Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit a66d813

Browse files
Base Setup
1 parent 768fcf3 commit a66d813

File tree

6 files changed

+56
-2
lines changed

6 files changed

+56
-2
lines changed

‎.vscode/settings.json‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@
2626
"port": 3306,
2727
"driver": "MySQL",
2828
"name": "mysql",
29-
"database": "default",
29+
"database": "restaurants",
3030
"username": "root",
3131
"askForPassword": true
3232
},
@@ -36,7 +36,7 @@
3636
"port": 5432,
3737
"driver": "PostgreSQL",
3838
"name": "postgresql",
39-
"database": "default",
39+
"database": "restaurants",
4040
"username": "postgres",
4141
"askForPassword": true
4242
}
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
CREATE DATABASE restaurants;
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
CREATE TABLE payment_methods (
2+
id INT PRIMARY KEY AUTO_INCREMENT, -- MySQL syntax
3+
-- id SERIAL PRIMARY KEY, -- PostgreSQL syntax
4+
name VARCHAR(200)
5+
);
6+
7+
CREATE TABLE tables (
8+
id INT PRIMARY KEY AUTO_INCREMENT, -- MySQL syntax
9+
-- id SERIAL PRIMARY KEY, -- PostgreSQL syntax
10+
num_seats INT,
11+
category VARCHAR(200)
12+
);
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
INSERT INTO payment_methods (name)
2+
VALUES ('Cash'), ('Credit Card');
3+
4+
INSERT INTO tables (num_seats, category)
5+
VALUES (2, 'small'), (2, 'small'), ( 4, 'medium'), (6, 'large'), (8, 'large');
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
CREATE TABLE bookings (
2+
id INT PRIMARY KEY AUTO_INCREMENT, -- MySQL syntax
3+
-- id SERIAL PRIMARY KEY,
4+
booking_date DATE NOT NULL,
5+
num_guests INT NOT NULL,
6+
amount_billed NUMERIC(6, 2) NOT NULL,
7+
amount_tipped NUMERIC(6, 2),
8+
payment_id INT, -- MySQL syntax
9+
table_id INT, -- MySQL syntax
10+
FOREIGN KEY (payment_id) REFERENCES payment_methods (id), -- MySQL syntax
11+
FOREIGN KEY (table_id) REFERENCES tables (id) -- MySQL syntax
12+
-- payment_id INT REFERENCES payment_methods,
13+
-- table_id INT REFERENCES tables
14+
);
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
INSERT INTO bookings (booking_date, num_guests, amount_billed, amount_tipped, payment_id, table_id)
2+
VALUES
3+
('2021年11月04日', 2, 19.90, 0.10, 2, 1),
4+
('2021年11月04日', 1, 12.90, 0.00, 2, 2),
5+
('2021年11月05日', 2, 15.50, NULL, 1, 1),
6+
('2021年11月05日', 7, 113.40, 6.60, 1, 5),
7+
('2021年11月05日', 6, 140.90, 10.10, 1, 4),
8+
('2021年11月05日', 7, 98.60, 1.40, 1, 5),
9+
('2021年11月05日', 4, 60.50, 4.50, 2, 3),
10+
('2021年11月06日', 5, 86.10, 4.90, 2, 4),
11+
('2021年11月06日', 3, 49.70, 5.30, 2, 4),
12+
('2021年11月06日', 1, 15.90, 2.10, 1, 2),
13+
('2021年11月06日', 7, 242.60, 12.40, 1, 5),
14+
('2021年11月06日', 6, 180.00, 20.00, 1, 5),
15+
('2021年11月06日', 3, 38.70, 11.30, 2, 3),
16+
('2021年11月06日', 2, 25.60, 9.40, 1, 1),
17+
('2021年11月06日', 3, 60.50, 14.50, 1, 4),
18+
('2021年11月07日', 2, 26.40, 1.60, 2, 1),
19+
('2021年11月07日', 2, 35.50, 4.50, 2, 2),
20+
('2021年11月07日', 5, 101.90, NULL, 1, 4),
21+
('2021年11月07日', 6, 130.10, 10, 1, 5),
22+
('2021年11月08日', 2, 38.60, 0.40, 2, 2);

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /