-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcreate.sql
More file actions
33 lines (28 loc) · 780 Bytes
/
create.sql
File metadata and controls
33 lines (28 loc) · 780 Bytes
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
CREATE DATABASE veggieapp
GO
USE veggieapp;
CREATE TABLE category (
id int IDENTITY PRIMARY KEY,
name nvarchar(30)
);
INSERT INTO category
VALUES
(N'Фрукты'),
(N'Овощи'),
(N'Грибы');
CREATE TABLE product (
id int IDENTITY PRIMARY KEY,
name nvarchar(30),
cat_id int,
img varchar(MAX),
delivery_date date,
CONSTRAINT FK_product_category FOREIGN KEY (cat_id)
REFERENCES category (id)
);
INSERT INTO product
VALUES
(N'Яблоки', 1, 'img/apples.jpg', '1970-01-01'),
(N'Картофель', 2, 'img/dummy.jpg', '1970-01-01'),
(N'Огурцы', 2, 'img/dummy.jpg', '1970-01-01'),
(N'Апельсины', 1, 'img/dummy.jpg', '1970-01-01'),
(N'Лисички', 3, 'img/dummy.jpg', '1970-01-01');