Practical File Bca-Dbms Section A
Practical File Bca-Dbms Section A
Practical File Bca-Dbms Section A
PRACTICAL FILE
ON
DATABASE MANAGEMENT SYSTEM (BCA-4002 P)
SESSION: BCA 2022 IV SEMESTER SECTION-A (2023 -24)
SUBMITTED IN
PARTIAL FULFILLMENT FOR AWARD OF THE DEGREE OF
BACHELOR OF COMPUTER APPLICATION
CHHATRAPATI SHAHU JI MAHARAJ UNIVERSITY, KANPUR, UP
STUDENT SIGNATURE
STUDENT NAME
INDEX (DATABASE MANAGEMENT SYSTEM)
3c Populated Database
4b Insertion of records
4c Updating On Records
5 Queries testing on Populated
Database of Company
1.Notations of ER Model:
2.Ent
ity
DEPARTMENT: WORKS_ON:
PROJECT:
DEPENDENT: DEPT_LOCATIONS:
update employee
set super_ssn=888565555
where ssn=333445555;
update employee
set super_ssn=333445555
where ssn=999887777;
update employee
set super_ssn=987654321
where ssn=999887777;
update employee
set super_ssn=888665555
where ssn=987654321;
update employee
set super_ssn=333445555
where ssn=666884444;
update employee
set super_ssn=333445555
where ssn=453453453;
update employee
set super_ssn=987654321
where ssn=987987987;
update employee
set super_ssn=null
where ssn=888665555;
Alter table employee add(Dno number(1));
update employee
set Dno=5
where minit='B';
update employee
set Dno=5
where minit='T';
update employee
set Dno=4
where minit='J';
update employee
set Dno=4
where minit='S';
update employee
set Dno=5
where minit='K';
update employee
set Dno=5
where minit='A';
update employee
set Dno=4
where minit='V';
update employee
set Dno=1
where minit='E';
Query 3: For every project located in 'Stafford', list the project number, the controlling department
number, and the department manager's last name, address, and birthdate.
Q3: SELECT PNUMBER,DNUM,LNAME,BDATE,ADDRESS FROM
PROJECT,DEPARTMENT,EMPLOYEE WHERE DNUM=DNUMBER AND MGR_SSN=SSN
AND PLOCATION='Stafford'
Query 4: Make a list of all project numbers for projects that involve an employee whose last name is
'Smith' as a worker or as a manager of the department that controls the project.
Q4:SELECT PNAME FROM PROJECT,DEPARTMENT,EMPLOYEE WHERE
DNUM=DNUMBER AND MGR_SSN=SSN AND LNAME='Smith'
UNION (SELECT PNAME FROM PROJECT, WORKS_ON, EMPLOYEE WHERE
PNUMBER=PNO AND ESSN=SSN AND LNAME='Smith')
Query 8:Retrieve the SSN values and Department Name for all employees.
Q8:SELECT SSN, DNAME FROM EMPLOYEE, DEPARTMENT
Query 9:Retrieve the different SALARY values for all employees.
Q9 : SELECT DISTINCT SALARY FROM EMPLOYEE
Query 10: Retrieve the names of all employees who do not have supervisors.
Q10:SELECT FNAME, LNAME FROM EMPLOYEE WHERE SUPER_SSN IS NULL
Query 11: Retrieve the name of each employee who has a dependent with the same first name as the
employee.
Q11: SELECT E.FNAME, E.LNAME FROM EMPLOYEE E WHERE E.SSN IN (SELECT ESSN
FROM DEPENDENT WHERE ESSN=E.SSN AND E.FNAME=DEPENDENT_NAME)
Query 12: Retrieve the social security numbers of all employees who work on project number 1, 2,
or 3.
Q12:SELECT DISTINCT ESSN FROM WORKS_ON WHERE PNO IN (1, 2, 3)
Query 13: Find the maximum salary, the minimum salary, and the average salary among all
employees.
Q13:SELECT MAX(SALARY), MIN(SALARY), AVG(SALARY) FROM EMPLOYEE
Query 14: Find the maximum salary, the minimum salary, and the average salary among employees
who work for the 'Research' department.
Q14: SELECT MAX(SALARY), MIN(SALARY), AVG(SALARY) FROM EMPLOYEE,
DEPARTMENT WHERE DNO=DNUMBER AND DNAME='Research'
Query 18: For each project, retrieve the project number, project name, and the number of employees
who work on that project.
Q18: SELECT PNUMBER, PNAME, COUNT (*) FROM PROJECT, WORKS_ON
WHERE PNUMBER=PNO GROUP BY PNUMBER, PNAME
Query 19: For each project on which more than two employees work , retrieve the project number,
project name, and the number of employees who work on that project.
Q19: SELECT PNUMBER, PNAME, COUNT (*) FROM PROJECT, WORKS_ON
WHERE PNUMBER=PNO GROUP BY PNUMBER, PNAME HAVING COUNT (*) > 2
Query 20: Retrieve all employees whose address is in Houston, Texas. Here, the value of the
ADDRESS attribute must contain the substring 'HoustonTX'.
Q20: SELECT FNAME, LNAME FROM EMPLOYEE WHERE ADDRESS LIKE '%HoustonTX
%'
Query 21: Retrieve all employees who were born during the 1950s. Here, '5' must be the 9th character
of the string (according to our format for date), so the BDATE value is '________5_', with each
underscore as a place holder for a single arbitrary character.
Q21: SELECT FNAME, LNAME FROM EMPLOYEE WHERE BDATE LIKE '________5_'
Query 22: Show the effect of giving all employees who work on the 'ProductX' project a 10% raise.
Q22:SELECT FNAME, LNAME, 1.1*SALARY FROM EMPLOYEE, WORKS_ON, PROJECT
WHERE SSN=ESSN AND PNO=PNUMBER AND PNAME='ProductX'
Query 23: Retrieve a list of employees and the projects each works in, ordered by the employee's
department, and within each department ordered alphabetically by employee last name.
Q23: SELECT DNAME, LNAME, FNAME, PNAME FROM DEPARTMENT,
EMPLOYEE,WORKS_ON, PROJECT WHERE DNUMBER=DNO AND SSN=ESSN AND
PNO=PNUMBER ORDER BY DNAME, LNAME