0% found this document useful (0 votes)
17 views5 pages

DBMS LAB ASSgn-2 DC

The document contains SQL code for 13 questions on database operations like creating tables, inserting values, updating fields, renaming tables, and retrieving data. The code creates Employee and Department tables, inserts sample records, modifies field values, renames fields and tables, and runs queries to display results.

Uploaded by

chaithanya021dc
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
17 views5 pages

DBMS LAB ASSgn-2 DC

The document contains SQL code for 13 questions on database operations like creating tables, inserting values, updating fields, renaming tables, and retrieving data. The code creates Employee and Department tables, inserts sample records, modifies field values, renames fields and tables, and runs queries to display results.

Uploaded by

chaithanya021dc
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 5

DBMS LAB ASSIGNMENT-2

NAME:KSHITIJ PATHAK
REG.No.:22BCE20232
Slot: L23+24

Q7: Display salary of the employees without duplications.


CODE:
Create table Employee(FName varchar(10),LName varchar(10), SSN integer,
Address varchar(10), Salary integer, Birthday date, Sex varchar(10), DepartNo
integer, SupervisorSSN integer);
Insert into Employee values('SUNIL', 'SINGH', 222,'VIJAYAWADA', 99999, '12-JAN-
2024', 'MALE', 222, 007);
Select Salary from Employee;

Q8: Display the MgrSSN, MgrStartDate of the manager of


‘Finance’ department.
CODE:
Create table Department(DeptNo integer, DeptName varchar(10), MgrSSN
integer, MgrStartDate date);
Insert into Department values(25, 'SCOPE', 745, '12-JAN-2024');
Insert into Department values(22, 'SENSE', 765, '12-JAN-2024');
Insert into Department values(20, 'MATH', 883, '12-JAN-2024');
Insert into Department values(12, 'Finance', 557, '19-JAN-2024');
Select MgrSSN, MgrStartDate from Department where DeptName='Finance';

Q9:Modify the department number of an employee having


fname as ‘Joyce’ to 5.
CODE:
Create table Employee(SerialNo integer, FName varchar(10),DeptNo
integer, Department varchar(10));
Insert into Employee values(1, 'Jeston', 3, 'Sports');
Insert into Employee values(2, 'Joyce', 9, 'Physics');
Select* from Employee;
Update Employee set DeptNo=5 where FName='Joyce';
Select* from Employee;
Q10:Alter Table department add column DepartmentPhoneNum of
NUMBER data type and insert values into this column only.
CODE:
Create table Department(DeptNo integer, DeptName varchar(10), MgrSSN
integer, MgrStartDate date, DeptPhNo integer);
Insert into Department values(25, 'SCOPE', 745, '12-JAN-2024',
999999999);
Insert into Department values(22, 'SENSE', 765, '12-JAN-2024',
100010101);
Insert into Department values(20, 'MATH', 883, '12-JAN-2024',
1120202020);
Insert into Department values(12, 'Finance', 557, '19-JAN-2024',
2020202020);
Select* from Department;
update Department set DeptPhNo=222222222 where DeptNo=20 ;
Select* from Department;
Q12:Modify the field name DepartmentPhoneNum of
departments table to PhNo.
CODE:
Create table Department(DeptNo integer, DeptName varchar(10), MgrSSN
integer, MgrStartDate date, DeptPhNo integer);
Insert into Department values(25, 'SCOPE', 745, '12-JAN-2024',
999999999);
Insert into Department values(22, 'SENSE', 765, '12-JAN-2024',
100010101);
Insert into Department values(20, 'MATH', 883, '12-JAN-2024',
1120202020);
Insert into Department values(12, 'Finance', 557, '19-JAN-2024',
2020202020);
Select* from Department;
Alter Table Department Rename column DeptPhNo to PhNo;
Select* from Department;
Q13:Rename Table Department as DEPT.
CODE:
Create table Department(DeptNo integer, DeptName varchar(10), MgrSSN integer,
MgrStartDate date, DeptPhNo integer);
Insert into Department values(25, 'SCOPE', 745, '12-JAN-2024', 999999999);
Insert into Department values(22, 'SENSE', 765, '12-JAN-2024', 100010101);
Insert into Department values(20, 'MATH', 883, '12-JAN-2024', 1120202020);
Insert into Department values(12, 'Finance', 557, '19-JAN-2024', 2020202020);
Alter Table Department Rename to DEPT;

You might also like