Chapter5 Exercise14
Chapter5 Exercise14
PRODUCT table
1,’CPU’, ‘ELECTRONIC’, 20000
2,’DELL MONITOR’, ‘ELECTRONIC’, 100000
3,’MOUSE’, ‘ELECTRONIC’, 3000
SALE table
1, 2, ‘JUNE 1, 2016’, 2
3, 1, ‘JUNE 1, 2016, 1
4, 3, ‘JUNE 5, 2016, 2
SUPPLIER table
1,’MG MG’, ‘MANDALAY’
2, ‘KO KO‘, ‘YANGON’
3, ‘MA MA’, ‘LASIO’
4, ‘MYA MYA’, ‘YANGON’
5, ‘HLA HLA’, ‘MANDALAY’
PRODUCT table
1,’BOOK’, ‘STATIONARY’, 2000
2,’PEN’, ‘STATIONARY’, 1000
3,’RULAR’,’STATIONARY’, 500
4, ‘FAN’, ‘ELECTRONIC’, 5000
5,’HIGHLIGHT PEN’, ‘STATIONARY’, 1000
INVENTRY table
1, 2,’JUNE 10, 2016’, 200
5, 1, ‘JUNE 10, 2016, 100
4, 3, ‘MAY 5, 2016, 200
(i) Insert records into PRODUCT table i.e ‘PENCIL’, 50
(ii) Update records into SUPPLIER table i.e ‘MA MA’, ‘YANGON’
(iii) Delete records into PRODUCT table record no 3.
(iv) Get supplier name who supply product name is book.
(v) Count number of supplier.
III.
1. Create the following tables which contain the following associated fields.
Animal(A_namevarchar(15), owner varchar(15) , species varchar(10), sex varchar(2),
birth date)
2. Insert the following data into the tables.
A_name owner species sex birth
Fluffy James cat f 2/4/1993
Claws Gwen cat m 3/17/1994
Buffy James dog f 5/13/1989
Fang Benny dog m 8/27/1990
Bowser Diane dog m 8/30/1990
Chirpy Gwen bird f 12/9/1997
Whistler Gwen bird f 4/29/1996
Write MYSQL statements for the following problems using tables create in (1).
3. Insert (‘Slim’, ‘Benny’, ’snake’, ’m’, ‘1996-04-29’) record into animal table.
4. Update the birth date of animal to ‘2000-08-31’ which is owned by ‘Gwen’, and
species is ‘cat’.
5. Get all details of animals which species is ‘dog’ and sex is’f’.
6. Delete all of cat information.
7. Get all detail of snake or bird.
IV.
1. Create database for SPC and the following tables with contain the following
associated fields.
Suppliers(sid: CHAR(5), sname : CHAR(15), address: CHAR (15))
Parts(pid: CHAR(5), pname : CHAR(15), color : CHAR (10))
Catalog (sid: CHAR(5), pid CHAR(5), cost : Integer)
2. Insert the following data into the tables.
Parts Suppliers