Download as pdf or txt
Download as pdf or txt
You are on page 1of 4

1.

Create database for BUSINESS and following tables


CUSTOMER (CNO, CNAME, ADDRESS)
PRODUCT (PNO, PNAME, PTYPE, PRICE)
SALE (CNO, PNO, DATE, QTY)
2. Insert record following.
CUSTOMER table
1,’MG MG’, ‘MANDALAY’
2,’MA MA’, ’MYITKYINA’
3,’SOE SOE’, ’KALAY’
4,’TOE TOE’, ‘TAUNGGYI’
5,’HLA HLA’, ‘KALAY’

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

(i) Get all detail records from SALE table.


(ii) Insert records into PRODUCT table i.e 4,’KEYBOARD’, 5000
(iii) Update records into PRODUCT table i.e ‘CPU’, 200000
(iv) Delete record into CUSTOMER table ‘HLA HLA’, ‘KALAY’
(v) Get customer name who buy product number 1.
II. 1. Create database for COMPANY and tables in the following:

PRODUCT (PNO, PNAME, PTYPE, PRICE)

SUPPLIER (SNO, SNAME, ADDRESS)

INVENTRY (SNO, PNO, DATE, QTY)

Insert record following.

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

sid sname address


id pname color S1 Esther London
P1 Bolt Green
S2 James Paris
P2 Nut Red
P3 Cam Blue S3 John London
P4 Cog Red
S4 Nigel Rome
P5 Screw Blue
P6 glass Green S5 Smith Athens
S6 Jones Paris
Catalog S7 Clark Rome
sid pid cost
S2 P1 100
S5 P1 100
S3 P2 300
S6 P3 200
S2 P2 700
S4 P6 900
S5 P4 500
S2 P5 150
Write MYSQL statements for the following problems using the tables create in (1).
(3). Find thename of parts which supply by supplier number 6.
(4). Find the names of parts who supply by supplier ‚Smith‛.
(5). Update the color of part ‚green‛ to ‚white‛.
(6). Find the total cost who supply by supplier ‚James‛.
(7). Delete the sids of suppliers who supply only blue parts.

You might also like