In this article, we will provide you with the Comprehensive notes on database table operations class 10.
Database table operations class 10
In this article, we will talk about insert data, edit records, delete records and sorting data in the table. The first operation of database table operations class 10 is insert record in the table.
Insert records in the table
Lets start this article with insert data into a table. You can insert data into table for database table operations class 10 in two ways:
- Datasheet View: This option is very simple and easy to insert a record.
- SQL View: This option provides a command to insert a record.
To insert data using datasheet view follow these steps:
Step 1 Open the database and select the table to insert a record.
Step 2 Now double click on the table name.
Step 3 A new screen appears with the title of table and database.
Step 4 Now insert records in the last row. Observe the above screenshot.
Step 5 Save the table when you finished.
To insert data using SQL mode follow these steps:
Step 1 > Open database.
Step 2 > Click on Tools > SQL. A new window appears with the title Execute SQL Statement.
Step 3 > Now type following command to insert record.
insert into "dept" ("dno","dname","loc") values (50,'TPP','Bhuj')
Step 4 >Now click on execute button and click on close button when you get the message “Command executed successfully. “
Step 5 > Click on close button.
Step 6 > Click View > Refresh Table option to see the updated table.
Observe the following screen shot:
You can avoid the column names if you are going to insert all records. Observe this command:
insert into "dept" values (60,'Hospital','Township')
The next operation is edit record operation for database table operations class 10.
Edit records in table
You can edit any records in similar two ways like datasheet view and SQL command.
Edit records in Datasheet view
Follow the below given steps:
Step 1 > Open your database to edit table.
Step 2 > Select your table and double click on it to open it.
Step 3 > Now place your cursor on the record which you want to edit.
Step 4 > Click on Edit > Edit Data or click on edit icon available on the standard toolbar or double click on data you want to edit.
Step 4 > Type the new data as you per requirement.
Step 5 > Save your records.
In the next section of database table operations class 10, we will see edit records through SQL.
Edit records through SQL
Open Execute SQL statement window. and type following command:
update "dept" set "deptno"=100 where "deptno"=10
The update command is used to edit records through SQL command. As you have seen in the above command –
- update – is a command to edit records
- tablename – it is a table in which the record needs to be updated
- set – This is a keyword used to set a new value
- columnname = new value – it is a columnname with new value
- where – it specifies the unique record of the table which is going to be deleted
- columnname = value – here the columnname is the column which is having a unique record and the value is a unique value
The next operation is delete records in database table operations class 10.
Delete records from the table
You can delete records from the table using datasheet view and execute SQL statement window. Open the database and table in datasheet view and open the table from you want to delete the record.
Delete record in datasheet view
Place your cursor on the record in the table and do one of the following:
- Click on Edit > Delete Record option. It will ask your confirmation to delete selected data with “Yes”/“No” button.
- Do Right-click and select delete option.
- Select the entire row, do right-click and choose the option Delete Rows and click on “Yes” button to confirm deletion.
Delete record using SQL view
Open Execute SQL statement window and write the following command:
delete from "dept" where "deptno"=100
It is almost similar like update with one difference that is, use delete from tablename command.
In the next section of database table operations class 10 we will see the common field properties for the OO base tables.,
Common field Properties
Field properties are useful to restrict or enable data validation in the table.
Data Validation refers to the set of rules and regulation for data input. So that incorrect data or invalid data can be avoided in the table.
To change the properties follow these steps:
- Open your database and select the table to change the properties.
- Right-click on a table and select edit option or Click on Edit > Edit option. That opens the table in design view.
- Now select the particular field to change the properties.
The common properties are as following:
- AutoValue – It provides Yes/No type option to accept the value automatically at the time of insertion.
- Entry Required – It is also Yes/No type option to make the field value mandatory at the time of insertion.
- Length – This option is used to specify the total length of the selected field.
- Default Value – This option provides a default value to your field if value is not inserted.
- Format Example – It allows to set your own format for the field values like email format, zip code format etc.
Lets talk about sorting data, as it is next topic given in your syllabus for database table operations class 10.
As you know that sorting rearranges the data in an ascending or descending order. To sort data in OO Base, follow these steps:
Step 1 > Select the column which you want to sort.
Step 2 > Now click on appropriate button from the toolbar as highlighted in above screen shot. Your datasheet displays the result accordingly.
In the next article, we will discuss about the referential integrity.
I hope you enjoyed this article and understood the concepts of database table operations class 10 in OO Base explained in this article. If you have any doubt or queries regarding this article, you are free to ask through comments.
Thank you for reading this article database table operations class 10. Share this article with your classmates and friends. Motivate us by hitting the like button to provide more and more concise and detailed study material.
Click here to access all the contents of unit 3 by this link.
Click on below given link to read comprehensive notes of IT 402.