forked from nsanders9022/Sizzle-Stuff
-
Notifications
You must be signed in to change notification settings - Fork 0
/
online_store_test.sql
152 lines (140 loc) · 7.33 KB
/
online_store_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
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
CREATE DATABASE [online_store_test]
GO
USE [online_store_test]
GO
/****** Object: Table [dbo].[activity_history] Script Date: 3/7/2017 4:34:04 PM ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[activity_history](
[id] [int] IDENTITY(1,1) NOT NULL,
[user_id] [int] NULL,
[product_id] [int] NULL,
[time_stamp] [datetime] NULL,
[activity] [varchar](255) NULL,
[notes] [varchar](1000) NULL
) ON [PRIMARY]
GO
/****** Object: Table [dbo].[cart_products] Script Date: 3/7/2017 4:34:04 PM ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[cart_products](
[id] [int] IDENTITY(1,1) NOT NULL,
[user_id] [int] NULL,
[product_id] [int] NULL,
[quantity] [int] NULL
) ON [PRIMARY]
GO
/****** Object: Table [dbo].[categories] Script Date: 3/7/2017 4:34:04 PM ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[categories](
[id] [int] IDENTITY(1,1) NOT NULL,
[name] [varchar](255) NULL
) ON [PRIMARY]
GO
/****** Object: Table [dbo].[pictures] Script Date: 3/7/2017 4:34:04 PM ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[pictures](
[id] [int] IDENTITY(1,1) NOT NULL,
[picture_key] [varchar](255) NULL,
[alt_text] [varchar](255) NULL
) ON [PRIMARY]
GO
/****** Object: Table [dbo].[pictures_products] Script Date: 3/7/2017 4:34:04 PM ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[pictures_products](
[id] [int] IDENTITY(1,1) NOT NULL,
[product_id] [int] NULL,
[picture_id] [int] NULL
) ON [PRIMARY]
GO
/****** Object: Table [dbo].[products] Script Date: 3/7/2017 4:34:04 PM ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[products](
[id] [int] IDENTITY(1,1) NOT NULL,
[name] [varchar](255) NULL,
[count] [int] NULL,
[rating] [int] NULL,
[price] [decimal](9, 2) NULL,
[description] [varchar](255) NULL
) ON [PRIMARY]
GO
/****** Object: Table [dbo].[products_categories] Script Date: 3/7/2017 4:34:04 PM ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[products_categories](
[id] [int] IDENTITY(1,1) NOT NULL,
[product_id] [int] NULL,
[category_id] [int] NULL
) ON [PRIMARY]
GO
/****** Object: Table [dbo].[profiles] Script Date: 3/7/2017 4:34:04 PM ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[profiles](
[id] [int] IDENTITY(1,1) NOT NULL,
[user_id] [int] NULL,
[street] [varchar](255) NULL,
[city] [varchar](255) NULL,
[state] [varchar](255) NULL,
[zip_code] [int] NULL,
[phone_number] [varchar](255) NULL
) ON [PRIMARY]
GO
/****** Object: Table [dbo].[reviews] Script Date: 3/7/2017 4:34:04 PM ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[reviews](
[id] [int] IDENTITY(1,1) NOT NULL,
[user_id] [int] NULL,
[product_id] [int] NULL,
[rating] [int] NULL,
[review_text] [varchar](5000) NULL
) ON [PRIMARY]
GO
/****** Object: Table [dbo].[reviews_pictures] Script Date: 3/7/2017 4:34:04 PM ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[reviews_pictures](
[id] [int] IDENTITY(1,1) NOT NULL,
[picture_id] [int] NULL,
[review_id] [int] NULL
) ON [PRIMARY]
GO
/****** Object: Table [dbo].[users] Script Date: 3/7/2017 4:34:04 PM ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[users](
[id] [int] IDENTITY(1,1) NOT NULL,
[first_name] [varchar](255) NULL,
[last_name] [varchar](255) NULL,
[username] [varchar](255) NULL,
[password] [varchar](255) NULL,
[admin_privileges] [bit] NULL
) ON [PRIMARY]
GO