0% found this document useful (0 votes)
21 views8 pages

Us03mabca03-Part-2 DBMS-1 Practical List

DBMS

Uploaded by

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

Us03mabca03-Part-2 DBMS-1 Practical List

DBMS

Uploaded by

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

SYBCA (Sem-3)

Course : US03MABCA03-Part-2 (DBMS-1)


(Practical)

Part-II : Weightage-60%
 Practical based on US03MABCA02 : Database Management Systems-I

(Questions based on table creation/modification, data insertion/modification, query writing


and object creation (e.g. view, synonym, and sequence may be asked)

Assignment 1: (Table Creation and Single Table Retrieval)

A. Table creation without constraints:


a. Customer Master table : cust

Column Name Data Type


cust_id varchar2(5)
lname varchar2(15)
fname varchar2(15)
Area varchar2(10)
phone_no number(10)

Records:

cust_id Lname fname Area phone_no


a01 Patel Ajay Anand 381334
a02 Shah Anjali Surat 556037
a03 Thakkar Vinay Baroda 372631
a04 Joshi Kamal Surat 666612
a05 Pandya Rohan Anand
a06 Patel Kajal Baroda 512527

b. Movies Master table: movie

Column Name Data Type


mv_no number(5)
Title varchar2(25)
Type varchar2(10)
Star varchar2(25)
Price number(8,2)

Page 1 of 8
Records:

mv_no Title type star price


1 Hera Pheri Comedy Paresh Raval 105
2 Kuch Kuch Hota Hein Romantic Kajol 225.00
3 Drashyam Suspense Ajay Devagan 250
4 Welcome Comedy Anil Kapoor 200.00
5 Gupt Suspense Bobby Deol 195
6 Tere Naam Romantic Salman Khan 190
7 Hungama Comedy Akshay Khanna 135
8 Ajanabee Suspense Akshay Kumar 165
9 No Entry Comedy Anil Kapoor 220
10 Singham Action Ajay Devagan 195

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 Data Type Constraints


Name
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

Page 2 of 8
TABLE NAME: emp

Column Data Type Constraints


Name
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

TABLE NAME: doctor

Column Data Type Constraints


Name
d_id varchar2(3) Primary Key, Must start with D
dname varchar2(25)
DCity varchar2(20) Must be ‘Anand’,’Baroda’ or ‘Nadiad’
spec varchar2(20) Must be in ‘ENT’, ‘Dental’,’Ortho’ and ‘Eye’

Page 3 of 8
Records :

D_id Dname DCity Spec


D01 Dharmendra Anand ENT
Patel
D02 Jinay Shah Nadiad Eye
D03 Sonal Patel Anand Dental
D04 Mehul Patel Anand ENT
D05 Mahesh Patel Baroda Ortho
D06 Neerav Parmar Nadiad Dental
D07 Niraj Shah Anand Ortho
D08 Mukesh Kotiya Baroda Eye

TABLE NAME: patient

Column Data Type Constraints


Name
P_id varchar2(3) Primary Key, Must start with P
Pname varchar2(25)
Bdate date Less than system date
Paddr Varchar2(35)
Gender Char(1) Check either ‘F’ or ‘M’, default ‘M’;

Records :

p_id Pname Bdate paddr Gender


P01 Rupal Patel 12-SEP-98 Anand F
P02 Kalpesh Shah 04-SEP-99 Baroda M
P03 Kavita Joshi 23-OCT-87 Surat F
P04 Sachin Pandya 04-FEB-89 Anand M
P05 Brijisha Patel 15-MAR-95 Nadiad F
P06 Mayank Shah 16-MAY-65 Baroda M
P07 Mitul Soni 27-AUG-96 Anand M
P08 Krunal Pandya 20-JAN-70 Rajkot M
P09 Rinkal Bhatt 14-APR-95 Navsari M
P10 Pratik Solanki 22-JUN-87 Surat M

TABLE NAME: treatment

Column Data Type Constraints


Name
T_id varchar2(3) Primary Key, Must start with T
Tdetails varchar2(50)
Charges Number(5) Must be greater than 0

Page 4 of 8
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

TABLE NAME: appointment

Column Data Type Constraints


Name
A_id Number(6) Pimary Key
d_id varchar2(3) References to doctor table
P_id varchar2(3) References to patient table
T_id varchar2(3) References to treatment table
App_date Date
Duration Number(4)
Status Char(1) Either ‘C’ for Confirmed or ‘W’ for Waiting

Records:
A_id d_id P_id T_id App_date Duration Status
201801 D02 P01 T01 01-DEC-18 20 C
201802 D03 P02 T02 12-OCT-18 35 C
201803 D04 P03 T03 26-DEC-18 30 W
201804 D08 P04 T04 01-JAN-18 25 C
201805 D01 P05 T05 11-SEP-18 40 C
201806 D05 P06 T06 23-SEP-18 45 C
201807 D04 P07 T07 16-JAN-18 55 W
201808 D07 P08 T08 12-NOV-18 40 W
201809 D06 P09 T09 16-NOV-18 35 C
201810 D04 P10 T03 03-JUL-18 30 W
201811 D01 P04 T05 01-DEC-18 50 C
201812 D07 P07 T08 30-OCT-18 25 W

Page 5 of 8
Assignment-3

Single Table Retrieval for emp table


1 Display employee number and name from emp table.
2 Display job from emp table, removing duplicate values.
3 Display employees of which are not in department 20.
4 Display employees, whose name begins with ‘J’.
5 Display all employees who receive commission.
6 Display employees of department 10 and who hired after 1st Sep ’81.
7 Display employees who are not in department 20.
(Use all the alternatives)
8 Display employee details like name, job and salary with user defined heading for all.
9 List employee name, salary, PF, HRA, DA & GROSS order the result in ascending
order of salary.(PF = 10% salary, HRA=50%, DA=30%,GROSS=SAL+HRA+DA-PF)
10 Display names of all the employees along with their annual salary.
11 Display employees, whose name begins with ‘J’.
12 Display all employees whose name begins with ‘J’ and has ‘N’ as the 3rd character.
13 Display emp details whose job is Clerk, Salesman or Analyst.
14 Display emp details whose name begins with ‘J’ and job is ‘Clerk’.
15 Display emp details in descending order of their name.

Assignment-4

Queries using Functions

1. Display empno, ename in uppercase and salary form emp table.


2 Display empno, ename in lower case and job form emp table whose sal>300
3 Display maximum salary and minimum salary from emp table.
4 Display total salary and average salary from emp table whose deptno is 10.
5 Display total no of employee working in deptno 20 and 30.

Assignment-5

Queries using Date.


1 Display empno,enameand salary with hiredate. The format of hiredate is 12th Jan,1981.
2 Display empno,enameand job and salary with hiredate. The format of hiredate is
twelveth January,81.
3 Display empno,ename and job and salary who hired in the month of September.
4 Display empno,ename and commision who hired on Monday
5 Find the date,15 days after today’s date.
6 Display all records from emp table whose working experience is more than 20 years.

Page 6 of 8
Assignment-6

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
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 7 of 8
Assignment-8

Group by….having (Multiple Tables)


1 Display deptno, dname and total no. of employee for each department.
2 Display dname,total salary paid to all clerk for each department.
3 Display dname, minimum salary paid to all salesman for each department whose
minimum salary>400.
4 Display the total amount received by Dr. Mehul Patel.
5 Display all the doctors who are presently treating at least two patient.
6 Display total no. of patient treated by each doctor.

Assignment-9

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 ‘Scott’.
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.

Assignment 10 (View)

Table structure:
Dept11 (dept_id number(5) primary key, Emp11(emp_id number(3) primary key,
dept_name varchar2(20) not null) emp_name varchar2(20) not null,
emp_sal number(8,2),
dept_id number(5) references
dept)

1 WAQ to create a view having name “emp_vw” which contains emp_id, emp_name and
salary from emp table.
2 WAQ to add new records in “emp” table using “emp_vw” view.
3 WAQ to update salary of JOHN from 2000 to 5000.
4 WAQ to create a read only view having name “emp_ro_vw” which contains emp_id,
emp_name and salary.
5 WAQ to view having name which contains emp_name, emp_sal and dept_name from
dept and emp table.

Assignment 11 (sequence)

1 Create sequence “seq1to10” which is start with 1 and ends with 10.
2 Create sequence “seq_even” which is generates with even numbers
between 100 and 500.
3 Create sequence “seq_rev” in a way that produce Z-A repetitive.
4 Create sequence “seq_div3”, it generates the number which is divisible by
3 and numbers are between 3 and 23.
5 Create sequence “seq_5” which is generates the numbers between 5 and
250, it start with 5 increment by 5, end with 250, cache value 5 and also the
numbers are in order.

Page 8 of 8

You might also like

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy