-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathsql.txt
More file actions
42 lines (31 loc) · 1.15 KB
/
sql.txt
File metadata and controls
42 lines (31 loc) · 1.15 KB
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
//Use this to re-create my database, if you want to test my work. (But remember to grant access to the data base, or change the database.php config).
CREATE DATABASE ChatServer;
CREATE TABLE users (
Id INT NOT NULL AUTO_INCREMENT,
Name VARCHAR(30) NOT NULL,
LastName VARChar(30),
Email VARCHAR(50),
Pass VARCHAR(10),
Age int,
PRIMARY KEY(id)
);
INSERT INTO users (Name, LastName, Email, Pass, Age)
VALUES("Michael", "Rodriguez", "michaelrodgam@gmail.com", "12345", "31");
INSERT INTO users (Name, LastName, Email, Pass, Age)
VALUES("Guest", "Guest", "guest@gmail.com", "Guest", "31");
CREATE TABLE messages (
Id INT NOT NULL AUTO_INCREMENT,
Message VARCHAR(512),
Date DATETIME,
UserId int
PRIMARY KEY (Id),
CONSTRAINT FOREIGN KEY(UserId)
REFERENCES users (Id)
ON DELETE CASCADE ON UPDATE CASCADE
);
INSERT INTO messages (Message, Date, UserId)
VALUES("Testing number 1", "2020-08-03 15:54:00", "1");
INSERT INTO messages (Message, Date, UserId)
VALUES("Testing message two", "2020-08-03 16:00:00", "1");
INSERT INTO messages (Message, Date, UserId)
VALUES("Guest testing message one", "2020-08-03 16:00:00", "2");