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

Lab task 11

Uploaded by

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

Lab task 11

Uploaded by

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

Lab task 11

CREATE TABLE Products (

product_no INT PRIMARY KEY,

description VARCHAR(50),

price DECIMAL(10, 2)

);

INSERT INTO Products (product_no, description, price) VALUES

(101, '1.44 Floppies', 10.00),

(102, 'CD DRIVE', 20.00),

(103, 'DVD DRIVE', 25.00),

(104, 'Hard Disk', 50.00),

(105, 'Monitor', 100.00);

CREATE TABLE Orders (

s_order_no INT PRIMARY KEY,

client_no VARCHAR(10),

client_name VARCHAR(50),

salesman_no VARCHAR(10),

s_order_date DATE,

product_no INT,

quantity INT,

FOREIGN KEY (product_no) REFERENCES Products(product_no)


);

INSERT INTO Orders (s_order_no, client_no, client_name, salesman_no, s_order_date,


product_no, quantity) VALUES

(1, 'C00001', 'Ivan Sayross', 'S001', '2024-01-01', 101, 10),

(2, 'C00002', 'Vandan Saitwal', 'S002', '2024-01-05', 102, 5),

(3, 'C00003', 'Ivan Bayross', 'S001', '2024-01-10', 103, 2),

(4, 'C00004', 'John Doe', 'S003', '2024-01-15', 104, 7),

(5, 'C00001', 'Ivan Sayross', 'S002', '2024-01-20', 105, 3);

Solve following quires

1. Find out the product which has been sold to ‘Ivan Sayross.’
2. Find out the products and their quantities that need to be delivered.
3. Find the product_no and description of moving products.
4. Find out the names of clients who have purchased ‘CD DRIVE.’
5. List the product_no and s_order_no of customers having qty ordered less than 5 from the
order details table for the product “1.44 floppies.”
6. Find the products and their quantities for the orders placed by ‘Vandan Saitwal’ and ‘Ivan
Bayross.’
7. Find the products and their quantities for the orders placed by client_no ‘C00001’ and
‘C00002.’

You might also like