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

Assignment_4DBMS (1)

The document outlines the creation and management of two database tables: DEPARTMENT and FACULTY. It includes specifications for columns, data types, constraints, and the insertion of initial data for both tables. Additionally, it details the implementation of foreign key constraints and check constraints to maintain data integrity between the tables.
Copyright
© © All Rights Reserved
Available Formats
Download as DOC, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
2 views

Assignment_4DBMS (1)

The document outlines the creation and management of two database tables: DEPARTMENT and FACULTY. It includes specifications for columns, data types, constraints, and the insertion of initial data for both tables. Additionally, it details the implementation of foreign key constraints and check constraints to maintain data integrity between the tables.
Copyright
© © All Rights Reserved
Available Formats
Download as DOC, PDF, TXT or read online on Scribd
You are on page 1/ 3

1.

Create table DEPARTMENT

Column Name Data Type Size Constraints


DeptCode Varchar2 4 Not null, Primary key
DeptName Varchar2 40 Not null
HOD Varchar2 4 Not null
.

2. Insert values into DEPARTMENT table, as follows:

DeptCode DeptName HOD


IT Information Technology F201
EE Electrical Engineering F801
CSE Computer Science and Engineering F101
ECE Electronics Engineering F701
MCA Master of Computer application F301

3. Add a foreign key constraint in STUDENT against DeptCode column which references department.

© IT Department Page 1 of 3
4. Create table: FACULTY

Column Name Data Type Size Constraints


FacultyCode Varchar2 4 Primary key
FacultyName Varchar2 15 Not null
DateOfJoin Date Not null
DeptCode Varchar2 4 Not null

5. Insert appropriate values in the above table.

FacultyCode FacultyName DateOfJoin DeptCode


F101 S. RoyChoudhury 01-10-2005 CSE
F105 P. Roy 01-05-2006 CSE
F201 D. Dutta 24-08-2005 IT
F301 S. Paul 15-03-2003 MCA
F401 D. Majumdar 01-02-2002 IT
F501 N. Sanyal 31-12-2003 EE
F601 I. Majumdar 10-04-2000 ECE
F701 S. Ghosh 01-01-2004 ECE
F801 P. Das 15-06-2002 EE

6. Alter the table Faculty and add check constraint such that FacultyCode starts with ‘F’

© IT Department Page 2 of 3
7. Alter the table Faculty and add check constraint such DeptCode is either CSE,IT, MCA, EE, ECE

8. Add constraint : DeptCode of Faculty is foreign key and references DeptCode in Department.

9. Add Constraint: HOD of Department table is foreign key and references FacultyCode of Faculty.

© IT Department Page 3 of 3

You might also like