Skip to content

Table : Infant. Write a MYSQL Query

Table : Infant. Write a MYSQL Query

SOLUTION

Table : Infant. Write a MYSQL Query

Table: Infant

ItemCode Item DatePurchase UnitPrice Discount
101 Frock 2016-01-23 700 10
102 Cot 2015-09-23 5000 25
103 Soft Toy 2016-06-17 800 10
104 Baby Socks 2014-10-16 100 7
105 Baby Suit 2015-09-20 500 5

(i) List names & unit price of items where UnitPrice < 800 and Discount > 5%

(ii) Display number of items with Discount > 10%

(iii) Display ItemCode & UnitPrice in decreasing order of UnitPrice

(iv) Increase UnitPrice by 10%

(v) Display the highest UnitPrice

(vi) Display names of items that have ‘Baby’ in Item name

(vii) SELECT MID(Item,1,2) FROM Infant;

(viii) SELECT AVG(UnitPrice) FROM Infant WHERE DatePurchase > '2015-01-01';

Rows with DatePurchase > 2015-01-01 →