0% found this document useful (0 votes)
175 views

Database Management System: Assignment No-3

This document contains instructions to create tables and queries related to a student database and course management system. It includes 20 queries to retrieve and manipulate data from the tables, such as retrieving student names and courses, listing students who paid in full, and increasing course fees. It also contains questions to create tables for suppliers, parts, projects and their relationships, and 20 additional queries on this data such as retrieving supplier IDs, part numbers, project names and totals based on attributes like city, color, quantity. Finally, it lists 20 queries on employee data like names, departments, salaries, hires dates, and differences to group, filter, sort and update the records.

Uploaded by

aryan
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
175 views

Database Management System: Assignment No-3

This document contains instructions to create tables and queries related to a student database and course management system. It includes 20 queries to retrieve and manipulate data from the tables, such as retrieving student names and courses, listing students who paid in full, and increasing course fees. It also contains questions to create tables for suppliers, parts, projects and their relationships, and 20 additional queries on this data such as retrieving supplier IDs, part numbers, project names and totals based on attributes like city, color, quantity. Finally, it lists 20 queries on employee data like names, departments, salaries, hires dates, and differences to group, filter, sort and update the records.

Uploaded by

aryan
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 3

1|Page

Database Management System


ASSIGNMENT No-3
______________________________________________________________________________________________

Q1. Create the following tables

1. Course(course_no char(4), course_name varchar(20))

2. Course_fee(course_no char(4), full_part char(1) (F/P), fees number(10))

course_no and full_part should be unique

3. Student(prospectus_no number(10), name varchar(20), address varchar(30), phone_no number(11), D_O_B date,
total_amt number(10,2), amt_paid number(10,2), installment char(1) (I/F))

4. Installment(prospectus_no number(10) (foreign key) on delete cascade, installment_amt number(10,2), due_dt


date, paid char(1) (P,U))

prospectus_no and due_dt should be unique

5. Course_taken(prospectus_no number(10) (foreign key), course_no char(4), start_dt date, full_part char(1) (F/P),
time_slot char(2), performance varchar(20))

SQL Queries:

1) Retrieve name and course no of all the students.


2) List the names of students who have paid the full amount at the time of admission.
3) Find the names of students starting with A.
4) Print the names of students whose total amount is not equal to amount due.
5) Count the number of students who have joined in current year, current month.
6) Determine the maximum and minimum course fees.
7) Increase the fee of oracle by 50%.
8) Print the details of courses whose fees are between 5000 and 10000.
9) Display the admission date in Date, Month, Year format.
10) Find out in which course maximum number of students have taken admission.
11) Change the course_name from Unix to Unix Operating System,
12) Display the admission date in DD-MONTH-YYYY format.
13) Get the sum of amount to be collected from students in this month.
14) Find out in which course the maximum number of students have taken admission in the current month.
15) Select the students who have not yet paid full amount of fees.
2|Page

Q2. Create the following tables and answer the queries: (Take appropriate data types and relationships to
define the columns and then insert relevant data).
1. SUPPLIER(SNO, SNAME, STATUS, CITY)
2. PARTS(PNO, PNAME, COLOR, WEIGHT, CITY)
3. PROJECT(JNO, JNAME, CITY)
4. SPJ(SNO, PNO, JNO, QTY)

SQL Queries:
1) Get sno values for suppliers who supply project j1.
2) Get sno values for suppliers who supply project j1 with part p1.
3) Get jname values for projects supplied by supplier s1.
4) Get color values for parts supplied by supplier s1.
5) Get pno values for parts supplied to any project in London.
6) Get sno values for suppliers who supply project j1 with a red part.
7) Get sno values for suppliers who supply a London or Paris project with a red part.
8) Get pno values for parts supplied to any project by a supplier in the same city.
9) Get pno values for parts supplied to any project in London by a supplier in London.
10) Get jno values for projects supplied by at least one supplier not in the same city.
11) Get all pairs of city values such that a supplier in the first city supplies a project in the second city.
12) Get sno values for suppliers who supply the same part to all projects.
13) Get pno values for parts supplied to all projects in London.
14) Get sname values for suppliers who supplies at least one red part to any project.
15) Get total quantity of part p1 supplied by supplier s1.
16) Get the total number of projects supplied by supplier s3.
17) Change color of all red parts to orange.
18) Get sname values for suppliers who supply to both projects j1 and j2.
19) Get all city, pno, city triples such that a supplier in the first city supplies the specified part to a project in the
second city.
20) Get jnames for those project which are supplied by supplier XYZ.
3|Page

Q3. Create the required Tables

1. Display each employee name and hiredate of systems department.


2. Write query to calculate length of service of each employee.
3. Find the second maximum salary of all employees.
4. Display all employee name and department name in department name order.
5. Find the name of lowest paid employee for each manager.
6. Display the department that has no employee.
7. Find the employees who earn the maximum salary in each job type. Sort in descending order of salary.
8. In which year did most people joined the company? Display the year and number of employees.
9. Display the details of those employees who earn greater than average of their department.
10. List the employees having salary between 10000 and 20000
11. Display all employees hired during 1983.
12. Update the salaries of all employees in marketing department & hike it by 15%.
13. Get the gross salaries of all the employees.
14. Get the names of employees and their managers name.
15. Display the name, location and department name of all the employees earning more than 1500.
16. Show all the employees in Dallas.
17. List the employees name, job, salary, grade, and department for employees in the company except clerks. Sort
on employee names.
18. Find the employees who earns the minimum salary for their job. Sort in descending order of salary.
19. Find the most recently hired employees in the department order by hiredate.
20. Find out the difference between highest and lowest salaries.

You might also like