db_id
stringclasses 127
values | query
stringlengths 20
523
| question
stringlengths 16
224
| schema
stringclasses 127
values |
---|---|---|---|
ship_1
|
SELECT count(DISTINCT rank) FROM captain
|
How many different captain ranks are there?
|
CREATE TABLE "captain" (
"Captain_ID" int,
"Name" text,
"Ship_ID" int,
"age" text,
"Class" text,
"Rank" text,
PRIMARY KEY ("Captain_ID"),
FOREIGN KEY ("Ship_ID") REFERENCES "Ship"("Ship_ID")
);
CREATE TABLE "Ship" (
"Ship_ID" int,
"Name" text,
"Type" text,
"Built_Year" real,
"Class" text,
"Flag" text,
PRIMARY KEY ("Ship_ID")
);
INSERT INTO "Ship" VALUES (1,"HMS Manxman","Panamax","1997","KR","Panama");
INSERT INTO "captain" VALUES (1,"Captain Sir Henry Langford",1,"40","Third-rate ship of the line","Midshipman");
|
ship_1
|
SELECT count(DISTINCT rank) FROM captain
|
Count the number of different ranks of captain.
|
CREATE TABLE "captain" (
"Captain_ID" int,
"Name" text,
"Ship_ID" int,
"age" text,
"Class" text,
"Rank" text,
PRIMARY KEY ("Captain_ID"),
FOREIGN KEY ("Ship_ID") REFERENCES "Ship"("Ship_ID")
);
CREATE TABLE "Ship" (
"Ship_ID" int,
"Name" text,
"Type" text,
"Built_Year" real,
"Class" text,
"Flag" text,
PRIMARY KEY ("Ship_ID")
);
INSERT INTO "Ship" VALUES (1,"HMS Manxman","Panamax","1997","KR","Panama");
INSERT INTO "captain" VALUES (1,"Captain Sir Henry Langford",1,"40","Third-rate ship of the line","Midshipman");
|
ship_1
|
SELECT count(*) , rank FROM captain GROUP BY rank
|
How many captains are in each rank?
|
CREATE TABLE "captain" (
"Captain_ID" int,
"Name" text,
"Ship_ID" int,
"age" text,
"Class" text,
"Rank" text,
PRIMARY KEY ("Captain_ID"),
FOREIGN KEY ("Ship_ID") REFERENCES "Ship"("Ship_ID")
);
CREATE TABLE "Ship" (
"Ship_ID" int,
"Name" text,
"Type" text,
"Built_Year" real,
"Class" text,
"Flag" text,
PRIMARY KEY ("Ship_ID")
);
INSERT INTO "Ship" VALUES (1,"HMS Manxman","Panamax","1997","KR","Panama");
INSERT INTO "captain" VALUES (1,"Captain Sir Henry Langford",1,"40","Third-rate ship of the line","Midshipman");
|
ship_1
|
SELECT count(*) , rank FROM captain GROUP BY rank
|
Count the number of captains that have each rank.
|
CREATE TABLE "captain" (
"Captain_ID" int,
"Name" text,
"Ship_ID" int,
"age" text,
"Class" text,
"Rank" text,
PRIMARY KEY ("Captain_ID"),
FOREIGN KEY ("Ship_ID") REFERENCES "Ship"("Ship_ID")
);
CREATE TABLE "Ship" (
"Ship_ID" int,
"Name" text,
"Type" text,
"Built_Year" real,
"Class" text,
"Flag" text,
PRIMARY KEY ("Ship_ID")
);
INSERT INTO "Ship" VALUES (1,"HMS Manxman","Panamax","1997","KR","Panama");
INSERT INTO "captain" VALUES (1,"Captain Sir Henry Langford",1,"40","Third-rate ship of the line","Midshipman");
|
ship_1
|
SELECT count(*) , rank FROM captain WHERE age < 50 GROUP BY rank
|
How many captains with younger than 50 are in each rank?
|
CREATE TABLE "captain" (
"Captain_ID" int,
"Name" text,
"Ship_ID" int,
"age" text,
"Class" text,
"Rank" text,
PRIMARY KEY ("Captain_ID"),
FOREIGN KEY ("Ship_ID") REFERENCES "Ship"("Ship_ID")
);
CREATE TABLE "Ship" (
"Ship_ID" int,
"Name" text,
"Type" text,
"Built_Year" real,
"Class" text,
"Flag" text,
PRIMARY KEY ("Ship_ID")
);
INSERT INTO "Ship" VALUES (1,"HMS Manxman","Panamax","1997","KR","Panama");
INSERT INTO "captain" VALUES (1,"Captain Sir Henry Langford",1,"40","Third-rate ship of the line","Midshipman");
|
ship_1
|
SELECT count(*) , rank FROM captain WHERE age < 50 GROUP BY rank
|
Count the number of captains younger than 50 of each rank.
|
CREATE TABLE "captain" (
"Captain_ID" int,
"Name" text,
"Ship_ID" int,
"age" text,
"Class" text,
"Rank" text,
PRIMARY KEY ("Captain_ID"),
FOREIGN KEY ("Ship_ID") REFERENCES "Ship"("Ship_ID")
);
CREATE TABLE "Ship" (
"Ship_ID" int,
"Name" text,
"Type" text,
"Built_Year" real,
"Class" text,
"Flag" text,
PRIMARY KEY ("Ship_ID")
);
INSERT INTO "Ship" VALUES (1,"HMS Manxman","Panamax","1997","KR","Panama");
INSERT INTO "captain" VALUES (1,"Captain Sir Henry Langford",1,"40","Third-rate ship of the line","Midshipman");
|
ship_1
|
SELECT name FROM captain ORDER BY age DESC
|
Sort all captain names by their ages from old to young.
|
CREATE TABLE "captain" (
"Captain_ID" int,
"Name" text,
"Ship_ID" int,
"age" text,
"Class" text,
"Rank" text,
PRIMARY KEY ("Captain_ID"),
FOREIGN KEY ("Ship_ID") REFERENCES "Ship"("Ship_ID")
);
CREATE TABLE "Ship" (
"Ship_ID" int,
"Name" text,
"Type" text,
"Built_Year" real,
"Class" text,
"Flag" text,
PRIMARY KEY ("Ship_ID")
);
INSERT INTO "Ship" VALUES (1,"HMS Manxman","Panamax","1997","KR","Panama");
INSERT INTO "captain" VALUES (1,"Captain Sir Henry Langford",1,"40","Third-rate ship of the line","Midshipman");
|
ship_1
|
SELECT name FROM captain ORDER BY age DESC
|
What are the names of captains, sorted by age descending?
|
CREATE TABLE "captain" (
"Captain_ID" int,
"Name" text,
"Ship_ID" int,
"age" text,
"Class" text,
"Rank" text,
PRIMARY KEY ("Captain_ID"),
FOREIGN KEY ("Ship_ID") REFERENCES "Ship"("Ship_ID")
);
CREATE TABLE "Ship" (
"Ship_ID" int,
"Name" text,
"Type" text,
"Built_Year" real,
"Class" text,
"Flag" text,
PRIMARY KEY ("Ship_ID")
);
INSERT INTO "Ship" VALUES (1,"HMS Manxman","Panamax","1997","KR","Panama");
INSERT INTO "captain" VALUES (1,"Captain Sir Henry Langford",1,"40","Third-rate ship of the line","Midshipman");
|
ship_1
|
SELECT name , CLASS , rank FROM captain
|
Find the name, class and rank of all captains.
|
CREATE TABLE "captain" (
"Captain_ID" int,
"Name" text,
"Ship_ID" int,
"age" text,
"Class" text,
"Rank" text,
PRIMARY KEY ("Captain_ID"),
FOREIGN KEY ("Ship_ID") REFERENCES "Ship"("Ship_ID")
);
CREATE TABLE "Ship" (
"Ship_ID" int,
"Name" text,
"Type" text,
"Built_Year" real,
"Class" text,
"Flag" text,
PRIMARY KEY ("Ship_ID")
);
INSERT INTO "Ship" VALUES (1,"HMS Manxman","Panamax","1997","KR","Panama");
INSERT INTO "captain" VALUES (1,"Captain Sir Henry Langford",1,"40","Third-rate ship of the line","Midshipman");
|
ship_1
|
SELECT name , CLASS , rank FROM captain
|
What are the names, classes, and ranks of all captains?
|
CREATE TABLE "captain" (
"Captain_ID" int,
"Name" text,
"Ship_ID" int,
"age" text,
"Class" text,
"Rank" text,
PRIMARY KEY ("Captain_ID"),
FOREIGN KEY ("Ship_ID") REFERENCES "Ship"("Ship_ID")
);
CREATE TABLE "Ship" (
"Ship_ID" int,
"Name" text,
"Type" text,
"Built_Year" real,
"Class" text,
"Flag" text,
PRIMARY KEY ("Ship_ID")
);
INSERT INTO "Ship" VALUES (1,"HMS Manxman","Panamax","1997","KR","Panama");
INSERT INTO "captain" VALUES (1,"Captain Sir Henry Langford",1,"40","Third-rate ship of the line","Midshipman");
|
ship_1
|
SELECT rank FROM captain GROUP BY rank ORDER BY count(*) DESC LIMIT 1
|
Which rank is the most common among captains?
|
CREATE TABLE "captain" (
"Captain_ID" int,
"Name" text,
"Ship_ID" int,
"age" text,
"Class" text,
"Rank" text,
PRIMARY KEY ("Captain_ID"),
FOREIGN KEY ("Ship_ID") REFERENCES "Ship"("Ship_ID")
);
CREATE TABLE "Ship" (
"Ship_ID" int,
"Name" text,
"Type" text,
"Built_Year" real,
"Class" text,
"Flag" text,
PRIMARY KEY ("Ship_ID")
);
INSERT INTO "Ship" VALUES (1,"HMS Manxman","Panamax","1997","KR","Panama");
INSERT INTO "captain" VALUES (1,"Captain Sir Henry Langford",1,"40","Third-rate ship of the line","Midshipman");
|
ship_1
|
SELECT rank FROM captain GROUP BY rank ORDER BY count(*) DESC LIMIT 1
|
Return the rank for which there are the fewest captains.
|
CREATE TABLE "captain" (
"Captain_ID" int,
"Name" text,
"Ship_ID" int,
"age" text,
"Class" text,
"Rank" text,
PRIMARY KEY ("Captain_ID"),
FOREIGN KEY ("Ship_ID") REFERENCES "Ship"("Ship_ID")
);
CREATE TABLE "Ship" (
"Ship_ID" int,
"Name" text,
"Type" text,
"Built_Year" real,
"Class" text,
"Flag" text,
PRIMARY KEY ("Ship_ID")
);
INSERT INTO "Ship" VALUES (1,"HMS Manxman","Panamax","1997","KR","Panama");
INSERT INTO "captain" VALUES (1,"Captain Sir Henry Langford",1,"40","Third-rate ship of the line","Midshipman");
|
ship_1
|
SELECT CLASS FROM captain GROUP BY CLASS HAVING count(*) > 2
|
Which classes have more than two captains?
|
CREATE TABLE "captain" (
"Captain_ID" int,
"Name" text,
"Ship_ID" int,
"age" text,
"Class" text,
"Rank" text,
PRIMARY KEY ("Captain_ID"),
FOREIGN KEY ("Ship_ID") REFERENCES "Ship"("Ship_ID")
);
CREATE TABLE "Ship" (
"Ship_ID" int,
"Name" text,
"Type" text,
"Built_Year" real,
"Class" text,
"Flag" text,
PRIMARY KEY ("Ship_ID")
);
INSERT INTO "Ship" VALUES (1,"HMS Manxman","Panamax","1997","KR","Panama");
INSERT INTO "captain" VALUES (1,"Captain Sir Henry Langford",1,"40","Third-rate ship of the line","Midshipman");
|
ship_1
|
SELECT CLASS FROM captain GROUP BY CLASS HAVING count(*) > 2
|
Give the classes that have more than two captains.
|
CREATE TABLE "captain" (
"Captain_ID" int,
"Name" text,
"Ship_ID" int,
"age" text,
"Class" text,
"Rank" text,
PRIMARY KEY ("Captain_ID"),
FOREIGN KEY ("Ship_ID") REFERENCES "Ship"("Ship_ID")
);
CREATE TABLE "Ship" (
"Ship_ID" int,
"Name" text,
"Type" text,
"Built_Year" real,
"Class" text,
"Flag" text,
PRIMARY KEY ("Ship_ID")
);
INSERT INTO "Ship" VALUES (1,"HMS Manxman","Panamax","1997","KR","Panama");
INSERT INTO "captain" VALUES (1,"Captain Sir Henry Langford",1,"40","Third-rate ship of the line","Midshipman");
|
ship_1
|
SELECT name FROM captain WHERE rank = 'Midshipman' OR rank = 'Lieutenant'
|
Find the name of captains whose rank are either Midshipman or Lieutenant.
|
CREATE TABLE "captain" (
"Captain_ID" int,
"Name" text,
"Ship_ID" int,
"age" text,
"Class" text,
"Rank" text,
PRIMARY KEY ("Captain_ID"),
FOREIGN KEY ("Ship_ID") REFERENCES "Ship"("Ship_ID")
);
CREATE TABLE "Ship" (
"Ship_ID" int,
"Name" text,
"Type" text,
"Built_Year" real,
"Class" text,
"Flag" text,
PRIMARY KEY ("Ship_ID")
);
INSERT INTO "Ship" VALUES (1,"HMS Manxman","Panamax","1997","KR","Panama");
INSERT INTO "captain" VALUES (1,"Captain Sir Henry Langford",1,"40","Third-rate ship of the line","Midshipman");
|
ship_1
|
SELECT name FROM captain WHERE rank = 'Midshipman' OR rank = 'Lieutenant'
|
What are the names of captains that have either the rank Midshipman or Lieutenant?
|
CREATE TABLE "captain" (
"Captain_ID" int,
"Name" text,
"Ship_ID" int,
"age" text,
"Class" text,
"Rank" text,
PRIMARY KEY ("Captain_ID"),
FOREIGN KEY ("Ship_ID") REFERENCES "Ship"("Ship_ID")
);
CREATE TABLE "Ship" (
"Ship_ID" int,
"Name" text,
"Type" text,
"Built_Year" real,
"Class" text,
"Flag" text,
PRIMARY KEY ("Ship_ID")
);
INSERT INTO "Ship" VALUES (1,"HMS Manxman","Panamax","1997","KR","Panama");
INSERT INTO "captain" VALUES (1,"Captain Sir Henry Langford",1,"40","Third-rate ship of the line","Midshipman");
|
ship_1
|
SELECT avg(age) , min(age) , CLASS FROM captain GROUP BY CLASS
|
What are the average and minimum age of captains in different class?
|
CREATE TABLE "captain" (
"Captain_ID" int,
"Name" text,
"Ship_ID" int,
"age" text,
"Class" text,
"Rank" text,
PRIMARY KEY ("Captain_ID"),
FOREIGN KEY ("Ship_ID") REFERENCES "Ship"("Ship_ID")
);
CREATE TABLE "Ship" (
"Ship_ID" int,
"Name" text,
"Type" text,
"Built_Year" real,
"Class" text,
"Flag" text,
PRIMARY KEY ("Ship_ID")
);
INSERT INTO "Ship" VALUES (1,"HMS Manxman","Panamax","1997","KR","Panama");
INSERT INTO "captain" VALUES (1,"Captain Sir Henry Langford",1,"40","Third-rate ship of the line","Midshipman");
|
ship_1
|
SELECT avg(age) , min(age) , CLASS FROM captain GROUP BY CLASS
|
Return the average and minimum age of captains in each class.
|
CREATE TABLE "captain" (
"Captain_ID" int,
"Name" text,
"Ship_ID" int,
"age" text,
"Class" text,
"Rank" text,
PRIMARY KEY ("Captain_ID"),
FOREIGN KEY ("Ship_ID") REFERENCES "Ship"("Ship_ID")
);
CREATE TABLE "Ship" (
"Ship_ID" int,
"Name" text,
"Type" text,
"Built_Year" real,
"Class" text,
"Flag" text,
PRIMARY KEY ("Ship_ID")
);
INSERT INTO "Ship" VALUES (1,"HMS Manxman","Panamax","1997","KR","Panama");
INSERT INTO "captain" VALUES (1,"Captain Sir Henry Langford",1,"40","Third-rate ship of the line","Midshipman");
|
ship_1
|
SELECT rank FROM captain WHERE CLASS = 'Cutter' INTERSECT SELECT rank FROM captain WHERE CLASS = 'Armed schooner'
|
Find the captain rank that has some captains in both Cutter and Armed schooner classes.
|
CREATE TABLE "captain" (
"Captain_ID" int,
"Name" text,
"Ship_ID" int,
"age" text,
"Class" text,
"Rank" text,
PRIMARY KEY ("Captain_ID"),
FOREIGN KEY ("Ship_ID") REFERENCES "Ship"("Ship_ID")
);
CREATE TABLE "Ship" (
"Ship_ID" int,
"Name" text,
"Type" text,
"Built_Year" real,
"Class" text,
"Flag" text,
PRIMARY KEY ("Ship_ID")
);
INSERT INTO "Ship" VALUES (1,"HMS Manxman","Panamax","1997","KR","Panama");
INSERT INTO "captain" VALUES (1,"Captain Sir Henry Langford",1,"40","Third-rate ship of the line","Midshipman");
|
ship_1
|
SELECT rank FROM captain WHERE CLASS = 'Cutter' INTERSECT SELECT rank FROM captain WHERE CLASS = 'Armed schooner'
|
What are the ranks of captains that are both in the Cutter and Armed schooner classes?
|
CREATE TABLE "captain" (
"Captain_ID" int,
"Name" text,
"Ship_ID" int,
"age" text,
"Class" text,
"Rank" text,
PRIMARY KEY ("Captain_ID"),
FOREIGN KEY ("Ship_ID") REFERENCES "Ship"("Ship_ID")
);
CREATE TABLE "Ship" (
"Ship_ID" int,
"Name" text,
"Type" text,
"Built_Year" real,
"Class" text,
"Flag" text,
PRIMARY KEY ("Ship_ID")
);
INSERT INTO "Ship" VALUES (1,"HMS Manxman","Panamax","1997","KR","Panama");
INSERT INTO "captain" VALUES (1,"Captain Sir Henry Langford",1,"40","Third-rate ship of the line","Midshipman");
|
ship_1
|
SELECT rank FROM captain EXCEPT SELECT rank FROM captain WHERE CLASS = 'Third-rate ship of the line'
|
Find the captain rank that has no captain in Third-rate ship of the line class.
|
CREATE TABLE "captain" (
"Captain_ID" int,
"Name" text,
"Ship_ID" int,
"age" text,
"Class" text,
"Rank" text,
PRIMARY KEY ("Captain_ID"),
FOREIGN KEY ("Ship_ID") REFERENCES "Ship"("Ship_ID")
);
CREATE TABLE "Ship" (
"Ship_ID" int,
"Name" text,
"Type" text,
"Built_Year" real,
"Class" text,
"Flag" text,
PRIMARY KEY ("Ship_ID")
);
INSERT INTO "Ship" VALUES (1,"HMS Manxman","Panamax","1997","KR","Panama");
INSERT INTO "captain" VALUES (1,"Captain Sir Henry Langford",1,"40","Third-rate ship of the line","Midshipman");
|
ship_1
|
SELECT rank FROM captain EXCEPT SELECT rank FROM captain WHERE CLASS = 'Third-rate ship of the line'
|
What are the ranks of captains that have no captain that are in the Third-rate ship of the line class?
|
CREATE TABLE "captain" (
"Captain_ID" int,
"Name" text,
"Ship_ID" int,
"age" text,
"Class" text,
"Rank" text,
PRIMARY KEY ("Captain_ID"),
FOREIGN KEY ("Ship_ID") REFERENCES "Ship"("Ship_ID")
);
CREATE TABLE "Ship" (
"Ship_ID" int,
"Name" text,
"Type" text,
"Built_Year" real,
"Class" text,
"Flag" text,
PRIMARY KEY ("Ship_ID")
);
INSERT INTO "Ship" VALUES (1,"HMS Manxman","Panamax","1997","KR","Panama");
INSERT INTO "captain" VALUES (1,"Captain Sir Henry Langford",1,"40","Third-rate ship of the line","Midshipman");
|
ship_1
|
SELECT name FROM captain ORDER BY age LIMIT 1
|
What is the name of the youngest captain?
|
CREATE TABLE "captain" (
"Captain_ID" int,
"Name" text,
"Ship_ID" int,
"age" text,
"Class" text,
"Rank" text,
PRIMARY KEY ("Captain_ID"),
FOREIGN KEY ("Ship_ID") REFERENCES "Ship"("Ship_ID")
);
CREATE TABLE "Ship" (
"Ship_ID" int,
"Name" text,
"Type" text,
"Built_Year" real,
"Class" text,
"Flag" text,
PRIMARY KEY ("Ship_ID")
);
INSERT INTO "Ship" VALUES (1,"HMS Manxman","Panamax","1997","KR","Panama");
INSERT INTO "captain" VALUES (1,"Captain Sir Henry Langford",1,"40","Third-rate ship of the line","Midshipman");
|
ship_1
|
SELECT name FROM captain ORDER BY age LIMIT 1
|
Return the name of the youngest captain.
|
CREATE TABLE "captain" (
"Captain_ID" int,
"Name" text,
"Ship_ID" int,
"age" text,
"Class" text,
"Rank" text,
PRIMARY KEY ("Captain_ID"),
FOREIGN KEY ("Ship_ID") REFERENCES "Ship"("Ship_ID")
);
CREATE TABLE "Ship" (
"Ship_ID" int,
"Name" text,
"Type" text,
"Built_Year" real,
"Class" text,
"Flag" text,
PRIMARY KEY ("Ship_ID")
);
INSERT INTO "Ship" VALUES (1,"HMS Manxman","Panamax","1997","KR","Panama");
INSERT INTO "captain" VALUES (1,"Captain Sir Henry Langford",1,"40","Third-rate ship of the line","Midshipman");
|
ship_1
|
SELECT count(*) FROM ship
|
how many ships are there?
|
CREATE TABLE "captain" (
"Captain_ID" int,
"Name" text,
"Ship_ID" int,
"age" text,
"Class" text,
"Rank" text,
PRIMARY KEY ("Captain_ID"),
FOREIGN KEY ("Ship_ID") REFERENCES "Ship"("Ship_ID")
);
CREATE TABLE "Ship" (
"Ship_ID" int,
"Name" text,
"Type" text,
"Built_Year" real,
"Class" text,
"Flag" text,
PRIMARY KEY ("Ship_ID")
);
INSERT INTO "Ship" VALUES (1,"HMS Manxman","Panamax","1997","KR","Panama");
INSERT INTO "captain" VALUES (1,"Captain Sir Henry Langford",1,"40","Third-rate ship of the line","Midshipman");
|
ship_1
|
SELECT count(*) FROM ship
|
Count the number of ships.
|
CREATE TABLE "captain" (
"Captain_ID" int,
"Name" text,
"Ship_ID" int,
"age" text,
"Class" text,
"Rank" text,
PRIMARY KEY ("Captain_ID"),
FOREIGN KEY ("Ship_ID") REFERENCES "Ship"("Ship_ID")
);
CREATE TABLE "Ship" (
"Ship_ID" int,
"Name" text,
"Type" text,
"Built_Year" real,
"Class" text,
"Flag" text,
PRIMARY KEY ("Ship_ID")
);
INSERT INTO "Ship" VALUES (1,"HMS Manxman","Panamax","1997","KR","Panama");
INSERT INTO "captain" VALUES (1,"Captain Sir Henry Langford",1,"40","Third-rate ship of the line","Midshipman");
|
ship_1
|
SELECT name , TYPE , flag FROM ship ORDER BY built_year DESC LIMIT 1
|
Find the name, type, and flag of the ship that is built in the most recent year.
|
CREATE TABLE "captain" (
"Captain_ID" int,
"Name" text,
"Ship_ID" int,
"age" text,
"Class" text,
"Rank" text,
PRIMARY KEY ("Captain_ID"),
FOREIGN KEY ("Ship_ID") REFERENCES "Ship"("Ship_ID")
);
CREATE TABLE "Ship" (
"Ship_ID" int,
"Name" text,
"Type" text,
"Built_Year" real,
"Class" text,
"Flag" text,
PRIMARY KEY ("Ship_ID")
);
INSERT INTO "Ship" VALUES (1,"HMS Manxman","Panamax","1997","KR","Panama");
INSERT INTO "captain" VALUES (1,"Captain Sir Henry Langford",1,"40","Third-rate ship of the line","Midshipman");
|
ship_1
|
SELECT name , TYPE , flag FROM ship ORDER BY built_year DESC LIMIT 1
|
What is the name, type, and flag of the ship that was built in the most recent year?
|
CREATE TABLE "captain" (
"Captain_ID" int,
"Name" text,
"Ship_ID" int,
"age" text,
"Class" text,
"Rank" text,
PRIMARY KEY ("Captain_ID"),
FOREIGN KEY ("Ship_ID") REFERENCES "Ship"("Ship_ID")
);
CREATE TABLE "Ship" (
"Ship_ID" int,
"Name" text,
"Type" text,
"Built_Year" real,
"Class" text,
"Flag" text,
PRIMARY KEY ("Ship_ID")
);
INSERT INTO "Ship" VALUES (1,"HMS Manxman","Panamax","1997","KR","Panama");
INSERT INTO "captain" VALUES (1,"Captain Sir Henry Langford",1,"40","Third-rate ship of the line","Midshipman");
|
ship_1
|
SELECT count(*) , flag FROM ship GROUP BY flag
|
Group by ships by flag, and return number of ships that have each flag.
|
CREATE TABLE "captain" (
"Captain_ID" int,
"Name" text,
"Ship_ID" int,
"age" text,
"Class" text,
"Rank" text,
PRIMARY KEY ("Captain_ID"),
FOREIGN KEY ("Ship_ID") REFERENCES "Ship"("Ship_ID")
);
CREATE TABLE "Ship" (
"Ship_ID" int,
"Name" text,
"Type" text,
"Built_Year" real,
"Class" text,
"Flag" text,
PRIMARY KEY ("Ship_ID")
);
INSERT INTO "Ship" VALUES (1,"HMS Manxman","Panamax","1997","KR","Panama");
INSERT INTO "captain" VALUES (1,"Captain Sir Henry Langford",1,"40","Third-rate ship of the line","Midshipman");
|
ship_1
|
SELECT count(*) , flag FROM ship GROUP BY flag
|
What are the different ship flags, and how many ships have each?
|
CREATE TABLE "captain" (
"Captain_ID" int,
"Name" text,
"Ship_ID" int,
"age" text,
"Class" text,
"Rank" text,
PRIMARY KEY ("Captain_ID"),
FOREIGN KEY ("Ship_ID") REFERENCES "Ship"("Ship_ID")
);
CREATE TABLE "Ship" (
"Ship_ID" int,
"Name" text,
"Type" text,
"Built_Year" real,
"Class" text,
"Flag" text,
PRIMARY KEY ("Ship_ID")
);
INSERT INTO "Ship" VALUES (1,"HMS Manxman","Panamax","1997","KR","Panama");
INSERT INTO "captain" VALUES (1,"Captain Sir Henry Langford",1,"40","Third-rate ship of the line","Midshipman");
|
ship_1
|
SELECT flag FROM ship GROUP BY flag ORDER BY count(*) DESC LIMIT 1
|
Which flag is most widely used among all ships?
|
CREATE TABLE "captain" (
"Captain_ID" int,
"Name" text,
"Ship_ID" int,
"age" text,
"Class" text,
"Rank" text,
PRIMARY KEY ("Captain_ID"),
FOREIGN KEY ("Ship_ID") REFERENCES "Ship"("Ship_ID")
);
CREATE TABLE "Ship" (
"Ship_ID" int,
"Name" text,
"Type" text,
"Built_Year" real,
"Class" text,
"Flag" text,
PRIMARY KEY ("Ship_ID")
);
INSERT INTO "Ship" VALUES (1,"HMS Manxman","Panamax","1997","KR","Panama");
INSERT INTO "captain" VALUES (1,"Captain Sir Henry Langford",1,"40","Third-rate ship of the line","Midshipman");
|
ship_1
|
SELECT flag FROM ship GROUP BY flag ORDER BY count(*) DESC LIMIT 1
|
Return the flag that is most common among all ships.
|
CREATE TABLE "captain" (
"Captain_ID" int,
"Name" text,
"Ship_ID" int,
"age" text,
"Class" text,
"Rank" text,
PRIMARY KEY ("Captain_ID"),
FOREIGN KEY ("Ship_ID") REFERENCES "Ship"("Ship_ID")
);
CREATE TABLE "Ship" (
"Ship_ID" int,
"Name" text,
"Type" text,
"Built_Year" real,
"Class" text,
"Flag" text,
PRIMARY KEY ("Ship_ID")
);
INSERT INTO "Ship" VALUES (1,"HMS Manxman","Panamax","1997","KR","Panama");
INSERT INTO "captain" VALUES (1,"Captain Sir Henry Langford",1,"40","Third-rate ship of the line","Midshipman");
|
ship_1
|
SELECT name FROM ship ORDER BY built_year , CLASS
|
List all ship names in the order of built year and class.
|
CREATE TABLE "captain" (
"Captain_ID" int,
"Name" text,
"Ship_ID" int,
"age" text,
"Class" text,
"Rank" text,
PRIMARY KEY ("Captain_ID"),
FOREIGN KEY ("Ship_ID") REFERENCES "Ship"("Ship_ID")
);
CREATE TABLE "Ship" (
"Ship_ID" int,
"Name" text,
"Type" text,
"Built_Year" real,
"Class" text,
"Flag" text,
PRIMARY KEY ("Ship_ID")
);
INSERT INTO "Ship" VALUES (1,"HMS Manxman","Panamax","1997","KR","Panama");
INSERT INTO "captain" VALUES (1,"Captain Sir Henry Langford",1,"40","Third-rate ship of the line","Midshipman");
|
ship_1
|
SELECT name FROM ship ORDER BY built_year , CLASS
|
What are the names of ships, ordered by year they were built and their class?
|
CREATE TABLE "captain" (
"Captain_ID" int,
"Name" text,
"Ship_ID" int,
"age" text,
"Class" text,
"Rank" text,
PRIMARY KEY ("Captain_ID"),
FOREIGN KEY ("Ship_ID") REFERENCES "Ship"("Ship_ID")
);
CREATE TABLE "Ship" (
"Ship_ID" int,
"Name" text,
"Type" text,
"Built_Year" real,
"Class" text,
"Flag" text,
PRIMARY KEY ("Ship_ID")
);
INSERT INTO "Ship" VALUES (1,"HMS Manxman","Panamax","1997","KR","Panama");
INSERT INTO "captain" VALUES (1,"Captain Sir Henry Langford",1,"40","Third-rate ship of the line","Midshipman");
|
ship_1
|
SELECT TYPE FROM ship WHERE flag = 'Panama' INTERSECT SELECT TYPE FROM ship WHERE flag = 'Malta'
|
Find the ship type that are used by both ships with Panama and Malta flags.
|
CREATE TABLE "captain" (
"Captain_ID" int,
"Name" text,
"Ship_ID" int,
"age" text,
"Class" text,
"Rank" text,
PRIMARY KEY ("Captain_ID"),
FOREIGN KEY ("Ship_ID") REFERENCES "Ship"("Ship_ID")
);
CREATE TABLE "Ship" (
"Ship_ID" int,
"Name" text,
"Type" text,
"Built_Year" real,
"Class" text,
"Flag" text,
PRIMARY KEY ("Ship_ID")
);
INSERT INTO "Ship" VALUES (1,"HMS Manxman","Panamax","1997","KR","Panama");
INSERT INTO "captain" VALUES (1,"Captain Sir Henry Langford",1,"40","Third-rate ship of the line","Midshipman");
|
ship_1
|
SELECT TYPE FROM ship WHERE flag = 'Panama' INTERSECT SELECT TYPE FROM ship WHERE flag = 'Malta'
|
What types of ships have both ships that have Panama Flags and Malta flags?
|
CREATE TABLE "captain" (
"Captain_ID" int,
"Name" text,
"Ship_ID" int,
"age" text,
"Class" text,
"Rank" text,
PRIMARY KEY ("Captain_ID"),
FOREIGN KEY ("Ship_ID") REFERENCES "Ship"("Ship_ID")
);
CREATE TABLE "Ship" (
"Ship_ID" int,
"Name" text,
"Type" text,
"Built_Year" real,
"Class" text,
"Flag" text,
PRIMARY KEY ("Ship_ID")
);
INSERT INTO "Ship" VALUES (1,"HMS Manxman","Panamax","1997","KR","Panama");
INSERT INTO "captain" VALUES (1,"Captain Sir Henry Langford",1,"40","Third-rate ship of the line","Midshipman");
|
ship_1
|
SELECT built_year FROM ship GROUP BY built_year ORDER BY count(*) DESC LIMIT 1
|
In which year were most of ships built?
|
CREATE TABLE "captain" (
"Captain_ID" int,
"Name" text,
"Ship_ID" int,
"age" text,
"Class" text,
"Rank" text,
PRIMARY KEY ("Captain_ID"),
FOREIGN KEY ("Ship_ID") REFERENCES "Ship"("Ship_ID")
);
CREATE TABLE "Ship" (
"Ship_ID" int,
"Name" text,
"Type" text,
"Built_Year" real,
"Class" text,
"Flag" text,
PRIMARY KEY ("Ship_ID")
);
INSERT INTO "Ship" VALUES (1,"HMS Manxman","Panamax","1997","KR","Panama");
INSERT INTO "captain" VALUES (1,"Captain Sir Henry Langford",1,"40","Third-rate ship of the line","Midshipman");
|
ship_1
|
SELECT built_year FROM ship GROUP BY built_year ORDER BY count(*) DESC LIMIT 1
|
What is the year in which most ships were built?
|
CREATE TABLE "captain" (
"Captain_ID" int,
"Name" text,
"Ship_ID" int,
"age" text,
"Class" text,
"Rank" text,
PRIMARY KEY ("Captain_ID"),
FOREIGN KEY ("Ship_ID") REFERENCES "Ship"("Ship_ID")
);
CREATE TABLE "Ship" (
"Ship_ID" int,
"Name" text,
"Type" text,
"Built_Year" real,
"Class" text,
"Flag" text,
PRIMARY KEY ("Ship_ID")
);
INSERT INTO "Ship" VALUES (1,"HMS Manxman","Panamax","1997","KR","Panama");
INSERT INTO "captain" VALUES (1,"Captain Sir Henry Langford",1,"40","Third-rate ship of the line","Midshipman");
|
ship_1
|
SELECT t1.name FROM ship AS t1 JOIN captain AS t2 ON t1.ship_id = t2.ship_id GROUP BY t2.ship_id HAVING count(*) > 1
|
Find the name of the ships that have more than one captain.
|
CREATE TABLE "captain" (
"Captain_ID" int,
"Name" text,
"Ship_ID" int,
"age" text,
"Class" text,
"Rank" text,
PRIMARY KEY ("Captain_ID"),
FOREIGN KEY ("Ship_ID") REFERENCES "Ship"("Ship_ID")
);
CREATE TABLE "Ship" (
"Ship_ID" int,
"Name" text,
"Type" text,
"Built_Year" real,
"Class" text,
"Flag" text,
PRIMARY KEY ("Ship_ID")
);
INSERT INTO "Ship" VALUES (1,"HMS Manxman","Panamax","1997","KR","Panama");
INSERT INTO "captain" VALUES (1,"Captain Sir Henry Langford",1,"40","Third-rate ship of the line","Midshipman");
|
ship_1
|
SELECT t1.name FROM ship AS t1 JOIN captain AS t2 ON t1.ship_id = t2.ship_id GROUP BY t2.ship_id HAVING count(*) > 1
|
What are the names of ships that have more than one captain?
|
CREATE TABLE "captain" (
"Captain_ID" int,
"Name" text,
"Ship_ID" int,
"age" text,
"Class" text,
"Rank" text,
PRIMARY KEY ("Captain_ID"),
FOREIGN KEY ("Ship_ID") REFERENCES "Ship"("Ship_ID")
);
CREATE TABLE "Ship" (
"Ship_ID" int,
"Name" text,
"Type" text,
"Built_Year" real,
"Class" text,
"Flag" text,
PRIMARY KEY ("Ship_ID")
);
INSERT INTO "Ship" VALUES (1,"HMS Manxman","Panamax","1997","KR","Panama");
INSERT INTO "captain" VALUES (1,"Captain Sir Henry Langford",1,"40","Third-rate ship of the line","Midshipman");
|
ship_1
|
SELECT name , CLASS FROM ship WHERE ship_id NOT IN (SELECT ship_id FROM captain)
|
what are the names and classes of the ships that do not have any captain yet?
|
CREATE TABLE "captain" (
"Captain_ID" int,
"Name" text,
"Ship_ID" int,
"age" text,
"Class" text,
"Rank" text,
PRIMARY KEY ("Captain_ID"),
FOREIGN KEY ("Ship_ID") REFERENCES "Ship"("Ship_ID")
);
CREATE TABLE "Ship" (
"Ship_ID" int,
"Name" text,
"Type" text,
"Built_Year" real,
"Class" text,
"Flag" text,
PRIMARY KEY ("Ship_ID")
);
INSERT INTO "Ship" VALUES (1,"HMS Manxman","Panamax","1997","KR","Panama");
INSERT INTO "captain" VALUES (1,"Captain Sir Henry Langford",1,"40","Third-rate ship of the line","Midshipman");
|
ship_1
|
SELECT name , CLASS FROM ship WHERE ship_id NOT IN (SELECT ship_id FROM captain)
|
Return the names and classes of ships that do not have a captain?
|
CREATE TABLE "captain" (
"Captain_ID" int,
"Name" text,
"Ship_ID" int,
"age" text,
"Class" text,
"Rank" text,
PRIMARY KEY ("Captain_ID"),
FOREIGN KEY ("Ship_ID") REFERENCES "Ship"("Ship_ID")
);
CREATE TABLE "Ship" (
"Ship_ID" int,
"Name" text,
"Type" text,
"Built_Year" real,
"Class" text,
"Flag" text,
PRIMARY KEY ("Ship_ID")
);
INSERT INTO "Ship" VALUES (1,"HMS Manxman","Panamax","1997","KR","Panama");
INSERT INTO "captain" VALUES (1,"Captain Sir Henry Langford",1,"40","Third-rate ship of the line","Midshipman");
|
ship_1
|
SELECT t1.name FROM ship AS t1 JOIN captain AS t2 ON t1.ship_id = t2.ship_id ORDER BY t2.age LIMIT 1
|
Find the name of the ship that is steered by the youngest captain.
|
CREATE TABLE "captain" (
"Captain_ID" int,
"Name" text,
"Ship_ID" int,
"age" text,
"Class" text,
"Rank" text,
PRIMARY KEY ("Captain_ID"),
FOREIGN KEY ("Ship_ID") REFERENCES "Ship"("Ship_ID")
);
CREATE TABLE "Ship" (
"Ship_ID" int,
"Name" text,
"Type" text,
"Built_Year" real,
"Class" text,
"Flag" text,
PRIMARY KEY ("Ship_ID")
);
INSERT INTO "Ship" VALUES (1,"HMS Manxman","Panamax","1997","KR","Panama");
INSERT INTO "captain" VALUES (1,"Captain Sir Henry Langford",1,"40","Third-rate ship of the line","Midshipman");
|
ship_1
|
SELECT t1.name FROM ship AS t1 JOIN captain AS t2 ON t1.ship_id = t2.ship_id ORDER BY t2.age LIMIT 1
|
What is the name of the ship that is commanded by the youngest captain?
|
CREATE TABLE "captain" (
"Captain_ID" int,
"Name" text,
"Ship_ID" int,
"age" text,
"Class" text,
"Rank" text,
PRIMARY KEY ("Captain_ID"),
FOREIGN KEY ("Ship_ID") REFERENCES "Ship"("Ship_ID")
);
CREATE TABLE "Ship" (
"Ship_ID" int,
"Name" text,
"Type" text,
"Built_Year" real,
"Class" text,
"Flag" text,
PRIMARY KEY ("Ship_ID")
);
INSERT INTO "Ship" VALUES (1,"HMS Manxman","Panamax","1997","KR","Panama");
INSERT INTO "captain" VALUES (1,"Captain Sir Henry Langford",1,"40","Third-rate ship of the line","Midshipman");
|
ship_1
|
SELECT name , flag FROM ship WHERE ship_id NOT IN (SELECT ship_id FROM captain WHERE rank = 'Midshipman')
|
Find the name and flag of ships that are not steered by any captain with Midshipman rank.
|
CREATE TABLE "captain" (
"Captain_ID" int,
"Name" text,
"Ship_ID" int,
"age" text,
"Class" text,
"Rank" text,
PRIMARY KEY ("Captain_ID"),
FOREIGN KEY ("Ship_ID") REFERENCES "Ship"("Ship_ID")
);
CREATE TABLE "Ship" (
"Ship_ID" int,
"Name" text,
"Type" text,
"Built_Year" real,
"Class" text,
"Flag" text,
PRIMARY KEY ("Ship_ID")
);
INSERT INTO "Ship" VALUES (1,"HMS Manxman","Panamax","1997","KR","Panama");
INSERT INTO "captain" VALUES (1,"Captain Sir Henry Langford",1,"40","Third-rate ship of the line","Midshipman");
|
ship_1
|
SELECT name , flag FROM ship WHERE ship_id NOT IN (SELECT ship_id FROM captain WHERE rank = 'Midshipman')
|
What are the names and flags of ships that do not have a captain with the rank of Midshipman?
|
CREATE TABLE "captain" (
"Captain_ID" int,
"Name" text,
"Ship_ID" int,
"age" text,
"Class" text,
"Rank" text,
PRIMARY KEY ("Captain_ID"),
FOREIGN KEY ("Ship_ID") REFERENCES "Ship"("Ship_ID")
);
CREATE TABLE "Ship" (
"Ship_ID" int,
"Name" text,
"Type" text,
"Built_Year" real,
"Class" text,
"Flag" text,
PRIMARY KEY ("Ship_ID")
);
INSERT INTO "Ship" VALUES (1,"HMS Manxman","Panamax","1997","KR","Panama");
INSERT INTO "captain" VALUES (1,"Captain Sir Henry Langford",1,"40","Third-rate ship of the line","Midshipman");
|
ship_1
|
SELECT t1.name FROM ship AS t1 JOIN captain AS t2 ON t1.ship_id = t2.ship_id WHERE t2.rank = 'Midshipman' INTERSECT SELECT t1.name FROM ship AS t1 JOIN captain AS t2 ON t1.ship_id = t2.ship_id WHERE t2.rank = 'Lieutenant'
|
Find the name of the ships that are steered by both a captain with Midshipman rank and a captain with Lieutenant rank.
|
CREATE TABLE "captain" (
"Captain_ID" int,
"Name" text,
"Ship_ID" int,
"age" text,
"Class" text,
"Rank" text,
PRIMARY KEY ("Captain_ID"),
FOREIGN KEY ("Ship_ID") REFERENCES "Ship"("Ship_ID")
);
CREATE TABLE "Ship" (
"Ship_ID" int,
"Name" text,
"Type" text,
"Built_Year" real,
"Class" text,
"Flag" text,
PRIMARY KEY ("Ship_ID")
);
INSERT INTO "Ship" VALUES (1,"HMS Manxman","Panamax","1997","KR","Panama");
INSERT INTO "captain" VALUES (1,"Captain Sir Henry Langford",1,"40","Third-rate ship of the line","Midshipman");
|
ship_1
|
SELECT t1.name FROM ship AS t1 JOIN captain AS t2 ON t1.ship_id = t2.ship_id WHERE t2.rank = 'Midshipman' INTERSECT SELECT t1.name FROM ship AS t1 JOIN captain AS t2 ON t1.ship_id = t2.ship_id WHERE t2.rank = 'Lieutenant'
|
What are the names of ships that are commanded by both captains with the rank of Midshipman and captains with the rank of Lieutenant?
|
CREATE TABLE "captain" (
"Captain_ID" int,
"Name" text,
"Ship_ID" int,
"age" text,
"Class" text,
"Rank" text,
PRIMARY KEY ("Captain_ID"),
FOREIGN KEY ("Ship_ID") REFERENCES "Ship"("Ship_ID")
);
CREATE TABLE "Ship" (
"Ship_ID" int,
"Name" text,
"Type" text,
"Built_Year" real,
"Class" text,
"Flag" text,
PRIMARY KEY ("Ship_ID")
);
INSERT INTO "Ship" VALUES (1,"HMS Manxman","Panamax","1997","KR","Panama");
INSERT INTO "captain" VALUES (1,"Captain Sir Henry Langford",1,"40","Third-rate ship of the line","Midshipman");
|
city_record
|
SELECT host_city FROM hosting_city ORDER BY YEAR DESC LIMIT 1
|
What is id of the city that hosted events in the most recent year?
|
CREATE TABLE "city" (
"City_ID" int,
"City" text,
"Hanzi" text,
"Hanyu_Pinyin" text,
"Regional_Population" int,
"GDP" real,
PRIMARY KEY ("City_ID")
);
CREATE TABLE "match" (
"Match_ID" int,
"Date" text,
"Venue" text,
"Score" text,
"Result" text,
"Competition" text,
PRIMARY KEY ("Match_ID")
);
CREATE TABLE "temperature" (
"City_ID" int,
"Jan" real,
"Feb" real,
"Mar" real,
"Apr" real,
"Jun" real,
"Jul" real,
"Aug" real,
"Sep" real,
"Oct" real,
"Nov" real,
"Dec" real,
PRIMARY KEY ("City_ID"),
FOREIGN KEY (`City_ID`) REFERENCES `city`(`City_ID`)
);
CREATE TABLE "hosting_city" (
"Year" int,
"Match_ID" int,
"Host_City" text,
PRIMARY KEY ("Year"),
FOREIGN KEY (`Host_City`) REFERENCES `city`(`City_ID`),
FOREIGN KEY (`Match_ID`) REFERENCES `match`(`Match_ID`)
);
INSERT INTO "city" VALUES (1,"Shanghai","上海","Shànghǎi","23019148","1919.57");
INSERT INTO "temperature" VALUES (1,17.8,17.8,18.3,18.9,20.0,20.6,20.6,20.6,20.0,19.4,18.3);
INSERT INTO "match" VALUES (1,"18 February 1992","Estadio Cuscatlán , San Salvador , El Salvador","1-0","2-0","Friendly match");
INSERT INTO "hosting_city" VALUES ("2008",1,1);
|
city_record
|
SELECT host_city FROM hosting_city ORDER BY YEAR DESC LIMIT 1
|
Find the city that hosted some events in the most recent year. What is the id of this city?
|
CREATE TABLE "city" (
"City_ID" int,
"City" text,
"Hanzi" text,
"Hanyu_Pinyin" text,
"Regional_Population" int,
"GDP" real,
PRIMARY KEY ("City_ID")
);
CREATE TABLE "match" (
"Match_ID" int,
"Date" text,
"Venue" text,
"Score" text,
"Result" text,
"Competition" text,
PRIMARY KEY ("Match_ID")
);
CREATE TABLE "temperature" (
"City_ID" int,
"Jan" real,
"Feb" real,
"Mar" real,
"Apr" real,
"Jun" real,
"Jul" real,
"Aug" real,
"Sep" real,
"Oct" real,
"Nov" real,
"Dec" real,
PRIMARY KEY ("City_ID"),
FOREIGN KEY (`City_ID`) REFERENCES `city`(`City_ID`)
);
CREATE TABLE "hosting_city" (
"Year" int,
"Match_ID" int,
"Host_City" text,
PRIMARY KEY ("Year"),
FOREIGN KEY (`Host_City`) REFERENCES `city`(`City_ID`),
FOREIGN KEY (`Match_ID`) REFERENCES `match`(`Match_ID`)
);
INSERT INTO "city" VALUES (1,"Shanghai","上海","Shànghǎi","23019148","1919.57");
INSERT INTO "temperature" VALUES (1,17.8,17.8,18.3,18.9,20.0,20.6,20.6,20.6,20.0,19.4,18.3);
INSERT INTO "match" VALUES (1,"18 February 1992","Estadio Cuscatlán , San Salvador , El Salvador","1-0","2-0","Friendly match");
INSERT INTO "hosting_city" VALUES ("2008",1,1);
|
city_record
|
SELECT match_id FROM MATCH WHERE competition = "1994 FIFA World Cup qualification"
|
Find the match ids of the cities that hosted competition "1994 FIFA World Cup qualification"?
|
CREATE TABLE "city" (
"City_ID" int,
"City" text,
"Hanzi" text,
"Hanyu_Pinyin" text,
"Regional_Population" int,
"GDP" real,
PRIMARY KEY ("City_ID")
);
CREATE TABLE "match" (
"Match_ID" int,
"Date" text,
"Venue" text,
"Score" text,
"Result" text,
"Competition" text,
PRIMARY KEY ("Match_ID")
);
CREATE TABLE "temperature" (
"City_ID" int,
"Jan" real,
"Feb" real,
"Mar" real,
"Apr" real,
"Jun" real,
"Jul" real,
"Aug" real,
"Sep" real,
"Oct" real,
"Nov" real,
"Dec" real,
PRIMARY KEY ("City_ID"),
FOREIGN KEY (`City_ID`) REFERENCES `city`(`City_ID`)
);
CREATE TABLE "hosting_city" (
"Year" int,
"Match_ID" int,
"Host_City" text,
PRIMARY KEY ("Year"),
FOREIGN KEY (`Host_City`) REFERENCES `city`(`City_ID`),
FOREIGN KEY (`Match_ID`) REFERENCES `match`(`Match_ID`)
);
INSERT INTO "city" VALUES (1,"Shanghai","上海","Shànghǎi","23019148","1919.57");
INSERT INTO "temperature" VALUES (1,17.8,17.8,18.3,18.9,20.0,20.6,20.6,20.6,20.0,19.4,18.3);
INSERT INTO "match" VALUES (1,"18 February 1992","Estadio Cuscatlán , San Salvador , El Salvador","1-0","2-0","Friendly match");
INSERT INTO "hosting_city" VALUES ("2008",1,1);
|
city_record
|
SELECT match_id FROM MATCH WHERE competition = "1994 FIFA World Cup qualification"
|
What is the match id of the competition called "1994 FIFA World Cup qualification"?
|
CREATE TABLE "city" (
"City_ID" int,
"City" text,
"Hanzi" text,
"Hanyu_Pinyin" text,
"Regional_Population" int,
"GDP" real,
PRIMARY KEY ("City_ID")
);
CREATE TABLE "match" (
"Match_ID" int,
"Date" text,
"Venue" text,
"Score" text,
"Result" text,
"Competition" text,
PRIMARY KEY ("Match_ID")
);
CREATE TABLE "temperature" (
"City_ID" int,
"Jan" real,
"Feb" real,
"Mar" real,
"Apr" real,
"Jun" real,
"Jul" real,
"Aug" real,
"Sep" real,
"Oct" real,
"Nov" real,
"Dec" real,
PRIMARY KEY ("City_ID"),
FOREIGN KEY (`City_ID`) REFERENCES `city`(`City_ID`)
);
CREATE TABLE "hosting_city" (
"Year" int,
"Match_ID" int,
"Host_City" text,
PRIMARY KEY ("Year"),
FOREIGN KEY (`Host_City`) REFERENCES `city`(`City_ID`),
FOREIGN KEY (`Match_ID`) REFERENCES `match`(`Match_ID`)
);
INSERT INTO "city" VALUES (1,"Shanghai","上海","Shànghǎi","23019148","1919.57");
INSERT INTO "temperature" VALUES (1,17.8,17.8,18.3,18.9,20.0,20.6,20.6,20.6,20.0,19.4,18.3);
INSERT INTO "match" VALUES (1,"18 February 1992","Estadio Cuscatlán , San Salvador , El Salvador","1-0","2-0","Friendly match");
INSERT INTO "hosting_city" VALUES ("2008",1,1);
|
city_record
|
SELECT T1.city FROM city AS T1 JOIN hosting_city AS T2 ON T1.city_id = T2.host_city WHERE T2.year > 2010
|
Find the cities which were once a host city after 2010?
|
CREATE TABLE "city" (
"City_ID" int,
"City" text,
"Hanzi" text,
"Hanyu_Pinyin" text,
"Regional_Population" int,
"GDP" real,
PRIMARY KEY ("City_ID")
);
CREATE TABLE "match" (
"Match_ID" int,
"Date" text,
"Venue" text,
"Score" text,
"Result" text,
"Competition" text,
PRIMARY KEY ("Match_ID")
);
CREATE TABLE "temperature" (
"City_ID" int,
"Jan" real,
"Feb" real,
"Mar" real,
"Apr" real,
"Jun" real,
"Jul" real,
"Aug" real,
"Sep" real,
"Oct" real,
"Nov" real,
"Dec" real,
PRIMARY KEY ("City_ID"),
FOREIGN KEY (`City_ID`) REFERENCES `city`(`City_ID`)
);
CREATE TABLE "hosting_city" (
"Year" int,
"Match_ID" int,
"Host_City" text,
PRIMARY KEY ("Year"),
FOREIGN KEY (`Host_City`) REFERENCES `city`(`City_ID`),
FOREIGN KEY (`Match_ID`) REFERENCES `match`(`Match_ID`)
);
INSERT INTO "city" VALUES (1,"Shanghai","上海","Shànghǎi","23019148","1919.57");
INSERT INTO "temperature" VALUES (1,17.8,17.8,18.3,18.9,20.0,20.6,20.6,20.6,20.0,19.4,18.3);
INSERT INTO "match" VALUES (1,"18 February 1992","Estadio Cuscatlán , San Salvador , El Salvador","1-0","2-0","Friendly match");
INSERT INTO "hosting_city" VALUES ("2008",1,1);
|
city_record
|
SELECT T1.city FROM city AS T1 JOIN hosting_city AS T2 ON T1.city_id = T2.host_city WHERE T2.year > 2010
|
Which cities served as a host city after 2010?
|
CREATE TABLE "city" (
"City_ID" int,
"City" text,
"Hanzi" text,
"Hanyu_Pinyin" text,
"Regional_Population" int,
"GDP" real,
PRIMARY KEY ("City_ID")
);
CREATE TABLE "match" (
"Match_ID" int,
"Date" text,
"Venue" text,
"Score" text,
"Result" text,
"Competition" text,
PRIMARY KEY ("Match_ID")
);
CREATE TABLE "temperature" (
"City_ID" int,
"Jan" real,
"Feb" real,
"Mar" real,
"Apr" real,
"Jun" real,
"Jul" real,
"Aug" real,
"Sep" real,
"Oct" real,
"Nov" real,
"Dec" real,
PRIMARY KEY ("City_ID"),
FOREIGN KEY (`City_ID`) REFERENCES `city`(`City_ID`)
);
CREATE TABLE "hosting_city" (
"Year" int,
"Match_ID" int,
"Host_City" text,
PRIMARY KEY ("Year"),
FOREIGN KEY (`Host_City`) REFERENCES `city`(`City_ID`),
FOREIGN KEY (`Match_ID`) REFERENCES `match`(`Match_ID`)
);
INSERT INTO "city" VALUES (1,"Shanghai","上海","Shànghǎi","23019148","1919.57");
INSERT INTO "temperature" VALUES (1,17.8,17.8,18.3,18.9,20.0,20.6,20.6,20.6,20.0,19.4,18.3);
INSERT INTO "match" VALUES (1,"18 February 1992","Estadio Cuscatlán , San Salvador , El Salvador","1-0","2-0","Friendly match");
INSERT INTO "hosting_city" VALUES ("2008",1,1);
|
city_record
|
SELECT T1.city FROM city AS T1 JOIN hosting_city AS T2 ON T1.city_id = T2.host_city GROUP BY T2.host_city ORDER BY count(*) DESC LIMIT 1
|
Which city has hosted the most events?
|
CREATE TABLE "city" (
"City_ID" int,
"City" text,
"Hanzi" text,
"Hanyu_Pinyin" text,
"Regional_Population" int,
"GDP" real,
PRIMARY KEY ("City_ID")
);
CREATE TABLE "match" (
"Match_ID" int,
"Date" text,
"Venue" text,
"Score" text,
"Result" text,
"Competition" text,
PRIMARY KEY ("Match_ID")
);
CREATE TABLE "temperature" (
"City_ID" int,
"Jan" real,
"Feb" real,
"Mar" real,
"Apr" real,
"Jun" real,
"Jul" real,
"Aug" real,
"Sep" real,
"Oct" real,
"Nov" real,
"Dec" real,
PRIMARY KEY ("City_ID"),
FOREIGN KEY (`City_ID`) REFERENCES `city`(`City_ID`)
);
CREATE TABLE "hosting_city" (
"Year" int,
"Match_ID" int,
"Host_City" text,
PRIMARY KEY ("Year"),
FOREIGN KEY (`Host_City`) REFERENCES `city`(`City_ID`),
FOREIGN KEY (`Match_ID`) REFERENCES `match`(`Match_ID`)
);
INSERT INTO "city" VALUES (1,"Shanghai","上海","Shànghǎi","23019148","1919.57");
INSERT INTO "temperature" VALUES (1,17.8,17.8,18.3,18.9,20.0,20.6,20.6,20.6,20.0,19.4,18.3);
INSERT INTO "match" VALUES (1,"18 February 1992","Estadio Cuscatlán , San Salvador , El Salvador","1-0","2-0","Friendly match");
INSERT INTO "hosting_city" VALUES ("2008",1,1);
|
city_record
|
SELECT T1.city FROM city AS T1 JOIN hosting_city AS T2 ON T1.city_id = T2.host_city GROUP BY T2.host_city ORDER BY count(*) DESC LIMIT 1
|
Find the city that hosted the most events.
|
CREATE TABLE "city" (
"City_ID" int,
"City" text,
"Hanzi" text,
"Hanyu_Pinyin" text,
"Regional_Population" int,
"GDP" real,
PRIMARY KEY ("City_ID")
);
CREATE TABLE "match" (
"Match_ID" int,
"Date" text,
"Venue" text,
"Score" text,
"Result" text,
"Competition" text,
PRIMARY KEY ("Match_ID")
);
CREATE TABLE "temperature" (
"City_ID" int,
"Jan" real,
"Feb" real,
"Mar" real,
"Apr" real,
"Jun" real,
"Jul" real,
"Aug" real,
"Sep" real,
"Oct" real,
"Nov" real,
"Dec" real,
PRIMARY KEY ("City_ID"),
FOREIGN KEY (`City_ID`) REFERENCES `city`(`City_ID`)
);
CREATE TABLE "hosting_city" (
"Year" int,
"Match_ID" int,
"Host_City" text,
PRIMARY KEY ("Year"),
FOREIGN KEY (`Host_City`) REFERENCES `city`(`City_ID`),
FOREIGN KEY (`Match_ID`) REFERENCES `match`(`Match_ID`)
);
INSERT INTO "city" VALUES (1,"Shanghai","上海","Shànghǎi","23019148","1919.57");
INSERT INTO "temperature" VALUES (1,17.8,17.8,18.3,18.9,20.0,20.6,20.6,20.6,20.0,19.4,18.3);
INSERT INTO "match" VALUES (1,"18 February 1992","Estadio Cuscatlán , San Salvador , El Salvador","1-0","2-0","Friendly match");
INSERT INTO "hosting_city" VALUES ("2008",1,1);
|
city_record
|
SELECT T3.venue FROM city AS T1 JOIN hosting_city AS T2 ON T1.city_id = T2.host_city JOIN MATCH AS T3 ON T2.match_id = T3.match_id WHERE T1.city = "Nanjing ( Jiangsu )" AND T3.competition = "1994 FIFA World Cup qualification"
|
What is the venue of the competition "1994 FIFA World Cup qualification" hosted by "Nanjing ( Jiangsu )"?
|
CREATE TABLE "city" (
"City_ID" int,
"City" text,
"Hanzi" text,
"Hanyu_Pinyin" text,
"Regional_Population" int,
"GDP" real,
PRIMARY KEY ("City_ID")
);
CREATE TABLE "match" (
"Match_ID" int,
"Date" text,
"Venue" text,
"Score" text,
"Result" text,
"Competition" text,
PRIMARY KEY ("Match_ID")
);
CREATE TABLE "temperature" (
"City_ID" int,
"Jan" real,
"Feb" real,
"Mar" real,
"Apr" real,
"Jun" real,
"Jul" real,
"Aug" real,
"Sep" real,
"Oct" real,
"Nov" real,
"Dec" real,
PRIMARY KEY ("City_ID"),
FOREIGN KEY (`City_ID`) REFERENCES `city`(`City_ID`)
);
CREATE TABLE "hosting_city" (
"Year" int,
"Match_ID" int,
"Host_City" text,
PRIMARY KEY ("Year"),
FOREIGN KEY (`Host_City`) REFERENCES `city`(`City_ID`),
FOREIGN KEY (`Match_ID`) REFERENCES `match`(`Match_ID`)
);
INSERT INTO "city" VALUES (1,"Shanghai","上海","Shànghǎi","23019148","1919.57");
INSERT INTO "temperature" VALUES (1,17.8,17.8,18.3,18.9,20.0,20.6,20.6,20.6,20.0,19.4,18.3);
INSERT INTO "match" VALUES (1,"18 February 1992","Estadio Cuscatlán , San Salvador , El Salvador","1-0","2-0","Friendly match");
INSERT INTO "hosting_city" VALUES ("2008",1,1);
|
city_record
|
SELECT T3.venue FROM city AS T1 JOIN hosting_city AS T2 ON T1.city_id = T2.host_city JOIN MATCH AS T3 ON T2.match_id = T3.match_id WHERE T1.city = "Nanjing ( Jiangsu )" AND T3.competition = "1994 FIFA World Cup qualification"
|
Find the venue of the competition "1994 FIFA World Cup qualification" which was hosted by "Nanjing ( Jiangsu )".
|
CREATE TABLE "city" (
"City_ID" int,
"City" text,
"Hanzi" text,
"Hanyu_Pinyin" text,
"Regional_Population" int,
"GDP" real,
PRIMARY KEY ("City_ID")
);
CREATE TABLE "match" (
"Match_ID" int,
"Date" text,
"Venue" text,
"Score" text,
"Result" text,
"Competition" text,
PRIMARY KEY ("Match_ID")
);
CREATE TABLE "temperature" (
"City_ID" int,
"Jan" real,
"Feb" real,
"Mar" real,
"Apr" real,
"Jun" real,
"Jul" real,
"Aug" real,
"Sep" real,
"Oct" real,
"Nov" real,
"Dec" real,
PRIMARY KEY ("City_ID"),
FOREIGN KEY (`City_ID`) REFERENCES `city`(`City_ID`)
);
CREATE TABLE "hosting_city" (
"Year" int,
"Match_ID" int,
"Host_City" text,
PRIMARY KEY ("Year"),
FOREIGN KEY (`Host_City`) REFERENCES `city`(`City_ID`),
FOREIGN KEY (`Match_ID`) REFERENCES `match`(`Match_ID`)
);
INSERT INTO "city" VALUES (1,"Shanghai","上海","Shànghǎi","23019148","1919.57");
INSERT INTO "temperature" VALUES (1,17.8,17.8,18.3,18.9,20.0,20.6,20.6,20.6,20.0,19.4,18.3);
INSERT INTO "match" VALUES (1,"18 February 1992","Estadio Cuscatlán , San Salvador , El Salvador","1-0","2-0","Friendly match");
INSERT INTO "hosting_city" VALUES ("2008",1,1);
|
city_record
|
SELECT T2.Jan FROM city AS T1 JOIN temperature AS T2 ON T1.city_id = T2.city_id WHERE T1.city = "Shanghai"
|
Give me the temperature of Shanghai in January.
|
CREATE TABLE "city" (
"City_ID" int,
"City" text,
"Hanzi" text,
"Hanyu_Pinyin" text,
"Regional_Population" int,
"GDP" real,
PRIMARY KEY ("City_ID")
);
CREATE TABLE "match" (
"Match_ID" int,
"Date" text,
"Venue" text,
"Score" text,
"Result" text,
"Competition" text,
PRIMARY KEY ("Match_ID")
);
CREATE TABLE "temperature" (
"City_ID" int,
"Jan" real,
"Feb" real,
"Mar" real,
"Apr" real,
"Jun" real,
"Jul" real,
"Aug" real,
"Sep" real,
"Oct" real,
"Nov" real,
"Dec" real,
PRIMARY KEY ("City_ID"),
FOREIGN KEY (`City_ID`) REFERENCES `city`(`City_ID`)
);
CREATE TABLE "hosting_city" (
"Year" int,
"Match_ID" int,
"Host_City" text,
PRIMARY KEY ("Year"),
FOREIGN KEY (`Host_City`) REFERENCES `city`(`City_ID`),
FOREIGN KEY (`Match_ID`) REFERENCES `match`(`Match_ID`)
);
INSERT INTO "city" VALUES (1,"Shanghai","上海","Shànghǎi","23019148","1919.57");
INSERT INTO "temperature" VALUES (1,17.8,17.8,18.3,18.9,20.0,20.6,20.6,20.6,20.0,19.4,18.3);
INSERT INTO "match" VALUES (1,"18 February 1992","Estadio Cuscatlán , San Salvador , El Salvador","1-0","2-0","Friendly match");
INSERT INTO "hosting_city" VALUES ("2008",1,1);
|
city_record
|
SELECT T2.Jan FROM city AS T1 JOIN temperature AS T2 ON T1.city_id = T2.city_id WHERE T1.city = "Shanghai"
|
What is the temperature of "Shanghai" city in January?
|
CREATE TABLE "city" (
"City_ID" int,
"City" text,
"Hanzi" text,
"Hanyu_Pinyin" text,
"Regional_Population" int,
"GDP" real,
PRIMARY KEY ("City_ID")
);
CREATE TABLE "match" (
"Match_ID" int,
"Date" text,
"Venue" text,
"Score" text,
"Result" text,
"Competition" text,
PRIMARY KEY ("Match_ID")
);
CREATE TABLE "temperature" (
"City_ID" int,
"Jan" real,
"Feb" real,
"Mar" real,
"Apr" real,
"Jun" real,
"Jul" real,
"Aug" real,
"Sep" real,
"Oct" real,
"Nov" real,
"Dec" real,
PRIMARY KEY ("City_ID"),
FOREIGN KEY (`City_ID`) REFERENCES `city`(`City_ID`)
);
CREATE TABLE "hosting_city" (
"Year" int,
"Match_ID" int,
"Host_City" text,
PRIMARY KEY ("Year"),
FOREIGN KEY (`Host_City`) REFERENCES `city`(`City_ID`),
FOREIGN KEY (`Match_ID`) REFERENCES `match`(`Match_ID`)
);
INSERT INTO "city" VALUES (1,"Shanghai","上海","Shànghǎi","23019148","1919.57");
INSERT INTO "temperature" VALUES (1,17.8,17.8,18.3,18.9,20.0,20.6,20.6,20.6,20.0,19.4,18.3);
INSERT INTO "match" VALUES (1,"18 February 1992","Estadio Cuscatlán , San Salvador , El Salvador","1-0","2-0","Friendly match");
INSERT INTO "hosting_city" VALUES ("2008",1,1);
|
city_record
|
SELECT T2.year FROM city AS T1 JOIN hosting_city AS T2 ON T1.city_id = T2.host_city WHERE T1.city = "Taizhou ( Zhejiang )"
|
What is the host year of city "Taizhou ( Zhejiang )"?
|
CREATE TABLE "city" (
"City_ID" int,
"City" text,
"Hanzi" text,
"Hanyu_Pinyin" text,
"Regional_Population" int,
"GDP" real,
PRIMARY KEY ("City_ID")
);
CREATE TABLE "match" (
"Match_ID" int,
"Date" text,
"Venue" text,
"Score" text,
"Result" text,
"Competition" text,
PRIMARY KEY ("Match_ID")
);
CREATE TABLE "temperature" (
"City_ID" int,
"Jan" real,
"Feb" real,
"Mar" real,
"Apr" real,
"Jun" real,
"Jul" real,
"Aug" real,
"Sep" real,
"Oct" real,
"Nov" real,
"Dec" real,
PRIMARY KEY ("City_ID"),
FOREIGN KEY (`City_ID`) REFERENCES `city`(`City_ID`)
);
CREATE TABLE "hosting_city" (
"Year" int,
"Match_ID" int,
"Host_City" text,
PRIMARY KEY ("Year"),
FOREIGN KEY (`Host_City`) REFERENCES `city`(`City_ID`),
FOREIGN KEY (`Match_ID`) REFERENCES `match`(`Match_ID`)
);
INSERT INTO "city" VALUES (1,"Shanghai","上海","Shànghǎi","23019148","1919.57");
INSERT INTO "temperature" VALUES (1,17.8,17.8,18.3,18.9,20.0,20.6,20.6,20.6,20.0,19.4,18.3);
INSERT INTO "match" VALUES (1,"18 February 1992","Estadio Cuscatlán , San Salvador , El Salvador","1-0","2-0","Friendly match");
INSERT INTO "hosting_city" VALUES ("2008",1,1);
|
city_record
|
SELECT T2.year FROM city AS T1 JOIN hosting_city AS T2 ON T1.city_id = T2.host_city WHERE T1.city = "Taizhou ( Zhejiang )"
|
IN which year did city "Taizhou ( Zhejiang )" serve as a host city?
|
CREATE TABLE "city" (
"City_ID" int,
"City" text,
"Hanzi" text,
"Hanyu_Pinyin" text,
"Regional_Population" int,
"GDP" real,
PRIMARY KEY ("City_ID")
);
CREATE TABLE "match" (
"Match_ID" int,
"Date" text,
"Venue" text,
"Score" text,
"Result" text,
"Competition" text,
PRIMARY KEY ("Match_ID")
);
CREATE TABLE "temperature" (
"City_ID" int,
"Jan" real,
"Feb" real,
"Mar" real,
"Apr" real,
"Jun" real,
"Jul" real,
"Aug" real,
"Sep" real,
"Oct" real,
"Nov" real,
"Dec" real,
PRIMARY KEY ("City_ID"),
FOREIGN KEY (`City_ID`) REFERENCES `city`(`City_ID`)
);
CREATE TABLE "hosting_city" (
"Year" int,
"Match_ID" int,
"Host_City" text,
PRIMARY KEY ("Year"),
FOREIGN KEY (`Host_City`) REFERENCES `city`(`City_ID`),
FOREIGN KEY (`Match_ID`) REFERENCES `match`(`Match_ID`)
);
INSERT INTO "city" VALUES (1,"Shanghai","上海","Shànghǎi","23019148","1919.57");
INSERT INTO "temperature" VALUES (1,17.8,17.8,18.3,18.9,20.0,20.6,20.6,20.6,20.0,19.4,18.3);
INSERT INTO "match" VALUES (1,"18 February 1992","Estadio Cuscatlán , San Salvador , El Salvador","1-0","2-0","Friendly match");
INSERT INTO "hosting_city" VALUES ("2008",1,1);
|
city_record
|
SELECT city FROM city ORDER BY regional_population DESC LIMIT 3
|
Which three cities have the largest regional population?
|
CREATE TABLE "city" (
"City_ID" int,
"City" text,
"Hanzi" text,
"Hanyu_Pinyin" text,
"Regional_Population" int,
"GDP" real,
PRIMARY KEY ("City_ID")
);
CREATE TABLE "match" (
"Match_ID" int,
"Date" text,
"Venue" text,
"Score" text,
"Result" text,
"Competition" text,
PRIMARY KEY ("Match_ID")
);
CREATE TABLE "temperature" (
"City_ID" int,
"Jan" real,
"Feb" real,
"Mar" real,
"Apr" real,
"Jun" real,
"Jul" real,
"Aug" real,
"Sep" real,
"Oct" real,
"Nov" real,
"Dec" real,
PRIMARY KEY ("City_ID"),
FOREIGN KEY (`City_ID`) REFERENCES `city`(`City_ID`)
);
CREATE TABLE "hosting_city" (
"Year" int,
"Match_ID" int,
"Host_City" text,
PRIMARY KEY ("Year"),
FOREIGN KEY (`Host_City`) REFERENCES `city`(`City_ID`),
FOREIGN KEY (`Match_ID`) REFERENCES `match`(`Match_ID`)
);
INSERT INTO "city" VALUES (1,"Shanghai","上海","Shànghǎi","23019148","1919.57");
INSERT INTO "temperature" VALUES (1,17.8,17.8,18.3,18.9,20.0,20.6,20.6,20.6,20.0,19.4,18.3);
INSERT INTO "match" VALUES (1,"18 February 1992","Estadio Cuscatlán , San Salvador , El Salvador","1-0","2-0","Friendly match");
INSERT INTO "hosting_city" VALUES ("2008",1,1);
|
city_record
|
SELECT city FROM city ORDER BY regional_population DESC LIMIT 3
|
What are the three largest cities in terms of regional population?
|
CREATE TABLE "city" (
"City_ID" int,
"City" text,
"Hanzi" text,
"Hanyu_Pinyin" text,
"Regional_Population" int,
"GDP" real,
PRIMARY KEY ("City_ID")
);
CREATE TABLE "match" (
"Match_ID" int,
"Date" text,
"Venue" text,
"Score" text,
"Result" text,
"Competition" text,
PRIMARY KEY ("Match_ID")
);
CREATE TABLE "temperature" (
"City_ID" int,
"Jan" real,
"Feb" real,
"Mar" real,
"Apr" real,
"Jun" real,
"Jul" real,
"Aug" real,
"Sep" real,
"Oct" real,
"Nov" real,
"Dec" real,
PRIMARY KEY ("City_ID"),
FOREIGN KEY (`City_ID`) REFERENCES `city`(`City_ID`)
);
CREATE TABLE "hosting_city" (
"Year" int,
"Match_ID" int,
"Host_City" text,
PRIMARY KEY ("Year"),
FOREIGN KEY (`Host_City`) REFERENCES `city`(`City_ID`),
FOREIGN KEY (`Match_ID`) REFERENCES `match`(`Match_ID`)
);
INSERT INTO "city" VALUES (1,"Shanghai","上海","Shànghǎi","23019148","1919.57");
INSERT INTO "temperature" VALUES (1,17.8,17.8,18.3,18.9,20.0,20.6,20.6,20.6,20.0,19.4,18.3);
INSERT INTO "match" VALUES (1,"18 February 1992","Estadio Cuscatlán , San Salvador , El Salvador","1-0","2-0","Friendly match");
INSERT INTO "hosting_city" VALUES ("2008",1,1);
|
city_record
|
SELECT city , GDP FROM city ORDER BY GDP LIMIT 1
|
Which city has the lowest GDP? Please list the city name and its GDP.
|
CREATE TABLE "city" (
"City_ID" int,
"City" text,
"Hanzi" text,
"Hanyu_Pinyin" text,
"Regional_Population" int,
"GDP" real,
PRIMARY KEY ("City_ID")
);
CREATE TABLE "match" (
"Match_ID" int,
"Date" text,
"Venue" text,
"Score" text,
"Result" text,
"Competition" text,
PRIMARY KEY ("Match_ID")
);
CREATE TABLE "temperature" (
"City_ID" int,
"Jan" real,
"Feb" real,
"Mar" real,
"Apr" real,
"Jun" real,
"Jul" real,
"Aug" real,
"Sep" real,
"Oct" real,
"Nov" real,
"Dec" real,
PRIMARY KEY ("City_ID"),
FOREIGN KEY (`City_ID`) REFERENCES `city`(`City_ID`)
);
CREATE TABLE "hosting_city" (
"Year" int,
"Match_ID" int,
"Host_City" text,
PRIMARY KEY ("Year"),
FOREIGN KEY (`Host_City`) REFERENCES `city`(`City_ID`),
FOREIGN KEY (`Match_ID`) REFERENCES `match`(`Match_ID`)
);
INSERT INTO "city" VALUES (1,"Shanghai","上海","Shànghǎi","23019148","1919.57");
INSERT INTO "temperature" VALUES (1,17.8,17.8,18.3,18.9,20.0,20.6,20.6,20.6,20.0,19.4,18.3);
INSERT INTO "match" VALUES (1,"18 February 1992","Estadio Cuscatlán , San Salvador , El Salvador","1-0","2-0","Friendly match");
INSERT INTO "hosting_city" VALUES ("2008",1,1);
|
city_record
|
SELECT city , GDP FROM city ORDER BY GDP LIMIT 1
|
What is the city with the smallest GDP? Return the city and its GDP.
|
CREATE TABLE "city" (
"City_ID" int,
"City" text,
"Hanzi" text,
"Hanyu_Pinyin" text,
"Regional_Population" int,
"GDP" real,
PRIMARY KEY ("City_ID")
);
CREATE TABLE "match" (
"Match_ID" int,
"Date" text,
"Venue" text,
"Score" text,
"Result" text,
"Competition" text,
PRIMARY KEY ("Match_ID")
);
CREATE TABLE "temperature" (
"City_ID" int,
"Jan" real,
"Feb" real,
"Mar" real,
"Apr" real,
"Jun" real,
"Jul" real,
"Aug" real,
"Sep" real,
"Oct" real,
"Nov" real,
"Dec" real,
PRIMARY KEY ("City_ID"),
FOREIGN KEY (`City_ID`) REFERENCES `city`(`City_ID`)
);
CREATE TABLE "hosting_city" (
"Year" int,
"Match_ID" int,
"Host_City" text,
PRIMARY KEY ("Year"),
FOREIGN KEY (`Host_City`) REFERENCES `city`(`City_ID`),
FOREIGN KEY (`Match_ID`) REFERENCES `match`(`Match_ID`)
);
INSERT INTO "city" VALUES (1,"Shanghai","上海","Shànghǎi","23019148","1919.57");
INSERT INTO "temperature" VALUES (1,17.8,17.8,18.3,18.9,20.0,20.6,20.6,20.6,20.0,19.4,18.3);
INSERT INTO "match" VALUES (1,"18 February 1992","Estadio Cuscatlán , San Salvador , El Salvador","1-0","2-0","Friendly match");
INSERT INTO "hosting_city" VALUES ("2008",1,1);
|
city_record
|
SELECT T1.city FROM city AS T1 JOIN temperature AS T2 ON T1.city_id = T2.city_id ORDER BY T2.Feb DESC LIMIT 1
|
Which city has the highest temperature in February?
|
CREATE TABLE "city" (
"City_ID" int,
"City" text,
"Hanzi" text,
"Hanyu_Pinyin" text,
"Regional_Population" int,
"GDP" real,
PRIMARY KEY ("City_ID")
);
CREATE TABLE "match" (
"Match_ID" int,
"Date" text,
"Venue" text,
"Score" text,
"Result" text,
"Competition" text,
PRIMARY KEY ("Match_ID")
);
CREATE TABLE "temperature" (
"City_ID" int,
"Jan" real,
"Feb" real,
"Mar" real,
"Apr" real,
"Jun" real,
"Jul" real,
"Aug" real,
"Sep" real,
"Oct" real,
"Nov" real,
"Dec" real,
PRIMARY KEY ("City_ID"),
FOREIGN KEY (`City_ID`) REFERENCES `city`(`City_ID`)
);
CREATE TABLE "hosting_city" (
"Year" int,
"Match_ID" int,
"Host_City" text,
PRIMARY KEY ("Year"),
FOREIGN KEY (`Host_City`) REFERENCES `city`(`City_ID`),
FOREIGN KEY (`Match_ID`) REFERENCES `match`(`Match_ID`)
);
INSERT INTO "city" VALUES (1,"Shanghai","上海","Shànghǎi","23019148","1919.57");
INSERT INTO "temperature" VALUES (1,17.8,17.8,18.3,18.9,20.0,20.6,20.6,20.6,20.0,19.4,18.3);
INSERT INTO "match" VALUES (1,"18 February 1992","Estadio Cuscatlán , San Salvador , El Salvador","1-0","2-0","Friendly match");
INSERT INTO "hosting_city" VALUES ("2008",1,1);
|
city_record
|
SELECT T1.city FROM city AS T1 JOIN temperature AS T2 ON T1.city_id = T2.city_id ORDER BY T2.Feb DESC LIMIT 1
|
In February, which city marks the highest temperature?
|
CREATE TABLE "city" (
"City_ID" int,
"City" text,
"Hanzi" text,
"Hanyu_Pinyin" text,
"Regional_Population" int,
"GDP" real,
PRIMARY KEY ("City_ID")
);
CREATE TABLE "match" (
"Match_ID" int,
"Date" text,
"Venue" text,
"Score" text,
"Result" text,
"Competition" text,
PRIMARY KEY ("Match_ID")
);
CREATE TABLE "temperature" (
"City_ID" int,
"Jan" real,
"Feb" real,
"Mar" real,
"Apr" real,
"Jun" real,
"Jul" real,
"Aug" real,
"Sep" real,
"Oct" real,
"Nov" real,
"Dec" real,
PRIMARY KEY ("City_ID"),
FOREIGN KEY (`City_ID`) REFERENCES `city`(`City_ID`)
);
CREATE TABLE "hosting_city" (
"Year" int,
"Match_ID" int,
"Host_City" text,
PRIMARY KEY ("Year"),
FOREIGN KEY (`Host_City`) REFERENCES `city`(`City_ID`),
FOREIGN KEY (`Match_ID`) REFERENCES `match`(`Match_ID`)
);
INSERT INTO "city" VALUES (1,"Shanghai","上海","Shànghǎi","23019148","1919.57");
INSERT INTO "temperature" VALUES (1,17.8,17.8,18.3,18.9,20.0,20.6,20.6,20.6,20.0,19.4,18.3);
INSERT INTO "match" VALUES (1,"18 February 1992","Estadio Cuscatlán , San Salvador , El Salvador","1-0","2-0","Friendly match");
INSERT INTO "hosting_city" VALUES ("2008",1,1);
|
city_record
|
SELECT T1.city FROM city AS T1 JOIN temperature AS T2 ON T1.city_id = T2.city_id WHERE T2.Mar < T2.Jul OR T2.Mar > T2.Oct
|
Give me a list of cities whose temperature in March is lower than that in July or higher than that in Oct?
|
CREATE TABLE "city" (
"City_ID" int,
"City" text,
"Hanzi" text,
"Hanyu_Pinyin" text,
"Regional_Population" int,
"GDP" real,
PRIMARY KEY ("City_ID")
);
CREATE TABLE "match" (
"Match_ID" int,
"Date" text,
"Venue" text,
"Score" text,
"Result" text,
"Competition" text,
PRIMARY KEY ("Match_ID")
);
CREATE TABLE "temperature" (
"City_ID" int,
"Jan" real,
"Feb" real,
"Mar" real,
"Apr" real,
"Jun" real,
"Jul" real,
"Aug" real,
"Sep" real,
"Oct" real,
"Nov" real,
"Dec" real,
PRIMARY KEY ("City_ID"),
FOREIGN KEY (`City_ID`) REFERENCES `city`(`City_ID`)
);
CREATE TABLE "hosting_city" (
"Year" int,
"Match_ID" int,
"Host_City" text,
PRIMARY KEY ("Year"),
FOREIGN KEY (`Host_City`) REFERENCES `city`(`City_ID`),
FOREIGN KEY (`Match_ID`) REFERENCES `match`(`Match_ID`)
);
INSERT INTO "city" VALUES (1,"Shanghai","上海","Shànghǎi","23019148","1919.57");
INSERT INTO "temperature" VALUES (1,17.8,17.8,18.3,18.9,20.0,20.6,20.6,20.6,20.0,19.4,18.3);
INSERT INTO "match" VALUES (1,"18 February 1992","Estadio Cuscatlán , San Salvador , El Salvador","1-0","2-0","Friendly match");
INSERT INTO "hosting_city" VALUES ("2008",1,1);
|
city_record
|
SELECT T1.city FROM city AS T1 JOIN temperature AS T2 ON T1.city_id = T2.city_id WHERE T2.Mar < T2.Jul OR T2.Mar > T2.Oct
|
Which cities' temperature in March is lower than that in July or higher than that in Oct?
|
CREATE TABLE "city" (
"City_ID" int,
"City" text,
"Hanzi" text,
"Hanyu_Pinyin" text,
"Regional_Population" int,
"GDP" real,
PRIMARY KEY ("City_ID")
);
CREATE TABLE "match" (
"Match_ID" int,
"Date" text,
"Venue" text,
"Score" text,
"Result" text,
"Competition" text,
PRIMARY KEY ("Match_ID")
);
CREATE TABLE "temperature" (
"City_ID" int,
"Jan" real,
"Feb" real,
"Mar" real,
"Apr" real,
"Jun" real,
"Jul" real,
"Aug" real,
"Sep" real,
"Oct" real,
"Nov" real,
"Dec" real,
PRIMARY KEY ("City_ID"),
FOREIGN KEY (`City_ID`) REFERENCES `city`(`City_ID`)
);
CREATE TABLE "hosting_city" (
"Year" int,
"Match_ID" int,
"Host_City" text,
PRIMARY KEY ("Year"),
FOREIGN KEY (`Host_City`) REFERENCES `city`(`City_ID`),
FOREIGN KEY (`Match_ID`) REFERENCES `match`(`Match_ID`)
);
INSERT INTO "city" VALUES (1,"Shanghai","上海","Shànghǎi","23019148","1919.57");
INSERT INTO "temperature" VALUES (1,17.8,17.8,18.3,18.9,20.0,20.6,20.6,20.6,20.0,19.4,18.3);
INSERT INTO "match" VALUES (1,"18 February 1992","Estadio Cuscatlán , San Salvador , El Salvador","1-0","2-0","Friendly match");
INSERT INTO "hosting_city" VALUES ("2008",1,1);
|
city_record
|
SELECT T1.city FROM city AS T1 JOIN temperature AS T2 ON T1.city_id = T2.city_id WHERE T2.Mar < T2.Jul INTERSECT SELECT T3.city FROM city AS T3 JOIN hosting_city AS T4 ON T3.city_id = T4.host_city
|
Give me a list of cities whose temperature in Mar is lower than that in July and which have also served as host cities?
|
CREATE TABLE "city" (
"City_ID" int,
"City" text,
"Hanzi" text,
"Hanyu_Pinyin" text,
"Regional_Population" int,
"GDP" real,
PRIMARY KEY ("City_ID")
);
CREATE TABLE "match" (
"Match_ID" int,
"Date" text,
"Venue" text,
"Score" text,
"Result" text,
"Competition" text,
PRIMARY KEY ("Match_ID")
);
CREATE TABLE "temperature" (
"City_ID" int,
"Jan" real,
"Feb" real,
"Mar" real,
"Apr" real,
"Jun" real,
"Jul" real,
"Aug" real,
"Sep" real,
"Oct" real,
"Nov" real,
"Dec" real,
PRIMARY KEY ("City_ID"),
FOREIGN KEY (`City_ID`) REFERENCES `city`(`City_ID`)
);
CREATE TABLE "hosting_city" (
"Year" int,
"Match_ID" int,
"Host_City" text,
PRIMARY KEY ("Year"),
FOREIGN KEY (`Host_City`) REFERENCES `city`(`City_ID`),
FOREIGN KEY (`Match_ID`) REFERENCES `match`(`Match_ID`)
);
INSERT INTO "city" VALUES (1,"Shanghai","上海","Shànghǎi","23019148","1919.57");
INSERT INTO "temperature" VALUES (1,17.8,17.8,18.3,18.9,20.0,20.6,20.6,20.6,20.0,19.4,18.3);
INSERT INTO "match" VALUES (1,"18 February 1992","Estadio Cuscatlán , San Salvador , El Salvador","1-0","2-0","Friendly match");
INSERT INTO "hosting_city" VALUES ("2008",1,1);
|
city_record
|
SELECT T1.city FROM city AS T1 JOIN temperature AS T2 ON T1.city_id = T2.city_id WHERE T2.Mar < T2.Jul INTERSECT SELECT T3.city FROM city AS T3 JOIN hosting_city AS T4 ON T3.city_id = T4.host_city
|
Which cities have lower temperature in March than in July and have been once host cities?
|
CREATE TABLE "city" (
"City_ID" int,
"City" text,
"Hanzi" text,
"Hanyu_Pinyin" text,
"Regional_Population" int,
"GDP" real,
PRIMARY KEY ("City_ID")
);
CREATE TABLE "match" (
"Match_ID" int,
"Date" text,
"Venue" text,
"Score" text,
"Result" text,
"Competition" text,
PRIMARY KEY ("Match_ID")
);
CREATE TABLE "temperature" (
"City_ID" int,
"Jan" real,
"Feb" real,
"Mar" real,
"Apr" real,
"Jun" real,
"Jul" real,
"Aug" real,
"Sep" real,
"Oct" real,
"Nov" real,
"Dec" real,
PRIMARY KEY ("City_ID"),
FOREIGN KEY (`City_ID`) REFERENCES `city`(`City_ID`)
);
CREATE TABLE "hosting_city" (
"Year" int,
"Match_ID" int,
"Host_City" text,
PRIMARY KEY ("Year"),
FOREIGN KEY (`Host_City`) REFERENCES `city`(`City_ID`),
FOREIGN KEY (`Match_ID`) REFERENCES `match`(`Match_ID`)
);
INSERT INTO "city" VALUES (1,"Shanghai","上海","Shànghǎi","23019148","1919.57");
INSERT INTO "temperature" VALUES (1,17.8,17.8,18.3,18.9,20.0,20.6,20.6,20.6,20.0,19.4,18.3);
INSERT INTO "match" VALUES (1,"18 February 1992","Estadio Cuscatlán , San Salvador , El Salvador","1-0","2-0","Friendly match");
INSERT INTO "hosting_city" VALUES ("2008",1,1);
|
city_record
|
SELECT T1.city FROM city AS T1 JOIN temperature AS T2 ON T1.city_id = T2.city_id WHERE T2.Mar < T2.Dec EXCEPT SELECT T3.city FROM city AS T3 JOIN hosting_city AS T4 ON T3.city_id = T4.host_city
|
Give me a list of cities whose temperature in Mar is lower than that in Dec and which have never been host cities.
|
CREATE TABLE "city" (
"City_ID" int,
"City" text,
"Hanzi" text,
"Hanyu_Pinyin" text,
"Regional_Population" int,
"GDP" real,
PRIMARY KEY ("City_ID")
);
CREATE TABLE "match" (
"Match_ID" int,
"Date" text,
"Venue" text,
"Score" text,
"Result" text,
"Competition" text,
PRIMARY KEY ("Match_ID")
);
CREATE TABLE "temperature" (
"City_ID" int,
"Jan" real,
"Feb" real,
"Mar" real,
"Apr" real,
"Jun" real,
"Jul" real,
"Aug" real,
"Sep" real,
"Oct" real,
"Nov" real,
"Dec" real,
PRIMARY KEY ("City_ID"),
FOREIGN KEY (`City_ID`) REFERENCES `city`(`City_ID`)
);
CREATE TABLE "hosting_city" (
"Year" int,
"Match_ID" int,
"Host_City" text,
PRIMARY KEY ("Year"),
FOREIGN KEY (`Host_City`) REFERENCES `city`(`City_ID`),
FOREIGN KEY (`Match_ID`) REFERENCES `match`(`Match_ID`)
);
INSERT INTO "city" VALUES (1,"Shanghai","上海","Shànghǎi","23019148","1919.57");
INSERT INTO "temperature" VALUES (1,17.8,17.8,18.3,18.9,20.0,20.6,20.6,20.6,20.0,19.4,18.3);
INSERT INTO "match" VALUES (1,"18 February 1992","Estadio Cuscatlán , San Salvador , El Salvador","1-0","2-0","Friendly match");
INSERT INTO "hosting_city" VALUES ("2008",1,1);
|
city_record
|
SELECT T1.city FROM city AS T1 JOIN temperature AS T2 ON T1.city_id = T2.city_id WHERE T2.Mar < T2.Dec EXCEPT SELECT T3.city FROM city AS T3 JOIN hosting_city AS T4 ON T3.city_id = T4.host_city
|
Which cities have lower temperature in March than in Dec and have never served as host cities?
|
CREATE TABLE "city" (
"City_ID" int,
"City" text,
"Hanzi" text,
"Hanyu_Pinyin" text,
"Regional_Population" int,
"GDP" real,
PRIMARY KEY ("City_ID")
);
CREATE TABLE "match" (
"Match_ID" int,
"Date" text,
"Venue" text,
"Score" text,
"Result" text,
"Competition" text,
PRIMARY KEY ("Match_ID")
);
CREATE TABLE "temperature" (
"City_ID" int,
"Jan" real,
"Feb" real,
"Mar" real,
"Apr" real,
"Jun" real,
"Jul" real,
"Aug" real,
"Sep" real,
"Oct" real,
"Nov" real,
"Dec" real,
PRIMARY KEY ("City_ID"),
FOREIGN KEY (`City_ID`) REFERENCES `city`(`City_ID`)
);
CREATE TABLE "hosting_city" (
"Year" int,
"Match_ID" int,
"Host_City" text,
PRIMARY KEY ("Year"),
FOREIGN KEY (`Host_City`) REFERENCES `city`(`City_ID`),
FOREIGN KEY (`Match_ID`) REFERENCES `match`(`Match_ID`)
);
INSERT INTO "city" VALUES (1,"Shanghai","上海","Shànghǎi","23019148","1919.57");
INSERT INTO "temperature" VALUES (1,17.8,17.8,18.3,18.9,20.0,20.6,20.6,20.6,20.0,19.4,18.3);
INSERT INTO "match" VALUES (1,"18 February 1992","Estadio Cuscatlán , San Salvador , El Salvador","1-0","2-0","Friendly match");
INSERT INTO "hosting_city" VALUES ("2008",1,1);
|
city_record
|
SELECT T1.city FROM city AS T1 JOIN temperature AS T2 ON T1.city_id = T2.city_id WHERE T2.Feb > T2.Jun UNION SELECT T3.city FROM city AS T3 JOIN hosting_city AS T4 ON T3.city_id = T4.host_city
|
Give me a list of cities whose temperature in Feb is higher than that in Jun or cities that were once host cities?
|
CREATE TABLE "city" (
"City_ID" int,
"City" text,
"Hanzi" text,
"Hanyu_Pinyin" text,
"Regional_Population" int,
"GDP" real,
PRIMARY KEY ("City_ID")
);
CREATE TABLE "match" (
"Match_ID" int,
"Date" text,
"Venue" text,
"Score" text,
"Result" text,
"Competition" text,
PRIMARY KEY ("Match_ID")
);
CREATE TABLE "temperature" (
"City_ID" int,
"Jan" real,
"Feb" real,
"Mar" real,
"Apr" real,
"Jun" real,
"Jul" real,
"Aug" real,
"Sep" real,
"Oct" real,
"Nov" real,
"Dec" real,
PRIMARY KEY ("City_ID"),
FOREIGN KEY (`City_ID`) REFERENCES `city`(`City_ID`)
);
CREATE TABLE "hosting_city" (
"Year" int,
"Match_ID" int,
"Host_City" text,
PRIMARY KEY ("Year"),
FOREIGN KEY (`Host_City`) REFERENCES `city`(`City_ID`),
FOREIGN KEY (`Match_ID`) REFERENCES `match`(`Match_ID`)
);
INSERT INTO "city" VALUES (1,"Shanghai","上海","Shànghǎi","23019148","1919.57");
INSERT INTO "temperature" VALUES (1,17.8,17.8,18.3,18.9,20.0,20.6,20.6,20.6,20.0,19.4,18.3);
INSERT INTO "match" VALUES (1,"18 February 1992","Estadio Cuscatlán , San Salvador , El Salvador","1-0","2-0","Friendly match");
INSERT INTO "hosting_city" VALUES ("2008",1,1);
|
city_record
|
SELECT T1.city FROM city AS T1 JOIN temperature AS T2 ON T1.city_id = T2.city_id WHERE T2.Feb > T2.Jun UNION SELECT T3.city FROM city AS T3 JOIN hosting_city AS T4 ON T3.city_id = T4.host_city
|
Which cities have higher temperature in Feb than in Jun or have once served as host cities?
|
CREATE TABLE "city" (
"City_ID" int,
"City" text,
"Hanzi" text,
"Hanyu_Pinyin" text,
"Regional_Population" int,
"GDP" real,
PRIMARY KEY ("City_ID")
);
CREATE TABLE "match" (
"Match_ID" int,
"Date" text,
"Venue" text,
"Score" text,
"Result" text,
"Competition" text,
PRIMARY KEY ("Match_ID")
);
CREATE TABLE "temperature" (
"City_ID" int,
"Jan" real,
"Feb" real,
"Mar" real,
"Apr" real,
"Jun" real,
"Jul" real,
"Aug" real,
"Sep" real,
"Oct" real,
"Nov" real,
"Dec" real,
PRIMARY KEY ("City_ID"),
FOREIGN KEY (`City_ID`) REFERENCES `city`(`City_ID`)
);
CREATE TABLE "hosting_city" (
"Year" int,
"Match_ID" int,
"Host_City" text,
PRIMARY KEY ("Year"),
FOREIGN KEY (`Host_City`) REFERENCES `city`(`City_ID`),
FOREIGN KEY (`Match_ID`) REFERENCES `match`(`Match_ID`)
);
INSERT INTO "city" VALUES (1,"Shanghai","上海","Shànghǎi","23019148","1919.57");
INSERT INTO "temperature" VALUES (1,17.8,17.8,18.3,18.9,20.0,20.6,20.6,20.6,20.0,19.4,18.3);
INSERT INTO "match" VALUES (1,"18 February 1992","Estadio Cuscatlán , San Salvador , El Salvador","1-0","2-0","Friendly match");
INSERT INTO "hosting_city" VALUES ("2008",1,1);
|
city_record
|
SELECT city FROM city WHERE regional_population > 10000000
|
Please give me a list of cities whose regional population is over 10000000.
|
CREATE TABLE "city" (
"City_ID" int,
"City" text,
"Hanzi" text,
"Hanyu_Pinyin" text,
"Regional_Population" int,
"GDP" real,
PRIMARY KEY ("City_ID")
);
CREATE TABLE "match" (
"Match_ID" int,
"Date" text,
"Venue" text,
"Score" text,
"Result" text,
"Competition" text,
PRIMARY KEY ("Match_ID")
);
CREATE TABLE "temperature" (
"City_ID" int,
"Jan" real,
"Feb" real,
"Mar" real,
"Apr" real,
"Jun" real,
"Jul" real,
"Aug" real,
"Sep" real,
"Oct" real,
"Nov" real,
"Dec" real,
PRIMARY KEY ("City_ID"),
FOREIGN KEY (`City_ID`) REFERENCES `city`(`City_ID`)
);
CREATE TABLE "hosting_city" (
"Year" int,
"Match_ID" int,
"Host_City" text,
PRIMARY KEY ("Year"),
FOREIGN KEY (`Host_City`) REFERENCES `city`(`City_ID`),
FOREIGN KEY (`Match_ID`) REFERENCES `match`(`Match_ID`)
);
INSERT INTO "city" VALUES (1,"Shanghai","上海","Shànghǎi","23019148","1919.57");
INSERT INTO "temperature" VALUES (1,17.8,17.8,18.3,18.9,20.0,20.6,20.6,20.6,20.0,19.4,18.3);
INSERT INTO "match" VALUES (1,"18 February 1992","Estadio Cuscatlán , San Salvador , El Salvador","1-0","2-0","Friendly match");
INSERT INTO "hosting_city" VALUES ("2008",1,1);
|
city_record
|
SELECT city FROM city WHERE regional_population > 10000000
|
Which cities have regional population above 10000000?
|
CREATE TABLE "city" (
"City_ID" int,
"City" text,
"Hanzi" text,
"Hanyu_Pinyin" text,
"Regional_Population" int,
"GDP" real,
PRIMARY KEY ("City_ID")
);
CREATE TABLE "match" (
"Match_ID" int,
"Date" text,
"Venue" text,
"Score" text,
"Result" text,
"Competition" text,
PRIMARY KEY ("Match_ID")
);
CREATE TABLE "temperature" (
"City_ID" int,
"Jan" real,
"Feb" real,
"Mar" real,
"Apr" real,
"Jun" real,
"Jul" real,
"Aug" real,
"Sep" real,
"Oct" real,
"Nov" real,
"Dec" real,
PRIMARY KEY ("City_ID"),
FOREIGN KEY (`City_ID`) REFERENCES `city`(`City_ID`)
);
CREATE TABLE "hosting_city" (
"Year" int,
"Match_ID" int,
"Host_City" text,
PRIMARY KEY ("Year"),
FOREIGN KEY (`Host_City`) REFERENCES `city`(`City_ID`),
FOREIGN KEY (`Match_ID`) REFERENCES `match`(`Match_ID`)
);
INSERT INTO "city" VALUES (1,"Shanghai","上海","Shànghǎi","23019148","1919.57");
INSERT INTO "temperature" VALUES (1,17.8,17.8,18.3,18.9,20.0,20.6,20.6,20.6,20.0,19.4,18.3);
INSERT INTO "match" VALUES (1,"18 February 1992","Estadio Cuscatlán , San Salvador , El Salvador","1-0","2-0","Friendly match");
INSERT INTO "hosting_city" VALUES ("2008",1,1);
|
city_record
|
SELECT city FROM city WHERE regional_population > 10000000 UNION SELECT city FROM city WHERE regional_population < 5000000
|
Please give me a list of cities whose regional population is over 8000000 or under 5000000.
|
CREATE TABLE "city" (
"City_ID" int,
"City" text,
"Hanzi" text,
"Hanyu_Pinyin" text,
"Regional_Population" int,
"GDP" real,
PRIMARY KEY ("City_ID")
);
CREATE TABLE "match" (
"Match_ID" int,
"Date" text,
"Venue" text,
"Score" text,
"Result" text,
"Competition" text,
PRIMARY KEY ("Match_ID")
);
CREATE TABLE "temperature" (
"City_ID" int,
"Jan" real,
"Feb" real,
"Mar" real,
"Apr" real,
"Jun" real,
"Jul" real,
"Aug" real,
"Sep" real,
"Oct" real,
"Nov" real,
"Dec" real,
PRIMARY KEY ("City_ID"),
FOREIGN KEY (`City_ID`) REFERENCES `city`(`City_ID`)
);
CREATE TABLE "hosting_city" (
"Year" int,
"Match_ID" int,
"Host_City" text,
PRIMARY KEY ("Year"),
FOREIGN KEY (`Host_City`) REFERENCES `city`(`City_ID`),
FOREIGN KEY (`Match_ID`) REFERENCES `match`(`Match_ID`)
);
INSERT INTO "city" VALUES (1,"Shanghai","上海","Shànghǎi","23019148","1919.57");
INSERT INTO "temperature" VALUES (1,17.8,17.8,18.3,18.9,20.0,20.6,20.6,20.6,20.0,19.4,18.3);
INSERT INTO "match" VALUES (1,"18 February 1992","Estadio Cuscatlán , San Salvador , El Salvador","1-0","2-0","Friendly match");
INSERT INTO "hosting_city" VALUES ("2008",1,1);
|
city_record
|
SELECT city FROM city WHERE regional_population > 10000000 UNION SELECT city FROM city WHERE regional_population < 5000000
|
Which cities have regional population above 8000000 or below 5000000?
|
CREATE TABLE "city" (
"City_ID" int,
"City" text,
"Hanzi" text,
"Hanyu_Pinyin" text,
"Regional_Population" int,
"GDP" real,
PRIMARY KEY ("City_ID")
);
CREATE TABLE "match" (
"Match_ID" int,
"Date" text,
"Venue" text,
"Score" text,
"Result" text,
"Competition" text,
PRIMARY KEY ("Match_ID")
);
CREATE TABLE "temperature" (
"City_ID" int,
"Jan" real,
"Feb" real,
"Mar" real,
"Apr" real,
"Jun" real,
"Jul" real,
"Aug" real,
"Sep" real,
"Oct" real,
"Nov" real,
"Dec" real,
PRIMARY KEY ("City_ID"),
FOREIGN KEY (`City_ID`) REFERENCES `city`(`City_ID`)
);
CREATE TABLE "hosting_city" (
"Year" int,
"Match_ID" int,
"Host_City" text,
PRIMARY KEY ("Year"),
FOREIGN KEY (`Host_City`) REFERENCES `city`(`City_ID`),
FOREIGN KEY (`Match_ID`) REFERENCES `match`(`Match_ID`)
);
INSERT INTO "city" VALUES (1,"Shanghai","上海","Shànghǎi","23019148","1919.57");
INSERT INTO "temperature" VALUES (1,17.8,17.8,18.3,18.9,20.0,20.6,20.6,20.6,20.0,19.4,18.3);
INSERT INTO "match" VALUES (1,"18 February 1992","Estadio Cuscatlán , San Salvador , El Salvador","1-0","2-0","Friendly match");
INSERT INTO "hosting_city" VALUES ("2008",1,1);
|
city_record
|
SELECT count(*) , Competition FROM MATCH GROUP BY Competition
|
Find the number of matches in different competitions.
|
CREATE TABLE "city" (
"City_ID" int,
"City" text,
"Hanzi" text,
"Hanyu_Pinyin" text,
"Regional_Population" int,
"GDP" real,
PRIMARY KEY ("City_ID")
);
CREATE TABLE "match" (
"Match_ID" int,
"Date" text,
"Venue" text,
"Score" text,
"Result" text,
"Competition" text,
PRIMARY KEY ("Match_ID")
);
CREATE TABLE "temperature" (
"City_ID" int,
"Jan" real,
"Feb" real,
"Mar" real,
"Apr" real,
"Jun" real,
"Jul" real,
"Aug" real,
"Sep" real,
"Oct" real,
"Nov" real,
"Dec" real,
PRIMARY KEY ("City_ID"),
FOREIGN KEY (`City_ID`) REFERENCES `city`(`City_ID`)
);
CREATE TABLE "hosting_city" (
"Year" int,
"Match_ID" int,
"Host_City" text,
PRIMARY KEY ("Year"),
FOREIGN KEY (`Host_City`) REFERENCES `city`(`City_ID`),
FOREIGN KEY (`Match_ID`) REFERENCES `match`(`Match_ID`)
);
INSERT INTO "city" VALUES (1,"Shanghai","上海","Shànghǎi","23019148","1919.57");
INSERT INTO "temperature" VALUES (1,17.8,17.8,18.3,18.9,20.0,20.6,20.6,20.6,20.0,19.4,18.3);
INSERT INTO "match" VALUES (1,"18 February 1992","Estadio Cuscatlán , San Salvador , El Salvador","1-0","2-0","Friendly match");
INSERT INTO "hosting_city" VALUES ("2008",1,1);
|
city_record
|
SELECT count(*) , Competition FROM MATCH GROUP BY Competition
|
For each competition, count the number of matches.
|
CREATE TABLE "city" (
"City_ID" int,
"City" text,
"Hanzi" text,
"Hanyu_Pinyin" text,
"Regional_Population" int,
"GDP" real,
PRIMARY KEY ("City_ID")
);
CREATE TABLE "match" (
"Match_ID" int,
"Date" text,
"Venue" text,
"Score" text,
"Result" text,
"Competition" text,
PRIMARY KEY ("Match_ID")
);
CREATE TABLE "temperature" (
"City_ID" int,
"Jan" real,
"Feb" real,
"Mar" real,
"Apr" real,
"Jun" real,
"Jul" real,
"Aug" real,
"Sep" real,
"Oct" real,
"Nov" real,
"Dec" real,
PRIMARY KEY ("City_ID"),
FOREIGN KEY (`City_ID`) REFERENCES `city`(`City_ID`)
);
CREATE TABLE "hosting_city" (
"Year" int,
"Match_ID" int,
"Host_City" text,
PRIMARY KEY ("Year"),
FOREIGN KEY (`Host_City`) REFERENCES `city`(`City_ID`),
FOREIGN KEY (`Match_ID`) REFERENCES `match`(`Match_ID`)
);
INSERT INTO "city" VALUES (1,"Shanghai","上海","Shànghǎi","23019148","1919.57");
INSERT INTO "temperature" VALUES (1,17.8,17.8,18.3,18.9,20.0,20.6,20.6,20.6,20.0,19.4,18.3);
INSERT INTO "match" VALUES (1,"18 February 1992","Estadio Cuscatlán , San Salvador , El Salvador","1-0","2-0","Friendly match");
INSERT INTO "hosting_city" VALUES ("2008",1,1);
|
city_record
|
SELECT venue FROM MATCH ORDER BY date DESC
|
List venues of all matches in the order of their dates starting from the most recent one.
|
CREATE TABLE "city" (
"City_ID" int,
"City" text,
"Hanzi" text,
"Hanyu_Pinyin" text,
"Regional_Population" int,
"GDP" real,
PRIMARY KEY ("City_ID")
);
CREATE TABLE "match" (
"Match_ID" int,
"Date" text,
"Venue" text,
"Score" text,
"Result" text,
"Competition" text,
PRIMARY KEY ("Match_ID")
);
CREATE TABLE "temperature" (
"City_ID" int,
"Jan" real,
"Feb" real,
"Mar" real,
"Apr" real,
"Jun" real,
"Jul" real,
"Aug" real,
"Sep" real,
"Oct" real,
"Nov" real,
"Dec" real,
PRIMARY KEY ("City_ID"),
FOREIGN KEY (`City_ID`) REFERENCES `city`(`City_ID`)
);
CREATE TABLE "hosting_city" (
"Year" int,
"Match_ID" int,
"Host_City" text,
PRIMARY KEY ("Year"),
FOREIGN KEY (`Host_City`) REFERENCES `city`(`City_ID`),
FOREIGN KEY (`Match_ID`) REFERENCES `match`(`Match_ID`)
);
INSERT INTO "city" VALUES (1,"Shanghai","上海","Shànghǎi","23019148","1919.57");
INSERT INTO "temperature" VALUES (1,17.8,17.8,18.3,18.9,20.0,20.6,20.6,20.6,20.0,19.4,18.3);
INSERT INTO "match" VALUES (1,"18 February 1992","Estadio Cuscatlán , San Salvador , El Salvador","1-0","2-0","Friendly match");
INSERT INTO "hosting_city" VALUES ("2008",1,1);
|
city_record
|
SELECT venue FROM MATCH ORDER BY date DESC
|
What are the venues of all the matches? Sort them in the descending order of match date.
|
CREATE TABLE "city" (
"City_ID" int,
"City" text,
"Hanzi" text,
"Hanyu_Pinyin" text,
"Regional_Population" int,
"GDP" real,
PRIMARY KEY ("City_ID")
);
CREATE TABLE "match" (
"Match_ID" int,
"Date" text,
"Venue" text,
"Score" text,
"Result" text,
"Competition" text,
PRIMARY KEY ("Match_ID")
);
CREATE TABLE "temperature" (
"City_ID" int,
"Jan" real,
"Feb" real,
"Mar" real,
"Apr" real,
"Jun" real,
"Jul" real,
"Aug" real,
"Sep" real,
"Oct" real,
"Nov" real,
"Dec" real,
PRIMARY KEY ("City_ID"),
FOREIGN KEY (`City_ID`) REFERENCES `city`(`City_ID`)
);
CREATE TABLE "hosting_city" (
"Year" int,
"Match_ID" int,
"Host_City" text,
PRIMARY KEY ("Year"),
FOREIGN KEY (`Host_City`) REFERENCES `city`(`City_ID`),
FOREIGN KEY (`Match_ID`) REFERENCES `match`(`Match_ID`)
);
INSERT INTO "city" VALUES (1,"Shanghai","上海","Shànghǎi","23019148","1919.57");
INSERT INTO "temperature" VALUES (1,17.8,17.8,18.3,18.9,20.0,20.6,20.6,20.6,20.0,19.4,18.3);
INSERT INTO "match" VALUES (1,"18 February 1992","Estadio Cuscatlán , San Salvador , El Salvador","1-0","2-0","Friendly match");
INSERT INTO "hosting_city" VALUES ("2008",1,1);
|
city_record
|
SELECT gdp FROM city ORDER BY Regional_Population DESC LIMIT 1
|
what is the GDP of the city with the largest population.
|
CREATE TABLE "city" (
"City_ID" int,
"City" text,
"Hanzi" text,
"Hanyu_Pinyin" text,
"Regional_Population" int,
"GDP" real,
PRIMARY KEY ("City_ID")
);
CREATE TABLE "match" (
"Match_ID" int,
"Date" text,
"Venue" text,
"Score" text,
"Result" text,
"Competition" text,
PRIMARY KEY ("Match_ID")
);
CREATE TABLE "temperature" (
"City_ID" int,
"Jan" real,
"Feb" real,
"Mar" real,
"Apr" real,
"Jun" real,
"Jul" real,
"Aug" real,
"Sep" real,
"Oct" real,
"Nov" real,
"Dec" real,
PRIMARY KEY ("City_ID"),
FOREIGN KEY (`City_ID`) REFERENCES `city`(`City_ID`)
);
CREATE TABLE "hosting_city" (
"Year" int,
"Match_ID" int,
"Host_City" text,
PRIMARY KEY ("Year"),
FOREIGN KEY (`Host_City`) REFERENCES `city`(`City_ID`),
FOREIGN KEY (`Match_ID`) REFERENCES `match`(`Match_ID`)
);
INSERT INTO "city" VALUES (1,"Shanghai","上海","Shànghǎi","23019148","1919.57");
INSERT INTO "temperature" VALUES (1,17.8,17.8,18.3,18.9,20.0,20.6,20.6,20.6,20.0,19.4,18.3);
INSERT INTO "match" VALUES (1,"18 February 1992","Estadio Cuscatlán , San Salvador , El Salvador","1-0","2-0","Friendly match");
INSERT INTO "hosting_city" VALUES ("2008",1,1);
|
city_record
|
SELECT gdp FROM city ORDER BY Regional_Population DESC LIMIT 1
|
Find the GDP of the city with the largest regional population.
|
CREATE TABLE "city" (
"City_ID" int,
"City" text,
"Hanzi" text,
"Hanyu_Pinyin" text,
"Regional_Population" int,
"GDP" real,
PRIMARY KEY ("City_ID")
);
CREATE TABLE "match" (
"Match_ID" int,
"Date" text,
"Venue" text,
"Score" text,
"Result" text,
"Competition" text,
PRIMARY KEY ("Match_ID")
);
CREATE TABLE "temperature" (
"City_ID" int,
"Jan" real,
"Feb" real,
"Mar" real,
"Apr" real,
"Jun" real,
"Jul" real,
"Aug" real,
"Sep" real,
"Oct" real,
"Nov" real,
"Dec" real,
PRIMARY KEY ("City_ID"),
FOREIGN KEY (`City_ID`) REFERENCES `city`(`City_ID`)
);
CREATE TABLE "hosting_city" (
"Year" int,
"Match_ID" int,
"Host_City" text,
PRIMARY KEY ("Year"),
FOREIGN KEY (`Host_City`) REFERENCES `city`(`City_ID`),
FOREIGN KEY (`Match_ID`) REFERENCES `match`(`Match_ID`)
);
INSERT INTO "city" VALUES (1,"Shanghai","上海","Shànghǎi","23019148","1919.57");
INSERT INTO "temperature" VALUES (1,17.8,17.8,18.3,18.9,20.0,20.6,20.6,20.6,20.0,19.4,18.3);
INSERT INTO "match" VALUES (1,"18 February 1992","Estadio Cuscatlán , San Salvador , El Salvador","1-0","2-0","Friendly match");
INSERT INTO "hosting_city" VALUES ("2008",1,1);
|
city_record
|
SELECT t1.gdp , t1.Regional_Population FROM city AS T1 JOIN hosting_city AS T2 ON T1.city_id = T2.host_city GROUP BY t2.Host_City HAVING count(*) > 1
|
What are the GDP and population of the city that already served as a host more than once?
|
CREATE TABLE "city" (
"City_ID" int,
"City" text,
"Hanzi" text,
"Hanyu_Pinyin" text,
"Regional_Population" int,
"GDP" real,
PRIMARY KEY ("City_ID")
);
CREATE TABLE "match" (
"Match_ID" int,
"Date" text,
"Venue" text,
"Score" text,
"Result" text,
"Competition" text,
PRIMARY KEY ("Match_ID")
);
CREATE TABLE "temperature" (
"City_ID" int,
"Jan" real,
"Feb" real,
"Mar" real,
"Apr" real,
"Jun" real,
"Jul" real,
"Aug" real,
"Sep" real,
"Oct" real,
"Nov" real,
"Dec" real,
PRIMARY KEY ("City_ID"),
FOREIGN KEY (`City_ID`) REFERENCES `city`(`City_ID`)
);
CREATE TABLE "hosting_city" (
"Year" int,
"Match_ID" int,
"Host_City" text,
PRIMARY KEY ("Year"),
FOREIGN KEY (`Host_City`) REFERENCES `city`(`City_ID`),
FOREIGN KEY (`Match_ID`) REFERENCES `match`(`Match_ID`)
);
INSERT INTO "city" VALUES (1,"Shanghai","上海","Shànghǎi","23019148","1919.57");
INSERT INTO "temperature" VALUES (1,17.8,17.8,18.3,18.9,20.0,20.6,20.6,20.6,20.0,19.4,18.3);
INSERT INTO "match" VALUES (1,"18 February 1992","Estadio Cuscatlán , San Salvador , El Salvador","1-0","2-0","Friendly match");
INSERT INTO "hosting_city" VALUES ("2008",1,1);
|
city_record
|
SELECT t1.gdp , t1.Regional_Population FROM city AS T1 JOIN hosting_city AS T2 ON T1.city_id = T2.host_city GROUP BY t2.Host_City HAVING count(*) > 1
|
Which cities have served as host cities more than once? Return me their GDP and population.
|
CREATE TABLE "city" (
"City_ID" int,
"City" text,
"Hanzi" text,
"Hanyu_Pinyin" text,
"Regional_Population" int,
"GDP" real,
PRIMARY KEY ("City_ID")
);
CREATE TABLE "match" (
"Match_ID" int,
"Date" text,
"Venue" text,
"Score" text,
"Result" text,
"Competition" text,
PRIMARY KEY ("Match_ID")
);
CREATE TABLE "temperature" (
"City_ID" int,
"Jan" real,
"Feb" real,
"Mar" real,
"Apr" real,
"Jun" real,
"Jul" real,
"Aug" real,
"Sep" real,
"Oct" real,
"Nov" real,
"Dec" real,
PRIMARY KEY ("City_ID"),
FOREIGN KEY (`City_ID`) REFERENCES `city`(`City_ID`)
);
CREATE TABLE "hosting_city" (
"Year" int,
"Match_ID" int,
"Host_City" text,
PRIMARY KEY ("Year"),
FOREIGN KEY (`Host_City`) REFERENCES `city`(`City_ID`),
FOREIGN KEY (`Match_ID`) REFERENCES `match`(`Match_ID`)
);
INSERT INTO "city" VALUES (1,"Shanghai","上海","Shànghǎi","23019148","1919.57");
INSERT INTO "temperature" VALUES (1,17.8,17.8,18.3,18.9,20.0,20.6,20.6,20.6,20.0,19.4,18.3);
INSERT INTO "match" VALUES (1,"18 February 1992","Estadio Cuscatlán , San Salvador , El Salvador","1-0","2-0","Friendly match");
INSERT INTO "hosting_city" VALUES ("2008",1,1);
|
e_government
|
SELECT individual_first_name , individual_middle_name , individual_last_name FROM individuals ORDER BY individual_last_name
|
List every individual's first name, middle name and last name in alphabetical order by last name.
|
CREATE TABLE `Addresses` (
`address_id` INTEGER PRIMARY KEY,
`line_1_number_building` VARCHAR(80),
`town_city` VARCHAR(50),
`zip_postcode` VARCHAR(20),
`state_province_county` VARCHAR(50),
`country` VARCHAR(50)
);
CREATE TABLE `Services` (
`service_id` INTEGER PRIMARY KEY,
`service_type_code` VARCHAR(15) NOT NULL,
`service_name` VARCHAR(80),
`service_descriptio` VARCHAR(255)
);
CREATE TABLE `Forms` (
`form_id` INTEGER PRIMARY KEY,
`form_type_code` VARCHAR(15) NOT NULL,
`service_id` INTEGER,
`form_number` VARCHAR(50),
`form_name` VARCHAR(80),
`form_description` VARCHAR(255),
FOREIGN KEY (`service_id` ) REFERENCES `Services`(`service_id` )
);
CREATE TABLE `Individuals` (
`individual_id` INTEGER PRIMARY KEY,
`individual_first_name` VARCHAR(80),
`individual_middle_name` VARCHAR(80),
`inidividual_phone` VARCHAR(80),
`individual_email` VARCHAR(80),
`individual_address` VARCHAR(255),
`individual_last_name` VARCHAR(80)
);
CREATE TABLE `Organizations` (
`organization_id` INTEGER PRIMARY KEY,
`date_formed` DATETIME,
`organization_name` VARCHAR(255),
`uk_vat_number` VARCHAR(20)
);
CREATE TABLE `Parties` (
`party_id` INTEGER PRIMARY KEY,
`payment_method_code` VARCHAR(15) NOT NULL,
`party_phone` VARCHAR(80),
`party_email` VARCHAR(80)
);
CREATE TABLE `Organization_Contact_Individuals` (
`individual_id` INTEGER NOT NULL,
`organization_id` INTEGER NOT NULL,
`date_contact_from` DATETIME NOT NULL,
`date_contact_to` DATETIME,
PRIMARY KEY (`individual_id`,`organization_id` ),
FOREIGN KEY (`organization_id` ) REFERENCES `Organizations`(`organization_id` ),
FOREIGN KEY (`individual_id` ) REFERENCES `Individuals`(`individual_id` )
);
CREATE TABLE `Party_Addresses` (
`party_id` INTEGER NOT NULL,
`address_id` INTEGER NOT NULL,
`date_address_from` DATETIME NOT NULL,
`address_type_code` VARCHAR(15) NOT NULL,
`date_address_to` DATETIME,
PRIMARY KEY (`party_id`, `address_id`),
FOREIGN KEY (`address_id` ) REFERENCES `Addresses`(`address_id` ),
FOREIGN KEY (`party_id` ) REFERENCES `Parties`(`party_id` )
);
CREATE TABLE `Party_Forms` (
`party_id` INTEGER NOT NULL,
`form_id` INTEGER NOT NULL,
`date_completion_started` DATETIME NOT NULL,
`form_status_code` VARCHAR(15) NOT NULL,
`date_fully_completed` DATETIME,
PRIMARY KEY (`party_id`, `form_id`),
FOREIGN KEY (`party_id` ) REFERENCES `Parties`(`party_id` ),
FOREIGN KEY (`form_id` ) REFERENCES `Forms`(`form_id` )
);
CREATE TABLE `Party_Services` (
`booking_id` INTEGER NOT NULL ,
`customer_id` INTEGER NOT NULL,
`service_id` INTEGER NOT NULL,
`service_datetime` DATETIME NOT NULL,
`booking_made_date` DATETIME,
FOREIGN KEY (`service_id` ) REFERENCES `Services`(`service_id` ),
FOREIGN KEY (`customer_id` ) REFERENCES `Parties`(`party_id` )
);
INSERT INTO Addresses (`address_id`, `line_1_number_building`, `town_city`, `zip_postcode`, `state_province_county`, `country`) VALUES (1, '25518 Ortiz Centers', 'West Stacy', '193', 'NorthCarolina', 'USA')
INSERT INTO Services (`service_id`, `service_type_code`, `service_name`, `service_descriptio`) VALUES (1, 'Education', 'Education', 'Education')
INSERT INTO Forms (`form_id`, `form_type_code`, `service_id`, `form_number`, `form_name`, `form_description`) VALUES (1, 'Basic', 13, '8069', 'SSN Application', 'Form for SSN Application')
INSERT INTO Individuals (`individual_id`, `individual_first_name`, `individual_middle_name`, `inidividual_phone`, `individual_email`, `individual_address`, `individual_last_name`) VALUES (1, 'Oscar', 'Hosea', '1-925-696-5232', '[email protected]', '6956 Lia Plaza', 'Maggio')
INSERT INTO Organizations (`organization_id`, `date_formed`, `organization_name`, `uk_vat_number`) VALUES (1, '2016-08-24 23:52:48', 'Labour Party', '2157')
INSERT INTO Parties (`party_id`, `payment_method_code`, `party_phone`, `party_email`) VALUES (1, 'Cheque', '05374656172', '[email protected]')
INSERT INTO Organization_Contact_Individuals (`individual_id`, `organization_id`, `date_contact_from`, `date_contact_to`) VALUES (13, 1, '2016-08-16 22:09:11', '2018-03-25 10:27:18')
INSERT INTO Party_Addresses (`party_id`, `address_id`, `date_address_from`, `address_type_code`, `date_address_to`) VALUES (10, 8, '2016-04-08 22:40:02', 'Residence', '2018-02-28 23:14:41')
INSERT INTO Party_Forms (`party_id`, `form_id`, `date_completion_started`, `form_status_code`, `date_fully_completed`) VALUES (2, 4, '2017-12-17 11:29:47', 'Completed', '2018-02-11 16:46:10')
INSERT INTO Party_Services (`booking_id`, `customer_id`, `service_id`, `service_datetime`, `booking_made_date`) VALUES (1, 10, 12, '2018-03-10 22:43:12', '2018-03-23 23:56:51')
|
e_government
|
SELECT individual_first_name , individual_middle_name , individual_last_name FROM individuals ORDER BY individual_last_name
|
What are the first, middle, and last names of all individuals, ordered by last name?
|
CREATE TABLE `Addresses` (
`address_id` INTEGER PRIMARY KEY,
`line_1_number_building` VARCHAR(80),
`town_city` VARCHAR(50),
`zip_postcode` VARCHAR(20),
`state_province_county` VARCHAR(50),
`country` VARCHAR(50)
);
CREATE TABLE `Services` (
`service_id` INTEGER PRIMARY KEY,
`service_type_code` VARCHAR(15) NOT NULL,
`service_name` VARCHAR(80),
`service_descriptio` VARCHAR(255)
);
CREATE TABLE `Forms` (
`form_id` INTEGER PRIMARY KEY,
`form_type_code` VARCHAR(15) NOT NULL,
`service_id` INTEGER,
`form_number` VARCHAR(50),
`form_name` VARCHAR(80),
`form_description` VARCHAR(255),
FOREIGN KEY (`service_id` ) REFERENCES `Services`(`service_id` )
);
CREATE TABLE `Individuals` (
`individual_id` INTEGER PRIMARY KEY,
`individual_first_name` VARCHAR(80),
`individual_middle_name` VARCHAR(80),
`inidividual_phone` VARCHAR(80),
`individual_email` VARCHAR(80),
`individual_address` VARCHAR(255),
`individual_last_name` VARCHAR(80)
);
CREATE TABLE `Organizations` (
`organization_id` INTEGER PRIMARY KEY,
`date_formed` DATETIME,
`organization_name` VARCHAR(255),
`uk_vat_number` VARCHAR(20)
);
CREATE TABLE `Parties` (
`party_id` INTEGER PRIMARY KEY,
`payment_method_code` VARCHAR(15) NOT NULL,
`party_phone` VARCHAR(80),
`party_email` VARCHAR(80)
);
CREATE TABLE `Organization_Contact_Individuals` (
`individual_id` INTEGER NOT NULL,
`organization_id` INTEGER NOT NULL,
`date_contact_from` DATETIME NOT NULL,
`date_contact_to` DATETIME,
PRIMARY KEY (`individual_id`,`organization_id` ),
FOREIGN KEY (`organization_id` ) REFERENCES `Organizations`(`organization_id` ),
FOREIGN KEY (`individual_id` ) REFERENCES `Individuals`(`individual_id` )
);
CREATE TABLE `Party_Addresses` (
`party_id` INTEGER NOT NULL,
`address_id` INTEGER NOT NULL,
`date_address_from` DATETIME NOT NULL,
`address_type_code` VARCHAR(15) NOT NULL,
`date_address_to` DATETIME,
PRIMARY KEY (`party_id`, `address_id`),
FOREIGN KEY (`address_id` ) REFERENCES `Addresses`(`address_id` ),
FOREIGN KEY (`party_id` ) REFERENCES `Parties`(`party_id` )
);
CREATE TABLE `Party_Forms` (
`party_id` INTEGER NOT NULL,
`form_id` INTEGER NOT NULL,
`date_completion_started` DATETIME NOT NULL,
`form_status_code` VARCHAR(15) NOT NULL,
`date_fully_completed` DATETIME,
PRIMARY KEY (`party_id`, `form_id`),
FOREIGN KEY (`party_id` ) REFERENCES `Parties`(`party_id` ),
FOREIGN KEY (`form_id` ) REFERENCES `Forms`(`form_id` )
);
CREATE TABLE `Party_Services` (
`booking_id` INTEGER NOT NULL ,
`customer_id` INTEGER NOT NULL,
`service_id` INTEGER NOT NULL,
`service_datetime` DATETIME NOT NULL,
`booking_made_date` DATETIME,
FOREIGN KEY (`service_id` ) REFERENCES `Services`(`service_id` ),
FOREIGN KEY (`customer_id` ) REFERENCES `Parties`(`party_id` )
);
INSERT INTO Addresses (`address_id`, `line_1_number_building`, `town_city`, `zip_postcode`, `state_province_county`, `country`) VALUES (1, '25518 Ortiz Centers', 'West Stacy', '193', 'NorthCarolina', 'USA')
INSERT INTO Services (`service_id`, `service_type_code`, `service_name`, `service_descriptio`) VALUES (1, 'Education', 'Education', 'Education')
INSERT INTO Forms (`form_id`, `form_type_code`, `service_id`, `form_number`, `form_name`, `form_description`) VALUES (1, 'Basic', 13, '8069', 'SSN Application', 'Form for SSN Application')
INSERT INTO Individuals (`individual_id`, `individual_first_name`, `individual_middle_name`, `inidividual_phone`, `individual_email`, `individual_address`, `individual_last_name`) VALUES (1, 'Oscar', 'Hosea', '1-925-696-5232', '[email protected]', '6956 Lia Plaza', 'Maggio')
INSERT INTO Organizations (`organization_id`, `date_formed`, `organization_name`, `uk_vat_number`) VALUES (1, '2016-08-24 23:52:48', 'Labour Party', '2157')
INSERT INTO Parties (`party_id`, `payment_method_code`, `party_phone`, `party_email`) VALUES (1, 'Cheque', '05374656172', '[email protected]')
INSERT INTO Organization_Contact_Individuals (`individual_id`, `organization_id`, `date_contact_from`, `date_contact_to`) VALUES (13, 1, '2016-08-16 22:09:11', '2018-03-25 10:27:18')
INSERT INTO Party_Addresses (`party_id`, `address_id`, `date_address_from`, `address_type_code`, `date_address_to`) VALUES (10, 8, '2016-04-08 22:40:02', 'Residence', '2018-02-28 23:14:41')
INSERT INTO Party_Forms (`party_id`, `form_id`, `date_completion_started`, `form_status_code`, `date_fully_completed`) VALUES (2, 4, '2017-12-17 11:29:47', 'Completed', '2018-02-11 16:46:10')
INSERT INTO Party_Services (`booking_id`, `customer_id`, `service_id`, `service_datetime`, `booking_made_date`) VALUES (1, 10, 12, '2018-03-10 22:43:12', '2018-03-23 23:56:51')
|
e_government
|
SELECT DISTINCT form_type_code FROM forms
|
List all the types of forms.
|
CREATE TABLE `Addresses` (
`address_id` INTEGER PRIMARY KEY,
`line_1_number_building` VARCHAR(80),
`town_city` VARCHAR(50),
`zip_postcode` VARCHAR(20),
`state_province_county` VARCHAR(50),
`country` VARCHAR(50)
);
CREATE TABLE `Services` (
`service_id` INTEGER PRIMARY KEY,
`service_type_code` VARCHAR(15) NOT NULL,
`service_name` VARCHAR(80),
`service_descriptio` VARCHAR(255)
);
CREATE TABLE `Forms` (
`form_id` INTEGER PRIMARY KEY,
`form_type_code` VARCHAR(15) NOT NULL,
`service_id` INTEGER,
`form_number` VARCHAR(50),
`form_name` VARCHAR(80),
`form_description` VARCHAR(255),
FOREIGN KEY (`service_id` ) REFERENCES `Services`(`service_id` )
);
CREATE TABLE `Individuals` (
`individual_id` INTEGER PRIMARY KEY,
`individual_first_name` VARCHAR(80),
`individual_middle_name` VARCHAR(80),
`inidividual_phone` VARCHAR(80),
`individual_email` VARCHAR(80),
`individual_address` VARCHAR(255),
`individual_last_name` VARCHAR(80)
);
CREATE TABLE `Organizations` (
`organization_id` INTEGER PRIMARY KEY,
`date_formed` DATETIME,
`organization_name` VARCHAR(255),
`uk_vat_number` VARCHAR(20)
);
CREATE TABLE `Parties` (
`party_id` INTEGER PRIMARY KEY,
`payment_method_code` VARCHAR(15) NOT NULL,
`party_phone` VARCHAR(80),
`party_email` VARCHAR(80)
);
CREATE TABLE `Organization_Contact_Individuals` (
`individual_id` INTEGER NOT NULL,
`organization_id` INTEGER NOT NULL,
`date_contact_from` DATETIME NOT NULL,
`date_contact_to` DATETIME,
PRIMARY KEY (`individual_id`,`organization_id` ),
FOREIGN KEY (`organization_id` ) REFERENCES `Organizations`(`organization_id` ),
FOREIGN KEY (`individual_id` ) REFERENCES `Individuals`(`individual_id` )
);
CREATE TABLE `Party_Addresses` (
`party_id` INTEGER NOT NULL,
`address_id` INTEGER NOT NULL,
`date_address_from` DATETIME NOT NULL,
`address_type_code` VARCHAR(15) NOT NULL,
`date_address_to` DATETIME,
PRIMARY KEY (`party_id`, `address_id`),
FOREIGN KEY (`address_id` ) REFERENCES `Addresses`(`address_id` ),
FOREIGN KEY (`party_id` ) REFERENCES `Parties`(`party_id` )
);
CREATE TABLE `Party_Forms` (
`party_id` INTEGER NOT NULL,
`form_id` INTEGER NOT NULL,
`date_completion_started` DATETIME NOT NULL,
`form_status_code` VARCHAR(15) NOT NULL,
`date_fully_completed` DATETIME,
PRIMARY KEY (`party_id`, `form_id`),
FOREIGN KEY (`party_id` ) REFERENCES `Parties`(`party_id` ),
FOREIGN KEY (`form_id` ) REFERENCES `Forms`(`form_id` )
);
CREATE TABLE `Party_Services` (
`booking_id` INTEGER NOT NULL ,
`customer_id` INTEGER NOT NULL,
`service_id` INTEGER NOT NULL,
`service_datetime` DATETIME NOT NULL,
`booking_made_date` DATETIME,
FOREIGN KEY (`service_id` ) REFERENCES `Services`(`service_id` ),
FOREIGN KEY (`customer_id` ) REFERENCES `Parties`(`party_id` )
);
INSERT INTO Addresses (`address_id`, `line_1_number_building`, `town_city`, `zip_postcode`, `state_province_county`, `country`) VALUES (1, '25518 Ortiz Centers', 'West Stacy', '193', 'NorthCarolina', 'USA')
INSERT INTO Services (`service_id`, `service_type_code`, `service_name`, `service_descriptio`) VALUES (1, 'Education', 'Education', 'Education')
INSERT INTO Forms (`form_id`, `form_type_code`, `service_id`, `form_number`, `form_name`, `form_description`) VALUES (1, 'Basic', 13, '8069', 'SSN Application', 'Form for SSN Application')
INSERT INTO Individuals (`individual_id`, `individual_first_name`, `individual_middle_name`, `inidividual_phone`, `individual_email`, `individual_address`, `individual_last_name`) VALUES (1, 'Oscar', 'Hosea', '1-925-696-5232', '[email protected]', '6956 Lia Plaza', 'Maggio')
INSERT INTO Organizations (`organization_id`, `date_formed`, `organization_name`, `uk_vat_number`) VALUES (1, '2016-08-24 23:52:48', 'Labour Party', '2157')
INSERT INTO Parties (`party_id`, `payment_method_code`, `party_phone`, `party_email`) VALUES (1, 'Cheque', '05374656172', '[email protected]')
INSERT INTO Organization_Contact_Individuals (`individual_id`, `organization_id`, `date_contact_from`, `date_contact_to`) VALUES (13, 1, '2016-08-16 22:09:11', '2018-03-25 10:27:18')
INSERT INTO Party_Addresses (`party_id`, `address_id`, `date_address_from`, `address_type_code`, `date_address_to`) VALUES (10, 8, '2016-04-08 22:40:02', 'Residence', '2018-02-28 23:14:41')
INSERT INTO Party_Forms (`party_id`, `form_id`, `date_completion_started`, `form_status_code`, `date_fully_completed`) VALUES (2, 4, '2017-12-17 11:29:47', 'Completed', '2018-02-11 16:46:10')
INSERT INTO Party_Services (`booking_id`, `customer_id`, `service_id`, `service_datetime`, `booking_made_date`) VALUES (1, 10, 12, '2018-03-10 22:43:12', '2018-03-23 23:56:51')
|
e_government
|
SELECT DISTINCT form_type_code FROM forms
|
What are the different types of forms?
|
CREATE TABLE `Addresses` (
`address_id` INTEGER PRIMARY KEY,
`line_1_number_building` VARCHAR(80),
`town_city` VARCHAR(50),
`zip_postcode` VARCHAR(20),
`state_province_county` VARCHAR(50),
`country` VARCHAR(50)
);
CREATE TABLE `Services` (
`service_id` INTEGER PRIMARY KEY,
`service_type_code` VARCHAR(15) NOT NULL,
`service_name` VARCHAR(80),
`service_descriptio` VARCHAR(255)
);
CREATE TABLE `Forms` (
`form_id` INTEGER PRIMARY KEY,
`form_type_code` VARCHAR(15) NOT NULL,
`service_id` INTEGER,
`form_number` VARCHAR(50),
`form_name` VARCHAR(80),
`form_description` VARCHAR(255),
FOREIGN KEY (`service_id` ) REFERENCES `Services`(`service_id` )
);
CREATE TABLE `Individuals` (
`individual_id` INTEGER PRIMARY KEY,
`individual_first_name` VARCHAR(80),
`individual_middle_name` VARCHAR(80),
`inidividual_phone` VARCHAR(80),
`individual_email` VARCHAR(80),
`individual_address` VARCHAR(255),
`individual_last_name` VARCHAR(80)
);
CREATE TABLE `Organizations` (
`organization_id` INTEGER PRIMARY KEY,
`date_formed` DATETIME,
`organization_name` VARCHAR(255),
`uk_vat_number` VARCHAR(20)
);
CREATE TABLE `Parties` (
`party_id` INTEGER PRIMARY KEY,
`payment_method_code` VARCHAR(15) NOT NULL,
`party_phone` VARCHAR(80),
`party_email` VARCHAR(80)
);
CREATE TABLE `Organization_Contact_Individuals` (
`individual_id` INTEGER NOT NULL,
`organization_id` INTEGER NOT NULL,
`date_contact_from` DATETIME NOT NULL,
`date_contact_to` DATETIME,
PRIMARY KEY (`individual_id`,`organization_id` ),
FOREIGN KEY (`organization_id` ) REFERENCES `Organizations`(`organization_id` ),
FOREIGN KEY (`individual_id` ) REFERENCES `Individuals`(`individual_id` )
);
CREATE TABLE `Party_Addresses` (
`party_id` INTEGER NOT NULL,
`address_id` INTEGER NOT NULL,
`date_address_from` DATETIME NOT NULL,
`address_type_code` VARCHAR(15) NOT NULL,
`date_address_to` DATETIME,
PRIMARY KEY (`party_id`, `address_id`),
FOREIGN KEY (`address_id` ) REFERENCES `Addresses`(`address_id` ),
FOREIGN KEY (`party_id` ) REFERENCES `Parties`(`party_id` )
);
CREATE TABLE `Party_Forms` (
`party_id` INTEGER NOT NULL,
`form_id` INTEGER NOT NULL,
`date_completion_started` DATETIME NOT NULL,
`form_status_code` VARCHAR(15) NOT NULL,
`date_fully_completed` DATETIME,
PRIMARY KEY (`party_id`, `form_id`),
FOREIGN KEY (`party_id` ) REFERENCES `Parties`(`party_id` ),
FOREIGN KEY (`form_id` ) REFERENCES `Forms`(`form_id` )
);
CREATE TABLE `Party_Services` (
`booking_id` INTEGER NOT NULL ,
`customer_id` INTEGER NOT NULL,
`service_id` INTEGER NOT NULL,
`service_datetime` DATETIME NOT NULL,
`booking_made_date` DATETIME,
FOREIGN KEY (`service_id` ) REFERENCES `Services`(`service_id` ),
FOREIGN KEY (`customer_id` ) REFERENCES `Parties`(`party_id` )
);
INSERT INTO Addresses (`address_id`, `line_1_number_building`, `town_city`, `zip_postcode`, `state_province_county`, `country`) VALUES (1, '25518 Ortiz Centers', 'West Stacy', '193', 'NorthCarolina', 'USA')
INSERT INTO Services (`service_id`, `service_type_code`, `service_name`, `service_descriptio`) VALUES (1, 'Education', 'Education', 'Education')
INSERT INTO Forms (`form_id`, `form_type_code`, `service_id`, `form_number`, `form_name`, `form_description`) VALUES (1, 'Basic', 13, '8069', 'SSN Application', 'Form for SSN Application')
INSERT INTO Individuals (`individual_id`, `individual_first_name`, `individual_middle_name`, `inidividual_phone`, `individual_email`, `individual_address`, `individual_last_name`) VALUES (1, 'Oscar', 'Hosea', '1-925-696-5232', '[email protected]', '6956 Lia Plaza', 'Maggio')
INSERT INTO Organizations (`organization_id`, `date_formed`, `organization_name`, `uk_vat_number`) VALUES (1, '2016-08-24 23:52:48', 'Labour Party', '2157')
INSERT INTO Parties (`party_id`, `payment_method_code`, `party_phone`, `party_email`) VALUES (1, 'Cheque', '05374656172', '[email protected]')
INSERT INTO Organization_Contact_Individuals (`individual_id`, `organization_id`, `date_contact_from`, `date_contact_to`) VALUES (13, 1, '2016-08-16 22:09:11', '2018-03-25 10:27:18')
INSERT INTO Party_Addresses (`party_id`, `address_id`, `date_address_from`, `address_type_code`, `date_address_to`) VALUES (10, 8, '2016-04-08 22:40:02', 'Residence', '2018-02-28 23:14:41')
INSERT INTO Party_Forms (`party_id`, `form_id`, `date_completion_started`, `form_status_code`, `date_fully_completed`) VALUES (2, 4, '2017-12-17 11:29:47', 'Completed', '2018-02-11 16:46:10')
INSERT INTO Party_Services (`booking_id`, `customer_id`, `service_id`, `service_datetime`, `booking_made_date`) VALUES (1, 10, 12, '2018-03-10 22:43:12', '2018-03-23 23:56:51')
|
e_government
|
SELECT t1.form_name FROM forms AS t1 JOIN party_forms AS t2 ON t1.form_id = t2.form_id GROUP BY t2.form_id ORDER BY count(*) DESC LIMIT 1
|
Find the name of the most popular party form.
|
CREATE TABLE `Addresses` (
`address_id` INTEGER PRIMARY KEY,
`line_1_number_building` VARCHAR(80),
`town_city` VARCHAR(50),
`zip_postcode` VARCHAR(20),
`state_province_county` VARCHAR(50),
`country` VARCHAR(50)
);
CREATE TABLE `Services` (
`service_id` INTEGER PRIMARY KEY,
`service_type_code` VARCHAR(15) NOT NULL,
`service_name` VARCHAR(80),
`service_descriptio` VARCHAR(255)
);
CREATE TABLE `Forms` (
`form_id` INTEGER PRIMARY KEY,
`form_type_code` VARCHAR(15) NOT NULL,
`service_id` INTEGER,
`form_number` VARCHAR(50),
`form_name` VARCHAR(80),
`form_description` VARCHAR(255),
FOREIGN KEY (`service_id` ) REFERENCES `Services`(`service_id` )
);
CREATE TABLE `Individuals` (
`individual_id` INTEGER PRIMARY KEY,
`individual_first_name` VARCHAR(80),
`individual_middle_name` VARCHAR(80),
`inidividual_phone` VARCHAR(80),
`individual_email` VARCHAR(80),
`individual_address` VARCHAR(255),
`individual_last_name` VARCHAR(80)
);
CREATE TABLE `Organizations` (
`organization_id` INTEGER PRIMARY KEY,
`date_formed` DATETIME,
`organization_name` VARCHAR(255),
`uk_vat_number` VARCHAR(20)
);
CREATE TABLE `Parties` (
`party_id` INTEGER PRIMARY KEY,
`payment_method_code` VARCHAR(15) NOT NULL,
`party_phone` VARCHAR(80),
`party_email` VARCHAR(80)
);
CREATE TABLE `Organization_Contact_Individuals` (
`individual_id` INTEGER NOT NULL,
`organization_id` INTEGER NOT NULL,
`date_contact_from` DATETIME NOT NULL,
`date_contact_to` DATETIME,
PRIMARY KEY (`individual_id`,`organization_id` ),
FOREIGN KEY (`organization_id` ) REFERENCES `Organizations`(`organization_id` ),
FOREIGN KEY (`individual_id` ) REFERENCES `Individuals`(`individual_id` )
);
CREATE TABLE `Party_Addresses` (
`party_id` INTEGER NOT NULL,
`address_id` INTEGER NOT NULL,
`date_address_from` DATETIME NOT NULL,
`address_type_code` VARCHAR(15) NOT NULL,
`date_address_to` DATETIME,
PRIMARY KEY (`party_id`, `address_id`),
FOREIGN KEY (`address_id` ) REFERENCES `Addresses`(`address_id` ),
FOREIGN KEY (`party_id` ) REFERENCES `Parties`(`party_id` )
);
CREATE TABLE `Party_Forms` (
`party_id` INTEGER NOT NULL,
`form_id` INTEGER NOT NULL,
`date_completion_started` DATETIME NOT NULL,
`form_status_code` VARCHAR(15) NOT NULL,
`date_fully_completed` DATETIME,
PRIMARY KEY (`party_id`, `form_id`),
FOREIGN KEY (`party_id` ) REFERENCES `Parties`(`party_id` ),
FOREIGN KEY (`form_id` ) REFERENCES `Forms`(`form_id` )
);
CREATE TABLE `Party_Services` (
`booking_id` INTEGER NOT NULL ,
`customer_id` INTEGER NOT NULL,
`service_id` INTEGER NOT NULL,
`service_datetime` DATETIME NOT NULL,
`booking_made_date` DATETIME,
FOREIGN KEY (`service_id` ) REFERENCES `Services`(`service_id` ),
FOREIGN KEY (`customer_id` ) REFERENCES `Parties`(`party_id` )
);
INSERT INTO Addresses (`address_id`, `line_1_number_building`, `town_city`, `zip_postcode`, `state_province_county`, `country`) VALUES (1, '25518 Ortiz Centers', 'West Stacy', '193', 'NorthCarolina', 'USA')
INSERT INTO Services (`service_id`, `service_type_code`, `service_name`, `service_descriptio`) VALUES (1, 'Education', 'Education', 'Education')
INSERT INTO Forms (`form_id`, `form_type_code`, `service_id`, `form_number`, `form_name`, `form_description`) VALUES (1, 'Basic', 13, '8069', 'SSN Application', 'Form for SSN Application')
INSERT INTO Individuals (`individual_id`, `individual_first_name`, `individual_middle_name`, `inidividual_phone`, `individual_email`, `individual_address`, `individual_last_name`) VALUES (1, 'Oscar', 'Hosea', '1-925-696-5232', '[email protected]', '6956 Lia Plaza', 'Maggio')
INSERT INTO Organizations (`organization_id`, `date_formed`, `organization_name`, `uk_vat_number`) VALUES (1, '2016-08-24 23:52:48', 'Labour Party', '2157')
INSERT INTO Parties (`party_id`, `payment_method_code`, `party_phone`, `party_email`) VALUES (1, 'Cheque', '05374656172', '[email protected]')
INSERT INTO Organization_Contact_Individuals (`individual_id`, `organization_id`, `date_contact_from`, `date_contact_to`) VALUES (13, 1, '2016-08-16 22:09:11', '2018-03-25 10:27:18')
INSERT INTO Party_Addresses (`party_id`, `address_id`, `date_address_from`, `address_type_code`, `date_address_to`) VALUES (10, 8, '2016-04-08 22:40:02', 'Residence', '2018-02-28 23:14:41')
INSERT INTO Party_Forms (`party_id`, `form_id`, `date_completion_started`, `form_status_code`, `date_fully_completed`) VALUES (2, 4, '2017-12-17 11:29:47', 'Completed', '2018-02-11 16:46:10')
INSERT INTO Party_Services (`booking_id`, `customer_id`, `service_id`, `service_datetime`, `booking_made_date`) VALUES (1, 10, 12, '2018-03-10 22:43:12', '2018-03-23 23:56:51')
|
e_government
|
SELECT t1.form_name FROM forms AS t1 JOIN party_forms AS t2 ON t1.form_id = t2.form_id GROUP BY t2.form_id ORDER BY count(*) DESC LIMIT 1
|
What is the name of the party form that is most common?
|
CREATE TABLE `Addresses` (
`address_id` INTEGER PRIMARY KEY,
`line_1_number_building` VARCHAR(80),
`town_city` VARCHAR(50),
`zip_postcode` VARCHAR(20),
`state_province_county` VARCHAR(50),
`country` VARCHAR(50)
);
CREATE TABLE `Services` (
`service_id` INTEGER PRIMARY KEY,
`service_type_code` VARCHAR(15) NOT NULL,
`service_name` VARCHAR(80),
`service_descriptio` VARCHAR(255)
);
CREATE TABLE `Forms` (
`form_id` INTEGER PRIMARY KEY,
`form_type_code` VARCHAR(15) NOT NULL,
`service_id` INTEGER,
`form_number` VARCHAR(50),
`form_name` VARCHAR(80),
`form_description` VARCHAR(255),
FOREIGN KEY (`service_id` ) REFERENCES `Services`(`service_id` )
);
CREATE TABLE `Individuals` (
`individual_id` INTEGER PRIMARY KEY,
`individual_first_name` VARCHAR(80),
`individual_middle_name` VARCHAR(80),
`inidividual_phone` VARCHAR(80),
`individual_email` VARCHAR(80),
`individual_address` VARCHAR(255),
`individual_last_name` VARCHAR(80)
);
CREATE TABLE `Organizations` (
`organization_id` INTEGER PRIMARY KEY,
`date_formed` DATETIME,
`organization_name` VARCHAR(255),
`uk_vat_number` VARCHAR(20)
);
CREATE TABLE `Parties` (
`party_id` INTEGER PRIMARY KEY,
`payment_method_code` VARCHAR(15) NOT NULL,
`party_phone` VARCHAR(80),
`party_email` VARCHAR(80)
);
CREATE TABLE `Organization_Contact_Individuals` (
`individual_id` INTEGER NOT NULL,
`organization_id` INTEGER NOT NULL,
`date_contact_from` DATETIME NOT NULL,
`date_contact_to` DATETIME,
PRIMARY KEY (`individual_id`,`organization_id` ),
FOREIGN KEY (`organization_id` ) REFERENCES `Organizations`(`organization_id` ),
FOREIGN KEY (`individual_id` ) REFERENCES `Individuals`(`individual_id` )
);
CREATE TABLE `Party_Addresses` (
`party_id` INTEGER NOT NULL,
`address_id` INTEGER NOT NULL,
`date_address_from` DATETIME NOT NULL,
`address_type_code` VARCHAR(15) NOT NULL,
`date_address_to` DATETIME,
PRIMARY KEY (`party_id`, `address_id`),
FOREIGN KEY (`address_id` ) REFERENCES `Addresses`(`address_id` ),
FOREIGN KEY (`party_id` ) REFERENCES `Parties`(`party_id` )
);
CREATE TABLE `Party_Forms` (
`party_id` INTEGER NOT NULL,
`form_id` INTEGER NOT NULL,
`date_completion_started` DATETIME NOT NULL,
`form_status_code` VARCHAR(15) NOT NULL,
`date_fully_completed` DATETIME,
PRIMARY KEY (`party_id`, `form_id`),
FOREIGN KEY (`party_id` ) REFERENCES `Parties`(`party_id` ),
FOREIGN KEY (`form_id` ) REFERENCES `Forms`(`form_id` )
);
CREATE TABLE `Party_Services` (
`booking_id` INTEGER NOT NULL ,
`customer_id` INTEGER NOT NULL,
`service_id` INTEGER NOT NULL,
`service_datetime` DATETIME NOT NULL,
`booking_made_date` DATETIME,
FOREIGN KEY (`service_id` ) REFERENCES `Services`(`service_id` ),
FOREIGN KEY (`customer_id` ) REFERENCES `Parties`(`party_id` )
);
INSERT INTO Addresses (`address_id`, `line_1_number_building`, `town_city`, `zip_postcode`, `state_province_county`, `country`) VALUES (1, '25518 Ortiz Centers', 'West Stacy', '193', 'NorthCarolina', 'USA')
INSERT INTO Services (`service_id`, `service_type_code`, `service_name`, `service_descriptio`) VALUES (1, 'Education', 'Education', 'Education')
INSERT INTO Forms (`form_id`, `form_type_code`, `service_id`, `form_number`, `form_name`, `form_description`) VALUES (1, 'Basic', 13, '8069', 'SSN Application', 'Form for SSN Application')
INSERT INTO Individuals (`individual_id`, `individual_first_name`, `individual_middle_name`, `inidividual_phone`, `individual_email`, `individual_address`, `individual_last_name`) VALUES (1, 'Oscar', 'Hosea', '1-925-696-5232', '[email protected]', '6956 Lia Plaza', 'Maggio')
INSERT INTO Organizations (`organization_id`, `date_formed`, `organization_name`, `uk_vat_number`) VALUES (1, '2016-08-24 23:52:48', 'Labour Party', '2157')
INSERT INTO Parties (`party_id`, `payment_method_code`, `party_phone`, `party_email`) VALUES (1, 'Cheque', '05374656172', '[email protected]')
INSERT INTO Organization_Contact_Individuals (`individual_id`, `organization_id`, `date_contact_from`, `date_contact_to`) VALUES (13, 1, '2016-08-16 22:09:11', '2018-03-25 10:27:18')
INSERT INTO Party_Addresses (`party_id`, `address_id`, `date_address_from`, `address_type_code`, `date_address_to`) VALUES (10, 8, '2016-04-08 22:40:02', 'Residence', '2018-02-28 23:14:41')
INSERT INTO Party_Forms (`party_id`, `form_id`, `date_completion_started`, `form_status_code`, `date_fully_completed`) VALUES (2, 4, '2017-12-17 11:29:47', 'Completed', '2018-02-11 16:46:10')
INSERT INTO Party_Services (`booking_id`, `customer_id`, `service_id`, `service_datetime`, `booking_made_date`) VALUES (1, 10, 12, '2018-03-10 22:43:12', '2018-03-23 23:56:51')
|
e_government
|
SELECT payment_method_code , party_phone FROM parties WHERE party_email = "[email protected]"
|
Find the payment method and phone of the party with email "[email protected]".
|
CREATE TABLE `Addresses` (
`address_id` INTEGER PRIMARY KEY,
`line_1_number_building` VARCHAR(80),
`town_city` VARCHAR(50),
`zip_postcode` VARCHAR(20),
`state_province_county` VARCHAR(50),
`country` VARCHAR(50)
);
CREATE TABLE `Services` (
`service_id` INTEGER PRIMARY KEY,
`service_type_code` VARCHAR(15) NOT NULL,
`service_name` VARCHAR(80),
`service_descriptio` VARCHAR(255)
);
CREATE TABLE `Forms` (
`form_id` INTEGER PRIMARY KEY,
`form_type_code` VARCHAR(15) NOT NULL,
`service_id` INTEGER,
`form_number` VARCHAR(50),
`form_name` VARCHAR(80),
`form_description` VARCHAR(255),
FOREIGN KEY (`service_id` ) REFERENCES `Services`(`service_id` )
);
CREATE TABLE `Individuals` (
`individual_id` INTEGER PRIMARY KEY,
`individual_first_name` VARCHAR(80),
`individual_middle_name` VARCHAR(80),
`inidividual_phone` VARCHAR(80),
`individual_email` VARCHAR(80),
`individual_address` VARCHAR(255),
`individual_last_name` VARCHAR(80)
);
CREATE TABLE `Organizations` (
`organization_id` INTEGER PRIMARY KEY,
`date_formed` DATETIME,
`organization_name` VARCHAR(255),
`uk_vat_number` VARCHAR(20)
);
CREATE TABLE `Parties` (
`party_id` INTEGER PRIMARY KEY,
`payment_method_code` VARCHAR(15) NOT NULL,
`party_phone` VARCHAR(80),
`party_email` VARCHAR(80)
);
CREATE TABLE `Organization_Contact_Individuals` (
`individual_id` INTEGER NOT NULL,
`organization_id` INTEGER NOT NULL,
`date_contact_from` DATETIME NOT NULL,
`date_contact_to` DATETIME,
PRIMARY KEY (`individual_id`,`organization_id` ),
FOREIGN KEY (`organization_id` ) REFERENCES `Organizations`(`organization_id` ),
FOREIGN KEY (`individual_id` ) REFERENCES `Individuals`(`individual_id` )
);
CREATE TABLE `Party_Addresses` (
`party_id` INTEGER NOT NULL,
`address_id` INTEGER NOT NULL,
`date_address_from` DATETIME NOT NULL,
`address_type_code` VARCHAR(15) NOT NULL,
`date_address_to` DATETIME,
PRIMARY KEY (`party_id`, `address_id`),
FOREIGN KEY (`address_id` ) REFERENCES `Addresses`(`address_id` ),
FOREIGN KEY (`party_id` ) REFERENCES `Parties`(`party_id` )
);
CREATE TABLE `Party_Forms` (
`party_id` INTEGER NOT NULL,
`form_id` INTEGER NOT NULL,
`date_completion_started` DATETIME NOT NULL,
`form_status_code` VARCHAR(15) NOT NULL,
`date_fully_completed` DATETIME,
PRIMARY KEY (`party_id`, `form_id`),
FOREIGN KEY (`party_id` ) REFERENCES `Parties`(`party_id` ),
FOREIGN KEY (`form_id` ) REFERENCES `Forms`(`form_id` )
);
CREATE TABLE `Party_Services` (
`booking_id` INTEGER NOT NULL ,
`customer_id` INTEGER NOT NULL,
`service_id` INTEGER NOT NULL,
`service_datetime` DATETIME NOT NULL,
`booking_made_date` DATETIME,
FOREIGN KEY (`service_id` ) REFERENCES `Services`(`service_id` ),
FOREIGN KEY (`customer_id` ) REFERENCES `Parties`(`party_id` )
);
INSERT INTO Addresses (`address_id`, `line_1_number_building`, `town_city`, `zip_postcode`, `state_province_county`, `country`) VALUES (1, '25518 Ortiz Centers', 'West Stacy', '193', 'NorthCarolina', 'USA')
INSERT INTO Services (`service_id`, `service_type_code`, `service_name`, `service_descriptio`) VALUES (1, 'Education', 'Education', 'Education')
INSERT INTO Forms (`form_id`, `form_type_code`, `service_id`, `form_number`, `form_name`, `form_description`) VALUES (1, 'Basic', 13, '8069', 'SSN Application', 'Form for SSN Application')
INSERT INTO Individuals (`individual_id`, `individual_first_name`, `individual_middle_name`, `inidividual_phone`, `individual_email`, `individual_address`, `individual_last_name`) VALUES (1, 'Oscar', 'Hosea', '1-925-696-5232', '[email protected]', '6956 Lia Plaza', 'Maggio')
INSERT INTO Organizations (`organization_id`, `date_formed`, `organization_name`, `uk_vat_number`) VALUES (1, '2016-08-24 23:52:48', 'Labour Party', '2157')
INSERT INTO Parties (`party_id`, `payment_method_code`, `party_phone`, `party_email`) VALUES (1, 'Cheque', '05374656172', '[email protected]')
INSERT INTO Organization_Contact_Individuals (`individual_id`, `organization_id`, `date_contact_from`, `date_contact_to`) VALUES (13, 1, '2016-08-16 22:09:11', '2018-03-25 10:27:18')
INSERT INTO Party_Addresses (`party_id`, `address_id`, `date_address_from`, `address_type_code`, `date_address_to`) VALUES (10, 8, '2016-04-08 22:40:02', 'Residence', '2018-02-28 23:14:41')
INSERT INTO Party_Forms (`party_id`, `form_id`, `date_completion_started`, `form_status_code`, `date_fully_completed`) VALUES (2, 4, '2017-12-17 11:29:47', 'Completed', '2018-02-11 16:46:10')
INSERT INTO Party_Services (`booking_id`, `customer_id`, `service_id`, `service_datetime`, `booking_made_date`) VALUES (1, 10, 12, '2018-03-10 22:43:12', '2018-03-23 23:56:51')
|
e_government
|
SELECT payment_method_code , party_phone FROM parties WHERE party_email = "[email protected]"
|
What is the payment method code and party phone of the party with the email '[email protected]'?
|
CREATE TABLE `Addresses` (
`address_id` INTEGER PRIMARY KEY,
`line_1_number_building` VARCHAR(80),
`town_city` VARCHAR(50),
`zip_postcode` VARCHAR(20),
`state_province_county` VARCHAR(50),
`country` VARCHAR(50)
);
CREATE TABLE `Services` (
`service_id` INTEGER PRIMARY KEY,
`service_type_code` VARCHAR(15) NOT NULL,
`service_name` VARCHAR(80),
`service_descriptio` VARCHAR(255)
);
CREATE TABLE `Forms` (
`form_id` INTEGER PRIMARY KEY,
`form_type_code` VARCHAR(15) NOT NULL,
`service_id` INTEGER,
`form_number` VARCHAR(50),
`form_name` VARCHAR(80),
`form_description` VARCHAR(255),
FOREIGN KEY (`service_id` ) REFERENCES `Services`(`service_id` )
);
CREATE TABLE `Individuals` (
`individual_id` INTEGER PRIMARY KEY,
`individual_first_name` VARCHAR(80),
`individual_middle_name` VARCHAR(80),
`inidividual_phone` VARCHAR(80),
`individual_email` VARCHAR(80),
`individual_address` VARCHAR(255),
`individual_last_name` VARCHAR(80)
);
CREATE TABLE `Organizations` (
`organization_id` INTEGER PRIMARY KEY,
`date_formed` DATETIME,
`organization_name` VARCHAR(255),
`uk_vat_number` VARCHAR(20)
);
CREATE TABLE `Parties` (
`party_id` INTEGER PRIMARY KEY,
`payment_method_code` VARCHAR(15) NOT NULL,
`party_phone` VARCHAR(80),
`party_email` VARCHAR(80)
);
CREATE TABLE `Organization_Contact_Individuals` (
`individual_id` INTEGER NOT NULL,
`organization_id` INTEGER NOT NULL,
`date_contact_from` DATETIME NOT NULL,
`date_contact_to` DATETIME,
PRIMARY KEY (`individual_id`,`organization_id` ),
FOREIGN KEY (`organization_id` ) REFERENCES `Organizations`(`organization_id` ),
FOREIGN KEY (`individual_id` ) REFERENCES `Individuals`(`individual_id` )
);
CREATE TABLE `Party_Addresses` (
`party_id` INTEGER NOT NULL,
`address_id` INTEGER NOT NULL,
`date_address_from` DATETIME NOT NULL,
`address_type_code` VARCHAR(15) NOT NULL,
`date_address_to` DATETIME,
PRIMARY KEY (`party_id`, `address_id`),
FOREIGN KEY (`address_id` ) REFERENCES `Addresses`(`address_id` ),
FOREIGN KEY (`party_id` ) REFERENCES `Parties`(`party_id` )
);
CREATE TABLE `Party_Forms` (
`party_id` INTEGER NOT NULL,
`form_id` INTEGER NOT NULL,
`date_completion_started` DATETIME NOT NULL,
`form_status_code` VARCHAR(15) NOT NULL,
`date_fully_completed` DATETIME,
PRIMARY KEY (`party_id`, `form_id`),
FOREIGN KEY (`party_id` ) REFERENCES `Parties`(`party_id` ),
FOREIGN KEY (`form_id` ) REFERENCES `Forms`(`form_id` )
);
CREATE TABLE `Party_Services` (
`booking_id` INTEGER NOT NULL ,
`customer_id` INTEGER NOT NULL,
`service_id` INTEGER NOT NULL,
`service_datetime` DATETIME NOT NULL,
`booking_made_date` DATETIME,
FOREIGN KEY (`service_id` ) REFERENCES `Services`(`service_id` ),
FOREIGN KEY (`customer_id` ) REFERENCES `Parties`(`party_id` )
);
INSERT INTO Addresses (`address_id`, `line_1_number_building`, `town_city`, `zip_postcode`, `state_province_county`, `country`) VALUES (1, '25518 Ortiz Centers', 'West Stacy', '193', 'NorthCarolina', 'USA')
INSERT INTO Services (`service_id`, `service_type_code`, `service_name`, `service_descriptio`) VALUES (1, 'Education', 'Education', 'Education')
INSERT INTO Forms (`form_id`, `form_type_code`, `service_id`, `form_number`, `form_name`, `form_description`) VALUES (1, 'Basic', 13, '8069', 'SSN Application', 'Form for SSN Application')
INSERT INTO Individuals (`individual_id`, `individual_first_name`, `individual_middle_name`, `inidividual_phone`, `individual_email`, `individual_address`, `individual_last_name`) VALUES (1, 'Oscar', 'Hosea', '1-925-696-5232', '[email protected]', '6956 Lia Plaza', 'Maggio')
INSERT INTO Organizations (`organization_id`, `date_formed`, `organization_name`, `uk_vat_number`) VALUES (1, '2016-08-24 23:52:48', 'Labour Party', '2157')
INSERT INTO Parties (`party_id`, `payment_method_code`, `party_phone`, `party_email`) VALUES (1, 'Cheque', '05374656172', '[email protected]')
INSERT INTO Organization_Contact_Individuals (`individual_id`, `organization_id`, `date_contact_from`, `date_contact_to`) VALUES (13, 1, '2016-08-16 22:09:11', '2018-03-25 10:27:18')
INSERT INTO Party_Addresses (`party_id`, `address_id`, `date_address_from`, `address_type_code`, `date_address_to`) VALUES (10, 8, '2016-04-08 22:40:02', 'Residence', '2018-02-28 23:14:41')
INSERT INTO Party_Forms (`party_id`, `form_id`, `date_completion_started`, `form_status_code`, `date_fully_completed`) VALUES (2, 4, '2017-12-17 11:29:47', 'Completed', '2018-02-11 16:46:10')
INSERT INTO Party_Services (`booking_id`, `customer_id`, `service_id`, `service_datetime`, `booking_made_date`) VALUES (1, 10, 12, '2018-03-10 22:43:12', '2018-03-23 23:56:51')
|
e_government
|
SELECT t1.party_email FROM parties AS t1 JOIN party_forms AS t2 ON t1.party_id = t2.party_id WHERE t2.form_id = (SELECT form_id FROM party_forms GROUP BY form_id ORDER BY count(*) DESC LIMIT 1)
|
Find the emails of parties with the most popular party form.
|
CREATE TABLE `Addresses` (
`address_id` INTEGER PRIMARY KEY,
`line_1_number_building` VARCHAR(80),
`town_city` VARCHAR(50),
`zip_postcode` VARCHAR(20),
`state_province_county` VARCHAR(50),
`country` VARCHAR(50)
);
CREATE TABLE `Services` (
`service_id` INTEGER PRIMARY KEY,
`service_type_code` VARCHAR(15) NOT NULL,
`service_name` VARCHAR(80),
`service_descriptio` VARCHAR(255)
);
CREATE TABLE `Forms` (
`form_id` INTEGER PRIMARY KEY,
`form_type_code` VARCHAR(15) NOT NULL,
`service_id` INTEGER,
`form_number` VARCHAR(50),
`form_name` VARCHAR(80),
`form_description` VARCHAR(255),
FOREIGN KEY (`service_id` ) REFERENCES `Services`(`service_id` )
);
CREATE TABLE `Individuals` (
`individual_id` INTEGER PRIMARY KEY,
`individual_first_name` VARCHAR(80),
`individual_middle_name` VARCHAR(80),
`inidividual_phone` VARCHAR(80),
`individual_email` VARCHAR(80),
`individual_address` VARCHAR(255),
`individual_last_name` VARCHAR(80)
);
CREATE TABLE `Organizations` (
`organization_id` INTEGER PRIMARY KEY,
`date_formed` DATETIME,
`organization_name` VARCHAR(255),
`uk_vat_number` VARCHAR(20)
);
CREATE TABLE `Parties` (
`party_id` INTEGER PRIMARY KEY,
`payment_method_code` VARCHAR(15) NOT NULL,
`party_phone` VARCHAR(80),
`party_email` VARCHAR(80)
);
CREATE TABLE `Organization_Contact_Individuals` (
`individual_id` INTEGER NOT NULL,
`organization_id` INTEGER NOT NULL,
`date_contact_from` DATETIME NOT NULL,
`date_contact_to` DATETIME,
PRIMARY KEY (`individual_id`,`organization_id` ),
FOREIGN KEY (`organization_id` ) REFERENCES `Organizations`(`organization_id` ),
FOREIGN KEY (`individual_id` ) REFERENCES `Individuals`(`individual_id` )
);
CREATE TABLE `Party_Addresses` (
`party_id` INTEGER NOT NULL,
`address_id` INTEGER NOT NULL,
`date_address_from` DATETIME NOT NULL,
`address_type_code` VARCHAR(15) NOT NULL,
`date_address_to` DATETIME,
PRIMARY KEY (`party_id`, `address_id`),
FOREIGN KEY (`address_id` ) REFERENCES `Addresses`(`address_id` ),
FOREIGN KEY (`party_id` ) REFERENCES `Parties`(`party_id` )
);
CREATE TABLE `Party_Forms` (
`party_id` INTEGER NOT NULL,
`form_id` INTEGER NOT NULL,
`date_completion_started` DATETIME NOT NULL,
`form_status_code` VARCHAR(15) NOT NULL,
`date_fully_completed` DATETIME,
PRIMARY KEY (`party_id`, `form_id`),
FOREIGN KEY (`party_id` ) REFERENCES `Parties`(`party_id` ),
FOREIGN KEY (`form_id` ) REFERENCES `Forms`(`form_id` )
);
CREATE TABLE `Party_Services` (
`booking_id` INTEGER NOT NULL ,
`customer_id` INTEGER NOT NULL,
`service_id` INTEGER NOT NULL,
`service_datetime` DATETIME NOT NULL,
`booking_made_date` DATETIME,
FOREIGN KEY (`service_id` ) REFERENCES `Services`(`service_id` ),
FOREIGN KEY (`customer_id` ) REFERENCES `Parties`(`party_id` )
);
INSERT INTO Addresses (`address_id`, `line_1_number_building`, `town_city`, `zip_postcode`, `state_province_county`, `country`) VALUES (1, '25518 Ortiz Centers', 'West Stacy', '193', 'NorthCarolina', 'USA')
INSERT INTO Services (`service_id`, `service_type_code`, `service_name`, `service_descriptio`) VALUES (1, 'Education', 'Education', 'Education')
INSERT INTO Forms (`form_id`, `form_type_code`, `service_id`, `form_number`, `form_name`, `form_description`) VALUES (1, 'Basic', 13, '8069', 'SSN Application', 'Form for SSN Application')
INSERT INTO Individuals (`individual_id`, `individual_first_name`, `individual_middle_name`, `inidividual_phone`, `individual_email`, `individual_address`, `individual_last_name`) VALUES (1, 'Oscar', 'Hosea', '1-925-696-5232', '[email protected]', '6956 Lia Plaza', 'Maggio')
INSERT INTO Organizations (`organization_id`, `date_formed`, `organization_name`, `uk_vat_number`) VALUES (1, '2016-08-24 23:52:48', 'Labour Party', '2157')
INSERT INTO Parties (`party_id`, `payment_method_code`, `party_phone`, `party_email`) VALUES (1, 'Cheque', '05374656172', '[email protected]')
INSERT INTO Organization_Contact_Individuals (`individual_id`, `organization_id`, `date_contact_from`, `date_contact_to`) VALUES (13, 1, '2016-08-16 22:09:11', '2018-03-25 10:27:18')
INSERT INTO Party_Addresses (`party_id`, `address_id`, `date_address_from`, `address_type_code`, `date_address_to`) VALUES (10, 8, '2016-04-08 22:40:02', 'Residence', '2018-02-28 23:14:41')
INSERT INTO Party_Forms (`party_id`, `form_id`, `date_completion_started`, `form_status_code`, `date_fully_completed`) VALUES (2, 4, '2017-12-17 11:29:47', 'Completed', '2018-02-11 16:46:10')
INSERT INTO Party_Services (`booking_id`, `customer_id`, `service_id`, `service_datetime`, `booking_made_date`) VALUES (1, 10, 12, '2018-03-10 22:43:12', '2018-03-23 23:56:51')
|
e_government
|
SELECT t1.party_email FROM parties AS t1 JOIN party_forms AS t2 ON t1.party_id = t2.party_id WHERE t2.form_id = (SELECT form_id FROM party_forms GROUP BY form_id ORDER BY count(*) DESC LIMIT 1)
|
What are the party emails associated with parties that used the party form that is the most common?
|
CREATE TABLE `Addresses` (
`address_id` INTEGER PRIMARY KEY,
`line_1_number_building` VARCHAR(80),
`town_city` VARCHAR(50),
`zip_postcode` VARCHAR(20),
`state_province_county` VARCHAR(50),
`country` VARCHAR(50)
);
CREATE TABLE `Services` (
`service_id` INTEGER PRIMARY KEY,
`service_type_code` VARCHAR(15) NOT NULL,
`service_name` VARCHAR(80),
`service_descriptio` VARCHAR(255)
);
CREATE TABLE `Forms` (
`form_id` INTEGER PRIMARY KEY,
`form_type_code` VARCHAR(15) NOT NULL,
`service_id` INTEGER,
`form_number` VARCHAR(50),
`form_name` VARCHAR(80),
`form_description` VARCHAR(255),
FOREIGN KEY (`service_id` ) REFERENCES `Services`(`service_id` )
);
CREATE TABLE `Individuals` (
`individual_id` INTEGER PRIMARY KEY,
`individual_first_name` VARCHAR(80),
`individual_middle_name` VARCHAR(80),
`inidividual_phone` VARCHAR(80),
`individual_email` VARCHAR(80),
`individual_address` VARCHAR(255),
`individual_last_name` VARCHAR(80)
);
CREATE TABLE `Organizations` (
`organization_id` INTEGER PRIMARY KEY,
`date_formed` DATETIME,
`organization_name` VARCHAR(255),
`uk_vat_number` VARCHAR(20)
);
CREATE TABLE `Parties` (
`party_id` INTEGER PRIMARY KEY,
`payment_method_code` VARCHAR(15) NOT NULL,
`party_phone` VARCHAR(80),
`party_email` VARCHAR(80)
);
CREATE TABLE `Organization_Contact_Individuals` (
`individual_id` INTEGER NOT NULL,
`organization_id` INTEGER NOT NULL,
`date_contact_from` DATETIME NOT NULL,
`date_contact_to` DATETIME,
PRIMARY KEY (`individual_id`,`organization_id` ),
FOREIGN KEY (`organization_id` ) REFERENCES `Organizations`(`organization_id` ),
FOREIGN KEY (`individual_id` ) REFERENCES `Individuals`(`individual_id` )
);
CREATE TABLE `Party_Addresses` (
`party_id` INTEGER NOT NULL,
`address_id` INTEGER NOT NULL,
`date_address_from` DATETIME NOT NULL,
`address_type_code` VARCHAR(15) NOT NULL,
`date_address_to` DATETIME,
PRIMARY KEY (`party_id`, `address_id`),
FOREIGN KEY (`address_id` ) REFERENCES `Addresses`(`address_id` ),
FOREIGN KEY (`party_id` ) REFERENCES `Parties`(`party_id` )
);
CREATE TABLE `Party_Forms` (
`party_id` INTEGER NOT NULL,
`form_id` INTEGER NOT NULL,
`date_completion_started` DATETIME NOT NULL,
`form_status_code` VARCHAR(15) NOT NULL,
`date_fully_completed` DATETIME,
PRIMARY KEY (`party_id`, `form_id`),
FOREIGN KEY (`party_id` ) REFERENCES `Parties`(`party_id` ),
FOREIGN KEY (`form_id` ) REFERENCES `Forms`(`form_id` )
);
CREATE TABLE `Party_Services` (
`booking_id` INTEGER NOT NULL ,
`customer_id` INTEGER NOT NULL,
`service_id` INTEGER NOT NULL,
`service_datetime` DATETIME NOT NULL,
`booking_made_date` DATETIME,
FOREIGN KEY (`service_id` ) REFERENCES `Services`(`service_id` ),
FOREIGN KEY (`customer_id` ) REFERENCES `Parties`(`party_id` )
);
INSERT INTO Addresses (`address_id`, `line_1_number_building`, `town_city`, `zip_postcode`, `state_province_county`, `country`) VALUES (1, '25518 Ortiz Centers', 'West Stacy', '193', 'NorthCarolina', 'USA')
INSERT INTO Services (`service_id`, `service_type_code`, `service_name`, `service_descriptio`) VALUES (1, 'Education', 'Education', 'Education')
INSERT INTO Forms (`form_id`, `form_type_code`, `service_id`, `form_number`, `form_name`, `form_description`) VALUES (1, 'Basic', 13, '8069', 'SSN Application', 'Form for SSN Application')
INSERT INTO Individuals (`individual_id`, `individual_first_name`, `individual_middle_name`, `inidividual_phone`, `individual_email`, `individual_address`, `individual_last_name`) VALUES (1, 'Oscar', 'Hosea', '1-925-696-5232', '[email protected]', '6956 Lia Plaza', 'Maggio')
INSERT INTO Organizations (`organization_id`, `date_formed`, `organization_name`, `uk_vat_number`) VALUES (1, '2016-08-24 23:52:48', 'Labour Party', '2157')
INSERT INTO Parties (`party_id`, `payment_method_code`, `party_phone`, `party_email`) VALUES (1, 'Cheque', '05374656172', '[email protected]')
INSERT INTO Organization_Contact_Individuals (`individual_id`, `organization_id`, `date_contact_from`, `date_contact_to`) VALUES (13, 1, '2016-08-16 22:09:11', '2018-03-25 10:27:18')
INSERT INTO Party_Addresses (`party_id`, `address_id`, `date_address_from`, `address_type_code`, `date_address_to`) VALUES (10, 8, '2016-04-08 22:40:02', 'Residence', '2018-02-28 23:14:41')
INSERT INTO Party_Forms (`party_id`, `form_id`, `date_completion_started`, `form_status_code`, `date_fully_completed`) VALUES (2, 4, '2017-12-17 11:29:47', 'Completed', '2018-02-11 16:46:10')
INSERT INTO Party_Services (`booking_id`, `customer_id`, `service_id`, `service_datetime`, `booking_made_date`) VALUES (1, 10, 12, '2018-03-10 22:43:12', '2018-03-23 23:56:51')
|
e_government
|
SELECT organization_name FROM organizations ORDER BY date_formed ASC
|
List all the name of organizations in order of the date formed.
|
CREATE TABLE `Addresses` (
`address_id` INTEGER PRIMARY KEY,
`line_1_number_building` VARCHAR(80),
`town_city` VARCHAR(50),
`zip_postcode` VARCHAR(20),
`state_province_county` VARCHAR(50),
`country` VARCHAR(50)
);
CREATE TABLE `Services` (
`service_id` INTEGER PRIMARY KEY,
`service_type_code` VARCHAR(15) NOT NULL,
`service_name` VARCHAR(80),
`service_descriptio` VARCHAR(255)
);
CREATE TABLE `Forms` (
`form_id` INTEGER PRIMARY KEY,
`form_type_code` VARCHAR(15) NOT NULL,
`service_id` INTEGER,
`form_number` VARCHAR(50),
`form_name` VARCHAR(80),
`form_description` VARCHAR(255),
FOREIGN KEY (`service_id` ) REFERENCES `Services`(`service_id` )
);
CREATE TABLE `Individuals` (
`individual_id` INTEGER PRIMARY KEY,
`individual_first_name` VARCHAR(80),
`individual_middle_name` VARCHAR(80),
`inidividual_phone` VARCHAR(80),
`individual_email` VARCHAR(80),
`individual_address` VARCHAR(255),
`individual_last_name` VARCHAR(80)
);
CREATE TABLE `Organizations` (
`organization_id` INTEGER PRIMARY KEY,
`date_formed` DATETIME,
`organization_name` VARCHAR(255),
`uk_vat_number` VARCHAR(20)
);
CREATE TABLE `Parties` (
`party_id` INTEGER PRIMARY KEY,
`payment_method_code` VARCHAR(15) NOT NULL,
`party_phone` VARCHAR(80),
`party_email` VARCHAR(80)
);
CREATE TABLE `Organization_Contact_Individuals` (
`individual_id` INTEGER NOT NULL,
`organization_id` INTEGER NOT NULL,
`date_contact_from` DATETIME NOT NULL,
`date_contact_to` DATETIME,
PRIMARY KEY (`individual_id`,`organization_id` ),
FOREIGN KEY (`organization_id` ) REFERENCES `Organizations`(`organization_id` ),
FOREIGN KEY (`individual_id` ) REFERENCES `Individuals`(`individual_id` )
);
CREATE TABLE `Party_Addresses` (
`party_id` INTEGER NOT NULL,
`address_id` INTEGER NOT NULL,
`date_address_from` DATETIME NOT NULL,
`address_type_code` VARCHAR(15) NOT NULL,
`date_address_to` DATETIME,
PRIMARY KEY (`party_id`, `address_id`),
FOREIGN KEY (`address_id` ) REFERENCES `Addresses`(`address_id` ),
FOREIGN KEY (`party_id` ) REFERENCES `Parties`(`party_id` )
);
CREATE TABLE `Party_Forms` (
`party_id` INTEGER NOT NULL,
`form_id` INTEGER NOT NULL,
`date_completion_started` DATETIME NOT NULL,
`form_status_code` VARCHAR(15) NOT NULL,
`date_fully_completed` DATETIME,
PRIMARY KEY (`party_id`, `form_id`),
FOREIGN KEY (`party_id` ) REFERENCES `Parties`(`party_id` ),
FOREIGN KEY (`form_id` ) REFERENCES `Forms`(`form_id` )
);
CREATE TABLE `Party_Services` (
`booking_id` INTEGER NOT NULL ,
`customer_id` INTEGER NOT NULL,
`service_id` INTEGER NOT NULL,
`service_datetime` DATETIME NOT NULL,
`booking_made_date` DATETIME,
FOREIGN KEY (`service_id` ) REFERENCES `Services`(`service_id` ),
FOREIGN KEY (`customer_id` ) REFERENCES `Parties`(`party_id` )
);
INSERT INTO Addresses (`address_id`, `line_1_number_building`, `town_city`, `zip_postcode`, `state_province_county`, `country`) VALUES (1, '25518 Ortiz Centers', 'West Stacy', '193', 'NorthCarolina', 'USA')
INSERT INTO Services (`service_id`, `service_type_code`, `service_name`, `service_descriptio`) VALUES (1, 'Education', 'Education', 'Education')
INSERT INTO Forms (`form_id`, `form_type_code`, `service_id`, `form_number`, `form_name`, `form_description`) VALUES (1, 'Basic', 13, '8069', 'SSN Application', 'Form for SSN Application')
INSERT INTO Individuals (`individual_id`, `individual_first_name`, `individual_middle_name`, `inidividual_phone`, `individual_email`, `individual_address`, `individual_last_name`) VALUES (1, 'Oscar', 'Hosea', '1-925-696-5232', '[email protected]', '6956 Lia Plaza', 'Maggio')
INSERT INTO Organizations (`organization_id`, `date_formed`, `organization_name`, `uk_vat_number`) VALUES (1, '2016-08-24 23:52:48', 'Labour Party', '2157')
INSERT INTO Parties (`party_id`, `payment_method_code`, `party_phone`, `party_email`) VALUES (1, 'Cheque', '05374656172', '[email protected]')
INSERT INTO Organization_Contact_Individuals (`individual_id`, `organization_id`, `date_contact_from`, `date_contact_to`) VALUES (13, 1, '2016-08-16 22:09:11', '2018-03-25 10:27:18')
INSERT INTO Party_Addresses (`party_id`, `address_id`, `date_address_from`, `address_type_code`, `date_address_to`) VALUES (10, 8, '2016-04-08 22:40:02', 'Residence', '2018-02-28 23:14:41')
INSERT INTO Party_Forms (`party_id`, `form_id`, `date_completion_started`, `form_status_code`, `date_fully_completed`) VALUES (2, 4, '2017-12-17 11:29:47', 'Completed', '2018-02-11 16:46:10')
INSERT INTO Party_Services (`booking_id`, `customer_id`, `service_id`, `service_datetime`, `booking_made_date`) VALUES (1, 10, 12, '2018-03-10 22:43:12', '2018-03-23 23:56:51')
|
e_government
|
SELECT organization_name FROM organizations ORDER BY date_formed ASC
|
What are the names of organizations, ordered by the date they were formed, ascending?
|
CREATE TABLE `Addresses` (
`address_id` INTEGER PRIMARY KEY,
`line_1_number_building` VARCHAR(80),
`town_city` VARCHAR(50),
`zip_postcode` VARCHAR(20),
`state_province_county` VARCHAR(50),
`country` VARCHAR(50)
);
CREATE TABLE `Services` (
`service_id` INTEGER PRIMARY KEY,
`service_type_code` VARCHAR(15) NOT NULL,
`service_name` VARCHAR(80),
`service_descriptio` VARCHAR(255)
);
CREATE TABLE `Forms` (
`form_id` INTEGER PRIMARY KEY,
`form_type_code` VARCHAR(15) NOT NULL,
`service_id` INTEGER,
`form_number` VARCHAR(50),
`form_name` VARCHAR(80),
`form_description` VARCHAR(255),
FOREIGN KEY (`service_id` ) REFERENCES `Services`(`service_id` )
);
CREATE TABLE `Individuals` (
`individual_id` INTEGER PRIMARY KEY,
`individual_first_name` VARCHAR(80),
`individual_middle_name` VARCHAR(80),
`inidividual_phone` VARCHAR(80),
`individual_email` VARCHAR(80),
`individual_address` VARCHAR(255),
`individual_last_name` VARCHAR(80)
);
CREATE TABLE `Organizations` (
`organization_id` INTEGER PRIMARY KEY,
`date_formed` DATETIME,
`organization_name` VARCHAR(255),
`uk_vat_number` VARCHAR(20)
);
CREATE TABLE `Parties` (
`party_id` INTEGER PRIMARY KEY,
`payment_method_code` VARCHAR(15) NOT NULL,
`party_phone` VARCHAR(80),
`party_email` VARCHAR(80)
);
CREATE TABLE `Organization_Contact_Individuals` (
`individual_id` INTEGER NOT NULL,
`organization_id` INTEGER NOT NULL,
`date_contact_from` DATETIME NOT NULL,
`date_contact_to` DATETIME,
PRIMARY KEY (`individual_id`,`organization_id` ),
FOREIGN KEY (`organization_id` ) REFERENCES `Organizations`(`organization_id` ),
FOREIGN KEY (`individual_id` ) REFERENCES `Individuals`(`individual_id` )
);
CREATE TABLE `Party_Addresses` (
`party_id` INTEGER NOT NULL,
`address_id` INTEGER NOT NULL,
`date_address_from` DATETIME NOT NULL,
`address_type_code` VARCHAR(15) NOT NULL,
`date_address_to` DATETIME,
PRIMARY KEY (`party_id`, `address_id`),
FOREIGN KEY (`address_id` ) REFERENCES `Addresses`(`address_id` ),
FOREIGN KEY (`party_id` ) REFERENCES `Parties`(`party_id` )
);
CREATE TABLE `Party_Forms` (
`party_id` INTEGER NOT NULL,
`form_id` INTEGER NOT NULL,
`date_completion_started` DATETIME NOT NULL,
`form_status_code` VARCHAR(15) NOT NULL,
`date_fully_completed` DATETIME,
PRIMARY KEY (`party_id`, `form_id`),
FOREIGN KEY (`party_id` ) REFERENCES `Parties`(`party_id` ),
FOREIGN KEY (`form_id` ) REFERENCES `Forms`(`form_id` )
);
CREATE TABLE `Party_Services` (
`booking_id` INTEGER NOT NULL ,
`customer_id` INTEGER NOT NULL,
`service_id` INTEGER NOT NULL,
`service_datetime` DATETIME NOT NULL,
`booking_made_date` DATETIME,
FOREIGN KEY (`service_id` ) REFERENCES `Services`(`service_id` ),
FOREIGN KEY (`customer_id` ) REFERENCES `Parties`(`party_id` )
);
INSERT INTO Addresses (`address_id`, `line_1_number_building`, `town_city`, `zip_postcode`, `state_province_county`, `country`) VALUES (1, '25518 Ortiz Centers', 'West Stacy', '193', 'NorthCarolina', 'USA')
INSERT INTO Services (`service_id`, `service_type_code`, `service_name`, `service_descriptio`) VALUES (1, 'Education', 'Education', 'Education')
INSERT INTO Forms (`form_id`, `form_type_code`, `service_id`, `form_number`, `form_name`, `form_description`) VALUES (1, 'Basic', 13, '8069', 'SSN Application', 'Form for SSN Application')
INSERT INTO Individuals (`individual_id`, `individual_first_name`, `individual_middle_name`, `inidividual_phone`, `individual_email`, `individual_address`, `individual_last_name`) VALUES (1, 'Oscar', 'Hosea', '1-925-696-5232', '[email protected]', '6956 Lia Plaza', 'Maggio')
INSERT INTO Organizations (`organization_id`, `date_formed`, `organization_name`, `uk_vat_number`) VALUES (1, '2016-08-24 23:52:48', 'Labour Party', '2157')
INSERT INTO Parties (`party_id`, `payment_method_code`, `party_phone`, `party_email`) VALUES (1, 'Cheque', '05374656172', '[email protected]')
INSERT INTO Organization_Contact_Individuals (`individual_id`, `organization_id`, `date_contact_from`, `date_contact_to`) VALUES (13, 1, '2016-08-16 22:09:11', '2018-03-25 10:27:18')
INSERT INTO Party_Addresses (`party_id`, `address_id`, `date_address_from`, `address_type_code`, `date_address_to`) VALUES (10, 8, '2016-04-08 22:40:02', 'Residence', '2018-02-28 23:14:41')
INSERT INTO Party_Forms (`party_id`, `form_id`, `date_completion_started`, `form_status_code`, `date_fully_completed`) VALUES (2, 4, '2017-12-17 11:29:47', 'Completed', '2018-02-11 16:46:10')
INSERT INTO Party_Services (`booking_id`, `customer_id`, `service_id`, `service_datetime`, `booking_made_date`) VALUES (1, 10, 12, '2018-03-10 22:43:12', '2018-03-23 23:56:51')
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.