SQL Questions 1
SQL Questions 1
4
Column name Data type Size Constraint
Name Varchar Primary key
Price Integer 5
Weight Integer 4
Consider the following table Diwali_items and write the queries (1) and (11).
Table: Diwali_items
Name Price Weight
Chakri 38 130
Anar 31 180
Phuljhari 8 38
) Write a command to insert a new record with the following values: ('Chocolate Bomb', 28, 130)
i) Write a query to display all the records of table Diwali_items whose price is more than 28
OR
Write a query to update the Price from 31 to 28. Also, write a query to delete the 2nd record of the table.
21. Create the following table Cricketers. 4
Column name Data type Size Constraint
Player ID Varchar 5
Name Varchar 25
Runs Integer 5
Wickets Integer 4
Consider the following table Cricketers and write the queries () and (i).
Table: Cricketers
Player ID Name Runs Wickets
SA2332 Jacques Kallis 12321 320
IND331 Javagal Srinath 2200 380
PAK331 Wasim Akram 3500 458
(i) Write a command to insert a new record with the following values: ('NZ3321', 'Ken Rutherford', 7000, 5)
(i) Write a query to display all records of table Cricketers whose runs is more than 5000 and wickets is
more than 100.
OR
Write the Wickets from 380 to 392.
a query to update Also, write a query to delete the 3rd record of the table
21. (a) Create the following table Household_items. 4
Size Constraint
Column name Data type
Itemno Integer Primary key
Varchar 15
Iname
Numericc 10, 2
Price
Quantity per item Integer 3
(b) Consider the following table Item and write the queries (i) and (i1).
Table: Household_Items
Quantity per item
Itemno Iname Price
1 Bedsheet 800 100
2 Bed cover 620 310
Blanket 1800 225
Carpet 900 15
5 Pillow cover 50 10
) Write a command to insert a new record with the following values : (6, T.V Cover, 150, 20).
(ii) Write a query to display all the records of table Item whose price is more than 500.
OR
Write a query to update the Price of Itemno: 5 as 75°'.
21. (a) reate the following table: Food_itet. 14
Column name Data type Size Constraint
Itemno
Integer Primary key
Iname Varchar 15
Price Numeric 10, 2
Quantity per plate Integer 3
(b) Consider the following table Item and write the queries (i) and (i).
Table: Food Itemns
Itemno Iname Price Quantity_per_plate
1 Dosa Sambhar 250 10
2 Pav Phaji 210 30
3 Chole Bhature 150 25
Paani Puri 105 15
5 Chaat 50 10
(i) Write a command to insert a new record with the following values: (6, 'Chowmein', 160, 20).
(ii) Write a query to display all the records of table Item whose price is 125 or more than
125.
OR
Write a query to display all the records of a table in descending order of
Quantity_per_plate.