Lets start this article with insert data into a table. You can insert data into table for database table operations in two ways:
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.
You can edit any records in similar two ways like datasheet view and SQL command.
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 5 > Type the new data as you per requirement.
Step 6 > Save your records.
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 –
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.
Place your cursor on the record in the table and do one of the following:
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.
Field properties are useful to restrict or enable data validation in the table.
To change the properties follow these steps:
The common properties are as following:
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.
As now you are familiar with the terms primary key and foreign key which is used for referential integrity. These keys link more than one table with each other. The referential integrity help to maintain the accuracy and consistency of data in the relational database. Let’s start an article referential integrity with advantages.
There are three types of relationships:
Now we will see how to create a relationship using OO base for referential integrity. By using relationship we are going to provide a connection or link or association between two tables. Hence it avoids data redundancy, in simple words, data duplicity can be avoided.
Create table to create relationship with primary key and foreign key. You can create relationship in two ways:
Follow the below given steps to create relationship in OO base.
Similarly, you can set the relationship of other types as well. When you add a relationship, the relation design window show one line that connects your tables.
Removing relationship is quite simple. You can remove this relationship using one of the following:
Edit relationship is quite similar to delete relationship, click on connecting lines and do right click on table and select edit option.
4 videos|27 docs|8 tests
|
|
Explore Courses for Class 10 exam
|