-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathschema.sql
More file actions
46 lines (36 loc) · 804 Bytes
/
schema.sql
File metadata and controls
46 lines (36 loc) · 804 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
34
35
36
37
38
39
40
41
42
43
44
45
46
DROP DATABASE IF EXISTS reviewsMod;
CREATE DATABASE reviewsMod;
USE reviewsMod;
CREATE TABLE users (
id INT AUTO_INCREMENT PRIMARY KEY,
name VARCHAR(40),
username VARCHAR(40),
address VARCHAR(100),
contributions INT,
votes INT,
avatar VARCHAR(100),
followers INT
);
CREATE TABLE listings (
id INT AUTO_INCREMENT PRIMARY KEY,
listing VARCHAR(100)
);
CREATE TABLE reviews (
id INT AUTO_INCREMENT PRIMARY KEY,
listing_id INT,
user_id INT,
title VARCHAR(100),
full_text VARCHAR(500),
date VARCHAR(70),
season VARCHAR(20),
travel_type VARCHAR(20),
language VARCHAR(20),
rating INT,
photo1 VARCHAR(50),
photo2 VARCHAR(50),
photo3 VARCHAR(50),
helpful VARCHAR(50),
FOREIGN KEY (user_id) REFERENCES users(id),
FOREIGN KEY (listing_id) REFERENCES listings(id)
);
-- mysql -u student1 < schema.sql -p