You are on page 1of 3

Practice Work

1. College Database
Student (Rollno, name, stream)
Exam (Course_no, course_name, date)
Appeared (Roll_no, course_no)

Design the queries for the following and show the result for your sample data.
a) List the students studying in computer Engineering.
b) List courses for which the examination was conducted on 1-12-2003.
c) List the students who have appeared for “C Programming” examination.
d) List the courses in which no student has appeared.
e) Delete the information about student whose roll no. is 501.
f) Change the name of the coursex “C programming” to “Programming in C”.
g) Display date wise information of examination.

2. Department Database
Employee (emp_id, name, gender, salary, dept_id, DOJ, degree, emp_phone)
Department (dept_id, name, dept_phone)
Manager (dept_id, man_id)
Note: m_id is the value from e_id only.

Design the queries for the following:


a) Give every employee of production department a 20% rise in salary.
b) List manager name, Department name that manages two or more department.
c) List the female employees whose salary is greater than 5000.
d) List managers who are MCA and joined on a given date.
e) List the managers with their department phone.
f) Give department wise list of employees.
g) Give details of employees having BE degree.
h) List the department with no female employee.

3. Employee Project Database


Employee (empno, emp_name, emp_sal)
Project (pno, pname)
Works (pno, empno)

Design the queries for the following and give it’s working.
a) Give the employee names who works on project “database”.
b) List the employees having salary more than 10,000.
c) List the employees working in project number 110.
d) List the employees working on both “MIS” and “VB” project.
e) List the employees working on “MIS” or “VB” project.
f) Find the project on which maximum no of employees are working.
g) Which employee is getting lowest salary?
h) Find all the employees working on project CRM and store them in a new table called CRM.
i) Delete the employee having salary between 1000 and 2000.
j) Modify the project name to maxEmployee in which maximum number of employees are
working.
k) Find the total salary of employees working on project “System”.
4. Order Processing Database
Supplier (Supp id, Supp name, City, Rating)
Part (Part id, Part name, Supp_id, Desc, Weight, Price)
Order (Order id, Order date, Supply date, Part id, Order qty, Supply qty, Salesman id, Order
cost)
Salesman (Salesman id, First Name, Last Name, City, commission, Salary)

Design the queries for the following


a. Decrease the cost of orders with minimum cost by 100/-.
b. List orders where supply qty is less than order qty.
c. List orders where delivery time is greater than 15 days.
d. List orders, which are less than 1 month old.
e. Delete the parts having highest weight.
f. List the salesman having same last name.
g. Put the records of the salesman having salary more than average salary of all the customers in
salary table.

5. Vendor Part Database


Part ( part_no, part_name, unit_price, size)
Vendor (vendor_no, vendor_name, city)
Supply (part_no, vendor_no, supply date, qty)
Design the queries for the following:
1. List the details of the parts that can be supplied by vendor “M/s Shah & Sons”.
2. List the details of the vendors who supply part P001 on given date.
3. List all the parts whose unit price is greater than Rs.150.
4. List the details of vendors who can supply part “Bolts” and live in ‘Baroda’.
5. Calculate the amount of supply for the given parts.
6. Delete the details of parts from supply that have already been supplied.
7. Increase the unit price of parts by 1.15% for those supplied by vendor 3 and qty not less than 1,000.
8. Store the vendor-part pair in ‘vendor part’ table where name of vendor city is between ‘p-t’ supplied in
given quantity.

6. Employee Project Database II


Employee (Emp no, emp name, basic, dept name)
Project (proj no, proj name, dept name, total cost)
Works (proj no, emp no, start date, end date)
Design the queries for the following:
1. Give the employee names are working on project “database”.
2. List the employees having salary 1,000 Rs more than the average salary.
3. List the employees working in project number 7.
4. Increase the project cost by Rs 1000 for all the projects having minimum cost.
5. Find the employee names associated with given project started after 1 st January.
6. List the employees working on projects having the same starting date.
7. Store the details of projects, which can be finished in one month in ‘1 month’ table.
8. Show the project employee combination by showing employees in rows and project details in columns.
7. Manager Database
Employee (emp_id, name, gender, salary, dept_id, DOJ, degree, emp_phone)
Department (dept_id, name, dept_phone)
Manager (dept_id, man_id)
Note: m_id is the value from e_id only.

Design the queries for the following:


1. Give every employee of production department a 20% rise in salary.
2. List manager name, Department name that manages two or more department.
3. List the female employees whose salary is greater than 5000.
4. List managers who are MCA and joined on a given date.
5. List the managers with their department phone.
6. Give department wise list of employees.
7. Give details of employees having BE degree.
8. List the department with no female employee.

8. Salesman Order Database


Salespeople (snum, sname, city, comm.)
Customers (cnum, cname, city, rating, snum)
Orders (onum, amt, odate, cnum, snum)

Design the queries for the following


1. List rating of all customers served by given salesperson.
2. List details of all salespersons whose commission is between 10% and 12%.
3. Count the number of salespeople currently listed in customer table.
4. Count the number of customers who have placed orders to salesperson 3.
5. Display average commission of all salespeople of a given city.
6. List all orders where maximum amount is greater than 30,000.
7. Delete the customers who have not placed any order.
8. Store the details of all the orders having same customer and salesperson number.

9. Movie Database
Theatre (Theatre Code, Theatre Name, Theatre Type, Price Hindi, Price Other);
Default hindi price is Rs. 100.
Default other price is Rs. 50.
Theatre type is lookup wizard with values single and multiplex.
Movie (Movie Code, Short Name, Long Name, Language);
Default language is hindi.
Short name eg: DDLJ, PKDK.
Collection (Date, Theatre Code, Short Name, Collection (in Rs));
Collection must be greater than or equal to 0.

Design the following Queries:


1. List the details of Multiplex theatres with hindi price less than Rs. 80.
2. Decrease price of hindi movies in multiplexes by Rs. 20
3. Delete the records of movies whose collection is not more than 3000 Rs.
4. Insert the English movies in a table called “English”.
5. Which theatre has maximum number of movies shown till date?
6. On which day minimum number of movies in other languages were shown?
7. Which movie has not been shown in any theatre?
8. Change the name of multiplex “Fun Republic” to “More fun”.