Now after creating all the tables we need to insert values into those tables. For Insertion of values into the tables we the following syntax:
Insert into Table_Name Values ( ...)
1. Location Table
For the location Table, we have Location_id as an integer type of data, and City is a Character type data that is always with the' ' sign.
--Inserting Values into Location--
Insert into Location Values(122,'New York');
Insert into Location Values(123,'Dallas');
Insert into Location Values(124,'Chicago');
Insert into Location Values(167,'Boston');
Select * from Location;
- Insert into Location Values (values...) is used to insert values into a table.
- Select * from Location helps to display the table after the insertion of values.
Output
2. Job Table
--Insert into Job
insert into Job values(667,'Clerk');
Insert into Job values(668,'Staff');
Insert into Job values(669,'Analyst');
Insert into Job values(670,'Sales Person');
Insert into job values(671,'Manager');
Insert into Job values(672,'President');
select * from Job;
Output
3. Department Table
--Insert into Department
Insert into Department Values(10,'Accounting',122);
Insert into Department Values(20,'Sales',124);
Insert into Department Values(30,'Research',123);
Insert into Department Values(40,'Operations',167);
Select * from Department;
Output
4. Employee Table
--Insert Values into Employee
insert into employee values(1, 'Smith','John','Q',667,NULL,'17-Dec-84',800,NULL,20);
insert into employee values(2,'Allen','Kevin','J',670,1,'20-Feb-85',1600,300,30);
insert into employee values(3,'Doyle','Jean','K',671,2,'04-Apr-85',2850,NULL,30);
insert into employee values(4,'Dennis','Lynn','S',671,3,'15-May-85',2750,NULL,30);
insert into employee values(5,'Baker','Leslie','D',671,4,'10-Jun-85',2200,NULL,40);
insert into employee values(6,'Wark','Cynthia','D',670,5,'22-Feb-85',1250,500,30);
- Here, NULL represents that no value is present at a particular place.
- Date is always enclosed with the ' ' sign and is written in DD-MMM-YY format.
Output
Note:
- here is no different procedure to insert the primary key and the Foreign key.
- Make sure the value of the Primary key must be similar to that of its Foreign keys.