-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathwindow.sql
57 lines (44 loc) · 1.99 KB
/
window.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
-- 1. drop the database window if it exists
-- 2. create the database window
-- 3. set the current DB context to the newly created database, and then execute the DDL statements.
-- drop database if exists window;
create database window;
use window;
CREATE TABLE shopping_cart (
window_ID integer not null,
width varchar(20) not null,
height varchar(20) not null,
label varchar(50) not null,
window_type varchar(15) not null,
casement_side_type varchar(10) not null,
slider_type varchar(2) not null,
glass_type varchar(20) not null,
gas_type varchar(20) not null,
tempered_type varchar(20) not null,
frame_type varchar(20) not null,
quantity integer not null,
primary key (window_ID),
CONSTRAINT CK_window_type CHECK (window_type IN ('Single Hung', 'Double Hung', 'Casement', 'Awning')),
CONSTRAINT CK_casement_side_type CHECK (casement_side_type IN ('N/A', 'Right', 'Left')),
CONSTRAINT CK_slider_type CHECK (slider_type IN ('XO', 'OX')),
CONSTRAINT CK_glass_type CHECK (glass_type IN ('N/A', 'Low-E 270', 'Low-E 360', 'Obscured')),
CONSTRAINT CK_gas_type CHECK (gas_type IN ('N/A', 'Yes', 'No')),
CONSTRAINT CK_tempered_type CHECK (tempered_type IN ('N/A', 'Tempered', 'No Tempered')),
CONSTRAINT CK_frame_type CHECK (frame_type IN ('N/A', 'Block', 'Nail Fin', 'Stucco'))
);
CREATE TABLE recent_quotes (
quote_ID integer not null,
price money not null,
window_ID integer not null,
width integer not null,
height integer not null,
label varchar(50) not null,
window_type varchar(15) not null,
casement_side_type varchar(10) not null,
slider_type varchar(2) not null,
glass_type varchar(20) not null,
gas_type varchar(20) not null,
tempered_type varchar(20) not null,
frame_type varchar(20) not null,
quantity integer not null
);