To display names of the products, whose
Pname starts with ‘B’ in ascending order
of price
Select Pname From Supplier
Where Pname like “B%”
Order By Price;
ii.
To display supplier code, Product name
and city of the products whose quantity is
less than 150
ANS. Select Scode, Pname, city
From Supplier;
Where Qty < 150;
iii.
ANS.
To count distinct city in the table
Select Count(distinct city)
From Supplier;
iv.
To insert a new row in the table supplier
‘110’,’Bournvita’,’ABC’,170,’Delhi’,40.00
ANS. Insert Into Supplier
Values(“110”,”Bournvita”,”ABC”,170,”Delhi”,40.00)
Table: EXAM
i.
ANS.
To display all information of the students
of humanities in desc order of percentage
Select * From Exam
Where stream = “Humanties”
Order By Percentage Desc;
ii.
ANS.
To display Adno, Name, Percentage and
Stream of those studentswhose name is
less than 6 characters long
Select Adno, SName, Percentage, Stream
From Exam
Where length(SNmae) < 6;
iii.
ANS.
To increase percentage by 2% of all the
humanities students
Update Exam
Set Percentage = Percentage +
percentage*0.02
Where Stream = “Humanities”;
iv.
ANS.
To add another column Bus_Fees with
datatype and size as Decimal(8,2)
Alter Table Exam
Add Bus_Fees Decimal(8,2);
Table: SOFTDRINK
i.
ANS.
To display names and drink codes of those
drinks that have more than 120 calories
Select DName, DRINKCODE
From SOFTDRINK
Where CALORIES > 120;
ii.
To display drink codes, names and calories
of all drinks, in descending order calories
ANS.
Select DRINKCODE, DNAME, CALORIES
From SOFTDRINK
ORDER BY CALORIES;
iii.
ANS.
To display names and price of drinks that
have PRICE in the range 12 to 18
Select DNAME, PRICE
From SOFTDRINK
Where PRICE Between 12 AND 18;
iv.
ANS.
Increase the PRICE of all drinks in the
given table by 10%
Update sOFTDRINK
Set PRICE = PRICE + 10/100;