1.创建两张表
1.1 创建Trips表
Trips 表中包含所有出租车的行程信息。
每一行代表一段行程,有唯一行程id,乘驾人信息,及其他行程信息。
行程状态有三种,为枚举类型。
Drop table If Exists Trips;
Create table Trips(
Id int,
Client_Id int,
Driver_Id int,
City_Id int,
Status ENUM('completed', 'cancelled_by_driver', 'cancelled_by_client'),
Request_at varchar(50));
插入数据
insert into Trips (Id, Client_Id, Driver_Id, City_Id, Status, Request_at) values ('1', '1', '10', '1', 'completed', '2013-10-01');
insert into Trips (Id, Client_Id, Driver_Id, City_Id, Status, Request_at) values ('2', '2', '11', '1', 'cancelled_by_driver', '2013-10-01');
insert into Trips (Id, Client_Id, Driver_Id, City_Id, Status, Request_at) values ('3', '3', '12', '6', 'completed', '2013-10-01'