Files
CS-Classes/CS457/cs457-master/Project 2/PA2_test.sql
2025-06-17 14:42:22 -07:00

64 lines
1.5 KiB
SQL

--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;
-- select pid, name from Product where price < 150;
.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.