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

Dbms-Practice-Case-Studies-For Practical

The document outlines a series of SQL exercises related to database management systems, focusing on creating and manipulating tables for players, countries, colleges, departments, and customers. It includes tasks such as creating tables, inserting data, modifying attributes, and querying specific information. Each exercise is structured with clear requirements and examples of the expected output.
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)
5 views8 pages

Dbms-Practice-Case-Studies-For Practical

The document outlines a series of SQL exercises related to database management systems, focusing on creating and manipulating tables for players, countries, colleges, departments, and customers. It includes tasks such as creating tables, inserting data, modifying attributes, and querying specific information. Each exercise is structured with clear requirements and examples of the expected output.
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

Dept of Computer Engg.

Sub : DBMS Practical & Oral Exam


-----------------------------------------------------------------------------------------------------------------------------
Example no 1a : Player Relation (T1)

Pid Pname Role Age Runs Wicket Tid


Number(4) Varchar2(20) Varchar2(20) Number(2) Number(10) Number(10) Number(3)
1001 Sachin Batsman 25 10000 45 101
1002 Jaywardhne Captain 29 5000 102
1003 Kapil Bowler 30 2000 470 103
1004 Clark Batsman 27 3000 120 104
1005 Gautam Batsman 28 20000 101
1006 Rahul Batsman 22 15000 101
1007 Vas Bowler 28 3000 480 102
1008 Flintop Bowler 24 6200 190 103
1009 Hussy Batsman 29 2900 104
1010 Murlidharan Bowler 31 1800 500 102
1011 Laxman Batsman 21 5200 101
1112 Dhoni Wicketkeeper 24 4500 101
Country (T2)
Tid Cname
Number(3) Varchar2(15)
101 India
102 Shrilanka
103 England
104 Australia
105 South Africa

Write SQL statement with Output for the following:


1. Create Player and country table with above mentioned schema.(eg : player & ur Rno eg player59)
2. Insert all tuples in both the tables.
3. Add new attribute No of Matches (NOM) in player table with number (4).
4. Modify the NOM attribute value by 75 to all Players.
5. List the Player names, who are not taking wickets.
6. Display names of players in lower and upper case.
7. List the name, runs, and strike rate (SR) of all players. (SR is run/NOM)
8. List the Different roles available.
9. List the player’s details not belonging to the teamid 101, 102, 104.
10. List the Player Name and runs, whose runs are in the range of 10000 and 20000.
11. List the total runs, highest runs and average runs of players teamid wise for the tid 101 and display
only those rows having average runs grater than 1500 and arrange the result in Descending order of
the total runs.
12. Display the list of Players in each country. Display the country information even if no player is
belong to that country.
13. Display the names of player having runs same as that of player VAS.
14. Write PL SQL program to find total player in the player table.
15. Display the different roles present in Tid 101 and 102.
Dept of Computer Engg. Sub : DBMS Practical & Oral Exam
-----------------------------------------------------------------------------------------------------------------------------
Example no 1b : Player Relation (T1)

Pid Pname Role Age Runs Wicket Tid NOM


Number(4) Varchar2(20) Varchar2(20) Number(2) Number(10) Number(10) Number(3) Num(3)
1001 Sachin Batsman 25 10000 45 101
1002 Jaywardhne Captain 29 5000 102
1003 Kapil Bowler 30 2000 470 103
1004 Clark Batsman 27 3000 120 104
1005 Gautam Batsman 28 20000 101
1006 Rahul Batsman 22 15000 101
1007 Vas Bowler 28 3000 480 102
1008 Flintop Bowler 24 6200 190 103
1009 Hussy Batsman 29 2900 104
1010 Murlidharan Bowler 31 1800 500 102
1011 Laxman Batsman 21 5200 101
1112 Dhoni Wicketkeeper 24 4500 101
Country (T2)
Tid Country
Number(3) name
Varchar2(15)
101 India
102 Shrilanka
103 England
104 Australia
105 South Africa

Write SQL statement with Output for the following:


1. Create Player and country table with above mentioned schema. .(eg : player & ur Rno eg player59)
2. Insert all tuples in both the tables.
3. Modify the width of NOM to number (4) player table.
4. Modify the NOM attribute value by 75 to all Players.
5. List the names of batsman for the Tid = 101.
6. Display name of the country which contains ‘N’ character in country name.
7. List the name, runs, and strike rate (SR) of all players. (SR is run/NOM)
8. List the Different Tid’s present in Player relation.
9. List the Names of Employee ending with ‘N’.
10. List the Player Name and runs, whose runs are in the range of 2000 and 8000.
11. List the total runs, highest runs and average runs of players teamid wise for the tid 101 and display
only those rows having average runs grater than 1000 and arrange the result in ascending order of
the total runs.
12. Display the pid, pname, tid, Country name for all players.
13. List the names of player belonging to tid of SACHIN.
14. Create a new View with three attributes pname, page and avg runs.
15. List common roles in Tid 102 103.
Dept of Computer Engg. Sub : DBMS Practical & Oral Exam
-----------------------------------------------------------------------------------------------------------------------------
Example No2a : College :

SNO DOA PCM


(Primary SNAME Year (Date of Marks DEPTNO
key) Varchar2(20) Char(15) Admission) (PCM) Number(2)
Number(4) Date Number(3)
7369 Adams First 01-jun-08 275 20
7499 Brooks Second 01-Jun-07 265 10
7521 Curry Second 01-Jun-07 255 30
7566 Glenn Third 01-jun-06 215 30
7654 Green Second 01-Jun-07 220 30
7698 Hayes Third 01-jun-06 235 30
7782 Johnson Third 01-jun-06 290 10
7783 Jones Third 01-jun-06 189 20
7839 Lindsay Final 01-jun-05 175 10
7844 Smith Second 01-Jun-07 263 30
7876 Turner First 01-jun-08 285 20
7900 Williams First 01-jun-08 275 30
7902 Adams Third 01-Jun-06 274 20
7934 Brooks First 01-jun-08 167 10
Department : -
DEPTNO DNAME
Primary key Varchar2(20)
Number(2)
10 Computer
20 Electronics
30 Civil
40 Chemical

Write SQL statement with Output for the following:


1. Create College and Department table with above mentioned schema.
2. Insert all tuples in both the tables.
3. Add new attribute Sports Marks (SM) in college table with number (2).
4. Modify the SM attribute value by 15 to students related to department 10.
5. List the Student names, which are eligible for Sports marks.
6. Display only names of students (first letter of name in capital only).
7. List the name, PCM marks, and percentage of all students.
8. List the Different years in college table.
9. List the player’s details not belonging to the teamid 20, 30 40.
10. List the Students Name and PCM marks, whose PCM are in the range of 250 and 300.
11. List the total pcm, highest pcm and average pcm of students deptno wise for the department no
30 and display only those rows having average pcm grater than 250 and arrange the result in
Descending order of the total pcm.
12. Display the list of Students in each department. Display the department information even if no
students is belong to that department.
13. Display the names of student having pcm marks same as that of student ‘Williams’.
14. Write PL SQL program to find total no of students in the student table.
15. Display the different year present in department no 10 and 20.
Dept of Computer Engg. Sub : DBMS Practical & Oral Exam
--------------------------------------------------------------------------------------------------------------------
Example No2b : College :
SNO SNAME Year DOA PCM SM DEPTNO
(Primary Varchar2(20) Char (Date of Marks (Sports Number(2)
key) (15) Admission) (PCM) Marks)
Number(4) Date Number(3) Number(3)
7369 adams First 01-jun-08 275 20
7499 brooks Second 01-Jun-07 265 30
7521 curry Second 01-Jun-07 255 30
7566 glenn Third 01-jun-06 215 20
7654 green Second 01-Jun-07 220 30
7698 hayes Third 01-jun-06 235 30
7782 johnson Third 01-jun-06 290 10
7783 jones Third 01-jun-06 189 20
7839 lindsay Final 01-jun-05 175 10
7844 smith Second 01-Jun-07 263 30
7876 turner First 01-jun-08 285 20
7900 williams First 01-jun-08 253 30
7902 adams Third 01-Jun-06 274 20
7934 brooks First 01-jun-08 167 10
Department : -
DEPT NO DNAME
Primary key Varchar2(20)
Number(2)
10 Computer
20 Electronics
30 Civil
40 Chemical

Write SQL statement with Output for the following:


1. Create College and Department table with above mentioned schema.
2. Insert all tuples in both the tables.
3. Modify the width of SM to number (4) college table.
4. Modify the SM attribute value by 10 to students related to department 20.
5. List the names of second year students for the department 10.
6. Display name of the names of students ending with char ‘s’.
7. List the name, PCM marks, and percentage of all students.
8. List the Different department nos present in college table.
9. List the Names of Employee ending with ‘N’.
10. List the Student Name and DOA who have taken admission after 01-Jun-07 and before 01-Jun-
08.
11. List the total pcm, highest pcm and average pcm of students deptno wise for the department no
20 and display only those rows having average pcm grater than 250 and arrange the result in
ascending order of the total pcm.
12. Display the student name, year, deptno, Name of the department all students.
13. List the names of students belonging to department of ‘Smith’.
14. Create a new View with three attributes sno, sname, pcm marks.
15. List common years in department no 10 and 20.
Dept of Computer Engg. Sub : DBMS Practical & Oral Exam
-----------------------------------------------------------------------------------------------------------------------------
Example 3a : Customer :

Acno cname cstreet ccity Balamt Loanno Loanamt Branchcode


(Customer Varchar2(20) Varchar2(20) Number(9,2) Char(4) Number(9,2) Number(2)
Char(6) Name)
Varchar2(20)
A-101 Adams Spring Pittsfield 9000 L-1 5000 10
A-201 Brooks Senator Brooklyn 8000 20
A-301 Curry North Rye 4500 L-2 2000 10
A-401 Glenn Sand Hill Woodside 8900 20
A-501 Jones Main Harrison 3784 10
A-601 Lindsay Park Pittsfield 7893 L-3 5700 30
A-701 Smith North Rye 4532 10
A-801 Turner Putnam Stanford 4981 30
Branch :
Branchcode BranchName
Number(2) Varchar2(20)
10 Brighton
20 Downtown
30 Mianus
40 North Town

Write SQL statement with Output for the following:


1. Create Customer and Branch table with above mentioned schema.
2. Insert all tuples in both the tables.
3. Add new attribute Assets in customer table with number (4).
4. Modify the Assets attribute value by 25% of balamt of all customers.
5. List the Customers names, who have not taken loan.
6. Display names of customer in lower and upper case.
7. List the acno, Customer name, balamt, and Interest of all customers. (interest is 7% of balamt)
8. List the Different City present in customer table.
9. List the Customer details not belonging to the Branch code 10, 20.
10. List the Customer Name and balamt, whose balamt is in the range of 2000 and 5000.
11. List the total balamt, highest balamt and average balamt of customer branch code wise for the
branch code 30 and display only those rows having average balamt grater than 1500 and arrange
the result in Descending order of the total balamt.
12. Display the list of Customer in each Branch. Display the Branch information even if no customer
is belonging to that Branch.
13. Display the names of Customer whose stays at same street and city as that of ‘Smith’.
14. Write PL SQL program to find factorial of 7 no.
15. Display the different City present in Branch code 10 and 30.
Dept of Computer Engg. Sub : DBMS Practical & Oral Exam
-----------------------------------------------------------------------------------------------------------------------------

Example 3b : Customer:

Acno cname cstreet ccity Balamt Loanno Loanamt Branc Assets


Varchar2 Varchar2(20) Varchar2 Number Char Number hcode Numbe
Char(6) (20) (20) (9,2) (4) (9,2) Numb r(4)
er(2)
A-101 Adams Spring Pittsfield 9000 L-1 5000 10
A-201 Brooks Senator Brooklyn 8000 20
A-301 Curry North Rye 4500 L-2 2000 10
A-401 Glenn Sand Hill Woodside 8900 20
A-501 Jones Main Harrison 3784 10
A-601 Lindsay Park Pittsfield 7893 L-3 5700 30
A-701 Smith North Rye 4532 10
A-801 Turner Putnam Stanford 4981 30
Branch :
Branchcode BranchName
Number(2) Varchar2(20)

10 Brighton
20 Downtown
30 Mianus
40 North Town
Write SQL statement with Output for the following:
1. Create Customer and Branch table with above mentioned schema.
2. Insert all tuples in both the tables.
3. Modify the width of assets to number (6) player table.
4. Modify the Assets attribute value by 25% of balamt of all customers.
5. List the names of customer of branch code 10 and stays in Rye city.
6. Display name of the customer which contains ‘N’ character in customer name.
7. List the acno, Customer name, balamt, and Interest of all customers. (interest is 7% of balamt)
8. List the Different customer street present in customer table.
9. List the Names of customer ending with ‘S’.
10. List the Customer Name and balamt, whose balamt is in the range of 3000 and 5000.
11. List the total balamt, highest balamt and average balamt of customer branch code wise for the
branch code 20 and display only those rows having average balamt grater than 1500 and arrange
the result in Descending order of the total balamt.
12. Display the acno, customer name, branch code , Branch name for all customer.
13. List the names of customer who account in the same branch as that of Adams.
14. Write PL SQL program to find area of circle for radius 5.
15. Display the different City present in Branch code 20 and 30.
Dept of Computer Engg. Sub : DBMS Practical & Oral Exam
-----------------------------------------------------------------------------------------------------------------------------
Example No: 1a Employee Table (Data)
EMPNO ENAME JOB MGR HIREDATE SAL COMM DEPT NO
(Primary Varchar2(20) Varchar2(20) Number(4) Date Number(9,2) Number(9,2) Number(2)
key)
Number(4)
7369 Smith Clerk 7902 17-DEC-80 800 - 20
7499 Allen Salesman 7698 20-FEB-81 1600 - 30
7521 Ward Salesman 7698 22-FEB-81 1250 300 30
7566 Jones Manager 7839 02-APR-81 2975 500 20
7654 Martin Salesman 7698 28-SEP-81 1250 - 30
7698 Blake Manager 7839 01-MAY-81 2850 1400 30
7782 Clark Manager 7839 09-JUN-81 2450 - 10
7783 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 04-DEC-81 3000 20
7934 Miller Clerk 7782 23-JAN-82 1300 10
Department-TABLE (Data)
DEPT NO DNAME LOC
Primary key Varchar2(20) Varchar2(10)
Number(2)
10 Accounting New York
20 Research Dallas
30 Sales Chicago
40 Operations Boston

Write SQL statement with Output for the following:


1. Create Employee and department table with above mentioned schema.
2. Insert all tuples in both the tables.
3. Add new attribute company in the employee table with char (4).
4. List the employee name, who are not eligible for commission.
5. Display names of employees in lower and upper case.
6. List the name, salary, and PF amount of all employees. (Pf is 10% of salary)
7. List the Different designations available in the employee table.
8. List the Employee details not belonging to the department 10, 30, 40.
9. List the Employee Name and Salary, whose salary is in the range 1000 and 2000.
10. List the total salary, highest salary and average salary of employees job wise for the department no
20 and display only those rows having average salary greater than 1500 and arrange the result in
descending order of total salary.
11. Display the list of employees working in each department. Display the department information even
if no employees belong to that department.
12. Display the name of employee having salary same as that of employee FORD.
13. List the names of employee along with Manager Name, who joined company before their manager.
14. Write PL SQL program to find factorial of 5.
15. Increase the salary of employees working as a Manager by 5 %.
Dept of Computer Engg. Sub : DBMS Practical & Oral Exam
-----------------------------------------------------------------------------------------------------------------------------
Example No: 1b Employee Table (Data)
EMPNO ENAME JOB MGR HIREDATE SAL COMM DEPTNO
(Primary Varchar2(20) Varchar2(20) Number(4) Date Number(9,2) Number(9,2) Number(2)
key)
Number(4)
7369 Smith Clerk 7902 17-DEC-80 800 - 20
7499 Allen Salesman 7698 20-FEB-81 1600 - 30
7521 Ward Salesman 7698 22-FEB-81 1250 300 30
7566 Jones Manager 7839 02-APR-81 2975 500 20
7654 Martin Salesman 7698 28-SEP-81 1250 - 30
7698 Blake Manager 7839 01-MAY-81 2850 1400 30
7782 Clark Manager 7839 09-JUN-81 2450 - 10
7783 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 04-DEC-81 3000 20
7934 Miller Clerk 7782 23-JAN-82 1300 10
7777 Xyz Clerk 7782 23-JAN-83 578 50

Department-TABLE (Data)
DEPT NO DNAME LOC
Primary key Varchar2(20) Varchar2(10)
Number(2)
10 Accounting New York
20 Research Dallas
30 Sales Chicago
40 Operations Boston

Write SQL statement with Output for the following:


1. Create Employee and department table with above mentioned schema.
2. Insert all tuples in both the tables.
3. Add attribute grade to employee table.
4. List the names of clerk employees working in the department 20.
5. Display name of the department and length of each department.
6. List the name, salary, and HRA amount of all employees.(HRA is 20% of salary)
7. List the Different department nos in the employee table.
8. List the Names of Employee starting with ‘M’.
9. List the Employee Name and hire date who have joined after 30th June 81 and before 31-dec- 81.
10. List the total salary, highest salary and average salary of employees job wise for the department no
30 and display only those rows having average salary greater than 1000 and arrange the result in
ascending order of total salary.
11. Display the list of all employees with no corresponding department name and location.
12. List the names of employee belonging to department of JONES.
13. List the names of employee along with Manager Name.
14. Write PL SQL program to generate table of 5 no.
15. Give Rs 500 as commission to all employees.

You might also like