SQL PRACTICE - 3 (SELF PRACTICE)


Consider the following tables CUSTOMER and ONLINESHOP. Write SQL commands for the statements (a) to (d) and give outputs for SQL queries (a) to (h).
TABLE: CUSTOMER
CID
CNAME
GENDER
SID
AREA
1001
R SHARMA
FEMALE
101
NORTH
1002
M R TIWARY
MALE
102
SOUTH
1003
M K KHAN
MALE
103
EAST
1004
A K SINGH
MALE
102
EAST
1005
S SEN
FEMALE
101
WEST
1006
R DUBEY
MALE
104
NORTH
1007
M AGARWAL
FEMALE
104
NORTH
1008
S DAS
FEMALE
103
SOUTH
1009
R K PATIL
MALE
102
NORTH
1010
N KRISHNA MURTY
MALE
102
SOUTH

TABLE: ONLINESHOP
SID
SHOP
101
MY BUY
102
ECO BUY
103
JUST SHOPPING
104
SHOPPING EASY

(a)    To display CNAME, AREA of all female customers from CUSTOMER table.
(b)    To display the details of all the CUSTOMERS in ascending order of CNAME within SID.
(c)    To display the total number of customers for each AREA from CUSTOMER table.
(d)    To display CNAME and corresponding SHOP from CUSTOMER table and ONLINESHOP table.
(e)    SELECT COUNT (*), GENDER FROM CUSTOMER GROUP BY GENDER;
(f)    SELECT COUNT (*) FROM ONLINESHOP;
(g)    SELECT CNAME FROM CUSTOMER WHERE CNAME LIKE ‘L%’;
(h)    SELECT DISTINCT AREA FROM CUSTOMER;





No comments

Post your comments

Powered by Blogger.