-
Notifications
You must be signed in to change notification settings - Fork 0
/
seed.sql
57 lines (46 loc) · 1.21 KB
/
seed.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
delete from users;
delete from courses;
delete from ratings;
-- USER SEEDS
insert into
users (email, first_name, last_name, password)
values
('test1@test.com', 'jon', 'smith', 123);
insert into
users (email, first_name, last_name, password)
values
('test2@test.com', 'abe', 'andrews', 123);
insert into
users (email, first_name, last_name, password)
values
('test3@test.com', 'vincent', 'bevins', 123);
-- COURSE SEEDS
insert into
courses (name, description, instructor_id, category, rate)
values (
'spaghetti', 'make spaghetti',
(select id from users where first_name = 'jon')
,'Cooking', 3);
insert into
courses (name, description, instructor_id, category, rate)
values (
'dslr class', 'make pictures',
( select id from users where first_name = 'jon' )
, 'Photography/Film', 3);
-- RATING SEEDS
insert into
ratings (user_id, course_id, rating, comment)
values (
(select id from users where first_name = 'jon'),
(select id from courses where name = 'spaghetti'),
1,
'terrible!'
);
insert into
ratings (user_id, course_id, rating, comment)
values (
(select id from users where first_name = 'jon'),
(select id from courses where name = 'dslr class'),
4,
'Great class by Jon!'
)