db_id stringclasses 146
values | question stringlengths 3 224 | sql stringlengths 18 577 | database_schema stringclasses 146
values |
|---|---|---|---|
train_station | Show the name, location, and number of platforms for all stations. | SELECT name , LOCATION , number_of_platforms FROM station | CREATE TABLE "station" (
"Station_ID" int,
"Name" text,
"Annual_entry_exit" real,
"Annual_interchanges" real,
"Total_Passengers" real,
"Location" text,
"Main_Services" text,
"Number_of_Platforms" int,
PRIMARY KEY ("Station_ID")
)
3 rows from station table:
Station_ID Name Annual_entry_exit Annual_interchanges Total_Passengers Location Main_Services Number_of_Platforms
1 London Waterloo 94.046 9.489 103.534 London South Western Main Line West of England Main Line 19
2 London Victoria 76.231 9.157 85.380 London Brighton Main Line Chatham Main Line 19
3 London Bridge 52.634 8.742 61.376 London South Eastern Main Line Thameslink 12
CREATE TABLE "train" (
"Train_ID" int,
"Name" text,
"Time" text,
"Service" text,
PRIMARY KEY ("Train_ID")
)
3 rows from train table:
Train_ID Name Time Service
1 Ananthapuri Express 17:15 Daily
2 Guruvayur Express 22:10 Daily
3 Guruvayur Express 4:49 Daily
CREATE TABLE "train_station" (
"Train_ID" int,
"Station_ID" int,
PRIMARY KEY ("Train_ID","Station_ID"),
FOREIGN KEY ("Train_ID") REFERENCES "train"("Train_ID"),
FOREIGN KEY ("Station_ID") REFERENCES "station"("Station_ID")
)
3 rows from train_station table:
Train_ID Station_ID
1 1
2 1
3 1
|
train_station | What are all locations of train stations? | SELECT DISTINCT LOCATION FROM station | CREATE TABLE "station" (
"Station_ID" int,
"Name" text,
"Annual_entry_exit" real,
"Annual_interchanges" real,
"Total_Passengers" real,
"Location" text,
"Main_Services" text,
"Number_of_Platforms" int,
PRIMARY KEY ("Station_ID")
)
3 rows from station table:
Station_ID Name Annual_entry_exit Annual_interchanges Total_Passengers Location Main_Services Number_of_Platforms
1 London Waterloo 94.046 9.489 103.534 London South Western Main Line West of England Main Line 19
2 London Victoria 76.231 9.157 85.380 London Brighton Main Line Chatham Main Line 19
3 London Bridge 52.634 8.742 61.376 London South Eastern Main Line Thameslink 12
CREATE TABLE "train" (
"Train_ID" int,
"Name" text,
"Time" text,
"Service" text,
PRIMARY KEY ("Train_ID")
)
3 rows from train table:
Train_ID Name Time Service
1 Ananthapuri Express 17:15 Daily
2 Guruvayur Express 22:10 Daily
3 Guruvayur Express 4:49 Daily
CREATE TABLE "train_station" (
"Train_ID" int,
"Station_ID" int,
PRIMARY KEY ("Train_ID","Station_ID"),
FOREIGN KEY ("Train_ID") REFERENCES "train"("Train_ID"),
FOREIGN KEY ("Station_ID") REFERENCES "station"("Station_ID")
)
3 rows from train_station table:
Train_ID Station_ID
1 1
2 1
3 1
|
train_station | Show the names and total passengers for all train stations not in London. | SELECT name , total_passengers FROM station WHERE LOCATION != 'London' | CREATE TABLE "station" (
"Station_ID" int,
"Name" text,
"Annual_entry_exit" real,
"Annual_interchanges" real,
"Total_Passengers" real,
"Location" text,
"Main_Services" text,
"Number_of_Platforms" int,
PRIMARY KEY ("Station_ID")
)
3 rows from station table:
Station_ID Name Annual_entry_exit Annual_interchanges Total_Passengers Location Main_Services Number_of_Platforms
1 London Waterloo 94.046 9.489 103.534 London South Western Main Line West of England Main Line 19
2 London Victoria 76.231 9.157 85.380 London Brighton Main Line Chatham Main Line 19
3 London Bridge 52.634 8.742 61.376 London South Eastern Main Line Thameslink 12
CREATE TABLE "train" (
"Train_ID" int,
"Name" text,
"Time" text,
"Service" text,
PRIMARY KEY ("Train_ID")
)
3 rows from train table:
Train_ID Name Time Service
1 Ananthapuri Express 17:15 Daily
2 Guruvayur Express 22:10 Daily
3 Guruvayur Express 4:49 Daily
CREATE TABLE "train_station" (
"Train_ID" int,
"Station_ID" int,
PRIMARY KEY ("Train_ID","Station_ID"),
FOREIGN KEY ("Train_ID") REFERENCES "train"("Train_ID"),
FOREIGN KEY ("Station_ID") REFERENCES "station"("Station_ID")
)
3 rows from train_station table:
Train_ID Station_ID
1 1
2 1
3 1
|
train_station | Show the names and main services for train stations that have the top three total number of passengers. | SELECT name , main_services FROM station ORDER BY total_passengers DESC LIMIT 3 | CREATE TABLE "station" (
"Station_ID" int,
"Name" text,
"Annual_entry_exit" real,
"Annual_interchanges" real,
"Total_Passengers" real,
"Location" text,
"Main_Services" text,
"Number_of_Platforms" int,
PRIMARY KEY ("Station_ID")
)
3 rows from station table:
Station_ID Name Annual_entry_exit Annual_interchanges Total_Passengers Location Main_Services Number_of_Platforms
1 London Waterloo 94.046 9.489 103.534 London South Western Main Line West of England Main Line 19
2 London Victoria 76.231 9.157 85.380 London Brighton Main Line Chatham Main Line 19
3 London Bridge 52.634 8.742 61.376 London South Eastern Main Line Thameslink 12
CREATE TABLE "train" (
"Train_ID" int,
"Name" text,
"Time" text,
"Service" text,
PRIMARY KEY ("Train_ID")
)
3 rows from train table:
Train_ID Name Time Service
1 Ananthapuri Express 17:15 Daily
2 Guruvayur Express 22:10 Daily
3 Guruvayur Express 4:49 Daily
CREATE TABLE "train_station" (
"Train_ID" int,
"Station_ID" int,
PRIMARY KEY ("Train_ID","Station_ID"),
FOREIGN KEY ("Train_ID") REFERENCES "train"("Train_ID"),
FOREIGN KEY ("Station_ID") REFERENCES "station"("Station_ID")
)
3 rows from train_station table:
Train_ID Station_ID
1 1
2 1
3 1
|
train_station | What is the average and maximum number of total passengers for train stations in London or Glasgow? | SELECT avg(total_passengers) , max(total_passengers) FROM station WHERE LOCATION = 'London' OR LOCATION = 'Glasgow' | CREATE TABLE "station" (
"Station_ID" int,
"Name" text,
"Annual_entry_exit" real,
"Annual_interchanges" real,
"Total_Passengers" real,
"Location" text,
"Main_Services" text,
"Number_of_Platforms" int,
PRIMARY KEY ("Station_ID")
)
3 rows from station table:
Station_ID Name Annual_entry_exit Annual_interchanges Total_Passengers Location Main_Services Number_of_Platforms
1 London Waterloo 94.046 9.489 103.534 London South Western Main Line West of England Main Line 19
2 London Victoria 76.231 9.157 85.380 London Brighton Main Line Chatham Main Line 19
3 London Bridge 52.634 8.742 61.376 London South Eastern Main Line Thameslink 12
CREATE TABLE "train" (
"Train_ID" int,
"Name" text,
"Time" text,
"Service" text,
PRIMARY KEY ("Train_ID")
)
3 rows from train table:
Train_ID Name Time Service
1 Ananthapuri Express 17:15 Daily
2 Guruvayur Express 22:10 Daily
3 Guruvayur Express 4:49 Daily
CREATE TABLE "train_station" (
"Train_ID" int,
"Station_ID" int,
PRIMARY KEY ("Train_ID","Station_ID"),
FOREIGN KEY ("Train_ID") REFERENCES "train"("Train_ID"),
FOREIGN KEY ("Station_ID") REFERENCES "station"("Station_ID")
)
3 rows from train_station table:
Train_ID Station_ID
1 1
2 1
3 1
|
train_station | Show all locations and the total number of platforms and passengers for all train stations in each location. | SELECT LOCATION , sum(number_of_platforms) , sum(total_passengers) FROM station GROUP BY LOCATION | CREATE TABLE "station" (
"Station_ID" int,
"Name" text,
"Annual_entry_exit" real,
"Annual_interchanges" real,
"Total_Passengers" real,
"Location" text,
"Main_Services" text,
"Number_of_Platforms" int,
PRIMARY KEY ("Station_ID")
)
3 rows from station table:
Station_ID Name Annual_entry_exit Annual_interchanges Total_Passengers Location Main_Services Number_of_Platforms
1 London Waterloo 94.046 9.489 103.534 London South Western Main Line West of England Main Line 19
2 London Victoria 76.231 9.157 85.380 London Brighton Main Line Chatham Main Line 19
3 London Bridge 52.634 8.742 61.376 London South Eastern Main Line Thameslink 12
CREATE TABLE "train" (
"Train_ID" int,
"Name" text,
"Time" text,
"Service" text,
PRIMARY KEY ("Train_ID")
)
3 rows from train table:
Train_ID Name Time Service
1 Ananthapuri Express 17:15 Daily
2 Guruvayur Express 22:10 Daily
3 Guruvayur Express 4:49 Daily
CREATE TABLE "train_station" (
"Train_ID" int,
"Station_ID" int,
PRIMARY KEY ("Train_ID","Station_ID"),
FOREIGN KEY ("Train_ID") REFERENCES "train"("Train_ID"),
FOREIGN KEY ("Station_ID") REFERENCES "station"("Station_ID")
)
3 rows from train_station table:
Train_ID Station_ID
1 1
2 1
3 1
|
train_station | Show all locations that have train stations with at least 15 platforms and train stations with more than 25 total passengers. | SELECT DISTINCT LOCATION FROM station WHERE number_of_platforms >= 15 AND total_passengers > 25 | CREATE TABLE "station" (
"Station_ID" int,
"Name" text,
"Annual_entry_exit" real,
"Annual_interchanges" real,
"Total_Passengers" real,
"Location" text,
"Main_Services" text,
"Number_of_Platforms" int,
PRIMARY KEY ("Station_ID")
)
3 rows from station table:
Station_ID Name Annual_entry_exit Annual_interchanges Total_Passengers Location Main_Services Number_of_Platforms
1 London Waterloo 94.046 9.489 103.534 London South Western Main Line West of England Main Line 19
2 London Victoria 76.231 9.157 85.380 London Brighton Main Line Chatham Main Line 19
3 London Bridge 52.634 8.742 61.376 London South Eastern Main Line Thameslink 12
CREATE TABLE "train" (
"Train_ID" int,
"Name" text,
"Time" text,
"Service" text,
PRIMARY KEY ("Train_ID")
)
3 rows from train table:
Train_ID Name Time Service
1 Ananthapuri Express 17:15 Daily
2 Guruvayur Express 22:10 Daily
3 Guruvayur Express 4:49 Daily
CREATE TABLE "train_station" (
"Train_ID" int,
"Station_ID" int,
PRIMARY KEY ("Train_ID","Station_ID"),
FOREIGN KEY ("Train_ID") REFERENCES "train"("Train_ID"),
FOREIGN KEY ("Station_ID") REFERENCES "station"("Station_ID")
)
3 rows from train_station table:
Train_ID Station_ID
1 1
2 1
3 1
|
train_station | Show all locations which don't have a train station with at least 15 platforms. | SELECT LOCATION FROM station EXCEPT SELECT LOCATION FROM station WHERE number_of_platforms >= 15 | CREATE TABLE "station" (
"Station_ID" int,
"Name" text,
"Annual_entry_exit" real,
"Annual_interchanges" real,
"Total_Passengers" real,
"Location" text,
"Main_Services" text,
"Number_of_Platforms" int,
PRIMARY KEY ("Station_ID")
)
3 rows from station table:
Station_ID Name Annual_entry_exit Annual_interchanges Total_Passengers Location Main_Services Number_of_Platforms
1 London Waterloo 94.046 9.489 103.534 London South Western Main Line West of England Main Line 19
2 London Victoria 76.231 9.157 85.380 London Brighton Main Line Chatham Main Line 19
3 London Bridge 52.634 8.742 61.376 London South Eastern Main Line Thameslink 12
CREATE TABLE "train" (
"Train_ID" int,
"Name" text,
"Time" text,
"Service" text,
PRIMARY KEY ("Train_ID")
)
3 rows from train table:
Train_ID Name Time Service
1 Ananthapuri Express 17:15 Daily
2 Guruvayur Express 22:10 Daily
3 Guruvayur Express 4:49 Daily
CREATE TABLE "train_station" (
"Train_ID" int,
"Station_ID" int,
PRIMARY KEY ("Train_ID","Station_ID"),
FOREIGN KEY ("Train_ID") REFERENCES "train"("Train_ID"),
FOREIGN KEY ("Station_ID") REFERENCES "station"("Station_ID")
)
3 rows from train_station table:
Train_ID Station_ID
1 1
2 1
3 1
|
train_station | Show the location with most number of train stations. | SELECT LOCATION FROM station GROUP BY LOCATION ORDER BY count(*) DESC LIMIT 1 | CREATE TABLE "station" (
"Station_ID" int,
"Name" text,
"Annual_entry_exit" real,
"Annual_interchanges" real,
"Total_Passengers" real,
"Location" text,
"Main_Services" text,
"Number_of_Platforms" int,
PRIMARY KEY ("Station_ID")
)
3 rows from station table:
Station_ID Name Annual_entry_exit Annual_interchanges Total_Passengers Location Main_Services Number_of_Platforms
1 London Waterloo 94.046 9.489 103.534 London South Western Main Line West of England Main Line 19
2 London Victoria 76.231 9.157 85.380 London Brighton Main Line Chatham Main Line 19
3 London Bridge 52.634 8.742 61.376 London South Eastern Main Line Thameslink 12
CREATE TABLE "train" (
"Train_ID" int,
"Name" text,
"Time" text,
"Service" text,
PRIMARY KEY ("Train_ID")
)
3 rows from train table:
Train_ID Name Time Service
1 Ananthapuri Express 17:15 Daily
2 Guruvayur Express 22:10 Daily
3 Guruvayur Express 4:49 Daily
CREATE TABLE "train_station" (
"Train_ID" int,
"Station_ID" int,
PRIMARY KEY ("Train_ID","Station_ID"),
FOREIGN KEY ("Train_ID") REFERENCES "train"("Train_ID"),
FOREIGN KEY ("Station_ID") REFERENCES "station"("Station_ID")
)
3 rows from train_station table:
Train_ID Station_ID
1 1
2 1
3 1
|
train_station | Show the name, time, and service for all trains. | SELECT name , TIME , service FROM train | CREATE TABLE "station" (
"Station_ID" int,
"Name" text,
"Annual_entry_exit" real,
"Annual_interchanges" real,
"Total_Passengers" real,
"Location" text,
"Main_Services" text,
"Number_of_Platforms" int,
PRIMARY KEY ("Station_ID")
)
3 rows from station table:
Station_ID Name Annual_entry_exit Annual_interchanges Total_Passengers Location Main_Services Number_of_Platforms
1 London Waterloo 94.046 9.489 103.534 London South Western Main Line West of England Main Line 19
2 London Victoria 76.231 9.157 85.380 London Brighton Main Line Chatham Main Line 19
3 London Bridge 52.634 8.742 61.376 London South Eastern Main Line Thameslink 12
CREATE TABLE "train" (
"Train_ID" int,
"Name" text,
"Time" text,
"Service" text,
PRIMARY KEY ("Train_ID")
)
3 rows from train table:
Train_ID Name Time Service
1 Ananthapuri Express 17:15 Daily
2 Guruvayur Express 22:10 Daily
3 Guruvayur Express 4:49 Daily
CREATE TABLE "train_station" (
"Train_ID" int,
"Station_ID" int,
PRIMARY KEY ("Train_ID","Station_ID"),
FOREIGN KEY ("Train_ID") REFERENCES "train"("Train_ID"),
FOREIGN KEY ("Station_ID") REFERENCES "station"("Station_ID")
)
3 rows from train_station table:
Train_ID Station_ID
1 1
2 1
3 1
|
train_station | Show the number of trains | SELECT count(*) FROM train | CREATE TABLE "station" (
"Station_ID" int,
"Name" text,
"Annual_entry_exit" real,
"Annual_interchanges" real,
"Total_Passengers" real,
"Location" text,
"Main_Services" text,
"Number_of_Platforms" int,
PRIMARY KEY ("Station_ID")
)
3 rows from station table:
Station_ID Name Annual_entry_exit Annual_interchanges Total_Passengers Location Main_Services Number_of_Platforms
1 London Waterloo 94.046 9.489 103.534 London South Western Main Line West of England Main Line 19
2 London Victoria 76.231 9.157 85.380 London Brighton Main Line Chatham Main Line 19
3 London Bridge 52.634 8.742 61.376 London South Eastern Main Line Thameslink 12
CREATE TABLE "train" (
"Train_ID" int,
"Name" text,
"Time" text,
"Service" text,
PRIMARY KEY ("Train_ID")
)
3 rows from train table:
Train_ID Name Time Service
1 Ananthapuri Express 17:15 Daily
2 Guruvayur Express 22:10 Daily
3 Guruvayur Express 4:49 Daily
CREATE TABLE "train_station" (
"Train_ID" int,
"Station_ID" int,
PRIMARY KEY ("Train_ID","Station_ID"),
FOREIGN KEY ("Train_ID") REFERENCES "train"("Train_ID"),
FOREIGN KEY ("Station_ID") REFERENCES "station"("Station_ID")
)
3 rows from train_station table:
Train_ID Station_ID
1 1
2 1
3 1
|
train_station | Show the name and service for all trains in order by time. | SELECT name , service FROM train ORDER BY TIME | CREATE TABLE "station" (
"Station_ID" int,
"Name" text,
"Annual_entry_exit" real,
"Annual_interchanges" real,
"Total_Passengers" real,
"Location" text,
"Main_Services" text,
"Number_of_Platforms" int,
PRIMARY KEY ("Station_ID")
)
3 rows from station table:
Station_ID Name Annual_entry_exit Annual_interchanges Total_Passengers Location Main_Services Number_of_Platforms
1 London Waterloo 94.046 9.489 103.534 London South Western Main Line West of England Main Line 19
2 London Victoria 76.231 9.157 85.380 London Brighton Main Line Chatham Main Line 19
3 London Bridge 52.634 8.742 61.376 London South Eastern Main Line Thameslink 12
CREATE TABLE "train" (
"Train_ID" int,
"Name" text,
"Time" text,
"Service" text,
PRIMARY KEY ("Train_ID")
)
3 rows from train table:
Train_ID Name Time Service
1 Ananthapuri Express 17:15 Daily
2 Guruvayur Express 22:10 Daily
3 Guruvayur Express 4:49 Daily
CREATE TABLE "train_station" (
"Train_ID" int,
"Station_ID" int,
PRIMARY KEY ("Train_ID","Station_ID"),
FOREIGN KEY ("Train_ID") REFERENCES "train"("Train_ID"),
FOREIGN KEY ("Station_ID") REFERENCES "station"("Station_ID")
)
3 rows from train_station table:
Train_ID Station_ID
1 1
2 1
3 1
|
train_station | Show the station name and number of trains in each station. | SELECT T2.name , count(*) FROM train_station AS T1 JOIN station AS T2 ON T1.station_id = T2.station_id GROUP BY T1.station_id | CREATE TABLE "station" (
"Station_ID" int,
"Name" text,
"Annual_entry_exit" real,
"Annual_interchanges" real,
"Total_Passengers" real,
"Location" text,
"Main_Services" text,
"Number_of_Platforms" int,
PRIMARY KEY ("Station_ID")
)
3 rows from station table:
Station_ID Name Annual_entry_exit Annual_interchanges Total_Passengers Location Main_Services Number_of_Platforms
1 London Waterloo 94.046 9.489 103.534 London South Western Main Line West of England Main Line 19
2 London Victoria 76.231 9.157 85.380 London Brighton Main Line Chatham Main Line 19
3 London Bridge 52.634 8.742 61.376 London South Eastern Main Line Thameslink 12
CREATE TABLE "train" (
"Train_ID" int,
"Name" text,
"Time" text,
"Service" text,
PRIMARY KEY ("Train_ID")
)
3 rows from train table:
Train_ID Name Time Service
1 Ananthapuri Express 17:15 Daily
2 Guruvayur Express 22:10 Daily
3 Guruvayur Express 4:49 Daily
CREATE TABLE "train_station" (
"Train_ID" int,
"Station_ID" int,
PRIMARY KEY ("Train_ID","Station_ID"),
FOREIGN KEY ("Train_ID") REFERENCES "train"("Train_ID"),
FOREIGN KEY ("Station_ID") REFERENCES "station"("Station_ID")
)
3 rows from train_station table:
Train_ID Station_ID
1 1
2 1
3 1
|
train_station | show the train name and station name for each train. | SELECT T2.name , T3.name FROM train_station AS T1 JOIN station AS T2 ON T1.station_id = T2.station_id JOIN train AS T3 ON T3.train_id = T1.train_id | CREATE TABLE "station" (
"Station_ID" int,
"Name" text,
"Annual_entry_exit" real,
"Annual_interchanges" real,
"Total_Passengers" real,
"Location" text,
"Main_Services" text,
"Number_of_Platforms" int,
PRIMARY KEY ("Station_ID")
)
3 rows from station table:
Station_ID Name Annual_entry_exit Annual_interchanges Total_Passengers Location Main_Services Number_of_Platforms
1 London Waterloo 94.046 9.489 103.534 London South Western Main Line West of England Main Line 19
2 London Victoria 76.231 9.157 85.380 London Brighton Main Line Chatham Main Line 19
3 London Bridge 52.634 8.742 61.376 London South Eastern Main Line Thameslink 12
CREATE TABLE "train" (
"Train_ID" int,
"Name" text,
"Time" text,
"Service" text,
PRIMARY KEY ("Train_ID")
)
3 rows from train table:
Train_ID Name Time Service
1 Ananthapuri Express 17:15 Daily
2 Guruvayur Express 22:10 Daily
3 Guruvayur Express 4:49 Daily
CREATE TABLE "train_station" (
"Train_ID" int,
"Station_ID" int,
PRIMARY KEY ("Train_ID","Station_ID"),
FOREIGN KEY ("Train_ID") REFERENCES "train"("Train_ID"),
FOREIGN KEY ("Station_ID") REFERENCES "station"("Station_ID")
)
3 rows from train_station table:
Train_ID Station_ID
1 1
2 1
3 1
|
train_station | Show all train names and times in stations in London in descending order by train time. | SELECT T3.name , T3.time FROM train_station AS T1 JOIN station AS T2 ON T1.station_id = T2.station_id JOIN train AS T3 ON T3.train_id = T1.train_id WHERE T2.location = 'London' ORDER BY T3.time DESC | CREATE TABLE "station" (
"Station_ID" int,
"Name" text,
"Annual_entry_exit" real,
"Annual_interchanges" real,
"Total_Passengers" real,
"Location" text,
"Main_Services" text,
"Number_of_Platforms" int,
PRIMARY KEY ("Station_ID")
)
3 rows from station table:
Station_ID Name Annual_entry_exit Annual_interchanges Total_Passengers Location Main_Services Number_of_Platforms
1 London Waterloo 94.046 9.489 103.534 London South Western Main Line West of England Main Line 19
2 London Victoria 76.231 9.157 85.380 London Brighton Main Line Chatham Main Line 19
3 London Bridge 52.634 8.742 61.376 London South Eastern Main Line Thameslink 12
CREATE TABLE "train" (
"Train_ID" int,
"Name" text,
"Time" text,
"Service" text,
PRIMARY KEY ("Train_ID")
)
3 rows from train table:
Train_ID Name Time Service
1 Ananthapuri Express 17:15 Daily
2 Guruvayur Express 22:10 Daily
3 Guruvayur Express 4:49 Daily
CREATE TABLE "train_station" (
"Train_ID" int,
"Station_ID" int,
PRIMARY KEY ("Train_ID","Station_ID"),
FOREIGN KEY ("Train_ID") REFERENCES "train"("Train_ID"),
FOREIGN KEY ("Station_ID") REFERENCES "station"("Station_ID")
)
3 rows from train_station table:
Train_ID Station_ID
1 1
2 1
3 1
|
train_station | Show the station name with greatest number of trains. | SELECT T2.name FROM train_station AS T1 JOIN station AS T2 ON T1.station_id = T2.station_id GROUP BY T1.station_id ORDER BY count(*) DESC LIMIT 1 | CREATE TABLE "station" (
"Station_ID" int,
"Name" text,
"Annual_entry_exit" real,
"Annual_interchanges" real,
"Total_Passengers" real,
"Location" text,
"Main_Services" text,
"Number_of_Platforms" int,
PRIMARY KEY ("Station_ID")
)
3 rows from station table:
Station_ID Name Annual_entry_exit Annual_interchanges Total_Passengers Location Main_Services Number_of_Platforms
1 London Waterloo 94.046 9.489 103.534 London South Western Main Line West of England Main Line 19
2 London Victoria 76.231 9.157 85.380 London Brighton Main Line Chatham Main Line 19
3 London Bridge 52.634 8.742 61.376 London South Eastern Main Line Thameslink 12
CREATE TABLE "train" (
"Train_ID" int,
"Name" text,
"Time" text,
"Service" text,
PRIMARY KEY ("Train_ID")
)
3 rows from train table:
Train_ID Name Time Service
1 Ananthapuri Express 17:15 Daily
2 Guruvayur Express 22:10 Daily
3 Guruvayur Express 4:49 Daily
CREATE TABLE "train_station" (
"Train_ID" int,
"Station_ID" int,
PRIMARY KEY ("Train_ID","Station_ID"),
FOREIGN KEY ("Train_ID") REFERENCES "train"("Train_ID"),
FOREIGN KEY ("Station_ID") REFERENCES "station"("Station_ID")
)
3 rows from train_station table:
Train_ID Station_ID
1 1
2 1
3 1
|
train_station | Show the station name with at least two trains. | SELECT T2.name FROM train_station AS T1 JOIN station AS T2 ON T1.station_id = T2.station_id GROUP BY T1.station_id HAVING count(*) >= 2 | CREATE TABLE "station" (
"Station_ID" int,
"Name" text,
"Annual_entry_exit" real,
"Annual_interchanges" real,
"Total_Passengers" real,
"Location" text,
"Main_Services" text,
"Number_of_Platforms" int,
PRIMARY KEY ("Station_ID")
)
3 rows from station table:
Station_ID Name Annual_entry_exit Annual_interchanges Total_Passengers Location Main_Services Number_of_Platforms
1 London Waterloo 94.046 9.489 103.534 London South Western Main Line West of England Main Line 19
2 London Victoria 76.231 9.157 85.380 London Brighton Main Line Chatham Main Line 19
3 London Bridge 52.634 8.742 61.376 London South Eastern Main Line Thameslink 12
CREATE TABLE "train" (
"Train_ID" int,
"Name" text,
"Time" text,
"Service" text,
PRIMARY KEY ("Train_ID")
)
3 rows from train table:
Train_ID Name Time Service
1 Ananthapuri Express 17:15 Daily
2 Guruvayur Express 22:10 Daily
3 Guruvayur Express 4:49 Daily
CREATE TABLE "train_station" (
"Train_ID" int,
"Station_ID" int,
PRIMARY KEY ("Train_ID","Station_ID"),
FOREIGN KEY ("Train_ID") REFERENCES "train"("Train_ID"),
FOREIGN KEY ("Station_ID") REFERENCES "station"("Station_ID")
)
3 rows from train_station table:
Train_ID Station_ID
1 1
2 1
3 1
|
train_station | Show all locations with only 1 station. | SELECT LOCATION FROM station GROUP BY LOCATION HAVING count(*) = 1 | CREATE TABLE "station" (
"Station_ID" int,
"Name" text,
"Annual_entry_exit" real,
"Annual_interchanges" real,
"Total_Passengers" real,
"Location" text,
"Main_Services" text,
"Number_of_Platforms" int,
PRIMARY KEY ("Station_ID")
)
3 rows from station table:
Station_ID Name Annual_entry_exit Annual_interchanges Total_Passengers Location Main_Services Number_of_Platforms
1 London Waterloo 94.046 9.489 103.534 London South Western Main Line West of England Main Line 19
2 London Victoria 76.231 9.157 85.380 London Brighton Main Line Chatham Main Line 19
3 London Bridge 52.634 8.742 61.376 London South Eastern Main Line Thameslink 12
CREATE TABLE "train" (
"Train_ID" int,
"Name" text,
"Time" text,
"Service" text,
PRIMARY KEY ("Train_ID")
)
3 rows from train table:
Train_ID Name Time Service
1 Ananthapuri Express 17:15 Daily
2 Guruvayur Express 22:10 Daily
3 Guruvayur Express 4:49 Daily
CREATE TABLE "train_station" (
"Train_ID" int,
"Station_ID" int,
PRIMARY KEY ("Train_ID","Station_ID"),
FOREIGN KEY ("Train_ID") REFERENCES "train"("Train_ID"),
FOREIGN KEY ("Station_ID") REFERENCES "station"("Station_ID")
)
3 rows from train_station table:
Train_ID Station_ID
1 1
2 1
3 1
|
train_station | Show station names without any trains. | SELECT name FROM station WHERE station_id NOT IN (SELECT station_id FROM train_station) | CREATE TABLE "station" (
"Station_ID" int,
"Name" text,
"Annual_entry_exit" real,
"Annual_interchanges" real,
"Total_Passengers" real,
"Location" text,
"Main_Services" text,
"Number_of_Platforms" int,
PRIMARY KEY ("Station_ID")
)
3 rows from station table:
Station_ID Name Annual_entry_exit Annual_interchanges Total_Passengers Location Main_Services Number_of_Platforms
1 London Waterloo 94.046 9.489 103.534 London South Western Main Line West of England Main Line 19
2 London Victoria 76.231 9.157 85.380 London Brighton Main Line Chatham Main Line 19
3 London Bridge 52.634 8.742 61.376 London South Eastern Main Line Thameslink 12
CREATE TABLE "train" (
"Train_ID" int,
"Name" text,
"Time" text,
"Service" text,
PRIMARY KEY ("Train_ID")
)
3 rows from train table:
Train_ID Name Time Service
1 Ananthapuri Express 17:15 Daily
2 Guruvayur Express 22:10 Daily
3 Guruvayur Express 4:49 Daily
CREATE TABLE "train_station" (
"Train_ID" int,
"Station_ID" int,
PRIMARY KEY ("Train_ID","Station_ID"),
FOREIGN KEY ("Train_ID") REFERENCES "train"("Train_ID"),
FOREIGN KEY ("Station_ID") REFERENCES "station"("Station_ID")
)
3 rows from train_station table:
Train_ID Station_ID
1 1
2 1
3 1
|
train_station | What are the names of the stations which serve both "Ananthapuri Express" and "Guruvayur Express" trains? | SELECT T2.name FROM train_station AS T1 JOIN station AS T2 ON T1.station_id = T2.station_id JOIN train AS T3 ON T3.train_id = T1.train_id WHERE T3.Name = "Ananthapuri Express" INTERSECT SELECT T2.name FROM train_station AS T1 JOIN station AS T2 ON T1.station_id = T2.station_id JOIN train AS T3 ON T3.train_id = T1.train_id WHERE T3.Name = "Guruvayur Express" | CREATE TABLE "station" (
"Station_ID" int,
"Name" text,
"Annual_entry_exit" real,
"Annual_interchanges" real,
"Total_Passengers" real,
"Location" text,
"Main_Services" text,
"Number_of_Platforms" int,
PRIMARY KEY ("Station_ID")
)
3 rows from station table:
Station_ID Name Annual_entry_exit Annual_interchanges Total_Passengers Location Main_Services Number_of_Platforms
1 London Waterloo 94.046 9.489 103.534 London South Western Main Line West of England Main Line 19
2 London Victoria 76.231 9.157 85.380 London Brighton Main Line Chatham Main Line 19
3 London Bridge 52.634 8.742 61.376 London South Eastern Main Line Thameslink 12
CREATE TABLE "train" (
"Train_ID" int,
"Name" text,
"Time" text,
"Service" text,
PRIMARY KEY ("Train_ID")
)
3 rows from train table:
Train_ID Name Time Service
1 Ananthapuri Express 17:15 Daily
2 Guruvayur Express 22:10 Daily
3 Guruvayur Express 4:49 Daily
CREATE TABLE "train_station" (
"Train_ID" int,
"Station_ID" int,
PRIMARY KEY ("Train_ID","Station_ID"),
FOREIGN KEY ("Train_ID") REFERENCES "train"("Train_ID"),
FOREIGN KEY ("Station_ID") REFERENCES "station"("Station_ID")
)
3 rows from train_station table:
Train_ID Station_ID
1 1
2 1
3 1
|
train_station | Find the names of the trains that do not pass any station located in London. | SELECT T2.name FROM train_station AS T1 JOIN train AS T2 ON T1.train_id = T2.train_id WHERE T1.station_id NOT IN (SELECT T4.station_id FROM train_station AS T3 JOIN station AS T4 ON T3.station_id = T4.station_id WHERE t4.location = "London") | CREATE TABLE "station" (
"Station_ID" int,
"Name" text,
"Annual_entry_exit" real,
"Annual_interchanges" real,
"Total_Passengers" real,
"Location" text,
"Main_Services" text,
"Number_of_Platforms" int,
PRIMARY KEY ("Station_ID")
)
3 rows from station table:
Station_ID Name Annual_entry_exit Annual_interchanges Total_Passengers Location Main_Services Number_of_Platforms
1 London Waterloo 94.046 9.489 103.534 London South Western Main Line West of England Main Line 19
2 London Victoria 76.231 9.157 85.380 London Brighton Main Line Chatham Main Line 19
3 London Bridge 52.634 8.742 61.376 London South Eastern Main Line Thameslink 12
CREATE TABLE "train" (
"Train_ID" int,
"Name" text,
"Time" text,
"Service" text,
PRIMARY KEY ("Train_ID")
)
3 rows from train table:
Train_ID Name Time Service
1 Ananthapuri Express 17:15 Daily
2 Guruvayur Express 22:10 Daily
3 Guruvayur Express 4:49 Daily
CREATE TABLE "train_station" (
"Train_ID" int,
"Station_ID" int,
PRIMARY KEY ("Train_ID","Station_ID"),
FOREIGN KEY ("Train_ID") REFERENCES "train"("Train_ID"),
FOREIGN KEY ("Station_ID") REFERENCES "station"("Station_ID")
)
3 rows from train_station table:
Train_ID Station_ID
1 1
2 1
3 1
|
train_station | List the names and locations of all stations ordered by their yearly entry exit and interchange amounts. | SELECT name , LOCATION FROM station ORDER BY Annual_entry_exit , Annual_interchanges | CREATE TABLE "station" (
"Station_ID" int,
"Name" text,
"Annual_entry_exit" real,
"Annual_interchanges" real,
"Total_Passengers" real,
"Location" text,
"Main_Services" text,
"Number_of_Platforms" int,
PRIMARY KEY ("Station_ID")
)
3 rows from station table:
Station_ID Name Annual_entry_exit Annual_interchanges Total_Passengers Location Main_Services Number_of_Platforms
1 London Waterloo 94.046 9.489 103.534 London South Western Main Line West of England Main Line 19
2 London Victoria 76.231 9.157 85.380 London Brighton Main Line Chatham Main Line 19
3 London Bridge 52.634 8.742 61.376 London South Eastern Main Line Thameslink 12
CREATE TABLE "train" (
"Train_ID" int,
"Name" text,
"Time" text,
"Service" text,
PRIMARY KEY ("Train_ID")
)
3 rows from train table:
Train_ID Name Time Service
1 Ananthapuri Express 17:15 Daily
2 Guruvayur Express 22:10 Daily
3 Guruvayur Express 4:49 Daily
CREATE TABLE "train_station" (
"Train_ID" int,
"Station_ID" int,
PRIMARY KEY ("Train_ID","Station_ID"),
FOREIGN KEY ("Train_ID") REFERENCES "train"("Train_ID"),
FOREIGN KEY ("Station_ID") REFERENCES "station"("Station_ID")
)
3 rows from train_station table:
Train_ID Station_ID
1 1
2 1
3 1
|
driving_school | List all vehicle id | SELECT vehicle_id FROM Vehicles; | CREATE TABLE `Addresses` (
`address_id` INTEGER PRIMARY KEY,
`line_1_number_building` VARCHAR(80),
`city` VARCHAR(50),
`zip_postcode` VARCHAR(20),
`state_province_county` VARCHAR(50),
`country` VARCHAR(50)
)
3 rows from Addresses table:
address_id line_1_number_building city zip_postcode state_province_county country
1 3904 Stroman Passage Port Melyssa 14445 Georgia USA
2 053 Quigley Island Hagenesfurt 22194 Kentucky USA
3 00704 Zoe Alley Lake Elaina 08938 Georgia USA
CREATE TABLE `Staff` (
`staff_id` INTEGER PRIMARY KEY,
`staff_address_id` INTEGER NOT NULL,
`nickname` VARCHAR(80),
`first_name` VARCHAR(80),
`middle_name` VARCHAR(80),
`last_name` VARCHAR(80),
`date_of_birth` DATETIME,
`date_joined_staff` DATETIME,
`date_left_staff` DATETIME,
FOREIGN KEY (`staff_address_id` ) REFERENCES `Addresses`(`address_id` )
)
3 rows from Staff table:
staff_id staff_address_id nickname first_name middle_name last_name date_of_birth date_joined_staff date_left_staff
1 14 thompson.constantin Janessa Amara Sawayn 2010-12-08 16:55:14 2017-04-27 03:21:26 2018-03-23 22:53:12
2 3 santos45 Camylle Icie Weissnat 2015-08-01 13:22:43 2016-06-06 08:54:28 2018-03-10 15:25:00
3 5 ynader Kaitlin Stephania Mertz 1994-05-17 05:32:11 2018-01-02 12:24:24 2018-03-24 10:11:08
CREATE TABLE `Vehicles` (
`vehicle_id` INTEGER PRIMARY KEY,
`vehicle_details` VARCHAR(255)
)
3 rows from Vehicles table:
vehicle_id vehicle_details
1 Van
2 Truck
3 Car
CREATE TABLE `Customers` (
`customer_id` INTEGER PRIMARY KEY,
`customer_address_id` INTEGER NOT NULL,
`customer_status_code` VARCHAR(15) NOT NULL,
`date_became_customer` DATETIME,
`date_of_birth` DATETIME,
`first_name` VARCHAR(80),
`last_name` VARCHAR(80),
`amount_outstanding` DOUBLE NULL,
`email_address` VARCHAR(250),
`phone_number` VARCHAR(255),
`cell_mobile_phone_number` VARCHAR(255),
FOREIGN KEY (`customer_address_id` ) REFERENCES `Addresses`(`address_id` )
)
3 rows from Customers table:
customer_id customer_address_id customer_status_code date_became_customer date_of_birth first_name last_name amount_outstanding email_address phone_number cell_mobile_phone_number
1 13 Bad Customer 2016-05-11 17:03:48 1998-12-15 13:24:40 Carole Bernhard 255.0 everette.goyette@example.org 07278206718 861-638-9797
2 10 Bad Customer 2015-11-16 22:52:14 1995-07-17 12:13:16 Genevieve Terry 7256.0 huel.jana@example.org +14(5)2351480248 578-518-4785x612
3 10 Good Customer 2016-04-08 00:28:15 1994-06-21 01:34:56 Clara Ortiz 9443.0 hilario.sporer@example.org 374-483-2758x85087 1-197-686-2849x8761
CREATE TABLE `Customer_Payments` (
`customer_id` INTEGER NOT NULL,
`datetime_payment` DATETIME NOT NULL,
`payment_method_code` VARCHAR(10) NOT NULL,
`amount_payment` DOUBLE NULL,
PRIMARY KEY (`customer_id`,`datetime_payment`),
FOREIGN KEY (`customer_id` ) REFERENCES `Customers`(`customer_id` )
)
3 rows from Customer_Payments table:
customer_id datetime_payment payment_method_code amount_payment
11 2018-02-05 18:44:46 Direct Debit 9570.93
2 2018-02-24 10:07:05 Direct Debit 8180.26
14 2018-02-27 20:08:53 Direct Debit 4610.26
CREATE TABLE `Lessons` (
`lesson_id` INTEGER PRIMARY KEY,
`customer_id` INTEGER NOT NULL,
`lesson_status_code` VARCHAR(15) NOT NULL,
`staff_id` INTEGER,
`vehicle_id` INTEGER NOT NULL,
`lesson_date` DATETIME,
`lesson_time` VARCHAR(10),
`price` DOUBLE NULL,
FOREIGN KEY (`vehicle_id` ) REFERENCES `Vehicles`(`vehicle_id` ),
FOREIGN KEY (`staff_id` ) REFERENCES `Staff`(`staff_id` ),
FOREIGN KEY (`customer_id` ) REFERENCES `Customers`(`customer_id` )
)
3 rows from Lessons table:
lesson_id customer_id lesson_status_code staff_id vehicle_id lesson_date lesson_time price
1 6 Cancelled 8 3 2018-02-28 10:55:36 5 199.0
2 8 Cancelled 14 3 2018-03-07 16:12:36 6 167.0
3 6 Cancelled 11 2 2018-03-03 15:10:16 3 352.0
|
driving_school | What are the ids of all vehicles? | SELECT vehicle_id FROM Vehicles; | CREATE TABLE `Addresses` (
`address_id` INTEGER PRIMARY KEY,
`line_1_number_building` VARCHAR(80),
`city` VARCHAR(50),
`zip_postcode` VARCHAR(20),
`state_province_county` VARCHAR(50),
`country` VARCHAR(50)
)
3 rows from Addresses table:
address_id line_1_number_building city zip_postcode state_province_county country
1 3904 Stroman Passage Port Melyssa 14445 Georgia USA
2 053 Quigley Island Hagenesfurt 22194 Kentucky USA
3 00704 Zoe Alley Lake Elaina 08938 Georgia USA
CREATE TABLE `Staff` (
`staff_id` INTEGER PRIMARY KEY,
`staff_address_id` INTEGER NOT NULL,
`nickname` VARCHAR(80),
`first_name` VARCHAR(80),
`middle_name` VARCHAR(80),
`last_name` VARCHAR(80),
`date_of_birth` DATETIME,
`date_joined_staff` DATETIME,
`date_left_staff` DATETIME,
FOREIGN KEY (`staff_address_id` ) REFERENCES `Addresses`(`address_id` )
)
3 rows from Staff table:
staff_id staff_address_id nickname first_name middle_name last_name date_of_birth date_joined_staff date_left_staff
1 14 thompson.constantin Janessa Amara Sawayn 2010-12-08 16:55:14 2017-04-27 03:21:26 2018-03-23 22:53:12
2 3 santos45 Camylle Icie Weissnat 2015-08-01 13:22:43 2016-06-06 08:54:28 2018-03-10 15:25:00
3 5 ynader Kaitlin Stephania Mertz 1994-05-17 05:32:11 2018-01-02 12:24:24 2018-03-24 10:11:08
CREATE TABLE `Vehicles` (
`vehicle_id` INTEGER PRIMARY KEY,
`vehicle_details` VARCHAR(255)
)
3 rows from Vehicles table:
vehicle_id vehicle_details
1 Van
2 Truck
3 Car
CREATE TABLE `Customers` (
`customer_id` INTEGER PRIMARY KEY,
`customer_address_id` INTEGER NOT NULL,
`customer_status_code` VARCHAR(15) NOT NULL,
`date_became_customer` DATETIME,
`date_of_birth` DATETIME,
`first_name` VARCHAR(80),
`last_name` VARCHAR(80),
`amount_outstanding` DOUBLE NULL,
`email_address` VARCHAR(250),
`phone_number` VARCHAR(255),
`cell_mobile_phone_number` VARCHAR(255),
FOREIGN KEY (`customer_address_id` ) REFERENCES `Addresses`(`address_id` )
)
3 rows from Customers table:
customer_id customer_address_id customer_status_code date_became_customer date_of_birth first_name last_name amount_outstanding email_address phone_number cell_mobile_phone_number
1 13 Bad Customer 2016-05-11 17:03:48 1998-12-15 13:24:40 Carole Bernhard 255.0 everette.goyette@example.org 07278206718 861-638-9797
2 10 Bad Customer 2015-11-16 22:52:14 1995-07-17 12:13:16 Genevieve Terry 7256.0 huel.jana@example.org +14(5)2351480248 578-518-4785x612
3 10 Good Customer 2016-04-08 00:28:15 1994-06-21 01:34:56 Clara Ortiz 9443.0 hilario.sporer@example.org 374-483-2758x85087 1-197-686-2849x8761
CREATE TABLE `Customer_Payments` (
`customer_id` INTEGER NOT NULL,
`datetime_payment` DATETIME NOT NULL,
`payment_method_code` VARCHAR(10) NOT NULL,
`amount_payment` DOUBLE NULL,
PRIMARY KEY (`customer_id`,`datetime_payment`),
FOREIGN KEY (`customer_id` ) REFERENCES `Customers`(`customer_id` )
)
3 rows from Customer_Payments table:
customer_id datetime_payment payment_method_code amount_payment
11 2018-02-05 18:44:46 Direct Debit 9570.93
2 2018-02-24 10:07:05 Direct Debit 8180.26
14 2018-02-27 20:08:53 Direct Debit 4610.26
CREATE TABLE `Lessons` (
`lesson_id` INTEGER PRIMARY KEY,
`customer_id` INTEGER NOT NULL,
`lesson_status_code` VARCHAR(15) NOT NULL,
`staff_id` INTEGER,
`vehicle_id` INTEGER NOT NULL,
`lesson_date` DATETIME,
`lesson_time` VARCHAR(10),
`price` DOUBLE NULL,
FOREIGN KEY (`vehicle_id` ) REFERENCES `Vehicles`(`vehicle_id` ),
FOREIGN KEY (`staff_id` ) REFERENCES `Staff`(`staff_id` ),
FOREIGN KEY (`customer_id` ) REFERENCES `Customers`(`customer_id` )
)
3 rows from Lessons table:
lesson_id customer_id lesson_status_code staff_id vehicle_id lesson_date lesson_time price
1 6 Cancelled 8 3 2018-02-28 10:55:36 5 199.0
2 8 Cancelled 14 3 2018-03-07 16:12:36 6 167.0
3 6 Cancelled 11 2 2018-03-03 15:10:16 3 352.0
|
driving_school | How many vehicle in total? | SELECT count(*) FROM Vehicles; | CREATE TABLE `Addresses` (
`address_id` INTEGER PRIMARY KEY,
`line_1_number_building` VARCHAR(80),
`city` VARCHAR(50),
`zip_postcode` VARCHAR(20),
`state_province_county` VARCHAR(50),
`country` VARCHAR(50)
)
3 rows from Addresses table:
address_id line_1_number_building city zip_postcode state_province_county country
1 3904 Stroman Passage Port Melyssa 14445 Georgia USA
2 053 Quigley Island Hagenesfurt 22194 Kentucky USA
3 00704 Zoe Alley Lake Elaina 08938 Georgia USA
CREATE TABLE `Staff` (
`staff_id` INTEGER PRIMARY KEY,
`staff_address_id` INTEGER NOT NULL,
`nickname` VARCHAR(80),
`first_name` VARCHAR(80),
`middle_name` VARCHAR(80),
`last_name` VARCHAR(80),
`date_of_birth` DATETIME,
`date_joined_staff` DATETIME,
`date_left_staff` DATETIME,
FOREIGN KEY (`staff_address_id` ) REFERENCES `Addresses`(`address_id` )
)
3 rows from Staff table:
staff_id staff_address_id nickname first_name middle_name last_name date_of_birth date_joined_staff date_left_staff
1 14 thompson.constantin Janessa Amara Sawayn 2010-12-08 16:55:14 2017-04-27 03:21:26 2018-03-23 22:53:12
2 3 santos45 Camylle Icie Weissnat 2015-08-01 13:22:43 2016-06-06 08:54:28 2018-03-10 15:25:00
3 5 ynader Kaitlin Stephania Mertz 1994-05-17 05:32:11 2018-01-02 12:24:24 2018-03-24 10:11:08
CREATE TABLE `Vehicles` (
`vehicle_id` INTEGER PRIMARY KEY,
`vehicle_details` VARCHAR(255)
)
3 rows from Vehicles table:
vehicle_id vehicle_details
1 Van
2 Truck
3 Car
CREATE TABLE `Customers` (
`customer_id` INTEGER PRIMARY KEY,
`customer_address_id` INTEGER NOT NULL,
`customer_status_code` VARCHAR(15) NOT NULL,
`date_became_customer` DATETIME,
`date_of_birth` DATETIME,
`first_name` VARCHAR(80),
`last_name` VARCHAR(80),
`amount_outstanding` DOUBLE NULL,
`email_address` VARCHAR(250),
`phone_number` VARCHAR(255),
`cell_mobile_phone_number` VARCHAR(255),
FOREIGN KEY (`customer_address_id` ) REFERENCES `Addresses`(`address_id` )
)
3 rows from Customers table:
customer_id customer_address_id customer_status_code date_became_customer date_of_birth first_name last_name amount_outstanding email_address phone_number cell_mobile_phone_number
1 13 Bad Customer 2016-05-11 17:03:48 1998-12-15 13:24:40 Carole Bernhard 255.0 everette.goyette@example.org 07278206718 861-638-9797
2 10 Bad Customer 2015-11-16 22:52:14 1995-07-17 12:13:16 Genevieve Terry 7256.0 huel.jana@example.org +14(5)2351480248 578-518-4785x612
3 10 Good Customer 2016-04-08 00:28:15 1994-06-21 01:34:56 Clara Ortiz 9443.0 hilario.sporer@example.org 374-483-2758x85087 1-197-686-2849x8761
CREATE TABLE `Customer_Payments` (
`customer_id` INTEGER NOT NULL,
`datetime_payment` DATETIME NOT NULL,
`payment_method_code` VARCHAR(10) NOT NULL,
`amount_payment` DOUBLE NULL,
PRIMARY KEY (`customer_id`,`datetime_payment`),
FOREIGN KEY (`customer_id` ) REFERENCES `Customers`(`customer_id` )
)
3 rows from Customer_Payments table:
customer_id datetime_payment payment_method_code amount_payment
11 2018-02-05 18:44:46 Direct Debit 9570.93
2 2018-02-24 10:07:05 Direct Debit 8180.26
14 2018-02-27 20:08:53 Direct Debit 4610.26
CREATE TABLE `Lessons` (
`lesson_id` INTEGER PRIMARY KEY,
`customer_id` INTEGER NOT NULL,
`lesson_status_code` VARCHAR(15) NOT NULL,
`staff_id` INTEGER,
`vehicle_id` INTEGER NOT NULL,
`lesson_date` DATETIME,
`lesson_time` VARCHAR(10),
`price` DOUBLE NULL,
FOREIGN KEY (`vehicle_id` ) REFERENCES `Vehicles`(`vehicle_id` ),
FOREIGN KEY (`staff_id` ) REFERENCES `Staff`(`staff_id` ),
FOREIGN KEY (`customer_id` ) REFERENCES `Customers`(`customer_id` )
)
3 rows from Lessons table:
lesson_id customer_id lesson_status_code staff_id vehicle_id lesson_date lesson_time price
1 6 Cancelled 8 3 2018-02-28 10:55:36 5 199.0
2 8 Cancelled 14 3 2018-03-07 16:12:36 6 167.0
3 6 Cancelled 11 2 2018-03-03 15:10:16 3 352.0
|
driving_school | How many vehicles exist? | SELECT count(*) FROM Vehicles; | CREATE TABLE `Addresses` (
`address_id` INTEGER PRIMARY KEY,
`line_1_number_building` VARCHAR(80),
`city` VARCHAR(50),
`zip_postcode` VARCHAR(20),
`state_province_county` VARCHAR(50),
`country` VARCHAR(50)
)
3 rows from Addresses table:
address_id line_1_number_building city zip_postcode state_province_county country
1 3904 Stroman Passage Port Melyssa 14445 Georgia USA
2 053 Quigley Island Hagenesfurt 22194 Kentucky USA
3 00704 Zoe Alley Lake Elaina 08938 Georgia USA
CREATE TABLE `Staff` (
`staff_id` INTEGER PRIMARY KEY,
`staff_address_id` INTEGER NOT NULL,
`nickname` VARCHAR(80),
`first_name` VARCHAR(80),
`middle_name` VARCHAR(80),
`last_name` VARCHAR(80),
`date_of_birth` DATETIME,
`date_joined_staff` DATETIME,
`date_left_staff` DATETIME,
FOREIGN KEY (`staff_address_id` ) REFERENCES `Addresses`(`address_id` )
)
3 rows from Staff table:
staff_id staff_address_id nickname first_name middle_name last_name date_of_birth date_joined_staff date_left_staff
1 14 thompson.constantin Janessa Amara Sawayn 2010-12-08 16:55:14 2017-04-27 03:21:26 2018-03-23 22:53:12
2 3 santos45 Camylle Icie Weissnat 2015-08-01 13:22:43 2016-06-06 08:54:28 2018-03-10 15:25:00
3 5 ynader Kaitlin Stephania Mertz 1994-05-17 05:32:11 2018-01-02 12:24:24 2018-03-24 10:11:08
CREATE TABLE `Vehicles` (
`vehicle_id` INTEGER PRIMARY KEY,
`vehicle_details` VARCHAR(255)
)
3 rows from Vehicles table:
vehicle_id vehicle_details
1 Van
2 Truck
3 Car
CREATE TABLE `Customers` (
`customer_id` INTEGER PRIMARY KEY,
`customer_address_id` INTEGER NOT NULL,
`customer_status_code` VARCHAR(15) NOT NULL,
`date_became_customer` DATETIME,
`date_of_birth` DATETIME,
`first_name` VARCHAR(80),
`last_name` VARCHAR(80),
`amount_outstanding` DOUBLE NULL,
`email_address` VARCHAR(250),
`phone_number` VARCHAR(255),
`cell_mobile_phone_number` VARCHAR(255),
FOREIGN KEY (`customer_address_id` ) REFERENCES `Addresses`(`address_id` )
)
3 rows from Customers table:
customer_id customer_address_id customer_status_code date_became_customer date_of_birth first_name last_name amount_outstanding email_address phone_number cell_mobile_phone_number
1 13 Bad Customer 2016-05-11 17:03:48 1998-12-15 13:24:40 Carole Bernhard 255.0 everette.goyette@example.org 07278206718 861-638-9797
2 10 Bad Customer 2015-11-16 22:52:14 1995-07-17 12:13:16 Genevieve Terry 7256.0 huel.jana@example.org +14(5)2351480248 578-518-4785x612
3 10 Good Customer 2016-04-08 00:28:15 1994-06-21 01:34:56 Clara Ortiz 9443.0 hilario.sporer@example.org 374-483-2758x85087 1-197-686-2849x8761
CREATE TABLE `Customer_Payments` (
`customer_id` INTEGER NOT NULL,
`datetime_payment` DATETIME NOT NULL,
`payment_method_code` VARCHAR(10) NOT NULL,
`amount_payment` DOUBLE NULL,
PRIMARY KEY (`customer_id`,`datetime_payment`),
FOREIGN KEY (`customer_id` ) REFERENCES `Customers`(`customer_id` )
)
3 rows from Customer_Payments table:
customer_id datetime_payment payment_method_code amount_payment
11 2018-02-05 18:44:46 Direct Debit 9570.93
2 2018-02-24 10:07:05 Direct Debit 8180.26
14 2018-02-27 20:08:53 Direct Debit 4610.26
CREATE TABLE `Lessons` (
`lesson_id` INTEGER PRIMARY KEY,
`customer_id` INTEGER NOT NULL,
`lesson_status_code` VARCHAR(15) NOT NULL,
`staff_id` INTEGER,
`vehicle_id` INTEGER NOT NULL,
`lesson_date` DATETIME,
`lesson_time` VARCHAR(10),
`price` DOUBLE NULL,
FOREIGN KEY (`vehicle_id` ) REFERENCES `Vehicles`(`vehicle_id` ),
FOREIGN KEY (`staff_id` ) REFERENCES `Staff`(`staff_id` ),
FOREIGN KEY (`customer_id` ) REFERENCES `Customers`(`customer_id` )
)
3 rows from Lessons table:
lesson_id customer_id lesson_status_code staff_id vehicle_id lesson_date lesson_time price
1 6 Cancelled 8 3 2018-02-28 10:55:36 5 199.0
2 8 Cancelled 14 3 2018-03-07 16:12:36 6 167.0
3 6 Cancelled 11 2 2018-03-03 15:10:16 3 352.0
|
driving_school | Show the detail of vehicle with id 1. | SELECT vehicle_details FROM Vehicles WHERE vehicle_id = 1; | CREATE TABLE `Addresses` (
`address_id` INTEGER PRIMARY KEY,
`line_1_number_building` VARCHAR(80),
`city` VARCHAR(50),
`zip_postcode` VARCHAR(20),
`state_province_county` VARCHAR(50),
`country` VARCHAR(50)
)
3 rows from Addresses table:
address_id line_1_number_building city zip_postcode state_province_county country
1 3904 Stroman Passage Port Melyssa 14445 Georgia USA
2 053 Quigley Island Hagenesfurt 22194 Kentucky USA
3 00704 Zoe Alley Lake Elaina 08938 Georgia USA
CREATE TABLE `Staff` (
`staff_id` INTEGER PRIMARY KEY,
`staff_address_id` INTEGER NOT NULL,
`nickname` VARCHAR(80),
`first_name` VARCHAR(80),
`middle_name` VARCHAR(80),
`last_name` VARCHAR(80),
`date_of_birth` DATETIME,
`date_joined_staff` DATETIME,
`date_left_staff` DATETIME,
FOREIGN KEY (`staff_address_id` ) REFERENCES `Addresses`(`address_id` )
)
3 rows from Staff table:
staff_id staff_address_id nickname first_name middle_name last_name date_of_birth date_joined_staff date_left_staff
1 14 thompson.constantin Janessa Amara Sawayn 2010-12-08 16:55:14 2017-04-27 03:21:26 2018-03-23 22:53:12
2 3 santos45 Camylle Icie Weissnat 2015-08-01 13:22:43 2016-06-06 08:54:28 2018-03-10 15:25:00
3 5 ynader Kaitlin Stephania Mertz 1994-05-17 05:32:11 2018-01-02 12:24:24 2018-03-24 10:11:08
CREATE TABLE `Vehicles` (
`vehicle_id` INTEGER PRIMARY KEY,
`vehicle_details` VARCHAR(255)
)
3 rows from Vehicles table:
vehicle_id vehicle_details
1 Van
2 Truck
3 Car
CREATE TABLE `Customers` (
`customer_id` INTEGER PRIMARY KEY,
`customer_address_id` INTEGER NOT NULL,
`customer_status_code` VARCHAR(15) NOT NULL,
`date_became_customer` DATETIME,
`date_of_birth` DATETIME,
`first_name` VARCHAR(80),
`last_name` VARCHAR(80),
`amount_outstanding` DOUBLE NULL,
`email_address` VARCHAR(250),
`phone_number` VARCHAR(255),
`cell_mobile_phone_number` VARCHAR(255),
FOREIGN KEY (`customer_address_id` ) REFERENCES `Addresses`(`address_id` )
)
3 rows from Customers table:
customer_id customer_address_id customer_status_code date_became_customer date_of_birth first_name last_name amount_outstanding email_address phone_number cell_mobile_phone_number
1 13 Bad Customer 2016-05-11 17:03:48 1998-12-15 13:24:40 Carole Bernhard 255.0 everette.goyette@example.org 07278206718 861-638-9797
2 10 Bad Customer 2015-11-16 22:52:14 1995-07-17 12:13:16 Genevieve Terry 7256.0 huel.jana@example.org +14(5)2351480248 578-518-4785x612
3 10 Good Customer 2016-04-08 00:28:15 1994-06-21 01:34:56 Clara Ortiz 9443.0 hilario.sporer@example.org 374-483-2758x85087 1-197-686-2849x8761
CREATE TABLE `Customer_Payments` (
`customer_id` INTEGER NOT NULL,
`datetime_payment` DATETIME NOT NULL,
`payment_method_code` VARCHAR(10) NOT NULL,
`amount_payment` DOUBLE NULL,
PRIMARY KEY (`customer_id`,`datetime_payment`),
FOREIGN KEY (`customer_id` ) REFERENCES `Customers`(`customer_id` )
)
3 rows from Customer_Payments table:
customer_id datetime_payment payment_method_code amount_payment
11 2018-02-05 18:44:46 Direct Debit 9570.93
2 2018-02-24 10:07:05 Direct Debit 8180.26
14 2018-02-27 20:08:53 Direct Debit 4610.26
CREATE TABLE `Lessons` (
`lesson_id` INTEGER PRIMARY KEY,
`customer_id` INTEGER NOT NULL,
`lesson_status_code` VARCHAR(15) NOT NULL,
`staff_id` INTEGER,
`vehicle_id` INTEGER NOT NULL,
`lesson_date` DATETIME,
`lesson_time` VARCHAR(10),
`price` DOUBLE NULL,
FOREIGN KEY (`vehicle_id` ) REFERENCES `Vehicles`(`vehicle_id` ),
FOREIGN KEY (`staff_id` ) REFERENCES `Staff`(`staff_id` ),
FOREIGN KEY (`customer_id` ) REFERENCES `Customers`(`customer_id` )
)
3 rows from Lessons table:
lesson_id customer_id lesson_status_code staff_id vehicle_id lesson_date lesson_time price
1 6 Cancelled 8 3 2018-02-28 10:55:36 5 199.0
2 8 Cancelled 14 3 2018-03-07 16:12:36 6 167.0
3 6 Cancelled 11 2 2018-03-03 15:10:16 3 352.0
|
driving_school | What are the details of the car with id 1? | SELECT vehicle_details FROM Vehicles WHERE vehicle_id = 1; | CREATE TABLE `Addresses` (
`address_id` INTEGER PRIMARY KEY,
`line_1_number_building` VARCHAR(80),
`city` VARCHAR(50),
`zip_postcode` VARCHAR(20),
`state_province_county` VARCHAR(50),
`country` VARCHAR(50)
)
3 rows from Addresses table:
address_id line_1_number_building city zip_postcode state_province_county country
1 3904 Stroman Passage Port Melyssa 14445 Georgia USA
2 053 Quigley Island Hagenesfurt 22194 Kentucky USA
3 00704 Zoe Alley Lake Elaina 08938 Georgia USA
CREATE TABLE `Staff` (
`staff_id` INTEGER PRIMARY KEY,
`staff_address_id` INTEGER NOT NULL,
`nickname` VARCHAR(80),
`first_name` VARCHAR(80),
`middle_name` VARCHAR(80),
`last_name` VARCHAR(80),
`date_of_birth` DATETIME,
`date_joined_staff` DATETIME,
`date_left_staff` DATETIME,
FOREIGN KEY (`staff_address_id` ) REFERENCES `Addresses`(`address_id` )
)
3 rows from Staff table:
staff_id staff_address_id nickname first_name middle_name last_name date_of_birth date_joined_staff date_left_staff
1 14 thompson.constantin Janessa Amara Sawayn 2010-12-08 16:55:14 2017-04-27 03:21:26 2018-03-23 22:53:12
2 3 santos45 Camylle Icie Weissnat 2015-08-01 13:22:43 2016-06-06 08:54:28 2018-03-10 15:25:00
3 5 ynader Kaitlin Stephania Mertz 1994-05-17 05:32:11 2018-01-02 12:24:24 2018-03-24 10:11:08
CREATE TABLE `Vehicles` (
`vehicle_id` INTEGER PRIMARY KEY,
`vehicle_details` VARCHAR(255)
)
3 rows from Vehicles table:
vehicle_id vehicle_details
1 Van
2 Truck
3 Car
CREATE TABLE `Customers` (
`customer_id` INTEGER PRIMARY KEY,
`customer_address_id` INTEGER NOT NULL,
`customer_status_code` VARCHAR(15) NOT NULL,
`date_became_customer` DATETIME,
`date_of_birth` DATETIME,
`first_name` VARCHAR(80),
`last_name` VARCHAR(80),
`amount_outstanding` DOUBLE NULL,
`email_address` VARCHAR(250),
`phone_number` VARCHAR(255),
`cell_mobile_phone_number` VARCHAR(255),
FOREIGN KEY (`customer_address_id` ) REFERENCES `Addresses`(`address_id` )
)
3 rows from Customers table:
customer_id customer_address_id customer_status_code date_became_customer date_of_birth first_name last_name amount_outstanding email_address phone_number cell_mobile_phone_number
1 13 Bad Customer 2016-05-11 17:03:48 1998-12-15 13:24:40 Carole Bernhard 255.0 everette.goyette@example.org 07278206718 861-638-9797
2 10 Bad Customer 2015-11-16 22:52:14 1995-07-17 12:13:16 Genevieve Terry 7256.0 huel.jana@example.org +14(5)2351480248 578-518-4785x612
3 10 Good Customer 2016-04-08 00:28:15 1994-06-21 01:34:56 Clara Ortiz 9443.0 hilario.sporer@example.org 374-483-2758x85087 1-197-686-2849x8761
CREATE TABLE `Customer_Payments` (
`customer_id` INTEGER NOT NULL,
`datetime_payment` DATETIME NOT NULL,
`payment_method_code` VARCHAR(10) NOT NULL,
`amount_payment` DOUBLE NULL,
PRIMARY KEY (`customer_id`,`datetime_payment`),
FOREIGN KEY (`customer_id` ) REFERENCES `Customers`(`customer_id` )
)
3 rows from Customer_Payments table:
customer_id datetime_payment payment_method_code amount_payment
11 2018-02-05 18:44:46 Direct Debit 9570.93
2 2018-02-24 10:07:05 Direct Debit 8180.26
14 2018-02-27 20:08:53 Direct Debit 4610.26
CREATE TABLE `Lessons` (
`lesson_id` INTEGER PRIMARY KEY,
`customer_id` INTEGER NOT NULL,
`lesson_status_code` VARCHAR(15) NOT NULL,
`staff_id` INTEGER,
`vehicle_id` INTEGER NOT NULL,
`lesson_date` DATETIME,
`lesson_time` VARCHAR(10),
`price` DOUBLE NULL,
FOREIGN KEY (`vehicle_id` ) REFERENCES `Vehicles`(`vehicle_id` ),
FOREIGN KEY (`staff_id` ) REFERENCES `Staff`(`staff_id` ),
FOREIGN KEY (`customer_id` ) REFERENCES `Customers`(`customer_id` )
)
3 rows from Lessons table:
lesson_id customer_id lesson_status_code staff_id vehicle_id lesson_date lesson_time price
1 6 Cancelled 8 3 2018-02-28 10:55:36 5 199.0
2 8 Cancelled 14 3 2018-03-07 16:12:36 6 167.0
3 6 Cancelled 11 2 2018-03-03 15:10:16 3 352.0
|
driving_school | List the first name middle name and last name of all staff. | SELECT first_name , middle_name , last_name FROM Staff; | CREATE TABLE `Addresses` (
`address_id` INTEGER PRIMARY KEY,
`line_1_number_building` VARCHAR(80),
`city` VARCHAR(50),
`zip_postcode` VARCHAR(20),
`state_province_county` VARCHAR(50),
`country` VARCHAR(50)
)
3 rows from Addresses table:
address_id line_1_number_building city zip_postcode state_province_county country
1 3904 Stroman Passage Port Melyssa 14445 Georgia USA
2 053 Quigley Island Hagenesfurt 22194 Kentucky USA
3 00704 Zoe Alley Lake Elaina 08938 Georgia USA
CREATE TABLE `Staff` (
`staff_id` INTEGER PRIMARY KEY,
`staff_address_id` INTEGER NOT NULL,
`nickname` VARCHAR(80),
`first_name` VARCHAR(80),
`middle_name` VARCHAR(80),
`last_name` VARCHAR(80),
`date_of_birth` DATETIME,
`date_joined_staff` DATETIME,
`date_left_staff` DATETIME,
FOREIGN KEY (`staff_address_id` ) REFERENCES `Addresses`(`address_id` )
)
3 rows from Staff table:
staff_id staff_address_id nickname first_name middle_name last_name date_of_birth date_joined_staff date_left_staff
1 14 thompson.constantin Janessa Amara Sawayn 2010-12-08 16:55:14 2017-04-27 03:21:26 2018-03-23 22:53:12
2 3 santos45 Camylle Icie Weissnat 2015-08-01 13:22:43 2016-06-06 08:54:28 2018-03-10 15:25:00
3 5 ynader Kaitlin Stephania Mertz 1994-05-17 05:32:11 2018-01-02 12:24:24 2018-03-24 10:11:08
CREATE TABLE `Vehicles` (
`vehicle_id` INTEGER PRIMARY KEY,
`vehicle_details` VARCHAR(255)
)
3 rows from Vehicles table:
vehicle_id vehicle_details
1 Van
2 Truck
3 Car
CREATE TABLE `Customers` (
`customer_id` INTEGER PRIMARY KEY,
`customer_address_id` INTEGER NOT NULL,
`customer_status_code` VARCHAR(15) NOT NULL,
`date_became_customer` DATETIME,
`date_of_birth` DATETIME,
`first_name` VARCHAR(80),
`last_name` VARCHAR(80),
`amount_outstanding` DOUBLE NULL,
`email_address` VARCHAR(250),
`phone_number` VARCHAR(255),
`cell_mobile_phone_number` VARCHAR(255),
FOREIGN KEY (`customer_address_id` ) REFERENCES `Addresses`(`address_id` )
)
3 rows from Customers table:
customer_id customer_address_id customer_status_code date_became_customer date_of_birth first_name last_name amount_outstanding email_address phone_number cell_mobile_phone_number
1 13 Bad Customer 2016-05-11 17:03:48 1998-12-15 13:24:40 Carole Bernhard 255.0 everette.goyette@example.org 07278206718 861-638-9797
2 10 Bad Customer 2015-11-16 22:52:14 1995-07-17 12:13:16 Genevieve Terry 7256.0 huel.jana@example.org +14(5)2351480248 578-518-4785x612
3 10 Good Customer 2016-04-08 00:28:15 1994-06-21 01:34:56 Clara Ortiz 9443.0 hilario.sporer@example.org 374-483-2758x85087 1-197-686-2849x8761
CREATE TABLE `Customer_Payments` (
`customer_id` INTEGER NOT NULL,
`datetime_payment` DATETIME NOT NULL,
`payment_method_code` VARCHAR(10) NOT NULL,
`amount_payment` DOUBLE NULL,
PRIMARY KEY (`customer_id`,`datetime_payment`),
FOREIGN KEY (`customer_id` ) REFERENCES `Customers`(`customer_id` )
)
3 rows from Customer_Payments table:
customer_id datetime_payment payment_method_code amount_payment
11 2018-02-05 18:44:46 Direct Debit 9570.93
2 2018-02-24 10:07:05 Direct Debit 8180.26
14 2018-02-27 20:08:53 Direct Debit 4610.26
CREATE TABLE `Lessons` (
`lesson_id` INTEGER PRIMARY KEY,
`customer_id` INTEGER NOT NULL,
`lesson_status_code` VARCHAR(15) NOT NULL,
`staff_id` INTEGER,
`vehicle_id` INTEGER NOT NULL,
`lesson_date` DATETIME,
`lesson_time` VARCHAR(10),
`price` DOUBLE NULL,
FOREIGN KEY (`vehicle_id` ) REFERENCES `Vehicles`(`vehicle_id` ),
FOREIGN KEY (`staff_id` ) REFERENCES `Staff`(`staff_id` ),
FOREIGN KEY (`customer_id` ) REFERENCES `Customers`(`customer_id` )
)
3 rows from Lessons table:
lesson_id customer_id lesson_status_code staff_id vehicle_id lesson_date lesson_time price
1 6 Cancelled 8 3 2018-02-28 10:55:36 5 199.0
2 8 Cancelled 14 3 2018-03-07 16:12:36 6 167.0
3 6 Cancelled 11 2 2018-03-03 15:10:16 3 352.0
|
driving_school | What are the first, middle, and last names of all staff? | SELECT first_name , middle_name , last_name FROM Staff; | CREATE TABLE `Addresses` (
`address_id` INTEGER PRIMARY KEY,
`line_1_number_building` VARCHAR(80),
`city` VARCHAR(50),
`zip_postcode` VARCHAR(20),
`state_province_county` VARCHAR(50),
`country` VARCHAR(50)
)
3 rows from Addresses table:
address_id line_1_number_building city zip_postcode state_province_county country
1 3904 Stroman Passage Port Melyssa 14445 Georgia USA
2 053 Quigley Island Hagenesfurt 22194 Kentucky USA
3 00704 Zoe Alley Lake Elaina 08938 Georgia USA
CREATE TABLE `Staff` (
`staff_id` INTEGER PRIMARY KEY,
`staff_address_id` INTEGER NOT NULL,
`nickname` VARCHAR(80),
`first_name` VARCHAR(80),
`middle_name` VARCHAR(80),
`last_name` VARCHAR(80),
`date_of_birth` DATETIME,
`date_joined_staff` DATETIME,
`date_left_staff` DATETIME,
FOREIGN KEY (`staff_address_id` ) REFERENCES `Addresses`(`address_id` )
)
3 rows from Staff table:
staff_id staff_address_id nickname first_name middle_name last_name date_of_birth date_joined_staff date_left_staff
1 14 thompson.constantin Janessa Amara Sawayn 2010-12-08 16:55:14 2017-04-27 03:21:26 2018-03-23 22:53:12
2 3 santos45 Camylle Icie Weissnat 2015-08-01 13:22:43 2016-06-06 08:54:28 2018-03-10 15:25:00
3 5 ynader Kaitlin Stephania Mertz 1994-05-17 05:32:11 2018-01-02 12:24:24 2018-03-24 10:11:08
CREATE TABLE `Vehicles` (
`vehicle_id` INTEGER PRIMARY KEY,
`vehicle_details` VARCHAR(255)
)
3 rows from Vehicles table:
vehicle_id vehicle_details
1 Van
2 Truck
3 Car
CREATE TABLE `Customers` (
`customer_id` INTEGER PRIMARY KEY,
`customer_address_id` INTEGER NOT NULL,
`customer_status_code` VARCHAR(15) NOT NULL,
`date_became_customer` DATETIME,
`date_of_birth` DATETIME,
`first_name` VARCHAR(80),
`last_name` VARCHAR(80),
`amount_outstanding` DOUBLE NULL,
`email_address` VARCHAR(250),
`phone_number` VARCHAR(255),
`cell_mobile_phone_number` VARCHAR(255),
FOREIGN KEY (`customer_address_id` ) REFERENCES `Addresses`(`address_id` )
)
3 rows from Customers table:
customer_id customer_address_id customer_status_code date_became_customer date_of_birth first_name last_name amount_outstanding email_address phone_number cell_mobile_phone_number
1 13 Bad Customer 2016-05-11 17:03:48 1998-12-15 13:24:40 Carole Bernhard 255.0 everette.goyette@example.org 07278206718 861-638-9797
2 10 Bad Customer 2015-11-16 22:52:14 1995-07-17 12:13:16 Genevieve Terry 7256.0 huel.jana@example.org +14(5)2351480248 578-518-4785x612
3 10 Good Customer 2016-04-08 00:28:15 1994-06-21 01:34:56 Clara Ortiz 9443.0 hilario.sporer@example.org 374-483-2758x85087 1-197-686-2849x8761
CREATE TABLE `Customer_Payments` (
`customer_id` INTEGER NOT NULL,
`datetime_payment` DATETIME NOT NULL,
`payment_method_code` VARCHAR(10) NOT NULL,
`amount_payment` DOUBLE NULL,
PRIMARY KEY (`customer_id`,`datetime_payment`),
FOREIGN KEY (`customer_id` ) REFERENCES `Customers`(`customer_id` )
)
3 rows from Customer_Payments table:
customer_id datetime_payment payment_method_code amount_payment
11 2018-02-05 18:44:46 Direct Debit 9570.93
2 2018-02-24 10:07:05 Direct Debit 8180.26
14 2018-02-27 20:08:53 Direct Debit 4610.26
CREATE TABLE `Lessons` (
`lesson_id` INTEGER PRIMARY KEY,
`customer_id` INTEGER NOT NULL,
`lesson_status_code` VARCHAR(15) NOT NULL,
`staff_id` INTEGER,
`vehicle_id` INTEGER NOT NULL,
`lesson_date` DATETIME,
`lesson_time` VARCHAR(10),
`price` DOUBLE NULL,
FOREIGN KEY (`vehicle_id` ) REFERENCES `Vehicles`(`vehicle_id` ),
FOREIGN KEY (`staff_id` ) REFERENCES `Staff`(`staff_id` ),
FOREIGN KEY (`customer_id` ) REFERENCES `Customers`(`customer_id` )
)
3 rows from Lessons table:
lesson_id customer_id lesson_status_code staff_id vehicle_id lesson_date lesson_time price
1 6 Cancelled 8 3 2018-02-28 10:55:36 5 199.0
2 8 Cancelled 14 3 2018-03-07 16:12:36 6 167.0
3 6 Cancelled 11 2 2018-03-03 15:10:16 3 352.0
|
driving_school | What is the birthday of the staff member with first name as Janessa and last name as Sawayn? | SELECT date_of_birth FROM Staff WHERE first_name = "Janessa" AND last_name = "Sawayn"; | CREATE TABLE `Addresses` (
`address_id` INTEGER PRIMARY KEY,
`line_1_number_building` VARCHAR(80),
`city` VARCHAR(50),
`zip_postcode` VARCHAR(20),
`state_province_county` VARCHAR(50),
`country` VARCHAR(50)
)
3 rows from Addresses table:
address_id line_1_number_building city zip_postcode state_province_county country
1 3904 Stroman Passage Port Melyssa 14445 Georgia USA
2 053 Quigley Island Hagenesfurt 22194 Kentucky USA
3 00704 Zoe Alley Lake Elaina 08938 Georgia USA
CREATE TABLE `Staff` (
`staff_id` INTEGER PRIMARY KEY,
`staff_address_id` INTEGER NOT NULL,
`nickname` VARCHAR(80),
`first_name` VARCHAR(80),
`middle_name` VARCHAR(80),
`last_name` VARCHAR(80),
`date_of_birth` DATETIME,
`date_joined_staff` DATETIME,
`date_left_staff` DATETIME,
FOREIGN KEY (`staff_address_id` ) REFERENCES `Addresses`(`address_id` )
)
3 rows from Staff table:
staff_id staff_address_id nickname first_name middle_name last_name date_of_birth date_joined_staff date_left_staff
1 14 thompson.constantin Janessa Amara Sawayn 2010-12-08 16:55:14 2017-04-27 03:21:26 2018-03-23 22:53:12
2 3 santos45 Camylle Icie Weissnat 2015-08-01 13:22:43 2016-06-06 08:54:28 2018-03-10 15:25:00
3 5 ynader Kaitlin Stephania Mertz 1994-05-17 05:32:11 2018-01-02 12:24:24 2018-03-24 10:11:08
CREATE TABLE `Vehicles` (
`vehicle_id` INTEGER PRIMARY KEY,
`vehicle_details` VARCHAR(255)
)
3 rows from Vehicles table:
vehicle_id vehicle_details
1 Van
2 Truck
3 Car
CREATE TABLE `Customers` (
`customer_id` INTEGER PRIMARY KEY,
`customer_address_id` INTEGER NOT NULL,
`customer_status_code` VARCHAR(15) NOT NULL,
`date_became_customer` DATETIME,
`date_of_birth` DATETIME,
`first_name` VARCHAR(80),
`last_name` VARCHAR(80),
`amount_outstanding` DOUBLE NULL,
`email_address` VARCHAR(250),
`phone_number` VARCHAR(255),
`cell_mobile_phone_number` VARCHAR(255),
FOREIGN KEY (`customer_address_id` ) REFERENCES `Addresses`(`address_id` )
)
3 rows from Customers table:
customer_id customer_address_id customer_status_code date_became_customer date_of_birth first_name last_name amount_outstanding email_address phone_number cell_mobile_phone_number
1 13 Bad Customer 2016-05-11 17:03:48 1998-12-15 13:24:40 Carole Bernhard 255.0 everette.goyette@example.org 07278206718 861-638-9797
2 10 Bad Customer 2015-11-16 22:52:14 1995-07-17 12:13:16 Genevieve Terry 7256.0 huel.jana@example.org +14(5)2351480248 578-518-4785x612
3 10 Good Customer 2016-04-08 00:28:15 1994-06-21 01:34:56 Clara Ortiz 9443.0 hilario.sporer@example.org 374-483-2758x85087 1-197-686-2849x8761
CREATE TABLE `Customer_Payments` (
`customer_id` INTEGER NOT NULL,
`datetime_payment` DATETIME NOT NULL,
`payment_method_code` VARCHAR(10) NOT NULL,
`amount_payment` DOUBLE NULL,
PRIMARY KEY (`customer_id`,`datetime_payment`),
FOREIGN KEY (`customer_id` ) REFERENCES `Customers`(`customer_id` )
)
3 rows from Customer_Payments table:
customer_id datetime_payment payment_method_code amount_payment
11 2018-02-05 18:44:46 Direct Debit 9570.93
2 2018-02-24 10:07:05 Direct Debit 8180.26
14 2018-02-27 20:08:53 Direct Debit 4610.26
CREATE TABLE `Lessons` (
`lesson_id` INTEGER PRIMARY KEY,
`customer_id` INTEGER NOT NULL,
`lesson_status_code` VARCHAR(15) NOT NULL,
`staff_id` INTEGER,
`vehicle_id` INTEGER NOT NULL,
`lesson_date` DATETIME,
`lesson_time` VARCHAR(10),
`price` DOUBLE NULL,
FOREIGN KEY (`vehicle_id` ) REFERENCES `Vehicles`(`vehicle_id` ),
FOREIGN KEY (`staff_id` ) REFERENCES `Staff`(`staff_id` ),
FOREIGN KEY (`customer_id` ) REFERENCES `Customers`(`customer_id` )
)
3 rows from Lessons table:
lesson_id customer_id lesson_status_code staff_id vehicle_id lesson_date lesson_time price
1 6 Cancelled 8 3 2018-02-28 10:55:36 5 199.0
2 8 Cancelled 14 3 2018-03-07 16:12:36 6 167.0
3 6 Cancelled 11 2 2018-03-03 15:10:16 3 352.0
|
driving_school | What is the date of birth for the staff member named Janessa Sawayn? | SELECT date_of_birth FROM Staff WHERE first_name = "Janessa" AND last_name = "Sawayn"; | CREATE TABLE `Addresses` (
`address_id` INTEGER PRIMARY KEY,
`line_1_number_building` VARCHAR(80),
`city` VARCHAR(50),
`zip_postcode` VARCHAR(20),
`state_province_county` VARCHAR(50),
`country` VARCHAR(50)
)
3 rows from Addresses table:
address_id line_1_number_building city zip_postcode state_province_county country
1 3904 Stroman Passage Port Melyssa 14445 Georgia USA
2 053 Quigley Island Hagenesfurt 22194 Kentucky USA
3 00704 Zoe Alley Lake Elaina 08938 Georgia USA
CREATE TABLE `Staff` (
`staff_id` INTEGER PRIMARY KEY,
`staff_address_id` INTEGER NOT NULL,
`nickname` VARCHAR(80),
`first_name` VARCHAR(80),
`middle_name` VARCHAR(80),
`last_name` VARCHAR(80),
`date_of_birth` DATETIME,
`date_joined_staff` DATETIME,
`date_left_staff` DATETIME,
FOREIGN KEY (`staff_address_id` ) REFERENCES `Addresses`(`address_id` )
)
3 rows from Staff table:
staff_id staff_address_id nickname first_name middle_name last_name date_of_birth date_joined_staff date_left_staff
1 14 thompson.constantin Janessa Amara Sawayn 2010-12-08 16:55:14 2017-04-27 03:21:26 2018-03-23 22:53:12
2 3 santos45 Camylle Icie Weissnat 2015-08-01 13:22:43 2016-06-06 08:54:28 2018-03-10 15:25:00
3 5 ynader Kaitlin Stephania Mertz 1994-05-17 05:32:11 2018-01-02 12:24:24 2018-03-24 10:11:08
CREATE TABLE `Vehicles` (
`vehicle_id` INTEGER PRIMARY KEY,
`vehicle_details` VARCHAR(255)
)
3 rows from Vehicles table:
vehicle_id vehicle_details
1 Van
2 Truck
3 Car
CREATE TABLE `Customers` (
`customer_id` INTEGER PRIMARY KEY,
`customer_address_id` INTEGER NOT NULL,
`customer_status_code` VARCHAR(15) NOT NULL,
`date_became_customer` DATETIME,
`date_of_birth` DATETIME,
`first_name` VARCHAR(80),
`last_name` VARCHAR(80),
`amount_outstanding` DOUBLE NULL,
`email_address` VARCHAR(250),
`phone_number` VARCHAR(255),
`cell_mobile_phone_number` VARCHAR(255),
FOREIGN KEY (`customer_address_id` ) REFERENCES `Addresses`(`address_id` )
)
3 rows from Customers table:
customer_id customer_address_id customer_status_code date_became_customer date_of_birth first_name last_name amount_outstanding email_address phone_number cell_mobile_phone_number
1 13 Bad Customer 2016-05-11 17:03:48 1998-12-15 13:24:40 Carole Bernhard 255.0 everette.goyette@example.org 07278206718 861-638-9797
2 10 Bad Customer 2015-11-16 22:52:14 1995-07-17 12:13:16 Genevieve Terry 7256.0 huel.jana@example.org +14(5)2351480248 578-518-4785x612
3 10 Good Customer 2016-04-08 00:28:15 1994-06-21 01:34:56 Clara Ortiz 9443.0 hilario.sporer@example.org 374-483-2758x85087 1-197-686-2849x8761
CREATE TABLE `Customer_Payments` (
`customer_id` INTEGER NOT NULL,
`datetime_payment` DATETIME NOT NULL,
`payment_method_code` VARCHAR(10) NOT NULL,
`amount_payment` DOUBLE NULL,
PRIMARY KEY (`customer_id`,`datetime_payment`),
FOREIGN KEY (`customer_id` ) REFERENCES `Customers`(`customer_id` )
)
3 rows from Customer_Payments table:
customer_id datetime_payment payment_method_code amount_payment
11 2018-02-05 18:44:46 Direct Debit 9570.93
2 2018-02-24 10:07:05 Direct Debit 8180.26
14 2018-02-27 20:08:53 Direct Debit 4610.26
CREATE TABLE `Lessons` (
`lesson_id` INTEGER PRIMARY KEY,
`customer_id` INTEGER NOT NULL,
`lesson_status_code` VARCHAR(15) NOT NULL,
`staff_id` INTEGER,
`vehicle_id` INTEGER NOT NULL,
`lesson_date` DATETIME,
`lesson_time` VARCHAR(10),
`price` DOUBLE NULL,
FOREIGN KEY (`vehicle_id` ) REFERENCES `Vehicles`(`vehicle_id` ),
FOREIGN KEY (`staff_id` ) REFERENCES `Staff`(`staff_id` ),
FOREIGN KEY (`customer_id` ) REFERENCES `Customers`(`customer_id` )
)
3 rows from Lessons table:
lesson_id customer_id lesson_status_code staff_id vehicle_id lesson_date lesson_time price
1 6 Cancelled 8 3 2018-02-28 10:55:36 5 199.0
2 8 Cancelled 14 3 2018-03-07 16:12:36 6 167.0
3 6 Cancelled 11 2 2018-03-03 15:10:16 3 352.0
|
driving_school | When did the staff member with first name as Janessa and last name as Sawayn join the company? | SELECT date_joined_staff FROM Staff WHERE first_name = "Janessa" AND last_name = "Sawayn"; | CREATE TABLE `Addresses` (
`address_id` INTEGER PRIMARY KEY,
`line_1_number_building` VARCHAR(80),
`city` VARCHAR(50),
`zip_postcode` VARCHAR(20),
`state_province_county` VARCHAR(50),
`country` VARCHAR(50)
)
3 rows from Addresses table:
address_id line_1_number_building city zip_postcode state_province_county country
1 3904 Stroman Passage Port Melyssa 14445 Georgia USA
2 053 Quigley Island Hagenesfurt 22194 Kentucky USA
3 00704 Zoe Alley Lake Elaina 08938 Georgia USA
CREATE TABLE `Staff` (
`staff_id` INTEGER PRIMARY KEY,
`staff_address_id` INTEGER NOT NULL,
`nickname` VARCHAR(80),
`first_name` VARCHAR(80),
`middle_name` VARCHAR(80),
`last_name` VARCHAR(80),
`date_of_birth` DATETIME,
`date_joined_staff` DATETIME,
`date_left_staff` DATETIME,
FOREIGN KEY (`staff_address_id` ) REFERENCES `Addresses`(`address_id` )
)
3 rows from Staff table:
staff_id staff_address_id nickname first_name middle_name last_name date_of_birth date_joined_staff date_left_staff
1 14 thompson.constantin Janessa Amara Sawayn 2010-12-08 16:55:14 2017-04-27 03:21:26 2018-03-23 22:53:12
2 3 santos45 Camylle Icie Weissnat 2015-08-01 13:22:43 2016-06-06 08:54:28 2018-03-10 15:25:00
3 5 ynader Kaitlin Stephania Mertz 1994-05-17 05:32:11 2018-01-02 12:24:24 2018-03-24 10:11:08
CREATE TABLE `Vehicles` (
`vehicle_id` INTEGER PRIMARY KEY,
`vehicle_details` VARCHAR(255)
)
3 rows from Vehicles table:
vehicle_id vehicle_details
1 Van
2 Truck
3 Car
CREATE TABLE `Customers` (
`customer_id` INTEGER PRIMARY KEY,
`customer_address_id` INTEGER NOT NULL,
`customer_status_code` VARCHAR(15) NOT NULL,
`date_became_customer` DATETIME,
`date_of_birth` DATETIME,
`first_name` VARCHAR(80),
`last_name` VARCHAR(80),
`amount_outstanding` DOUBLE NULL,
`email_address` VARCHAR(250),
`phone_number` VARCHAR(255),
`cell_mobile_phone_number` VARCHAR(255),
FOREIGN KEY (`customer_address_id` ) REFERENCES `Addresses`(`address_id` )
)
3 rows from Customers table:
customer_id customer_address_id customer_status_code date_became_customer date_of_birth first_name last_name amount_outstanding email_address phone_number cell_mobile_phone_number
1 13 Bad Customer 2016-05-11 17:03:48 1998-12-15 13:24:40 Carole Bernhard 255.0 everette.goyette@example.org 07278206718 861-638-9797
2 10 Bad Customer 2015-11-16 22:52:14 1995-07-17 12:13:16 Genevieve Terry 7256.0 huel.jana@example.org +14(5)2351480248 578-518-4785x612
3 10 Good Customer 2016-04-08 00:28:15 1994-06-21 01:34:56 Clara Ortiz 9443.0 hilario.sporer@example.org 374-483-2758x85087 1-197-686-2849x8761
CREATE TABLE `Customer_Payments` (
`customer_id` INTEGER NOT NULL,
`datetime_payment` DATETIME NOT NULL,
`payment_method_code` VARCHAR(10) NOT NULL,
`amount_payment` DOUBLE NULL,
PRIMARY KEY (`customer_id`,`datetime_payment`),
FOREIGN KEY (`customer_id` ) REFERENCES `Customers`(`customer_id` )
)
3 rows from Customer_Payments table:
customer_id datetime_payment payment_method_code amount_payment
11 2018-02-05 18:44:46 Direct Debit 9570.93
2 2018-02-24 10:07:05 Direct Debit 8180.26
14 2018-02-27 20:08:53 Direct Debit 4610.26
CREATE TABLE `Lessons` (
`lesson_id` INTEGER PRIMARY KEY,
`customer_id` INTEGER NOT NULL,
`lesson_status_code` VARCHAR(15) NOT NULL,
`staff_id` INTEGER,
`vehicle_id` INTEGER NOT NULL,
`lesson_date` DATETIME,
`lesson_time` VARCHAR(10),
`price` DOUBLE NULL,
FOREIGN KEY (`vehicle_id` ) REFERENCES `Vehicles`(`vehicle_id` ),
FOREIGN KEY (`staff_id` ) REFERENCES `Staff`(`staff_id` ),
FOREIGN KEY (`customer_id` ) REFERENCES `Customers`(`customer_id` )
)
3 rows from Lessons table:
lesson_id customer_id lesson_status_code staff_id vehicle_id lesson_date lesson_time price
1 6 Cancelled 8 3 2018-02-28 10:55:36 5 199.0
2 8 Cancelled 14 3 2018-03-07 16:12:36 6 167.0
3 6 Cancelled 11 2 2018-03-03 15:10:16 3 352.0
|
driving_school | When did the staff member named Janessa Sawayn join the company? | SELECT date_joined_staff FROM Staff WHERE first_name = "Janessa" AND last_name = "Sawayn"; | CREATE TABLE `Addresses` (
`address_id` INTEGER PRIMARY KEY,
`line_1_number_building` VARCHAR(80),
`city` VARCHAR(50),
`zip_postcode` VARCHAR(20),
`state_province_county` VARCHAR(50),
`country` VARCHAR(50)
)
3 rows from Addresses table:
address_id line_1_number_building city zip_postcode state_province_county country
1 3904 Stroman Passage Port Melyssa 14445 Georgia USA
2 053 Quigley Island Hagenesfurt 22194 Kentucky USA
3 00704 Zoe Alley Lake Elaina 08938 Georgia USA
CREATE TABLE `Staff` (
`staff_id` INTEGER PRIMARY KEY,
`staff_address_id` INTEGER NOT NULL,
`nickname` VARCHAR(80),
`first_name` VARCHAR(80),
`middle_name` VARCHAR(80),
`last_name` VARCHAR(80),
`date_of_birth` DATETIME,
`date_joined_staff` DATETIME,
`date_left_staff` DATETIME,
FOREIGN KEY (`staff_address_id` ) REFERENCES `Addresses`(`address_id` )
)
3 rows from Staff table:
staff_id staff_address_id nickname first_name middle_name last_name date_of_birth date_joined_staff date_left_staff
1 14 thompson.constantin Janessa Amara Sawayn 2010-12-08 16:55:14 2017-04-27 03:21:26 2018-03-23 22:53:12
2 3 santos45 Camylle Icie Weissnat 2015-08-01 13:22:43 2016-06-06 08:54:28 2018-03-10 15:25:00
3 5 ynader Kaitlin Stephania Mertz 1994-05-17 05:32:11 2018-01-02 12:24:24 2018-03-24 10:11:08
CREATE TABLE `Vehicles` (
`vehicle_id` INTEGER PRIMARY KEY,
`vehicle_details` VARCHAR(255)
)
3 rows from Vehicles table:
vehicle_id vehicle_details
1 Van
2 Truck
3 Car
CREATE TABLE `Customers` (
`customer_id` INTEGER PRIMARY KEY,
`customer_address_id` INTEGER NOT NULL,
`customer_status_code` VARCHAR(15) NOT NULL,
`date_became_customer` DATETIME,
`date_of_birth` DATETIME,
`first_name` VARCHAR(80),
`last_name` VARCHAR(80),
`amount_outstanding` DOUBLE NULL,
`email_address` VARCHAR(250),
`phone_number` VARCHAR(255),
`cell_mobile_phone_number` VARCHAR(255),
FOREIGN KEY (`customer_address_id` ) REFERENCES `Addresses`(`address_id` )
)
3 rows from Customers table:
customer_id customer_address_id customer_status_code date_became_customer date_of_birth first_name last_name amount_outstanding email_address phone_number cell_mobile_phone_number
1 13 Bad Customer 2016-05-11 17:03:48 1998-12-15 13:24:40 Carole Bernhard 255.0 everette.goyette@example.org 07278206718 861-638-9797
2 10 Bad Customer 2015-11-16 22:52:14 1995-07-17 12:13:16 Genevieve Terry 7256.0 huel.jana@example.org +14(5)2351480248 578-518-4785x612
3 10 Good Customer 2016-04-08 00:28:15 1994-06-21 01:34:56 Clara Ortiz 9443.0 hilario.sporer@example.org 374-483-2758x85087 1-197-686-2849x8761
CREATE TABLE `Customer_Payments` (
`customer_id` INTEGER NOT NULL,
`datetime_payment` DATETIME NOT NULL,
`payment_method_code` VARCHAR(10) NOT NULL,
`amount_payment` DOUBLE NULL,
PRIMARY KEY (`customer_id`,`datetime_payment`),
FOREIGN KEY (`customer_id` ) REFERENCES `Customers`(`customer_id` )
)
3 rows from Customer_Payments table:
customer_id datetime_payment payment_method_code amount_payment
11 2018-02-05 18:44:46 Direct Debit 9570.93
2 2018-02-24 10:07:05 Direct Debit 8180.26
14 2018-02-27 20:08:53 Direct Debit 4610.26
CREATE TABLE `Lessons` (
`lesson_id` INTEGER PRIMARY KEY,
`customer_id` INTEGER NOT NULL,
`lesson_status_code` VARCHAR(15) NOT NULL,
`staff_id` INTEGER,
`vehicle_id` INTEGER NOT NULL,
`lesson_date` DATETIME,
`lesson_time` VARCHAR(10),
`price` DOUBLE NULL,
FOREIGN KEY (`vehicle_id` ) REFERENCES `Vehicles`(`vehicle_id` ),
FOREIGN KEY (`staff_id` ) REFERENCES `Staff`(`staff_id` ),
FOREIGN KEY (`customer_id` ) REFERENCES `Customers`(`customer_id` )
)
3 rows from Lessons table:
lesson_id customer_id lesson_status_code staff_id vehicle_id lesson_date lesson_time price
1 6 Cancelled 8 3 2018-02-28 10:55:36 5 199.0
2 8 Cancelled 14 3 2018-03-07 16:12:36 6 167.0
3 6 Cancelled 11 2 2018-03-03 15:10:16 3 352.0
|
driving_school | When did the staff member with first name as Janessa and last name as Sawayn leave the company? | SELECT date_left_staff FROM Staff WHERE first_name = "Janessa" AND last_name = "Sawayn"; | CREATE TABLE `Addresses` (
`address_id` INTEGER PRIMARY KEY,
`line_1_number_building` VARCHAR(80),
`city` VARCHAR(50),
`zip_postcode` VARCHAR(20),
`state_province_county` VARCHAR(50),
`country` VARCHAR(50)
)
3 rows from Addresses table:
address_id line_1_number_building city zip_postcode state_province_county country
1 3904 Stroman Passage Port Melyssa 14445 Georgia USA
2 053 Quigley Island Hagenesfurt 22194 Kentucky USA
3 00704 Zoe Alley Lake Elaina 08938 Georgia USA
CREATE TABLE `Staff` (
`staff_id` INTEGER PRIMARY KEY,
`staff_address_id` INTEGER NOT NULL,
`nickname` VARCHAR(80),
`first_name` VARCHAR(80),
`middle_name` VARCHAR(80),
`last_name` VARCHAR(80),
`date_of_birth` DATETIME,
`date_joined_staff` DATETIME,
`date_left_staff` DATETIME,
FOREIGN KEY (`staff_address_id` ) REFERENCES `Addresses`(`address_id` )
)
3 rows from Staff table:
staff_id staff_address_id nickname first_name middle_name last_name date_of_birth date_joined_staff date_left_staff
1 14 thompson.constantin Janessa Amara Sawayn 2010-12-08 16:55:14 2017-04-27 03:21:26 2018-03-23 22:53:12
2 3 santos45 Camylle Icie Weissnat 2015-08-01 13:22:43 2016-06-06 08:54:28 2018-03-10 15:25:00
3 5 ynader Kaitlin Stephania Mertz 1994-05-17 05:32:11 2018-01-02 12:24:24 2018-03-24 10:11:08
CREATE TABLE `Vehicles` (
`vehicle_id` INTEGER PRIMARY KEY,
`vehicle_details` VARCHAR(255)
)
3 rows from Vehicles table:
vehicle_id vehicle_details
1 Van
2 Truck
3 Car
CREATE TABLE `Customers` (
`customer_id` INTEGER PRIMARY KEY,
`customer_address_id` INTEGER NOT NULL,
`customer_status_code` VARCHAR(15) NOT NULL,
`date_became_customer` DATETIME,
`date_of_birth` DATETIME,
`first_name` VARCHAR(80),
`last_name` VARCHAR(80),
`amount_outstanding` DOUBLE NULL,
`email_address` VARCHAR(250),
`phone_number` VARCHAR(255),
`cell_mobile_phone_number` VARCHAR(255),
FOREIGN KEY (`customer_address_id` ) REFERENCES `Addresses`(`address_id` )
)
3 rows from Customers table:
customer_id customer_address_id customer_status_code date_became_customer date_of_birth first_name last_name amount_outstanding email_address phone_number cell_mobile_phone_number
1 13 Bad Customer 2016-05-11 17:03:48 1998-12-15 13:24:40 Carole Bernhard 255.0 everette.goyette@example.org 07278206718 861-638-9797
2 10 Bad Customer 2015-11-16 22:52:14 1995-07-17 12:13:16 Genevieve Terry 7256.0 huel.jana@example.org +14(5)2351480248 578-518-4785x612
3 10 Good Customer 2016-04-08 00:28:15 1994-06-21 01:34:56 Clara Ortiz 9443.0 hilario.sporer@example.org 374-483-2758x85087 1-197-686-2849x8761
CREATE TABLE `Customer_Payments` (
`customer_id` INTEGER NOT NULL,
`datetime_payment` DATETIME NOT NULL,
`payment_method_code` VARCHAR(10) NOT NULL,
`amount_payment` DOUBLE NULL,
PRIMARY KEY (`customer_id`,`datetime_payment`),
FOREIGN KEY (`customer_id` ) REFERENCES `Customers`(`customer_id` )
)
3 rows from Customer_Payments table:
customer_id datetime_payment payment_method_code amount_payment
11 2018-02-05 18:44:46 Direct Debit 9570.93
2 2018-02-24 10:07:05 Direct Debit 8180.26
14 2018-02-27 20:08:53 Direct Debit 4610.26
CREATE TABLE `Lessons` (
`lesson_id` INTEGER PRIMARY KEY,
`customer_id` INTEGER NOT NULL,
`lesson_status_code` VARCHAR(15) NOT NULL,
`staff_id` INTEGER,
`vehicle_id` INTEGER NOT NULL,
`lesson_date` DATETIME,
`lesson_time` VARCHAR(10),
`price` DOUBLE NULL,
FOREIGN KEY (`vehicle_id` ) REFERENCES `Vehicles`(`vehicle_id` ),
FOREIGN KEY (`staff_id` ) REFERENCES `Staff`(`staff_id` ),
FOREIGN KEY (`customer_id` ) REFERENCES `Customers`(`customer_id` )
)
3 rows from Lessons table:
lesson_id customer_id lesson_status_code staff_id vehicle_id lesson_date lesson_time price
1 6 Cancelled 8 3 2018-02-28 10:55:36 5 199.0
2 8 Cancelled 14 3 2018-03-07 16:12:36 6 167.0
3 6 Cancelled 11 2 2018-03-03 15:10:16 3 352.0
|
driving_school | When did the staff member Janessa Sawayn leave the company? | SELECT date_left_staff FROM Staff WHERE first_name = "Janessa" AND last_name = "Sawayn"; | CREATE TABLE `Addresses` (
`address_id` INTEGER PRIMARY KEY,
`line_1_number_building` VARCHAR(80),
`city` VARCHAR(50),
`zip_postcode` VARCHAR(20),
`state_province_county` VARCHAR(50),
`country` VARCHAR(50)
)
3 rows from Addresses table:
address_id line_1_number_building city zip_postcode state_province_county country
1 3904 Stroman Passage Port Melyssa 14445 Georgia USA
2 053 Quigley Island Hagenesfurt 22194 Kentucky USA
3 00704 Zoe Alley Lake Elaina 08938 Georgia USA
CREATE TABLE `Staff` (
`staff_id` INTEGER PRIMARY KEY,
`staff_address_id` INTEGER NOT NULL,
`nickname` VARCHAR(80),
`first_name` VARCHAR(80),
`middle_name` VARCHAR(80),
`last_name` VARCHAR(80),
`date_of_birth` DATETIME,
`date_joined_staff` DATETIME,
`date_left_staff` DATETIME,
FOREIGN KEY (`staff_address_id` ) REFERENCES `Addresses`(`address_id` )
)
3 rows from Staff table:
staff_id staff_address_id nickname first_name middle_name last_name date_of_birth date_joined_staff date_left_staff
1 14 thompson.constantin Janessa Amara Sawayn 2010-12-08 16:55:14 2017-04-27 03:21:26 2018-03-23 22:53:12
2 3 santos45 Camylle Icie Weissnat 2015-08-01 13:22:43 2016-06-06 08:54:28 2018-03-10 15:25:00
3 5 ynader Kaitlin Stephania Mertz 1994-05-17 05:32:11 2018-01-02 12:24:24 2018-03-24 10:11:08
CREATE TABLE `Vehicles` (
`vehicle_id` INTEGER PRIMARY KEY,
`vehicle_details` VARCHAR(255)
)
3 rows from Vehicles table:
vehicle_id vehicle_details
1 Van
2 Truck
3 Car
CREATE TABLE `Customers` (
`customer_id` INTEGER PRIMARY KEY,
`customer_address_id` INTEGER NOT NULL,
`customer_status_code` VARCHAR(15) NOT NULL,
`date_became_customer` DATETIME,
`date_of_birth` DATETIME,
`first_name` VARCHAR(80),
`last_name` VARCHAR(80),
`amount_outstanding` DOUBLE NULL,
`email_address` VARCHAR(250),
`phone_number` VARCHAR(255),
`cell_mobile_phone_number` VARCHAR(255),
FOREIGN KEY (`customer_address_id` ) REFERENCES `Addresses`(`address_id` )
)
3 rows from Customers table:
customer_id customer_address_id customer_status_code date_became_customer date_of_birth first_name last_name amount_outstanding email_address phone_number cell_mobile_phone_number
1 13 Bad Customer 2016-05-11 17:03:48 1998-12-15 13:24:40 Carole Bernhard 255.0 everette.goyette@example.org 07278206718 861-638-9797
2 10 Bad Customer 2015-11-16 22:52:14 1995-07-17 12:13:16 Genevieve Terry 7256.0 huel.jana@example.org +14(5)2351480248 578-518-4785x612
3 10 Good Customer 2016-04-08 00:28:15 1994-06-21 01:34:56 Clara Ortiz 9443.0 hilario.sporer@example.org 374-483-2758x85087 1-197-686-2849x8761
CREATE TABLE `Customer_Payments` (
`customer_id` INTEGER NOT NULL,
`datetime_payment` DATETIME NOT NULL,
`payment_method_code` VARCHAR(10) NOT NULL,
`amount_payment` DOUBLE NULL,
PRIMARY KEY (`customer_id`,`datetime_payment`),
FOREIGN KEY (`customer_id` ) REFERENCES `Customers`(`customer_id` )
)
3 rows from Customer_Payments table:
customer_id datetime_payment payment_method_code amount_payment
11 2018-02-05 18:44:46 Direct Debit 9570.93
2 2018-02-24 10:07:05 Direct Debit 8180.26
14 2018-02-27 20:08:53 Direct Debit 4610.26
CREATE TABLE `Lessons` (
`lesson_id` INTEGER PRIMARY KEY,
`customer_id` INTEGER NOT NULL,
`lesson_status_code` VARCHAR(15) NOT NULL,
`staff_id` INTEGER,
`vehicle_id` INTEGER NOT NULL,
`lesson_date` DATETIME,
`lesson_time` VARCHAR(10),
`price` DOUBLE NULL,
FOREIGN KEY (`vehicle_id` ) REFERENCES `Vehicles`(`vehicle_id` ),
FOREIGN KEY (`staff_id` ) REFERENCES `Staff`(`staff_id` ),
FOREIGN KEY (`customer_id` ) REFERENCES `Customers`(`customer_id` )
)
3 rows from Lessons table:
lesson_id customer_id lesson_status_code staff_id vehicle_id lesson_date lesson_time price
1 6 Cancelled 8 3 2018-02-28 10:55:36 5 199.0
2 8 Cancelled 14 3 2018-03-07 16:12:36 6 167.0
3 6 Cancelled 11 2 2018-03-03 15:10:16 3 352.0
|
driving_school | How many staff have the first name Ludie? | SELECT count(*) FROM Staff WHERE first_name = "Ludie"; | CREATE TABLE `Addresses` (
`address_id` INTEGER PRIMARY KEY,
`line_1_number_building` VARCHAR(80),
`city` VARCHAR(50),
`zip_postcode` VARCHAR(20),
`state_province_county` VARCHAR(50),
`country` VARCHAR(50)
)
3 rows from Addresses table:
address_id line_1_number_building city zip_postcode state_province_county country
1 3904 Stroman Passage Port Melyssa 14445 Georgia USA
2 053 Quigley Island Hagenesfurt 22194 Kentucky USA
3 00704 Zoe Alley Lake Elaina 08938 Georgia USA
CREATE TABLE `Staff` (
`staff_id` INTEGER PRIMARY KEY,
`staff_address_id` INTEGER NOT NULL,
`nickname` VARCHAR(80),
`first_name` VARCHAR(80),
`middle_name` VARCHAR(80),
`last_name` VARCHAR(80),
`date_of_birth` DATETIME,
`date_joined_staff` DATETIME,
`date_left_staff` DATETIME,
FOREIGN KEY (`staff_address_id` ) REFERENCES `Addresses`(`address_id` )
)
3 rows from Staff table:
staff_id staff_address_id nickname first_name middle_name last_name date_of_birth date_joined_staff date_left_staff
1 14 thompson.constantin Janessa Amara Sawayn 2010-12-08 16:55:14 2017-04-27 03:21:26 2018-03-23 22:53:12
2 3 santos45 Camylle Icie Weissnat 2015-08-01 13:22:43 2016-06-06 08:54:28 2018-03-10 15:25:00
3 5 ynader Kaitlin Stephania Mertz 1994-05-17 05:32:11 2018-01-02 12:24:24 2018-03-24 10:11:08
CREATE TABLE `Vehicles` (
`vehicle_id` INTEGER PRIMARY KEY,
`vehicle_details` VARCHAR(255)
)
3 rows from Vehicles table:
vehicle_id vehicle_details
1 Van
2 Truck
3 Car
CREATE TABLE `Customers` (
`customer_id` INTEGER PRIMARY KEY,
`customer_address_id` INTEGER NOT NULL,
`customer_status_code` VARCHAR(15) NOT NULL,
`date_became_customer` DATETIME,
`date_of_birth` DATETIME,
`first_name` VARCHAR(80),
`last_name` VARCHAR(80),
`amount_outstanding` DOUBLE NULL,
`email_address` VARCHAR(250),
`phone_number` VARCHAR(255),
`cell_mobile_phone_number` VARCHAR(255),
FOREIGN KEY (`customer_address_id` ) REFERENCES `Addresses`(`address_id` )
)
3 rows from Customers table:
customer_id customer_address_id customer_status_code date_became_customer date_of_birth first_name last_name amount_outstanding email_address phone_number cell_mobile_phone_number
1 13 Bad Customer 2016-05-11 17:03:48 1998-12-15 13:24:40 Carole Bernhard 255.0 everette.goyette@example.org 07278206718 861-638-9797
2 10 Bad Customer 2015-11-16 22:52:14 1995-07-17 12:13:16 Genevieve Terry 7256.0 huel.jana@example.org +14(5)2351480248 578-518-4785x612
3 10 Good Customer 2016-04-08 00:28:15 1994-06-21 01:34:56 Clara Ortiz 9443.0 hilario.sporer@example.org 374-483-2758x85087 1-197-686-2849x8761
CREATE TABLE `Customer_Payments` (
`customer_id` INTEGER NOT NULL,
`datetime_payment` DATETIME NOT NULL,
`payment_method_code` VARCHAR(10) NOT NULL,
`amount_payment` DOUBLE NULL,
PRIMARY KEY (`customer_id`,`datetime_payment`),
FOREIGN KEY (`customer_id` ) REFERENCES `Customers`(`customer_id` )
)
3 rows from Customer_Payments table:
customer_id datetime_payment payment_method_code amount_payment
11 2018-02-05 18:44:46 Direct Debit 9570.93
2 2018-02-24 10:07:05 Direct Debit 8180.26
14 2018-02-27 20:08:53 Direct Debit 4610.26
CREATE TABLE `Lessons` (
`lesson_id` INTEGER PRIMARY KEY,
`customer_id` INTEGER NOT NULL,
`lesson_status_code` VARCHAR(15) NOT NULL,
`staff_id` INTEGER,
`vehicle_id` INTEGER NOT NULL,
`lesson_date` DATETIME,
`lesson_time` VARCHAR(10),
`price` DOUBLE NULL,
FOREIGN KEY (`vehicle_id` ) REFERENCES `Vehicles`(`vehicle_id` ),
FOREIGN KEY (`staff_id` ) REFERENCES `Staff`(`staff_id` ),
FOREIGN KEY (`customer_id` ) REFERENCES `Customers`(`customer_id` )
)
3 rows from Lessons table:
lesson_id customer_id lesson_status_code staff_id vehicle_id lesson_date lesson_time price
1 6 Cancelled 8 3 2018-02-28 10:55:36 5 199.0
2 8 Cancelled 14 3 2018-03-07 16:12:36 6 167.0
3 6 Cancelled 11 2 2018-03-03 15:10:16 3 352.0
|
driving_school | How many employees have a first name of Ludie? | SELECT count(*) FROM Staff WHERE first_name = "Ludie"; | CREATE TABLE `Addresses` (
`address_id` INTEGER PRIMARY KEY,
`line_1_number_building` VARCHAR(80),
`city` VARCHAR(50),
`zip_postcode` VARCHAR(20),
`state_province_county` VARCHAR(50),
`country` VARCHAR(50)
)
3 rows from Addresses table:
address_id line_1_number_building city zip_postcode state_province_county country
1 3904 Stroman Passage Port Melyssa 14445 Georgia USA
2 053 Quigley Island Hagenesfurt 22194 Kentucky USA
3 00704 Zoe Alley Lake Elaina 08938 Georgia USA
CREATE TABLE `Staff` (
`staff_id` INTEGER PRIMARY KEY,
`staff_address_id` INTEGER NOT NULL,
`nickname` VARCHAR(80),
`first_name` VARCHAR(80),
`middle_name` VARCHAR(80),
`last_name` VARCHAR(80),
`date_of_birth` DATETIME,
`date_joined_staff` DATETIME,
`date_left_staff` DATETIME,
FOREIGN KEY (`staff_address_id` ) REFERENCES `Addresses`(`address_id` )
)
3 rows from Staff table:
staff_id staff_address_id nickname first_name middle_name last_name date_of_birth date_joined_staff date_left_staff
1 14 thompson.constantin Janessa Amara Sawayn 2010-12-08 16:55:14 2017-04-27 03:21:26 2018-03-23 22:53:12
2 3 santos45 Camylle Icie Weissnat 2015-08-01 13:22:43 2016-06-06 08:54:28 2018-03-10 15:25:00
3 5 ynader Kaitlin Stephania Mertz 1994-05-17 05:32:11 2018-01-02 12:24:24 2018-03-24 10:11:08
CREATE TABLE `Vehicles` (
`vehicle_id` INTEGER PRIMARY KEY,
`vehicle_details` VARCHAR(255)
)
3 rows from Vehicles table:
vehicle_id vehicle_details
1 Van
2 Truck
3 Car
CREATE TABLE `Customers` (
`customer_id` INTEGER PRIMARY KEY,
`customer_address_id` INTEGER NOT NULL,
`customer_status_code` VARCHAR(15) NOT NULL,
`date_became_customer` DATETIME,
`date_of_birth` DATETIME,
`first_name` VARCHAR(80),
`last_name` VARCHAR(80),
`amount_outstanding` DOUBLE NULL,
`email_address` VARCHAR(250),
`phone_number` VARCHAR(255),
`cell_mobile_phone_number` VARCHAR(255),
FOREIGN KEY (`customer_address_id` ) REFERENCES `Addresses`(`address_id` )
)
3 rows from Customers table:
customer_id customer_address_id customer_status_code date_became_customer date_of_birth first_name last_name amount_outstanding email_address phone_number cell_mobile_phone_number
1 13 Bad Customer 2016-05-11 17:03:48 1998-12-15 13:24:40 Carole Bernhard 255.0 everette.goyette@example.org 07278206718 861-638-9797
2 10 Bad Customer 2015-11-16 22:52:14 1995-07-17 12:13:16 Genevieve Terry 7256.0 huel.jana@example.org +14(5)2351480248 578-518-4785x612
3 10 Good Customer 2016-04-08 00:28:15 1994-06-21 01:34:56 Clara Ortiz 9443.0 hilario.sporer@example.org 374-483-2758x85087 1-197-686-2849x8761
CREATE TABLE `Customer_Payments` (
`customer_id` INTEGER NOT NULL,
`datetime_payment` DATETIME NOT NULL,
`payment_method_code` VARCHAR(10) NOT NULL,
`amount_payment` DOUBLE NULL,
PRIMARY KEY (`customer_id`,`datetime_payment`),
FOREIGN KEY (`customer_id` ) REFERENCES `Customers`(`customer_id` )
)
3 rows from Customer_Payments table:
customer_id datetime_payment payment_method_code amount_payment
11 2018-02-05 18:44:46 Direct Debit 9570.93
2 2018-02-24 10:07:05 Direct Debit 8180.26
14 2018-02-27 20:08:53 Direct Debit 4610.26
CREATE TABLE `Lessons` (
`lesson_id` INTEGER PRIMARY KEY,
`customer_id` INTEGER NOT NULL,
`lesson_status_code` VARCHAR(15) NOT NULL,
`staff_id` INTEGER,
`vehicle_id` INTEGER NOT NULL,
`lesson_date` DATETIME,
`lesson_time` VARCHAR(10),
`price` DOUBLE NULL,
FOREIGN KEY (`vehicle_id` ) REFERENCES `Vehicles`(`vehicle_id` ),
FOREIGN KEY (`staff_id` ) REFERENCES `Staff`(`staff_id` ),
FOREIGN KEY (`customer_id` ) REFERENCES `Customers`(`customer_id` )
)
3 rows from Lessons table:
lesson_id customer_id lesson_status_code staff_id vehicle_id lesson_date lesson_time price
1 6 Cancelled 8 3 2018-02-28 10:55:36 5 199.0
2 8 Cancelled 14 3 2018-03-07 16:12:36 6 167.0
3 6 Cancelled 11 2 2018-03-03 15:10:16 3 352.0
|
driving_school | What is the nickname of staff with first name as Janessa and last name as Sawayn? | SELECT nickname FROM Staff WHERE first_name = "Janessa" AND last_name = "Sawayn"; | CREATE TABLE `Addresses` (
`address_id` INTEGER PRIMARY KEY,
`line_1_number_building` VARCHAR(80),
`city` VARCHAR(50),
`zip_postcode` VARCHAR(20),
`state_province_county` VARCHAR(50),
`country` VARCHAR(50)
)
3 rows from Addresses table:
address_id line_1_number_building city zip_postcode state_province_county country
1 3904 Stroman Passage Port Melyssa 14445 Georgia USA
2 053 Quigley Island Hagenesfurt 22194 Kentucky USA
3 00704 Zoe Alley Lake Elaina 08938 Georgia USA
CREATE TABLE `Staff` (
`staff_id` INTEGER PRIMARY KEY,
`staff_address_id` INTEGER NOT NULL,
`nickname` VARCHAR(80),
`first_name` VARCHAR(80),
`middle_name` VARCHAR(80),
`last_name` VARCHAR(80),
`date_of_birth` DATETIME,
`date_joined_staff` DATETIME,
`date_left_staff` DATETIME,
FOREIGN KEY (`staff_address_id` ) REFERENCES `Addresses`(`address_id` )
)
3 rows from Staff table:
staff_id staff_address_id nickname first_name middle_name last_name date_of_birth date_joined_staff date_left_staff
1 14 thompson.constantin Janessa Amara Sawayn 2010-12-08 16:55:14 2017-04-27 03:21:26 2018-03-23 22:53:12
2 3 santos45 Camylle Icie Weissnat 2015-08-01 13:22:43 2016-06-06 08:54:28 2018-03-10 15:25:00
3 5 ynader Kaitlin Stephania Mertz 1994-05-17 05:32:11 2018-01-02 12:24:24 2018-03-24 10:11:08
CREATE TABLE `Vehicles` (
`vehicle_id` INTEGER PRIMARY KEY,
`vehicle_details` VARCHAR(255)
)
3 rows from Vehicles table:
vehicle_id vehicle_details
1 Van
2 Truck
3 Car
CREATE TABLE `Customers` (
`customer_id` INTEGER PRIMARY KEY,
`customer_address_id` INTEGER NOT NULL,
`customer_status_code` VARCHAR(15) NOT NULL,
`date_became_customer` DATETIME,
`date_of_birth` DATETIME,
`first_name` VARCHAR(80),
`last_name` VARCHAR(80),
`amount_outstanding` DOUBLE NULL,
`email_address` VARCHAR(250),
`phone_number` VARCHAR(255),
`cell_mobile_phone_number` VARCHAR(255),
FOREIGN KEY (`customer_address_id` ) REFERENCES `Addresses`(`address_id` )
)
3 rows from Customers table:
customer_id customer_address_id customer_status_code date_became_customer date_of_birth first_name last_name amount_outstanding email_address phone_number cell_mobile_phone_number
1 13 Bad Customer 2016-05-11 17:03:48 1998-12-15 13:24:40 Carole Bernhard 255.0 everette.goyette@example.org 07278206718 861-638-9797
2 10 Bad Customer 2015-11-16 22:52:14 1995-07-17 12:13:16 Genevieve Terry 7256.0 huel.jana@example.org +14(5)2351480248 578-518-4785x612
3 10 Good Customer 2016-04-08 00:28:15 1994-06-21 01:34:56 Clara Ortiz 9443.0 hilario.sporer@example.org 374-483-2758x85087 1-197-686-2849x8761
CREATE TABLE `Customer_Payments` (
`customer_id` INTEGER NOT NULL,
`datetime_payment` DATETIME NOT NULL,
`payment_method_code` VARCHAR(10) NOT NULL,
`amount_payment` DOUBLE NULL,
PRIMARY KEY (`customer_id`,`datetime_payment`),
FOREIGN KEY (`customer_id` ) REFERENCES `Customers`(`customer_id` )
)
3 rows from Customer_Payments table:
customer_id datetime_payment payment_method_code amount_payment
11 2018-02-05 18:44:46 Direct Debit 9570.93
2 2018-02-24 10:07:05 Direct Debit 8180.26
14 2018-02-27 20:08:53 Direct Debit 4610.26
CREATE TABLE `Lessons` (
`lesson_id` INTEGER PRIMARY KEY,
`customer_id` INTEGER NOT NULL,
`lesson_status_code` VARCHAR(15) NOT NULL,
`staff_id` INTEGER,
`vehicle_id` INTEGER NOT NULL,
`lesson_date` DATETIME,
`lesson_time` VARCHAR(10),
`price` DOUBLE NULL,
FOREIGN KEY (`vehicle_id` ) REFERENCES `Vehicles`(`vehicle_id` ),
FOREIGN KEY (`staff_id` ) REFERENCES `Staff`(`staff_id` ),
FOREIGN KEY (`customer_id` ) REFERENCES `Customers`(`customer_id` )
)
3 rows from Lessons table:
lesson_id customer_id lesson_status_code staff_id vehicle_id lesson_date lesson_time price
1 6 Cancelled 8 3 2018-02-28 10:55:36 5 199.0
2 8 Cancelled 14 3 2018-03-07 16:12:36 6 167.0
3 6 Cancelled 11 2 2018-03-03 15:10:16 3 352.0
|
driving_school | What is the nickname of the employee named Janessa Sawayn? | SELECT nickname FROM Staff WHERE first_name = "Janessa" AND last_name = "Sawayn"; | CREATE TABLE `Addresses` (
`address_id` INTEGER PRIMARY KEY,
`line_1_number_building` VARCHAR(80),
`city` VARCHAR(50),
`zip_postcode` VARCHAR(20),
`state_province_county` VARCHAR(50),
`country` VARCHAR(50)
)
3 rows from Addresses table:
address_id line_1_number_building city zip_postcode state_province_county country
1 3904 Stroman Passage Port Melyssa 14445 Georgia USA
2 053 Quigley Island Hagenesfurt 22194 Kentucky USA
3 00704 Zoe Alley Lake Elaina 08938 Georgia USA
CREATE TABLE `Staff` (
`staff_id` INTEGER PRIMARY KEY,
`staff_address_id` INTEGER NOT NULL,
`nickname` VARCHAR(80),
`first_name` VARCHAR(80),
`middle_name` VARCHAR(80),
`last_name` VARCHAR(80),
`date_of_birth` DATETIME,
`date_joined_staff` DATETIME,
`date_left_staff` DATETIME,
FOREIGN KEY (`staff_address_id` ) REFERENCES `Addresses`(`address_id` )
)
3 rows from Staff table:
staff_id staff_address_id nickname first_name middle_name last_name date_of_birth date_joined_staff date_left_staff
1 14 thompson.constantin Janessa Amara Sawayn 2010-12-08 16:55:14 2017-04-27 03:21:26 2018-03-23 22:53:12
2 3 santos45 Camylle Icie Weissnat 2015-08-01 13:22:43 2016-06-06 08:54:28 2018-03-10 15:25:00
3 5 ynader Kaitlin Stephania Mertz 1994-05-17 05:32:11 2018-01-02 12:24:24 2018-03-24 10:11:08
CREATE TABLE `Vehicles` (
`vehicle_id` INTEGER PRIMARY KEY,
`vehicle_details` VARCHAR(255)
)
3 rows from Vehicles table:
vehicle_id vehicle_details
1 Van
2 Truck
3 Car
CREATE TABLE `Customers` (
`customer_id` INTEGER PRIMARY KEY,
`customer_address_id` INTEGER NOT NULL,
`customer_status_code` VARCHAR(15) NOT NULL,
`date_became_customer` DATETIME,
`date_of_birth` DATETIME,
`first_name` VARCHAR(80),
`last_name` VARCHAR(80),
`amount_outstanding` DOUBLE NULL,
`email_address` VARCHAR(250),
`phone_number` VARCHAR(255),
`cell_mobile_phone_number` VARCHAR(255),
FOREIGN KEY (`customer_address_id` ) REFERENCES `Addresses`(`address_id` )
)
3 rows from Customers table:
customer_id customer_address_id customer_status_code date_became_customer date_of_birth first_name last_name amount_outstanding email_address phone_number cell_mobile_phone_number
1 13 Bad Customer 2016-05-11 17:03:48 1998-12-15 13:24:40 Carole Bernhard 255.0 everette.goyette@example.org 07278206718 861-638-9797
2 10 Bad Customer 2015-11-16 22:52:14 1995-07-17 12:13:16 Genevieve Terry 7256.0 huel.jana@example.org +14(5)2351480248 578-518-4785x612
3 10 Good Customer 2016-04-08 00:28:15 1994-06-21 01:34:56 Clara Ortiz 9443.0 hilario.sporer@example.org 374-483-2758x85087 1-197-686-2849x8761
CREATE TABLE `Customer_Payments` (
`customer_id` INTEGER NOT NULL,
`datetime_payment` DATETIME NOT NULL,
`payment_method_code` VARCHAR(10) NOT NULL,
`amount_payment` DOUBLE NULL,
PRIMARY KEY (`customer_id`,`datetime_payment`),
FOREIGN KEY (`customer_id` ) REFERENCES `Customers`(`customer_id` )
)
3 rows from Customer_Payments table:
customer_id datetime_payment payment_method_code amount_payment
11 2018-02-05 18:44:46 Direct Debit 9570.93
2 2018-02-24 10:07:05 Direct Debit 8180.26
14 2018-02-27 20:08:53 Direct Debit 4610.26
CREATE TABLE `Lessons` (
`lesson_id` INTEGER PRIMARY KEY,
`customer_id` INTEGER NOT NULL,
`lesson_status_code` VARCHAR(15) NOT NULL,
`staff_id` INTEGER,
`vehicle_id` INTEGER NOT NULL,
`lesson_date` DATETIME,
`lesson_time` VARCHAR(10),
`price` DOUBLE NULL,
FOREIGN KEY (`vehicle_id` ) REFERENCES `Vehicles`(`vehicle_id` ),
FOREIGN KEY (`staff_id` ) REFERENCES `Staff`(`staff_id` ),
FOREIGN KEY (`customer_id` ) REFERENCES `Customers`(`customer_id` )
)
3 rows from Lessons table:
lesson_id customer_id lesson_status_code staff_id vehicle_id lesson_date lesson_time price
1 6 Cancelled 8 3 2018-02-28 10:55:36 5 199.0
2 8 Cancelled 14 3 2018-03-07 16:12:36 6 167.0
3 6 Cancelled 11 2 2018-03-03 15:10:16 3 352.0
|
driving_school | How many staff in total? | SELECT count(*) FROM Staff; | CREATE TABLE `Addresses` (
`address_id` INTEGER PRIMARY KEY,
`line_1_number_building` VARCHAR(80),
`city` VARCHAR(50),
`zip_postcode` VARCHAR(20),
`state_province_county` VARCHAR(50),
`country` VARCHAR(50)
)
3 rows from Addresses table:
address_id line_1_number_building city zip_postcode state_province_county country
1 3904 Stroman Passage Port Melyssa 14445 Georgia USA
2 053 Quigley Island Hagenesfurt 22194 Kentucky USA
3 00704 Zoe Alley Lake Elaina 08938 Georgia USA
CREATE TABLE `Staff` (
`staff_id` INTEGER PRIMARY KEY,
`staff_address_id` INTEGER NOT NULL,
`nickname` VARCHAR(80),
`first_name` VARCHAR(80),
`middle_name` VARCHAR(80),
`last_name` VARCHAR(80),
`date_of_birth` DATETIME,
`date_joined_staff` DATETIME,
`date_left_staff` DATETIME,
FOREIGN KEY (`staff_address_id` ) REFERENCES `Addresses`(`address_id` )
)
3 rows from Staff table:
staff_id staff_address_id nickname first_name middle_name last_name date_of_birth date_joined_staff date_left_staff
1 14 thompson.constantin Janessa Amara Sawayn 2010-12-08 16:55:14 2017-04-27 03:21:26 2018-03-23 22:53:12
2 3 santos45 Camylle Icie Weissnat 2015-08-01 13:22:43 2016-06-06 08:54:28 2018-03-10 15:25:00
3 5 ynader Kaitlin Stephania Mertz 1994-05-17 05:32:11 2018-01-02 12:24:24 2018-03-24 10:11:08
CREATE TABLE `Vehicles` (
`vehicle_id` INTEGER PRIMARY KEY,
`vehicle_details` VARCHAR(255)
)
3 rows from Vehicles table:
vehicle_id vehicle_details
1 Van
2 Truck
3 Car
CREATE TABLE `Customers` (
`customer_id` INTEGER PRIMARY KEY,
`customer_address_id` INTEGER NOT NULL,
`customer_status_code` VARCHAR(15) NOT NULL,
`date_became_customer` DATETIME,
`date_of_birth` DATETIME,
`first_name` VARCHAR(80),
`last_name` VARCHAR(80),
`amount_outstanding` DOUBLE NULL,
`email_address` VARCHAR(250),
`phone_number` VARCHAR(255),
`cell_mobile_phone_number` VARCHAR(255),
FOREIGN KEY (`customer_address_id` ) REFERENCES `Addresses`(`address_id` )
)
3 rows from Customers table:
customer_id customer_address_id customer_status_code date_became_customer date_of_birth first_name last_name amount_outstanding email_address phone_number cell_mobile_phone_number
1 13 Bad Customer 2016-05-11 17:03:48 1998-12-15 13:24:40 Carole Bernhard 255.0 everette.goyette@example.org 07278206718 861-638-9797
2 10 Bad Customer 2015-11-16 22:52:14 1995-07-17 12:13:16 Genevieve Terry 7256.0 huel.jana@example.org +14(5)2351480248 578-518-4785x612
3 10 Good Customer 2016-04-08 00:28:15 1994-06-21 01:34:56 Clara Ortiz 9443.0 hilario.sporer@example.org 374-483-2758x85087 1-197-686-2849x8761
CREATE TABLE `Customer_Payments` (
`customer_id` INTEGER NOT NULL,
`datetime_payment` DATETIME NOT NULL,
`payment_method_code` VARCHAR(10) NOT NULL,
`amount_payment` DOUBLE NULL,
PRIMARY KEY (`customer_id`,`datetime_payment`),
FOREIGN KEY (`customer_id` ) REFERENCES `Customers`(`customer_id` )
)
3 rows from Customer_Payments table:
customer_id datetime_payment payment_method_code amount_payment
11 2018-02-05 18:44:46 Direct Debit 9570.93
2 2018-02-24 10:07:05 Direct Debit 8180.26
14 2018-02-27 20:08:53 Direct Debit 4610.26
CREATE TABLE `Lessons` (
`lesson_id` INTEGER PRIMARY KEY,
`customer_id` INTEGER NOT NULL,
`lesson_status_code` VARCHAR(15) NOT NULL,
`staff_id` INTEGER,
`vehicle_id` INTEGER NOT NULL,
`lesson_date` DATETIME,
`lesson_time` VARCHAR(10),
`price` DOUBLE NULL,
FOREIGN KEY (`vehicle_id` ) REFERENCES `Vehicles`(`vehicle_id` ),
FOREIGN KEY (`staff_id` ) REFERENCES `Staff`(`staff_id` ),
FOREIGN KEY (`customer_id` ) REFERENCES `Customers`(`customer_id` )
)
3 rows from Lessons table:
lesson_id customer_id lesson_status_code staff_id vehicle_id lesson_date lesson_time price
1 6 Cancelled 8 3 2018-02-28 10:55:36 5 199.0
2 8 Cancelled 14 3 2018-03-07 16:12:36 6 167.0
3 6 Cancelled 11 2 2018-03-03 15:10:16 3 352.0
|
driving_school | How many employees are there? | SELECT count(*) FROM Staff; | CREATE TABLE `Addresses` (
`address_id` INTEGER PRIMARY KEY,
`line_1_number_building` VARCHAR(80),
`city` VARCHAR(50),
`zip_postcode` VARCHAR(20),
`state_province_county` VARCHAR(50),
`country` VARCHAR(50)
)
3 rows from Addresses table:
address_id line_1_number_building city zip_postcode state_province_county country
1 3904 Stroman Passage Port Melyssa 14445 Georgia USA
2 053 Quigley Island Hagenesfurt 22194 Kentucky USA
3 00704 Zoe Alley Lake Elaina 08938 Georgia USA
CREATE TABLE `Staff` (
`staff_id` INTEGER PRIMARY KEY,
`staff_address_id` INTEGER NOT NULL,
`nickname` VARCHAR(80),
`first_name` VARCHAR(80),
`middle_name` VARCHAR(80),
`last_name` VARCHAR(80),
`date_of_birth` DATETIME,
`date_joined_staff` DATETIME,
`date_left_staff` DATETIME,
FOREIGN KEY (`staff_address_id` ) REFERENCES `Addresses`(`address_id` )
)
3 rows from Staff table:
staff_id staff_address_id nickname first_name middle_name last_name date_of_birth date_joined_staff date_left_staff
1 14 thompson.constantin Janessa Amara Sawayn 2010-12-08 16:55:14 2017-04-27 03:21:26 2018-03-23 22:53:12
2 3 santos45 Camylle Icie Weissnat 2015-08-01 13:22:43 2016-06-06 08:54:28 2018-03-10 15:25:00
3 5 ynader Kaitlin Stephania Mertz 1994-05-17 05:32:11 2018-01-02 12:24:24 2018-03-24 10:11:08
CREATE TABLE `Vehicles` (
`vehicle_id` INTEGER PRIMARY KEY,
`vehicle_details` VARCHAR(255)
)
3 rows from Vehicles table:
vehicle_id vehicle_details
1 Van
2 Truck
3 Car
CREATE TABLE `Customers` (
`customer_id` INTEGER PRIMARY KEY,
`customer_address_id` INTEGER NOT NULL,
`customer_status_code` VARCHAR(15) NOT NULL,
`date_became_customer` DATETIME,
`date_of_birth` DATETIME,
`first_name` VARCHAR(80),
`last_name` VARCHAR(80),
`amount_outstanding` DOUBLE NULL,
`email_address` VARCHAR(250),
`phone_number` VARCHAR(255),
`cell_mobile_phone_number` VARCHAR(255),
FOREIGN KEY (`customer_address_id` ) REFERENCES `Addresses`(`address_id` )
)
3 rows from Customers table:
customer_id customer_address_id customer_status_code date_became_customer date_of_birth first_name last_name amount_outstanding email_address phone_number cell_mobile_phone_number
1 13 Bad Customer 2016-05-11 17:03:48 1998-12-15 13:24:40 Carole Bernhard 255.0 everette.goyette@example.org 07278206718 861-638-9797
2 10 Bad Customer 2015-11-16 22:52:14 1995-07-17 12:13:16 Genevieve Terry 7256.0 huel.jana@example.org +14(5)2351480248 578-518-4785x612
3 10 Good Customer 2016-04-08 00:28:15 1994-06-21 01:34:56 Clara Ortiz 9443.0 hilario.sporer@example.org 374-483-2758x85087 1-197-686-2849x8761
CREATE TABLE `Customer_Payments` (
`customer_id` INTEGER NOT NULL,
`datetime_payment` DATETIME NOT NULL,
`payment_method_code` VARCHAR(10) NOT NULL,
`amount_payment` DOUBLE NULL,
PRIMARY KEY (`customer_id`,`datetime_payment`),
FOREIGN KEY (`customer_id` ) REFERENCES `Customers`(`customer_id` )
)
3 rows from Customer_Payments table:
customer_id datetime_payment payment_method_code amount_payment
11 2018-02-05 18:44:46 Direct Debit 9570.93
2 2018-02-24 10:07:05 Direct Debit 8180.26
14 2018-02-27 20:08:53 Direct Debit 4610.26
CREATE TABLE `Lessons` (
`lesson_id` INTEGER PRIMARY KEY,
`customer_id` INTEGER NOT NULL,
`lesson_status_code` VARCHAR(15) NOT NULL,
`staff_id` INTEGER,
`vehicle_id` INTEGER NOT NULL,
`lesson_date` DATETIME,
`lesson_time` VARCHAR(10),
`price` DOUBLE NULL,
FOREIGN KEY (`vehicle_id` ) REFERENCES `Vehicles`(`vehicle_id` ),
FOREIGN KEY (`staff_id` ) REFERENCES `Staff`(`staff_id` ),
FOREIGN KEY (`customer_id` ) REFERENCES `Customers`(`customer_id` )
)
3 rows from Lessons table:
lesson_id customer_id lesson_status_code staff_id vehicle_id lesson_date lesson_time price
1 6 Cancelled 8 3 2018-02-28 10:55:36 5 199.0
2 8 Cancelled 14 3 2018-03-07 16:12:36 6 167.0
3 6 Cancelled 11 2 2018-03-03 15:10:16 3 352.0
|
driving_school | Which city does staff with first name as Janessa and last name as Sawayn live? | SELECT T1.city FROM Addresses AS T1 JOIN Staff AS T2 ON T1.address_id = T2.staff_address_id WHERE T2.first_name = "Janessa" AND T2.last_name = "Sawayn"; | CREATE TABLE `Addresses` (
`address_id` INTEGER PRIMARY KEY,
`line_1_number_building` VARCHAR(80),
`city` VARCHAR(50),
`zip_postcode` VARCHAR(20),
`state_province_county` VARCHAR(50),
`country` VARCHAR(50)
)
3 rows from Addresses table:
address_id line_1_number_building city zip_postcode state_province_county country
1 3904 Stroman Passage Port Melyssa 14445 Georgia USA
2 053 Quigley Island Hagenesfurt 22194 Kentucky USA
3 00704 Zoe Alley Lake Elaina 08938 Georgia USA
CREATE TABLE `Staff` (
`staff_id` INTEGER PRIMARY KEY,
`staff_address_id` INTEGER NOT NULL,
`nickname` VARCHAR(80),
`first_name` VARCHAR(80),
`middle_name` VARCHAR(80),
`last_name` VARCHAR(80),
`date_of_birth` DATETIME,
`date_joined_staff` DATETIME,
`date_left_staff` DATETIME,
FOREIGN KEY (`staff_address_id` ) REFERENCES `Addresses`(`address_id` )
)
3 rows from Staff table:
staff_id staff_address_id nickname first_name middle_name last_name date_of_birth date_joined_staff date_left_staff
1 14 thompson.constantin Janessa Amara Sawayn 2010-12-08 16:55:14 2017-04-27 03:21:26 2018-03-23 22:53:12
2 3 santos45 Camylle Icie Weissnat 2015-08-01 13:22:43 2016-06-06 08:54:28 2018-03-10 15:25:00
3 5 ynader Kaitlin Stephania Mertz 1994-05-17 05:32:11 2018-01-02 12:24:24 2018-03-24 10:11:08
CREATE TABLE `Vehicles` (
`vehicle_id` INTEGER PRIMARY KEY,
`vehicle_details` VARCHAR(255)
)
3 rows from Vehicles table:
vehicle_id vehicle_details
1 Van
2 Truck
3 Car
CREATE TABLE `Customers` (
`customer_id` INTEGER PRIMARY KEY,
`customer_address_id` INTEGER NOT NULL,
`customer_status_code` VARCHAR(15) NOT NULL,
`date_became_customer` DATETIME,
`date_of_birth` DATETIME,
`first_name` VARCHAR(80),
`last_name` VARCHAR(80),
`amount_outstanding` DOUBLE NULL,
`email_address` VARCHAR(250),
`phone_number` VARCHAR(255),
`cell_mobile_phone_number` VARCHAR(255),
FOREIGN KEY (`customer_address_id` ) REFERENCES `Addresses`(`address_id` )
)
3 rows from Customers table:
customer_id customer_address_id customer_status_code date_became_customer date_of_birth first_name last_name amount_outstanding email_address phone_number cell_mobile_phone_number
1 13 Bad Customer 2016-05-11 17:03:48 1998-12-15 13:24:40 Carole Bernhard 255.0 everette.goyette@example.org 07278206718 861-638-9797
2 10 Bad Customer 2015-11-16 22:52:14 1995-07-17 12:13:16 Genevieve Terry 7256.0 huel.jana@example.org +14(5)2351480248 578-518-4785x612
3 10 Good Customer 2016-04-08 00:28:15 1994-06-21 01:34:56 Clara Ortiz 9443.0 hilario.sporer@example.org 374-483-2758x85087 1-197-686-2849x8761
CREATE TABLE `Customer_Payments` (
`customer_id` INTEGER NOT NULL,
`datetime_payment` DATETIME NOT NULL,
`payment_method_code` VARCHAR(10) NOT NULL,
`amount_payment` DOUBLE NULL,
PRIMARY KEY (`customer_id`,`datetime_payment`),
FOREIGN KEY (`customer_id` ) REFERENCES `Customers`(`customer_id` )
)
3 rows from Customer_Payments table:
customer_id datetime_payment payment_method_code amount_payment
11 2018-02-05 18:44:46 Direct Debit 9570.93
2 2018-02-24 10:07:05 Direct Debit 8180.26
14 2018-02-27 20:08:53 Direct Debit 4610.26
CREATE TABLE `Lessons` (
`lesson_id` INTEGER PRIMARY KEY,
`customer_id` INTEGER NOT NULL,
`lesson_status_code` VARCHAR(15) NOT NULL,
`staff_id` INTEGER,
`vehicle_id` INTEGER NOT NULL,
`lesson_date` DATETIME,
`lesson_time` VARCHAR(10),
`price` DOUBLE NULL,
FOREIGN KEY (`vehicle_id` ) REFERENCES `Vehicles`(`vehicle_id` ),
FOREIGN KEY (`staff_id` ) REFERENCES `Staff`(`staff_id` ),
FOREIGN KEY (`customer_id` ) REFERENCES `Customers`(`customer_id` )
)
3 rows from Lessons table:
lesson_id customer_id lesson_status_code staff_id vehicle_id lesson_date lesson_time price
1 6 Cancelled 8 3 2018-02-28 10:55:36 5 199.0
2 8 Cancelled 14 3 2018-03-07 16:12:36 6 167.0
3 6 Cancelled 11 2 2018-03-03 15:10:16 3 352.0
|
driving_school | In what city does Janessa Sawayn live? | SELECT T1.city FROM Addresses AS T1 JOIN Staff AS T2 ON T1.address_id = T2.staff_address_id WHERE T2.first_name = "Janessa" AND T2.last_name = "Sawayn"; | CREATE TABLE `Addresses` (
`address_id` INTEGER PRIMARY KEY,
`line_1_number_building` VARCHAR(80),
`city` VARCHAR(50),
`zip_postcode` VARCHAR(20),
`state_province_county` VARCHAR(50),
`country` VARCHAR(50)
)
3 rows from Addresses table:
address_id line_1_number_building city zip_postcode state_province_county country
1 3904 Stroman Passage Port Melyssa 14445 Georgia USA
2 053 Quigley Island Hagenesfurt 22194 Kentucky USA
3 00704 Zoe Alley Lake Elaina 08938 Georgia USA
CREATE TABLE `Staff` (
`staff_id` INTEGER PRIMARY KEY,
`staff_address_id` INTEGER NOT NULL,
`nickname` VARCHAR(80),
`first_name` VARCHAR(80),
`middle_name` VARCHAR(80),
`last_name` VARCHAR(80),
`date_of_birth` DATETIME,
`date_joined_staff` DATETIME,
`date_left_staff` DATETIME,
FOREIGN KEY (`staff_address_id` ) REFERENCES `Addresses`(`address_id` )
)
3 rows from Staff table:
staff_id staff_address_id nickname first_name middle_name last_name date_of_birth date_joined_staff date_left_staff
1 14 thompson.constantin Janessa Amara Sawayn 2010-12-08 16:55:14 2017-04-27 03:21:26 2018-03-23 22:53:12
2 3 santos45 Camylle Icie Weissnat 2015-08-01 13:22:43 2016-06-06 08:54:28 2018-03-10 15:25:00
3 5 ynader Kaitlin Stephania Mertz 1994-05-17 05:32:11 2018-01-02 12:24:24 2018-03-24 10:11:08
CREATE TABLE `Vehicles` (
`vehicle_id` INTEGER PRIMARY KEY,
`vehicle_details` VARCHAR(255)
)
3 rows from Vehicles table:
vehicle_id vehicle_details
1 Van
2 Truck
3 Car
CREATE TABLE `Customers` (
`customer_id` INTEGER PRIMARY KEY,
`customer_address_id` INTEGER NOT NULL,
`customer_status_code` VARCHAR(15) NOT NULL,
`date_became_customer` DATETIME,
`date_of_birth` DATETIME,
`first_name` VARCHAR(80),
`last_name` VARCHAR(80),
`amount_outstanding` DOUBLE NULL,
`email_address` VARCHAR(250),
`phone_number` VARCHAR(255),
`cell_mobile_phone_number` VARCHAR(255),
FOREIGN KEY (`customer_address_id` ) REFERENCES `Addresses`(`address_id` )
)
3 rows from Customers table:
customer_id customer_address_id customer_status_code date_became_customer date_of_birth first_name last_name amount_outstanding email_address phone_number cell_mobile_phone_number
1 13 Bad Customer 2016-05-11 17:03:48 1998-12-15 13:24:40 Carole Bernhard 255.0 everette.goyette@example.org 07278206718 861-638-9797
2 10 Bad Customer 2015-11-16 22:52:14 1995-07-17 12:13:16 Genevieve Terry 7256.0 huel.jana@example.org +14(5)2351480248 578-518-4785x612
3 10 Good Customer 2016-04-08 00:28:15 1994-06-21 01:34:56 Clara Ortiz 9443.0 hilario.sporer@example.org 374-483-2758x85087 1-197-686-2849x8761
CREATE TABLE `Customer_Payments` (
`customer_id` INTEGER NOT NULL,
`datetime_payment` DATETIME NOT NULL,
`payment_method_code` VARCHAR(10) NOT NULL,
`amount_payment` DOUBLE NULL,
PRIMARY KEY (`customer_id`,`datetime_payment`),
FOREIGN KEY (`customer_id` ) REFERENCES `Customers`(`customer_id` )
)
3 rows from Customer_Payments table:
customer_id datetime_payment payment_method_code amount_payment
11 2018-02-05 18:44:46 Direct Debit 9570.93
2 2018-02-24 10:07:05 Direct Debit 8180.26
14 2018-02-27 20:08:53 Direct Debit 4610.26
CREATE TABLE `Lessons` (
`lesson_id` INTEGER PRIMARY KEY,
`customer_id` INTEGER NOT NULL,
`lesson_status_code` VARCHAR(15) NOT NULL,
`staff_id` INTEGER,
`vehicle_id` INTEGER NOT NULL,
`lesson_date` DATETIME,
`lesson_time` VARCHAR(10),
`price` DOUBLE NULL,
FOREIGN KEY (`vehicle_id` ) REFERENCES `Vehicles`(`vehicle_id` ),
FOREIGN KEY (`staff_id` ) REFERENCES `Staff`(`staff_id` ),
FOREIGN KEY (`customer_id` ) REFERENCES `Customers`(`customer_id` )
)
3 rows from Lessons table:
lesson_id customer_id lesson_status_code staff_id vehicle_id lesson_date lesson_time price
1 6 Cancelled 8 3 2018-02-28 10:55:36 5 199.0
2 8 Cancelled 14 3 2018-03-07 16:12:36 6 167.0
3 6 Cancelled 11 2 2018-03-03 15:10:16 3 352.0
|
driving_school | Which country and state does staff with first name as Janessa and last name as Sawayn lived? | SELECT T1.country , T1.state_province_county FROM Addresses AS T1 JOIN Staff AS T2 ON T1.address_id = T2.staff_address_id WHERE T2.first_name = "Janessa" AND T2.last_name = "Sawayn"; | CREATE TABLE `Addresses` (
`address_id` INTEGER PRIMARY KEY,
`line_1_number_building` VARCHAR(80),
`city` VARCHAR(50),
`zip_postcode` VARCHAR(20),
`state_province_county` VARCHAR(50),
`country` VARCHAR(50)
)
3 rows from Addresses table:
address_id line_1_number_building city zip_postcode state_province_county country
1 3904 Stroman Passage Port Melyssa 14445 Georgia USA
2 053 Quigley Island Hagenesfurt 22194 Kentucky USA
3 00704 Zoe Alley Lake Elaina 08938 Georgia USA
CREATE TABLE `Staff` (
`staff_id` INTEGER PRIMARY KEY,
`staff_address_id` INTEGER NOT NULL,
`nickname` VARCHAR(80),
`first_name` VARCHAR(80),
`middle_name` VARCHAR(80),
`last_name` VARCHAR(80),
`date_of_birth` DATETIME,
`date_joined_staff` DATETIME,
`date_left_staff` DATETIME,
FOREIGN KEY (`staff_address_id` ) REFERENCES `Addresses`(`address_id` )
)
3 rows from Staff table:
staff_id staff_address_id nickname first_name middle_name last_name date_of_birth date_joined_staff date_left_staff
1 14 thompson.constantin Janessa Amara Sawayn 2010-12-08 16:55:14 2017-04-27 03:21:26 2018-03-23 22:53:12
2 3 santos45 Camylle Icie Weissnat 2015-08-01 13:22:43 2016-06-06 08:54:28 2018-03-10 15:25:00
3 5 ynader Kaitlin Stephania Mertz 1994-05-17 05:32:11 2018-01-02 12:24:24 2018-03-24 10:11:08
CREATE TABLE `Vehicles` (
`vehicle_id` INTEGER PRIMARY KEY,
`vehicle_details` VARCHAR(255)
)
3 rows from Vehicles table:
vehicle_id vehicle_details
1 Van
2 Truck
3 Car
CREATE TABLE `Customers` (
`customer_id` INTEGER PRIMARY KEY,
`customer_address_id` INTEGER NOT NULL,
`customer_status_code` VARCHAR(15) NOT NULL,
`date_became_customer` DATETIME,
`date_of_birth` DATETIME,
`first_name` VARCHAR(80),
`last_name` VARCHAR(80),
`amount_outstanding` DOUBLE NULL,
`email_address` VARCHAR(250),
`phone_number` VARCHAR(255),
`cell_mobile_phone_number` VARCHAR(255),
FOREIGN KEY (`customer_address_id` ) REFERENCES `Addresses`(`address_id` )
)
3 rows from Customers table:
customer_id customer_address_id customer_status_code date_became_customer date_of_birth first_name last_name amount_outstanding email_address phone_number cell_mobile_phone_number
1 13 Bad Customer 2016-05-11 17:03:48 1998-12-15 13:24:40 Carole Bernhard 255.0 everette.goyette@example.org 07278206718 861-638-9797
2 10 Bad Customer 2015-11-16 22:52:14 1995-07-17 12:13:16 Genevieve Terry 7256.0 huel.jana@example.org +14(5)2351480248 578-518-4785x612
3 10 Good Customer 2016-04-08 00:28:15 1994-06-21 01:34:56 Clara Ortiz 9443.0 hilario.sporer@example.org 374-483-2758x85087 1-197-686-2849x8761
CREATE TABLE `Customer_Payments` (
`customer_id` INTEGER NOT NULL,
`datetime_payment` DATETIME NOT NULL,
`payment_method_code` VARCHAR(10) NOT NULL,
`amount_payment` DOUBLE NULL,
PRIMARY KEY (`customer_id`,`datetime_payment`),
FOREIGN KEY (`customer_id` ) REFERENCES `Customers`(`customer_id` )
)
3 rows from Customer_Payments table:
customer_id datetime_payment payment_method_code amount_payment
11 2018-02-05 18:44:46 Direct Debit 9570.93
2 2018-02-24 10:07:05 Direct Debit 8180.26
14 2018-02-27 20:08:53 Direct Debit 4610.26
CREATE TABLE `Lessons` (
`lesson_id` INTEGER PRIMARY KEY,
`customer_id` INTEGER NOT NULL,
`lesson_status_code` VARCHAR(15) NOT NULL,
`staff_id` INTEGER,
`vehicle_id` INTEGER NOT NULL,
`lesson_date` DATETIME,
`lesson_time` VARCHAR(10),
`price` DOUBLE NULL,
FOREIGN KEY (`vehicle_id` ) REFERENCES `Vehicles`(`vehicle_id` ),
FOREIGN KEY (`staff_id` ) REFERENCES `Staff`(`staff_id` ),
FOREIGN KEY (`customer_id` ) REFERENCES `Customers`(`customer_id` )
)
3 rows from Lessons table:
lesson_id customer_id lesson_status_code staff_id vehicle_id lesson_date lesson_time price
1 6 Cancelled 8 3 2018-02-28 10:55:36 5 199.0
2 8 Cancelled 14 3 2018-03-07 16:12:36 6 167.0
3 6 Cancelled 11 2 2018-03-03 15:10:16 3 352.0
|
driving_school | In which country and state does Janessa Sawayn live? | SELECT T1.country , T1.state_province_county FROM Addresses AS T1 JOIN Staff AS T2 ON T1.address_id = T2.staff_address_id WHERE T2.first_name = "Janessa" AND T2.last_name = "Sawayn"; | CREATE TABLE `Addresses` (
`address_id` INTEGER PRIMARY KEY,
`line_1_number_building` VARCHAR(80),
`city` VARCHAR(50),
`zip_postcode` VARCHAR(20),
`state_province_county` VARCHAR(50),
`country` VARCHAR(50)
)
3 rows from Addresses table:
address_id line_1_number_building city zip_postcode state_province_county country
1 3904 Stroman Passage Port Melyssa 14445 Georgia USA
2 053 Quigley Island Hagenesfurt 22194 Kentucky USA
3 00704 Zoe Alley Lake Elaina 08938 Georgia USA
CREATE TABLE `Staff` (
`staff_id` INTEGER PRIMARY KEY,
`staff_address_id` INTEGER NOT NULL,
`nickname` VARCHAR(80),
`first_name` VARCHAR(80),
`middle_name` VARCHAR(80),
`last_name` VARCHAR(80),
`date_of_birth` DATETIME,
`date_joined_staff` DATETIME,
`date_left_staff` DATETIME,
FOREIGN KEY (`staff_address_id` ) REFERENCES `Addresses`(`address_id` )
)
3 rows from Staff table:
staff_id staff_address_id nickname first_name middle_name last_name date_of_birth date_joined_staff date_left_staff
1 14 thompson.constantin Janessa Amara Sawayn 2010-12-08 16:55:14 2017-04-27 03:21:26 2018-03-23 22:53:12
2 3 santos45 Camylle Icie Weissnat 2015-08-01 13:22:43 2016-06-06 08:54:28 2018-03-10 15:25:00
3 5 ynader Kaitlin Stephania Mertz 1994-05-17 05:32:11 2018-01-02 12:24:24 2018-03-24 10:11:08
CREATE TABLE `Vehicles` (
`vehicle_id` INTEGER PRIMARY KEY,
`vehicle_details` VARCHAR(255)
)
3 rows from Vehicles table:
vehicle_id vehicle_details
1 Van
2 Truck
3 Car
CREATE TABLE `Customers` (
`customer_id` INTEGER PRIMARY KEY,
`customer_address_id` INTEGER NOT NULL,
`customer_status_code` VARCHAR(15) NOT NULL,
`date_became_customer` DATETIME,
`date_of_birth` DATETIME,
`first_name` VARCHAR(80),
`last_name` VARCHAR(80),
`amount_outstanding` DOUBLE NULL,
`email_address` VARCHAR(250),
`phone_number` VARCHAR(255),
`cell_mobile_phone_number` VARCHAR(255),
FOREIGN KEY (`customer_address_id` ) REFERENCES `Addresses`(`address_id` )
)
3 rows from Customers table:
customer_id customer_address_id customer_status_code date_became_customer date_of_birth first_name last_name amount_outstanding email_address phone_number cell_mobile_phone_number
1 13 Bad Customer 2016-05-11 17:03:48 1998-12-15 13:24:40 Carole Bernhard 255.0 everette.goyette@example.org 07278206718 861-638-9797
2 10 Bad Customer 2015-11-16 22:52:14 1995-07-17 12:13:16 Genevieve Terry 7256.0 huel.jana@example.org +14(5)2351480248 578-518-4785x612
3 10 Good Customer 2016-04-08 00:28:15 1994-06-21 01:34:56 Clara Ortiz 9443.0 hilario.sporer@example.org 374-483-2758x85087 1-197-686-2849x8761
CREATE TABLE `Customer_Payments` (
`customer_id` INTEGER NOT NULL,
`datetime_payment` DATETIME NOT NULL,
`payment_method_code` VARCHAR(10) NOT NULL,
`amount_payment` DOUBLE NULL,
PRIMARY KEY (`customer_id`,`datetime_payment`),
FOREIGN KEY (`customer_id` ) REFERENCES `Customers`(`customer_id` )
)
3 rows from Customer_Payments table:
customer_id datetime_payment payment_method_code amount_payment
11 2018-02-05 18:44:46 Direct Debit 9570.93
2 2018-02-24 10:07:05 Direct Debit 8180.26
14 2018-02-27 20:08:53 Direct Debit 4610.26
CREATE TABLE `Lessons` (
`lesson_id` INTEGER PRIMARY KEY,
`customer_id` INTEGER NOT NULL,
`lesson_status_code` VARCHAR(15) NOT NULL,
`staff_id` INTEGER,
`vehicle_id` INTEGER NOT NULL,
`lesson_date` DATETIME,
`lesson_time` VARCHAR(10),
`price` DOUBLE NULL,
FOREIGN KEY (`vehicle_id` ) REFERENCES `Vehicles`(`vehicle_id` ),
FOREIGN KEY (`staff_id` ) REFERENCES `Staff`(`staff_id` ),
FOREIGN KEY (`customer_id` ) REFERENCES `Customers`(`customer_id` )
)
3 rows from Lessons table:
lesson_id customer_id lesson_status_code staff_id vehicle_id lesson_date lesson_time price
1 6 Cancelled 8 3 2018-02-28 10:55:36 5 199.0
2 8 Cancelled 14 3 2018-03-07 16:12:36 6 167.0
3 6 Cancelled 11 2 2018-03-03 15:10:16 3 352.0
|
driving_school | How long is the total lesson time took by customer with first name as Rylan and last name as Goodwin? | SELECT sum(T1.lesson_time) FROM Lessons AS T1 JOIN Customers AS T2 ON T1.customer_id = T2.customer_id WHERE T2.first_name = "Rylan" AND T2.last_name = "Goodwin"; | CREATE TABLE `Addresses` (
`address_id` INTEGER PRIMARY KEY,
`line_1_number_building` VARCHAR(80),
`city` VARCHAR(50),
`zip_postcode` VARCHAR(20),
`state_province_county` VARCHAR(50),
`country` VARCHAR(50)
)
3 rows from Addresses table:
address_id line_1_number_building city zip_postcode state_province_county country
1 3904 Stroman Passage Port Melyssa 14445 Georgia USA
2 053 Quigley Island Hagenesfurt 22194 Kentucky USA
3 00704 Zoe Alley Lake Elaina 08938 Georgia USA
CREATE TABLE `Staff` (
`staff_id` INTEGER PRIMARY KEY,
`staff_address_id` INTEGER NOT NULL,
`nickname` VARCHAR(80),
`first_name` VARCHAR(80),
`middle_name` VARCHAR(80),
`last_name` VARCHAR(80),
`date_of_birth` DATETIME,
`date_joined_staff` DATETIME,
`date_left_staff` DATETIME,
FOREIGN KEY (`staff_address_id` ) REFERENCES `Addresses`(`address_id` )
)
3 rows from Staff table:
staff_id staff_address_id nickname first_name middle_name last_name date_of_birth date_joined_staff date_left_staff
1 14 thompson.constantin Janessa Amara Sawayn 2010-12-08 16:55:14 2017-04-27 03:21:26 2018-03-23 22:53:12
2 3 santos45 Camylle Icie Weissnat 2015-08-01 13:22:43 2016-06-06 08:54:28 2018-03-10 15:25:00
3 5 ynader Kaitlin Stephania Mertz 1994-05-17 05:32:11 2018-01-02 12:24:24 2018-03-24 10:11:08
CREATE TABLE `Vehicles` (
`vehicle_id` INTEGER PRIMARY KEY,
`vehicle_details` VARCHAR(255)
)
3 rows from Vehicles table:
vehicle_id vehicle_details
1 Van
2 Truck
3 Car
CREATE TABLE `Customers` (
`customer_id` INTEGER PRIMARY KEY,
`customer_address_id` INTEGER NOT NULL,
`customer_status_code` VARCHAR(15) NOT NULL,
`date_became_customer` DATETIME,
`date_of_birth` DATETIME,
`first_name` VARCHAR(80),
`last_name` VARCHAR(80),
`amount_outstanding` DOUBLE NULL,
`email_address` VARCHAR(250),
`phone_number` VARCHAR(255),
`cell_mobile_phone_number` VARCHAR(255),
FOREIGN KEY (`customer_address_id` ) REFERENCES `Addresses`(`address_id` )
)
3 rows from Customers table:
customer_id customer_address_id customer_status_code date_became_customer date_of_birth first_name last_name amount_outstanding email_address phone_number cell_mobile_phone_number
1 13 Bad Customer 2016-05-11 17:03:48 1998-12-15 13:24:40 Carole Bernhard 255.0 everette.goyette@example.org 07278206718 861-638-9797
2 10 Bad Customer 2015-11-16 22:52:14 1995-07-17 12:13:16 Genevieve Terry 7256.0 huel.jana@example.org +14(5)2351480248 578-518-4785x612
3 10 Good Customer 2016-04-08 00:28:15 1994-06-21 01:34:56 Clara Ortiz 9443.0 hilario.sporer@example.org 374-483-2758x85087 1-197-686-2849x8761
CREATE TABLE `Customer_Payments` (
`customer_id` INTEGER NOT NULL,
`datetime_payment` DATETIME NOT NULL,
`payment_method_code` VARCHAR(10) NOT NULL,
`amount_payment` DOUBLE NULL,
PRIMARY KEY (`customer_id`,`datetime_payment`),
FOREIGN KEY (`customer_id` ) REFERENCES `Customers`(`customer_id` )
)
3 rows from Customer_Payments table:
customer_id datetime_payment payment_method_code amount_payment
11 2018-02-05 18:44:46 Direct Debit 9570.93
2 2018-02-24 10:07:05 Direct Debit 8180.26
14 2018-02-27 20:08:53 Direct Debit 4610.26
CREATE TABLE `Lessons` (
`lesson_id` INTEGER PRIMARY KEY,
`customer_id` INTEGER NOT NULL,
`lesson_status_code` VARCHAR(15) NOT NULL,
`staff_id` INTEGER,
`vehicle_id` INTEGER NOT NULL,
`lesson_date` DATETIME,
`lesson_time` VARCHAR(10),
`price` DOUBLE NULL,
FOREIGN KEY (`vehicle_id` ) REFERENCES `Vehicles`(`vehicle_id` ),
FOREIGN KEY (`staff_id` ) REFERENCES `Staff`(`staff_id` ),
FOREIGN KEY (`customer_id` ) REFERENCES `Customers`(`customer_id` )
)
3 rows from Lessons table:
lesson_id customer_id lesson_status_code staff_id vehicle_id lesson_date lesson_time price
1 6 Cancelled 8 3 2018-02-28 10:55:36 5 199.0
2 8 Cancelled 14 3 2018-03-07 16:12:36 6 167.0
3 6 Cancelled 11 2 2018-03-03 15:10:16 3 352.0
|
driving_school | How long is the total lesson time took by the customer named Rylan Goodwin? | SELECT sum(T1.lesson_time) FROM Lessons AS T1 JOIN Customers AS T2 ON T1.customer_id = T2.customer_id WHERE T2.first_name = "Rylan" AND T2.last_name = "Goodwin"; | CREATE TABLE `Addresses` (
`address_id` INTEGER PRIMARY KEY,
`line_1_number_building` VARCHAR(80),
`city` VARCHAR(50),
`zip_postcode` VARCHAR(20),
`state_province_county` VARCHAR(50),
`country` VARCHAR(50)
)
3 rows from Addresses table:
address_id line_1_number_building city zip_postcode state_province_county country
1 3904 Stroman Passage Port Melyssa 14445 Georgia USA
2 053 Quigley Island Hagenesfurt 22194 Kentucky USA
3 00704 Zoe Alley Lake Elaina 08938 Georgia USA
CREATE TABLE `Staff` (
`staff_id` INTEGER PRIMARY KEY,
`staff_address_id` INTEGER NOT NULL,
`nickname` VARCHAR(80),
`first_name` VARCHAR(80),
`middle_name` VARCHAR(80),
`last_name` VARCHAR(80),
`date_of_birth` DATETIME,
`date_joined_staff` DATETIME,
`date_left_staff` DATETIME,
FOREIGN KEY (`staff_address_id` ) REFERENCES `Addresses`(`address_id` )
)
3 rows from Staff table:
staff_id staff_address_id nickname first_name middle_name last_name date_of_birth date_joined_staff date_left_staff
1 14 thompson.constantin Janessa Amara Sawayn 2010-12-08 16:55:14 2017-04-27 03:21:26 2018-03-23 22:53:12
2 3 santos45 Camylle Icie Weissnat 2015-08-01 13:22:43 2016-06-06 08:54:28 2018-03-10 15:25:00
3 5 ynader Kaitlin Stephania Mertz 1994-05-17 05:32:11 2018-01-02 12:24:24 2018-03-24 10:11:08
CREATE TABLE `Vehicles` (
`vehicle_id` INTEGER PRIMARY KEY,
`vehicle_details` VARCHAR(255)
)
3 rows from Vehicles table:
vehicle_id vehicle_details
1 Van
2 Truck
3 Car
CREATE TABLE `Customers` (
`customer_id` INTEGER PRIMARY KEY,
`customer_address_id` INTEGER NOT NULL,
`customer_status_code` VARCHAR(15) NOT NULL,
`date_became_customer` DATETIME,
`date_of_birth` DATETIME,
`first_name` VARCHAR(80),
`last_name` VARCHAR(80),
`amount_outstanding` DOUBLE NULL,
`email_address` VARCHAR(250),
`phone_number` VARCHAR(255),
`cell_mobile_phone_number` VARCHAR(255),
FOREIGN KEY (`customer_address_id` ) REFERENCES `Addresses`(`address_id` )
)
3 rows from Customers table:
customer_id customer_address_id customer_status_code date_became_customer date_of_birth first_name last_name amount_outstanding email_address phone_number cell_mobile_phone_number
1 13 Bad Customer 2016-05-11 17:03:48 1998-12-15 13:24:40 Carole Bernhard 255.0 everette.goyette@example.org 07278206718 861-638-9797
2 10 Bad Customer 2015-11-16 22:52:14 1995-07-17 12:13:16 Genevieve Terry 7256.0 huel.jana@example.org +14(5)2351480248 578-518-4785x612
3 10 Good Customer 2016-04-08 00:28:15 1994-06-21 01:34:56 Clara Ortiz 9443.0 hilario.sporer@example.org 374-483-2758x85087 1-197-686-2849x8761
CREATE TABLE `Customer_Payments` (
`customer_id` INTEGER NOT NULL,
`datetime_payment` DATETIME NOT NULL,
`payment_method_code` VARCHAR(10) NOT NULL,
`amount_payment` DOUBLE NULL,
PRIMARY KEY (`customer_id`,`datetime_payment`),
FOREIGN KEY (`customer_id` ) REFERENCES `Customers`(`customer_id` )
)
3 rows from Customer_Payments table:
customer_id datetime_payment payment_method_code amount_payment
11 2018-02-05 18:44:46 Direct Debit 9570.93
2 2018-02-24 10:07:05 Direct Debit 8180.26
14 2018-02-27 20:08:53 Direct Debit 4610.26
CREATE TABLE `Lessons` (
`lesson_id` INTEGER PRIMARY KEY,
`customer_id` INTEGER NOT NULL,
`lesson_status_code` VARCHAR(15) NOT NULL,
`staff_id` INTEGER,
`vehicle_id` INTEGER NOT NULL,
`lesson_date` DATETIME,
`lesson_time` VARCHAR(10),
`price` DOUBLE NULL,
FOREIGN KEY (`vehicle_id` ) REFERENCES `Vehicles`(`vehicle_id` ),
FOREIGN KEY (`staff_id` ) REFERENCES `Staff`(`staff_id` ),
FOREIGN KEY (`customer_id` ) REFERENCES `Customers`(`customer_id` )
)
3 rows from Lessons table:
lesson_id customer_id lesson_status_code staff_id vehicle_id lesson_date lesson_time price
1 6 Cancelled 8 3 2018-02-28 10:55:36 5 199.0
2 8 Cancelled 14 3 2018-03-07 16:12:36 6 167.0
3 6 Cancelled 11 2 2018-03-03 15:10:16 3 352.0
|
driving_school | What is the zip code of staff with first name as Janessa and last name as Sawayn lived? | SELECT T1.zip_postcode FROM Addresses AS T1 JOIN Staff AS T2 ON T1.address_id = T2.staff_address_id WHERE T2.first_name = "Janessa" AND T2.last_name = "Sawayn"; | CREATE TABLE `Addresses` (
`address_id` INTEGER PRIMARY KEY,
`line_1_number_building` VARCHAR(80),
`city` VARCHAR(50),
`zip_postcode` VARCHAR(20),
`state_province_county` VARCHAR(50),
`country` VARCHAR(50)
)
3 rows from Addresses table:
address_id line_1_number_building city zip_postcode state_province_county country
1 3904 Stroman Passage Port Melyssa 14445 Georgia USA
2 053 Quigley Island Hagenesfurt 22194 Kentucky USA
3 00704 Zoe Alley Lake Elaina 08938 Georgia USA
CREATE TABLE `Staff` (
`staff_id` INTEGER PRIMARY KEY,
`staff_address_id` INTEGER NOT NULL,
`nickname` VARCHAR(80),
`first_name` VARCHAR(80),
`middle_name` VARCHAR(80),
`last_name` VARCHAR(80),
`date_of_birth` DATETIME,
`date_joined_staff` DATETIME,
`date_left_staff` DATETIME,
FOREIGN KEY (`staff_address_id` ) REFERENCES `Addresses`(`address_id` )
)
3 rows from Staff table:
staff_id staff_address_id nickname first_name middle_name last_name date_of_birth date_joined_staff date_left_staff
1 14 thompson.constantin Janessa Amara Sawayn 2010-12-08 16:55:14 2017-04-27 03:21:26 2018-03-23 22:53:12
2 3 santos45 Camylle Icie Weissnat 2015-08-01 13:22:43 2016-06-06 08:54:28 2018-03-10 15:25:00
3 5 ynader Kaitlin Stephania Mertz 1994-05-17 05:32:11 2018-01-02 12:24:24 2018-03-24 10:11:08
CREATE TABLE `Vehicles` (
`vehicle_id` INTEGER PRIMARY KEY,
`vehicle_details` VARCHAR(255)
)
3 rows from Vehicles table:
vehicle_id vehicle_details
1 Van
2 Truck
3 Car
CREATE TABLE `Customers` (
`customer_id` INTEGER PRIMARY KEY,
`customer_address_id` INTEGER NOT NULL,
`customer_status_code` VARCHAR(15) NOT NULL,
`date_became_customer` DATETIME,
`date_of_birth` DATETIME,
`first_name` VARCHAR(80),
`last_name` VARCHAR(80),
`amount_outstanding` DOUBLE NULL,
`email_address` VARCHAR(250),
`phone_number` VARCHAR(255),
`cell_mobile_phone_number` VARCHAR(255),
FOREIGN KEY (`customer_address_id` ) REFERENCES `Addresses`(`address_id` )
)
3 rows from Customers table:
customer_id customer_address_id customer_status_code date_became_customer date_of_birth first_name last_name amount_outstanding email_address phone_number cell_mobile_phone_number
1 13 Bad Customer 2016-05-11 17:03:48 1998-12-15 13:24:40 Carole Bernhard 255.0 everette.goyette@example.org 07278206718 861-638-9797
2 10 Bad Customer 2015-11-16 22:52:14 1995-07-17 12:13:16 Genevieve Terry 7256.0 huel.jana@example.org +14(5)2351480248 578-518-4785x612
3 10 Good Customer 2016-04-08 00:28:15 1994-06-21 01:34:56 Clara Ortiz 9443.0 hilario.sporer@example.org 374-483-2758x85087 1-197-686-2849x8761
CREATE TABLE `Customer_Payments` (
`customer_id` INTEGER NOT NULL,
`datetime_payment` DATETIME NOT NULL,
`payment_method_code` VARCHAR(10) NOT NULL,
`amount_payment` DOUBLE NULL,
PRIMARY KEY (`customer_id`,`datetime_payment`),
FOREIGN KEY (`customer_id` ) REFERENCES `Customers`(`customer_id` )
)
3 rows from Customer_Payments table:
customer_id datetime_payment payment_method_code amount_payment
11 2018-02-05 18:44:46 Direct Debit 9570.93
2 2018-02-24 10:07:05 Direct Debit 8180.26
14 2018-02-27 20:08:53 Direct Debit 4610.26
CREATE TABLE `Lessons` (
`lesson_id` INTEGER PRIMARY KEY,
`customer_id` INTEGER NOT NULL,
`lesson_status_code` VARCHAR(15) NOT NULL,
`staff_id` INTEGER,
`vehicle_id` INTEGER NOT NULL,
`lesson_date` DATETIME,
`lesson_time` VARCHAR(10),
`price` DOUBLE NULL,
FOREIGN KEY (`vehicle_id` ) REFERENCES `Vehicles`(`vehicle_id` ),
FOREIGN KEY (`staff_id` ) REFERENCES `Staff`(`staff_id` ),
FOREIGN KEY (`customer_id` ) REFERENCES `Customers`(`customer_id` )
)
3 rows from Lessons table:
lesson_id customer_id lesson_status_code staff_id vehicle_id lesson_date lesson_time price
1 6 Cancelled 8 3 2018-02-28 10:55:36 5 199.0
2 8 Cancelled 14 3 2018-03-07 16:12:36 6 167.0
3 6 Cancelled 11 2 2018-03-03 15:10:16 3 352.0
|
driving_school | What is the zip code of the hosue of the employee named Janessa Sawayn? | SELECT T1.zip_postcode FROM Addresses AS T1 JOIN Staff AS T2 ON T1.address_id = T2.staff_address_id WHERE T2.first_name = "Janessa" AND T2.last_name = "Sawayn"; | CREATE TABLE `Addresses` (
`address_id` INTEGER PRIMARY KEY,
`line_1_number_building` VARCHAR(80),
`city` VARCHAR(50),
`zip_postcode` VARCHAR(20),
`state_province_county` VARCHAR(50),
`country` VARCHAR(50)
)
3 rows from Addresses table:
address_id line_1_number_building city zip_postcode state_province_county country
1 3904 Stroman Passage Port Melyssa 14445 Georgia USA
2 053 Quigley Island Hagenesfurt 22194 Kentucky USA
3 00704 Zoe Alley Lake Elaina 08938 Georgia USA
CREATE TABLE `Staff` (
`staff_id` INTEGER PRIMARY KEY,
`staff_address_id` INTEGER NOT NULL,
`nickname` VARCHAR(80),
`first_name` VARCHAR(80),
`middle_name` VARCHAR(80),
`last_name` VARCHAR(80),
`date_of_birth` DATETIME,
`date_joined_staff` DATETIME,
`date_left_staff` DATETIME,
FOREIGN KEY (`staff_address_id` ) REFERENCES `Addresses`(`address_id` )
)
3 rows from Staff table:
staff_id staff_address_id nickname first_name middle_name last_name date_of_birth date_joined_staff date_left_staff
1 14 thompson.constantin Janessa Amara Sawayn 2010-12-08 16:55:14 2017-04-27 03:21:26 2018-03-23 22:53:12
2 3 santos45 Camylle Icie Weissnat 2015-08-01 13:22:43 2016-06-06 08:54:28 2018-03-10 15:25:00
3 5 ynader Kaitlin Stephania Mertz 1994-05-17 05:32:11 2018-01-02 12:24:24 2018-03-24 10:11:08
CREATE TABLE `Vehicles` (
`vehicle_id` INTEGER PRIMARY KEY,
`vehicle_details` VARCHAR(255)
)
3 rows from Vehicles table:
vehicle_id vehicle_details
1 Van
2 Truck
3 Car
CREATE TABLE `Customers` (
`customer_id` INTEGER PRIMARY KEY,
`customer_address_id` INTEGER NOT NULL,
`customer_status_code` VARCHAR(15) NOT NULL,
`date_became_customer` DATETIME,
`date_of_birth` DATETIME,
`first_name` VARCHAR(80),
`last_name` VARCHAR(80),
`amount_outstanding` DOUBLE NULL,
`email_address` VARCHAR(250),
`phone_number` VARCHAR(255),
`cell_mobile_phone_number` VARCHAR(255),
FOREIGN KEY (`customer_address_id` ) REFERENCES `Addresses`(`address_id` )
)
3 rows from Customers table:
customer_id customer_address_id customer_status_code date_became_customer date_of_birth first_name last_name amount_outstanding email_address phone_number cell_mobile_phone_number
1 13 Bad Customer 2016-05-11 17:03:48 1998-12-15 13:24:40 Carole Bernhard 255.0 everette.goyette@example.org 07278206718 861-638-9797
2 10 Bad Customer 2015-11-16 22:52:14 1995-07-17 12:13:16 Genevieve Terry 7256.0 huel.jana@example.org +14(5)2351480248 578-518-4785x612
3 10 Good Customer 2016-04-08 00:28:15 1994-06-21 01:34:56 Clara Ortiz 9443.0 hilario.sporer@example.org 374-483-2758x85087 1-197-686-2849x8761
CREATE TABLE `Customer_Payments` (
`customer_id` INTEGER NOT NULL,
`datetime_payment` DATETIME NOT NULL,
`payment_method_code` VARCHAR(10) NOT NULL,
`amount_payment` DOUBLE NULL,
PRIMARY KEY (`customer_id`,`datetime_payment`),
FOREIGN KEY (`customer_id` ) REFERENCES `Customers`(`customer_id` )
)
3 rows from Customer_Payments table:
customer_id datetime_payment payment_method_code amount_payment
11 2018-02-05 18:44:46 Direct Debit 9570.93
2 2018-02-24 10:07:05 Direct Debit 8180.26
14 2018-02-27 20:08:53 Direct Debit 4610.26
CREATE TABLE `Lessons` (
`lesson_id` INTEGER PRIMARY KEY,
`customer_id` INTEGER NOT NULL,
`lesson_status_code` VARCHAR(15) NOT NULL,
`staff_id` INTEGER,
`vehicle_id` INTEGER NOT NULL,
`lesson_date` DATETIME,
`lesson_time` VARCHAR(10),
`price` DOUBLE NULL,
FOREIGN KEY (`vehicle_id` ) REFERENCES `Vehicles`(`vehicle_id` ),
FOREIGN KEY (`staff_id` ) REFERENCES `Staff`(`staff_id` ),
FOREIGN KEY (`customer_id` ) REFERENCES `Customers`(`customer_id` )
)
3 rows from Lessons table:
lesson_id customer_id lesson_status_code staff_id vehicle_id lesson_date lesson_time price
1 6 Cancelled 8 3 2018-02-28 10:55:36 5 199.0
2 8 Cancelled 14 3 2018-03-07 16:12:36 6 167.0
3 6 Cancelled 11 2 2018-03-03 15:10:16 3 352.0
|
driving_school | How many staff live in state Georgia? | SELECT count(*) FROM Addresses WHERE state_province_county = "Georgia"; | CREATE TABLE `Addresses` (
`address_id` INTEGER PRIMARY KEY,
`line_1_number_building` VARCHAR(80),
`city` VARCHAR(50),
`zip_postcode` VARCHAR(20),
`state_province_county` VARCHAR(50),
`country` VARCHAR(50)
)
3 rows from Addresses table:
address_id line_1_number_building city zip_postcode state_province_county country
1 3904 Stroman Passage Port Melyssa 14445 Georgia USA
2 053 Quigley Island Hagenesfurt 22194 Kentucky USA
3 00704 Zoe Alley Lake Elaina 08938 Georgia USA
CREATE TABLE `Staff` (
`staff_id` INTEGER PRIMARY KEY,
`staff_address_id` INTEGER NOT NULL,
`nickname` VARCHAR(80),
`first_name` VARCHAR(80),
`middle_name` VARCHAR(80),
`last_name` VARCHAR(80),
`date_of_birth` DATETIME,
`date_joined_staff` DATETIME,
`date_left_staff` DATETIME,
FOREIGN KEY (`staff_address_id` ) REFERENCES `Addresses`(`address_id` )
)
3 rows from Staff table:
staff_id staff_address_id nickname first_name middle_name last_name date_of_birth date_joined_staff date_left_staff
1 14 thompson.constantin Janessa Amara Sawayn 2010-12-08 16:55:14 2017-04-27 03:21:26 2018-03-23 22:53:12
2 3 santos45 Camylle Icie Weissnat 2015-08-01 13:22:43 2016-06-06 08:54:28 2018-03-10 15:25:00
3 5 ynader Kaitlin Stephania Mertz 1994-05-17 05:32:11 2018-01-02 12:24:24 2018-03-24 10:11:08
CREATE TABLE `Vehicles` (
`vehicle_id` INTEGER PRIMARY KEY,
`vehicle_details` VARCHAR(255)
)
3 rows from Vehicles table:
vehicle_id vehicle_details
1 Van
2 Truck
3 Car
CREATE TABLE `Customers` (
`customer_id` INTEGER PRIMARY KEY,
`customer_address_id` INTEGER NOT NULL,
`customer_status_code` VARCHAR(15) NOT NULL,
`date_became_customer` DATETIME,
`date_of_birth` DATETIME,
`first_name` VARCHAR(80),
`last_name` VARCHAR(80),
`amount_outstanding` DOUBLE NULL,
`email_address` VARCHAR(250),
`phone_number` VARCHAR(255),
`cell_mobile_phone_number` VARCHAR(255),
FOREIGN KEY (`customer_address_id` ) REFERENCES `Addresses`(`address_id` )
)
3 rows from Customers table:
customer_id customer_address_id customer_status_code date_became_customer date_of_birth first_name last_name amount_outstanding email_address phone_number cell_mobile_phone_number
1 13 Bad Customer 2016-05-11 17:03:48 1998-12-15 13:24:40 Carole Bernhard 255.0 everette.goyette@example.org 07278206718 861-638-9797
2 10 Bad Customer 2015-11-16 22:52:14 1995-07-17 12:13:16 Genevieve Terry 7256.0 huel.jana@example.org +14(5)2351480248 578-518-4785x612
3 10 Good Customer 2016-04-08 00:28:15 1994-06-21 01:34:56 Clara Ortiz 9443.0 hilario.sporer@example.org 374-483-2758x85087 1-197-686-2849x8761
CREATE TABLE `Customer_Payments` (
`customer_id` INTEGER NOT NULL,
`datetime_payment` DATETIME NOT NULL,
`payment_method_code` VARCHAR(10) NOT NULL,
`amount_payment` DOUBLE NULL,
PRIMARY KEY (`customer_id`,`datetime_payment`),
FOREIGN KEY (`customer_id` ) REFERENCES `Customers`(`customer_id` )
)
3 rows from Customer_Payments table:
customer_id datetime_payment payment_method_code amount_payment
11 2018-02-05 18:44:46 Direct Debit 9570.93
2 2018-02-24 10:07:05 Direct Debit 8180.26
14 2018-02-27 20:08:53 Direct Debit 4610.26
CREATE TABLE `Lessons` (
`lesson_id` INTEGER PRIMARY KEY,
`customer_id` INTEGER NOT NULL,
`lesson_status_code` VARCHAR(15) NOT NULL,
`staff_id` INTEGER,
`vehicle_id` INTEGER NOT NULL,
`lesson_date` DATETIME,
`lesson_time` VARCHAR(10),
`price` DOUBLE NULL,
FOREIGN KEY (`vehicle_id` ) REFERENCES `Vehicles`(`vehicle_id` ),
FOREIGN KEY (`staff_id` ) REFERENCES `Staff`(`staff_id` ),
FOREIGN KEY (`customer_id` ) REFERENCES `Customers`(`customer_id` )
)
3 rows from Lessons table:
lesson_id customer_id lesson_status_code staff_id vehicle_id lesson_date lesson_time price
1 6 Cancelled 8 3 2018-02-28 10:55:36 5 199.0
2 8 Cancelled 14 3 2018-03-07 16:12:36 6 167.0
3 6 Cancelled 11 2 2018-03-03 15:10:16 3 352.0
|
driving_school | How many employees live in Georgia? | SELECT count(*) FROM Addresses WHERE state_province_county = "Georgia"; | CREATE TABLE `Addresses` (
`address_id` INTEGER PRIMARY KEY,
`line_1_number_building` VARCHAR(80),
`city` VARCHAR(50),
`zip_postcode` VARCHAR(20),
`state_province_county` VARCHAR(50),
`country` VARCHAR(50)
)
3 rows from Addresses table:
address_id line_1_number_building city zip_postcode state_province_county country
1 3904 Stroman Passage Port Melyssa 14445 Georgia USA
2 053 Quigley Island Hagenesfurt 22194 Kentucky USA
3 00704 Zoe Alley Lake Elaina 08938 Georgia USA
CREATE TABLE `Staff` (
`staff_id` INTEGER PRIMARY KEY,
`staff_address_id` INTEGER NOT NULL,
`nickname` VARCHAR(80),
`first_name` VARCHAR(80),
`middle_name` VARCHAR(80),
`last_name` VARCHAR(80),
`date_of_birth` DATETIME,
`date_joined_staff` DATETIME,
`date_left_staff` DATETIME,
FOREIGN KEY (`staff_address_id` ) REFERENCES `Addresses`(`address_id` )
)
3 rows from Staff table:
staff_id staff_address_id nickname first_name middle_name last_name date_of_birth date_joined_staff date_left_staff
1 14 thompson.constantin Janessa Amara Sawayn 2010-12-08 16:55:14 2017-04-27 03:21:26 2018-03-23 22:53:12
2 3 santos45 Camylle Icie Weissnat 2015-08-01 13:22:43 2016-06-06 08:54:28 2018-03-10 15:25:00
3 5 ynader Kaitlin Stephania Mertz 1994-05-17 05:32:11 2018-01-02 12:24:24 2018-03-24 10:11:08
CREATE TABLE `Vehicles` (
`vehicle_id` INTEGER PRIMARY KEY,
`vehicle_details` VARCHAR(255)
)
3 rows from Vehicles table:
vehicle_id vehicle_details
1 Van
2 Truck
3 Car
CREATE TABLE `Customers` (
`customer_id` INTEGER PRIMARY KEY,
`customer_address_id` INTEGER NOT NULL,
`customer_status_code` VARCHAR(15) NOT NULL,
`date_became_customer` DATETIME,
`date_of_birth` DATETIME,
`first_name` VARCHAR(80),
`last_name` VARCHAR(80),
`amount_outstanding` DOUBLE NULL,
`email_address` VARCHAR(250),
`phone_number` VARCHAR(255),
`cell_mobile_phone_number` VARCHAR(255),
FOREIGN KEY (`customer_address_id` ) REFERENCES `Addresses`(`address_id` )
)
3 rows from Customers table:
customer_id customer_address_id customer_status_code date_became_customer date_of_birth first_name last_name amount_outstanding email_address phone_number cell_mobile_phone_number
1 13 Bad Customer 2016-05-11 17:03:48 1998-12-15 13:24:40 Carole Bernhard 255.0 everette.goyette@example.org 07278206718 861-638-9797
2 10 Bad Customer 2015-11-16 22:52:14 1995-07-17 12:13:16 Genevieve Terry 7256.0 huel.jana@example.org +14(5)2351480248 578-518-4785x612
3 10 Good Customer 2016-04-08 00:28:15 1994-06-21 01:34:56 Clara Ortiz 9443.0 hilario.sporer@example.org 374-483-2758x85087 1-197-686-2849x8761
CREATE TABLE `Customer_Payments` (
`customer_id` INTEGER NOT NULL,
`datetime_payment` DATETIME NOT NULL,
`payment_method_code` VARCHAR(10) NOT NULL,
`amount_payment` DOUBLE NULL,
PRIMARY KEY (`customer_id`,`datetime_payment`),
FOREIGN KEY (`customer_id` ) REFERENCES `Customers`(`customer_id` )
)
3 rows from Customer_Payments table:
customer_id datetime_payment payment_method_code amount_payment
11 2018-02-05 18:44:46 Direct Debit 9570.93
2 2018-02-24 10:07:05 Direct Debit 8180.26
14 2018-02-27 20:08:53 Direct Debit 4610.26
CREATE TABLE `Lessons` (
`lesson_id` INTEGER PRIMARY KEY,
`customer_id` INTEGER NOT NULL,
`lesson_status_code` VARCHAR(15) NOT NULL,
`staff_id` INTEGER,
`vehicle_id` INTEGER NOT NULL,
`lesson_date` DATETIME,
`lesson_time` VARCHAR(10),
`price` DOUBLE NULL,
FOREIGN KEY (`vehicle_id` ) REFERENCES `Vehicles`(`vehicle_id` ),
FOREIGN KEY (`staff_id` ) REFERENCES `Staff`(`staff_id` ),
FOREIGN KEY (`customer_id` ) REFERENCES `Customers`(`customer_id` )
)
3 rows from Lessons table:
lesson_id customer_id lesson_status_code staff_id vehicle_id lesson_date lesson_time price
1 6 Cancelled 8 3 2018-02-28 10:55:36 5 199.0
2 8 Cancelled 14 3 2018-03-07 16:12:36 6 167.0
3 6 Cancelled 11 2 2018-03-03 15:10:16 3 352.0
|
driving_school | Find out the first name and last name of staff lived in city Damianfort. | SELECT T2.first_name , T2.last_name FROM Addresses AS T1 JOIN Staff AS T2 ON T1.address_id = T2.staff_address_id WHERE T1.city = "Damianfort"; | CREATE TABLE `Addresses` (
`address_id` INTEGER PRIMARY KEY,
`line_1_number_building` VARCHAR(80),
`city` VARCHAR(50),
`zip_postcode` VARCHAR(20),
`state_province_county` VARCHAR(50),
`country` VARCHAR(50)
)
3 rows from Addresses table:
address_id line_1_number_building city zip_postcode state_province_county country
1 3904 Stroman Passage Port Melyssa 14445 Georgia USA
2 053 Quigley Island Hagenesfurt 22194 Kentucky USA
3 00704 Zoe Alley Lake Elaina 08938 Georgia USA
CREATE TABLE `Staff` (
`staff_id` INTEGER PRIMARY KEY,
`staff_address_id` INTEGER NOT NULL,
`nickname` VARCHAR(80),
`first_name` VARCHAR(80),
`middle_name` VARCHAR(80),
`last_name` VARCHAR(80),
`date_of_birth` DATETIME,
`date_joined_staff` DATETIME,
`date_left_staff` DATETIME,
FOREIGN KEY (`staff_address_id` ) REFERENCES `Addresses`(`address_id` )
)
3 rows from Staff table:
staff_id staff_address_id nickname first_name middle_name last_name date_of_birth date_joined_staff date_left_staff
1 14 thompson.constantin Janessa Amara Sawayn 2010-12-08 16:55:14 2017-04-27 03:21:26 2018-03-23 22:53:12
2 3 santos45 Camylle Icie Weissnat 2015-08-01 13:22:43 2016-06-06 08:54:28 2018-03-10 15:25:00
3 5 ynader Kaitlin Stephania Mertz 1994-05-17 05:32:11 2018-01-02 12:24:24 2018-03-24 10:11:08
CREATE TABLE `Vehicles` (
`vehicle_id` INTEGER PRIMARY KEY,
`vehicle_details` VARCHAR(255)
)
3 rows from Vehicles table:
vehicle_id vehicle_details
1 Van
2 Truck
3 Car
CREATE TABLE `Customers` (
`customer_id` INTEGER PRIMARY KEY,
`customer_address_id` INTEGER NOT NULL,
`customer_status_code` VARCHAR(15) NOT NULL,
`date_became_customer` DATETIME,
`date_of_birth` DATETIME,
`first_name` VARCHAR(80),
`last_name` VARCHAR(80),
`amount_outstanding` DOUBLE NULL,
`email_address` VARCHAR(250),
`phone_number` VARCHAR(255),
`cell_mobile_phone_number` VARCHAR(255),
FOREIGN KEY (`customer_address_id` ) REFERENCES `Addresses`(`address_id` )
)
3 rows from Customers table:
customer_id customer_address_id customer_status_code date_became_customer date_of_birth first_name last_name amount_outstanding email_address phone_number cell_mobile_phone_number
1 13 Bad Customer 2016-05-11 17:03:48 1998-12-15 13:24:40 Carole Bernhard 255.0 everette.goyette@example.org 07278206718 861-638-9797
2 10 Bad Customer 2015-11-16 22:52:14 1995-07-17 12:13:16 Genevieve Terry 7256.0 huel.jana@example.org +14(5)2351480248 578-518-4785x612
3 10 Good Customer 2016-04-08 00:28:15 1994-06-21 01:34:56 Clara Ortiz 9443.0 hilario.sporer@example.org 374-483-2758x85087 1-197-686-2849x8761
CREATE TABLE `Customer_Payments` (
`customer_id` INTEGER NOT NULL,
`datetime_payment` DATETIME NOT NULL,
`payment_method_code` VARCHAR(10) NOT NULL,
`amount_payment` DOUBLE NULL,
PRIMARY KEY (`customer_id`,`datetime_payment`),
FOREIGN KEY (`customer_id` ) REFERENCES `Customers`(`customer_id` )
)
3 rows from Customer_Payments table:
customer_id datetime_payment payment_method_code amount_payment
11 2018-02-05 18:44:46 Direct Debit 9570.93
2 2018-02-24 10:07:05 Direct Debit 8180.26
14 2018-02-27 20:08:53 Direct Debit 4610.26
CREATE TABLE `Lessons` (
`lesson_id` INTEGER PRIMARY KEY,
`customer_id` INTEGER NOT NULL,
`lesson_status_code` VARCHAR(15) NOT NULL,
`staff_id` INTEGER,
`vehicle_id` INTEGER NOT NULL,
`lesson_date` DATETIME,
`lesson_time` VARCHAR(10),
`price` DOUBLE NULL,
FOREIGN KEY (`vehicle_id` ) REFERENCES `Vehicles`(`vehicle_id` ),
FOREIGN KEY (`staff_id` ) REFERENCES `Staff`(`staff_id` ),
FOREIGN KEY (`customer_id` ) REFERENCES `Customers`(`customer_id` )
)
3 rows from Lessons table:
lesson_id customer_id lesson_status_code staff_id vehicle_id lesson_date lesson_time price
1 6 Cancelled 8 3 2018-02-28 10:55:36 5 199.0
2 8 Cancelled 14 3 2018-03-07 16:12:36 6 167.0
3 6 Cancelled 11 2 2018-03-03 15:10:16 3 352.0
|
driving_school | What is the first and last name of all employees who live in the city Damianfort? | SELECT T2.first_name , T2.last_name FROM Addresses AS T1 JOIN Staff AS T2 ON T1.address_id = T2.staff_address_id WHERE T1.city = "Damianfort"; | CREATE TABLE `Addresses` (
`address_id` INTEGER PRIMARY KEY,
`line_1_number_building` VARCHAR(80),
`city` VARCHAR(50),
`zip_postcode` VARCHAR(20),
`state_province_county` VARCHAR(50),
`country` VARCHAR(50)
)
3 rows from Addresses table:
address_id line_1_number_building city zip_postcode state_province_county country
1 3904 Stroman Passage Port Melyssa 14445 Georgia USA
2 053 Quigley Island Hagenesfurt 22194 Kentucky USA
3 00704 Zoe Alley Lake Elaina 08938 Georgia USA
CREATE TABLE `Staff` (
`staff_id` INTEGER PRIMARY KEY,
`staff_address_id` INTEGER NOT NULL,
`nickname` VARCHAR(80),
`first_name` VARCHAR(80),
`middle_name` VARCHAR(80),
`last_name` VARCHAR(80),
`date_of_birth` DATETIME,
`date_joined_staff` DATETIME,
`date_left_staff` DATETIME,
FOREIGN KEY (`staff_address_id` ) REFERENCES `Addresses`(`address_id` )
)
3 rows from Staff table:
staff_id staff_address_id nickname first_name middle_name last_name date_of_birth date_joined_staff date_left_staff
1 14 thompson.constantin Janessa Amara Sawayn 2010-12-08 16:55:14 2017-04-27 03:21:26 2018-03-23 22:53:12
2 3 santos45 Camylle Icie Weissnat 2015-08-01 13:22:43 2016-06-06 08:54:28 2018-03-10 15:25:00
3 5 ynader Kaitlin Stephania Mertz 1994-05-17 05:32:11 2018-01-02 12:24:24 2018-03-24 10:11:08
CREATE TABLE `Vehicles` (
`vehicle_id` INTEGER PRIMARY KEY,
`vehicle_details` VARCHAR(255)
)
3 rows from Vehicles table:
vehicle_id vehicle_details
1 Van
2 Truck
3 Car
CREATE TABLE `Customers` (
`customer_id` INTEGER PRIMARY KEY,
`customer_address_id` INTEGER NOT NULL,
`customer_status_code` VARCHAR(15) NOT NULL,
`date_became_customer` DATETIME,
`date_of_birth` DATETIME,
`first_name` VARCHAR(80),
`last_name` VARCHAR(80),
`amount_outstanding` DOUBLE NULL,
`email_address` VARCHAR(250),
`phone_number` VARCHAR(255),
`cell_mobile_phone_number` VARCHAR(255),
FOREIGN KEY (`customer_address_id` ) REFERENCES `Addresses`(`address_id` )
)
3 rows from Customers table:
customer_id customer_address_id customer_status_code date_became_customer date_of_birth first_name last_name amount_outstanding email_address phone_number cell_mobile_phone_number
1 13 Bad Customer 2016-05-11 17:03:48 1998-12-15 13:24:40 Carole Bernhard 255.0 everette.goyette@example.org 07278206718 861-638-9797
2 10 Bad Customer 2015-11-16 22:52:14 1995-07-17 12:13:16 Genevieve Terry 7256.0 huel.jana@example.org +14(5)2351480248 578-518-4785x612
3 10 Good Customer 2016-04-08 00:28:15 1994-06-21 01:34:56 Clara Ortiz 9443.0 hilario.sporer@example.org 374-483-2758x85087 1-197-686-2849x8761
CREATE TABLE `Customer_Payments` (
`customer_id` INTEGER NOT NULL,
`datetime_payment` DATETIME NOT NULL,
`payment_method_code` VARCHAR(10) NOT NULL,
`amount_payment` DOUBLE NULL,
PRIMARY KEY (`customer_id`,`datetime_payment`),
FOREIGN KEY (`customer_id` ) REFERENCES `Customers`(`customer_id` )
)
3 rows from Customer_Payments table:
customer_id datetime_payment payment_method_code amount_payment
11 2018-02-05 18:44:46 Direct Debit 9570.93
2 2018-02-24 10:07:05 Direct Debit 8180.26
14 2018-02-27 20:08:53 Direct Debit 4610.26
CREATE TABLE `Lessons` (
`lesson_id` INTEGER PRIMARY KEY,
`customer_id` INTEGER NOT NULL,
`lesson_status_code` VARCHAR(15) NOT NULL,
`staff_id` INTEGER,
`vehicle_id` INTEGER NOT NULL,
`lesson_date` DATETIME,
`lesson_time` VARCHAR(10),
`price` DOUBLE NULL,
FOREIGN KEY (`vehicle_id` ) REFERENCES `Vehicles`(`vehicle_id` ),
FOREIGN KEY (`staff_id` ) REFERENCES `Staff`(`staff_id` ),
FOREIGN KEY (`customer_id` ) REFERENCES `Customers`(`customer_id` )
)
3 rows from Lessons table:
lesson_id customer_id lesson_status_code staff_id vehicle_id lesson_date lesson_time price
1 6 Cancelled 8 3 2018-02-28 10:55:36 5 199.0
2 8 Cancelled 14 3 2018-03-07 16:12:36 6 167.0
3 6 Cancelled 11 2 2018-03-03 15:10:16 3 352.0
|
driving_school | Which city lives most of staffs? List the city name and number of staffs. | SELECT T1.city , count(*) FROM Addresses AS T1 JOIN Staff AS T2 ON T1.address_id = T2.staff_address_id GROUP BY T1.city ORDER BY count(*) DESC LIMIT 1; | CREATE TABLE `Addresses` (
`address_id` INTEGER PRIMARY KEY,
`line_1_number_building` VARCHAR(80),
`city` VARCHAR(50),
`zip_postcode` VARCHAR(20),
`state_province_county` VARCHAR(50),
`country` VARCHAR(50)
)
3 rows from Addresses table:
address_id line_1_number_building city zip_postcode state_province_county country
1 3904 Stroman Passage Port Melyssa 14445 Georgia USA
2 053 Quigley Island Hagenesfurt 22194 Kentucky USA
3 00704 Zoe Alley Lake Elaina 08938 Georgia USA
CREATE TABLE `Staff` (
`staff_id` INTEGER PRIMARY KEY,
`staff_address_id` INTEGER NOT NULL,
`nickname` VARCHAR(80),
`first_name` VARCHAR(80),
`middle_name` VARCHAR(80),
`last_name` VARCHAR(80),
`date_of_birth` DATETIME,
`date_joined_staff` DATETIME,
`date_left_staff` DATETIME,
FOREIGN KEY (`staff_address_id` ) REFERENCES `Addresses`(`address_id` )
)
3 rows from Staff table:
staff_id staff_address_id nickname first_name middle_name last_name date_of_birth date_joined_staff date_left_staff
1 14 thompson.constantin Janessa Amara Sawayn 2010-12-08 16:55:14 2017-04-27 03:21:26 2018-03-23 22:53:12
2 3 santos45 Camylle Icie Weissnat 2015-08-01 13:22:43 2016-06-06 08:54:28 2018-03-10 15:25:00
3 5 ynader Kaitlin Stephania Mertz 1994-05-17 05:32:11 2018-01-02 12:24:24 2018-03-24 10:11:08
CREATE TABLE `Vehicles` (
`vehicle_id` INTEGER PRIMARY KEY,
`vehicle_details` VARCHAR(255)
)
3 rows from Vehicles table:
vehicle_id vehicle_details
1 Van
2 Truck
3 Car
CREATE TABLE `Customers` (
`customer_id` INTEGER PRIMARY KEY,
`customer_address_id` INTEGER NOT NULL,
`customer_status_code` VARCHAR(15) NOT NULL,
`date_became_customer` DATETIME,
`date_of_birth` DATETIME,
`first_name` VARCHAR(80),
`last_name` VARCHAR(80),
`amount_outstanding` DOUBLE NULL,
`email_address` VARCHAR(250),
`phone_number` VARCHAR(255),
`cell_mobile_phone_number` VARCHAR(255),
FOREIGN KEY (`customer_address_id` ) REFERENCES `Addresses`(`address_id` )
)
3 rows from Customers table:
customer_id customer_address_id customer_status_code date_became_customer date_of_birth first_name last_name amount_outstanding email_address phone_number cell_mobile_phone_number
1 13 Bad Customer 2016-05-11 17:03:48 1998-12-15 13:24:40 Carole Bernhard 255.0 everette.goyette@example.org 07278206718 861-638-9797
2 10 Bad Customer 2015-11-16 22:52:14 1995-07-17 12:13:16 Genevieve Terry 7256.0 huel.jana@example.org +14(5)2351480248 578-518-4785x612
3 10 Good Customer 2016-04-08 00:28:15 1994-06-21 01:34:56 Clara Ortiz 9443.0 hilario.sporer@example.org 374-483-2758x85087 1-197-686-2849x8761
CREATE TABLE `Customer_Payments` (
`customer_id` INTEGER NOT NULL,
`datetime_payment` DATETIME NOT NULL,
`payment_method_code` VARCHAR(10) NOT NULL,
`amount_payment` DOUBLE NULL,
PRIMARY KEY (`customer_id`,`datetime_payment`),
FOREIGN KEY (`customer_id` ) REFERENCES `Customers`(`customer_id` )
)
3 rows from Customer_Payments table:
customer_id datetime_payment payment_method_code amount_payment
11 2018-02-05 18:44:46 Direct Debit 9570.93
2 2018-02-24 10:07:05 Direct Debit 8180.26
14 2018-02-27 20:08:53 Direct Debit 4610.26
CREATE TABLE `Lessons` (
`lesson_id` INTEGER PRIMARY KEY,
`customer_id` INTEGER NOT NULL,
`lesson_status_code` VARCHAR(15) NOT NULL,
`staff_id` INTEGER,
`vehicle_id` INTEGER NOT NULL,
`lesson_date` DATETIME,
`lesson_time` VARCHAR(10),
`price` DOUBLE NULL,
FOREIGN KEY (`vehicle_id` ) REFERENCES `Vehicles`(`vehicle_id` ),
FOREIGN KEY (`staff_id` ) REFERENCES `Staff`(`staff_id` ),
FOREIGN KEY (`customer_id` ) REFERENCES `Customers`(`customer_id` )
)
3 rows from Lessons table:
lesson_id customer_id lesson_status_code staff_id vehicle_id lesson_date lesson_time price
1 6 Cancelled 8 3 2018-02-28 10:55:36 5 199.0
2 8 Cancelled 14 3 2018-03-07 16:12:36 6 167.0
3 6 Cancelled 11 2 2018-03-03 15:10:16 3 352.0
|
driving_school | In which city do the most employees live and how many of them live there? | SELECT T1.city , count(*) FROM Addresses AS T1 JOIN Staff AS T2 ON T1.address_id = T2.staff_address_id GROUP BY T1.city ORDER BY count(*) DESC LIMIT 1; | CREATE TABLE `Addresses` (
`address_id` INTEGER PRIMARY KEY,
`line_1_number_building` VARCHAR(80),
`city` VARCHAR(50),
`zip_postcode` VARCHAR(20),
`state_province_county` VARCHAR(50),
`country` VARCHAR(50)
)
3 rows from Addresses table:
address_id line_1_number_building city zip_postcode state_province_county country
1 3904 Stroman Passage Port Melyssa 14445 Georgia USA
2 053 Quigley Island Hagenesfurt 22194 Kentucky USA
3 00704 Zoe Alley Lake Elaina 08938 Georgia USA
CREATE TABLE `Staff` (
`staff_id` INTEGER PRIMARY KEY,
`staff_address_id` INTEGER NOT NULL,
`nickname` VARCHAR(80),
`first_name` VARCHAR(80),
`middle_name` VARCHAR(80),
`last_name` VARCHAR(80),
`date_of_birth` DATETIME,
`date_joined_staff` DATETIME,
`date_left_staff` DATETIME,
FOREIGN KEY (`staff_address_id` ) REFERENCES `Addresses`(`address_id` )
)
3 rows from Staff table:
staff_id staff_address_id nickname first_name middle_name last_name date_of_birth date_joined_staff date_left_staff
1 14 thompson.constantin Janessa Amara Sawayn 2010-12-08 16:55:14 2017-04-27 03:21:26 2018-03-23 22:53:12
2 3 santos45 Camylle Icie Weissnat 2015-08-01 13:22:43 2016-06-06 08:54:28 2018-03-10 15:25:00
3 5 ynader Kaitlin Stephania Mertz 1994-05-17 05:32:11 2018-01-02 12:24:24 2018-03-24 10:11:08
CREATE TABLE `Vehicles` (
`vehicle_id` INTEGER PRIMARY KEY,
`vehicle_details` VARCHAR(255)
)
3 rows from Vehicles table:
vehicle_id vehicle_details
1 Van
2 Truck
3 Car
CREATE TABLE `Customers` (
`customer_id` INTEGER PRIMARY KEY,
`customer_address_id` INTEGER NOT NULL,
`customer_status_code` VARCHAR(15) NOT NULL,
`date_became_customer` DATETIME,
`date_of_birth` DATETIME,
`first_name` VARCHAR(80),
`last_name` VARCHAR(80),
`amount_outstanding` DOUBLE NULL,
`email_address` VARCHAR(250),
`phone_number` VARCHAR(255),
`cell_mobile_phone_number` VARCHAR(255),
FOREIGN KEY (`customer_address_id` ) REFERENCES `Addresses`(`address_id` )
)
3 rows from Customers table:
customer_id customer_address_id customer_status_code date_became_customer date_of_birth first_name last_name amount_outstanding email_address phone_number cell_mobile_phone_number
1 13 Bad Customer 2016-05-11 17:03:48 1998-12-15 13:24:40 Carole Bernhard 255.0 everette.goyette@example.org 07278206718 861-638-9797
2 10 Bad Customer 2015-11-16 22:52:14 1995-07-17 12:13:16 Genevieve Terry 7256.0 huel.jana@example.org +14(5)2351480248 578-518-4785x612
3 10 Good Customer 2016-04-08 00:28:15 1994-06-21 01:34:56 Clara Ortiz 9443.0 hilario.sporer@example.org 374-483-2758x85087 1-197-686-2849x8761
CREATE TABLE `Customer_Payments` (
`customer_id` INTEGER NOT NULL,
`datetime_payment` DATETIME NOT NULL,
`payment_method_code` VARCHAR(10) NOT NULL,
`amount_payment` DOUBLE NULL,
PRIMARY KEY (`customer_id`,`datetime_payment`),
FOREIGN KEY (`customer_id` ) REFERENCES `Customers`(`customer_id` )
)
3 rows from Customer_Payments table:
customer_id datetime_payment payment_method_code amount_payment
11 2018-02-05 18:44:46 Direct Debit 9570.93
2 2018-02-24 10:07:05 Direct Debit 8180.26
14 2018-02-27 20:08:53 Direct Debit 4610.26
CREATE TABLE `Lessons` (
`lesson_id` INTEGER PRIMARY KEY,
`customer_id` INTEGER NOT NULL,
`lesson_status_code` VARCHAR(15) NOT NULL,
`staff_id` INTEGER,
`vehicle_id` INTEGER NOT NULL,
`lesson_date` DATETIME,
`lesson_time` VARCHAR(10),
`price` DOUBLE NULL,
FOREIGN KEY (`vehicle_id` ) REFERENCES `Vehicles`(`vehicle_id` ),
FOREIGN KEY (`staff_id` ) REFERENCES `Staff`(`staff_id` ),
FOREIGN KEY (`customer_id` ) REFERENCES `Customers`(`customer_id` )
)
3 rows from Lessons table:
lesson_id customer_id lesson_status_code staff_id vehicle_id lesson_date lesson_time price
1 6 Cancelled 8 3 2018-02-28 10:55:36 5 199.0
2 8 Cancelled 14 3 2018-03-07 16:12:36 6 167.0
3 6 Cancelled 11 2 2018-03-03 15:10:16 3 352.0
|
driving_school | List the states which have between 2 to 4 staffs living there. | SELECT T1.state_province_county FROM Addresses AS T1 JOIN Staff AS T2 ON T1.address_id = T2.staff_address_id GROUP BY T1.state_province_county HAVING count(*) BETWEEN 2 AND 4; | CREATE TABLE `Addresses` (
`address_id` INTEGER PRIMARY KEY,
`line_1_number_building` VARCHAR(80),
`city` VARCHAR(50),
`zip_postcode` VARCHAR(20),
`state_province_county` VARCHAR(50),
`country` VARCHAR(50)
)
3 rows from Addresses table:
address_id line_1_number_building city zip_postcode state_province_county country
1 3904 Stroman Passage Port Melyssa 14445 Georgia USA
2 053 Quigley Island Hagenesfurt 22194 Kentucky USA
3 00704 Zoe Alley Lake Elaina 08938 Georgia USA
CREATE TABLE `Staff` (
`staff_id` INTEGER PRIMARY KEY,
`staff_address_id` INTEGER NOT NULL,
`nickname` VARCHAR(80),
`first_name` VARCHAR(80),
`middle_name` VARCHAR(80),
`last_name` VARCHAR(80),
`date_of_birth` DATETIME,
`date_joined_staff` DATETIME,
`date_left_staff` DATETIME,
FOREIGN KEY (`staff_address_id` ) REFERENCES `Addresses`(`address_id` )
)
3 rows from Staff table:
staff_id staff_address_id nickname first_name middle_name last_name date_of_birth date_joined_staff date_left_staff
1 14 thompson.constantin Janessa Amara Sawayn 2010-12-08 16:55:14 2017-04-27 03:21:26 2018-03-23 22:53:12
2 3 santos45 Camylle Icie Weissnat 2015-08-01 13:22:43 2016-06-06 08:54:28 2018-03-10 15:25:00
3 5 ynader Kaitlin Stephania Mertz 1994-05-17 05:32:11 2018-01-02 12:24:24 2018-03-24 10:11:08
CREATE TABLE `Vehicles` (
`vehicle_id` INTEGER PRIMARY KEY,
`vehicle_details` VARCHAR(255)
)
3 rows from Vehicles table:
vehicle_id vehicle_details
1 Van
2 Truck
3 Car
CREATE TABLE `Customers` (
`customer_id` INTEGER PRIMARY KEY,
`customer_address_id` INTEGER NOT NULL,
`customer_status_code` VARCHAR(15) NOT NULL,
`date_became_customer` DATETIME,
`date_of_birth` DATETIME,
`first_name` VARCHAR(80),
`last_name` VARCHAR(80),
`amount_outstanding` DOUBLE NULL,
`email_address` VARCHAR(250),
`phone_number` VARCHAR(255),
`cell_mobile_phone_number` VARCHAR(255),
FOREIGN KEY (`customer_address_id` ) REFERENCES `Addresses`(`address_id` )
)
3 rows from Customers table:
customer_id customer_address_id customer_status_code date_became_customer date_of_birth first_name last_name amount_outstanding email_address phone_number cell_mobile_phone_number
1 13 Bad Customer 2016-05-11 17:03:48 1998-12-15 13:24:40 Carole Bernhard 255.0 everette.goyette@example.org 07278206718 861-638-9797
2 10 Bad Customer 2015-11-16 22:52:14 1995-07-17 12:13:16 Genevieve Terry 7256.0 huel.jana@example.org +14(5)2351480248 578-518-4785x612
3 10 Good Customer 2016-04-08 00:28:15 1994-06-21 01:34:56 Clara Ortiz 9443.0 hilario.sporer@example.org 374-483-2758x85087 1-197-686-2849x8761
CREATE TABLE `Customer_Payments` (
`customer_id` INTEGER NOT NULL,
`datetime_payment` DATETIME NOT NULL,
`payment_method_code` VARCHAR(10) NOT NULL,
`amount_payment` DOUBLE NULL,
PRIMARY KEY (`customer_id`,`datetime_payment`),
FOREIGN KEY (`customer_id` ) REFERENCES `Customers`(`customer_id` )
)
3 rows from Customer_Payments table:
customer_id datetime_payment payment_method_code amount_payment
11 2018-02-05 18:44:46 Direct Debit 9570.93
2 2018-02-24 10:07:05 Direct Debit 8180.26
14 2018-02-27 20:08:53 Direct Debit 4610.26
CREATE TABLE `Lessons` (
`lesson_id` INTEGER PRIMARY KEY,
`customer_id` INTEGER NOT NULL,
`lesson_status_code` VARCHAR(15) NOT NULL,
`staff_id` INTEGER,
`vehicle_id` INTEGER NOT NULL,
`lesson_date` DATETIME,
`lesson_time` VARCHAR(10),
`price` DOUBLE NULL,
FOREIGN KEY (`vehicle_id` ) REFERENCES `Vehicles`(`vehicle_id` ),
FOREIGN KEY (`staff_id` ) REFERENCES `Staff`(`staff_id` ),
FOREIGN KEY (`customer_id` ) REFERENCES `Customers`(`customer_id` )
)
3 rows from Lessons table:
lesson_id customer_id lesson_status_code staff_id vehicle_id lesson_date lesson_time price
1 6 Cancelled 8 3 2018-02-28 10:55:36 5 199.0
2 8 Cancelled 14 3 2018-03-07 16:12:36 6 167.0
3 6 Cancelled 11 2 2018-03-03 15:10:16 3 352.0
|
driving_school | What are the names of the states that have 2 to 4 employees living there? | SELECT T1.state_province_county FROM Addresses AS T1 JOIN Staff AS T2 ON T1.address_id = T2.staff_address_id GROUP BY T1.state_province_county HAVING count(*) BETWEEN 2 AND 4; | CREATE TABLE `Addresses` (
`address_id` INTEGER PRIMARY KEY,
`line_1_number_building` VARCHAR(80),
`city` VARCHAR(50),
`zip_postcode` VARCHAR(20),
`state_province_county` VARCHAR(50),
`country` VARCHAR(50)
)
3 rows from Addresses table:
address_id line_1_number_building city zip_postcode state_province_county country
1 3904 Stroman Passage Port Melyssa 14445 Georgia USA
2 053 Quigley Island Hagenesfurt 22194 Kentucky USA
3 00704 Zoe Alley Lake Elaina 08938 Georgia USA
CREATE TABLE `Staff` (
`staff_id` INTEGER PRIMARY KEY,
`staff_address_id` INTEGER NOT NULL,
`nickname` VARCHAR(80),
`first_name` VARCHAR(80),
`middle_name` VARCHAR(80),
`last_name` VARCHAR(80),
`date_of_birth` DATETIME,
`date_joined_staff` DATETIME,
`date_left_staff` DATETIME,
FOREIGN KEY (`staff_address_id` ) REFERENCES `Addresses`(`address_id` )
)
3 rows from Staff table:
staff_id staff_address_id nickname first_name middle_name last_name date_of_birth date_joined_staff date_left_staff
1 14 thompson.constantin Janessa Amara Sawayn 2010-12-08 16:55:14 2017-04-27 03:21:26 2018-03-23 22:53:12
2 3 santos45 Camylle Icie Weissnat 2015-08-01 13:22:43 2016-06-06 08:54:28 2018-03-10 15:25:00
3 5 ynader Kaitlin Stephania Mertz 1994-05-17 05:32:11 2018-01-02 12:24:24 2018-03-24 10:11:08
CREATE TABLE `Vehicles` (
`vehicle_id` INTEGER PRIMARY KEY,
`vehicle_details` VARCHAR(255)
)
3 rows from Vehicles table:
vehicle_id vehicle_details
1 Van
2 Truck
3 Car
CREATE TABLE `Customers` (
`customer_id` INTEGER PRIMARY KEY,
`customer_address_id` INTEGER NOT NULL,
`customer_status_code` VARCHAR(15) NOT NULL,
`date_became_customer` DATETIME,
`date_of_birth` DATETIME,
`first_name` VARCHAR(80),
`last_name` VARCHAR(80),
`amount_outstanding` DOUBLE NULL,
`email_address` VARCHAR(250),
`phone_number` VARCHAR(255),
`cell_mobile_phone_number` VARCHAR(255),
FOREIGN KEY (`customer_address_id` ) REFERENCES `Addresses`(`address_id` )
)
3 rows from Customers table:
customer_id customer_address_id customer_status_code date_became_customer date_of_birth first_name last_name amount_outstanding email_address phone_number cell_mobile_phone_number
1 13 Bad Customer 2016-05-11 17:03:48 1998-12-15 13:24:40 Carole Bernhard 255.0 everette.goyette@example.org 07278206718 861-638-9797
2 10 Bad Customer 2015-11-16 22:52:14 1995-07-17 12:13:16 Genevieve Terry 7256.0 huel.jana@example.org +14(5)2351480248 578-518-4785x612
3 10 Good Customer 2016-04-08 00:28:15 1994-06-21 01:34:56 Clara Ortiz 9443.0 hilario.sporer@example.org 374-483-2758x85087 1-197-686-2849x8761
CREATE TABLE `Customer_Payments` (
`customer_id` INTEGER NOT NULL,
`datetime_payment` DATETIME NOT NULL,
`payment_method_code` VARCHAR(10) NOT NULL,
`amount_payment` DOUBLE NULL,
PRIMARY KEY (`customer_id`,`datetime_payment`),
FOREIGN KEY (`customer_id` ) REFERENCES `Customers`(`customer_id` )
)
3 rows from Customer_Payments table:
customer_id datetime_payment payment_method_code amount_payment
11 2018-02-05 18:44:46 Direct Debit 9570.93
2 2018-02-24 10:07:05 Direct Debit 8180.26
14 2018-02-27 20:08:53 Direct Debit 4610.26
CREATE TABLE `Lessons` (
`lesson_id` INTEGER PRIMARY KEY,
`customer_id` INTEGER NOT NULL,
`lesson_status_code` VARCHAR(15) NOT NULL,
`staff_id` INTEGER,
`vehicle_id` INTEGER NOT NULL,
`lesson_date` DATETIME,
`lesson_time` VARCHAR(10),
`price` DOUBLE NULL,
FOREIGN KEY (`vehicle_id` ) REFERENCES `Vehicles`(`vehicle_id` ),
FOREIGN KEY (`staff_id` ) REFERENCES `Staff`(`staff_id` ),
FOREIGN KEY (`customer_id` ) REFERENCES `Customers`(`customer_id` )
)
3 rows from Lessons table:
lesson_id customer_id lesson_status_code staff_id vehicle_id lesson_date lesson_time price
1 6 Cancelled 8 3 2018-02-28 10:55:36 5 199.0
2 8 Cancelled 14 3 2018-03-07 16:12:36 6 167.0
3 6 Cancelled 11 2 2018-03-03 15:10:16 3 352.0
|
driving_school | List the first name and last name of all customers. | SELECT first_name , last_name FROM Customers; | CREATE TABLE `Addresses` (
`address_id` INTEGER PRIMARY KEY,
`line_1_number_building` VARCHAR(80),
`city` VARCHAR(50),
`zip_postcode` VARCHAR(20),
`state_province_county` VARCHAR(50),
`country` VARCHAR(50)
)
3 rows from Addresses table:
address_id line_1_number_building city zip_postcode state_province_county country
1 3904 Stroman Passage Port Melyssa 14445 Georgia USA
2 053 Quigley Island Hagenesfurt 22194 Kentucky USA
3 00704 Zoe Alley Lake Elaina 08938 Georgia USA
CREATE TABLE `Staff` (
`staff_id` INTEGER PRIMARY KEY,
`staff_address_id` INTEGER NOT NULL,
`nickname` VARCHAR(80),
`first_name` VARCHAR(80),
`middle_name` VARCHAR(80),
`last_name` VARCHAR(80),
`date_of_birth` DATETIME,
`date_joined_staff` DATETIME,
`date_left_staff` DATETIME,
FOREIGN KEY (`staff_address_id` ) REFERENCES `Addresses`(`address_id` )
)
3 rows from Staff table:
staff_id staff_address_id nickname first_name middle_name last_name date_of_birth date_joined_staff date_left_staff
1 14 thompson.constantin Janessa Amara Sawayn 2010-12-08 16:55:14 2017-04-27 03:21:26 2018-03-23 22:53:12
2 3 santos45 Camylle Icie Weissnat 2015-08-01 13:22:43 2016-06-06 08:54:28 2018-03-10 15:25:00
3 5 ynader Kaitlin Stephania Mertz 1994-05-17 05:32:11 2018-01-02 12:24:24 2018-03-24 10:11:08
CREATE TABLE `Vehicles` (
`vehicle_id` INTEGER PRIMARY KEY,
`vehicle_details` VARCHAR(255)
)
3 rows from Vehicles table:
vehicle_id vehicle_details
1 Van
2 Truck
3 Car
CREATE TABLE `Customers` (
`customer_id` INTEGER PRIMARY KEY,
`customer_address_id` INTEGER NOT NULL,
`customer_status_code` VARCHAR(15) NOT NULL,
`date_became_customer` DATETIME,
`date_of_birth` DATETIME,
`first_name` VARCHAR(80),
`last_name` VARCHAR(80),
`amount_outstanding` DOUBLE NULL,
`email_address` VARCHAR(250),
`phone_number` VARCHAR(255),
`cell_mobile_phone_number` VARCHAR(255),
FOREIGN KEY (`customer_address_id` ) REFERENCES `Addresses`(`address_id` )
)
3 rows from Customers table:
customer_id customer_address_id customer_status_code date_became_customer date_of_birth first_name last_name amount_outstanding email_address phone_number cell_mobile_phone_number
1 13 Bad Customer 2016-05-11 17:03:48 1998-12-15 13:24:40 Carole Bernhard 255.0 everette.goyette@example.org 07278206718 861-638-9797
2 10 Bad Customer 2015-11-16 22:52:14 1995-07-17 12:13:16 Genevieve Terry 7256.0 huel.jana@example.org +14(5)2351480248 578-518-4785x612
3 10 Good Customer 2016-04-08 00:28:15 1994-06-21 01:34:56 Clara Ortiz 9443.0 hilario.sporer@example.org 374-483-2758x85087 1-197-686-2849x8761
CREATE TABLE `Customer_Payments` (
`customer_id` INTEGER NOT NULL,
`datetime_payment` DATETIME NOT NULL,
`payment_method_code` VARCHAR(10) NOT NULL,
`amount_payment` DOUBLE NULL,
PRIMARY KEY (`customer_id`,`datetime_payment`),
FOREIGN KEY (`customer_id` ) REFERENCES `Customers`(`customer_id` )
)
3 rows from Customer_Payments table:
customer_id datetime_payment payment_method_code amount_payment
11 2018-02-05 18:44:46 Direct Debit 9570.93
2 2018-02-24 10:07:05 Direct Debit 8180.26
14 2018-02-27 20:08:53 Direct Debit 4610.26
CREATE TABLE `Lessons` (
`lesson_id` INTEGER PRIMARY KEY,
`customer_id` INTEGER NOT NULL,
`lesson_status_code` VARCHAR(15) NOT NULL,
`staff_id` INTEGER,
`vehicle_id` INTEGER NOT NULL,
`lesson_date` DATETIME,
`lesson_time` VARCHAR(10),
`price` DOUBLE NULL,
FOREIGN KEY (`vehicle_id` ) REFERENCES `Vehicles`(`vehicle_id` ),
FOREIGN KEY (`staff_id` ) REFERENCES `Staff`(`staff_id` ),
FOREIGN KEY (`customer_id` ) REFERENCES `Customers`(`customer_id` )
)
3 rows from Lessons table:
lesson_id customer_id lesson_status_code staff_id vehicle_id lesson_date lesson_time price
1 6 Cancelled 8 3 2018-02-28 10:55:36 5 199.0
2 8 Cancelled 14 3 2018-03-07 16:12:36 6 167.0
3 6 Cancelled 11 2 2018-03-03 15:10:16 3 352.0
|
driving_school | What are the first and last names for all customers? | SELECT first_name , last_name FROM Customers; | CREATE TABLE `Addresses` (
`address_id` INTEGER PRIMARY KEY,
`line_1_number_building` VARCHAR(80),
`city` VARCHAR(50),
`zip_postcode` VARCHAR(20),
`state_province_county` VARCHAR(50),
`country` VARCHAR(50)
)
3 rows from Addresses table:
address_id line_1_number_building city zip_postcode state_province_county country
1 3904 Stroman Passage Port Melyssa 14445 Georgia USA
2 053 Quigley Island Hagenesfurt 22194 Kentucky USA
3 00704 Zoe Alley Lake Elaina 08938 Georgia USA
CREATE TABLE `Staff` (
`staff_id` INTEGER PRIMARY KEY,
`staff_address_id` INTEGER NOT NULL,
`nickname` VARCHAR(80),
`first_name` VARCHAR(80),
`middle_name` VARCHAR(80),
`last_name` VARCHAR(80),
`date_of_birth` DATETIME,
`date_joined_staff` DATETIME,
`date_left_staff` DATETIME,
FOREIGN KEY (`staff_address_id` ) REFERENCES `Addresses`(`address_id` )
)
3 rows from Staff table:
staff_id staff_address_id nickname first_name middle_name last_name date_of_birth date_joined_staff date_left_staff
1 14 thompson.constantin Janessa Amara Sawayn 2010-12-08 16:55:14 2017-04-27 03:21:26 2018-03-23 22:53:12
2 3 santos45 Camylle Icie Weissnat 2015-08-01 13:22:43 2016-06-06 08:54:28 2018-03-10 15:25:00
3 5 ynader Kaitlin Stephania Mertz 1994-05-17 05:32:11 2018-01-02 12:24:24 2018-03-24 10:11:08
CREATE TABLE `Vehicles` (
`vehicle_id` INTEGER PRIMARY KEY,
`vehicle_details` VARCHAR(255)
)
3 rows from Vehicles table:
vehicle_id vehicle_details
1 Van
2 Truck
3 Car
CREATE TABLE `Customers` (
`customer_id` INTEGER PRIMARY KEY,
`customer_address_id` INTEGER NOT NULL,
`customer_status_code` VARCHAR(15) NOT NULL,
`date_became_customer` DATETIME,
`date_of_birth` DATETIME,
`first_name` VARCHAR(80),
`last_name` VARCHAR(80),
`amount_outstanding` DOUBLE NULL,
`email_address` VARCHAR(250),
`phone_number` VARCHAR(255),
`cell_mobile_phone_number` VARCHAR(255),
FOREIGN KEY (`customer_address_id` ) REFERENCES `Addresses`(`address_id` )
)
3 rows from Customers table:
customer_id customer_address_id customer_status_code date_became_customer date_of_birth first_name last_name amount_outstanding email_address phone_number cell_mobile_phone_number
1 13 Bad Customer 2016-05-11 17:03:48 1998-12-15 13:24:40 Carole Bernhard 255.0 everette.goyette@example.org 07278206718 861-638-9797
2 10 Bad Customer 2015-11-16 22:52:14 1995-07-17 12:13:16 Genevieve Terry 7256.0 huel.jana@example.org +14(5)2351480248 578-518-4785x612
3 10 Good Customer 2016-04-08 00:28:15 1994-06-21 01:34:56 Clara Ortiz 9443.0 hilario.sporer@example.org 374-483-2758x85087 1-197-686-2849x8761
CREATE TABLE `Customer_Payments` (
`customer_id` INTEGER NOT NULL,
`datetime_payment` DATETIME NOT NULL,
`payment_method_code` VARCHAR(10) NOT NULL,
`amount_payment` DOUBLE NULL,
PRIMARY KEY (`customer_id`,`datetime_payment`),
FOREIGN KEY (`customer_id` ) REFERENCES `Customers`(`customer_id` )
)
3 rows from Customer_Payments table:
customer_id datetime_payment payment_method_code amount_payment
11 2018-02-05 18:44:46 Direct Debit 9570.93
2 2018-02-24 10:07:05 Direct Debit 8180.26
14 2018-02-27 20:08:53 Direct Debit 4610.26
CREATE TABLE `Lessons` (
`lesson_id` INTEGER PRIMARY KEY,
`customer_id` INTEGER NOT NULL,
`lesson_status_code` VARCHAR(15) NOT NULL,
`staff_id` INTEGER,
`vehicle_id` INTEGER NOT NULL,
`lesson_date` DATETIME,
`lesson_time` VARCHAR(10),
`price` DOUBLE NULL,
FOREIGN KEY (`vehicle_id` ) REFERENCES `Vehicles`(`vehicle_id` ),
FOREIGN KEY (`staff_id` ) REFERENCES `Staff`(`staff_id` ),
FOREIGN KEY (`customer_id` ) REFERENCES `Customers`(`customer_id` )
)
3 rows from Lessons table:
lesson_id customer_id lesson_status_code staff_id vehicle_id lesson_date lesson_time price
1 6 Cancelled 8 3 2018-02-28 10:55:36 5 199.0
2 8 Cancelled 14 3 2018-03-07 16:12:36 6 167.0
3 6 Cancelled 11 2 2018-03-03 15:10:16 3 352.0
|
driving_school | List email address and birthday of customer whose first name as Carole. | SELECT email_address , date_of_birth FROM Customers WHERE first_name = "Carole" | CREATE TABLE `Addresses` (
`address_id` INTEGER PRIMARY KEY,
`line_1_number_building` VARCHAR(80),
`city` VARCHAR(50),
`zip_postcode` VARCHAR(20),
`state_province_county` VARCHAR(50),
`country` VARCHAR(50)
)
3 rows from Addresses table:
address_id line_1_number_building city zip_postcode state_province_county country
1 3904 Stroman Passage Port Melyssa 14445 Georgia USA
2 053 Quigley Island Hagenesfurt 22194 Kentucky USA
3 00704 Zoe Alley Lake Elaina 08938 Georgia USA
CREATE TABLE `Staff` (
`staff_id` INTEGER PRIMARY KEY,
`staff_address_id` INTEGER NOT NULL,
`nickname` VARCHAR(80),
`first_name` VARCHAR(80),
`middle_name` VARCHAR(80),
`last_name` VARCHAR(80),
`date_of_birth` DATETIME,
`date_joined_staff` DATETIME,
`date_left_staff` DATETIME,
FOREIGN KEY (`staff_address_id` ) REFERENCES `Addresses`(`address_id` )
)
3 rows from Staff table:
staff_id staff_address_id nickname first_name middle_name last_name date_of_birth date_joined_staff date_left_staff
1 14 thompson.constantin Janessa Amara Sawayn 2010-12-08 16:55:14 2017-04-27 03:21:26 2018-03-23 22:53:12
2 3 santos45 Camylle Icie Weissnat 2015-08-01 13:22:43 2016-06-06 08:54:28 2018-03-10 15:25:00
3 5 ynader Kaitlin Stephania Mertz 1994-05-17 05:32:11 2018-01-02 12:24:24 2018-03-24 10:11:08
CREATE TABLE `Vehicles` (
`vehicle_id` INTEGER PRIMARY KEY,
`vehicle_details` VARCHAR(255)
)
3 rows from Vehicles table:
vehicle_id vehicle_details
1 Van
2 Truck
3 Car
CREATE TABLE `Customers` (
`customer_id` INTEGER PRIMARY KEY,
`customer_address_id` INTEGER NOT NULL,
`customer_status_code` VARCHAR(15) NOT NULL,
`date_became_customer` DATETIME,
`date_of_birth` DATETIME,
`first_name` VARCHAR(80),
`last_name` VARCHAR(80),
`amount_outstanding` DOUBLE NULL,
`email_address` VARCHAR(250),
`phone_number` VARCHAR(255),
`cell_mobile_phone_number` VARCHAR(255),
FOREIGN KEY (`customer_address_id` ) REFERENCES `Addresses`(`address_id` )
)
3 rows from Customers table:
customer_id customer_address_id customer_status_code date_became_customer date_of_birth first_name last_name amount_outstanding email_address phone_number cell_mobile_phone_number
1 13 Bad Customer 2016-05-11 17:03:48 1998-12-15 13:24:40 Carole Bernhard 255.0 everette.goyette@example.org 07278206718 861-638-9797
2 10 Bad Customer 2015-11-16 22:52:14 1995-07-17 12:13:16 Genevieve Terry 7256.0 huel.jana@example.org +14(5)2351480248 578-518-4785x612
3 10 Good Customer 2016-04-08 00:28:15 1994-06-21 01:34:56 Clara Ortiz 9443.0 hilario.sporer@example.org 374-483-2758x85087 1-197-686-2849x8761
CREATE TABLE `Customer_Payments` (
`customer_id` INTEGER NOT NULL,
`datetime_payment` DATETIME NOT NULL,
`payment_method_code` VARCHAR(10) NOT NULL,
`amount_payment` DOUBLE NULL,
PRIMARY KEY (`customer_id`,`datetime_payment`),
FOREIGN KEY (`customer_id` ) REFERENCES `Customers`(`customer_id` )
)
3 rows from Customer_Payments table:
customer_id datetime_payment payment_method_code amount_payment
11 2018-02-05 18:44:46 Direct Debit 9570.93
2 2018-02-24 10:07:05 Direct Debit 8180.26
14 2018-02-27 20:08:53 Direct Debit 4610.26
CREATE TABLE `Lessons` (
`lesson_id` INTEGER PRIMARY KEY,
`customer_id` INTEGER NOT NULL,
`lesson_status_code` VARCHAR(15) NOT NULL,
`staff_id` INTEGER,
`vehicle_id` INTEGER NOT NULL,
`lesson_date` DATETIME,
`lesson_time` VARCHAR(10),
`price` DOUBLE NULL,
FOREIGN KEY (`vehicle_id` ) REFERENCES `Vehicles`(`vehicle_id` ),
FOREIGN KEY (`staff_id` ) REFERENCES `Staff`(`staff_id` ),
FOREIGN KEY (`customer_id` ) REFERENCES `Customers`(`customer_id` )
)
3 rows from Lessons table:
lesson_id customer_id lesson_status_code staff_id vehicle_id lesson_date lesson_time price
1 6 Cancelled 8 3 2018-02-28 10:55:36 5 199.0
2 8 Cancelled 14 3 2018-03-07 16:12:36 6 167.0
3 6 Cancelled 11 2 2018-03-03 15:10:16 3 352.0
|
driving_school | What are the email addresses and date of births for all customers who have a first name of Carole? | SELECT email_address , date_of_birth FROM Customers WHERE first_name = "Carole" | CREATE TABLE `Addresses` (
`address_id` INTEGER PRIMARY KEY,
`line_1_number_building` VARCHAR(80),
`city` VARCHAR(50),
`zip_postcode` VARCHAR(20),
`state_province_county` VARCHAR(50),
`country` VARCHAR(50)
)
3 rows from Addresses table:
address_id line_1_number_building city zip_postcode state_province_county country
1 3904 Stroman Passage Port Melyssa 14445 Georgia USA
2 053 Quigley Island Hagenesfurt 22194 Kentucky USA
3 00704 Zoe Alley Lake Elaina 08938 Georgia USA
CREATE TABLE `Staff` (
`staff_id` INTEGER PRIMARY KEY,
`staff_address_id` INTEGER NOT NULL,
`nickname` VARCHAR(80),
`first_name` VARCHAR(80),
`middle_name` VARCHAR(80),
`last_name` VARCHAR(80),
`date_of_birth` DATETIME,
`date_joined_staff` DATETIME,
`date_left_staff` DATETIME,
FOREIGN KEY (`staff_address_id` ) REFERENCES `Addresses`(`address_id` )
)
3 rows from Staff table:
staff_id staff_address_id nickname first_name middle_name last_name date_of_birth date_joined_staff date_left_staff
1 14 thompson.constantin Janessa Amara Sawayn 2010-12-08 16:55:14 2017-04-27 03:21:26 2018-03-23 22:53:12
2 3 santos45 Camylle Icie Weissnat 2015-08-01 13:22:43 2016-06-06 08:54:28 2018-03-10 15:25:00
3 5 ynader Kaitlin Stephania Mertz 1994-05-17 05:32:11 2018-01-02 12:24:24 2018-03-24 10:11:08
CREATE TABLE `Vehicles` (
`vehicle_id` INTEGER PRIMARY KEY,
`vehicle_details` VARCHAR(255)
)
3 rows from Vehicles table:
vehicle_id vehicle_details
1 Van
2 Truck
3 Car
CREATE TABLE `Customers` (
`customer_id` INTEGER PRIMARY KEY,
`customer_address_id` INTEGER NOT NULL,
`customer_status_code` VARCHAR(15) NOT NULL,
`date_became_customer` DATETIME,
`date_of_birth` DATETIME,
`first_name` VARCHAR(80),
`last_name` VARCHAR(80),
`amount_outstanding` DOUBLE NULL,
`email_address` VARCHAR(250),
`phone_number` VARCHAR(255),
`cell_mobile_phone_number` VARCHAR(255),
FOREIGN KEY (`customer_address_id` ) REFERENCES `Addresses`(`address_id` )
)
3 rows from Customers table:
customer_id customer_address_id customer_status_code date_became_customer date_of_birth first_name last_name amount_outstanding email_address phone_number cell_mobile_phone_number
1 13 Bad Customer 2016-05-11 17:03:48 1998-12-15 13:24:40 Carole Bernhard 255.0 everette.goyette@example.org 07278206718 861-638-9797
2 10 Bad Customer 2015-11-16 22:52:14 1995-07-17 12:13:16 Genevieve Terry 7256.0 huel.jana@example.org +14(5)2351480248 578-518-4785x612
3 10 Good Customer 2016-04-08 00:28:15 1994-06-21 01:34:56 Clara Ortiz 9443.0 hilario.sporer@example.org 374-483-2758x85087 1-197-686-2849x8761
CREATE TABLE `Customer_Payments` (
`customer_id` INTEGER NOT NULL,
`datetime_payment` DATETIME NOT NULL,
`payment_method_code` VARCHAR(10) NOT NULL,
`amount_payment` DOUBLE NULL,
PRIMARY KEY (`customer_id`,`datetime_payment`),
FOREIGN KEY (`customer_id` ) REFERENCES `Customers`(`customer_id` )
)
3 rows from Customer_Payments table:
customer_id datetime_payment payment_method_code amount_payment
11 2018-02-05 18:44:46 Direct Debit 9570.93
2 2018-02-24 10:07:05 Direct Debit 8180.26
14 2018-02-27 20:08:53 Direct Debit 4610.26
CREATE TABLE `Lessons` (
`lesson_id` INTEGER PRIMARY KEY,
`customer_id` INTEGER NOT NULL,
`lesson_status_code` VARCHAR(15) NOT NULL,
`staff_id` INTEGER,
`vehicle_id` INTEGER NOT NULL,
`lesson_date` DATETIME,
`lesson_time` VARCHAR(10),
`price` DOUBLE NULL,
FOREIGN KEY (`vehicle_id` ) REFERENCES `Vehicles`(`vehicle_id` ),
FOREIGN KEY (`staff_id` ) REFERENCES `Staff`(`staff_id` ),
FOREIGN KEY (`customer_id` ) REFERENCES `Customers`(`customer_id` )
)
3 rows from Lessons table:
lesson_id customer_id lesson_status_code staff_id vehicle_id lesson_date lesson_time price
1 6 Cancelled 8 3 2018-02-28 10:55:36 5 199.0
2 8 Cancelled 14 3 2018-03-07 16:12:36 6 167.0
3 6 Cancelled 11 2 2018-03-03 15:10:16 3 352.0
|
driving_school | List phone number and email address of customer with more than 2000 outstanding balance. | SELECT phone_number , email_address FROM Customers WHERE amount_outstanding > 2000; | CREATE TABLE `Addresses` (
`address_id` INTEGER PRIMARY KEY,
`line_1_number_building` VARCHAR(80),
`city` VARCHAR(50),
`zip_postcode` VARCHAR(20),
`state_province_county` VARCHAR(50),
`country` VARCHAR(50)
)
3 rows from Addresses table:
address_id line_1_number_building city zip_postcode state_province_county country
1 3904 Stroman Passage Port Melyssa 14445 Georgia USA
2 053 Quigley Island Hagenesfurt 22194 Kentucky USA
3 00704 Zoe Alley Lake Elaina 08938 Georgia USA
CREATE TABLE `Staff` (
`staff_id` INTEGER PRIMARY KEY,
`staff_address_id` INTEGER NOT NULL,
`nickname` VARCHAR(80),
`first_name` VARCHAR(80),
`middle_name` VARCHAR(80),
`last_name` VARCHAR(80),
`date_of_birth` DATETIME,
`date_joined_staff` DATETIME,
`date_left_staff` DATETIME,
FOREIGN KEY (`staff_address_id` ) REFERENCES `Addresses`(`address_id` )
)
3 rows from Staff table:
staff_id staff_address_id nickname first_name middle_name last_name date_of_birth date_joined_staff date_left_staff
1 14 thompson.constantin Janessa Amara Sawayn 2010-12-08 16:55:14 2017-04-27 03:21:26 2018-03-23 22:53:12
2 3 santos45 Camylle Icie Weissnat 2015-08-01 13:22:43 2016-06-06 08:54:28 2018-03-10 15:25:00
3 5 ynader Kaitlin Stephania Mertz 1994-05-17 05:32:11 2018-01-02 12:24:24 2018-03-24 10:11:08
CREATE TABLE `Vehicles` (
`vehicle_id` INTEGER PRIMARY KEY,
`vehicle_details` VARCHAR(255)
)
3 rows from Vehicles table:
vehicle_id vehicle_details
1 Van
2 Truck
3 Car
CREATE TABLE `Customers` (
`customer_id` INTEGER PRIMARY KEY,
`customer_address_id` INTEGER NOT NULL,
`customer_status_code` VARCHAR(15) NOT NULL,
`date_became_customer` DATETIME,
`date_of_birth` DATETIME,
`first_name` VARCHAR(80),
`last_name` VARCHAR(80),
`amount_outstanding` DOUBLE NULL,
`email_address` VARCHAR(250),
`phone_number` VARCHAR(255),
`cell_mobile_phone_number` VARCHAR(255),
FOREIGN KEY (`customer_address_id` ) REFERENCES `Addresses`(`address_id` )
)
3 rows from Customers table:
customer_id customer_address_id customer_status_code date_became_customer date_of_birth first_name last_name amount_outstanding email_address phone_number cell_mobile_phone_number
1 13 Bad Customer 2016-05-11 17:03:48 1998-12-15 13:24:40 Carole Bernhard 255.0 everette.goyette@example.org 07278206718 861-638-9797
2 10 Bad Customer 2015-11-16 22:52:14 1995-07-17 12:13:16 Genevieve Terry 7256.0 huel.jana@example.org +14(5)2351480248 578-518-4785x612
3 10 Good Customer 2016-04-08 00:28:15 1994-06-21 01:34:56 Clara Ortiz 9443.0 hilario.sporer@example.org 374-483-2758x85087 1-197-686-2849x8761
CREATE TABLE `Customer_Payments` (
`customer_id` INTEGER NOT NULL,
`datetime_payment` DATETIME NOT NULL,
`payment_method_code` VARCHAR(10) NOT NULL,
`amount_payment` DOUBLE NULL,
PRIMARY KEY (`customer_id`,`datetime_payment`),
FOREIGN KEY (`customer_id` ) REFERENCES `Customers`(`customer_id` )
)
3 rows from Customer_Payments table:
customer_id datetime_payment payment_method_code amount_payment
11 2018-02-05 18:44:46 Direct Debit 9570.93
2 2018-02-24 10:07:05 Direct Debit 8180.26
14 2018-02-27 20:08:53 Direct Debit 4610.26
CREATE TABLE `Lessons` (
`lesson_id` INTEGER PRIMARY KEY,
`customer_id` INTEGER NOT NULL,
`lesson_status_code` VARCHAR(15) NOT NULL,
`staff_id` INTEGER,
`vehicle_id` INTEGER NOT NULL,
`lesson_date` DATETIME,
`lesson_time` VARCHAR(10),
`price` DOUBLE NULL,
FOREIGN KEY (`vehicle_id` ) REFERENCES `Vehicles`(`vehicle_id` ),
FOREIGN KEY (`staff_id` ) REFERENCES `Staff`(`staff_id` ),
FOREIGN KEY (`customer_id` ) REFERENCES `Customers`(`customer_id` )
)
3 rows from Lessons table:
lesson_id customer_id lesson_status_code staff_id vehicle_id lesson_date lesson_time price
1 6 Cancelled 8 3 2018-02-28 10:55:36 5 199.0
2 8 Cancelled 14 3 2018-03-07 16:12:36 6 167.0
3 6 Cancelled 11 2 2018-03-03 15:10:16 3 352.0
|
driving_school | What are the phone numbers and email addresses of all customers who have an outstanding balance of more than 2000? | SELECT phone_number , email_address FROM Customers WHERE amount_outstanding > 2000; | CREATE TABLE `Addresses` (
`address_id` INTEGER PRIMARY KEY,
`line_1_number_building` VARCHAR(80),
`city` VARCHAR(50),
`zip_postcode` VARCHAR(20),
`state_province_county` VARCHAR(50),
`country` VARCHAR(50)
)
3 rows from Addresses table:
address_id line_1_number_building city zip_postcode state_province_county country
1 3904 Stroman Passage Port Melyssa 14445 Georgia USA
2 053 Quigley Island Hagenesfurt 22194 Kentucky USA
3 00704 Zoe Alley Lake Elaina 08938 Georgia USA
CREATE TABLE `Staff` (
`staff_id` INTEGER PRIMARY KEY,
`staff_address_id` INTEGER NOT NULL,
`nickname` VARCHAR(80),
`first_name` VARCHAR(80),
`middle_name` VARCHAR(80),
`last_name` VARCHAR(80),
`date_of_birth` DATETIME,
`date_joined_staff` DATETIME,
`date_left_staff` DATETIME,
FOREIGN KEY (`staff_address_id` ) REFERENCES `Addresses`(`address_id` )
)
3 rows from Staff table:
staff_id staff_address_id nickname first_name middle_name last_name date_of_birth date_joined_staff date_left_staff
1 14 thompson.constantin Janessa Amara Sawayn 2010-12-08 16:55:14 2017-04-27 03:21:26 2018-03-23 22:53:12
2 3 santos45 Camylle Icie Weissnat 2015-08-01 13:22:43 2016-06-06 08:54:28 2018-03-10 15:25:00
3 5 ynader Kaitlin Stephania Mertz 1994-05-17 05:32:11 2018-01-02 12:24:24 2018-03-24 10:11:08
CREATE TABLE `Vehicles` (
`vehicle_id` INTEGER PRIMARY KEY,
`vehicle_details` VARCHAR(255)
)
3 rows from Vehicles table:
vehicle_id vehicle_details
1 Van
2 Truck
3 Car
CREATE TABLE `Customers` (
`customer_id` INTEGER PRIMARY KEY,
`customer_address_id` INTEGER NOT NULL,
`customer_status_code` VARCHAR(15) NOT NULL,
`date_became_customer` DATETIME,
`date_of_birth` DATETIME,
`first_name` VARCHAR(80),
`last_name` VARCHAR(80),
`amount_outstanding` DOUBLE NULL,
`email_address` VARCHAR(250),
`phone_number` VARCHAR(255),
`cell_mobile_phone_number` VARCHAR(255),
FOREIGN KEY (`customer_address_id` ) REFERENCES `Addresses`(`address_id` )
)
3 rows from Customers table:
customer_id customer_address_id customer_status_code date_became_customer date_of_birth first_name last_name amount_outstanding email_address phone_number cell_mobile_phone_number
1 13 Bad Customer 2016-05-11 17:03:48 1998-12-15 13:24:40 Carole Bernhard 255.0 everette.goyette@example.org 07278206718 861-638-9797
2 10 Bad Customer 2015-11-16 22:52:14 1995-07-17 12:13:16 Genevieve Terry 7256.0 huel.jana@example.org +14(5)2351480248 578-518-4785x612
3 10 Good Customer 2016-04-08 00:28:15 1994-06-21 01:34:56 Clara Ortiz 9443.0 hilario.sporer@example.org 374-483-2758x85087 1-197-686-2849x8761
CREATE TABLE `Customer_Payments` (
`customer_id` INTEGER NOT NULL,
`datetime_payment` DATETIME NOT NULL,
`payment_method_code` VARCHAR(10) NOT NULL,
`amount_payment` DOUBLE NULL,
PRIMARY KEY (`customer_id`,`datetime_payment`),
FOREIGN KEY (`customer_id` ) REFERENCES `Customers`(`customer_id` )
)
3 rows from Customer_Payments table:
customer_id datetime_payment payment_method_code amount_payment
11 2018-02-05 18:44:46 Direct Debit 9570.93
2 2018-02-24 10:07:05 Direct Debit 8180.26
14 2018-02-27 20:08:53 Direct Debit 4610.26
CREATE TABLE `Lessons` (
`lesson_id` INTEGER PRIMARY KEY,
`customer_id` INTEGER NOT NULL,
`lesson_status_code` VARCHAR(15) NOT NULL,
`staff_id` INTEGER,
`vehicle_id` INTEGER NOT NULL,
`lesson_date` DATETIME,
`lesson_time` VARCHAR(10),
`price` DOUBLE NULL,
FOREIGN KEY (`vehicle_id` ) REFERENCES `Vehicles`(`vehicle_id` ),
FOREIGN KEY (`staff_id` ) REFERENCES `Staff`(`staff_id` ),
FOREIGN KEY (`customer_id` ) REFERENCES `Customers`(`customer_id` )
)
3 rows from Lessons table:
lesson_id customer_id lesson_status_code staff_id vehicle_id lesson_date lesson_time price
1 6 Cancelled 8 3 2018-02-28 10:55:36 5 199.0
2 8 Cancelled 14 3 2018-03-07 16:12:36 6 167.0
3 6 Cancelled 11 2 2018-03-03 15:10:16 3 352.0
|
driving_school | What is the status code, mobile phone number and email address of customer with last name as Kohler or first name as Marina? | SELECT customer_status_code , cell_mobile_phone_number , email_address FROM Customers WHERE first_name = "Marina" OR last_name = "Kohler" | CREATE TABLE `Addresses` (
`address_id` INTEGER PRIMARY KEY,
`line_1_number_building` VARCHAR(80),
`city` VARCHAR(50),
`zip_postcode` VARCHAR(20),
`state_province_county` VARCHAR(50),
`country` VARCHAR(50)
)
3 rows from Addresses table:
address_id line_1_number_building city zip_postcode state_province_county country
1 3904 Stroman Passage Port Melyssa 14445 Georgia USA
2 053 Quigley Island Hagenesfurt 22194 Kentucky USA
3 00704 Zoe Alley Lake Elaina 08938 Georgia USA
CREATE TABLE `Staff` (
`staff_id` INTEGER PRIMARY KEY,
`staff_address_id` INTEGER NOT NULL,
`nickname` VARCHAR(80),
`first_name` VARCHAR(80),
`middle_name` VARCHAR(80),
`last_name` VARCHAR(80),
`date_of_birth` DATETIME,
`date_joined_staff` DATETIME,
`date_left_staff` DATETIME,
FOREIGN KEY (`staff_address_id` ) REFERENCES `Addresses`(`address_id` )
)
3 rows from Staff table:
staff_id staff_address_id nickname first_name middle_name last_name date_of_birth date_joined_staff date_left_staff
1 14 thompson.constantin Janessa Amara Sawayn 2010-12-08 16:55:14 2017-04-27 03:21:26 2018-03-23 22:53:12
2 3 santos45 Camylle Icie Weissnat 2015-08-01 13:22:43 2016-06-06 08:54:28 2018-03-10 15:25:00
3 5 ynader Kaitlin Stephania Mertz 1994-05-17 05:32:11 2018-01-02 12:24:24 2018-03-24 10:11:08
CREATE TABLE `Vehicles` (
`vehicle_id` INTEGER PRIMARY KEY,
`vehicle_details` VARCHAR(255)
)
3 rows from Vehicles table:
vehicle_id vehicle_details
1 Van
2 Truck
3 Car
CREATE TABLE `Customers` (
`customer_id` INTEGER PRIMARY KEY,
`customer_address_id` INTEGER NOT NULL,
`customer_status_code` VARCHAR(15) NOT NULL,
`date_became_customer` DATETIME,
`date_of_birth` DATETIME,
`first_name` VARCHAR(80),
`last_name` VARCHAR(80),
`amount_outstanding` DOUBLE NULL,
`email_address` VARCHAR(250),
`phone_number` VARCHAR(255),
`cell_mobile_phone_number` VARCHAR(255),
FOREIGN KEY (`customer_address_id` ) REFERENCES `Addresses`(`address_id` )
)
3 rows from Customers table:
customer_id customer_address_id customer_status_code date_became_customer date_of_birth first_name last_name amount_outstanding email_address phone_number cell_mobile_phone_number
1 13 Bad Customer 2016-05-11 17:03:48 1998-12-15 13:24:40 Carole Bernhard 255.0 everette.goyette@example.org 07278206718 861-638-9797
2 10 Bad Customer 2015-11-16 22:52:14 1995-07-17 12:13:16 Genevieve Terry 7256.0 huel.jana@example.org +14(5)2351480248 578-518-4785x612
3 10 Good Customer 2016-04-08 00:28:15 1994-06-21 01:34:56 Clara Ortiz 9443.0 hilario.sporer@example.org 374-483-2758x85087 1-197-686-2849x8761
CREATE TABLE `Customer_Payments` (
`customer_id` INTEGER NOT NULL,
`datetime_payment` DATETIME NOT NULL,
`payment_method_code` VARCHAR(10) NOT NULL,
`amount_payment` DOUBLE NULL,
PRIMARY KEY (`customer_id`,`datetime_payment`),
FOREIGN KEY (`customer_id` ) REFERENCES `Customers`(`customer_id` )
)
3 rows from Customer_Payments table:
customer_id datetime_payment payment_method_code amount_payment
11 2018-02-05 18:44:46 Direct Debit 9570.93
2 2018-02-24 10:07:05 Direct Debit 8180.26
14 2018-02-27 20:08:53 Direct Debit 4610.26
CREATE TABLE `Lessons` (
`lesson_id` INTEGER PRIMARY KEY,
`customer_id` INTEGER NOT NULL,
`lesson_status_code` VARCHAR(15) NOT NULL,
`staff_id` INTEGER,
`vehicle_id` INTEGER NOT NULL,
`lesson_date` DATETIME,
`lesson_time` VARCHAR(10),
`price` DOUBLE NULL,
FOREIGN KEY (`vehicle_id` ) REFERENCES `Vehicles`(`vehicle_id` ),
FOREIGN KEY (`staff_id` ) REFERENCES `Staff`(`staff_id` ),
FOREIGN KEY (`customer_id` ) REFERENCES `Customers`(`customer_id` )
)
3 rows from Lessons table:
lesson_id customer_id lesson_status_code staff_id vehicle_id lesson_date lesson_time price
1 6 Cancelled 8 3 2018-02-28 10:55:36 5 199.0
2 8 Cancelled 14 3 2018-03-07 16:12:36 6 167.0
3 6 Cancelled 11 2 2018-03-03 15:10:16 3 352.0
|
driving_school | What is the status code, phone number, and email address of the customer whose last name is Kohler or whose first name is Marina? | SELECT customer_status_code , cell_mobile_phone_number , email_address FROM Customers WHERE first_name = "Marina" OR last_name = "Kohler" | CREATE TABLE `Addresses` (
`address_id` INTEGER PRIMARY KEY,
`line_1_number_building` VARCHAR(80),
`city` VARCHAR(50),
`zip_postcode` VARCHAR(20),
`state_province_county` VARCHAR(50),
`country` VARCHAR(50)
)
3 rows from Addresses table:
address_id line_1_number_building city zip_postcode state_province_county country
1 3904 Stroman Passage Port Melyssa 14445 Georgia USA
2 053 Quigley Island Hagenesfurt 22194 Kentucky USA
3 00704 Zoe Alley Lake Elaina 08938 Georgia USA
CREATE TABLE `Staff` (
`staff_id` INTEGER PRIMARY KEY,
`staff_address_id` INTEGER NOT NULL,
`nickname` VARCHAR(80),
`first_name` VARCHAR(80),
`middle_name` VARCHAR(80),
`last_name` VARCHAR(80),
`date_of_birth` DATETIME,
`date_joined_staff` DATETIME,
`date_left_staff` DATETIME,
FOREIGN KEY (`staff_address_id` ) REFERENCES `Addresses`(`address_id` )
)
3 rows from Staff table:
staff_id staff_address_id nickname first_name middle_name last_name date_of_birth date_joined_staff date_left_staff
1 14 thompson.constantin Janessa Amara Sawayn 2010-12-08 16:55:14 2017-04-27 03:21:26 2018-03-23 22:53:12
2 3 santos45 Camylle Icie Weissnat 2015-08-01 13:22:43 2016-06-06 08:54:28 2018-03-10 15:25:00
3 5 ynader Kaitlin Stephania Mertz 1994-05-17 05:32:11 2018-01-02 12:24:24 2018-03-24 10:11:08
CREATE TABLE `Vehicles` (
`vehicle_id` INTEGER PRIMARY KEY,
`vehicle_details` VARCHAR(255)
)
3 rows from Vehicles table:
vehicle_id vehicle_details
1 Van
2 Truck
3 Car
CREATE TABLE `Customers` (
`customer_id` INTEGER PRIMARY KEY,
`customer_address_id` INTEGER NOT NULL,
`customer_status_code` VARCHAR(15) NOT NULL,
`date_became_customer` DATETIME,
`date_of_birth` DATETIME,
`first_name` VARCHAR(80),
`last_name` VARCHAR(80),
`amount_outstanding` DOUBLE NULL,
`email_address` VARCHAR(250),
`phone_number` VARCHAR(255),
`cell_mobile_phone_number` VARCHAR(255),
FOREIGN KEY (`customer_address_id` ) REFERENCES `Addresses`(`address_id` )
)
3 rows from Customers table:
customer_id customer_address_id customer_status_code date_became_customer date_of_birth first_name last_name amount_outstanding email_address phone_number cell_mobile_phone_number
1 13 Bad Customer 2016-05-11 17:03:48 1998-12-15 13:24:40 Carole Bernhard 255.0 everette.goyette@example.org 07278206718 861-638-9797
2 10 Bad Customer 2015-11-16 22:52:14 1995-07-17 12:13:16 Genevieve Terry 7256.0 huel.jana@example.org +14(5)2351480248 578-518-4785x612
3 10 Good Customer 2016-04-08 00:28:15 1994-06-21 01:34:56 Clara Ortiz 9443.0 hilario.sporer@example.org 374-483-2758x85087 1-197-686-2849x8761
CREATE TABLE `Customer_Payments` (
`customer_id` INTEGER NOT NULL,
`datetime_payment` DATETIME NOT NULL,
`payment_method_code` VARCHAR(10) NOT NULL,
`amount_payment` DOUBLE NULL,
PRIMARY KEY (`customer_id`,`datetime_payment`),
FOREIGN KEY (`customer_id` ) REFERENCES `Customers`(`customer_id` )
)
3 rows from Customer_Payments table:
customer_id datetime_payment payment_method_code amount_payment
11 2018-02-05 18:44:46 Direct Debit 9570.93
2 2018-02-24 10:07:05 Direct Debit 8180.26
14 2018-02-27 20:08:53 Direct Debit 4610.26
CREATE TABLE `Lessons` (
`lesson_id` INTEGER PRIMARY KEY,
`customer_id` INTEGER NOT NULL,
`lesson_status_code` VARCHAR(15) NOT NULL,
`staff_id` INTEGER,
`vehicle_id` INTEGER NOT NULL,
`lesson_date` DATETIME,
`lesson_time` VARCHAR(10),
`price` DOUBLE NULL,
FOREIGN KEY (`vehicle_id` ) REFERENCES `Vehicles`(`vehicle_id` ),
FOREIGN KEY (`staff_id` ) REFERENCES `Staff`(`staff_id` ),
FOREIGN KEY (`customer_id` ) REFERENCES `Customers`(`customer_id` )
)
3 rows from Lessons table:
lesson_id customer_id lesson_status_code staff_id vehicle_id lesson_date lesson_time price
1 6 Cancelled 8 3 2018-02-28 10:55:36 5 199.0
2 8 Cancelled 14 3 2018-03-07 16:12:36 6 167.0
3 6 Cancelled 11 2 2018-03-03 15:10:16 3 352.0
|
driving_school | When are the birthdays of customer who are classified as 'Good Customer' status? | SELECT date_of_birth FROM Customers WHERE customer_status_code = 'Good Customer' | CREATE TABLE `Addresses` (
`address_id` INTEGER PRIMARY KEY,
`line_1_number_building` VARCHAR(80),
`city` VARCHAR(50),
`zip_postcode` VARCHAR(20),
`state_province_county` VARCHAR(50),
`country` VARCHAR(50)
)
3 rows from Addresses table:
address_id line_1_number_building city zip_postcode state_province_county country
1 3904 Stroman Passage Port Melyssa 14445 Georgia USA
2 053 Quigley Island Hagenesfurt 22194 Kentucky USA
3 00704 Zoe Alley Lake Elaina 08938 Georgia USA
CREATE TABLE `Staff` (
`staff_id` INTEGER PRIMARY KEY,
`staff_address_id` INTEGER NOT NULL,
`nickname` VARCHAR(80),
`first_name` VARCHAR(80),
`middle_name` VARCHAR(80),
`last_name` VARCHAR(80),
`date_of_birth` DATETIME,
`date_joined_staff` DATETIME,
`date_left_staff` DATETIME,
FOREIGN KEY (`staff_address_id` ) REFERENCES `Addresses`(`address_id` )
)
3 rows from Staff table:
staff_id staff_address_id nickname first_name middle_name last_name date_of_birth date_joined_staff date_left_staff
1 14 thompson.constantin Janessa Amara Sawayn 2010-12-08 16:55:14 2017-04-27 03:21:26 2018-03-23 22:53:12
2 3 santos45 Camylle Icie Weissnat 2015-08-01 13:22:43 2016-06-06 08:54:28 2018-03-10 15:25:00
3 5 ynader Kaitlin Stephania Mertz 1994-05-17 05:32:11 2018-01-02 12:24:24 2018-03-24 10:11:08
CREATE TABLE `Vehicles` (
`vehicle_id` INTEGER PRIMARY KEY,
`vehicle_details` VARCHAR(255)
)
3 rows from Vehicles table:
vehicle_id vehicle_details
1 Van
2 Truck
3 Car
CREATE TABLE `Customers` (
`customer_id` INTEGER PRIMARY KEY,
`customer_address_id` INTEGER NOT NULL,
`customer_status_code` VARCHAR(15) NOT NULL,
`date_became_customer` DATETIME,
`date_of_birth` DATETIME,
`first_name` VARCHAR(80),
`last_name` VARCHAR(80),
`amount_outstanding` DOUBLE NULL,
`email_address` VARCHAR(250),
`phone_number` VARCHAR(255),
`cell_mobile_phone_number` VARCHAR(255),
FOREIGN KEY (`customer_address_id` ) REFERENCES `Addresses`(`address_id` )
)
3 rows from Customers table:
customer_id customer_address_id customer_status_code date_became_customer date_of_birth first_name last_name amount_outstanding email_address phone_number cell_mobile_phone_number
1 13 Bad Customer 2016-05-11 17:03:48 1998-12-15 13:24:40 Carole Bernhard 255.0 everette.goyette@example.org 07278206718 861-638-9797
2 10 Bad Customer 2015-11-16 22:52:14 1995-07-17 12:13:16 Genevieve Terry 7256.0 huel.jana@example.org +14(5)2351480248 578-518-4785x612
3 10 Good Customer 2016-04-08 00:28:15 1994-06-21 01:34:56 Clara Ortiz 9443.0 hilario.sporer@example.org 374-483-2758x85087 1-197-686-2849x8761
CREATE TABLE `Customer_Payments` (
`customer_id` INTEGER NOT NULL,
`datetime_payment` DATETIME NOT NULL,
`payment_method_code` VARCHAR(10) NOT NULL,
`amount_payment` DOUBLE NULL,
PRIMARY KEY (`customer_id`,`datetime_payment`),
FOREIGN KEY (`customer_id` ) REFERENCES `Customers`(`customer_id` )
)
3 rows from Customer_Payments table:
customer_id datetime_payment payment_method_code amount_payment
11 2018-02-05 18:44:46 Direct Debit 9570.93
2 2018-02-24 10:07:05 Direct Debit 8180.26
14 2018-02-27 20:08:53 Direct Debit 4610.26
CREATE TABLE `Lessons` (
`lesson_id` INTEGER PRIMARY KEY,
`customer_id` INTEGER NOT NULL,
`lesson_status_code` VARCHAR(15) NOT NULL,
`staff_id` INTEGER,
`vehicle_id` INTEGER NOT NULL,
`lesson_date` DATETIME,
`lesson_time` VARCHAR(10),
`price` DOUBLE NULL,
FOREIGN KEY (`vehicle_id` ) REFERENCES `Vehicles`(`vehicle_id` ),
FOREIGN KEY (`staff_id` ) REFERENCES `Staff`(`staff_id` ),
FOREIGN KEY (`customer_id` ) REFERENCES `Customers`(`customer_id` )
)
3 rows from Lessons table:
lesson_id customer_id lesson_status_code staff_id vehicle_id lesson_date lesson_time price
1 6 Cancelled 8 3 2018-02-28 10:55:36 5 199.0
2 8 Cancelled 14 3 2018-03-07 16:12:36 6 167.0
3 6 Cancelled 11 2 2018-03-03 15:10:16 3 352.0
|
driving_school | What is the date of birth of every customer whose status code is 'Good Customer'? | SELECT date_of_birth FROM Customers WHERE customer_status_code = 'Good Customer' | CREATE TABLE `Addresses` (
`address_id` INTEGER PRIMARY KEY,
`line_1_number_building` VARCHAR(80),
`city` VARCHAR(50),
`zip_postcode` VARCHAR(20),
`state_province_county` VARCHAR(50),
`country` VARCHAR(50)
)
3 rows from Addresses table:
address_id line_1_number_building city zip_postcode state_province_county country
1 3904 Stroman Passage Port Melyssa 14445 Georgia USA
2 053 Quigley Island Hagenesfurt 22194 Kentucky USA
3 00704 Zoe Alley Lake Elaina 08938 Georgia USA
CREATE TABLE `Staff` (
`staff_id` INTEGER PRIMARY KEY,
`staff_address_id` INTEGER NOT NULL,
`nickname` VARCHAR(80),
`first_name` VARCHAR(80),
`middle_name` VARCHAR(80),
`last_name` VARCHAR(80),
`date_of_birth` DATETIME,
`date_joined_staff` DATETIME,
`date_left_staff` DATETIME,
FOREIGN KEY (`staff_address_id` ) REFERENCES `Addresses`(`address_id` )
)
3 rows from Staff table:
staff_id staff_address_id nickname first_name middle_name last_name date_of_birth date_joined_staff date_left_staff
1 14 thompson.constantin Janessa Amara Sawayn 2010-12-08 16:55:14 2017-04-27 03:21:26 2018-03-23 22:53:12
2 3 santos45 Camylle Icie Weissnat 2015-08-01 13:22:43 2016-06-06 08:54:28 2018-03-10 15:25:00
3 5 ynader Kaitlin Stephania Mertz 1994-05-17 05:32:11 2018-01-02 12:24:24 2018-03-24 10:11:08
CREATE TABLE `Vehicles` (
`vehicle_id` INTEGER PRIMARY KEY,
`vehicle_details` VARCHAR(255)
)
3 rows from Vehicles table:
vehicle_id vehicle_details
1 Van
2 Truck
3 Car
CREATE TABLE `Customers` (
`customer_id` INTEGER PRIMARY KEY,
`customer_address_id` INTEGER NOT NULL,
`customer_status_code` VARCHAR(15) NOT NULL,
`date_became_customer` DATETIME,
`date_of_birth` DATETIME,
`first_name` VARCHAR(80),
`last_name` VARCHAR(80),
`amount_outstanding` DOUBLE NULL,
`email_address` VARCHAR(250),
`phone_number` VARCHAR(255),
`cell_mobile_phone_number` VARCHAR(255),
FOREIGN KEY (`customer_address_id` ) REFERENCES `Addresses`(`address_id` )
)
3 rows from Customers table:
customer_id customer_address_id customer_status_code date_became_customer date_of_birth first_name last_name amount_outstanding email_address phone_number cell_mobile_phone_number
1 13 Bad Customer 2016-05-11 17:03:48 1998-12-15 13:24:40 Carole Bernhard 255.0 everette.goyette@example.org 07278206718 861-638-9797
2 10 Bad Customer 2015-11-16 22:52:14 1995-07-17 12:13:16 Genevieve Terry 7256.0 huel.jana@example.org +14(5)2351480248 578-518-4785x612
3 10 Good Customer 2016-04-08 00:28:15 1994-06-21 01:34:56 Clara Ortiz 9443.0 hilario.sporer@example.org 374-483-2758x85087 1-197-686-2849x8761
CREATE TABLE `Customer_Payments` (
`customer_id` INTEGER NOT NULL,
`datetime_payment` DATETIME NOT NULL,
`payment_method_code` VARCHAR(10) NOT NULL,
`amount_payment` DOUBLE NULL,
PRIMARY KEY (`customer_id`,`datetime_payment`),
FOREIGN KEY (`customer_id` ) REFERENCES `Customers`(`customer_id` )
)
3 rows from Customer_Payments table:
customer_id datetime_payment payment_method_code amount_payment
11 2018-02-05 18:44:46 Direct Debit 9570.93
2 2018-02-24 10:07:05 Direct Debit 8180.26
14 2018-02-27 20:08:53 Direct Debit 4610.26
CREATE TABLE `Lessons` (
`lesson_id` INTEGER PRIMARY KEY,
`customer_id` INTEGER NOT NULL,
`lesson_status_code` VARCHAR(15) NOT NULL,
`staff_id` INTEGER,
`vehicle_id` INTEGER NOT NULL,
`lesson_date` DATETIME,
`lesson_time` VARCHAR(10),
`price` DOUBLE NULL,
FOREIGN KEY (`vehicle_id` ) REFERENCES `Vehicles`(`vehicle_id` ),
FOREIGN KEY (`staff_id` ) REFERENCES `Staff`(`staff_id` ),
FOREIGN KEY (`customer_id` ) REFERENCES `Customers`(`customer_id` )
)
3 rows from Lessons table:
lesson_id customer_id lesson_status_code staff_id vehicle_id lesson_date lesson_time price
1 6 Cancelled 8 3 2018-02-28 10:55:36 5 199.0
2 8 Cancelled 14 3 2018-03-07 16:12:36 6 167.0
3 6 Cancelled 11 2 2018-03-03 15:10:16 3 352.0
|
driving_school | When did customer with first name as Carole and last name as Bernhard became a customer? | SELECT date_became_customer FROM Customers WHERE first_name = "Carole" AND last_name = "Bernhard"; | CREATE TABLE `Addresses` (
`address_id` INTEGER PRIMARY KEY,
`line_1_number_building` VARCHAR(80),
`city` VARCHAR(50),
`zip_postcode` VARCHAR(20),
`state_province_county` VARCHAR(50),
`country` VARCHAR(50)
)
3 rows from Addresses table:
address_id line_1_number_building city zip_postcode state_province_county country
1 3904 Stroman Passage Port Melyssa 14445 Georgia USA
2 053 Quigley Island Hagenesfurt 22194 Kentucky USA
3 00704 Zoe Alley Lake Elaina 08938 Georgia USA
CREATE TABLE `Staff` (
`staff_id` INTEGER PRIMARY KEY,
`staff_address_id` INTEGER NOT NULL,
`nickname` VARCHAR(80),
`first_name` VARCHAR(80),
`middle_name` VARCHAR(80),
`last_name` VARCHAR(80),
`date_of_birth` DATETIME,
`date_joined_staff` DATETIME,
`date_left_staff` DATETIME,
FOREIGN KEY (`staff_address_id` ) REFERENCES `Addresses`(`address_id` )
)
3 rows from Staff table:
staff_id staff_address_id nickname first_name middle_name last_name date_of_birth date_joined_staff date_left_staff
1 14 thompson.constantin Janessa Amara Sawayn 2010-12-08 16:55:14 2017-04-27 03:21:26 2018-03-23 22:53:12
2 3 santos45 Camylle Icie Weissnat 2015-08-01 13:22:43 2016-06-06 08:54:28 2018-03-10 15:25:00
3 5 ynader Kaitlin Stephania Mertz 1994-05-17 05:32:11 2018-01-02 12:24:24 2018-03-24 10:11:08
CREATE TABLE `Vehicles` (
`vehicle_id` INTEGER PRIMARY KEY,
`vehicle_details` VARCHAR(255)
)
3 rows from Vehicles table:
vehicle_id vehicle_details
1 Van
2 Truck
3 Car
CREATE TABLE `Customers` (
`customer_id` INTEGER PRIMARY KEY,
`customer_address_id` INTEGER NOT NULL,
`customer_status_code` VARCHAR(15) NOT NULL,
`date_became_customer` DATETIME,
`date_of_birth` DATETIME,
`first_name` VARCHAR(80),
`last_name` VARCHAR(80),
`amount_outstanding` DOUBLE NULL,
`email_address` VARCHAR(250),
`phone_number` VARCHAR(255),
`cell_mobile_phone_number` VARCHAR(255),
FOREIGN KEY (`customer_address_id` ) REFERENCES `Addresses`(`address_id` )
)
3 rows from Customers table:
customer_id customer_address_id customer_status_code date_became_customer date_of_birth first_name last_name amount_outstanding email_address phone_number cell_mobile_phone_number
1 13 Bad Customer 2016-05-11 17:03:48 1998-12-15 13:24:40 Carole Bernhard 255.0 everette.goyette@example.org 07278206718 861-638-9797
2 10 Bad Customer 2015-11-16 22:52:14 1995-07-17 12:13:16 Genevieve Terry 7256.0 huel.jana@example.org +14(5)2351480248 578-518-4785x612
3 10 Good Customer 2016-04-08 00:28:15 1994-06-21 01:34:56 Clara Ortiz 9443.0 hilario.sporer@example.org 374-483-2758x85087 1-197-686-2849x8761
CREATE TABLE `Customer_Payments` (
`customer_id` INTEGER NOT NULL,
`datetime_payment` DATETIME NOT NULL,
`payment_method_code` VARCHAR(10) NOT NULL,
`amount_payment` DOUBLE NULL,
PRIMARY KEY (`customer_id`,`datetime_payment`),
FOREIGN KEY (`customer_id` ) REFERENCES `Customers`(`customer_id` )
)
3 rows from Customer_Payments table:
customer_id datetime_payment payment_method_code amount_payment
11 2018-02-05 18:44:46 Direct Debit 9570.93
2 2018-02-24 10:07:05 Direct Debit 8180.26
14 2018-02-27 20:08:53 Direct Debit 4610.26
CREATE TABLE `Lessons` (
`lesson_id` INTEGER PRIMARY KEY,
`customer_id` INTEGER NOT NULL,
`lesson_status_code` VARCHAR(15) NOT NULL,
`staff_id` INTEGER,
`vehicle_id` INTEGER NOT NULL,
`lesson_date` DATETIME,
`lesson_time` VARCHAR(10),
`price` DOUBLE NULL,
FOREIGN KEY (`vehicle_id` ) REFERENCES `Vehicles`(`vehicle_id` ),
FOREIGN KEY (`staff_id` ) REFERENCES `Staff`(`staff_id` ),
FOREIGN KEY (`customer_id` ) REFERENCES `Customers`(`customer_id` )
)
3 rows from Lessons table:
lesson_id customer_id lesson_status_code staff_id vehicle_id lesson_date lesson_time price
1 6 Cancelled 8 3 2018-02-28 10:55:36 5 199.0
2 8 Cancelled 14 3 2018-03-07 16:12:36 6 167.0
3 6 Cancelled 11 2 2018-03-03 15:10:16 3 352.0
|
driving_school | When did Carole Bernhard first become a customer? | SELECT date_became_customer FROM Customers WHERE first_name = "Carole" AND last_name = "Bernhard"; | CREATE TABLE `Addresses` (
`address_id` INTEGER PRIMARY KEY,
`line_1_number_building` VARCHAR(80),
`city` VARCHAR(50),
`zip_postcode` VARCHAR(20),
`state_province_county` VARCHAR(50),
`country` VARCHAR(50)
)
3 rows from Addresses table:
address_id line_1_number_building city zip_postcode state_province_county country
1 3904 Stroman Passage Port Melyssa 14445 Georgia USA
2 053 Quigley Island Hagenesfurt 22194 Kentucky USA
3 00704 Zoe Alley Lake Elaina 08938 Georgia USA
CREATE TABLE `Staff` (
`staff_id` INTEGER PRIMARY KEY,
`staff_address_id` INTEGER NOT NULL,
`nickname` VARCHAR(80),
`first_name` VARCHAR(80),
`middle_name` VARCHAR(80),
`last_name` VARCHAR(80),
`date_of_birth` DATETIME,
`date_joined_staff` DATETIME,
`date_left_staff` DATETIME,
FOREIGN KEY (`staff_address_id` ) REFERENCES `Addresses`(`address_id` )
)
3 rows from Staff table:
staff_id staff_address_id nickname first_name middle_name last_name date_of_birth date_joined_staff date_left_staff
1 14 thompson.constantin Janessa Amara Sawayn 2010-12-08 16:55:14 2017-04-27 03:21:26 2018-03-23 22:53:12
2 3 santos45 Camylle Icie Weissnat 2015-08-01 13:22:43 2016-06-06 08:54:28 2018-03-10 15:25:00
3 5 ynader Kaitlin Stephania Mertz 1994-05-17 05:32:11 2018-01-02 12:24:24 2018-03-24 10:11:08
CREATE TABLE `Vehicles` (
`vehicle_id` INTEGER PRIMARY KEY,
`vehicle_details` VARCHAR(255)
)
3 rows from Vehicles table:
vehicle_id vehicle_details
1 Van
2 Truck
3 Car
CREATE TABLE `Customers` (
`customer_id` INTEGER PRIMARY KEY,
`customer_address_id` INTEGER NOT NULL,
`customer_status_code` VARCHAR(15) NOT NULL,
`date_became_customer` DATETIME,
`date_of_birth` DATETIME,
`first_name` VARCHAR(80),
`last_name` VARCHAR(80),
`amount_outstanding` DOUBLE NULL,
`email_address` VARCHAR(250),
`phone_number` VARCHAR(255),
`cell_mobile_phone_number` VARCHAR(255),
FOREIGN KEY (`customer_address_id` ) REFERENCES `Addresses`(`address_id` )
)
3 rows from Customers table:
customer_id customer_address_id customer_status_code date_became_customer date_of_birth first_name last_name amount_outstanding email_address phone_number cell_mobile_phone_number
1 13 Bad Customer 2016-05-11 17:03:48 1998-12-15 13:24:40 Carole Bernhard 255.0 everette.goyette@example.org 07278206718 861-638-9797
2 10 Bad Customer 2015-11-16 22:52:14 1995-07-17 12:13:16 Genevieve Terry 7256.0 huel.jana@example.org +14(5)2351480248 578-518-4785x612
3 10 Good Customer 2016-04-08 00:28:15 1994-06-21 01:34:56 Clara Ortiz 9443.0 hilario.sporer@example.org 374-483-2758x85087 1-197-686-2849x8761
CREATE TABLE `Customer_Payments` (
`customer_id` INTEGER NOT NULL,
`datetime_payment` DATETIME NOT NULL,
`payment_method_code` VARCHAR(10) NOT NULL,
`amount_payment` DOUBLE NULL,
PRIMARY KEY (`customer_id`,`datetime_payment`),
FOREIGN KEY (`customer_id` ) REFERENCES `Customers`(`customer_id` )
)
3 rows from Customer_Payments table:
customer_id datetime_payment payment_method_code amount_payment
11 2018-02-05 18:44:46 Direct Debit 9570.93
2 2018-02-24 10:07:05 Direct Debit 8180.26
14 2018-02-27 20:08:53 Direct Debit 4610.26
CREATE TABLE `Lessons` (
`lesson_id` INTEGER PRIMARY KEY,
`customer_id` INTEGER NOT NULL,
`lesson_status_code` VARCHAR(15) NOT NULL,
`staff_id` INTEGER,
`vehicle_id` INTEGER NOT NULL,
`lesson_date` DATETIME,
`lesson_time` VARCHAR(10),
`price` DOUBLE NULL,
FOREIGN KEY (`vehicle_id` ) REFERENCES `Vehicles`(`vehicle_id` ),
FOREIGN KEY (`staff_id` ) REFERENCES `Staff`(`staff_id` ),
FOREIGN KEY (`customer_id` ) REFERENCES `Customers`(`customer_id` )
)
3 rows from Lessons table:
lesson_id customer_id lesson_status_code staff_id vehicle_id lesson_date lesson_time price
1 6 Cancelled 8 3 2018-02-28 10:55:36 5 199.0
2 8 Cancelled 14 3 2018-03-07 16:12:36 6 167.0
3 6 Cancelled 11 2 2018-03-03 15:10:16 3 352.0
|
driving_school | How many customers in total? | SELECT count(*) FROM Customers; | CREATE TABLE `Addresses` (
`address_id` INTEGER PRIMARY KEY,
`line_1_number_building` VARCHAR(80),
`city` VARCHAR(50),
`zip_postcode` VARCHAR(20),
`state_province_county` VARCHAR(50),
`country` VARCHAR(50)
)
3 rows from Addresses table:
address_id line_1_number_building city zip_postcode state_province_county country
1 3904 Stroman Passage Port Melyssa 14445 Georgia USA
2 053 Quigley Island Hagenesfurt 22194 Kentucky USA
3 00704 Zoe Alley Lake Elaina 08938 Georgia USA
CREATE TABLE `Staff` (
`staff_id` INTEGER PRIMARY KEY,
`staff_address_id` INTEGER NOT NULL,
`nickname` VARCHAR(80),
`first_name` VARCHAR(80),
`middle_name` VARCHAR(80),
`last_name` VARCHAR(80),
`date_of_birth` DATETIME,
`date_joined_staff` DATETIME,
`date_left_staff` DATETIME,
FOREIGN KEY (`staff_address_id` ) REFERENCES `Addresses`(`address_id` )
)
3 rows from Staff table:
staff_id staff_address_id nickname first_name middle_name last_name date_of_birth date_joined_staff date_left_staff
1 14 thompson.constantin Janessa Amara Sawayn 2010-12-08 16:55:14 2017-04-27 03:21:26 2018-03-23 22:53:12
2 3 santos45 Camylle Icie Weissnat 2015-08-01 13:22:43 2016-06-06 08:54:28 2018-03-10 15:25:00
3 5 ynader Kaitlin Stephania Mertz 1994-05-17 05:32:11 2018-01-02 12:24:24 2018-03-24 10:11:08
CREATE TABLE `Vehicles` (
`vehicle_id` INTEGER PRIMARY KEY,
`vehicle_details` VARCHAR(255)
)
3 rows from Vehicles table:
vehicle_id vehicle_details
1 Van
2 Truck
3 Car
CREATE TABLE `Customers` (
`customer_id` INTEGER PRIMARY KEY,
`customer_address_id` INTEGER NOT NULL,
`customer_status_code` VARCHAR(15) NOT NULL,
`date_became_customer` DATETIME,
`date_of_birth` DATETIME,
`first_name` VARCHAR(80),
`last_name` VARCHAR(80),
`amount_outstanding` DOUBLE NULL,
`email_address` VARCHAR(250),
`phone_number` VARCHAR(255),
`cell_mobile_phone_number` VARCHAR(255),
FOREIGN KEY (`customer_address_id` ) REFERENCES `Addresses`(`address_id` )
)
3 rows from Customers table:
customer_id customer_address_id customer_status_code date_became_customer date_of_birth first_name last_name amount_outstanding email_address phone_number cell_mobile_phone_number
1 13 Bad Customer 2016-05-11 17:03:48 1998-12-15 13:24:40 Carole Bernhard 255.0 everette.goyette@example.org 07278206718 861-638-9797
2 10 Bad Customer 2015-11-16 22:52:14 1995-07-17 12:13:16 Genevieve Terry 7256.0 huel.jana@example.org +14(5)2351480248 578-518-4785x612
3 10 Good Customer 2016-04-08 00:28:15 1994-06-21 01:34:56 Clara Ortiz 9443.0 hilario.sporer@example.org 374-483-2758x85087 1-197-686-2849x8761
CREATE TABLE `Customer_Payments` (
`customer_id` INTEGER NOT NULL,
`datetime_payment` DATETIME NOT NULL,
`payment_method_code` VARCHAR(10) NOT NULL,
`amount_payment` DOUBLE NULL,
PRIMARY KEY (`customer_id`,`datetime_payment`),
FOREIGN KEY (`customer_id` ) REFERENCES `Customers`(`customer_id` )
)
3 rows from Customer_Payments table:
customer_id datetime_payment payment_method_code amount_payment
11 2018-02-05 18:44:46 Direct Debit 9570.93
2 2018-02-24 10:07:05 Direct Debit 8180.26
14 2018-02-27 20:08:53 Direct Debit 4610.26
CREATE TABLE `Lessons` (
`lesson_id` INTEGER PRIMARY KEY,
`customer_id` INTEGER NOT NULL,
`lesson_status_code` VARCHAR(15) NOT NULL,
`staff_id` INTEGER,
`vehicle_id` INTEGER NOT NULL,
`lesson_date` DATETIME,
`lesson_time` VARCHAR(10),
`price` DOUBLE NULL,
FOREIGN KEY (`vehicle_id` ) REFERENCES `Vehicles`(`vehicle_id` ),
FOREIGN KEY (`staff_id` ) REFERENCES `Staff`(`staff_id` ),
FOREIGN KEY (`customer_id` ) REFERENCES `Customers`(`customer_id` )
)
3 rows from Lessons table:
lesson_id customer_id lesson_status_code staff_id vehicle_id lesson_date lesson_time price
1 6 Cancelled 8 3 2018-02-28 10:55:36 5 199.0
2 8 Cancelled 14 3 2018-03-07 16:12:36 6 167.0
3 6 Cancelled 11 2 2018-03-03 15:10:16 3 352.0
|
driving_school | How many customers are there? | SELECT count(*) FROM Customers; | CREATE TABLE `Addresses` (
`address_id` INTEGER PRIMARY KEY,
`line_1_number_building` VARCHAR(80),
`city` VARCHAR(50),
`zip_postcode` VARCHAR(20),
`state_province_county` VARCHAR(50),
`country` VARCHAR(50)
)
3 rows from Addresses table:
address_id line_1_number_building city zip_postcode state_province_county country
1 3904 Stroman Passage Port Melyssa 14445 Georgia USA
2 053 Quigley Island Hagenesfurt 22194 Kentucky USA
3 00704 Zoe Alley Lake Elaina 08938 Georgia USA
CREATE TABLE `Staff` (
`staff_id` INTEGER PRIMARY KEY,
`staff_address_id` INTEGER NOT NULL,
`nickname` VARCHAR(80),
`first_name` VARCHAR(80),
`middle_name` VARCHAR(80),
`last_name` VARCHAR(80),
`date_of_birth` DATETIME,
`date_joined_staff` DATETIME,
`date_left_staff` DATETIME,
FOREIGN KEY (`staff_address_id` ) REFERENCES `Addresses`(`address_id` )
)
3 rows from Staff table:
staff_id staff_address_id nickname first_name middle_name last_name date_of_birth date_joined_staff date_left_staff
1 14 thompson.constantin Janessa Amara Sawayn 2010-12-08 16:55:14 2017-04-27 03:21:26 2018-03-23 22:53:12
2 3 santos45 Camylle Icie Weissnat 2015-08-01 13:22:43 2016-06-06 08:54:28 2018-03-10 15:25:00
3 5 ynader Kaitlin Stephania Mertz 1994-05-17 05:32:11 2018-01-02 12:24:24 2018-03-24 10:11:08
CREATE TABLE `Vehicles` (
`vehicle_id` INTEGER PRIMARY KEY,
`vehicle_details` VARCHAR(255)
)
3 rows from Vehicles table:
vehicle_id vehicle_details
1 Van
2 Truck
3 Car
CREATE TABLE `Customers` (
`customer_id` INTEGER PRIMARY KEY,
`customer_address_id` INTEGER NOT NULL,
`customer_status_code` VARCHAR(15) NOT NULL,
`date_became_customer` DATETIME,
`date_of_birth` DATETIME,
`first_name` VARCHAR(80),
`last_name` VARCHAR(80),
`amount_outstanding` DOUBLE NULL,
`email_address` VARCHAR(250),
`phone_number` VARCHAR(255),
`cell_mobile_phone_number` VARCHAR(255),
FOREIGN KEY (`customer_address_id` ) REFERENCES `Addresses`(`address_id` )
)
3 rows from Customers table:
customer_id customer_address_id customer_status_code date_became_customer date_of_birth first_name last_name amount_outstanding email_address phone_number cell_mobile_phone_number
1 13 Bad Customer 2016-05-11 17:03:48 1998-12-15 13:24:40 Carole Bernhard 255.0 everette.goyette@example.org 07278206718 861-638-9797
2 10 Bad Customer 2015-11-16 22:52:14 1995-07-17 12:13:16 Genevieve Terry 7256.0 huel.jana@example.org +14(5)2351480248 578-518-4785x612
3 10 Good Customer 2016-04-08 00:28:15 1994-06-21 01:34:56 Clara Ortiz 9443.0 hilario.sporer@example.org 374-483-2758x85087 1-197-686-2849x8761
CREATE TABLE `Customer_Payments` (
`customer_id` INTEGER NOT NULL,
`datetime_payment` DATETIME NOT NULL,
`payment_method_code` VARCHAR(10) NOT NULL,
`amount_payment` DOUBLE NULL,
PRIMARY KEY (`customer_id`,`datetime_payment`),
FOREIGN KEY (`customer_id` ) REFERENCES `Customers`(`customer_id` )
)
3 rows from Customer_Payments table:
customer_id datetime_payment payment_method_code amount_payment
11 2018-02-05 18:44:46 Direct Debit 9570.93
2 2018-02-24 10:07:05 Direct Debit 8180.26
14 2018-02-27 20:08:53 Direct Debit 4610.26
CREATE TABLE `Lessons` (
`lesson_id` INTEGER PRIMARY KEY,
`customer_id` INTEGER NOT NULL,
`lesson_status_code` VARCHAR(15) NOT NULL,
`staff_id` INTEGER,
`vehicle_id` INTEGER NOT NULL,
`lesson_date` DATETIME,
`lesson_time` VARCHAR(10),
`price` DOUBLE NULL,
FOREIGN KEY (`vehicle_id` ) REFERENCES `Vehicles`(`vehicle_id` ),
FOREIGN KEY (`staff_id` ) REFERENCES `Staff`(`staff_id` ),
FOREIGN KEY (`customer_id` ) REFERENCES `Customers`(`customer_id` )
)
3 rows from Lessons table:
lesson_id customer_id lesson_status_code staff_id vehicle_id lesson_date lesson_time price
1 6 Cancelled 8 3 2018-02-28 10:55:36 5 199.0
2 8 Cancelled 14 3 2018-03-07 16:12:36 6 167.0
3 6 Cancelled 11 2 2018-03-03 15:10:16 3 352.0
|
driving_school | List all customer status codes and the number of customers having each status code. | SELECT customer_status_code , count(*) FROM Customers GROUP BY customer_status_code; | CREATE TABLE `Addresses` (
`address_id` INTEGER PRIMARY KEY,
`line_1_number_building` VARCHAR(80),
`city` VARCHAR(50),
`zip_postcode` VARCHAR(20),
`state_province_county` VARCHAR(50),
`country` VARCHAR(50)
)
3 rows from Addresses table:
address_id line_1_number_building city zip_postcode state_province_county country
1 3904 Stroman Passage Port Melyssa 14445 Georgia USA
2 053 Quigley Island Hagenesfurt 22194 Kentucky USA
3 00704 Zoe Alley Lake Elaina 08938 Georgia USA
CREATE TABLE `Staff` (
`staff_id` INTEGER PRIMARY KEY,
`staff_address_id` INTEGER NOT NULL,
`nickname` VARCHAR(80),
`first_name` VARCHAR(80),
`middle_name` VARCHAR(80),
`last_name` VARCHAR(80),
`date_of_birth` DATETIME,
`date_joined_staff` DATETIME,
`date_left_staff` DATETIME,
FOREIGN KEY (`staff_address_id` ) REFERENCES `Addresses`(`address_id` )
)
3 rows from Staff table:
staff_id staff_address_id nickname first_name middle_name last_name date_of_birth date_joined_staff date_left_staff
1 14 thompson.constantin Janessa Amara Sawayn 2010-12-08 16:55:14 2017-04-27 03:21:26 2018-03-23 22:53:12
2 3 santos45 Camylle Icie Weissnat 2015-08-01 13:22:43 2016-06-06 08:54:28 2018-03-10 15:25:00
3 5 ynader Kaitlin Stephania Mertz 1994-05-17 05:32:11 2018-01-02 12:24:24 2018-03-24 10:11:08
CREATE TABLE `Vehicles` (
`vehicle_id` INTEGER PRIMARY KEY,
`vehicle_details` VARCHAR(255)
)
3 rows from Vehicles table:
vehicle_id vehicle_details
1 Van
2 Truck
3 Car
CREATE TABLE `Customers` (
`customer_id` INTEGER PRIMARY KEY,
`customer_address_id` INTEGER NOT NULL,
`customer_status_code` VARCHAR(15) NOT NULL,
`date_became_customer` DATETIME,
`date_of_birth` DATETIME,
`first_name` VARCHAR(80),
`last_name` VARCHAR(80),
`amount_outstanding` DOUBLE NULL,
`email_address` VARCHAR(250),
`phone_number` VARCHAR(255),
`cell_mobile_phone_number` VARCHAR(255),
FOREIGN KEY (`customer_address_id` ) REFERENCES `Addresses`(`address_id` )
)
3 rows from Customers table:
customer_id customer_address_id customer_status_code date_became_customer date_of_birth first_name last_name amount_outstanding email_address phone_number cell_mobile_phone_number
1 13 Bad Customer 2016-05-11 17:03:48 1998-12-15 13:24:40 Carole Bernhard 255.0 everette.goyette@example.org 07278206718 861-638-9797
2 10 Bad Customer 2015-11-16 22:52:14 1995-07-17 12:13:16 Genevieve Terry 7256.0 huel.jana@example.org +14(5)2351480248 578-518-4785x612
3 10 Good Customer 2016-04-08 00:28:15 1994-06-21 01:34:56 Clara Ortiz 9443.0 hilario.sporer@example.org 374-483-2758x85087 1-197-686-2849x8761
CREATE TABLE `Customer_Payments` (
`customer_id` INTEGER NOT NULL,
`datetime_payment` DATETIME NOT NULL,
`payment_method_code` VARCHAR(10) NOT NULL,
`amount_payment` DOUBLE NULL,
PRIMARY KEY (`customer_id`,`datetime_payment`),
FOREIGN KEY (`customer_id` ) REFERENCES `Customers`(`customer_id` )
)
3 rows from Customer_Payments table:
customer_id datetime_payment payment_method_code amount_payment
11 2018-02-05 18:44:46 Direct Debit 9570.93
2 2018-02-24 10:07:05 Direct Debit 8180.26
14 2018-02-27 20:08:53 Direct Debit 4610.26
CREATE TABLE `Lessons` (
`lesson_id` INTEGER PRIMARY KEY,
`customer_id` INTEGER NOT NULL,
`lesson_status_code` VARCHAR(15) NOT NULL,
`staff_id` INTEGER,
`vehicle_id` INTEGER NOT NULL,
`lesson_date` DATETIME,
`lesson_time` VARCHAR(10),
`price` DOUBLE NULL,
FOREIGN KEY (`vehicle_id` ) REFERENCES `Vehicles`(`vehicle_id` ),
FOREIGN KEY (`staff_id` ) REFERENCES `Staff`(`staff_id` ),
FOREIGN KEY (`customer_id` ) REFERENCES `Customers`(`customer_id` )
)
3 rows from Lessons table:
lesson_id customer_id lesson_status_code staff_id vehicle_id lesson_date lesson_time price
1 6 Cancelled 8 3 2018-02-28 10:55:36 5 199.0
2 8 Cancelled 14 3 2018-03-07 16:12:36 6 167.0
3 6 Cancelled 11 2 2018-03-03 15:10:16 3 352.0
|
driving_school | For each customer status code, how many customers are classified that way? | SELECT customer_status_code , count(*) FROM Customers GROUP BY customer_status_code; | CREATE TABLE `Addresses` (
`address_id` INTEGER PRIMARY KEY,
`line_1_number_building` VARCHAR(80),
`city` VARCHAR(50),
`zip_postcode` VARCHAR(20),
`state_province_county` VARCHAR(50),
`country` VARCHAR(50)
)
3 rows from Addresses table:
address_id line_1_number_building city zip_postcode state_province_county country
1 3904 Stroman Passage Port Melyssa 14445 Georgia USA
2 053 Quigley Island Hagenesfurt 22194 Kentucky USA
3 00704 Zoe Alley Lake Elaina 08938 Georgia USA
CREATE TABLE `Staff` (
`staff_id` INTEGER PRIMARY KEY,
`staff_address_id` INTEGER NOT NULL,
`nickname` VARCHAR(80),
`first_name` VARCHAR(80),
`middle_name` VARCHAR(80),
`last_name` VARCHAR(80),
`date_of_birth` DATETIME,
`date_joined_staff` DATETIME,
`date_left_staff` DATETIME,
FOREIGN KEY (`staff_address_id` ) REFERENCES `Addresses`(`address_id` )
)
3 rows from Staff table:
staff_id staff_address_id nickname first_name middle_name last_name date_of_birth date_joined_staff date_left_staff
1 14 thompson.constantin Janessa Amara Sawayn 2010-12-08 16:55:14 2017-04-27 03:21:26 2018-03-23 22:53:12
2 3 santos45 Camylle Icie Weissnat 2015-08-01 13:22:43 2016-06-06 08:54:28 2018-03-10 15:25:00
3 5 ynader Kaitlin Stephania Mertz 1994-05-17 05:32:11 2018-01-02 12:24:24 2018-03-24 10:11:08
CREATE TABLE `Vehicles` (
`vehicle_id` INTEGER PRIMARY KEY,
`vehicle_details` VARCHAR(255)
)
3 rows from Vehicles table:
vehicle_id vehicle_details
1 Van
2 Truck
3 Car
CREATE TABLE `Customers` (
`customer_id` INTEGER PRIMARY KEY,
`customer_address_id` INTEGER NOT NULL,
`customer_status_code` VARCHAR(15) NOT NULL,
`date_became_customer` DATETIME,
`date_of_birth` DATETIME,
`first_name` VARCHAR(80),
`last_name` VARCHAR(80),
`amount_outstanding` DOUBLE NULL,
`email_address` VARCHAR(250),
`phone_number` VARCHAR(255),
`cell_mobile_phone_number` VARCHAR(255),
FOREIGN KEY (`customer_address_id` ) REFERENCES `Addresses`(`address_id` )
)
3 rows from Customers table:
customer_id customer_address_id customer_status_code date_became_customer date_of_birth first_name last_name amount_outstanding email_address phone_number cell_mobile_phone_number
1 13 Bad Customer 2016-05-11 17:03:48 1998-12-15 13:24:40 Carole Bernhard 255.0 everette.goyette@example.org 07278206718 861-638-9797
2 10 Bad Customer 2015-11-16 22:52:14 1995-07-17 12:13:16 Genevieve Terry 7256.0 huel.jana@example.org +14(5)2351480248 578-518-4785x612
3 10 Good Customer 2016-04-08 00:28:15 1994-06-21 01:34:56 Clara Ortiz 9443.0 hilario.sporer@example.org 374-483-2758x85087 1-197-686-2849x8761
CREATE TABLE `Customer_Payments` (
`customer_id` INTEGER NOT NULL,
`datetime_payment` DATETIME NOT NULL,
`payment_method_code` VARCHAR(10) NOT NULL,
`amount_payment` DOUBLE NULL,
PRIMARY KEY (`customer_id`,`datetime_payment`),
FOREIGN KEY (`customer_id` ) REFERENCES `Customers`(`customer_id` )
)
3 rows from Customer_Payments table:
customer_id datetime_payment payment_method_code amount_payment
11 2018-02-05 18:44:46 Direct Debit 9570.93
2 2018-02-24 10:07:05 Direct Debit 8180.26
14 2018-02-27 20:08:53 Direct Debit 4610.26
CREATE TABLE `Lessons` (
`lesson_id` INTEGER PRIMARY KEY,
`customer_id` INTEGER NOT NULL,
`lesson_status_code` VARCHAR(15) NOT NULL,
`staff_id` INTEGER,
`vehicle_id` INTEGER NOT NULL,
`lesson_date` DATETIME,
`lesson_time` VARCHAR(10),
`price` DOUBLE NULL,
FOREIGN KEY (`vehicle_id` ) REFERENCES `Vehicles`(`vehicle_id` ),
FOREIGN KEY (`staff_id` ) REFERENCES `Staff`(`staff_id` ),
FOREIGN KEY (`customer_id` ) REFERENCES `Customers`(`customer_id` )
)
3 rows from Lessons table:
lesson_id customer_id lesson_status_code staff_id vehicle_id lesson_date lesson_time price
1 6 Cancelled 8 3 2018-02-28 10:55:36 5 199.0
2 8 Cancelled 14 3 2018-03-07 16:12:36 6 167.0
3 6 Cancelled 11 2 2018-03-03 15:10:16 3 352.0
|
driving_school | Which customer status code has least number of customers? | SELECT customer_status_code FROM Customers GROUP BY customer_status_code ORDER BY count(*) ASC LIMIT 1; | CREATE TABLE `Addresses` (
`address_id` INTEGER PRIMARY KEY,
`line_1_number_building` VARCHAR(80),
`city` VARCHAR(50),
`zip_postcode` VARCHAR(20),
`state_province_county` VARCHAR(50),
`country` VARCHAR(50)
)
3 rows from Addresses table:
address_id line_1_number_building city zip_postcode state_province_county country
1 3904 Stroman Passage Port Melyssa 14445 Georgia USA
2 053 Quigley Island Hagenesfurt 22194 Kentucky USA
3 00704 Zoe Alley Lake Elaina 08938 Georgia USA
CREATE TABLE `Staff` (
`staff_id` INTEGER PRIMARY KEY,
`staff_address_id` INTEGER NOT NULL,
`nickname` VARCHAR(80),
`first_name` VARCHAR(80),
`middle_name` VARCHAR(80),
`last_name` VARCHAR(80),
`date_of_birth` DATETIME,
`date_joined_staff` DATETIME,
`date_left_staff` DATETIME,
FOREIGN KEY (`staff_address_id` ) REFERENCES `Addresses`(`address_id` )
)
3 rows from Staff table:
staff_id staff_address_id nickname first_name middle_name last_name date_of_birth date_joined_staff date_left_staff
1 14 thompson.constantin Janessa Amara Sawayn 2010-12-08 16:55:14 2017-04-27 03:21:26 2018-03-23 22:53:12
2 3 santos45 Camylle Icie Weissnat 2015-08-01 13:22:43 2016-06-06 08:54:28 2018-03-10 15:25:00
3 5 ynader Kaitlin Stephania Mertz 1994-05-17 05:32:11 2018-01-02 12:24:24 2018-03-24 10:11:08
CREATE TABLE `Vehicles` (
`vehicle_id` INTEGER PRIMARY KEY,
`vehicle_details` VARCHAR(255)
)
3 rows from Vehicles table:
vehicle_id vehicle_details
1 Van
2 Truck
3 Car
CREATE TABLE `Customers` (
`customer_id` INTEGER PRIMARY KEY,
`customer_address_id` INTEGER NOT NULL,
`customer_status_code` VARCHAR(15) NOT NULL,
`date_became_customer` DATETIME,
`date_of_birth` DATETIME,
`first_name` VARCHAR(80),
`last_name` VARCHAR(80),
`amount_outstanding` DOUBLE NULL,
`email_address` VARCHAR(250),
`phone_number` VARCHAR(255),
`cell_mobile_phone_number` VARCHAR(255),
FOREIGN KEY (`customer_address_id` ) REFERENCES `Addresses`(`address_id` )
)
3 rows from Customers table:
customer_id customer_address_id customer_status_code date_became_customer date_of_birth first_name last_name amount_outstanding email_address phone_number cell_mobile_phone_number
1 13 Bad Customer 2016-05-11 17:03:48 1998-12-15 13:24:40 Carole Bernhard 255.0 everette.goyette@example.org 07278206718 861-638-9797
2 10 Bad Customer 2015-11-16 22:52:14 1995-07-17 12:13:16 Genevieve Terry 7256.0 huel.jana@example.org +14(5)2351480248 578-518-4785x612
3 10 Good Customer 2016-04-08 00:28:15 1994-06-21 01:34:56 Clara Ortiz 9443.0 hilario.sporer@example.org 374-483-2758x85087 1-197-686-2849x8761
CREATE TABLE `Customer_Payments` (
`customer_id` INTEGER NOT NULL,
`datetime_payment` DATETIME NOT NULL,
`payment_method_code` VARCHAR(10) NOT NULL,
`amount_payment` DOUBLE NULL,
PRIMARY KEY (`customer_id`,`datetime_payment`),
FOREIGN KEY (`customer_id` ) REFERENCES `Customers`(`customer_id` )
)
3 rows from Customer_Payments table:
customer_id datetime_payment payment_method_code amount_payment
11 2018-02-05 18:44:46 Direct Debit 9570.93
2 2018-02-24 10:07:05 Direct Debit 8180.26
14 2018-02-27 20:08:53 Direct Debit 4610.26
CREATE TABLE `Lessons` (
`lesson_id` INTEGER PRIMARY KEY,
`customer_id` INTEGER NOT NULL,
`lesson_status_code` VARCHAR(15) NOT NULL,
`staff_id` INTEGER,
`vehicle_id` INTEGER NOT NULL,
`lesson_date` DATETIME,
`lesson_time` VARCHAR(10),
`price` DOUBLE NULL,
FOREIGN KEY (`vehicle_id` ) REFERENCES `Vehicles`(`vehicle_id` ),
FOREIGN KEY (`staff_id` ) REFERENCES `Staff`(`staff_id` ),
FOREIGN KEY (`customer_id` ) REFERENCES `Customers`(`customer_id` )
)
3 rows from Lessons table:
lesson_id customer_id lesson_status_code staff_id vehicle_id lesson_date lesson_time price
1 6 Cancelled 8 3 2018-02-28 10:55:36 5 199.0
2 8 Cancelled 14 3 2018-03-07 16:12:36 6 167.0
3 6 Cancelled 11 2 2018-03-03 15:10:16 3 352.0
|
driving_school | What is the status code with the least number of customers? | SELECT customer_status_code FROM Customers GROUP BY customer_status_code ORDER BY count(*) ASC LIMIT 1; | CREATE TABLE `Addresses` (
`address_id` INTEGER PRIMARY KEY,
`line_1_number_building` VARCHAR(80),
`city` VARCHAR(50),
`zip_postcode` VARCHAR(20),
`state_province_county` VARCHAR(50),
`country` VARCHAR(50)
)
3 rows from Addresses table:
address_id line_1_number_building city zip_postcode state_province_county country
1 3904 Stroman Passage Port Melyssa 14445 Georgia USA
2 053 Quigley Island Hagenesfurt 22194 Kentucky USA
3 00704 Zoe Alley Lake Elaina 08938 Georgia USA
CREATE TABLE `Staff` (
`staff_id` INTEGER PRIMARY KEY,
`staff_address_id` INTEGER NOT NULL,
`nickname` VARCHAR(80),
`first_name` VARCHAR(80),
`middle_name` VARCHAR(80),
`last_name` VARCHAR(80),
`date_of_birth` DATETIME,
`date_joined_staff` DATETIME,
`date_left_staff` DATETIME,
FOREIGN KEY (`staff_address_id` ) REFERENCES `Addresses`(`address_id` )
)
3 rows from Staff table:
staff_id staff_address_id nickname first_name middle_name last_name date_of_birth date_joined_staff date_left_staff
1 14 thompson.constantin Janessa Amara Sawayn 2010-12-08 16:55:14 2017-04-27 03:21:26 2018-03-23 22:53:12
2 3 santos45 Camylle Icie Weissnat 2015-08-01 13:22:43 2016-06-06 08:54:28 2018-03-10 15:25:00
3 5 ynader Kaitlin Stephania Mertz 1994-05-17 05:32:11 2018-01-02 12:24:24 2018-03-24 10:11:08
CREATE TABLE `Vehicles` (
`vehicle_id` INTEGER PRIMARY KEY,
`vehicle_details` VARCHAR(255)
)
3 rows from Vehicles table:
vehicle_id vehicle_details
1 Van
2 Truck
3 Car
CREATE TABLE `Customers` (
`customer_id` INTEGER PRIMARY KEY,
`customer_address_id` INTEGER NOT NULL,
`customer_status_code` VARCHAR(15) NOT NULL,
`date_became_customer` DATETIME,
`date_of_birth` DATETIME,
`first_name` VARCHAR(80),
`last_name` VARCHAR(80),
`amount_outstanding` DOUBLE NULL,
`email_address` VARCHAR(250),
`phone_number` VARCHAR(255),
`cell_mobile_phone_number` VARCHAR(255),
FOREIGN KEY (`customer_address_id` ) REFERENCES `Addresses`(`address_id` )
)
3 rows from Customers table:
customer_id customer_address_id customer_status_code date_became_customer date_of_birth first_name last_name amount_outstanding email_address phone_number cell_mobile_phone_number
1 13 Bad Customer 2016-05-11 17:03:48 1998-12-15 13:24:40 Carole Bernhard 255.0 everette.goyette@example.org 07278206718 861-638-9797
2 10 Bad Customer 2015-11-16 22:52:14 1995-07-17 12:13:16 Genevieve Terry 7256.0 huel.jana@example.org +14(5)2351480248 578-518-4785x612
3 10 Good Customer 2016-04-08 00:28:15 1994-06-21 01:34:56 Clara Ortiz 9443.0 hilario.sporer@example.org 374-483-2758x85087 1-197-686-2849x8761
CREATE TABLE `Customer_Payments` (
`customer_id` INTEGER NOT NULL,
`datetime_payment` DATETIME NOT NULL,
`payment_method_code` VARCHAR(10) NOT NULL,
`amount_payment` DOUBLE NULL,
PRIMARY KEY (`customer_id`,`datetime_payment`),
FOREIGN KEY (`customer_id` ) REFERENCES `Customers`(`customer_id` )
)
3 rows from Customer_Payments table:
customer_id datetime_payment payment_method_code amount_payment
11 2018-02-05 18:44:46 Direct Debit 9570.93
2 2018-02-24 10:07:05 Direct Debit 8180.26
14 2018-02-27 20:08:53 Direct Debit 4610.26
CREATE TABLE `Lessons` (
`lesson_id` INTEGER PRIMARY KEY,
`customer_id` INTEGER NOT NULL,
`lesson_status_code` VARCHAR(15) NOT NULL,
`staff_id` INTEGER,
`vehicle_id` INTEGER NOT NULL,
`lesson_date` DATETIME,
`lesson_time` VARCHAR(10),
`price` DOUBLE NULL,
FOREIGN KEY (`vehicle_id` ) REFERENCES `Vehicles`(`vehicle_id` ),
FOREIGN KEY (`staff_id` ) REFERENCES `Staff`(`staff_id` ),
FOREIGN KEY (`customer_id` ) REFERENCES `Customers`(`customer_id` )
)
3 rows from Lessons table:
lesson_id customer_id lesson_status_code staff_id vehicle_id lesson_date lesson_time price
1 6 Cancelled 8 3 2018-02-28 10:55:36 5 199.0
2 8 Cancelled 14 3 2018-03-07 16:12:36 6 167.0
3 6 Cancelled 11 2 2018-03-03 15:10:16 3 352.0
|
driving_school | How many lessons taken by customer with first name as Rylan and last name as Goodwin were completed? | SELECT count(*) FROM Lessons AS T1 JOIN Customers AS T2 ON T1.customer_id = T2.customer_id WHERE T2.first_name = "Rylan" AND T2.last_name = "Goodwin" AND T1.lesson_status_code = "Completed"; | CREATE TABLE `Addresses` (
`address_id` INTEGER PRIMARY KEY,
`line_1_number_building` VARCHAR(80),
`city` VARCHAR(50),
`zip_postcode` VARCHAR(20),
`state_province_county` VARCHAR(50),
`country` VARCHAR(50)
)
3 rows from Addresses table:
address_id line_1_number_building city zip_postcode state_province_county country
1 3904 Stroman Passage Port Melyssa 14445 Georgia USA
2 053 Quigley Island Hagenesfurt 22194 Kentucky USA
3 00704 Zoe Alley Lake Elaina 08938 Georgia USA
CREATE TABLE `Staff` (
`staff_id` INTEGER PRIMARY KEY,
`staff_address_id` INTEGER NOT NULL,
`nickname` VARCHAR(80),
`first_name` VARCHAR(80),
`middle_name` VARCHAR(80),
`last_name` VARCHAR(80),
`date_of_birth` DATETIME,
`date_joined_staff` DATETIME,
`date_left_staff` DATETIME,
FOREIGN KEY (`staff_address_id` ) REFERENCES `Addresses`(`address_id` )
)
3 rows from Staff table:
staff_id staff_address_id nickname first_name middle_name last_name date_of_birth date_joined_staff date_left_staff
1 14 thompson.constantin Janessa Amara Sawayn 2010-12-08 16:55:14 2017-04-27 03:21:26 2018-03-23 22:53:12
2 3 santos45 Camylle Icie Weissnat 2015-08-01 13:22:43 2016-06-06 08:54:28 2018-03-10 15:25:00
3 5 ynader Kaitlin Stephania Mertz 1994-05-17 05:32:11 2018-01-02 12:24:24 2018-03-24 10:11:08
CREATE TABLE `Vehicles` (
`vehicle_id` INTEGER PRIMARY KEY,
`vehicle_details` VARCHAR(255)
)
3 rows from Vehicles table:
vehicle_id vehicle_details
1 Van
2 Truck
3 Car
CREATE TABLE `Customers` (
`customer_id` INTEGER PRIMARY KEY,
`customer_address_id` INTEGER NOT NULL,
`customer_status_code` VARCHAR(15) NOT NULL,
`date_became_customer` DATETIME,
`date_of_birth` DATETIME,
`first_name` VARCHAR(80),
`last_name` VARCHAR(80),
`amount_outstanding` DOUBLE NULL,
`email_address` VARCHAR(250),
`phone_number` VARCHAR(255),
`cell_mobile_phone_number` VARCHAR(255),
FOREIGN KEY (`customer_address_id` ) REFERENCES `Addresses`(`address_id` )
)
3 rows from Customers table:
customer_id customer_address_id customer_status_code date_became_customer date_of_birth first_name last_name amount_outstanding email_address phone_number cell_mobile_phone_number
1 13 Bad Customer 2016-05-11 17:03:48 1998-12-15 13:24:40 Carole Bernhard 255.0 everette.goyette@example.org 07278206718 861-638-9797
2 10 Bad Customer 2015-11-16 22:52:14 1995-07-17 12:13:16 Genevieve Terry 7256.0 huel.jana@example.org +14(5)2351480248 578-518-4785x612
3 10 Good Customer 2016-04-08 00:28:15 1994-06-21 01:34:56 Clara Ortiz 9443.0 hilario.sporer@example.org 374-483-2758x85087 1-197-686-2849x8761
CREATE TABLE `Customer_Payments` (
`customer_id` INTEGER NOT NULL,
`datetime_payment` DATETIME NOT NULL,
`payment_method_code` VARCHAR(10) NOT NULL,
`amount_payment` DOUBLE NULL,
PRIMARY KEY (`customer_id`,`datetime_payment`),
FOREIGN KEY (`customer_id` ) REFERENCES `Customers`(`customer_id` )
)
3 rows from Customer_Payments table:
customer_id datetime_payment payment_method_code amount_payment
11 2018-02-05 18:44:46 Direct Debit 9570.93
2 2018-02-24 10:07:05 Direct Debit 8180.26
14 2018-02-27 20:08:53 Direct Debit 4610.26
CREATE TABLE `Lessons` (
`lesson_id` INTEGER PRIMARY KEY,
`customer_id` INTEGER NOT NULL,
`lesson_status_code` VARCHAR(15) NOT NULL,
`staff_id` INTEGER,
`vehicle_id` INTEGER NOT NULL,
`lesson_date` DATETIME,
`lesson_time` VARCHAR(10),
`price` DOUBLE NULL,
FOREIGN KEY (`vehicle_id` ) REFERENCES `Vehicles`(`vehicle_id` ),
FOREIGN KEY (`staff_id` ) REFERENCES `Staff`(`staff_id` ),
FOREIGN KEY (`customer_id` ) REFERENCES `Customers`(`customer_id` )
)
3 rows from Lessons table:
lesson_id customer_id lesson_status_code staff_id vehicle_id lesson_date lesson_time price
1 6 Cancelled 8 3 2018-02-28 10:55:36 5 199.0
2 8 Cancelled 14 3 2018-03-07 16:12:36 6 167.0
3 6 Cancelled 11 2 2018-03-03 15:10:16 3 352.0
|
driving_school | How many lessons did the customer Ryan Goodwin complete? | SELECT count(*) FROM Lessons AS T1 JOIN Customers AS T2 ON T1.customer_id = T2.customer_id WHERE T2.first_name = "Rylan" AND T2.last_name = "Goodwin" AND T1.lesson_status_code = "Completed"; | CREATE TABLE `Addresses` (
`address_id` INTEGER PRIMARY KEY,
`line_1_number_building` VARCHAR(80),
`city` VARCHAR(50),
`zip_postcode` VARCHAR(20),
`state_province_county` VARCHAR(50),
`country` VARCHAR(50)
)
3 rows from Addresses table:
address_id line_1_number_building city zip_postcode state_province_county country
1 3904 Stroman Passage Port Melyssa 14445 Georgia USA
2 053 Quigley Island Hagenesfurt 22194 Kentucky USA
3 00704 Zoe Alley Lake Elaina 08938 Georgia USA
CREATE TABLE `Staff` (
`staff_id` INTEGER PRIMARY KEY,
`staff_address_id` INTEGER NOT NULL,
`nickname` VARCHAR(80),
`first_name` VARCHAR(80),
`middle_name` VARCHAR(80),
`last_name` VARCHAR(80),
`date_of_birth` DATETIME,
`date_joined_staff` DATETIME,
`date_left_staff` DATETIME,
FOREIGN KEY (`staff_address_id` ) REFERENCES `Addresses`(`address_id` )
)
3 rows from Staff table:
staff_id staff_address_id nickname first_name middle_name last_name date_of_birth date_joined_staff date_left_staff
1 14 thompson.constantin Janessa Amara Sawayn 2010-12-08 16:55:14 2017-04-27 03:21:26 2018-03-23 22:53:12
2 3 santos45 Camylle Icie Weissnat 2015-08-01 13:22:43 2016-06-06 08:54:28 2018-03-10 15:25:00
3 5 ynader Kaitlin Stephania Mertz 1994-05-17 05:32:11 2018-01-02 12:24:24 2018-03-24 10:11:08
CREATE TABLE `Vehicles` (
`vehicle_id` INTEGER PRIMARY KEY,
`vehicle_details` VARCHAR(255)
)
3 rows from Vehicles table:
vehicle_id vehicle_details
1 Van
2 Truck
3 Car
CREATE TABLE `Customers` (
`customer_id` INTEGER PRIMARY KEY,
`customer_address_id` INTEGER NOT NULL,
`customer_status_code` VARCHAR(15) NOT NULL,
`date_became_customer` DATETIME,
`date_of_birth` DATETIME,
`first_name` VARCHAR(80),
`last_name` VARCHAR(80),
`amount_outstanding` DOUBLE NULL,
`email_address` VARCHAR(250),
`phone_number` VARCHAR(255),
`cell_mobile_phone_number` VARCHAR(255),
FOREIGN KEY (`customer_address_id` ) REFERENCES `Addresses`(`address_id` )
)
3 rows from Customers table:
customer_id customer_address_id customer_status_code date_became_customer date_of_birth first_name last_name amount_outstanding email_address phone_number cell_mobile_phone_number
1 13 Bad Customer 2016-05-11 17:03:48 1998-12-15 13:24:40 Carole Bernhard 255.0 everette.goyette@example.org 07278206718 861-638-9797
2 10 Bad Customer 2015-11-16 22:52:14 1995-07-17 12:13:16 Genevieve Terry 7256.0 huel.jana@example.org +14(5)2351480248 578-518-4785x612
3 10 Good Customer 2016-04-08 00:28:15 1994-06-21 01:34:56 Clara Ortiz 9443.0 hilario.sporer@example.org 374-483-2758x85087 1-197-686-2849x8761
CREATE TABLE `Customer_Payments` (
`customer_id` INTEGER NOT NULL,
`datetime_payment` DATETIME NOT NULL,
`payment_method_code` VARCHAR(10) NOT NULL,
`amount_payment` DOUBLE NULL,
PRIMARY KEY (`customer_id`,`datetime_payment`),
FOREIGN KEY (`customer_id` ) REFERENCES `Customers`(`customer_id` )
)
3 rows from Customer_Payments table:
customer_id datetime_payment payment_method_code amount_payment
11 2018-02-05 18:44:46 Direct Debit 9570.93
2 2018-02-24 10:07:05 Direct Debit 8180.26
14 2018-02-27 20:08:53 Direct Debit 4610.26
CREATE TABLE `Lessons` (
`lesson_id` INTEGER PRIMARY KEY,
`customer_id` INTEGER NOT NULL,
`lesson_status_code` VARCHAR(15) NOT NULL,
`staff_id` INTEGER,
`vehicle_id` INTEGER NOT NULL,
`lesson_date` DATETIME,
`lesson_time` VARCHAR(10),
`price` DOUBLE NULL,
FOREIGN KEY (`vehicle_id` ) REFERENCES `Vehicles`(`vehicle_id` ),
FOREIGN KEY (`staff_id` ) REFERENCES `Staff`(`staff_id` ),
FOREIGN KEY (`customer_id` ) REFERENCES `Customers`(`customer_id` )
)
3 rows from Lessons table:
lesson_id customer_id lesson_status_code staff_id vehicle_id lesson_date lesson_time price
1 6 Cancelled 8 3 2018-02-28 10:55:36 5 199.0
2 8 Cancelled 14 3 2018-03-07 16:12:36 6 167.0
3 6 Cancelled 11 2 2018-03-03 15:10:16 3 352.0
|
driving_school | What is maximum, minimum and average amount of outstanding of customer? | SELECT max(amount_outstanding) , min(amount_outstanding) , avg(amount_outstanding) FROM Customers; | CREATE TABLE `Addresses` (
`address_id` INTEGER PRIMARY KEY,
`line_1_number_building` VARCHAR(80),
`city` VARCHAR(50),
`zip_postcode` VARCHAR(20),
`state_province_county` VARCHAR(50),
`country` VARCHAR(50)
)
3 rows from Addresses table:
address_id line_1_number_building city zip_postcode state_province_county country
1 3904 Stroman Passage Port Melyssa 14445 Georgia USA
2 053 Quigley Island Hagenesfurt 22194 Kentucky USA
3 00704 Zoe Alley Lake Elaina 08938 Georgia USA
CREATE TABLE `Staff` (
`staff_id` INTEGER PRIMARY KEY,
`staff_address_id` INTEGER NOT NULL,
`nickname` VARCHAR(80),
`first_name` VARCHAR(80),
`middle_name` VARCHAR(80),
`last_name` VARCHAR(80),
`date_of_birth` DATETIME,
`date_joined_staff` DATETIME,
`date_left_staff` DATETIME,
FOREIGN KEY (`staff_address_id` ) REFERENCES `Addresses`(`address_id` )
)
3 rows from Staff table:
staff_id staff_address_id nickname first_name middle_name last_name date_of_birth date_joined_staff date_left_staff
1 14 thompson.constantin Janessa Amara Sawayn 2010-12-08 16:55:14 2017-04-27 03:21:26 2018-03-23 22:53:12
2 3 santos45 Camylle Icie Weissnat 2015-08-01 13:22:43 2016-06-06 08:54:28 2018-03-10 15:25:00
3 5 ynader Kaitlin Stephania Mertz 1994-05-17 05:32:11 2018-01-02 12:24:24 2018-03-24 10:11:08
CREATE TABLE `Vehicles` (
`vehicle_id` INTEGER PRIMARY KEY,
`vehicle_details` VARCHAR(255)
)
3 rows from Vehicles table:
vehicle_id vehicle_details
1 Van
2 Truck
3 Car
CREATE TABLE `Customers` (
`customer_id` INTEGER PRIMARY KEY,
`customer_address_id` INTEGER NOT NULL,
`customer_status_code` VARCHAR(15) NOT NULL,
`date_became_customer` DATETIME,
`date_of_birth` DATETIME,
`first_name` VARCHAR(80),
`last_name` VARCHAR(80),
`amount_outstanding` DOUBLE NULL,
`email_address` VARCHAR(250),
`phone_number` VARCHAR(255),
`cell_mobile_phone_number` VARCHAR(255),
FOREIGN KEY (`customer_address_id` ) REFERENCES `Addresses`(`address_id` )
)
3 rows from Customers table:
customer_id customer_address_id customer_status_code date_became_customer date_of_birth first_name last_name amount_outstanding email_address phone_number cell_mobile_phone_number
1 13 Bad Customer 2016-05-11 17:03:48 1998-12-15 13:24:40 Carole Bernhard 255.0 everette.goyette@example.org 07278206718 861-638-9797
2 10 Bad Customer 2015-11-16 22:52:14 1995-07-17 12:13:16 Genevieve Terry 7256.0 huel.jana@example.org +14(5)2351480248 578-518-4785x612
3 10 Good Customer 2016-04-08 00:28:15 1994-06-21 01:34:56 Clara Ortiz 9443.0 hilario.sporer@example.org 374-483-2758x85087 1-197-686-2849x8761
CREATE TABLE `Customer_Payments` (
`customer_id` INTEGER NOT NULL,
`datetime_payment` DATETIME NOT NULL,
`payment_method_code` VARCHAR(10) NOT NULL,
`amount_payment` DOUBLE NULL,
PRIMARY KEY (`customer_id`,`datetime_payment`),
FOREIGN KEY (`customer_id` ) REFERENCES `Customers`(`customer_id` )
)
3 rows from Customer_Payments table:
customer_id datetime_payment payment_method_code amount_payment
11 2018-02-05 18:44:46 Direct Debit 9570.93
2 2018-02-24 10:07:05 Direct Debit 8180.26
14 2018-02-27 20:08:53 Direct Debit 4610.26
CREATE TABLE `Lessons` (
`lesson_id` INTEGER PRIMARY KEY,
`customer_id` INTEGER NOT NULL,
`lesson_status_code` VARCHAR(15) NOT NULL,
`staff_id` INTEGER,
`vehicle_id` INTEGER NOT NULL,
`lesson_date` DATETIME,
`lesson_time` VARCHAR(10),
`price` DOUBLE NULL,
FOREIGN KEY (`vehicle_id` ) REFERENCES `Vehicles`(`vehicle_id` ),
FOREIGN KEY (`staff_id` ) REFERENCES `Staff`(`staff_id` ),
FOREIGN KEY (`customer_id` ) REFERENCES `Customers`(`customer_id` )
)
3 rows from Lessons table:
lesson_id customer_id lesson_status_code staff_id vehicle_id lesson_date lesson_time price
1 6 Cancelled 8 3 2018-02-28 10:55:36 5 199.0
2 8 Cancelled 14 3 2018-03-07 16:12:36 6 167.0
3 6 Cancelled 11 2 2018-03-03 15:10:16 3 352.0
|
driving_school | What is the maximum, minimum, and average amount of money outsanding for all customers? | SELECT max(amount_outstanding) , min(amount_outstanding) , avg(amount_outstanding) FROM Customers; | CREATE TABLE `Addresses` (
`address_id` INTEGER PRIMARY KEY,
`line_1_number_building` VARCHAR(80),
`city` VARCHAR(50),
`zip_postcode` VARCHAR(20),
`state_province_county` VARCHAR(50),
`country` VARCHAR(50)
)
3 rows from Addresses table:
address_id line_1_number_building city zip_postcode state_province_county country
1 3904 Stroman Passage Port Melyssa 14445 Georgia USA
2 053 Quigley Island Hagenesfurt 22194 Kentucky USA
3 00704 Zoe Alley Lake Elaina 08938 Georgia USA
CREATE TABLE `Staff` (
`staff_id` INTEGER PRIMARY KEY,
`staff_address_id` INTEGER NOT NULL,
`nickname` VARCHAR(80),
`first_name` VARCHAR(80),
`middle_name` VARCHAR(80),
`last_name` VARCHAR(80),
`date_of_birth` DATETIME,
`date_joined_staff` DATETIME,
`date_left_staff` DATETIME,
FOREIGN KEY (`staff_address_id` ) REFERENCES `Addresses`(`address_id` )
)
3 rows from Staff table:
staff_id staff_address_id nickname first_name middle_name last_name date_of_birth date_joined_staff date_left_staff
1 14 thompson.constantin Janessa Amara Sawayn 2010-12-08 16:55:14 2017-04-27 03:21:26 2018-03-23 22:53:12
2 3 santos45 Camylle Icie Weissnat 2015-08-01 13:22:43 2016-06-06 08:54:28 2018-03-10 15:25:00
3 5 ynader Kaitlin Stephania Mertz 1994-05-17 05:32:11 2018-01-02 12:24:24 2018-03-24 10:11:08
CREATE TABLE `Vehicles` (
`vehicle_id` INTEGER PRIMARY KEY,
`vehicle_details` VARCHAR(255)
)
3 rows from Vehicles table:
vehicle_id vehicle_details
1 Van
2 Truck
3 Car
CREATE TABLE `Customers` (
`customer_id` INTEGER PRIMARY KEY,
`customer_address_id` INTEGER NOT NULL,
`customer_status_code` VARCHAR(15) NOT NULL,
`date_became_customer` DATETIME,
`date_of_birth` DATETIME,
`first_name` VARCHAR(80),
`last_name` VARCHAR(80),
`amount_outstanding` DOUBLE NULL,
`email_address` VARCHAR(250),
`phone_number` VARCHAR(255),
`cell_mobile_phone_number` VARCHAR(255),
FOREIGN KEY (`customer_address_id` ) REFERENCES `Addresses`(`address_id` )
)
3 rows from Customers table:
customer_id customer_address_id customer_status_code date_became_customer date_of_birth first_name last_name amount_outstanding email_address phone_number cell_mobile_phone_number
1 13 Bad Customer 2016-05-11 17:03:48 1998-12-15 13:24:40 Carole Bernhard 255.0 everette.goyette@example.org 07278206718 861-638-9797
2 10 Bad Customer 2015-11-16 22:52:14 1995-07-17 12:13:16 Genevieve Terry 7256.0 huel.jana@example.org +14(5)2351480248 578-518-4785x612
3 10 Good Customer 2016-04-08 00:28:15 1994-06-21 01:34:56 Clara Ortiz 9443.0 hilario.sporer@example.org 374-483-2758x85087 1-197-686-2849x8761
CREATE TABLE `Customer_Payments` (
`customer_id` INTEGER NOT NULL,
`datetime_payment` DATETIME NOT NULL,
`payment_method_code` VARCHAR(10) NOT NULL,
`amount_payment` DOUBLE NULL,
PRIMARY KEY (`customer_id`,`datetime_payment`),
FOREIGN KEY (`customer_id` ) REFERENCES `Customers`(`customer_id` )
)
3 rows from Customer_Payments table:
customer_id datetime_payment payment_method_code amount_payment
11 2018-02-05 18:44:46 Direct Debit 9570.93
2 2018-02-24 10:07:05 Direct Debit 8180.26
14 2018-02-27 20:08:53 Direct Debit 4610.26
CREATE TABLE `Lessons` (
`lesson_id` INTEGER PRIMARY KEY,
`customer_id` INTEGER NOT NULL,
`lesson_status_code` VARCHAR(15) NOT NULL,
`staff_id` INTEGER,
`vehicle_id` INTEGER NOT NULL,
`lesson_date` DATETIME,
`lesson_time` VARCHAR(10),
`price` DOUBLE NULL,
FOREIGN KEY (`vehicle_id` ) REFERENCES `Vehicles`(`vehicle_id` ),
FOREIGN KEY (`staff_id` ) REFERENCES `Staff`(`staff_id` ),
FOREIGN KEY (`customer_id` ) REFERENCES `Customers`(`customer_id` )
)
3 rows from Lessons table:
lesson_id customer_id lesson_status_code staff_id vehicle_id lesson_date lesson_time price
1 6 Cancelled 8 3 2018-02-28 10:55:36 5 199.0
2 8 Cancelled 14 3 2018-03-07 16:12:36 6 167.0
3 6 Cancelled 11 2 2018-03-03 15:10:16 3 352.0
|
driving_school | List the first name and last name of customers have the amount of outstanding between 1000 and 3000. | SELECT first_name , last_name FROM Customers WHERE amount_outstanding BETWEEN 1000 AND 3000; | CREATE TABLE `Addresses` (
`address_id` INTEGER PRIMARY KEY,
`line_1_number_building` VARCHAR(80),
`city` VARCHAR(50),
`zip_postcode` VARCHAR(20),
`state_province_county` VARCHAR(50),
`country` VARCHAR(50)
)
3 rows from Addresses table:
address_id line_1_number_building city zip_postcode state_province_county country
1 3904 Stroman Passage Port Melyssa 14445 Georgia USA
2 053 Quigley Island Hagenesfurt 22194 Kentucky USA
3 00704 Zoe Alley Lake Elaina 08938 Georgia USA
CREATE TABLE `Staff` (
`staff_id` INTEGER PRIMARY KEY,
`staff_address_id` INTEGER NOT NULL,
`nickname` VARCHAR(80),
`first_name` VARCHAR(80),
`middle_name` VARCHAR(80),
`last_name` VARCHAR(80),
`date_of_birth` DATETIME,
`date_joined_staff` DATETIME,
`date_left_staff` DATETIME,
FOREIGN KEY (`staff_address_id` ) REFERENCES `Addresses`(`address_id` )
)
3 rows from Staff table:
staff_id staff_address_id nickname first_name middle_name last_name date_of_birth date_joined_staff date_left_staff
1 14 thompson.constantin Janessa Amara Sawayn 2010-12-08 16:55:14 2017-04-27 03:21:26 2018-03-23 22:53:12
2 3 santos45 Camylle Icie Weissnat 2015-08-01 13:22:43 2016-06-06 08:54:28 2018-03-10 15:25:00
3 5 ynader Kaitlin Stephania Mertz 1994-05-17 05:32:11 2018-01-02 12:24:24 2018-03-24 10:11:08
CREATE TABLE `Vehicles` (
`vehicle_id` INTEGER PRIMARY KEY,
`vehicle_details` VARCHAR(255)
)
3 rows from Vehicles table:
vehicle_id vehicle_details
1 Van
2 Truck
3 Car
CREATE TABLE `Customers` (
`customer_id` INTEGER PRIMARY KEY,
`customer_address_id` INTEGER NOT NULL,
`customer_status_code` VARCHAR(15) NOT NULL,
`date_became_customer` DATETIME,
`date_of_birth` DATETIME,
`first_name` VARCHAR(80),
`last_name` VARCHAR(80),
`amount_outstanding` DOUBLE NULL,
`email_address` VARCHAR(250),
`phone_number` VARCHAR(255),
`cell_mobile_phone_number` VARCHAR(255),
FOREIGN KEY (`customer_address_id` ) REFERENCES `Addresses`(`address_id` )
)
3 rows from Customers table:
customer_id customer_address_id customer_status_code date_became_customer date_of_birth first_name last_name amount_outstanding email_address phone_number cell_mobile_phone_number
1 13 Bad Customer 2016-05-11 17:03:48 1998-12-15 13:24:40 Carole Bernhard 255.0 everette.goyette@example.org 07278206718 861-638-9797
2 10 Bad Customer 2015-11-16 22:52:14 1995-07-17 12:13:16 Genevieve Terry 7256.0 huel.jana@example.org +14(5)2351480248 578-518-4785x612
3 10 Good Customer 2016-04-08 00:28:15 1994-06-21 01:34:56 Clara Ortiz 9443.0 hilario.sporer@example.org 374-483-2758x85087 1-197-686-2849x8761
CREATE TABLE `Customer_Payments` (
`customer_id` INTEGER NOT NULL,
`datetime_payment` DATETIME NOT NULL,
`payment_method_code` VARCHAR(10) NOT NULL,
`amount_payment` DOUBLE NULL,
PRIMARY KEY (`customer_id`,`datetime_payment`),
FOREIGN KEY (`customer_id` ) REFERENCES `Customers`(`customer_id` )
)
3 rows from Customer_Payments table:
customer_id datetime_payment payment_method_code amount_payment
11 2018-02-05 18:44:46 Direct Debit 9570.93
2 2018-02-24 10:07:05 Direct Debit 8180.26
14 2018-02-27 20:08:53 Direct Debit 4610.26
CREATE TABLE `Lessons` (
`lesson_id` INTEGER PRIMARY KEY,
`customer_id` INTEGER NOT NULL,
`lesson_status_code` VARCHAR(15) NOT NULL,
`staff_id` INTEGER,
`vehicle_id` INTEGER NOT NULL,
`lesson_date` DATETIME,
`lesson_time` VARCHAR(10),
`price` DOUBLE NULL,
FOREIGN KEY (`vehicle_id` ) REFERENCES `Vehicles`(`vehicle_id` ),
FOREIGN KEY (`staff_id` ) REFERENCES `Staff`(`staff_id` ),
FOREIGN KEY (`customer_id` ) REFERENCES `Customers`(`customer_id` )
)
3 rows from Lessons table:
lesson_id customer_id lesson_status_code staff_id vehicle_id lesson_date lesson_time price
1 6 Cancelled 8 3 2018-02-28 10:55:36 5 199.0
2 8 Cancelled 14 3 2018-03-07 16:12:36 6 167.0
3 6 Cancelled 11 2 2018-03-03 15:10:16 3 352.0
|
driving_school | What are the first and last names of all customers with between 1000 and 3000 dollars outstanding? | SELECT first_name , last_name FROM Customers WHERE amount_outstanding BETWEEN 1000 AND 3000; | CREATE TABLE `Addresses` (
`address_id` INTEGER PRIMARY KEY,
`line_1_number_building` VARCHAR(80),
`city` VARCHAR(50),
`zip_postcode` VARCHAR(20),
`state_province_county` VARCHAR(50),
`country` VARCHAR(50)
)
3 rows from Addresses table:
address_id line_1_number_building city zip_postcode state_province_county country
1 3904 Stroman Passage Port Melyssa 14445 Georgia USA
2 053 Quigley Island Hagenesfurt 22194 Kentucky USA
3 00704 Zoe Alley Lake Elaina 08938 Georgia USA
CREATE TABLE `Staff` (
`staff_id` INTEGER PRIMARY KEY,
`staff_address_id` INTEGER NOT NULL,
`nickname` VARCHAR(80),
`first_name` VARCHAR(80),
`middle_name` VARCHAR(80),
`last_name` VARCHAR(80),
`date_of_birth` DATETIME,
`date_joined_staff` DATETIME,
`date_left_staff` DATETIME,
FOREIGN KEY (`staff_address_id` ) REFERENCES `Addresses`(`address_id` )
)
3 rows from Staff table:
staff_id staff_address_id nickname first_name middle_name last_name date_of_birth date_joined_staff date_left_staff
1 14 thompson.constantin Janessa Amara Sawayn 2010-12-08 16:55:14 2017-04-27 03:21:26 2018-03-23 22:53:12
2 3 santos45 Camylle Icie Weissnat 2015-08-01 13:22:43 2016-06-06 08:54:28 2018-03-10 15:25:00
3 5 ynader Kaitlin Stephania Mertz 1994-05-17 05:32:11 2018-01-02 12:24:24 2018-03-24 10:11:08
CREATE TABLE `Vehicles` (
`vehicle_id` INTEGER PRIMARY KEY,
`vehicle_details` VARCHAR(255)
)
3 rows from Vehicles table:
vehicle_id vehicle_details
1 Van
2 Truck
3 Car
CREATE TABLE `Customers` (
`customer_id` INTEGER PRIMARY KEY,
`customer_address_id` INTEGER NOT NULL,
`customer_status_code` VARCHAR(15) NOT NULL,
`date_became_customer` DATETIME,
`date_of_birth` DATETIME,
`first_name` VARCHAR(80),
`last_name` VARCHAR(80),
`amount_outstanding` DOUBLE NULL,
`email_address` VARCHAR(250),
`phone_number` VARCHAR(255),
`cell_mobile_phone_number` VARCHAR(255),
FOREIGN KEY (`customer_address_id` ) REFERENCES `Addresses`(`address_id` )
)
3 rows from Customers table:
customer_id customer_address_id customer_status_code date_became_customer date_of_birth first_name last_name amount_outstanding email_address phone_number cell_mobile_phone_number
1 13 Bad Customer 2016-05-11 17:03:48 1998-12-15 13:24:40 Carole Bernhard 255.0 everette.goyette@example.org 07278206718 861-638-9797
2 10 Bad Customer 2015-11-16 22:52:14 1995-07-17 12:13:16 Genevieve Terry 7256.0 huel.jana@example.org +14(5)2351480248 578-518-4785x612
3 10 Good Customer 2016-04-08 00:28:15 1994-06-21 01:34:56 Clara Ortiz 9443.0 hilario.sporer@example.org 374-483-2758x85087 1-197-686-2849x8761
CREATE TABLE `Customer_Payments` (
`customer_id` INTEGER NOT NULL,
`datetime_payment` DATETIME NOT NULL,
`payment_method_code` VARCHAR(10) NOT NULL,
`amount_payment` DOUBLE NULL,
PRIMARY KEY (`customer_id`,`datetime_payment`),
FOREIGN KEY (`customer_id` ) REFERENCES `Customers`(`customer_id` )
)
3 rows from Customer_Payments table:
customer_id datetime_payment payment_method_code amount_payment
11 2018-02-05 18:44:46 Direct Debit 9570.93
2 2018-02-24 10:07:05 Direct Debit 8180.26
14 2018-02-27 20:08:53 Direct Debit 4610.26
CREATE TABLE `Lessons` (
`lesson_id` INTEGER PRIMARY KEY,
`customer_id` INTEGER NOT NULL,
`lesson_status_code` VARCHAR(15) NOT NULL,
`staff_id` INTEGER,
`vehicle_id` INTEGER NOT NULL,
`lesson_date` DATETIME,
`lesson_time` VARCHAR(10),
`price` DOUBLE NULL,
FOREIGN KEY (`vehicle_id` ) REFERENCES `Vehicles`(`vehicle_id` ),
FOREIGN KEY (`staff_id` ) REFERENCES `Staff`(`staff_id` ),
FOREIGN KEY (`customer_id` ) REFERENCES `Customers`(`customer_id` )
)
3 rows from Lessons table:
lesson_id customer_id lesson_status_code staff_id vehicle_id lesson_date lesson_time price
1 6 Cancelled 8 3 2018-02-28 10:55:36 5 199.0
2 8 Cancelled 14 3 2018-03-07 16:12:36 6 167.0
3 6 Cancelled 11 2 2018-03-03 15:10:16 3 352.0
|
driving_school | List first name and last name of customers lived in city Lockmanfurt. | SELECT T1.first_name , T1.last_name FROM Customers AS T1 JOIN Addresses AS T2 ON T1.customer_address_id = T2.address_id WHERE T2.city = "Lockmanfurt"; | CREATE TABLE `Addresses` (
`address_id` INTEGER PRIMARY KEY,
`line_1_number_building` VARCHAR(80),
`city` VARCHAR(50),
`zip_postcode` VARCHAR(20),
`state_province_county` VARCHAR(50),
`country` VARCHAR(50)
)
3 rows from Addresses table:
address_id line_1_number_building city zip_postcode state_province_county country
1 3904 Stroman Passage Port Melyssa 14445 Georgia USA
2 053 Quigley Island Hagenesfurt 22194 Kentucky USA
3 00704 Zoe Alley Lake Elaina 08938 Georgia USA
CREATE TABLE `Staff` (
`staff_id` INTEGER PRIMARY KEY,
`staff_address_id` INTEGER NOT NULL,
`nickname` VARCHAR(80),
`first_name` VARCHAR(80),
`middle_name` VARCHAR(80),
`last_name` VARCHAR(80),
`date_of_birth` DATETIME,
`date_joined_staff` DATETIME,
`date_left_staff` DATETIME,
FOREIGN KEY (`staff_address_id` ) REFERENCES `Addresses`(`address_id` )
)
3 rows from Staff table:
staff_id staff_address_id nickname first_name middle_name last_name date_of_birth date_joined_staff date_left_staff
1 14 thompson.constantin Janessa Amara Sawayn 2010-12-08 16:55:14 2017-04-27 03:21:26 2018-03-23 22:53:12
2 3 santos45 Camylle Icie Weissnat 2015-08-01 13:22:43 2016-06-06 08:54:28 2018-03-10 15:25:00
3 5 ynader Kaitlin Stephania Mertz 1994-05-17 05:32:11 2018-01-02 12:24:24 2018-03-24 10:11:08
CREATE TABLE `Vehicles` (
`vehicle_id` INTEGER PRIMARY KEY,
`vehicle_details` VARCHAR(255)
)
3 rows from Vehicles table:
vehicle_id vehicle_details
1 Van
2 Truck
3 Car
CREATE TABLE `Customers` (
`customer_id` INTEGER PRIMARY KEY,
`customer_address_id` INTEGER NOT NULL,
`customer_status_code` VARCHAR(15) NOT NULL,
`date_became_customer` DATETIME,
`date_of_birth` DATETIME,
`first_name` VARCHAR(80),
`last_name` VARCHAR(80),
`amount_outstanding` DOUBLE NULL,
`email_address` VARCHAR(250),
`phone_number` VARCHAR(255),
`cell_mobile_phone_number` VARCHAR(255),
FOREIGN KEY (`customer_address_id` ) REFERENCES `Addresses`(`address_id` )
)
3 rows from Customers table:
customer_id customer_address_id customer_status_code date_became_customer date_of_birth first_name last_name amount_outstanding email_address phone_number cell_mobile_phone_number
1 13 Bad Customer 2016-05-11 17:03:48 1998-12-15 13:24:40 Carole Bernhard 255.0 everette.goyette@example.org 07278206718 861-638-9797
2 10 Bad Customer 2015-11-16 22:52:14 1995-07-17 12:13:16 Genevieve Terry 7256.0 huel.jana@example.org +14(5)2351480248 578-518-4785x612
3 10 Good Customer 2016-04-08 00:28:15 1994-06-21 01:34:56 Clara Ortiz 9443.0 hilario.sporer@example.org 374-483-2758x85087 1-197-686-2849x8761
CREATE TABLE `Customer_Payments` (
`customer_id` INTEGER NOT NULL,
`datetime_payment` DATETIME NOT NULL,
`payment_method_code` VARCHAR(10) NOT NULL,
`amount_payment` DOUBLE NULL,
PRIMARY KEY (`customer_id`,`datetime_payment`),
FOREIGN KEY (`customer_id` ) REFERENCES `Customers`(`customer_id` )
)
3 rows from Customer_Payments table:
customer_id datetime_payment payment_method_code amount_payment
11 2018-02-05 18:44:46 Direct Debit 9570.93
2 2018-02-24 10:07:05 Direct Debit 8180.26
14 2018-02-27 20:08:53 Direct Debit 4610.26
CREATE TABLE `Lessons` (
`lesson_id` INTEGER PRIMARY KEY,
`customer_id` INTEGER NOT NULL,
`lesson_status_code` VARCHAR(15) NOT NULL,
`staff_id` INTEGER,
`vehicle_id` INTEGER NOT NULL,
`lesson_date` DATETIME,
`lesson_time` VARCHAR(10),
`price` DOUBLE NULL,
FOREIGN KEY (`vehicle_id` ) REFERENCES `Vehicles`(`vehicle_id` ),
FOREIGN KEY (`staff_id` ) REFERENCES `Staff`(`staff_id` ),
FOREIGN KEY (`customer_id` ) REFERENCES `Customers`(`customer_id` )
)
3 rows from Lessons table:
lesson_id customer_id lesson_status_code staff_id vehicle_id lesson_date lesson_time price
1 6 Cancelled 8 3 2018-02-28 10:55:36 5 199.0
2 8 Cancelled 14 3 2018-03-07 16:12:36 6 167.0
3 6 Cancelled 11 2 2018-03-03 15:10:16 3 352.0
|
driving_school | What are the first and last names of all customers who lived in Lockmanfurt? | SELECT T1.first_name , T1.last_name FROM Customers AS T1 JOIN Addresses AS T2 ON T1.customer_address_id = T2.address_id WHERE T2.city = "Lockmanfurt"; | CREATE TABLE `Addresses` (
`address_id` INTEGER PRIMARY KEY,
`line_1_number_building` VARCHAR(80),
`city` VARCHAR(50),
`zip_postcode` VARCHAR(20),
`state_province_county` VARCHAR(50),
`country` VARCHAR(50)
)
3 rows from Addresses table:
address_id line_1_number_building city zip_postcode state_province_county country
1 3904 Stroman Passage Port Melyssa 14445 Georgia USA
2 053 Quigley Island Hagenesfurt 22194 Kentucky USA
3 00704 Zoe Alley Lake Elaina 08938 Georgia USA
CREATE TABLE `Staff` (
`staff_id` INTEGER PRIMARY KEY,
`staff_address_id` INTEGER NOT NULL,
`nickname` VARCHAR(80),
`first_name` VARCHAR(80),
`middle_name` VARCHAR(80),
`last_name` VARCHAR(80),
`date_of_birth` DATETIME,
`date_joined_staff` DATETIME,
`date_left_staff` DATETIME,
FOREIGN KEY (`staff_address_id` ) REFERENCES `Addresses`(`address_id` )
)
3 rows from Staff table:
staff_id staff_address_id nickname first_name middle_name last_name date_of_birth date_joined_staff date_left_staff
1 14 thompson.constantin Janessa Amara Sawayn 2010-12-08 16:55:14 2017-04-27 03:21:26 2018-03-23 22:53:12
2 3 santos45 Camylle Icie Weissnat 2015-08-01 13:22:43 2016-06-06 08:54:28 2018-03-10 15:25:00
3 5 ynader Kaitlin Stephania Mertz 1994-05-17 05:32:11 2018-01-02 12:24:24 2018-03-24 10:11:08
CREATE TABLE `Vehicles` (
`vehicle_id` INTEGER PRIMARY KEY,
`vehicle_details` VARCHAR(255)
)
3 rows from Vehicles table:
vehicle_id vehicle_details
1 Van
2 Truck
3 Car
CREATE TABLE `Customers` (
`customer_id` INTEGER PRIMARY KEY,
`customer_address_id` INTEGER NOT NULL,
`customer_status_code` VARCHAR(15) NOT NULL,
`date_became_customer` DATETIME,
`date_of_birth` DATETIME,
`first_name` VARCHAR(80),
`last_name` VARCHAR(80),
`amount_outstanding` DOUBLE NULL,
`email_address` VARCHAR(250),
`phone_number` VARCHAR(255),
`cell_mobile_phone_number` VARCHAR(255),
FOREIGN KEY (`customer_address_id` ) REFERENCES `Addresses`(`address_id` )
)
3 rows from Customers table:
customer_id customer_address_id customer_status_code date_became_customer date_of_birth first_name last_name amount_outstanding email_address phone_number cell_mobile_phone_number
1 13 Bad Customer 2016-05-11 17:03:48 1998-12-15 13:24:40 Carole Bernhard 255.0 everette.goyette@example.org 07278206718 861-638-9797
2 10 Bad Customer 2015-11-16 22:52:14 1995-07-17 12:13:16 Genevieve Terry 7256.0 huel.jana@example.org +14(5)2351480248 578-518-4785x612
3 10 Good Customer 2016-04-08 00:28:15 1994-06-21 01:34:56 Clara Ortiz 9443.0 hilario.sporer@example.org 374-483-2758x85087 1-197-686-2849x8761
CREATE TABLE `Customer_Payments` (
`customer_id` INTEGER NOT NULL,
`datetime_payment` DATETIME NOT NULL,
`payment_method_code` VARCHAR(10) NOT NULL,
`amount_payment` DOUBLE NULL,
PRIMARY KEY (`customer_id`,`datetime_payment`),
FOREIGN KEY (`customer_id` ) REFERENCES `Customers`(`customer_id` )
)
3 rows from Customer_Payments table:
customer_id datetime_payment payment_method_code amount_payment
11 2018-02-05 18:44:46 Direct Debit 9570.93
2 2018-02-24 10:07:05 Direct Debit 8180.26
14 2018-02-27 20:08:53 Direct Debit 4610.26
CREATE TABLE `Lessons` (
`lesson_id` INTEGER PRIMARY KEY,
`customer_id` INTEGER NOT NULL,
`lesson_status_code` VARCHAR(15) NOT NULL,
`staff_id` INTEGER,
`vehicle_id` INTEGER NOT NULL,
`lesson_date` DATETIME,
`lesson_time` VARCHAR(10),
`price` DOUBLE NULL,
FOREIGN KEY (`vehicle_id` ) REFERENCES `Vehicles`(`vehicle_id` ),
FOREIGN KEY (`staff_id` ) REFERENCES `Staff`(`staff_id` ),
FOREIGN KEY (`customer_id` ) REFERENCES `Customers`(`customer_id` )
)
3 rows from Lessons table:
lesson_id customer_id lesson_status_code staff_id vehicle_id lesson_date lesson_time price
1 6 Cancelled 8 3 2018-02-28 10:55:36 5 199.0
2 8 Cancelled 14 3 2018-03-07 16:12:36 6 167.0
3 6 Cancelled 11 2 2018-03-03 15:10:16 3 352.0
|
driving_school | Which country does customer with first name as Carole and last name as Bernhard lived in? | SELECT T2.country FROM Customers AS T1 JOIN Addresses AS T2 ON T1.customer_address_id = T2.address_id WHERE T1.first_name = "Carole" AND T1.last_name = "Bernhard" | CREATE TABLE `Addresses` (
`address_id` INTEGER PRIMARY KEY,
`line_1_number_building` VARCHAR(80),
`city` VARCHAR(50),
`zip_postcode` VARCHAR(20),
`state_province_county` VARCHAR(50),
`country` VARCHAR(50)
)
3 rows from Addresses table:
address_id line_1_number_building city zip_postcode state_province_county country
1 3904 Stroman Passage Port Melyssa 14445 Georgia USA
2 053 Quigley Island Hagenesfurt 22194 Kentucky USA
3 00704 Zoe Alley Lake Elaina 08938 Georgia USA
CREATE TABLE `Staff` (
`staff_id` INTEGER PRIMARY KEY,
`staff_address_id` INTEGER NOT NULL,
`nickname` VARCHAR(80),
`first_name` VARCHAR(80),
`middle_name` VARCHAR(80),
`last_name` VARCHAR(80),
`date_of_birth` DATETIME,
`date_joined_staff` DATETIME,
`date_left_staff` DATETIME,
FOREIGN KEY (`staff_address_id` ) REFERENCES `Addresses`(`address_id` )
)
3 rows from Staff table:
staff_id staff_address_id nickname first_name middle_name last_name date_of_birth date_joined_staff date_left_staff
1 14 thompson.constantin Janessa Amara Sawayn 2010-12-08 16:55:14 2017-04-27 03:21:26 2018-03-23 22:53:12
2 3 santos45 Camylle Icie Weissnat 2015-08-01 13:22:43 2016-06-06 08:54:28 2018-03-10 15:25:00
3 5 ynader Kaitlin Stephania Mertz 1994-05-17 05:32:11 2018-01-02 12:24:24 2018-03-24 10:11:08
CREATE TABLE `Vehicles` (
`vehicle_id` INTEGER PRIMARY KEY,
`vehicle_details` VARCHAR(255)
)
3 rows from Vehicles table:
vehicle_id vehicle_details
1 Van
2 Truck
3 Car
CREATE TABLE `Customers` (
`customer_id` INTEGER PRIMARY KEY,
`customer_address_id` INTEGER NOT NULL,
`customer_status_code` VARCHAR(15) NOT NULL,
`date_became_customer` DATETIME,
`date_of_birth` DATETIME,
`first_name` VARCHAR(80),
`last_name` VARCHAR(80),
`amount_outstanding` DOUBLE NULL,
`email_address` VARCHAR(250),
`phone_number` VARCHAR(255),
`cell_mobile_phone_number` VARCHAR(255),
FOREIGN KEY (`customer_address_id` ) REFERENCES `Addresses`(`address_id` )
)
3 rows from Customers table:
customer_id customer_address_id customer_status_code date_became_customer date_of_birth first_name last_name amount_outstanding email_address phone_number cell_mobile_phone_number
1 13 Bad Customer 2016-05-11 17:03:48 1998-12-15 13:24:40 Carole Bernhard 255.0 everette.goyette@example.org 07278206718 861-638-9797
2 10 Bad Customer 2015-11-16 22:52:14 1995-07-17 12:13:16 Genevieve Terry 7256.0 huel.jana@example.org +14(5)2351480248 578-518-4785x612
3 10 Good Customer 2016-04-08 00:28:15 1994-06-21 01:34:56 Clara Ortiz 9443.0 hilario.sporer@example.org 374-483-2758x85087 1-197-686-2849x8761
CREATE TABLE `Customer_Payments` (
`customer_id` INTEGER NOT NULL,
`datetime_payment` DATETIME NOT NULL,
`payment_method_code` VARCHAR(10) NOT NULL,
`amount_payment` DOUBLE NULL,
PRIMARY KEY (`customer_id`,`datetime_payment`),
FOREIGN KEY (`customer_id` ) REFERENCES `Customers`(`customer_id` )
)
3 rows from Customer_Payments table:
customer_id datetime_payment payment_method_code amount_payment
11 2018-02-05 18:44:46 Direct Debit 9570.93
2 2018-02-24 10:07:05 Direct Debit 8180.26
14 2018-02-27 20:08:53 Direct Debit 4610.26
CREATE TABLE `Lessons` (
`lesson_id` INTEGER PRIMARY KEY,
`customer_id` INTEGER NOT NULL,
`lesson_status_code` VARCHAR(15) NOT NULL,
`staff_id` INTEGER,
`vehicle_id` INTEGER NOT NULL,
`lesson_date` DATETIME,
`lesson_time` VARCHAR(10),
`price` DOUBLE NULL,
FOREIGN KEY (`vehicle_id` ) REFERENCES `Vehicles`(`vehicle_id` ),
FOREIGN KEY (`staff_id` ) REFERENCES `Staff`(`staff_id` ),
FOREIGN KEY (`customer_id` ) REFERENCES `Customers`(`customer_id` )
)
3 rows from Lessons table:
lesson_id customer_id lesson_status_code staff_id vehicle_id lesson_date lesson_time price
1 6 Cancelled 8 3 2018-02-28 10:55:36 5 199.0
2 8 Cancelled 14 3 2018-03-07 16:12:36 6 167.0
3 6 Cancelled 11 2 2018-03-03 15:10:16 3 352.0
|
driving_school | What is the country in which the customer Carole Bernhard lived? | SELECT T2.country FROM Customers AS T1 JOIN Addresses AS T2 ON T1.customer_address_id = T2.address_id WHERE T1.first_name = "Carole" AND T1.last_name = "Bernhard" | CREATE TABLE `Addresses` (
`address_id` INTEGER PRIMARY KEY,
`line_1_number_building` VARCHAR(80),
`city` VARCHAR(50),
`zip_postcode` VARCHAR(20),
`state_province_county` VARCHAR(50),
`country` VARCHAR(50)
)
3 rows from Addresses table:
address_id line_1_number_building city zip_postcode state_province_county country
1 3904 Stroman Passage Port Melyssa 14445 Georgia USA
2 053 Quigley Island Hagenesfurt 22194 Kentucky USA
3 00704 Zoe Alley Lake Elaina 08938 Georgia USA
CREATE TABLE `Staff` (
`staff_id` INTEGER PRIMARY KEY,
`staff_address_id` INTEGER NOT NULL,
`nickname` VARCHAR(80),
`first_name` VARCHAR(80),
`middle_name` VARCHAR(80),
`last_name` VARCHAR(80),
`date_of_birth` DATETIME,
`date_joined_staff` DATETIME,
`date_left_staff` DATETIME,
FOREIGN KEY (`staff_address_id` ) REFERENCES `Addresses`(`address_id` )
)
3 rows from Staff table:
staff_id staff_address_id nickname first_name middle_name last_name date_of_birth date_joined_staff date_left_staff
1 14 thompson.constantin Janessa Amara Sawayn 2010-12-08 16:55:14 2017-04-27 03:21:26 2018-03-23 22:53:12
2 3 santos45 Camylle Icie Weissnat 2015-08-01 13:22:43 2016-06-06 08:54:28 2018-03-10 15:25:00
3 5 ynader Kaitlin Stephania Mertz 1994-05-17 05:32:11 2018-01-02 12:24:24 2018-03-24 10:11:08
CREATE TABLE `Vehicles` (
`vehicle_id` INTEGER PRIMARY KEY,
`vehicle_details` VARCHAR(255)
)
3 rows from Vehicles table:
vehicle_id vehicle_details
1 Van
2 Truck
3 Car
CREATE TABLE `Customers` (
`customer_id` INTEGER PRIMARY KEY,
`customer_address_id` INTEGER NOT NULL,
`customer_status_code` VARCHAR(15) NOT NULL,
`date_became_customer` DATETIME,
`date_of_birth` DATETIME,
`first_name` VARCHAR(80),
`last_name` VARCHAR(80),
`amount_outstanding` DOUBLE NULL,
`email_address` VARCHAR(250),
`phone_number` VARCHAR(255),
`cell_mobile_phone_number` VARCHAR(255),
FOREIGN KEY (`customer_address_id` ) REFERENCES `Addresses`(`address_id` )
)
3 rows from Customers table:
customer_id customer_address_id customer_status_code date_became_customer date_of_birth first_name last_name amount_outstanding email_address phone_number cell_mobile_phone_number
1 13 Bad Customer 2016-05-11 17:03:48 1998-12-15 13:24:40 Carole Bernhard 255.0 everette.goyette@example.org 07278206718 861-638-9797
2 10 Bad Customer 2015-11-16 22:52:14 1995-07-17 12:13:16 Genevieve Terry 7256.0 huel.jana@example.org +14(5)2351480248 578-518-4785x612
3 10 Good Customer 2016-04-08 00:28:15 1994-06-21 01:34:56 Clara Ortiz 9443.0 hilario.sporer@example.org 374-483-2758x85087 1-197-686-2849x8761
CREATE TABLE `Customer_Payments` (
`customer_id` INTEGER NOT NULL,
`datetime_payment` DATETIME NOT NULL,
`payment_method_code` VARCHAR(10) NOT NULL,
`amount_payment` DOUBLE NULL,
PRIMARY KEY (`customer_id`,`datetime_payment`),
FOREIGN KEY (`customer_id` ) REFERENCES `Customers`(`customer_id` )
)
3 rows from Customer_Payments table:
customer_id datetime_payment payment_method_code amount_payment
11 2018-02-05 18:44:46 Direct Debit 9570.93
2 2018-02-24 10:07:05 Direct Debit 8180.26
14 2018-02-27 20:08:53 Direct Debit 4610.26
CREATE TABLE `Lessons` (
`lesson_id` INTEGER PRIMARY KEY,
`customer_id` INTEGER NOT NULL,
`lesson_status_code` VARCHAR(15) NOT NULL,
`staff_id` INTEGER,
`vehicle_id` INTEGER NOT NULL,
`lesson_date` DATETIME,
`lesson_time` VARCHAR(10),
`price` DOUBLE NULL,
FOREIGN KEY (`vehicle_id` ) REFERENCES `Vehicles`(`vehicle_id` ),
FOREIGN KEY (`staff_id` ) REFERENCES `Staff`(`staff_id` ),
FOREIGN KEY (`customer_id` ) REFERENCES `Customers`(`customer_id` )
)
3 rows from Lessons table:
lesson_id customer_id lesson_status_code staff_id vehicle_id lesson_date lesson_time price
1 6 Cancelled 8 3 2018-02-28 10:55:36 5 199.0
2 8 Cancelled 14 3 2018-03-07 16:12:36 6 167.0
3 6 Cancelled 11 2 2018-03-03 15:10:16 3 352.0
|
driving_school | What is zip code of customer with first name as Carole and last name as Bernhard? | SELECT T2.zip_postcode FROM Customers AS T1 JOIN Addresses AS T2 ON T1.customer_address_id = T2.address_id WHERE T1.first_name = "Carole" AND T1.last_name = "Bernhard" | CREATE TABLE `Addresses` (
`address_id` INTEGER PRIMARY KEY,
`line_1_number_building` VARCHAR(80),
`city` VARCHAR(50),
`zip_postcode` VARCHAR(20),
`state_province_county` VARCHAR(50),
`country` VARCHAR(50)
)
3 rows from Addresses table:
address_id line_1_number_building city zip_postcode state_province_county country
1 3904 Stroman Passage Port Melyssa 14445 Georgia USA
2 053 Quigley Island Hagenesfurt 22194 Kentucky USA
3 00704 Zoe Alley Lake Elaina 08938 Georgia USA
CREATE TABLE `Staff` (
`staff_id` INTEGER PRIMARY KEY,
`staff_address_id` INTEGER NOT NULL,
`nickname` VARCHAR(80),
`first_name` VARCHAR(80),
`middle_name` VARCHAR(80),
`last_name` VARCHAR(80),
`date_of_birth` DATETIME,
`date_joined_staff` DATETIME,
`date_left_staff` DATETIME,
FOREIGN KEY (`staff_address_id` ) REFERENCES `Addresses`(`address_id` )
)
3 rows from Staff table:
staff_id staff_address_id nickname first_name middle_name last_name date_of_birth date_joined_staff date_left_staff
1 14 thompson.constantin Janessa Amara Sawayn 2010-12-08 16:55:14 2017-04-27 03:21:26 2018-03-23 22:53:12
2 3 santos45 Camylle Icie Weissnat 2015-08-01 13:22:43 2016-06-06 08:54:28 2018-03-10 15:25:00
3 5 ynader Kaitlin Stephania Mertz 1994-05-17 05:32:11 2018-01-02 12:24:24 2018-03-24 10:11:08
CREATE TABLE `Vehicles` (
`vehicle_id` INTEGER PRIMARY KEY,
`vehicle_details` VARCHAR(255)
)
3 rows from Vehicles table:
vehicle_id vehicle_details
1 Van
2 Truck
3 Car
CREATE TABLE `Customers` (
`customer_id` INTEGER PRIMARY KEY,
`customer_address_id` INTEGER NOT NULL,
`customer_status_code` VARCHAR(15) NOT NULL,
`date_became_customer` DATETIME,
`date_of_birth` DATETIME,
`first_name` VARCHAR(80),
`last_name` VARCHAR(80),
`amount_outstanding` DOUBLE NULL,
`email_address` VARCHAR(250),
`phone_number` VARCHAR(255),
`cell_mobile_phone_number` VARCHAR(255),
FOREIGN KEY (`customer_address_id` ) REFERENCES `Addresses`(`address_id` )
)
3 rows from Customers table:
customer_id customer_address_id customer_status_code date_became_customer date_of_birth first_name last_name amount_outstanding email_address phone_number cell_mobile_phone_number
1 13 Bad Customer 2016-05-11 17:03:48 1998-12-15 13:24:40 Carole Bernhard 255.0 everette.goyette@example.org 07278206718 861-638-9797
2 10 Bad Customer 2015-11-16 22:52:14 1995-07-17 12:13:16 Genevieve Terry 7256.0 huel.jana@example.org +14(5)2351480248 578-518-4785x612
3 10 Good Customer 2016-04-08 00:28:15 1994-06-21 01:34:56 Clara Ortiz 9443.0 hilario.sporer@example.org 374-483-2758x85087 1-197-686-2849x8761
CREATE TABLE `Customer_Payments` (
`customer_id` INTEGER NOT NULL,
`datetime_payment` DATETIME NOT NULL,
`payment_method_code` VARCHAR(10) NOT NULL,
`amount_payment` DOUBLE NULL,
PRIMARY KEY (`customer_id`,`datetime_payment`),
FOREIGN KEY (`customer_id` ) REFERENCES `Customers`(`customer_id` )
)
3 rows from Customer_Payments table:
customer_id datetime_payment payment_method_code amount_payment
11 2018-02-05 18:44:46 Direct Debit 9570.93
2 2018-02-24 10:07:05 Direct Debit 8180.26
14 2018-02-27 20:08:53 Direct Debit 4610.26
CREATE TABLE `Lessons` (
`lesson_id` INTEGER PRIMARY KEY,
`customer_id` INTEGER NOT NULL,
`lesson_status_code` VARCHAR(15) NOT NULL,
`staff_id` INTEGER,
`vehicle_id` INTEGER NOT NULL,
`lesson_date` DATETIME,
`lesson_time` VARCHAR(10),
`price` DOUBLE NULL,
FOREIGN KEY (`vehicle_id` ) REFERENCES `Vehicles`(`vehicle_id` ),
FOREIGN KEY (`staff_id` ) REFERENCES `Staff`(`staff_id` ),
FOREIGN KEY (`customer_id` ) REFERENCES `Customers`(`customer_id` )
)
3 rows from Lessons table:
lesson_id customer_id lesson_status_code staff_id vehicle_id lesson_date lesson_time price
1 6 Cancelled 8 3 2018-02-28 10:55:36 5 199.0
2 8 Cancelled 14 3 2018-03-07 16:12:36 6 167.0
3 6 Cancelled 11 2 2018-03-03 15:10:16 3 352.0
|
driving_school | What is the zip code of the customer Carole Bernhard? | SELECT T2.zip_postcode FROM Customers AS T1 JOIN Addresses AS T2 ON T1.customer_address_id = T2.address_id WHERE T1.first_name = "Carole" AND T1.last_name = "Bernhard" | CREATE TABLE `Addresses` (
`address_id` INTEGER PRIMARY KEY,
`line_1_number_building` VARCHAR(80),
`city` VARCHAR(50),
`zip_postcode` VARCHAR(20),
`state_province_county` VARCHAR(50),
`country` VARCHAR(50)
)
3 rows from Addresses table:
address_id line_1_number_building city zip_postcode state_province_county country
1 3904 Stroman Passage Port Melyssa 14445 Georgia USA
2 053 Quigley Island Hagenesfurt 22194 Kentucky USA
3 00704 Zoe Alley Lake Elaina 08938 Georgia USA
CREATE TABLE `Staff` (
`staff_id` INTEGER PRIMARY KEY,
`staff_address_id` INTEGER NOT NULL,
`nickname` VARCHAR(80),
`first_name` VARCHAR(80),
`middle_name` VARCHAR(80),
`last_name` VARCHAR(80),
`date_of_birth` DATETIME,
`date_joined_staff` DATETIME,
`date_left_staff` DATETIME,
FOREIGN KEY (`staff_address_id` ) REFERENCES `Addresses`(`address_id` )
)
3 rows from Staff table:
staff_id staff_address_id nickname first_name middle_name last_name date_of_birth date_joined_staff date_left_staff
1 14 thompson.constantin Janessa Amara Sawayn 2010-12-08 16:55:14 2017-04-27 03:21:26 2018-03-23 22:53:12
2 3 santos45 Camylle Icie Weissnat 2015-08-01 13:22:43 2016-06-06 08:54:28 2018-03-10 15:25:00
3 5 ynader Kaitlin Stephania Mertz 1994-05-17 05:32:11 2018-01-02 12:24:24 2018-03-24 10:11:08
CREATE TABLE `Vehicles` (
`vehicle_id` INTEGER PRIMARY KEY,
`vehicle_details` VARCHAR(255)
)
3 rows from Vehicles table:
vehicle_id vehicle_details
1 Van
2 Truck
3 Car
CREATE TABLE `Customers` (
`customer_id` INTEGER PRIMARY KEY,
`customer_address_id` INTEGER NOT NULL,
`customer_status_code` VARCHAR(15) NOT NULL,
`date_became_customer` DATETIME,
`date_of_birth` DATETIME,
`first_name` VARCHAR(80),
`last_name` VARCHAR(80),
`amount_outstanding` DOUBLE NULL,
`email_address` VARCHAR(250),
`phone_number` VARCHAR(255),
`cell_mobile_phone_number` VARCHAR(255),
FOREIGN KEY (`customer_address_id` ) REFERENCES `Addresses`(`address_id` )
)
3 rows from Customers table:
customer_id customer_address_id customer_status_code date_became_customer date_of_birth first_name last_name amount_outstanding email_address phone_number cell_mobile_phone_number
1 13 Bad Customer 2016-05-11 17:03:48 1998-12-15 13:24:40 Carole Bernhard 255.0 everette.goyette@example.org 07278206718 861-638-9797
2 10 Bad Customer 2015-11-16 22:52:14 1995-07-17 12:13:16 Genevieve Terry 7256.0 huel.jana@example.org +14(5)2351480248 578-518-4785x612
3 10 Good Customer 2016-04-08 00:28:15 1994-06-21 01:34:56 Clara Ortiz 9443.0 hilario.sporer@example.org 374-483-2758x85087 1-197-686-2849x8761
CREATE TABLE `Customer_Payments` (
`customer_id` INTEGER NOT NULL,
`datetime_payment` DATETIME NOT NULL,
`payment_method_code` VARCHAR(10) NOT NULL,
`amount_payment` DOUBLE NULL,
PRIMARY KEY (`customer_id`,`datetime_payment`),
FOREIGN KEY (`customer_id` ) REFERENCES `Customers`(`customer_id` )
)
3 rows from Customer_Payments table:
customer_id datetime_payment payment_method_code amount_payment
11 2018-02-05 18:44:46 Direct Debit 9570.93
2 2018-02-24 10:07:05 Direct Debit 8180.26
14 2018-02-27 20:08:53 Direct Debit 4610.26
CREATE TABLE `Lessons` (
`lesson_id` INTEGER PRIMARY KEY,
`customer_id` INTEGER NOT NULL,
`lesson_status_code` VARCHAR(15) NOT NULL,
`staff_id` INTEGER,
`vehicle_id` INTEGER NOT NULL,
`lesson_date` DATETIME,
`lesson_time` VARCHAR(10),
`price` DOUBLE NULL,
FOREIGN KEY (`vehicle_id` ) REFERENCES `Vehicles`(`vehicle_id` ),
FOREIGN KEY (`staff_id` ) REFERENCES `Staff`(`staff_id` ),
FOREIGN KEY (`customer_id` ) REFERENCES `Customers`(`customer_id` )
)
3 rows from Lessons table:
lesson_id customer_id lesson_status_code staff_id vehicle_id lesson_date lesson_time price
1 6 Cancelled 8 3 2018-02-28 10:55:36 5 199.0
2 8 Cancelled 14 3 2018-03-07 16:12:36 6 167.0
3 6 Cancelled 11 2 2018-03-03 15:10:16 3 352.0
|
driving_school | Which city does has most number of customers? | SELECT T2.city FROM Customers AS T1 JOIN Addresses AS T2 ON T1.customer_address_id = T2.address_id GROUP BY T2.city ORDER BY count(*) DESC LIMIT 1; | CREATE TABLE `Addresses` (
`address_id` INTEGER PRIMARY KEY,
`line_1_number_building` VARCHAR(80),
`city` VARCHAR(50),
`zip_postcode` VARCHAR(20),
`state_province_county` VARCHAR(50),
`country` VARCHAR(50)
)
3 rows from Addresses table:
address_id line_1_number_building city zip_postcode state_province_county country
1 3904 Stroman Passage Port Melyssa 14445 Georgia USA
2 053 Quigley Island Hagenesfurt 22194 Kentucky USA
3 00704 Zoe Alley Lake Elaina 08938 Georgia USA
CREATE TABLE `Staff` (
`staff_id` INTEGER PRIMARY KEY,
`staff_address_id` INTEGER NOT NULL,
`nickname` VARCHAR(80),
`first_name` VARCHAR(80),
`middle_name` VARCHAR(80),
`last_name` VARCHAR(80),
`date_of_birth` DATETIME,
`date_joined_staff` DATETIME,
`date_left_staff` DATETIME,
FOREIGN KEY (`staff_address_id` ) REFERENCES `Addresses`(`address_id` )
)
3 rows from Staff table:
staff_id staff_address_id nickname first_name middle_name last_name date_of_birth date_joined_staff date_left_staff
1 14 thompson.constantin Janessa Amara Sawayn 2010-12-08 16:55:14 2017-04-27 03:21:26 2018-03-23 22:53:12
2 3 santos45 Camylle Icie Weissnat 2015-08-01 13:22:43 2016-06-06 08:54:28 2018-03-10 15:25:00
3 5 ynader Kaitlin Stephania Mertz 1994-05-17 05:32:11 2018-01-02 12:24:24 2018-03-24 10:11:08
CREATE TABLE `Vehicles` (
`vehicle_id` INTEGER PRIMARY KEY,
`vehicle_details` VARCHAR(255)
)
3 rows from Vehicles table:
vehicle_id vehicle_details
1 Van
2 Truck
3 Car
CREATE TABLE `Customers` (
`customer_id` INTEGER PRIMARY KEY,
`customer_address_id` INTEGER NOT NULL,
`customer_status_code` VARCHAR(15) NOT NULL,
`date_became_customer` DATETIME,
`date_of_birth` DATETIME,
`first_name` VARCHAR(80),
`last_name` VARCHAR(80),
`amount_outstanding` DOUBLE NULL,
`email_address` VARCHAR(250),
`phone_number` VARCHAR(255),
`cell_mobile_phone_number` VARCHAR(255),
FOREIGN KEY (`customer_address_id` ) REFERENCES `Addresses`(`address_id` )
)
3 rows from Customers table:
customer_id customer_address_id customer_status_code date_became_customer date_of_birth first_name last_name amount_outstanding email_address phone_number cell_mobile_phone_number
1 13 Bad Customer 2016-05-11 17:03:48 1998-12-15 13:24:40 Carole Bernhard 255.0 everette.goyette@example.org 07278206718 861-638-9797
2 10 Bad Customer 2015-11-16 22:52:14 1995-07-17 12:13:16 Genevieve Terry 7256.0 huel.jana@example.org +14(5)2351480248 578-518-4785x612
3 10 Good Customer 2016-04-08 00:28:15 1994-06-21 01:34:56 Clara Ortiz 9443.0 hilario.sporer@example.org 374-483-2758x85087 1-197-686-2849x8761
CREATE TABLE `Customer_Payments` (
`customer_id` INTEGER NOT NULL,
`datetime_payment` DATETIME NOT NULL,
`payment_method_code` VARCHAR(10) NOT NULL,
`amount_payment` DOUBLE NULL,
PRIMARY KEY (`customer_id`,`datetime_payment`),
FOREIGN KEY (`customer_id` ) REFERENCES `Customers`(`customer_id` )
)
3 rows from Customer_Payments table:
customer_id datetime_payment payment_method_code amount_payment
11 2018-02-05 18:44:46 Direct Debit 9570.93
2 2018-02-24 10:07:05 Direct Debit 8180.26
14 2018-02-27 20:08:53 Direct Debit 4610.26
CREATE TABLE `Lessons` (
`lesson_id` INTEGER PRIMARY KEY,
`customer_id` INTEGER NOT NULL,
`lesson_status_code` VARCHAR(15) NOT NULL,
`staff_id` INTEGER,
`vehicle_id` INTEGER NOT NULL,
`lesson_date` DATETIME,
`lesson_time` VARCHAR(10),
`price` DOUBLE NULL,
FOREIGN KEY (`vehicle_id` ) REFERENCES `Vehicles`(`vehicle_id` ),
FOREIGN KEY (`staff_id` ) REFERENCES `Staff`(`staff_id` ),
FOREIGN KEY (`customer_id` ) REFERENCES `Customers`(`customer_id` )
)
3 rows from Lessons table:
lesson_id customer_id lesson_status_code staff_id vehicle_id lesson_date lesson_time price
1 6 Cancelled 8 3 2018-02-28 10:55:36 5 199.0
2 8 Cancelled 14 3 2018-03-07 16:12:36 6 167.0
3 6 Cancelled 11 2 2018-03-03 15:10:16 3 352.0
|
driving_school | What is the city with the most customers? | SELECT T2.city FROM Customers AS T1 JOIN Addresses AS T2 ON T1.customer_address_id = T2.address_id GROUP BY T2.city ORDER BY count(*) DESC LIMIT 1; | CREATE TABLE `Addresses` (
`address_id` INTEGER PRIMARY KEY,
`line_1_number_building` VARCHAR(80),
`city` VARCHAR(50),
`zip_postcode` VARCHAR(20),
`state_province_county` VARCHAR(50),
`country` VARCHAR(50)
)
3 rows from Addresses table:
address_id line_1_number_building city zip_postcode state_province_county country
1 3904 Stroman Passage Port Melyssa 14445 Georgia USA
2 053 Quigley Island Hagenesfurt 22194 Kentucky USA
3 00704 Zoe Alley Lake Elaina 08938 Georgia USA
CREATE TABLE `Staff` (
`staff_id` INTEGER PRIMARY KEY,
`staff_address_id` INTEGER NOT NULL,
`nickname` VARCHAR(80),
`first_name` VARCHAR(80),
`middle_name` VARCHAR(80),
`last_name` VARCHAR(80),
`date_of_birth` DATETIME,
`date_joined_staff` DATETIME,
`date_left_staff` DATETIME,
FOREIGN KEY (`staff_address_id` ) REFERENCES `Addresses`(`address_id` )
)
3 rows from Staff table:
staff_id staff_address_id nickname first_name middle_name last_name date_of_birth date_joined_staff date_left_staff
1 14 thompson.constantin Janessa Amara Sawayn 2010-12-08 16:55:14 2017-04-27 03:21:26 2018-03-23 22:53:12
2 3 santos45 Camylle Icie Weissnat 2015-08-01 13:22:43 2016-06-06 08:54:28 2018-03-10 15:25:00
3 5 ynader Kaitlin Stephania Mertz 1994-05-17 05:32:11 2018-01-02 12:24:24 2018-03-24 10:11:08
CREATE TABLE `Vehicles` (
`vehicle_id` INTEGER PRIMARY KEY,
`vehicle_details` VARCHAR(255)
)
3 rows from Vehicles table:
vehicle_id vehicle_details
1 Van
2 Truck
3 Car
CREATE TABLE `Customers` (
`customer_id` INTEGER PRIMARY KEY,
`customer_address_id` INTEGER NOT NULL,
`customer_status_code` VARCHAR(15) NOT NULL,
`date_became_customer` DATETIME,
`date_of_birth` DATETIME,
`first_name` VARCHAR(80),
`last_name` VARCHAR(80),
`amount_outstanding` DOUBLE NULL,
`email_address` VARCHAR(250),
`phone_number` VARCHAR(255),
`cell_mobile_phone_number` VARCHAR(255),
FOREIGN KEY (`customer_address_id` ) REFERENCES `Addresses`(`address_id` )
)
3 rows from Customers table:
customer_id customer_address_id customer_status_code date_became_customer date_of_birth first_name last_name amount_outstanding email_address phone_number cell_mobile_phone_number
1 13 Bad Customer 2016-05-11 17:03:48 1998-12-15 13:24:40 Carole Bernhard 255.0 everette.goyette@example.org 07278206718 861-638-9797
2 10 Bad Customer 2015-11-16 22:52:14 1995-07-17 12:13:16 Genevieve Terry 7256.0 huel.jana@example.org +14(5)2351480248 578-518-4785x612
3 10 Good Customer 2016-04-08 00:28:15 1994-06-21 01:34:56 Clara Ortiz 9443.0 hilario.sporer@example.org 374-483-2758x85087 1-197-686-2849x8761
CREATE TABLE `Customer_Payments` (
`customer_id` INTEGER NOT NULL,
`datetime_payment` DATETIME NOT NULL,
`payment_method_code` VARCHAR(10) NOT NULL,
`amount_payment` DOUBLE NULL,
PRIMARY KEY (`customer_id`,`datetime_payment`),
FOREIGN KEY (`customer_id` ) REFERENCES `Customers`(`customer_id` )
)
3 rows from Customer_Payments table:
customer_id datetime_payment payment_method_code amount_payment
11 2018-02-05 18:44:46 Direct Debit 9570.93
2 2018-02-24 10:07:05 Direct Debit 8180.26
14 2018-02-27 20:08:53 Direct Debit 4610.26
CREATE TABLE `Lessons` (
`lesson_id` INTEGER PRIMARY KEY,
`customer_id` INTEGER NOT NULL,
`lesson_status_code` VARCHAR(15) NOT NULL,
`staff_id` INTEGER,
`vehicle_id` INTEGER NOT NULL,
`lesson_date` DATETIME,
`lesson_time` VARCHAR(10),
`price` DOUBLE NULL,
FOREIGN KEY (`vehicle_id` ) REFERENCES `Vehicles`(`vehicle_id` ),
FOREIGN KEY (`staff_id` ) REFERENCES `Staff`(`staff_id` ),
FOREIGN KEY (`customer_id` ) REFERENCES `Customers`(`customer_id` )
)
3 rows from Lessons table:
lesson_id customer_id lesson_status_code staff_id vehicle_id lesson_date lesson_time price
1 6 Cancelled 8 3 2018-02-28 10:55:36 5 199.0
2 8 Cancelled 14 3 2018-03-07 16:12:36 6 167.0
3 6 Cancelled 11 2 2018-03-03 15:10:16 3 352.0
|
driving_school | How much in total does customer with first name as Carole and last name as Bernhard paid? | SELECT sum(T1.amount_payment) FROM Customer_Payments AS T1 JOIN Customers AS T2 ON T1.customer_id = T2.customer_id WHERE T2.first_name = "Carole" AND T2.last_name = "Bernhard" | CREATE TABLE `Addresses` (
`address_id` INTEGER PRIMARY KEY,
`line_1_number_building` VARCHAR(80),
`city` VARCHAR(50),
`zip_postcode` VARCHAR(20),
`state_province_county` VARCHAR(50),
`country` VARCHAR(50)
)
3 rows from Addresses table:
address_id line_1_number_building city zip_postcode state_province_county country
1 3904 Stroman Passage Port Melyssa 14445 Georgia USA
2 053 Quigley Island Hagenesfurt 22194 Kentucky USA
3 00704 Zoe Alley Lake Elaina 08938 Georgia USA
CREATE TABLE `Staff` (
`staff_id` INTEGER PRIMARY KEY,
`staff_address_id` INTEGER NOT NULL,
`nickname` VARCHAR(80),
`first_name` VARCHAR(80),
`middle_name` VARCHAR(80),
`last_name` VARCHAR(80),
`date_of_birth` DATETIME,
`date_joined_staff` DATETIME,
`date_left_staff` DATETIME,
FOREIGN KEY (`staff_address_id` ) REFERENCES `Addresses`(`address_id` )
)
3 rows from Staff table:
staff_id staff_address_id nickname first_name middle_name last_name date_of_birth date_joined_staff date_left_staff
1 14 thompson.constantin Janessa Amara Sawayn 2010-12-08 16:55:14 2017-04-27 03:21:26 2018-03-23 22:53:12
2 3 santos45 Camylle Icie Weissnat 2015-08-01 13:22:43 2016-06-06 08:54:28 2018-03-10 15:25:00
3 5 ynader Kaitlin Stephania Mertz 1994-05-17 05:32:11 2018-01-02 12:24:24 2018-03-24 10:11:08
CREATE TABLE `Vehicles` (
`vehicle_id` INTEGER PRIMARY KEY,
`vehicle_details` VARCHAR(255)
)
3 rows from Vehicles table:
vehicle_id vehicle_details
1 Van
2 Truck
3 Car
CREATE TABLE `Customers` (
`customer_id` INTEGER PRIMARY KEY,
`customer_address_id` INTEGER NOT NULL,
`customer_status_code` VARCHAR(15) NOT NULL,
`date_became_customer` DATETIME,
`date_of_birth` DATETIME,
`first_name` VARCHAR(80),
`last_name` VARCHAR(80),
`amount_outstanding` DOUBLE NULL,
`email_address` VARCHAR(250),
`phone_number` VARCHAR(255),
`cell_mobile_phone_number` VARCHAR(255),
FOREIGN KEY (`customer_address_id` ) REFERENCES `Addresses`(`address_id` )
)
3 rows from Customers table:
customer_id customer_address_id customer_status_code date_became_customer date_of_birth first_name last_name amount_outstanding email_address phone_number cell_mobile_phone_number
1 13 Bad Customer 2016-05-11 17:03:48 1998-12-15 13:24:40 Carole Bernhard 255.0 everette.goyette@example.org 07278206718 861-638-9797
2 10 Bad Customer 2015-11-16 22:52:14 1995-07-17 12:13:16 Genevieve Terry 7256.0 huel.jana@example.org +14(5)2351480248 578-518-4785x612
3 10 Good Customer 2016-04-08 00:28:15 1994-06-21 01:34:56 Clara Ortiz 9443.0 hilario.sporer@example.org 374-483-2758x85087 1-197-686-2849x8761
CREATE TABLE `Customer_Payments` (
`customer_id` INTEGER NOT NULL,
`datetime_payment` DATETIME NOT NULL,
`payment_method_code` VARCHAR(10) NOT NULL,
`amount_payment` DOUBLE NULL,
PRIMARY KEY (`customer_id`,`datetime_payment`),
FOREIGN KEY (`customer_id` ) REFERENCES `Customers`(`customer_id` )
)
3 rows from Customer_Payments table:
customer_id datetime_payment payment_method_code amount_payment
11 2018-02-05 18:44:46 Direct Debit 9570.93
2 2018-02-24 10:07:05 Direct Debit 8180.26
14 2018-02-27 20:08:53 Direct Debit 4610.26
CREATE TABLE `Lessons` (
`lesson_id` INTEGER PRIMARY KEY,
`customer_id` INTEGER NOT NULL,
`lesson_status_code` VARCHAR(15) NOT NULL,
`staff_id` INTEGER,
`vehicle_id` INTEGER NOT NULL,
`lesson_date` DATETIME,
`lesson_time` VARCHAR(10),
`price` DOUBLE NULL,
FOREIGN KEY (`vehicle_id` ) REFERENCES `Vehicles`(`vehicle_id` ),
FOREIGN KEY (`staff_id` ) REFERENCES `Staff`(`staff_id` ),
FOREIGN KEY (`customer_id` ) REFERENCES `Customers`(`customer_id` )
)
3 rows from Lessons table:
lesson_id customer_id lesson_status_code staff_id vehicle_id lesson_date lesson_time price
1 6 Cancelled 8 3 2018-02-28 10:55:36 5 199.0
2 8 Cancelled 14 3 2018-03-07 16:12:36 6 167.0
3 6 Cancelled 11 2 2018-03-03 15:10:16 3 352.0
|
driving_school | What is the total amount of moeny paid by the customer Carole Bernhard? | SELECT sum(T1.amount_payment) FROM Customer_Payments AS T1 JOIN Customers AS T2 ON T1.customer_id = T2.customer_id WHERE T2.first_name = "Carole" AND T2.last_name = "Bernhard" | CREATE TABLE `Addresses` (
`address_id` INTEGER PRIMARY KEY,
`line_1_number_building` VARCHAR(80),
`city` VARCHAR(50),
`zip_postcode` VARCHAR(20),
`state_province_county` VARCHAR(50),
`country` VARCHAR(50)
)
3 rows from Addresses table:
address_id line_1_number_building city zip_postcode state_province_county country
1 3904 Stroman Passage Port Melyssa 14445 Georgia USA
2 053 Quigley Island Hagenesfurt 22194 Kentucky USA
3 00704 Zoe Alley Lake Elaina 08938 Georgia USA
CREATE TABLE `Staff` (
`staff_id` INTEGER PRIMARY KEY,
`staff_address_id` INTEGER NOT NULL,
`nickname` VARCHAR(80),
`first_name` VARCHAR(80),
`middle_name` VARCHAR(80),
`last_name` VARCHAR(80),
`date_of_birth` DATETIME,
`date_joined_staff` DATETIME,
`date_left_staff` DATETIME,
FOREIGN KEY (`staff_address_id` ) REFERENCES `Addresses`(`address_id` )
)
3 rows from Staff table:
staff_id staff_address_id nickname first_name middle_name last_name date_of_birth date_joined_staff date_left_staff
1 14 thompson.constantin Janessa Amara Sawayn 2010-12-08 16:55:14 2017-04-27 03:21:26 2018-03-23 22:53:12
2 3 santos45 Camylle Icie Weissnat 2015-08-01 13:22:43 2016-06-06 08:54:28 2018-03-10 15:25:00
3 5 ynader Kaitlin Stephania Mertz 1994-05-17 05:32:11 2018-01-02 12:24:24 2018-03-24 10:11:08
CREATE TABLE `Vehicles` (
`vehicle_id` INTEGER PRIMARY KEY,
`vehicle_details` VARCHAR(255)
)
3 rows from Vehicles table:
vehicle_id vehicle_details
1 Van
2 Truck
3 Car
CREATE TABLE `Customers` (
`customer_id` INTEGER PRIMARY KEY,
`customer_address_id` INTEGER NOT NULL,
`customer_status_code` VARCHAR(15) NOT NULL,
`date_became_customer` DATETIME,
`date_of_birth` DATETIME,
`first_name` VARCHAR(80),
`last_name` VARCHAR(80),
`amount_outstanding` DOUBLE NULL,
`email_address` VARCHAR(250),
`phone_number` VARCHAR(255),
`cell_mobile_phone_number` VARCHAR(255),
FOREIGN KEY (`customer_address_id` ) REFERENCES `Addresses`(`address_id` )
)
3 rows from Customers table:
customer_id customer_address_id customer_status_code date_became_customer date_of_birth first_name last_name amount_outstanding email_address phone_number cell_mobile_phone_number
1 13 Bad Customer 2016-05-11 17:03:48 1998-12-15 13:24:40 Carole Bernhard 255.0 everette.goyette@example.org 07278206718 861-638-9797
2 10 Bad Customer 2015-11-16 22:52:14 1995-07-17 12:13:16 Genevieve Terry 7256.0 huel.jana@example.org +14(5)2351480248 578-518-4785x612
3 10 Good Customer 2016-04-08 00:28:15 1994-06-21 01:34:56 Clara Ortiz 9443.0 hilario.sporer@example.org 374-483-2758x85087 1-197-686-2849x8761
CREATE TABLE `Customer_Payments` (
`customer_id` INTEGER NOT NULL,
`datetime_payment` DATETIME NOT NULL,
`payment_method_code` VARCHAR(10) NOT NULL,
`amount_payment` DOUBLE NULL,
PRIMARY KEY (`customer_id`,`datetime_payment`),
FOREIGN KEY (`customer_id` ) REFERENCES `Customers`(`customer_id` )
)
3 rows from Customer_Payments table:
customer_id datetime_payment payment_method_code amount_payment
11 2018-02-05 18:44:46 Direct Debit 9570.93
2 2018-02-24 10:07:05 Direct Debit 8180.26
14 2018-02-27 20:08:53 Direct Debit 4610.26
CREATE TABLE `Lessons` (
`lesson_id` INTEGER PRIMARY KEY,
`customer_id` INTEGER NOT NULL,
`lesson_status_code` VARCHAR(15) NOT NULL,
`staff_id` INTEGER,
`vehicle_id` INTEGER NOT NULL,
`lesson_date` DATETIME,
`lesson_time` VARCHAR(10),
`price` DOUBLE NULL,
FOREIGN KEY (`vehicle_id` ) REFERENCES `Vehicles`(`vehicle_id` ),
FOREIGN KEY (`staff_id` ) REFERENCES `Staff`(`staff_id` ),
FOREIGN KEY (`customer_id` ) REFERENCES `Customers`(`customer_id` )
)
3 rows from Lessons table:
lesson_id customer_id lesson_status_code staff_id vehicle_id lesson_date lesson_time price
1 6 Cancelled 8 3 2018-02-28 10:55:36 5 199.0
2 8 Cancelled 14 3 2018-03-07 16:12:36 6 167.0
3 6 Cancelled 11 2 2018-03-03 15:10:16 3 352.0
|
driving_school | List the number of customers that did not have any payment history. | SELECT count(*) FROM Customers WHERE customer_id NOT IN ( SELECT customer_id FROM Customer_Payments ); | CREATE TABLE `Addresses` (
`address_id` INTEGER PRIMARY KEY,
`line_1_number_building` VARCHAR(80),
`city` VARCHAR(50),
`zip_postcode` VARCHAR(20),
`state_province_county` VARCHAR(50),
`country` VARCHAR(50)
)
3 rows from Addresses table:
address_id line_1_number_building city zip_postcode state_province_county country
1 3904 Stroman Passage Port Melyssa 14445 Georgia USA
2 053 Quigley Island Hagenesfurt 22194 Kentucky USA
3 00704 Zoe Alley Lake Elaina 08938 Georgia USA
CREATE TABLE `Staff` (
`staff_id` INTEGER PRIMARY KEY,
`staff_address_id` INTEGER NOT NULL,
`nickname` VARCHAR(80),
`first_name` VARCHAR(80),
`middle_name` VARCHAR(80),
`last_name` VARCHAR(80),
`date_of_birth` DATETIME,
`date_joined_staff` DATETIME,
`date_left_staff` DATETIME,
FOREIGN KEY (`staff_address_id` ) REFERENCES `Addresses`(`address_id` )
)
3 rows from Staff table:
staff_id staff_address_id nickname first_name middle_name last_name date_of_birth date_joined_staff date_left_staff
1 14 thompson.constantin Janessa Amara Sawayn 2010-12-08 16:55:14 2017-04-27 03:21:26 2018-03-23 22:53:12
2 3 santos45 Camylle Icie Weissnat 2015-08-01 13:22:43 2016-06-06 08:54:28 2018-03-10 15:25:00
3 5 ynader Kaitlin Stephania Mertz 1994-05-17 05:32:11 2018-01-02 12:24:24 2018-03-24 10:11:08
CREATE TABLE `Vehicles` (
`vehicle_id` INTEGER PRIMARY KEY,
`vehicle_details` VARCHAR(255)
)
3 rows from Vehicles table:
vehicle_id vehicle_details
1 Van
2 Truck
3 Car
CREATE TABLE `Customers` (
`customer_id` INTEGER PRIMARY KEY,
`customer_address_id` INTEGER NOT NULL,
`customer_status_code` VARCHAR(15) NOT NULL,
`date_became_customer` DATETIME,
`date_of_birth` DATETIME,
`first_name` VARCHAR(80),
`last_name` VARCHAR(80),
`amount_outstanding` DOUBLE NULL,
`email_address` VARCHAR(250),
`phone_number` VARCHAR(255),
`cell_mobile_phone_number` VARCHAR(255),
FOREIGN KEY (`customer_address_id` ) REFERENCES `Addresses`(`address_id` )
)
3 rows from Customers table:
customer_id customer_address_id customer_status_code date_became_customer date_of_birth first_name last_name amount_outstanding email_address phone_number cell_mobile_phone_number
1 13 Bad Customer 2016-05-11 17:03:48 1998-12-15 13:24:40 Carole Bernhard 255.0 everette.goyette@example.org 07278206718 861-638-9797
2 10 Bad Customer 2015-11-16 22:52:14 1995-07-17 12:13:16 Genevieve Terry 7256.0 huel.jana@example.org +14(5)2351480248 578-518-4785x612
3 10 Good Customer 2016-04-08 00:28:15 1994-06-21 01:34:56 Clara Ortiz 9443.0 hilario.sporer@example.org 374-483-2758x85087 1-197-686-2849x8761
CREATE TABLE `Customer_Payments` (
`customer_id` INTEGER NOT NULL,
`datetime_payment` DATETIME NOT NULL,
`payment_method_code` VARCHAR(10) NOT NULL,
`amount_payment` DOUBLE NULL,
PRIMARY KEY (`customer_id`,`datetime_payment`),
FOREIGN KEY (`customer_id` ) REFERENCES `Customers`(`customer_id` )
)
3 rows from Customer_Payments table:
customer_id datetime_payment payment_method_code amount_payment
11 2018-02-05 18:44:46 Direct Debit 9570.93
2 2018-02-24 10:07:05 Direct Debit 8180.26
14 2018-02-27 20:08:53 Direct Debit 4610.26
CREATE TABLE `Lessons` (
`lesson_id` INTEGER PRIMARY KEY,
`customer_id` INTEGER NOT NULL,
`lesson_status_code` VARCHAR(15) NOT NULL,
`staff_id` INTEGER,
`vehicle_id` INTEGER NOT NULL,
`lesson_date` DATETIME,
`lesson_time` VARCHAR(10),
`price` DOUBLE NULL,
FOREIGN KEY (`vehicle_id` ) REFERENCES `Vehicles`(`vehicle_id` ),
FOREIGN KEY (`staff_id` ) REFERENCES `Staff`(`staff_id` ),
FOREIGN KEY (`customer_id` ) REFERENCES `Customers`(`customer_id` )
)
3 rows from Lessons table:
lesson_id customer_id lesson_status_code staff_id vehicle_id lesson_date lesson_time price
1 6 Cancelled 8 3 2018-02-28 10:55:36 5 199.0
2 8 Cancelled 14 3 2018-03-07 16:12:36 6 167.0
3 6 Cancelled 11 2 2018-03-03 15:10:16 3 352.0
|
driving_school | How many customers have no payment histories? | SELECT count(*) FROM Customers WHERE customer_id NOT IN ( SELECT customer_id FROM Customer_Payments ); | CREATE TABLE `Addresses` (
`address_id` INTEGER PRIMARY KEY,
`line_1_number_building` VARCHAR(80),
`city` VARCHAR(50),
`zip_postcode` VARCHAR(20),
`state_province_county` VARCHAR(50),
`country` VARCHAR(50)
)
3 rows from Addresses table:
address_id line_1_number_building city zip_postcode state_province_county country
1 3904 Stroman Passage Port Melyssa 14445 Georgia USA
2 053 Quigley Island Hagenesfurt 22194 Kentucky USA
3 00704 Zoe Alley Lake Elaina 08938 Georgia USA
CREATE TABLE `Staff` (
`staff_id` INTEGER PRIMARY KEY,
`staff_address_id` INTEGER NOT NULL,
`nickname` VARCHAR(80),
`first_name` VARCHAR(80),
`middle_name` VARCHAR(80),
`last_name` VARCHAR(80),
`date_of_birth` DATETIME,
`date_joined_staff` DATETIME,
`date_left_staff` DATETIME,
FOREIGN KEY (`staff_address_id` ) REFERENCES `Addresses`(`address_id` )
)
3 rows from Staff table:
staff_id staff_address_id nickname first_name middle_name last_name date_of_birth date_joined_staff date_left_staff
1 14 thompson.constantin Janessa Amara Sawayn 2010-12-08 16:55:14 2017-04-27 03:21:26 2018-03-23 22:53:12
2 3 santos45 Camylle Icie Weissnat 2015-08-01 13:22:43 2016-06-06 08:54:28 2018-03-10 15:25:00
3 5 ynader Kaitlin Stephania Mertz 1994-05-17 05:32:11 2018-01-02 12:24:24 2018-03-24 10:11:08
CREATE TABLE `Vehicles` (
`vehicle_id` INTEGER PRIMARY KEY,
`vehicle_details` VARCHAR(255)
)
3 rows from Vehicles table:
vehicle_id vehicle_details
1 Van
2 Truck
3 Car
CREATE TABLE `Customers` (
`customer_id` INTEGER PRIMARY KEY,
`customer_address_id` INTEGER NOT NULL,
`customer_status_code` VARCHAR(15) NOT NULL,
`date_became_customer` DATETIME,
`date_of_birth` DATETIME,
`first_name` VARCHAR(80),
`last_name` VARCHAR(80),
`amount_outstanding` DOUBLE NULL,
`email_address` VARCHAR(250),
`phone_number` VARCHAR(255),
`cell_mobile_phone_number` VARCHAR(255),
FOREIGN KEY (`customer_address_id` ) REFERENCES `Addresses`(`address_id` )
)
3 rows from Customers table:
customer_id customer_address_id customer_status_code date_became_customer date_of_birth first_name last_name amount_outstanding email_address phone_number cell_mobile_phone_number
1 13 Bad Customer 2016-05-11 17:03:48 1998-12-15 13:24:40 Carole Bernhard 255.0 everette.goyette@example.org 07278206718 861-638-9797
2 10 Bad Customer 2015-11-16 22:52:14 1995-07-17 12:13:16 Genevieve Terry 7256.0 huel.jana@example.org +14(5)2351480248 578-518-4785x612
3 10 Good Customer 2016-04-08 00:28:15 1994-06-21 01:34:56 Clara Ortiz 9443.0 hilario.sporer@example.org 374-483-2758x85087 1-197-686-2849x8761
CREATE TABLE `Customer_Payments` (
`customer_id` INTEGER NOT NULL,
`datetime_payment` DATETIME NOT NULL,
`payment_method_code` VARCHAR(10) NOT NULL,
`amount_payment` DOUBLE NULL,
PRIMARY KEY (`customer_id`,`datetime_payment`),
FOREIGN KEY (`customer_id` ) REFERENCES `Customers`(`customer_id` )
)
3 rows from Customer_Payments table:
customer_id datetime_payment payment_method_code amount_payment
11 2018-02-05 18:44:46 Direct Debit 9570.93
2 2018-02-24 10:07:05 Direct Debit 8180.26
14 2018-02-27 20:08:53 Direct Debit 4610.26
CREATE TABLE `Lessons` (
`lesson_id` INTEGER PRIMARY KEY,
`customer_id` INTEGER NOT NULL,
`lesson_status_code` VARCHAR(15) NOT NULL,
`staff_id` INTEGER,
`vehicle_id` INTEGER NOT NULL,
`lesson_date` DATETIME,
`lesson_time` VARCHAR(10),
`price` DOUBLE NULL,
FOREIGN KEY (`vehicle_id` ) REFERENCES `Vehicles`(`vehicle_id` ),
FOREIGN KEY (`staff_id` ) REFERENCES `Staff`(`staff_id` ),
FOREIGN KEY (`customer_id` ) REFERENCES `Customers`(`customer_id` )
)
3 rows from Lessons table:
lesson_id customer_id lesson_status_code staff_id vehicle_id lesson_date lesson_time price
1 6 Cancelled 8 3 2018-02-28 10:55:36 5 199.0
2 8 Cancelled 14 3 2018-03-07 16:12:36 6 167.0
3 6 Cancelled 11 2 2018-03-03 15:10:16 3 352.0
|
driving_school | List first name and last name of customers that have more than 2 payments. | SELECT T2.first_name , T2.last_name FROM Customer_Payments AS T1 JOIN Customers AS T2 ON T1.customer_id = T2.customer_id GROUP BY T1.customer_id HAVING count(*) > 2; | CREATE TABLE `Addresses` (
`address_id` INTEGER PRIMARY KEY,
`line_1_number_building` VARCHAR(80),
`city` VARCHAR(50),
`zip_postcode` VARCHAR(20),
`state_province_county` VARCHAR(50),
`country` VARCHAR(50)
)
3 rows from Addresses table:
address_id line_1_number_building city zip_postcode state_province_county country
1 3904 Stroman Passage Port Melyssa 14445 Georgia USA
2 053 Quigley Island Hagenesfurt 22194 Kentucky USA
3 00704 Zoe Alley Lake Elaina 08938 Georgia USA
CREATE TABLE `Staff` (
`staff_id` INTEGER PRIMARY KEY,
`staff_address_id` INTEGER NOT NULL,
`nickname` VARCHAR(80),
`first_name` VARCHAR(80),
`middle_name` VARCHAR(80),
`last_name` VARCHAR(80),
`date_of_birth` DATETIME,
`date_joined_staff` DATETIME,
`date_left_staff` DATETIME,
FOREIGN KEY (`staff_address_id` ) REFERENCES `Addresses`(`address_id` )
)
3 rows from Staff table:
staff_id staff_address_id nickname first_name middle_name last_name date_of_birth date_joined_staff date_left_staff
1 14 thompson.constantin Janessa Amara Sawayn 2010-12-08 16:55:14 2017-04-27 03:21:26 2018-03-23 22:53:12
2 3 santos45 Camylle Icie Weissnat 2015-08-01 13:22:43 2016-06-06 08:54:28 2018-03-10 15:25:00
3 5 ynader Kaitlin Stephania Mertz 1994-05-17 05:32:11 2018-01-02 12:24:24 2018-03-24 10:11:08
CREATE TABLE `Vehicles` (
`vehicle_id` INTEGER PRIMARY KEY,
`vehicle_details` VARCHAR(255)
)
3 rows from Vehicles table:
vehicle_id vehicle_details
1 Van
2 Truck
3 Car
CREATE TABLE `Customers` (
`customer_id` INTEGER PRIMARY KEY,
`customer_address_id` INTEGER NOT NULL,
`customer_status_code` VARCHAR(15) NOT NULL,
`date_became_customer` DATETIME,
`date_of_birth` DATETIME,
`first_name` VARCHAR(80),
`last_name` VARCHAR(80),
`amount_outstanding` DOUBLE NULL,
`email_address` VARCHAR(250),
`phone_number` VARCHAR(255),
`cell_mobile_phone_number` VARCHAR(255),
FOREIGN KEY (`customer_address_id` ) REFERENCES `Addresses`(`address_id` )
)
3 rows from Customers table:
customer_id customer_address_id customer_status_code date_became_customer date_of_birth first_name last_name amount_outstanding email_address phone_number cell_mobile_phone_number
1 13 Bad Customer 2016-05-11 17:03:48 1998-12-15 13:24:40 Carole Bernhard 255.0 everette.goyette@example.org 07278206718 861-638-9797
2 10 Bad Customer 2015-11-16 22:52:14 1995-07-17 12:13:16 Genevieve Terry 7256.0 huel.jana@example.org +14(5)2351480248 578-518-4785x612
3 10 Good Customer 2016-04-08 00:28:15 1994-06-21 01:34:56 Clara Ortiz 9443.0 hilario.sporer@example.org 374-483-2758x85087 1-197-686-2849x8761
CREATE TABLE `Customer_Payments` (
`customer_id` INTEGER NOT NULL,
`datetime_payment` DATETIME NOT NULL,
`payment_method_code` VARCHAR(10) NOT NULL,
`amount_payment` DOUBLE NULL,
PRIMARY KEY (`customer_id`,`datetime_payment`),
FOREIGN KEY (`customer_id` ) REFERENCES `Customers`(`customer_id` )
)
3 rows from Customer_Payments table:
customer_id datetime_payment payment_method_code amount_payment
11 2018-02-05 18:44:46 Direct Debit 9570.93
2 2018-02-24 10:07:05 Direct Debit 8180.26
14 2018-02-27 20:08:53 Direct Debit 4610.26
CREATE TABLE `Lessons` (
`lesson_id` INTEGER PRIMARY KEY,
`customer_id` INTEGER NOT NULL,
`lesson_status_code` VARCHAR(15) NOT NULL,
`staff_id` INTEGER,
`vehicle_id` INTEGER NOT NULL,
`lesson_date` DATETIME,
`lesson_time` VARCHAR(10),
`price` DOUBLE NULL,
FOREIGN KEY (`vehicle_id` ) REFERENCES `Vehicles`(`vehicle_id` ),
FOREIGN KEY (`staff_id` ) REFERENCES `Staff`(`staff_id` ),
FOREIGN KEY (`customer_id` ) REFERENCES `Customers`(`customer_id` )
)
3 rows from Lessons table:
lesson_id customer_id lesson_status_code staff_id vehicle_id lesson_date lesson_time price
1 6 Cancelled 8 3 2018-02-28 10:55:36 5 199.0
2 8 Cancelled 14 3 2018-03-07 16:12:36 6 167.0
3 6 Cancelled 11 2 2018-03-03 15:10:16 3 352.0
|
driving_school | What are the first and last names of all customers with more than 2 payments? | SELECT T2.first_name , T2.last_name FROM Customer_Payments AS T1 JOIN Customers AS T2 ON T1.customer_id = T2.customer_id GROUP BY T1.customer_id HAVING count(*) > 2; | CREATE TABLE `Addresses` (
`address_id` INTEGER PRIMARY KEY,
`line_1_number_building` VARCHAR(80),
`city` VARCHAR(50),
`zip_postcode` VARCHAR(20),
`state_province_county` VARCHAR(50),
`country` VARCHAR(50)
)
3 rows from Addresses table:
address_id line_1_number_building city zip_postcode state_province_county country
1 3904 Stroman Passage Port Melyssa 14445 Georgia USA
2 053 Quigley Island Hagenesfurt 22194 Kentucky USA
3 00704 Zoe Alley Lake Elaina 08938 Georgia USA
CREATE TABLE `Staff` (
`staff_id` INTEGER PRIMARY KEY,
`staff_address_id` INTEGER NOT NULL,
`nickname` VARCHAR(80),
`first_name` VARCHAR(80),
`middle_name` VARCHAR(80),
`last_name` VARCHAR(80),
`date_of_birth` DATETIME,
`date_joined_staff` DATETIME,
`date_left_staff` DATETIME,
FOREIGN KEY (`staff_address_id` ) REFERENCES `Addresses`(`address_id` )
)
3 rows from Staff table:
staff_id staff_address_id nickname first_name middle_name last_name date_of_birth date_joined_staff date_left_staff
1 14 thompson.constantin Janessa Amara Sawayn 2010-12-08 16:55:14 2017-04-27 03:21:26 2018-03-23 22:53:12
2 3 santos45 Camylle Icie Weissnat 2015-08-01 13:22:43 2016-06-06 08:54:28 2018-03-10 15:25:00
3 5 ynader Kaitlin Stephania Mertz 1994-05-17 05:32:11 2018-01-02 12:24:24 2018-03-24 10:11:08
CREATE TABLE `Vehicles` (
`vehicle_id` INTEGER PRIMARY KEY,
`vehicle_details` VARCHAR(255)
)
3 rows from Vehicles table:
vehicle_id vehicle_details
1 Van
2 Truck
3 Car
CREATE TABLE `Customers` (
`customer_id` INTEGER PRIMARY KEY,
`customer_address_id` INTEGER NOT NULL,
`customer_status_code` VARCHAR(15) NOT NULL,
`date_became_customer` DATETIME,
`date_of_birth` DATETIME,
`first_name` VARCHAR(80),
`last_name` VARCHAR(80),
`amount_outstanding` DOUBLE NULL,
`email_address` VARCHAR(250),
`phone_number` VARCHAR(255),
`cell_mobile_phone_number` VARCHAR(255),
FOREIGN KEY (`customer_address_id` ) REFERENCES `Addresses`(`address_id` )
)
3 rows from Customers table:
customer_id customer_address_id customer_status_code date_became_customer date_of_birth first_name last_name amount_outstanding email_address phone_number cell_mobile_phone_number
1 13 Bad Customer 2016-05-11 17:03:48 1998-12-15 13:24:40 Carole Bernhard 255.0 everette.goyette@example.org 07278206718 861-638-9797
2 10 Bad Customer 2015-11-16 22:52:14 1995-07-17 12:13:16 Genevieve Terry 7256.0 huel.jana@example.org +14(5)2351480248 578-518-4785x612
3 10 Good Customer 2016-04-08 00:28:15 1994-06-21 01:34:56 Clara Ortiz 9443.0 hilario.sporer@example.org 374-483-2758x85087 1-197-686-2849x8761
CREATE TABLE `Customer_Payments` (
`customer_id` INTEGER NOT NULL,
`datetime_payment` DATETIME NOT NULL,
`payment_method_code` VARCHAR(10) NOT NULL,
`amount_payment` DOUBLE NULL,
PRIMARY KEY (`customer_id`,`datetime_payment`),
FOREIGN KEY (`customer_id` ) REFERENCES `Customers`(`customer_id` )
)
3 rows from Customer_Payments table:
customer_id datetime_payment payment_method_code amount_payment
11 2018-02-05 18:44:46 Direct Debit 9570.93
2 2018-02-24 10:07:05 Direct Debit 8180.26
14 2018-02-27 20:08:53 Direct Debit 4610.26
CREATE TABLE `Lessons` (
`lesson_id` INTEGER PRIMARY KEY,
`customer_id` INTEGER NOT NULL,
`lesson_status_code` VARCHAR(15) NOT NULL,
`staff_id` INTEGER,
`vehicle_id` INTEGER NOT NULL,
`lesson_date` DATETIME,
`lesson_time` VARCHAR(10),
`price` DOUBLE NULL,
FOREIGN KEY (`vehicle_id` ) REFERENCES `Vehicles`(`vehicle_id` ),
FOREIGN KEY (`staff_id` ) REFERENCES `Staff`(`staff_id` ),
FOREIGN KEY (`customer_id` ) REFERENCES `Customers`(`customer_id` )
)
3 rows from Lessons table:
lesson_id customer_id lesson_status_code staff_id vehicle_id lesson_date lesson_time price
1 6 Cancelled 8 3 2018-02-28 10:55:36 5 199.0
2 8 Cancelled 14 3 2018-03-07 16:12:36 6 167.0
3 6 Cancelled 11 2 2018-03-03 15:10:16 3 352.0
|
driving_school | List all payment methods and number of payments using each payment methods. | SELECT payment_method_code , count(*) FROM Customer_Payments GROUP BY payment_method_code; | CREATE TABLE `Addresses` (
`address_id` INTEGER PRIMARY KEY,
`line_1_number_building` VARCHAR(80),
`city` VARCHAR(50),
`zip_postcode` VARCHAR(20),
`state_province_county` VARCHAR(50),
`country` VARCHAR(50)
)
3 rows from Addresses table:
address_id line_1_number_building city zip_postcode state_province_county country
1 3904 Stroman Passage Port Melyssa 14445 Georgia USA
2 053 Quigley Island Hagenesfurt 22194 Kentucky USA
3 00704 Zoe Alley Lake Elaina 08938 Georgia USA
CREATE TABLE `Staff` (
`staff_id` INTEGER PRIMARY KEY,
`staff_address_id` INTEGER NOT NULL,
`nickname` VARCHAR(80),
`first_name` VARCHAR(80),
`middle_name` VARCHAR(80),
`last_name` VARCHAR(80),
`date_of_birth` DATETIME,
`date_joined_staff` DATETIME,
`date_left_staff` DATETIME,
FOREIGN KEY (`staff_address_id` ) REFERENCES `Addresses`(`address_id` )
)
3 rows from Staff table:
staff_id staff_address_id nickname first_name middle_name last_name date_of_birth date_joined_staff date_left_staff
1 14 thompson.constantin Janessa Amara Sawayn 2010-12-08 16:55:14 2017-04-27 03:21:26 2018-03-23 22:53:12
2 3 santos45 Camylle Icie Weissnat 2015-08-01 13:22:43 2016-06-06 08:54:28 2018-03-10 15:25:00
3 5 ynader Kaitlin Stephania Mertz 1994-05-17 05:32:11 2018-01-02 12:24:24 2018-03-24 10:11:08
CREATE TABLE `Vehicles` (
`vehicle_id` INTEGER PRIMARY KEY,
`vehicle_details` VARCHAR(255)
)
3 rows from Vehicles table:
vehicle_id vehicle_details
1 Van
2 Truck
3 Car
CREATE TABLE `Customers` (
`customer_id` INTEGER PRIMARY KEY,
`customer_address_id` INTEGER NOT NULL,
`customer_status_code` VARCHAR(15) NOT NULL,
`date_became_customer` DATETIME,
`date_of_birth` DATETIME,
`first_name` VARCHAR(80),
`last_name` VARCHAR(80),
`amount_outstanding` DOUBLE NULL,
`email_address` VARCHAR(250),
`phone_number` VARCHAR(255),
`cell_mobile_phone_number` VARCHAR(255),
FOREIGN KEY (`customer_address_id` ) REFERENCES `Addresses`(`address_id` )
)
3 rows from Customers table:
customer_id customer_address_id customer_status_code date_became_customer date_of_birth first_name last_name amount_outstanding email_address phone_number cell_mobile_phone_number
1 13 Bad Customer 2016-05-11 17:03:48 1998-12-15 13:24:40 Carole Bernhard 255.0 everette.goyette@example.org 07278206718 861-638-9797
2 10 Bad Customer 2015-11-16 22:52:14 1995-07-17 12:13:16 Genevieve Terry 7256.0 huel.jana@example.org +14(5)2351480248 578-518-4785x612
3 10 Good Customer 2016-04-08 00:28:15 1994-06-21 01:34:56 Clara Ortiz 9443.0 hilario.sporer@example.org 374-483-2758x85087 1-197-686-2849x8761
CREATE TABLE `Customer_Payments` (
`customer_id` INTEGER NOT NULL,
`datetime_payment` DATETIME NOT NULL,
`payment_method_code` VARCHAR(10) NOT NULL,
`amount_payment` DOUBLE NULL,
PRIMARY KEY (`customer_id`,`datetime_payment`),
FOREIGN KEY (`customer_id` ) REFERENCES `Customers`(`customer_id` )
)
3 rows from Customer_Payments table:
customer_id datetime_payment payment_method_code amount_payment
11 2018-02-05 18:44:46 Direct Debit 9570.93
2 2018-02-24 10:07:05 Direct Debit 8180.26
14 2018-02-27 20:08:53 Direct Debit 4610.26
CREATE TABLE `Lessons` (
`lesson_id` INTEGER PRIMARY KEY,
`customer_id` INTEGER NOT NULL,
`lesson_status_code` VARCHAR(15) NOT NULL,
`staff_id` INTEGER,
`vehicle_id` INTEGER NOT NULL,
`lesson_date` DATETIME,
`lesson_time` VARCHAR(10),
`price` DOUBLE NULL,
FOREIGN KEY (`vehicle_id` ) REFERENCES `Vehicles`(`vehicle_id` ),
FOREIGN KEY (`staff_id` ) REFERENCES `Staff`(`staff_id` ),
FOREIGN KEY (`customer_id` ) REFERENCES `Customers`(`customer_id` )
)
3 rows from Lessons table:
lesson_id customer_id lesson_status_code staff_id vehicle_id lesson_date lesson_time price
1 6 Cancelled 8 3 2018-02-28 10:55:36 5 199.0
2 8 Cancelled 14 3 2018-03-07 16:12:36 6 167.0
3 6 Cancelled 11 2 2018-03-03 15:10:16 3 352.0
|
driving_school | For each payment method, how many payments were made? | SELECT payment_method_code , count(*) FROM Customer_Payments GROUP BY payment_method_code; | CREATE TABLE `Addresses` (
`address_id` INTEGER PRIMARY KEY,
`line_1_number_building` VARCHAR(80),
`city` VARCHAR(50),
`zip_postcode` VARCHAR(20),
`state_province_county` VARCHAR(50),
`country` VARCHAR(50)
)
3 rows from Addresses table:
address_id line_1_number_building city zip_postcode state_province_county country
1 3904 Stroman Passage Port Melyssa 14445 Georgia USA
2 053 Quigley Island Hagenesfurt 22194 Kentucky USA
3 00704 Zoe Alley Lake Elaina 08938 Georgia USA
CREATE TABLE `Staff` (
`staff_id` INTEGER PRIMARY KEY,
`staff_address_id` INTEGER NOT NULL,
`nickname` VARCHAR(80),
`first_name` VARCHAR(80),
`middle_name` VARCHAR(80),
`last_name` VARCHAR(80),
`date_of_birth` DATETIME,
`date_joined_staff` DATETIME,
`date_left_staff` DATETIME,
FOREIGN KEY (`staff_address_id` ) REFERENCES `Addresses`(`address_id` )
)
3 rows from Staff table:
staff_id staff_address_id nickname first_name middle_name last_name date_of_birth date_joined_staff date_left_staff
1 14 thompson.constantin Janessa Amara Sawayn 2010-12-08 16:55:14 2017-04-27 03:21:26 2018-03-23 22:53:12
2 3 santos45 Camylle Icie Weissnat 2015-08-01 13:22:43 2016-06-06 08:54:28 2018-03-10 15:25:00
3 5 ynader Kaitlin Stephania Mertz 1994-05-17 05:32:11 2018-01-02 12:24:24 2018-03-24 10:11:08
CREATE TABLE `Vehicles` (
`vehicle_id` INTEGER PRIMARY KEY,
`vehicle_details` VARCHAR(255)
)
3 rows from Vehicles table:
vehicle_id vehicle_details
1 Van
2 Truck
3 Car
CREATE TABLE `Customers` (
`customer_id` INTEGER PRIMARY KEY,
`customer_address_id` INTEGER NOT NULL,
`customer_status_code` VARCHAR(15) NOT NULL,
`date_became_customer` DATETIME,
`date_of_birth` DATETIME,
`first_name` VARCHAR(80),
`last_name` VARCHAR(80),
`amount_outstanding` DOUBLE NULL,
`email_address` VARCHAR(250),
`phone_number` VARCHAR(255),
`cell_mobile_phone_number` VARCHAR(255),
FOREIGN KEY (`customer_address_id` ) REFERENCES `Addresses`(`address_id` )
)
3 rows from Customers table:
customer_id customer_address_id customer_status_code date_became_customer date_of_birth first_name last_name amount_outstanding email_address phone_number cell_mobile_phone_number
1 13 Bad Customer 2016-05-11 17:03:48 1998-12-15 13:24:40 Carole Bernhard 255.0 everette.goyette@example.org 07278206718 861-638-9797
2 10 Bad Customer 2015-11-16 22:52:14 1995-07-17 12:13:16 Genevieve Terry 7256.0 huel.jana@example.org +14(5)2351480248 578-518-4785x612
3 10 Good Customer 2016-04-08 00:28:15 1994-06-21 01:34:56 Clara Ortiz 9443.0 hilario.sporer@example.org 374-483-2758x85087 1-197-686-2849x8761
CREATE TABLE `Customer_Payments` (
`customer_id` INTEGER NOT NULL,
`datetime_payment` DATETIME NOT NULL,
`payment_method_code` VARCHAR(10) NOT NULL,
`amount_payment` DOUBLE NULL,
PRIMARY KEY (`customer_id`,`datetime_payment`),
FOREIGN KEY (`customer_id` ) REFERENCES `Customers`(`customer_id` )
)
3 rows from Customer_Payments table:
customer_id datetime_payment payment_method_code amount_payment
11 2018-02-05 18:44:46 Direct Debit 9570.93
2 2018-02-24 10:07:05 Direct Debit 8180.26
14 2018-02-27 20:08:53 Direct Debit 4610.26
CREATE TABLE `Lessons` (
`lesson_id` INTEGER PRIMARY KEY,
`customer_id` INTEGER NOT NULL,
`lesson_status_code` VARCHAR(15) NOT NULL,
`staff_id` INTEGER,
`vehicle_id` INTEGER NOT NULL,
`lesson_date` DATETIME,
`lesson_time` VARCHAR(10),
`price` DOUBLE NULL,
FOREIGN KEY (`vehicle_id` ) REFERENCES `Vehicles`(`vehicle_id` ),
FOREIGN KEY (`staff_id` ) REFERENCES `Staff`(`staff_id` ),
FOREIGN KEY (`customer_id` ) REFERENCES `Customers`(`customer_id` )
)
3 rows from Lessons table:
lesson_id customer_id lesson_status_code staff_id vehicle_id lesson_date lesson_time price
1 6 Cancelled 8 3 2018-02-28 10:55:36 5 199.0
2 8 Cancelled 14 3 2018-03-07 16:12:36 6 167.0
3 6 Cancelled 11 2 2018-03-03 15:10:16 3 352.0
|
driving_school | How many lessons were in cancelled state? | SELECT count(*) FROM Lessons WHERE lesson_status_code = "Cancelled"; | CREATE TABLE `Addresses` (
`address_id` INTEGER PRIMARY KEY,
`line_1_number_building` VARCHAR(80),
`city` VARCHAR(50),
`zip_postcode` VARCHAR(20),
`state_province_county` VARCHAR(50),
`country` VARCHAR(50)
)
3 rows from Addresses table:
address_id line_1_number_building city zip_postcode state_province_county country
1 3904 Stroman Passage Port Melyssa 14445 Georgia USA
2 053 Quigley Island Hagenesfurt 22194 Kentucky USA
3 00704 Zoe Alley Lake Elaina 08938 Georgia USA
CREATE TABLE `Staff` (
`staff_id` INTEGER PRIMARY KEY,
`staff_address_id` INTEGER NOT NULL,
`nickname` VARCHAR(80),
`first_name` VARCHAR(80),
`middle_name` VARCHAR(80),
`last_name` VARCHAR(80),
`date_of_birth` DATETIME,
`date_joined_staff` DATETIME,
`date_left_staff` DATETIME,
FOREIGN KEY (`staff_address_id` ) REFERENCES `Addresses`(`address_id` )
)
3 rows from Staff table:
staff_id staff_address_id nickname first_name middle_name last_name date_of_birth date_joined_staff date_left_staff
1 14 thompson.constantin Janessa Amara Sawayn 2010-12-08 16:55:14 2017-04-27 03:21:26 2018-03-23 22:53:12
2 3 santos45 Camylle Icie Weissnat 2015-08-01 13:22:43 2016-06-06 08:54:28 2018-03-10 15:25:00
3 5 ynader Kaitlin Stephania Mertz 1994-05-17 05:32:11 2018-01-02 12:24:24 2018-03-24 10:11:08
CREATE TABLE `Vehicles` (
`vehicle_id` INTEGER PRIMARY KEY,
`vehicle_details` VARCHAR(255)
)
3 rows from Vehicles table:
vehicle_id vehicle_details
1 Van
2 Truck
3 Car
CREATE TABLE `Customers` (
`customer_id` INTEGER PRIMARY KEY,
`customer_address_id` INTEGER NOT NULL,
`customer_status_code` VARCHAR(15) NOT NULL,
`date_became_customer` DATETIME,
`date_of_birth` DATETIME,
`first_name` VARCHAR(80),
`last_name` VARCHAR(80),
`amount_outstanding` DOUBLE NULL,
`email_address` VARCHAR(250),
`phone_number` VARCHAR(255),
`cell_mobile_phone_number` VARCHAR(255),
FOREIGN KEY (`customer_address_id` ) REFERENCES `Addresses`(`address_id` )
)
3 rows from Customers table:
customer_id customer_address_id customer_status_code date_became_customer date_of_birth first_name last_name amount_outstanding email_address phone_number cell_mobile_phone_number
1 13 Bad Customer 2016-05-11 17:03:48 1998-12-15 13:24:40 Carole Bernhard 255.0 everette.goyette@example.org 07278206718 861-638-9797
2 10 Bad Customer 2015-11-16 22:52:14 1995-07-17 12:13:16 Genevieve Terry 7256.0 huel.jana@example.org +14(5)2351480248 578-518-4785x612
3 10 Good Customer 2016-04-08 00:28:15 1994-06-21 01:34:56 Clara Ortiz 9443.0 hilario.sporer@example.org 374-483-2758x85087 1-197-686-2849x8761
CREATE TABLE `Customer_Payments` (
`customer_id` INTEGER NOT NULL,
`datetime_payment` DATETIME NOT NULL,
`payment_method_code` VARCHAR(10) NOT NULL,
`amount_payment` DOUBLE NULL,
PRIMARY KEY (`customer_id`,`datetime_payment`),
FOREIGN KEY (`customer_id` ) REFERENCES `Customers`(`customer_id` )
)
3 rows from Customer_Payments table:
customer_id datetime_payment payment_method_code amount_payment
11 2018-02-05 18:44:46 Direct Debit 9570.93
2 2018-02-24 10:07:05 Direct Debit 8180.26
14 2018-02-27 20:08:53 Direct Debit 4610.26
CREATE TABLE `Lessons` (
`lesson_id` INTEGER PRIMARY KEY,
`customer_id` INTEGER NOT NULL,
`lesson_status_code` VARCHAR(15) NOT NULL,
`staff_id` INTEGER,
`vehicle_id` INTEGER NOT NULL,
`lesson_date` DATETIME,
`lesson_time` VARCHAR(10),
`price` DOUBLE NULL,
FOREIGN KEY (`vehicle_id` ) REFERENCES `Vehicles`(`vehicle_id` ),
FOREIGN KEY (`staff_id` ) REFERENCES `Staff`(`staff_id` ),
FOREIGN KEY (`customer_id` ) REFERENCES `Customers`(`customer_id` )
)
3 rows from Lessons table:
lesson_id customer_id lesson_status_code staff_id vehicle_id lesson_date lesson_time price
1 6 Cancelled 8 3 2018-02-28 10:55:36 5 199.0
2 8 Cancelled 14 3 2018-03-07 16:12:36 6 167.0
3 6 Cancelled 11 2 2018-03-03 15:10:16 3 352.0
|
driving_school | How many lessons have been cancelled? | SELECT count(*) FROM Lessons WHERE lesson_status_code = "Cancelled"; | CREATE TABLE `Addresses` (
`address_id` INTEGER PRIMARY KEY,
`line_1_number_building` VARCHAR(80),
`city` VARCHAR(50),
`zip_postcode` VARCHAR(20),
`state_province_county` VARCHAR(50),
`country` VARCHAR(50)
)
3 rows from Addresses table:
address_id line_1_number_building city zip_postcode state_province_county country
1 3904 Stroman Passage Port Melyssa 14445 Georgia USA
2 053 Quigley Island Hagenesfurt 22194 Kentucky USA
3 00704 Zoe Alley Lake Elaina 08938 Georgia USA
CREATE TABLE `Staff` (
`staff_id` INTEGER PRIMARY KEY,
`staff_address_id` INTEGER NOT NULL,
`nickname` VARCHAR(80),
`first_name` VARCHAR(80),
`middle_name` VARCHAR(80),
`last_name` VARCHAR(80),
`date_of_birth` DATETIME,
`date_joined_staff` DATETIME,
`date_left_staff` DATETIME,
FOREIGN KEY (`staff_address_id` ) REFERENCES `Addresses`(`address_id` )
)
3 rows from Staff table:
staff_id staff_address_id nickname first_name middle_name last_name date_of_birth date_joined_staff date_left_staff
1 14 thompson.constantin Janessa Amara Sawayn 2010-12-08 16:55:14 2017-04-27 03:21:26 2018-03-23 22:53:12
2 3 santos45 Camylle Icie Weissnat 2015-08-01 13:22:43 2016-06-06 08:54:28 2018-03-10 15:25:00
3 5 ynader Kaitlin Stephania Mertz 1994-05-17 05:32:11 2018-01-02 12:24:24 2018-03-24 10:11:08
CREATE TABLE `Vehicles` (
`vehicle_id` INTEGER PRIMARY KEY,
`vehicle_details` VARCHAR(255)
)
3 rows from Vehicles table:
vehicle_id vehicle_details
1 Van
2 Truck
3 Car
CREATE TABLE `Customers` (
`customer_id` INTEGER PRIMARY KEY,
`customer_address_id` INTEGER NOT NULL,
`customer_status_code` VARCHAR(15) NOT NULL,
`date_became_customer` DATETIME,
`date_of_birth` DATETIME,
`first_name` VARCHAR(80),
`last_name` VARCHAR(80),
`amount_outstanding` DOUBLE NULL,
`email_address` VARCHAR(250),
`phone_number` VARCHAR(255),
`cell_mobile_phone_number` VARCHAR(255),
FOREIGN KEY (`customer_address_id` ) REFERENCES `Addresses`(`address_id` )
)
3 rows from Customers table:
customer_id customer_address_id customer_status_code date_became_customer date_of_birth first_name last_name amount_outstanding email_address phone_number cell_mobile_phone_number
1 13 Bad Customer 2016-05-11 17:03:48 1998-12-15 13:24:40 Carole Bernhard 255.0 everette.goyette@example.org 07278206718 861-638-9797
2 10 Bad Customer 2015-11-16 22:52:14 1995-07-17 12:13:16 Genevieve Terry 7256.0 huel.jana@example.org +14(5)2351480248 578-518-4785x612
3 10 Good Customer 2016-04-08 00:28:15 1994-06-21 01:34:56 Clara Ortiz 9443.0 hilario.sporer@example.org 374-483-2758x85087 1-197-686-2849x8761
CREATE TABLE `Customer_Payments` (
`customer_id` INTEGER NOT NULL,
`datetime_payment` DATETIME NOT NULL,
`payment_method_code` VARCHAR(10) NOT NULL,
`amount_payment` DOUBLE NULL,
PRIMARY KEY (`customer_id`,`datetime_payment`),
FOREIGN KEY (`customer_id` ) REFERENCES `Customers`(`customer_id` )
)
3 rows from Customer_Payments table:
customer_id datetime_payment payment_method_code amount_payment
11 2018-02-05 18:44:46 Direct Debit 9570.93
2 2018-02-24 10:07:05 Direct Debit 8180.26
14 2018-02-27 20:08:53 Direct Debit 4610.26
CREATE TABLE `Lessons` (
`lesson_id` INTEGER PRIMARY KEY,
`customer_id` INTEGER NOT NULL,
`lesson_status_code` VARCHAR(15) NOT NULL,
`staff_id` INTEGER,
`vehicle_id` INTEGER NOT NULL,
`lesson_date` DATETIME,
`lesson_time` VARCHAR(10),
`price` DOUBLE NULL,
FOREIGN KEY (`vehicle_id` ) REFERENCES `Vehicles`(`vehicle_id` ),
FOREIGN KEY (`staff_id` ) REFERENCES `Staff`(`staff_id` ),
FOREIGN KEY (`customer_id` ) REFERENCES `Customers`(`customer_id` )
)
3 rows from Lessons table:
lesson_id customer_id lesson_status_code staff_id vehicle_id lesson_date lesson_time price
1 6 Cancelled 8 3 2018-02-28 10:55:36 5 199.0
2 8 Cancelled 14 3 2018-03-07 16:12:36 6 167.0
3 6 Cancelled 11 2 2018-03-03 15:10:16 3 352.0
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.