0% found this document useful (0 votes)
7 views5 pages

DBMS - Assignmet 2

The document outlines an assignment for the Database Management Systems course at Atria Institute of Technology, detailing various tasks related to SQL queries and database normalization. It includes specific queries to be executed on given schemas, covering topics such as data retrieval, updates, and calculations. Additionally, it emphasizes the course outcomes related to normalization, database application development, and understanding NoSQL databases.

Uploaded by

sameersm2005
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
7 views5 pages

DBMS - Assignmet 2

The document outlines an assignment for the Database Management Systems course at Atria Institute of Technology, detailing various tasks related to SQL queries and database normalization. It includes specific queries to be executed on given schemas, covering topics such as data retrieval, updates, and calculations. Additionally, it emphasizes the course outcomes related to normalization, database application development, and understanding NoSQL databases.

Uploaded by

sameersm2005
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 5

Atria Institute of Technology, Bangalore

Dept of CSE
Assignment 2

Semester - IV Subject Code & Name : BCS403 -Database management Systems

Date: 22.04.2025 Faculty- Prof.Preetha.M

Course Outcome

CO4 Analyse various normalization forms for the given application.

CO 5 Develop database applications for the given real world problem.

CO6 Understand the concepts related to NoSQL databases.

S Content BTL CO
No

1 Consider the following table and answer the queries. 3 4

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.

2 Consider the following schema CL4 4


Write the suitable code for creating tales, inserting data and for the queries.

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).

3 Consider the following schema

Write the suitable code for creating tales, inserting data and for the queries. 3 4

1) Select the codes of all warehouses that are saturated (a warehouse is


saturated if the number of boxes in it is larger than the warehouse's capacity).
2) Select the code of each box, along with the name of the city the box is
located in.
3) Select the codes of all the boxes located in Chicago.
4) Reduce the value of all boxes by 15%.
Add Index for column "Warehouse" in table "boxes"

4 Consider the following COMPANY database 3 5

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)

Write the SQL queries for the following

i) Retrieve the name of the employee who works with same department as Ravi

ii)Retrieve the number of dependents for an employee “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

v)List “CSE” department details

5 Consider the following relation schema

Works(Pname,Cname,salary)

Lives(Pname,Street,City)

located_in (Cname, city)

Manager(Pname,Mgrname)

Write the SQL queries for the following


4 5
i) Find the names of all persons who live in the city Bangalore.

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.

v)Find the average salary of “Infosys” persons

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)

Department (Dname, Dnumber, Mgr_SSN, Mgr_Start_date)

Department_Location (Dnumber, Dlocation)

Project(Pname, Pnumber, Plocation, Dnum)

Work_on(Essn, DNo, HRS)

Dependant (Essn, Dependentname, Sex, Bdate)

i)For each department retrieve the department number, the number of


employees in the

department and their average salary.

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

employees from department no. S who work on that project.

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.

v) Retrieve the names of an employees who have two or more dependents.

7 Consider the following relations:

Student(Snum, Sname, Branch, level, age)

Class(Cname, meet_at, room, fid)

Enrolled(Snum, Cname)

Faculty(fid, fname, deptid)

Write the following queries in SQL. No duplicates should be printed in any of


the answers.

(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.

(v) Find the names of students not enrolled in any class.

8 Consider the following relations: 4 4


Orchestras(id, name, rating, city_origin, country_origin, year)

Concerts (id, city, country, year, rating, orchestra_id)

Members (id, name, position, wage, experience, orchestra_id)


Write the following queries in SQL using the concept of subqueries.

(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

You might also like