Us02cbca26 DBMS Practical
Us02cbca26 DBMS Practical
BCA
Course : US02CBCA26
(Practical)
(Questions based on table creation/modification, data insertion/modification, query writing may be asked)
Page 1 of 6
B. Single Table Retrieval
1 Display entire content of cust table.
2 Display customer first name with their area.
3 Display customer with their fname and last name whose cust_id is a01 or a02.
4 Display all the records from cust table whose cust_id is a02 and area is Surat.
5 Display customer details who does not have phone number.
6 Display entire content of movie table.
7 Display all details of movie whose price is greater than 200.
8 Display title and type of movie whose price is greater than 150 and less than 200.
9 Display movie details whose movie type is Comedy or Action.(Using IN and OR operator)
10 Display movie details whose movie type is Suspense and price is greater than 180.
11 Display title, star and price of comedy movie.
12 Display distinct movies types.
13 Display movies details in ascending order of movie title.
14 Display movies details in descending order of movie price.
15 Display movie details whose type is Romantic or Action and price less than 200.
Assignment 2: (Table Creation with Constraints)
TABLE NAME: dept
Column Name Data Type Constraints
deptno number(2) Primary Key
dname varchar2(15)
loc varchar2(15)
Records :
deptno dname loc
10 Accounting New York
20 Research Dallas
30 Sales Chicago
40 Operations Boston
TABLE NAME: emp
Column Name Data Type Constraints
empno number(4) Primary Key
ename varchar2(10)
job varchar2(10)
mgr number(4)
hiredate date
sal number(7,2)
comm number(7,2)
deptno number(2) Reference to dept table
Records:
empno ename job mgr hiredate sal comm deptno
7369 Smith Clerk 7902 17-DEC-80 800 20
7499 Allen Salesman 7698 20-FEB-81 1600 300 30
7521 Ward Salesman 7698 22-FEB-81 1250 500 30
7566 Jones Manager 7839 02-APR-81 2975 20
7654 Martin Salesman 7698 28-SEP-81 1250 1400 30
7698 Blake Manager 7839 01-MAY-81 2850 30
7782 Clark Manager 7839 09-JUN-81 2450 10
7788 Scott Analyst 7566 09-DEC-82 3000 20
7839 King President 17-NOV-81 5000 10
7844 Turner Salesman 7698 08-SEP-81 1500 0 30
7876 Adams Clerk 7788 12-JAN-83 1100 20
7900 James Clerk 7698 03-DEC-81 950 30
7902 Ford Analyst 7566 03-DEC-81 3000 20
7934 Miller Clerk 7782 23-JAN-82 1300 10
Page 2 of 6
TABLE NAME: doctor
Page 3 of 6
Records :
T_id Tdetails Charges
T01 Retina 1200
T02 Root Canal 400
T03 Sleep Apnea 600
T04 Glaucoma 1500
T05 Tonsil 200
T06 Knee Replacement 500
T07 Ear Infection 400
T08 Spine 600
T09 Tooth Extraction 1000
Page 4 of 6
Assignment-4 || Queries using Functions
Queries using Functions
Group by…having
1 Display total no. of employee working is each department.
2 Find total no. of salesman and clerk in each department.
3 Find maximum salary of emp in each department.
4 Display dname and average salary of each department.
5 Display jobwise commission.
6 Display total salary of clerk and analyst of each department.
7 Display ename , dnmae and deptno of employee whose maximum salary greater than 5000.
8 Display deptno and salary whose department have more than 2 employee
9 Display deptno and salary whose total salary of employee is lessthan 2000.
10 Display total no of patient citywise.
11 Display total no. of doctors for each specialization.
12 Display total no of male patient citywise.
13 Display total no. of doctors for eye specialization.
Assignment-7 || Joins
Joins
1 Display ename and dname of employee who working in Accounting department.
2 Display deptno , dname and ename of employee in sales department whose sal>2000
3 Display ename, dname of emp in research department whose enmae start with ‘A’.
4 Display ename, dname and sal of emp working as ‘clerk’ or ‘salesman’.
5 Display dname, ename,deptn of emp hired before ’01-sep-81’,
6 Display treatment details with their charges.
7 Display patients name and their appointment date.
8 Display doctor name, specialization and their appointment date.
9 Display treatment details whose charges is greater than 500.
10 Display patients name and their appointment date whose appointment date in the month of
December.
11 Display doctor name , patient name and treatment details with their charges.
12 Display detailed list of appointments for dr. Dharmendra Patel.
13 Display patient name who was treted by Dr. Mehul Patel.
14 Display patient name whose treatment is not completed.
15 Display the age of all male patients who are presently undergoing treatment.
16 Display employee name with their manage name.
Page 5 of 6
Assignment-8 || Group by….having (Multiple Tables)
Sub query
1 Display empno, ename and salary whose salary is same as ‘WARD’s salary.
2 Display empno, ename and job who are working in same as
3 List the treatment details which treated in anand.
4 Display patient name with age greater than 28 years and completed their treatment.
5 Display doctor name who have treated male patients.
Page 6 of 6