III COMPONENT (PRACTICAL)
WORKSHEET
1. Consider the following relational schema for a Grocery shop.
Product (Prod-code, Prod_name,cost)
Shopping(Custname, No_of_Units purchased, Payment Mode,Prod_code);
The Text highlighted in yellow is primary key and green in foreign key
Payment Mode takes the value: card / cash
CustName Units P_Mode Pcode
RAMESH 7 Card P05
VIDYA 1 Cash P02
LAVANYA 4 Cash P03
VIDYA 3 Card P04
ANAND 8 Cash P05
PRIYA 6 Cash P02
ARUN 4 Card P01
ANAND 1 Cash P01
AVANTHI 10 Card P04
Product
Pcode Pname Price
P01 Soap 25
P02 Paste 43
P03 Oil 130
P04 Rice 54
P05 Sugar 35
Qestions:
1. Create table Product and Shopping with appropriate data types and keys.
2. Create constraint on product table, such that price is greater than 0.
3. Insert values into the table Product and Shopping.
4. Display the Custname, Product_name ,Price and Units Purchased for all the customers
using joins.
5. Display the number of unique Customers in the shopping table.
6. Display the Bill for the Customers for each transaction.
7. Display the Product code and the total number of units purchased
8. Update the price of “paste” to 60 rs and display the product table.
9. Display the Products ranging from highest to lowest price.
10.Display the customers whose payment mode is “Cash”.
------------------------All the Best------------------------