forked from MohitR1999/cab-booking
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathsetup.sql
More file actions
29 lines (25 loc) · 720 Bytes
/
Copy pathsetup.sql
File metadata and controls
29 lines (25 loc) · 720 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
CREATE DATABASE cab_booking;
USE cab_booking;
CREATE TABLE users (
user_id INT AUTO_INCREMENT PRIMARY KEY,
name VARCHAR(100),
phone VARCHAR(15),
email VARCHAR(100) UNIQUE
);
CREATE TABLE drivers (
driver_id INT AUTO_INCREMENT PRIMARY KEY,
name VARCHAR(100),
phone VARCHAR(15),
car_model VARCHAR(50),
license_plate VARCHAR(20) UNIQUE
);
CREATE TABLE bookings (
booking_id INT AUTO_INCREMENT PRIMARY KEY,
user_id INT,
driver_id INT,
pickup_location VARCHAR(255),
dropoff_location VARCHAR(255),
booking_time TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
FOREIGN KEY (user_id) REFERENCES users(user_id),
FOREIGN KEY (driver_id) REFERENCES drivers(driver_id)
);