DBMS - Assignmet 2
DBMS - Assignmet 2
Dept of CSE
Assignment 2
Course Outcome
S Content BTL CO
No
Queries:
1 . Retrieve the product_name and unit_price from the Products table.
2. Filter the Sales table to show only sales with a total_price greater than
$100.
3. Retrieve the sale_id and total_price from the Sales table for sales
made on
January 3, 2024.
4. Calculate the average unit_price of products in the Products table.
1) For each piece, find the most expensive offering of that piece and
include the piece name, provider name, and price(Note that there could be two
providers who supply the same piece at the most expensive price).
2) Obtain the names of all providers who supply piece 1.
3) Update the database to reflect that "Susan Calvin Corp." (code "RBT")
will not supply any pieces
4) Add an entry to the database to indicate that "Skellington Supplies"
(code "TNBC") will provide sprockets (code "1") for 7 cents each.
Obtain the average price of each piece (show only the piece code and the
average price).
Write the suitable code for creating tales, inserting data and for the queries. 3 4
EMP(Name,SSN,Salary,SuperSSN,Dno)
DEPT(DNum,Dname,MgrSSN,Dno)
DEPT_LOC(Dnum,Dlocation)
DEPENDENT(ESSN,Dep_name,Sex)
WORKS_ON(ESSN,Pno,Hours)
PROJECT(Pname,Pnumber,Plocation,Dnum)
i) Retrieve the name of the employee who works with same department as Ravi
iii)Retrieve the name of the managers working in location “DELHI” who has
no female
dependents
iv)List female employees from Dno=20 earning more than 50000
Works(Pname,Cname,salary)
Lives(Pname,Street,City)
Manager(Pname,Mgrname)
ii) Retrieve the names of all person of "Infosys" whose salary is between Rs
50000
iii) Find the names of all persons who lives and work in the same city
iv) List the names of the people who work for “Tech M” along with the cities
they live in.
6 Referring to the below mentioned company schema. Write the SQL queries for 3 5
the following:
EMPLOYEE (Fname, Lname, Minit, SSN, Bdate,Address, Sex, Salary,
SuperSSN, Dno)
ii)For each project on which more than 2 employees work, retrieve the project
number,
the project name and the number of employees who work on the project.
iii) For each project, retrieve the project number, the project name and the
number of
iv) For each department that has more than 5 employees, retrieve the
department number and the number of its employees who are making more than
$40,000 salary.
Enrolled(Snum, Cname)
(i)Find the names of all Juniors (level = JR) who are enrolled in a class taught 4 4
by I. Teach.
(ii) Find the names of all classes that either meet in room R128 or have five or
more students enrolled.
(iii) For all levels except JR, print the level and the average age of students for
that level.
(iv) For each faculty member that has taught classes only in room R128, print
the faculty member's name and the total number of classes she or he has taught.
(i)Select the names of all orchestras that have the same city of origin as any city
in which any orchestra performed in 2013.
(ii)Select the names of all orchestra members that have above 10 years of
experience and do not belong to orchestras with a rating below 8.0.
(iii) Show the name and position of orchestra members who earn more than the
average wage of all violinists.
(iv) Show the names of orchestras that were created after the 'Chamber
Orchestra' and have a rating greater than 7.5