dbms pdf
dbms pdf
Practical File
On
Database Management System Lab
BCA- 306
Session: 2022-23
4. Write a Query: 10
A) Find Average of Salaries of those Employees
having designation=”Asst. Manager”.[use of
where clause].
B) Find Id, Name, BasicSalary of those Employee
having Research Area=”Software Engineering”
and Gender=” Male”.
5. 11-12
Write a Query for: (Order By,
Group By and Having Clause)
Select EmpName, Salary from
table and Order ByEmpName.
Select Average Salary from table and Group By
Department.
[1]
QUERY : EMP 2- Personal Information of Employee
[2]
Practical No. 2
AIM: Write a Query for Inserting, Deleting, Updating, Alter, Drop Data of
Database Tables i.e,
1. Emp1 and Emp2 having 15 and Emp3 having 10 records.
2. Alter/Modify command perform alteration of attribute Type and Adding
New Column i.e., in Emp3 e.g. change the column name Date_of_Joining
toJoining_Date, Add Column in same Table Monthly_Salary_,
Yearly_Salary.
3. Drop Table Emp4.
QUERY : 1 – EMP_1
[3]
insert into Emp1
values(89,'Aris','BCA','coordinator','7488954127','[email protected]','MCA','so
ftware_engineering'),
(105,'Kasif','BCA','asst_manager','620645453','[email protected]','MCA','system
_engineering'),
(96,'ayan','BCA','asst_manager','8102660167','[email protected]','MCA','electric
_engineering'),(118,'Arif','BCA','manager','765543632','[email protected]','MC
A','web_engineering'),(129,'Akhilesh','BCA','asst_professor','76475826','mdk243@
gmail.com','MCA','web_designing'),
(101,'Sanjeev','BCA','asst_manager','81020167','[email protected]','MCA','softw
are_engineering'),
(107,'abhisek','BCA','asst_manager','8102360167','[email protected]','MCA','sof
tware_engineering'),
(1,'Njiya','MA','manager','7487369937','[email protected]','MCA','teacher'),
(2,'Chandni','BA','manager','8102360167','[email protected]','B_TECH','teacher,
(3,'Feziya','MCA','asst_manager','8102363467','[email protected]','MCA','softw
are_engineering'),
(107,'sana','B_TECH','asst_manager','8102360167','[email protected]','MCA','so
ftware_devloper'),
(93,'sogodogo','BCA','asst_manager','8106560167','[email protected]','MCA','so
ftware_engineering'),
(108,'abusalim','HM','food_manager','886545463','[email protected]','MCA','hot
el_management'),
(109,'sachin','HHA','front_office','6767545577','[email protected]','MCA','hotel_
management'),
(10,'imran','HHA','bilder','654424354','[email protected]','MCA','hotel_manage
ment');
[4]
QUERY : EMP_1
QUERY :1 – EMP_2
[5]
QUERY : EMP_2
QUERY : 1 – EMP_3
[6]
QUERY : EMP_3
QUERY: 2
[7]
Practical No. 3
AIM: Write a Query for using:
Primary Key Constraints on EMP_ID Column,
Unique Key Constraints on EMP_CONTACT Column,
Not Null Key Constraints on EMP_QUALIFICATION Column,
EMP_RESEARCH_AREA Column. Also use Foreign key Constraints in
“EMP2 tables not on EMP3. Apart from use Check Constraints for
EMP_BASIC_SALRY i.e., it shouldn’t greater than Rs. 30000 of any employee.
QUERY 1:
• Primary key constraints on Emp_Id.
QUERY 2:
• Unique key constraints on EMP_CONTACT
[8]
QUERY 3:
• Not null key constraints on EMP_QUALIFICATION
QUERY 4:
• Foreign key constraints in “EMP2” table not on “EMP3”.
QUERY 4:
• Check Constraints for EMP_BASIC_SALRY i.e., it shouldn’t greater than Rs. 30000 of
any employee.
[9]
Practical No. 4
QUERY 2:
❖ Find Id, Name, BasicSalary of those Employee having Research
Area=”Software Engineering” and Gender=” Male”
[10]
Practical No. 5
[11]
QUERY 2:
• Select Average Salary from table and Group By Department.
select avg (Emp3.Emp_Basic_Salary),Emp1.Emp_Dept
from Emp3
join Emp1
on Emp3.Emp_Id=Emp1.Emp_Id
group by Emp1.Emp_Dept;
QUERY 3:
• Select Average Salary from table and Group By Department Having
Designation Asst_manager.
[12]
[13]