This repository has been archived by the owner on Sep 6, 2019. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathPA2_test.sql
58 lines (58 loc) · 1.48 KB
/
PA2_test.sql
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
--CS457 PA2 test script
CREATE DATABASE CS457_PA2;
USE CS457_PA2;
CREATE TABLE Product (pid int, name varchar(20), price float);
insert into Product values(1, 'Gizmo', 19.99);
insert into Product values(2, 'PowerGizmo', 29.99);
insert into Product values(3, 'SingleTouch', 149.99);
insert into Product values(4, 'MultiTouch', 199.99);
insert into Product values(5, 'SuperGizmo', 49.99);
select * from Product;
update Product
set name = 'Gizmo'
where name = 'SuperGizmo';
update Product
set price = 14.99
where name = 'Gizmo';
select * from Product;
delete from product
where name = 'Gizmo';
delete from product
where price > 150;
select * from Product;
select name, price
from product
where pid != 2;
.exit
-- Expected output
--
-- Database CS457_PA2 created.
-- Using database CS457_PA2.
-- Table Product created.
-- 1 new record inserted.
-- 1 new record inserted.
-- 1 new record inserted.
-- 1 new record inserted.
-- 1 new record inserted.
-- pid int|name varchar(20)|price float
-- 1|Gizmo|19.99
-- 2|PowerGizmo|29.99
-- 3|SingleTouch|149.99
-- 4|MultiTouch|199.99
-- 5|SuperGizmo|49.99
-- 1 record modified.
-- 2 records modified.
-- pid int|name varchar(20)|price float
-- 1|Gizmo|14.99
-- 2|PowerGizmo|29.99
-- 3|SingleTouch|149.99
-- 4|MultiTouch|199.99
-- 5|Gizmo|14.99
-- 2 records deleted.
-- 1 record deleted.
-- pid int|name varchar(20)|price float
-- 2|PowerGizmo|29.99
-- 3|SingleTouch|149.99
-- name varchar(20)|price float
-- SingleTouch|149.99
-- All done.