-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathBD.sql
31 lines (31 loc) · 844 Bytes
/
BD.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
- CREATE DATABASE moviestar;
- CREATE TABLE users(
id INT(11) UNSIGNED AUTO_INCREMENT PRIMARY KEY,
name VARCHAR(100),
lastname VARCHAR(200),
email VARCHAR(200),
password VARCHAR(200),
image VARCHAR(200),
token VARCHAR(200),
bio TEXT
);
- CREATE TABLE movies(
id INT(11) UNSIGNED AUTO_INCREMENT PRIMARY KEY,
title VARCHAR(100),
description TEXT,
image VARCHAR(200),
trailer VARCHAR(150),
category VARCHAR(50),
length VARCHAR(50),
users_id INT(11) UNSIGNED,
FOREIGN KEY (users_id) REFERENCES users(id)
);
- CREATE TABLE reviews(
id INT(11) UNSIGNED AUTO_INCREMENT PRIMARY KEY,
rating INT,
review TEXT,
users_id INT(11) UNSIGNED,
movies_id INT(11) UNSIGNED,
FOREIGN KEY (users_id) REFERENCES users(id),
FOREIGN KEY (movies_id) REFERENCES movies(id)
);