0% found this document useful (0 votes)
105 views

DBMS Lab 08

The document outlines 6 tasks related to creating and manipulating tables in a database: 1. Create new EMPLOYEE and DEPART tables from existing EMP and DEPT tables, with a primary key-foreign key relationship between them. 2. Insert 2 records into EMPLOYEE table linking employees to departments. 3. Update the name and salary of one employee record. 4. Delete any records from EMPLOYEE where job is analyst. 5. Try to update the DEPART table but receive an error because child records must be deleted first. 6. Try to insert a record into EMPLOYEE with a department that doesn't exist, receiving an error.

Uploaded by

Abdullah
Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
105 views

DBMS Lab 08

The document outlines 6 tasks related to creating and manipulating tables in a database: 1. Create new EMPLOYEE and DEPART tables from existing EMP and DEPT tables, with a primary key-foreign key relationship between them. 2. Insert 2 records into EMPLOYEE table linking employees to departments. 3. Update the name and salary of one employee record. 4. Delete any records from EMPLOYEE where job is analyst. 5. Try to update the DEPART table but receive an error because child records must be deleted first. 6. Try to insert a record into EMPLOYEE with a department that doesn't exist, receiving an error.

Uploaded by

Abdullah
Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 3

TASK NO 1

1. Create a new table EMPLOYEE replica of EMP table with no records in it.Create a new table
DEPART replica of DEPT table with all the records in it.Create a primary foreignkey relationship
between EMPLOYEE and DEPART tables.
TASK NO 2

2. Insert following records into EMPLOYEE using following values: EMPNO = 101, ENAME =
WASEEEM, SAL = 5000, JOB = CLERK and DEPTNO = 20. EMPNO = 102, ENAME = SAJID, SAL =
15000, JOB = ANALYST and DEPTNO = 10.

TASK NO 3
3. Change the record inserted in question 2 from ENAME WASEEM to KHALID and SAL 5000 to
10000.

TASK NO 4
4. Remove all the records from EMPLOYEE table having job = ANALYST.

TASK NO 5
5. Try to update the table DEPART and change the value of DEPTNO from 10 to 30. Find the error
and give the reason for the error.

Ans. Because depart is the parent table and to change any record in the parent table, the child
table must have that record null.
TASK NO 6
6. Insert a new record into EMPLOYEE using following values: EMPNO = 103, ENAME = SALEEM,
SAL = 60000, JOB = ANALYST and DEPTNO = 60. Find the error and give the reason for the error.
Ans. Because to enter any record in the child table, the parent table must contain that record. In
this case DEPTNO (60) is not present in the parent table so it cannot be entered in child table.

You might also like