Professional Documents
Culture Documents
Assignment 1 DBMS Solution by Jaya
Assignment 1 DBMS Solution by Jaya
Assignment 1 DBMS Solution by Jaya
Jaya Das
Roll No:30011218009
Assignment-1
Subject : Advanced Database Management System Lab
Subject Code : PGCSE291/PGSE291
Output:
Table created
Query:
INSERT INTO DEPARTMENT(DeptCode, DeptName, HOD) VALUES ('IT',
'Information Technology','F201');
Output:
1 row created.
Query:
INSERT INTO DEPARTMENT(DeptCode, DeptName, HOD) VALUES ('BIO',
'Bio Technology','F901');
Output:
1 row created
Query:
INSERT INTO DEPARTMENT(DeptCode, DeptName, HOD) VALUES ('NS',
'Natural Science','F506');
Maulana Abul Kalam Azad University of Technology, West Bengal
Output:
1 row created.
Query:
INSERT INTO DEPARTMENT(DeptCode, DeptName, HOD) VALUES ('CSE',
'Computer Science and Engineering','F101');
Output:
1row created
Output:
Table created
Query:
Output:
Table created
Query:
INSERT INTO FACULTY(FacultyCode, FacultyName, DateOfJoin, DeptCode)
VALUES ('F101', 'M. Sinha','2005-01-01','CSE');
Output:
1 row created.
Query:
Query:
INSERT INTO FACULTY(FacultyCode, FacultyName, DateOfJoin, DeptCode)
VALUES ('F201', 'S. Mazumder','2005-09-15','IT');
Output:
1 row created.
Query:
Query:
Maulana Abul Kalam Azad University of Technology, West Bengal
Query:
INSERT INTO FACULTY(FacultyCode, FacultyName, DateOfJoin, DeptCode)
VALUES ('F808', 'K. Das','2010-06-15','IT');
Output:
1 row created.
Query:
Output:
1 row created.
6. Alter the table Faculty and add check constraint such that FacultyCode
starts with ‘F’
Query:
ALTER TABLE FACULTY
ADD CONSTRAINT My_Constraint CHECK(FacultyCode like 'F%');
Output:
Table altered.
7. Alter the table Faculty and add check constraint such DeptCode is
either CSE,IT, BIO,NS
Query:
ALTER TABLE FACULTY ADD CHECK(DeptCode IN (‘CSE’,’IT’,’BIO’,’NS’));
Maulana Abul Kalam Azad University of Technology, West Bengal
Output:
Table altered
Query:
Query:
Output:
Output:
Maulana Abul Kalam Azad University of Technology, West Bengal
12. Show the names of the heads of departments with department name.
Query:
SELECT HOD, DeptName, FacultyName FROM DEPARTMENT
FULL JOIN FACULTY ON FacultyCode=HOD;
Output:
Query:
update faculty set salary=45823.00 where FacultyCode='F101';
update faculty set salary=458856.00 where FacultyCode='F201';
update faculty set salary=528856.00 where FacultyCode='F301';
update faculty set salary=522456.00 where FacultyCode='F401';
update faculty set salary=350426.00 where FacultyCode='F506';
update faculty set salary=452106.00 where FacultyCode='F607';
update faculty set salary=252106.00 where FacultyCode='F704';
update faculty set salary=201406.00 where FacultyCode='F808';
update faculty set salary=651406.00 where FacultyCode='F901';
update faculty set salary=658796.00 where FacultyCode='F902';
Output:
17. Find the name, department of the faculties who earn between 8000 and
12000.
Query:
select FacultyName,DeptCode from faculty where salary >8000.00 AND salary<12000.00;
Output:
Maulana Abul Kalam Azad University of Technology, West Bengal
Output:
20. Find the name of the faculty who has completed 5 years.
Query:
select facultyname from faculty where To_Char(sysdate,'yyyy')
to_char(dateofjoin,'yyyy')>=5;
Output: