-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcreate_database.sql
More file actions
39 lines (34 loc) · 941 Bytes
/
Copy pathcreate_database.sql
File metadata and controls
39 lines (34 loc) · 941 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
-- Create the database
CREATE DATABASE wine_booking;
USE wine_booking;
-- Create the 'bookings' table
CREATE TABLE bookings (
id INT AUTO_INCREMENT PRIMARY KEY,
name VARCHAR(255) NOT NULL,
email VARCHAR(255) NOT NULL,
table_number INT NOT NULL,
date DATE NOT NULL,
time TIME NOT NULL,
created_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP
);
-- Create the 'tables' table
CREATE TABLE tables (
table_id INT AUTO_INCREMENT PRIMARY KEY,
table_number INT NOT NULL,
capacity INT NOT NULL
);
-- Insert static data into the 'tables' table
INSERT INTO tables (table_number, capacity) VALUES
(1, 4),
(2, 4),
(3, 6),
(4, 2),
(5, 4);
-- Create the 'users' table
CREATE TABLE users (
id INT AUTO_INCREMENT PRIMARY KEY,
name VARCHAR(255) NOT NULL,
email VARCHAR(255) NOT NULL,
password VARCHAR(255) NOT NULL,
created_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP
);