Class 12 LabFile (2)
Class 12 LabFile (2)
PRACTICAL FILE
COMPUTER SCIENCE
Code No.- 083
b) Create table student with following attributes Rollno, First name, Lname
name, Address(unique), Coursecode(foreign key)
Q2.
Person table
P_id Firstname Lastname Address city
1 Hari Om Tilaknagar 10 Delhi
2 Shyam Tomar Base 23 Bangalore
3 Petter Joseph Staff 20 Chandigarh
Orders table:
o_id orderno p_id
1 77895 3
2 44678 3
3 22456 2
4 24562 1
Specify the following constraints while creating table:-
1)p_id (person table)-primary key
2)first name-not null constraint
3)order no –unique constraint,not null
4)p_id(order table)-foreign key
5)o_id-primary key
4)try to delete a record from person table and find out the result
5)try to delete a record from order table and find out the result.
Q4. Display the details of the employee who draws maximum salary.
Q5. Display the details of those employees whose salary is greater than the average
salary in the organization.
Q6. Display the details of the employee whose Department location is Noida.
1.Create the Department table with fields: Dno(Primary Key), Dname, Dloc
Insert the following values
Dno Dname Dloc
10 Accounts New York
20 Research Dallas
30 Sales Chicago
40 Operation Boston
50 Payroll Dallas
2. Create the Employee table with fields: Empno(Primary Key), Ename, Salary,
Commission, Deptno(Foreign Key),Mgrid
Insert the following values
Empno Ename Salary Commissio Deptno Mgrid
n
75 Jones 20000 20
76 Martin 30000 30 75
77 Blake 40000 1400 30 75
78 Ford 10000 20
79 Tummes 20000 5000 10 78
3. Create the SalGrade table with fields: Grade, Lowsal, Highsal
Insert the following values
Grade Lowsal Highsal
A 10000 19000
B 20000 29000
C 30000 50000
4. Display Empno, Salary,Deptname of employees
5. Use table Alias & solve the above query again
6. Display Empno., ename,Grade and salary that should be greater than lowsal
and less than highsal
7. Retrieve name of employees where employee is also a manager.
8. Display Empno, Ename, Dname ,Dloc of all the employees using outer join
9. Display Empno, Ename, Dname ,Dloc of all the departments using outer
join
10.Retrieve employee no, employee name of all the employees along with their
manager no and manager name if any
Assignment 8
(Creating tables with constraints,Groupingfuctions)
1. Create table hotel and insert 3 records for the following attributes:-Hotelno
(primary key), Hotelname, city
2. Create table Room and insert 3 records for the following fields:- Room
no(primary key), hotelno(foreign key), type of room, price
3. Create table guest and insert 3 records into table:- Guest no(primary key),
gname, gaddress
4. Create table booking and insert 3 records for the following fields- Hotelno -
foreign key),guestno(foreign key),datefrom,dateto,roomno
6. List name and address of guest with booking for a hotel in ‘delhi’ ordered by
name