Thanks to visit codestin.com
Credit goes to www.scribd.com

0% found this document useful (0 votes)
3 views3 pages

DBMS Lab Assignment-4

The document outlines an assignment for a DBMS lab at Motilal Nehru National Institute of Technology Allahabad, detailing the construction of a sales information system and a company's office organization database. It includes schemas for products, clients, salesmen, sales orders, employees, bonuses, and job titles, along with sample data for each table. Additionally, it provides a series of SQL queries to create tables, manipulate data, and retrieve specific information from these databases.

Uploaded by

roshnarajesh18
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)
3 views3 pages

DBMS Lab Assignment-4

The document outlines an assignment for a DBMS lab at Motilal Nehru National Institute of Technology Allahabad, detailing the construction of a sales information system and a company's office organization database. It includes schemas for products, clients, salesmen, sales orders, employees, bonuses, and job titles, along with sample data for each table. Additionally, it provides a series of SQL queries to create tables, manipulate data, and retrieve specific information from these databases.

Uploaded by

roshnarajesh18
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/ 3

Computer Science and Engineering Department

Motilal Nehru National Institute of Technology Allahabad


B.Tech V Semester
DBMS Lab (CSN15401)
Assignment-4

1. A database is being constructed for storing sales information system. A product can be described
with a unique product number, product name, selling price, manufacturer name. The product can sale
to a particular client and each client have its own unique client number, client name, client
addresses, city, pin code, state and total balance to be required to paid. Each client order is to buy
product from the salesman. In the order, it has unique sales order number, sales order date, client
number, salesman number (unique), billed whole payment by the party or not and its delivery date.
The salesman has the name, addresses, city, pin code, state, salary of the sales man, delivery date,
total quantity ordered, product rate.
Consider the sales info system consisting of following schemas: -

Product(p_id, p_name, mfg_name, p_rate, sell_price, p_description)


Client(c_id, c_name, address, city, pin, state, balance_due)
Salesman(s_id, s_name, address, city, pin, state, salary)
Sales_order_details(so_no, so_date, c_id, s_id, p_id, bill_paid, delivery_date, p_rate, quantity,
cancel_date)

Product Table:
p_id p_name mfg_name p_rate sell_price p_description
101 Laptop Dell 45000 50000 Dell Inspiron 15
102 Mobile Samsung 15000 18000 Galaxy M13
103 Printer HP 8000 9500 LaserJet Pro
104 Tablet Apple 30000 35000 iPad 9th Gen

Client Table:
c_id c_name address city pin state balance_due
201 Rahul Sharma Sector 12, Noida Noida 201301 UP 10000
202 Priya Singh Park Street Kolkata 700016 WB 5000
203 Amit Verma Civil Lines Prayagraj 211002 UP 7000
204 Riya Mehta MG Road Bengaluru 560001 Karnataka 2000

Salesman Table:
s_id s_name address city pin state salary
301 Suresh Kumar Sec 10 Noida 201301 UP 35000
302 Anil Gupta Salt Lake Kolkata 700091 WB 40000
303 Neha Jain Indiranagar Bengaluru 560038 Karnataka 30000

Sales_order_details Table:
so_no so_date c_id s_id p_id bill_p delivery_d p_rate quantity cancel_
aid ate date
401 2025-01-15 201 301 101 YES 2025-01-20 50000 2 NULL
402 2025-01-18 202 302 102 NO 2025-01-25 18000 3 NULL
403 2025-02-01 203 301 103 YES 2025-02-05 9500 1 NULL
404 2025-02-10 204 303 104 YES 2025-02-15 35000 2 NULL
Write the SQL queries for the following with respect to database created: –

(a) For the sales information system schema provided above, create the corresponding tables
and insert the required data as shown in the tables.
(b) Delete all the records having delivery date before 30th January, 2025.
(c) Delete a client who has no pending balance.
(d) Delete a canceled order (if any) in table ‘Sales_order_details’.
(e) Add a new column New_sell_price into the product table.
(f) Update the balance of client 202 after payment of 2000.
(g) Change the delivery date of order number 403 to 2025-03-10.
(h) Change the bal_due of client_no 201 to 12000.
(i) Update the salary of the salesman with ID ‘302’ by increasing it by Rs. 5000.
(j) List the various products available.
(k) List all the clients who are in ‘Prayagraj’.
(l) Find the products whose selling price is greater than 10000 and less than or equal to
40000.
(m) Display all clients with balance due greater than 5000.
(n) Show products with selling price greater than 20000.
(o) List the products in sorted order of their description.
(p) Display the order number and date on which the clients placed their order.
(q) Find the product with description as ‘Dell Inspiron 15’ and ‘LaserJet Pro’.
(r) List the names, city, and state of the clients not in the state of ‘UP’.
(s) Retrieve the list of names and the cities of all the clients.

2. Consider a database that is being constructed for a Company’s office organization where it stores the
value of Employees, their Bonus and Job title. The employee relation contains the details of id, first
name, last name, salary, joining date of office and the department in which they are working. The
Bonus relation contains the details of employee reference id, bonus date and amount of bonus. Title
relates to bonus table through the reference id and this table stores the value of employer designation
and their job affected from which date.
Consider the Company's Office System consisting of following schemas: -

Employee (E_id, First_Name, Last_Name, Salary, Joining_Date, Department)


Bonus (E_Ref_Id, Bonus_Date, Bonus_Amount)
Job_Title (E_Ref_Id, E_Title, Affected_From)

Employee Table:
E_id First_Name Last_Name Salary Joining_Date Department
101 Amit Sharma 50000 2019-06-15 IT
102 Neha Verma 60000 2020-01-20 HR
103 Rajesh Gupta 75000 2018-09-10 Finance
104 Priya Mehta 50000 2021-03-05 Marketing
105 Anil Yadav 45000 2022-07-12 Sales

Bonus Table:
E_Ref_Id Bonus_Date Bonus_Amount
101 2022-12-25 5000
102 2021-11-15 7000
103 2022-03-10 10000
104 2023-01-05 4000
105 2022-08-20 3000
Job_Title Table:
E_Ref_Id E_Title Affected_From
101 Software Engineer 2019-06-15
102 HR Executive 2020-01-20
103 Finance Manager 2018-09-10
104 Marketing Officer 2021-03-05
105 Sales Associate 2022-07-12

Write the SQL queries for the following with respect to database created: –
a) For the company’s office system schema provided above, create the corresponding tables and
insert the required data as shown in the tables.
b) Insert a new record in ‘Job_Title’ table with E_Ref_Id as ‘106’, E_Title as ‘Senior Software
Engineer’, Affected_From as ‘2022-10-01’.
c) An employee with E_Id 104 has resigned. Delete the record from the employee table.
d) Delete job title of an employee with employee ref_id ‘104’.
e) Update the salary of an employee with E_Id as ‘101’ by increasing it by Rs 6000.
f) Update bonus amount for E_Id ‘103’ to 12000.
g) Update job title of an employee with ref_id ‘102’ to ‘HR Manager’.
h) List the last name of employees in upper case.
i) Retrieve the first three characters of employees from their first name.
j) List the details of an employee whose first name ends with ‘a’ and contains four
alphabets.
k) Display the details of employees who have joined in March 2021.
l) Fetch the employee’s names with salaries over and equal to 40000 and less than equal to 75000.
m) Print the details of employees who are ‘HR Executive’.
n) List the details of employees with the same salary.
o) Display all employees who joined after 2020.
p) Show all employees working in the ‘IT’ department.
q) List employees with salary greater than 55,000.
r) Retrieve employees who received a bonus greater than 5000.

You might also like