0% found this document useful (0 votes)
28 views6 pages

Us02cbca26 DBMS Practical

The document outlines practical assignments for a BCA course at Sardar Patel University, focusing on Database Management Systems. It includes tasks related to table creation, data retrieval, queries using functions, and joins across multiple tables. Each assignment specifies requirements for creating and manipulating various database tables, along with example records and queries to be executed.

Uploaded by

arpitchristian00
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)
28 views6 pages

Us02cbca26 DBMS Practical

The document outlines practical assignments for a BCA course at Sardar Patel University, focusing on Database Management Systems. It includes tasks related to table creation, data retrieval, queries using functions, and joins across multiple tables. Each assignment specifies requirements for creating and manipulating various database tables, along with example records and queries to be executed.

Uploaded by

arpitchristian00
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/ 6

SARDAR PATEL UNIVERSITY

BCA
Course : US02CBCA26
(Practical)

University examination duration : 2 Hours

 Practical based on US02CBCA25 : Database Management Systems-I

(Questions based on table creation/modification, data insertion/modification, query writing 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 char(10)
fname char(10)
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)
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

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

Column Name Data Type Constraints


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’
Records :

D_id Dname DCity Spec


D01 Dharmendra Patel Anand ENT
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 Name Data Type Constraints
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-JUNE-87 Surat M

TABLE NAME: treatment

Column Name Data Type Constraints


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

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

TABLE NAME: appointment

Column Name Data Type Constraints


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 Completed or ‘I’ for Incompleted

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 I
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 I
201808 D07 P08 T08 12-NOV-18 40 I
201809 D06 P09 T09 16-NOV-18 35 C
201810 D04 P10 T03 03-JUL-18 30 I
201811 D01 P04 T05 01-DEC-18 50 C
201812 D07 P07 T08 30-OCT-18 25 I

Assignment-3 || Single Table Retrieval

Using 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 where hired after 1st Sep ’81.
7 Display employees of which 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.

Page 4 of 6
Assignment-4 || Queries using Functions
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.
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.

Assignment-6 || Group by…having

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)

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>4000.
3 Display the total amount received by Dr. Mehul Patel.
4 Display all the doctors who are presently treating at least two patient.
5 Display total no. of patient treated by each doctor.

Assignment-9 || Sub query

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.

Assignment-10 || Updating and Alteration of table and Table Data

Updating and Alteration of table and Table Data


1 Change the size of cust_id of cust table with varchar2(20).
2 Change the size of fname and lname of cust table with varchar2(15).
3 Add the column gender char(1) in cust table.
4 Change the star of movie table with Axay Kumar whose mv_no is 1.
5 Change the the area with Surat of cust table whose cust_id is ‘a01’.

Page 6 of 6

You might also like