-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathMilestone2_sql.sql
More file actions
68 lines (48 loc) · 1.46 KB
/
Milestone2_sql.sql
File metadata and controls
68 lines (48 loc) · 1.46 KB
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
59
60
61
62
63
64
65
66
67
68
Create database manavi_db;
use manavi_db;
create table shirts(
shirt_id int not null auto_increment,
article varchar(100),
color varchar(100),
shirt_size varchar(100),
last_worn int,
primary key(shirt_id)
);
desc shirts;
insert into shirts (article, color, shirt_size, last_worn) VALUES
('t-shirt', 'white', 'S', 10),
('t-shirt', 'green', 'S', 200),
('polo shirt', 'black', 'M', 10),
('tank top', 'blue', 'S', 50),
('t-shirt', 'pink', 'S', 0),
('polo shirt', 'red', 'M', 5),
('tank top', 'white', 'S', 200),
('tank top', 'blue', 'M', 15),
('purple', 'polo shirt', 'medium', 50);
select * from shirts;
select article,color from shirts;
select * from shirts where shirt_size='M';
select article, color, shirt_size, last_worn from shirts where shirt_size='M';
update shirts set shirt_size='L' where article='polo shirt';
select * from shirts where article='polo shirt';
update shirts set last_worn='0' where last_worn='15';
select * from shirts where last_worn='0';
update shirts set color='off white',shirt_size='XS' where color='white';
select * from shirts where color='off white';
select * from shirts;
Delete from shirts where last_worn >=200;
select * from shirts;
Delete from shirts where article='tank top';
select * from shirts;
Delete from shirts;
select * from shirts;
/*PL/SQL (extra)
1.B -It will print
num: 95
num: 195
2.D - The variable c_id should be
declared as a type-compatible variable
as −
c_id customers.id%type := 1;
3. C - 10
*/