SQLize Online / PHPize Online  /  SQLtest Online

A A A
Share      Blog   Popular
Copy Format Clear
create table trip ( date Date, goid varchar(255), backid varchar(255), vehicleId int, durationDay int, durationNight int, blankRow int ); create table vehicle ( vehicleId int, color varchar(255), name varchar(255) ); insert into trip (date, goid, backid, vehicleId, durationDay, durationNight, blankRow) values ('2020-09-20', 'GO1', 'DAC', 22, 2, 3, 0); insert into trip (date, goid, backid, vehicleId, durationDay, durationNight, blankRow) values ('2020-09-21', 'DAC', 'GO1', 22, 3, 4, 0); insert into trip (date, goid, backid, vehicleId, durationDay, durationNight, blankRow) values ('2020-09-09', 'DAC', 'GO1', 33, 4, 3, 2); insert into trip (date, goid, backid, vehicleId, durationDay, durationNight, blankRow) values ('2020-09-22', 'GO1', 'DAC', 22, 4, 4, 0); insert into trip (date, goid, backid, vehicleId, durationDay, durationNight, blankRow) values ('2020-09-12', 'GO1', 'GO1', 33, 3, 3, 0); insert into trip (date, goid, backid, vehicleId, durationDay, durationNight, blankRow) values ('2020-09-25', 'DAC', 'GO1', 22, 4, 4, 0); insert into trip (date, goid, backid, vehicleId, durationDay, durationNight, blankRow) values ('2020-09-22', 'GO1', 'DAC', 22, 4, 4, 0); insert into trip (date, goid, backid, vehicleId, durationDay, durationNight, blankRow) values ('2020-09-12', 'GO1', 'GO1', 33, 3, 3, 0); insert into trip (date, goid, backid, vehicleId, durationDay, durationNight, blankRow) values ('2020-09-25', 'DAC', 'GO1', 22, 4, 4, 0); insert into trip (date, goid, backid, vehicleId, durationDay, durationNight, blankRow) values ('2020-09-22', 'GO1', 'DAC', 22, 4, 4, 0); insert into trip (date, goid, backid, vehicleId, durationDay, durationNight, blankRow) values ('2020-09-12', 'GO1', 'GO1', 33, 3, 3, 0); insert into trip (date, goid, backid, vehicleId, durationDay, durationNight, blankRow) values ('2020-09-25', 'DAC', 'GO1', 22, 4, 4, 0); insert into trip (date, goid, backid, vehicleId, durationDay, durationNight, blankRow) values ('2020-09-22', 'GO1', 'DAC', 22, 4, 4, 0); insert into trip (date, goid, backid, vehicleId, durationDay, durationNight, blankRow) values ('2020-09-12', 'GO1', 'GO1', 33, 3, 3, 0); insert into trip (date, goid, backid, vehicleId, durationDay, durationNight, blankRow) values ('2020-09-25', 'DAC', 'GO1', 22, 4, 4, 0); insert into trip (date, goid, backid, vehicleId, durationDay, durationNight, blankRow) values ('2020-09-22', 'GO1', 'DAC', 22, 4, 4, 0); insert into trip (date, goid, backid, vehicleId, durationDay, durationNight, blankRow) values ('2020-09-12', 'GO1', 'GO1', 33, 3, 3, 0); insert into trip (date, goid, backid, vehicleId, durationDay, durationNight, blankRow) values ('2020-09-25', 'DAC', 'GO1', 22, 4, 4, 0); insert into trip (date, goid, backid, vehicleId, durationDay, durationNight, blankRow) values ('2020-09-22', 'GO1', 'DAC', 22, 4, 4, 0); insert into trip (date, goid, backid, vehicleId, durationDay, durationNight, blankRow) values ('2020-09-12', 'GO1', 'GO1', 33, 3, 3, 0); insert into trip (date, goid, backid, vehicleId, durationDay, durationNight, blankRow) values ('2020-09-25', 'DAC', 'GO1', 22, 4, 4, 0); insert into vehicle (vehicleId, color, name) values (22, 'Red', 'vehicle1'); insert into vehicle (vehicleId, color, name) values (33, 'Green', 'vehicle2'); SELECT trip.*, vehicle.* FROM trip, vehicle WHERE vehicle.vehicleId=trip.vehicleId ORDER BY date ASC
Stuck with a problem? Got Error? Ask ChatGPT!
Copy Clear