Draw output results for following queries                                                                             Select Name, pQuantity*Price from Customer, Product where CID>5 AND description IN (‘Soap’,’Milk’) 2.Select Description, Sum(oQuantity*Price) FROM Customer c inner join Order o on c.CID=o.CID inner join Invoice i on i.OID=o.OID inner join Product p on p.PID=i.PID AND CITY=’Rawalpindi’ Group By Description     Calculate the query cost of the given two relational queries. Write SQL query for both relational queries. PNAME (((sCITY!= ‘Rawat’(Customer)) ⋉CID(Order)) ⋈OID(soquantity!=3 (Invoice)))   2.PPrice(sPID=I.PID^O.OID=I.OID(((sPrice>30(Product)) x Invoice))x(soid!=3 (Order)))       Write a procedure which takes order’s and invoice’s information as argument and insert data in relevant Before insertion make sure following points must not be violated. CID and PID must exists in Customer and product table respectively. oQuantity given for invoice table must be less than or equal to the quantity of that particular product exists in Product table. If product is cigarette, it must not be sold to customers whose age is less than 20. In that case data must not be inserted.   Write a procedure which takes customer id as argument and return name of customer and his/her total bill of all orders. You must display Customer name and total bill which is returned by procedure in main body.

Computer Networking: A Top-Down Approach (7th Edition)
7th Edition
ISBN:9780133594140
Author:James Kurose, Keith Ross
Publisher:James Kurose, Keith Ross
Chapter1: Computer Networks And The Internet
Section: Chapter Questions
Problem R1RQ: What is the difference between a host and an end system? List several different types of end...
icon
Related questions
Question

Draw output results for following queries                                                                            

  1. Select Name, pQuantity*Price from Customer, Product where CID>5 AND description IN (‘Soap’,’Milk’)

2.Select Description, Sum(oQuantity*Price) FROM
Customer c inner join Order o on c.CID=o.CID
inner join Invoice i on i.OID=o.OID
inner join Product p on p.PID=i.PID
AND CITY=’Rawalpindi’
Group By Description

 

 

  • Calculate the query cost of the given two relational queries.
  • Write SQL query for both relational queries.
  1. PNAME (((sCITY!= ‘Rawat’(Customer)) ⋉CID(Order)) OID(soquantity!=3 (Invoice)))

 

2.PPrice(sPID=I.PID^O.OID=I.OID(((sPrice>30(Product)) x Invoice))x(soid!=3 (Order)))

 

 

 

  • Write a procedure which takes order’s and invoice’s information as argument and insert data in relevant Before insertion make sure following points must not be violated.
    1. CID and PID must exists in Customer and product table respectively.
    2. oQuantity given for invoice table must be less than or equal to the quantity of that particular product exists in Product table.
    3. If product is cigarette, it must not be sold to customers whose age is less than 20. In that case data must not be inserted.

 

  • Write a procedure which takes customer id as argument and return name of customer and his/her total bill of all orders. You must display Customer name and total bill which is returned by procedure in main body.

 

 

 

 

 

 

Consider the following database schema and do as directed.
Product
Order
PID Description pQuantity Price
Shampoo
Soap
Detergent
Milk
OID
Date
CID
23/5/2012
24/5/2012
1
300
50
1
140
40
2
230
30
4
23/4/2016
4
14
33
12/2/2016
1
Lemon Max
10
20
10/1/2016
2.
Chocolate
7 Cigarettes
6
34
34
30
150
Customer
Invoice
CID Name
СITY
Age
OID
PID
oQuantity
1
Rawalpindi 23
Ahmad Islamabad 45
1
Ali
1
1.
1.
1.
4
2
Chakwal
Islamabad 34
Shafiq Islamabad 42
3
Umer
33
3
1
4
Karim
5
2
3
1
6.
Waleed
Rawat
19
2
3
3
4
2
4
3
Transcribed Image Text:Consider the following database schema and do as directed. Product Order PID Description pQuantity Price Shampoo Soap Detergent Milk OID Date CID 23/5/2012 24/5/2012 1 300 50 1 140 40 2 230 30 4 23/4/2016 4 14 33 12/2/2016 1 Lemon Max 10 20 10/1/2016 2. Chocolate 7 Cigarettes 6 34 34 30 150 Customer Invoice CID Name СITY Age OID PID oQuantity 1 Rawalpindi 23 Ahmad Islamabad 45 1 Ali 1 1. 1. 1. 4 2 Chakwal Islamabad 34 Shafiq Islamabad 42 3 Umer 33 3 1 4 Karim 5 2 3 1 6. Waleed Rawat 19 2 3 3 4 2 4 3
Expert Solution
trending now

Trending now

This is a popular solution!

steps

Step by step

Solved in 2 steps with 1 images

Blurred answer
Recommended textbooks for you
Computer Networking: A Top-Down Approach (7th Edi…
Computer Networking: A Top-Down Approach (7th Edi…
Computer Engineering
ISBN:
9780133594140
Author:
James Kurose, Keith Ross
Publisher:
PEARSON
Computer Organization and Design MIPS Edition, Fi…
Computer Organization and Design MIPS Edition, Fi…
Computer Engineering
ISBN:
9780124077263
Author:
David A. Patterson, John L. Hennessy
Publisher:
Elsevier Science
Network+ Guide to Networks (MindTap Course List)
Network+ Guide to Networks (MindTap Course List)
Computer Engineering
ISBN:
9781337569330
Author:
Jill West, Tamara Dean, Jean Andrews
Publisher:
Cengage Learning
Concepts of Database Management
Concepts of Database Management
Computer Engineering
ISBN:
9781337093422
Author:
Joy L. Starks, Philip J. Pratt, Mary Z. Last
Publisher:
Cengage Learning
Prelude to Programming
Prelude to Programming
Computer Engineering
ISBN:
9780133750423
Author:
VENIT, Stewart
Publisher:
Pearson Education
Sc Business Data Communications and Networking, T…
Sc Business Data Communications and Networking, T…
Computer Engineering
ISBN:
9781119368830
Author:
FITZGERALD
Publisher:
WILEY