Skip to content

Instantly share code, notes, and snippets.

@danielmoralesp
Created May 19, 2020 01:40
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save danielmoralesp/c2d1ccdff96452136be7b4d89dc57b4c to your computer and use it in GitHub Desktop.
Save danielmoralesp/c2d1ccdff96452136be7b4d89dc57b4c to your computer and use it in GitHub Desktop.
multiple-tables-db
CREATE TABLE trips (
  id INTEGER,
  date TEXT,
  pickup TEXT,
  dropoff TEXT,
  rider_id INTEGER,
  car_id INTEGER,
  type TEXT,
  cost INTEGER
);

CREATE TABLE riders(
  id INTEGER,
  first TEXT,
  last TEXT,
  username TEXT,
  rating INTEGER,
  total_trips INTEGER,
  referred INTEGER
);

CREATE TABLE cars (
  id INTEGER,
  model TEXT,
  OS TEXT,
  status TEXT,
  trips_completed INTEGER
);

CREATE TABLE riders2(
  id INTEGER,
  first TEXT,
  last TEXT,
  username TEXT,
  rating INTEGER,
  total_trips INTEGER,
  referred INTEGER
);

INSERT INTO trips (id, date, pickup, dropoff, rider_id, car_id, type, cost)
VALUES
(1001,	"2017-12-05",	"06:45",	"07:10",	102,	1,	"X",	28.66),
(1002,	"2017-12-05",	"08:00",	"08:15",	101,	3,	"POOL",	9.11),
(1003,	"2017-12-05",	"09:30",	"09:50",	104,	4,	"X",	24.98),
(1004,	"2017-12-05",	"13:40",	"14:05",	105,	1,	"X",	31.27),
(1005,	"2017-12-05",	"15:15",	"16:00",	103,	2,	"POOL",	18.95),
(1006,	"2017-12-05",	"18:20",	"18:55",	101,	3,	"XL",	78.52);

INSERT INTO riders (id, first, last, username, rating, total_trips, referred)
VALUES
(101, "Sonny", "Li", "@sonnynomnom", 4.66, 352, null),
(102, "Laura", "Breiman", "@lauracle", 4.99, 687, 101),
(103, "Kassa", "Korley", "@kassablanca", 4.63, 42, null),
(104, "Yakov", "Kagan", "@yakovkagan", 4.52, 1910, 103);

INSERT INTO cars (id, model, OS, status, trips_completed)
VALUES
(1, "Ada", "Ryzac", "active", 82),
(2, "Ada", "Ryzac", "active", 30),
(3, "Turing XL", "Ryzac", "active", 164),
(4, "Akira", "Finux", "maintenance", 22);


INSERT INTO riders2 (id, first, last, username, rating, total_trips, referred)
VALUES
(105, "Zach", "Sims", "@zsims", 4.85, 787, null),
(106, "Eric", "Vaught", "@posturelol", 4.96, 54, 101),
(107, "Jilly", "Beans", "@jillkuzmin", 4.7, 32, 101);

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment