Professional Documents
Culture Documents
College of Engineering Science and Technology Department of Computing Science & Information Systems
College of Engineering Science and Technology Department of Computing Science & Information Systems
Refer to the STOCK table given below to answer the following questions:
i. Write a SQL command to add the following set of data into the “stock table”
ii. Write a SQL command to change the Quantity of the stock, Code_Number 109 to 20
crates.
UPDATE stocktable
SET Quantity = ‘20 crates’,
WHERE Code_Number = 109;
iii. Write a SQL command to increase all Unit_price in the stock table by 20%.
UPDATE Unit_price
SET price = price + (price * 20.0 / 100.0)
WHERE Code_Number= ‘100’ and ‘101’and ‘102’ and ‘103’ and ‘104’ and ‘105’ and
‘106’ and ‘107’ and ‘108’ and ‘109’ and ‘110’ and ‘111’;
iv. Write a SQL command to delete all stocks with the type ‘Frozen Item’.
DELETE FROM stocktable WHERE Type='Frozen Item';
v. Write a SQL command to display the stock details for those stocks with Unit_Price
between $3.95 and $11.55.
CREATE VIEW [stock details] AS
SELECT Code_Number, Item_Name, Type, Quantity, Unit_price
FROM stocktable
WHERE Unit_price =‘>$3.95’ and ‘<$11.95’;
vi. Write a SQL command to list all stocks which are considered as Tin Stuff or Baby
Section
SELECT * FROM stocktable WHERE Type= ‘Tin Stuff’ and ‘Baby Section’;
vii. Write a SQL command to produce a list of Unit_Price for all stocks, arranged in
descending order of Unit_Price.