Mysql 2. Oracle 3. Microsoft SQL Server
Mysql 2. Oracle 3. Microsoft SQL Server
It returns one result per row It returns one result for multiple rows.
It can be used in Select, Where, It can be used in the select clause only.
and Order
by clause.
i) To display the day like “Monday”, “Tuesday”, from the date when
India got independence.
iii) To display the name of the month in which you were born.
Ans. i) dayname( )
iii) monthname( )
d) SELECT YEAR(“1979/11/26”),MONTH(“1979/11/26”),
DAY(“1979/11/26”), MONTHNAME(“1979/11/26”);
Ans. a) 8
b) 123.23 340
c) 21
d) 1979 11 26 November
e) IND ence
f) form actices
i. Create the table Product with appropriate data types and constraints.
vi. Increase the price by 12 per cent for all the products manufactured
by Dove.
Ans.
Ans.
Soap 31.5
Shampoo 245
ii.
Manufacture
Surf
Colgate
Lux
Pepsodent
Dove
iii. 4
iv.
PName MAX(UPrice) MIN(UPrice)
Tooth Paste 65 54
Soap 38 25
(iii) A 12% discount is given on cars other than LXI model and VXI
model.
c) Display the name of the costliest car with fuel type “Petrol”.
Ans.
b)
(i) update inventory set Discount =0 where model=”LXI”;
(ii) update inventory set Discount =10 where model=”VXI”;
(iii) update inventory set Discount =10 where model not in (“VXI”,
“LXI”);
Table : Stream
StCode Stream
S01 Science
S02 Commerce
S03 Humanities
Write SQL queries for the following:
Ans. Select Name from Student Where Name like “%a” order by
Name;
Ans. Select Name from Student where StCode in (“S01” , “S03”) order
by Name, Admno;
Ans. Degree : 6
Cardinality : 18