db_id
stringclasses
146 values
question
stringlengths
3
224
sql
stringlengths
18
577
database_schema
stringclasses
146 values
small_bank_1
Find the names and total checking and savings balances of accounts whose savings balance is higher than the average savings balance.
SELECT T1.name , T2.balance + T3.balance FROM accounts AS T1 JOIN checking AS T2 ON T1.custid = T2.custid JOIN savings AS T3 ON T1.custid = T3.custid WHERE T3.balance > (SELECT avg(balance) FROM savings)
CREATE TABLE ACCOUNTS ( custid BIGINT NOT NULL PRIMARY KEY, name VARCHAR(64) NOT NULL ) 3 rows from ACCOUNTS table: custid name 1 Brown 2 Wang 3 O'mahony CREATE TABLE SAVINGS ( custid BIGINT NOT NULL PRIMARY KEY, balance FLOAT NOT NULL, FOREIGN KEY (custid) REFERENCES ACCOUNTS (custid) ) 3 rows from SAVINGS table: custid balance 1 200000.0 2 999999999.0 3 230000.0 CREATE TABLE CHECKING ( custid BIGINT NOT NULL PRIMARY KEY, balance FLOAT NOT NULL, FOREIGN KEY (custid) REFERENCES ACCOUNTS (custid) ) 3 rows from CHECKING table: custid balance 1 10000.0 2 2000.0 3 3000.0
small_bank_1
What are the names and sum of checking and savings balances for accounts with savings balances higher than the average savings balance?
SELECT T1.name , T2.balance + T3.balance FROM accounts AS T1 JOIN checking AS T2 ON T1.custid = T2.custid JOIN savings AS T3 ON T1.custid = T3.custid WHERE T3.balance > (SELECT avg(balance) FROM savings)
CREATE TABLE ACCOUNTS ( custid BIGINT NOT NULL PRIMARY KEY, name VARCHAR(64) NOT NULL ) 3 rows from ACCOUNTS table: custid name 1 Brown 2 Wang 3 O'mahony CREATE TABLE SAVINGS ( custid BIGINT NOT NULL PRIMARY KEY, balance FLOAT NOT NULL, FOREIGN KEY (custid) REFERENCES ACCOUNTS (custid) ) 3 rows from SAVINGS table: custid balance 1 200000.0 2 999999999.0 3 230000.0 CREATE TABLE CHECKING ( custid BIGINT NOT NULL PRIMARY KEY, balance FLOAT NOT NULL, FOREIGN KEY (custid) REFERENCES ACCOUNTS (custid) ) 3 rows from CHECKING table: custid balance 1 10000.0 2 2000.0 3 3000.0
small_bank_1
Find the name and checking balance of the account with the lowest savings balance.
SELECT T1.name , T2.balance FROM accounts AS T1 JOIN checking AS T2 ON T1.custid = T2.custid JOIN savings AS T3 ON T1.custid = T3.custid ORDER BY T3.balance LIMIT 1
CREATE TABLE ACCOUNTS ( custid BIGINT NOT NULL PRIMARY KEY, name VARCHAR(64) NOT NULL ) 3 rows from ACCOUNTS table: custid name 1 Brown 2 Wang 3 O'mahony CREATE TABLE SAVINGS ( custid BIGINT NOT NULL PRIMARY KEY, balance FLOAT NOT NULL, FOREIGN KEY (custid) REFERENCES ACCOUNTS (custid) ) 3 rows from SAVINGS table: custid balance 1 200000.0 2 999999999.0 3 230000.0 CREATE TABLE CHECKING ( custid BIGINT NOT NULL PRIMARY KEY, balance FLOAT NOT NULL, FOREIGN KEY (custid) REFERENCES ACCOUNTS (custid) ) 3 rows from CHECKING table: custid balance 1 10000.0 2 2000.0 3 3000.0
small_bank_1
What are the names and balances of checking accounts belonging to the customer with the lowest savings balance?
SELECT T1.name , T2.balance FROM accounts AS T1 JOIN checking AS T2 ON T1.custid = T2.custid JOIN savings AS T3 ON T1.custid = T3.custid ORDER BY T3.balance LIMIT 1
CREATE TABLE ACCOUNTS ( custid BIGINT NOT NULL PRIMARY KEY, name VARCHAR(64) NOT NULL ) 3 rows from ACCOUNTS table: custid name 1 Brown 2 Wang 3 O'mahony CREATE TABLE SAVINGS ( custid BIGINT NOT NULL PRIMARY KEY, balance FLOAT NOT NULL, FOREIGN KEY (custid) REFERENCES ACCOUNTS (custid) ) 3 rows from SAVINGS table: custid balance 1 200000.0 2 999999999.0 3 230000.0 CREATE TABLE CHECKING ( custid BIGINT NOT NULL PRIMARY KEY, balance FLOAT NOT NULL, FOREIGN KEY (custid) REFERENCES ACCOUNTS (custid) ) 3 rows from CHECKING table: custid balance 1 10000.0 2 2000.0 3 3000.0
small_bank_1
Find the number of checking accounts for each account name.
SELECT count(*) , T1.name FROM accounts AS T1 JOIN checking AS T2 ON T1.custid = T2.custid GROUP BY T1.name
CREATE TABLE ACCOUNTS ( custid BIGINT NOT NULL PRIMARY KEY, name VARCHAR(64) NOT NULL ) 3 rows from ACCOUNTS table: custid name 1 Brown 2 Wang 3 O'mahony CREATE TABLE SAVINGS ( custid BIGINT NOT NULL PRIMARY KEY, balance FLOAT NOT NULL, FOREIGN KEY (custid) REFERENCES ACCOUNTS (custid) ) 3 rows from SAVINGS table: custid balance 1 200000.0 2 999999999.0 3 230000.0 CREATE TABLE CHECKING ( custid BIGINT NOT NULL PRIMARY KEY, balance FLOAT NOT NULL, FOREIGN KEY (custid) REFERENCES ACCOUNTS (custid) ) 3 rows from CHECKING table: custid balance 1 10000.0 2 2000.0 3 3000.0
small_bank_1
What are the names of customers with accounts, and how many checking accounts do each of them have?
SELECT count(*) , T1.name FROM accounts AS T1 JOIN checking AS T2 ON T1.custid = T2.custid GROUP BY T1.name
CREATE TABLE ACCOUNTS ( custid BIGINT NOT NULL PRIMARY KEY, name VARCHAR(64) NOT NULL ) 3 rows from ACCOUNTS table: custid name 1 Brown 2 Wang 3 O'mahony CREATE TABLE SAVINGS ( custid BIGINT NOT NULL PRIMARY KEY, balance FLOAT NOT NULL, FOREIGN KEY (custid) REFERENCES ACCOUNTS (custid) ) 3 rows from SAVINGS table: custid balance 1 200000.0 2 999999999.0 3 230000.0 CREATE TABLE CHECKING ( custid BIGINT NOT NULL PRIMARY KEY, balance FLOAT NOT NULL, FOREIGN KEY (custid) REFERENCES ACCOUNTS (custid) ) 3 rows from CHECKING table: custid balance 1 10000.0 2 2000.0 3 3000.0
small_bank_1
Find the total saving balance for each account name.
SELECT sum(T2.balance) , T1.name FROM accounts AS T1 JOIN savings AS T2 ON T1.custid = T2.custid GROUP BY T1.name
CREATE TABLE ACCOUNTS ( custid BIGINT NOT NULL PRIMARY KEY, name VARCHAR(64) NOT NULL ) 3 rows from ACCOUNTS table: custid name 1 Brown 2 Wang 3 O'mahony CREATE TABLE SAVINGS ( custid BIGINT NOT NULL PRIMARY KEY, balance FLOAT NOT NULL, FOREIGN KEY (custid) REFERENCES ACCOUNTS (custid) ) 3 rows from SAVINGS table: custid balance 1 200000.0 2 999999999.0 3 230000.0 CREATE TABLE CHECKING ( custid BIGINT NOT NULL PRIMARY KEY, balance FLOAT NOT NULL, FOREIGN KEY (custid) REFERENCES ACCOUNTS (custid) ) 3 rows from CHECKING table: custid balance 1 10000.0 2 2000.0 3 3000.0
small_bank_1
What are the names of customers with accounts, and what are the total savings balances for each?
SELECT sum(T2.balance) , T1.name FROM accounts AS T1 JOIN savings AS T2 ON T1.custid = T2.custid GROUP BY T1.name
CREATE TABLE ACCOUNTS ( custid BIGINT NOT NULL PRIMARY KEY, name VARCHAR(64) NOT NULL ) 3 rows from ACCOUNTS table: custid name 1 Brown 2 Wang 3 O'mahony CREATE TABLE SAVINGS ( custid BIGINT NOT NULL PRIMARY KEY, balance FLOAT NOT NULL, FOREIGN KEY (custid) REFERENCES ACCOUNTS (custid) ) 3 rows from SAVINGS table: custid balance 1 200000.0 2 999999999.0 3 230000.0 CREATE TABLE CHECKING ( custid BIGINT NOT NULL PRIMARY KEY, balance FLOAT NOT NULL, FOREIGN KEY (custid) REFERENCES ACCOUNTS (custid) ) 3 rows from CHECKING table: custid balance 1 10000.0 2 2000.0 3 3000.0
small_bank_1
Find the name of accounts whose checking balance is below the average checking balance.
SELECT T1.name FROM accounts AS T1 JOIN checking AS T2 ON T1.custid = T2.custid WHERE T2.balance < (SELECT avg(balance) FROM checking)
CREATE TABLE ACCOUNTS ( custid BIGINT NOT NULL PRIMARY KEY, name VARCHAR(64) NOT NULL ) 3 rows from ACCOUNTS table: custid name 1 Brown 2 Wang 3 O'mahony CREATE TABLE SAVINGS ( custid BIGINT NOT NULL PRIMARY KEY, balance FLOAT NOT NULL, FOREIGN KEY (custid) REFERENCES ACCOUNTS (custid) ) 3 rows from SAVINGS table: custid balance 1 200000.0 2 999999999.0 3 230000.0 CREATE TABLE CHECKING ( custid BIGINT NOT NULL PRIMARY KEY, balance FLOAT NOT NULL, FOREIGN KEY (custid) REFERENCES ACCOUNTS (custid) ) 3 rows from CHECKING table: custid balance 1 10000.0 2 2000.0 3 3000.0
small_bank_1
What are the names of customers with checking balances lower than the average checking balance?
SELECT T1.name FROM accounts AS T1 JOIN checking AS T2 ON T1.custid = T2.custid WHERE T2.balance < (SELECT avg(balance) FROM checking)
CREATE TABLE ACCOUNTS ( custid BIGINT NOT NULL PRIMARY KEY, name VARCHAR(64) NOT NULL ) 3 rows from ACCOUNTS table: custid name 1 Brown 2 Wang 3 O'mahony CREATE TABLE SAVINGS ( custid BIGINT NOT NULL PRIMARY KEY, balance FLOAT NOT NULL, FOREIGN KEY (custid) REFERENCES ACCOUNTS (custid) ) 3 rows from SAVINGS table: custid balance 1 200000.0 2 999999999.0 3 230000.0 CREATE TABLE CHECKING ( custid BIGINT NOT NULL PRIMARY KEY, balance FLOAT NOT NULL, FOREIGN KEY (custid) REFERENCES ACCOUNTS (custid) ) 3 rows from CHECKING table: custid balance 1 10000.0 2 2000.0 3 3000.0
small_bank_1
Find the saving balance of the account with the highest checking balance.
SELECT T3.balance FROM accounts AS T1 JOIN checking AS T2 ON T1.custid = T2.custid JOIN savings AS T3 ON T1.custid = T3.custid ORDER BY T2.balance DESC LIMIT 1
CREATE TABLE ACCOUNTS ( custid BIGINT NOT NULL PRIMARY KEY, name VARCHAR(64) NOT NULL ) 3 rows from ACCOUNTS table: custid name 1 Brown 2 Wang 3 O'mahony CREATE TABLE SAVINGS ( custid BIGINT NOT NULL PRIMARY KEY, balance FLOAT NOT NULL, FOREIGN KEY (custid) REFERENCES ACCOUNTS (custid) ) 3 rows from SAVINGS table: custid balance 1 200000.0 2 999999999.0 3 230000.0 CREATE TABLE CHECKING ( custid BIGINT NOT NULL PRIMARY KEY, balance FLOAT NOT NULL, FOREIGN KEY (custid) REFERENCES ACCOUNTS (custid) ) 3 rows from CHECKING table: custid balance 1 10000.0 2 2000.0 3 3000.0
small_bank_1
What is the savings balance of the account belonging to the customer with the highest checking balance?
SELECT T3.balance FROM accounts AS T1 JOIN checking AS T2 ON T1.custid = T2.custid JOIN savings AS T3 ON T1.custid = T3.custid ORDER BY T2.balance DESC LIMIT 1
CREATE TABLE ACCOUNTS ( custid BIGINT NOT NULL PRIMARY KEY, name VARCHAR(64) NOT NULL ) 3 rows from ACCOUNTS table: custid name 1 Brown 2 Wang 3 O'mahony CREATE TABLE SAVINGS ( custid BIGINT NOT NULL PRIMARY KEY, balance FLOAT NOT NULL, FOREIGN KEY (custid) REFERENCES ACCOUNTS (custid) ) 3 rows from SAVINGS table: custid balance 1 200000.0 2 999999999.0 3 230000.0 CREATE TABLE CHECKING ( custid BIGINT NOT NULL PRIMARY KEY, balance FLOAT NOT NULL, FOREIGN KEY (custid) REFERENCES ACCOUNTS (custid) ) 3 rows from CHECKING table: custid balance 1 10000.0 2 2000.0 3 3000.0
small_bank_1
Find the total checking and saving balance of all accounts sorted by the total balance in ascending order.
SELECT T1.balance + T2.balance FROM checking AS T1 JOIN savings AS T2 ON T1.custid = T2.custid ORDER BY T1.balance + T2.balance
CREATE TABLE ACCOUNTS ( custid BIGINT NOT NULL PRIMARY KEY, name VARCHAR(64) NOT NULL ) 3 rows from ACCOUNTS table: custid name 1 Brown 2 Wang 3 O'mahony CREATE TABLE SAVINGS ( custid BIGINT NOT NULL PRIMARY KEY, balance FLOAT NOT NULL, FOREIGN KEY (custid) REFERENCES ACCOUNTS (custid) ) 3 rows from SAVINGS table: custid balance 1 200000.0 2 999999999.0 3 230000.0 CREATE TABLE CHECKING ( custid BIGINT NOT NULL PRIMARY KEY, balance FLOAT NOT NULL, FOREIGN KEY (custid) REFERENCES ACCOUNTS (custid) ) 3 rows from CHECKING table: custid balance 1 10000.0 2 2000.0 3 3000.0
small_bank_1
What is the sum of checking and savings balances for all customers, ordered by the total balance?
SELECT T1.balance + T2.balance FROM checking AS T1 JOIN savings AS T2 ON T1.custid = T2.custid ORDER BY T1.balance + T2.balance
CREATE TABLE ACCOUNTS ( custid BIGINT NOT NULL PRIMARY KEY, name VARCHAR(64) NOT NULL ) 3 rows from ACCOUNTS table: custid name 1 Brown 2 Wang 3 O'mahony CREATE TABLE SAVINGS ( custid BIGINT NOT NULL PRIMARY KEY, balance FLOAT NOT NULL, FOREIGN KEY (custid) REFERENCES ACCOUNTS (custid) ) 3 rows from SAVINGS table: custid balance 1 200000.0 2 999999999.0 3 230000.0 CREATE TABLE CHECKING ( custid BIGINT NOT NULL PRIMARY KEY, balance FLOAT NOT NULL, FOREIGN KEY (custid) REFERENCES ACCOUNTS (custid) ) 3 rows from CHECKING table: custid balance 1 10000.0 2 2000.0 3 3000.0
small_bank_1
Find the name and checking balance of the account with the lowest saving balance.
SELECT T2.balance , T1.name FROM accounts AS T1 JOIN checking AS T2 ON T1.custid = T2.custid JOIN savings AS T3 ON T1.custid = T3.custid ORDER BY T3.balance LIMIT 1
CREATE TABLE ACCOUNTS ( custid BIGINT NOT NULL PRIMARY KEY, name VARCHAR(64) NOT NULL ) 3 rows from ACCOUNTS table: custid name 1 Brown 2 Wang 3 O'mahony CREATE TABLE SAVINGS ( custid BIGINT NOT NULL PRIMARY KEY, balance FLOAT NOT NULL, FOREIGN KEY (custid) REFERENCES ACCOUNTS (custid) ) 3 rows from SAVINGS table: custid balance 1 200000.0 2 999999999.0 3 230000.0 CREATE TABLE CHECKING ( custid BIGINT NOT NULL PRIMARY KEY, balance FLOAT NOT NULL, FOREIGN KEY (custid) REFERENCES ACCOUNTS (custid) ) 3 rows from CHECKING table: custid balance 1 10000.0 2 2000.0 3 3000.0
small_bank_1
What is the name and checking balance of the account which has the lowest savings balance?
SELECT T2.balance , T1.name FROM accounts AS T1 JOIN checking AS T2 ON T1.custid = T2.custid JOIN savings AS T3 ON T1.custid = T3.custid ORDER BY T3.balance LIMIT 1
CREATE TABLE ACCOUNTS ( custid BIGINT NOT NULL PRIMARY KEY, name VARCHAR(64) NOT NULL ) 3 rows from ACCOUNTS table: custid name 1 Brown 2 Wang 3 O'mahony CREATE TABLE SAVINGS ( custid BIGINT NOT NULL PRIMARY KEY, balance FLOAT NOT NULL, FOREIGN KEY (custid) REFERENCES ACCOUNTS (custid) ) 3 rows from SAVINGS table: custid balance 1 200000.0 2 999999999.0 3 230000.0 CREATE TABLE CHECKING ( custid BIGINT NOT NULL PRIMARY KEY, balance FLOAT NOT NULL, FOREIGN KEY (custid) REFERENCES ACCOUNTS (custid) ) 3 rows from CHECKING table: custid balance 1 10000.0 2 2000.0 3 3000.0
small_bank_1
Find the name, checking balance and saving balance of all accounts in the bank.
SELECT T2.balance , T3.balance , T1.name FROM accounts AS T1 JOIN checking AS T2 ON T1.custid = T2.custid JOIN savings AS T3 ON T1.custid = T3.custid
CREATE TABLE ACCOUNTS ( custid BIGINT NOT NULL PRIMARY KEY, name VARCHAR(64) NOT NULL ) 3 rows from ACCOUNTS table: custid name 1 Brown 2 Wang 3 O'mahony CREATE TABLE SAVINGS ( custid BIGINT NOT NULL PRIMARY KEY, balance FLOAT NOT NULL, FOREIGN KEY (custid) REFERENCES ACCOUNTS (custid) ) 3 rows from SAVINGS table: custid balance 1 200000.0 2 999999999.0 3 230000.0 CREATE TABLE CHECKING ( custid BIGINT NOT NULL PRIMARY KEY, balance FLOAT NOT NULL, FOREIGN KEY (custid) REFERENCES ACCOUNTS (custid) ) 3 rows from CHECKING table: custid balance 1 10000.0 2 2000.0 3 3000.0
small_bank_1
What are the names, checking balances, and savings balances for all customers?
SELECT T2.balance , T3.balance , T1.name FROM accounts AS T1 JOIN checking AS T2 ON T1.custid = T2.custid JOIN savings AS T3 ON T1.custid = T3.custid
CREATE TABLE ACCOUNTS ( custid BIGINT NOT NULL PRIMARY KEY, name VARCHAR(64) NOT NULL ) 3 rows from ACCOUNTS table: custid name 1 Brown 2 Wang 3 O'mahony CREATE TABLE SAVINGS ( custid BIGINT NOT NULL PRIMARY KEY, balance FLOAT NOT NULL, FOREIGN KEY (custid) REFERENCES ACCOUNTS (custid) ) 3 rows from SAVINGS table: custid balance 1 200000.0 2 999999999.0 3 230000.0 CREATE TABLE CHECKING ( custid BIGINT NOT NULL PRIMARY KEY, balance FLOAT NOT NULL, FOREIGN KEY (custid) REFERENCES ACCOUNTS (custid) ) 3 rows from CHECKING table: custid balance 1 10000.0 2 2000.0 3 3000.0
small_bank_1
Find the name, checking balance and savings balance of all accounts in the bank sorted by their total checking and savings balance in descending order.
SELECT T2.balance , T3.balance , T1.name FROM accounts AS T1 JOIN checking AS T2 ON T1.custid = T2.custid JOIN savings AS T3 ON T1.custid = T3.custid ORDER BY T2.balance + T3.balance DESC
CREATE TABLE ACCOUNTS ( custid BIGINT NOT NULL PRIMARY KEY, name VARCHAR(64) NOT NULL ) 3 rows from ACCOUNTS table: custid name 1 Brown 2 Wang 3 O'mahony CREATE TABLE SAVINGS ( custid BIGINT NOT NULL PRIMARY KEY, balance FLOAT NOT NULL, FOREIGN KEY (custid) REFERENCES ACCOUNTS (custid) ) 3 rows from SAVINGS table: custid balance 1 200000.0 2 999999999.0 3 230000.0 CREATE TABLE CHECKING ( custid BIGINT NOT NULL PRIMARY KEY, balance FLOAT NOT NULL, FOREIGN KEY (custid) REFERENCES ACCOUNTS (custid) ) 3 rows from CHECKING table: custid balance 1 10000.0 2 2000.0 3 3000.0
small_bank_1
What are the names, checking balances, and savings balances of customers, ordered by the total of checking and savings balances descending?
SELECT T2.balance , T3.balance , T1.name FROM accounts AS T1 JOIN checking AS T2 ON T1.custid = T2.custid JOIN savings AS T3 ON T1.custid = T3.custid ORDER BY T2.balance + T3.balance DESC
CREATE TABLE ACCOUNTS ( custid BIGINT NOT NULL PRIMARY KEY, name VARCHAR(64) NOT NULL ) 3 rows from ACCOUNTS table: custid name 1 Brown 2 Wang 3 O'mahony CREATE TABLE SAVINGS ( custid BIGINT NOT NULL PRIMARY KEY, balance FLOAT NOT NULL, FOREIGN KEY (custid) REFERENCES ACCOUNTS (custid) ) 3 rows from SAVINGS table: custid balance 1 200000.0 2 999999999.0 3 230000.0 CREATE TABLE CHECKING ( custid BIGINT NOT NULL PRIMARY KEY, balance FLOAT NOT NULL, FOREIGN KEY (custid) REFERENCES ACCOUNTS (custid) ) 3 rows from CHECKING table: custid balance 1 10000.0 2 2000.0 3 3000.0
small_bank_1
Find the name of accounts whose checking balance is higher than corresponding saving balance.
SELECT T1.name FROM accounts AS T1 JOIN checking AS T2 ON T1.custid = T2.custid JOIN savings AS T3 ON T1.custid = T3.custid WHERE T2.balance > T3.balance
CREATE TABLE ACCOUNTS ( custid BIGINT NOT NULL PRIMARY KEY, name VARCHAR(64) NOT NULL ) 3 rows from ACCOUNTS table: custid name 1 Brown 2 Wang 3 O'mahony CREATE TABLE SAVINGS ( custid BIGINT NOT NULL PRIMARY KEY, balance FLOAT NOT NULL, FOREIGN KEY (custid) REFERENCES ACCOUNTS (custid) ) 3 rows from SAVINGS table: custid balance 1 200000.0 2 999999999.0 3 230000.0 CREATE TABLE CHECKING ( custid BIGINT NOT NULL PRIMARY KEY, balance FLOAT NOT NULL, FOREIGN KEY (custid) REFERENCES ACCOUNTS (custid) ) 3 rows from CHECKING table: custid balance 1 10000.0 2 2000.0 3 3000.0
small_bank_1
What are the names of customers with a higher checking balance than savings balance?
SELECT T1.name FROM accounts AS T1 JOIN checking AS T2 ON T1.custid = T2.custid JOIN savings AS T3 ON T1.custid = T3.custid WHERE T2.balance > T3.balance
CREATE TABLE ACCOUNTS ( custid BIGINT NOT NULL PRIMARY KEY, name VARCHAR(64) NOT NULL ) 3 rows from ACCOUNTS table: custid name 1 Brown 2 Wang 3 O'mahony CREATE TABLE SAVINGS ( custid BIGINT NOT NULL PRIMARY KEY, balance FLOAT NOT NULL, FOREIGN KEY (custid) REFERENCES ACCOUNTS (custid) ) 3 rows from SAVINGS table: custid balance 1 200000.0 2 999999999.0 3 230000.0 CREATE TABLE CHECKING ( custid BIGINT NOT NULL PRIMARY KEY, balance FLOAT NOT NULL, FOREIGN KEY (custid) REFERENCES ACCOUNTS (custid) ) 3 rows from CHECKING table: custid balance 1 10000.0 2 2000.0 3 3000.0
small_bank_1
Find the name and total checking and savings balance of the accounts whose savings balance is lower than corresponding checking balance.
SELECT T1.name , T3.balance + T2.balance FROM accounts AS T1 JOIN checking AS T2 ON T1.custid = T2.custid JOIN savings AS T3 ON T1.custid = T3.custid WHERE T3.balance < T2.balance
CREATE TABLE ACCOUNTS ( custid BIGINT NOT NULL PRIMARY KEY, name VARCHAR(64) NOT NULL ) 3 rows from ACCOUNTS table: custid name 1 Brown 2 Wang 3 O'mahony CREATE TABLE SAVINGS ( custid BIGINT NOT NULL PRIMARY KEY, balance FLOAT NOT NULL, FOREIGN KEY (custid) REFERENCES ACCOUNTS (custid) ) 3 rows from SAVINGS table: custid balance 1 200000.0 2 999999999.0 3 230000.0 CREATE TABLE CHECKING ( custid BIGINT NOT NULL PRIMARY KEY, balance FLOAT NOT NULL, FOREIGN KEY (custid) REFERENCES ACCOUNTS (custid) ) 3 rows from CHECKING table: custid balance 1 10000.0 2 2000.0 3 3000.0
small_bank_1
What are the names of customers who have a savings balance lower than their checking balance, and what is the total of their checking and savings balances?
SELECT T1.name , T3.balance + T2.balance FROM accounts AS T1 JOIN checking AS T2 ON T1.custid = T2.custid JOIN savings AS T3 ON T1.custid = T3.custid WHERE T3.balance < T2.balance
CREATE TABLE ACCOUNTS ( custid BIGINT NOT NULL PRIMARY KEY, name VARCHAR(64) NOT NULL ) 3 rows from ACCOUNTS table: custid name 1 Brown 2 Wang 3 O'mahony CREATE TABLE SAVINGS ( custid BIGINT NOT NULL PRIMARY KEY, balance FLOAT NOT NULL, FOREIGN KEY (custid) REFERENCES ACCOUNTS (custid) ) 3 rows from SAVINGS table: custid balance 1 200000.0 2 999999999.0 3 230000.0 CREATE TABLE CHECKING ( custid BIGINT NOT NULL PRIMARY KEY, balance FLOAT NOT NULL, FOREIGN KEY (custid) REFERENCES ACCOUNTS (custid) ) 3 rows from CHECKING table: custid balance 1 10000.0 2 2000.0 3 3000.0
small_bank_1
Find the name and savings balance of the top 3 accounts with the highest saving balance sorted by savings balance in descending order.
SELECT T1.name , T2.balance FROM accounts AS T1 JOIN savings AS T2 ON T1.custid = T2.custid ORDER BY T2.balance DESC LIMIT 3
CREATE TABLE ACCOUNTS ( custid BIGINT NOT NULL PRIMARY KEY, name VARCHAR(64) NOT NULL ) 3 rows from ACCOUNTS table: custid name 1 Brown 2 Wang 3 O'mahony CREATE TABLE SAVINGS ( custid BIGINT NOT NULL PRIMARY KEY, balance FLOAT NOT NULL, FOREIGN KEY (custid) REFERENCES ACCOUNTS (custid) ) 3 rows from SAVINGS table: custid balance 1 200000.0 2 999999999.0 3 230000.0 CREATE TABLE CHECKING ( custid BIGINT NOT NULL PRIMARY KEY, balance FLOAT NOT NULL, FOREIGN KEY (custid) REFERENCES ACCOUNTS (custid) ) 3 rows from CHECKING table: custid balance 1 10000.0 2 2000.0 3 3000.0
small_bank_1
What are names and savings balances of the three accounts with the highest savings balances?
SELECT T1.name , T2.balance FROM accounts AS T1 JOIN savings AS T2 ON T1.custid = T2.custid ORDER BY T2.balance DESC LIMIT 3
CREATE TABLE ACCOUNTS ( custid BIGINT NOT NULL PRIMARY KEY, name VARCHAR(64) NOT NULL ) 3 rows from ACCOUNTS table: custid name 1 Brown 2 Wang 3 O'mahony CREATE TABLE SAVINGS ( custid BIGINT NOT NULL PRIMARY KEY, balance FLOAT NOT NULL, FOREIGN KEY (custid) REFERENCES ACCOUNTS (custid) ) 3 rows from SAVINGS table: custid balance 1 200000.0 2 999999999.0 3 230000.0 CREATE TABLE CHECKING ( custid BIGINT NOT NULL PRIMARY KEY, balance FLOAT NOT NULL, FOREIGN KEY (custid) REFERENCES ACCOUNTS (custid) ) 3 rows from CHECKING table: custid balance 1 10000.0 2 2000.0 3 3000.0
browser_web
How many main stream browsers whose market share is at least 5 exist?
SELECT count(*) FROM browser WHERE market_share >= 5
CREATE TABLE "Web_client_accelerator" ( "id" int, "name" text, "Operating_system" text, "Client" text, "Connection" text, primary key("id") ) 3 rows from Web_client_accelerator table: id name Operating_system Client Connection 1 CACHEbox Appliance (Linux) End user, ISP Broadband, Satellite, Wireless, Fiber, DSL 2 CProxy Windows user up to 756kbit/s 3 Fasterfox Windows, Mac, Linux and Mobile devices user Dialup, Wireless, Broadband, DSL CREATE TABLE "browser" ( "id" int, "name" text, "market_share" real, primary key("id") ) 3 rows from browser table: id name market_share 1 Internet Explorer 28.96 2 Firefox 18.11 3 Safari 8.54 CREATE TABLE "accelerator_compatible_browser" ( "accelerator_id" int, "browser_id" int, "compatible_since_year" int, primary key("accelerator_id", "browser_id"), foreign key ("accelerator_id") references `Web_client_accelerator`("id"), foreign key ("browser_id") references `browser`("id") ) 3 rows from accelerator_compatible_browser table: accelerator_id browser_id compatible_since_year 1 1 1995 1 2 1996 2 3 1996
browser_web
List the name of browsers in descending order by market share.
SELECT name FROM browser ORDER BY market_share DESC
CREATE TABLE "Web_client_accelerator" ( "id" int, "name" text, "Operating_system" text, "Client" text, "Connection" text, primary key("id") ) 3 rows from Web_client_accelerator table: id name Operating_system Client Connection 1 CACHEbox Appliance (Linux) End user, ISP Broadband, Satellite, Wireless, Fiber, DSL 2 CProxy Windows user up to 756kbit/s 3 Fasterfox Windows, Mac, Linux and Mobile devices user Dialup, Wireless, Broadband, DSL CREATE TABLE "browser" ( "id" int, "name" text, "market_share" real, primary key("id") ) 3 rows from browser table: id name market_share 1 Internet Explorer 28.96 2 Firefox 18.11 3 Safari 8.54 CREATE TABLE "accelerator_compatible_browser" ( "accelerator_id" int, "browser_id" int, "compatible_since_year" int, primary key("accelerator_id", "browser_id"), foreign key ("accelerator_id") references `Web_client_accelerator`("id"), foreign key ("browser_id") references `browser`("id") ) 3 rows from accelerator_compatible_browser table: accelerator_id browser_id compatible_since_year 1 1 1995 1 2 1996 2 3 1996
browser_web
List the ids, names and market shares of all browsers.
SELECT id , name , market_share FROM browser
CREATE TABLE "Web_client_accelerator" ( "id" int, "name" text, "Operating_system" text, "Client" text, "Connection" text, primary key("id") ) 3 rows from Web_client_accelerator table: id name Operating_system Client Connection 1 CACHEbox Appliance (Linux) End user, ISP Broadband, Satellite, Wireless, Fiber, DSL 2 CProxy Windows user up to 756kbit/s 3 Fasterfox Windows, Mac, Linux and Mobile devices user Dialup, Wireless, Broadband, DSL CREATE TABLE "browser" ( "id" int, "name" text, "market_share" real, primary key("id") ) 3 rows from browser table: id name market_share 1 Internet Explorer 28.96 2 Firefox 18.11 3 Safari 8.54 CREATE TABLE "accelerator_compatible_browser" ( "accelerator_id" int, "browser_id" int, "compatible_since_year" int, primary key("accelerator_id", "browser_id"), foreign key ("accelerator_id") references `Web_client_accelerator`("id"), foreign key ("browser_id") references `browser`("id") ) 3 rows from accelerator_compatible_browser table: accelerator_id browser_id compatible_since_year 1 1 1995 1 2 1996 2 3 1996
browser_web
What is the maximum, minimum and average market share of the listed browsers?
SELECT max(market_share) , min(market_share) , avg(market_share) FROM browser
CREATE TABLE "Web_client_accelerator" ( "id" int, "name" text, "Operating_system" text, "Client" text, "Connection" text, primary key("id") ) 3 rows from Web_client_accelerator table: id name Operating_system Client Connection 1 CACHEbox Appliance (Linux) End user, ISP Broadband, Satellite, Wireless, Fiber, DSL 2 CProxy Windows user up to 756kbit/s 3 Fasterfox Windows, Mac, Linux and Mobile devices user Dialup, Wireless, Broadband, DSL CREATE TABLE "browser" ( "id" int, "name" text, "market_share" real, primary key("id") ) 3 rows from browser table: id name market_share 1 Internet Explorer 28.96 2 Firefox 18.11 3 Safari 8.54 CREATE TABLE "accelerator_compatible_browser" ( "accelerator_id" int, "browser_id" int, "compatible_since_year" int, primary key("accelerator_id", "browser_id"), foreign key ("accelerator_id") references `Web_client_accelerator`("id"), foreign key ("browser_id") references `browser`("id") ) 3 rows from accelerator_compatible_browser table: accelerator_id browser_id compatible_since_year 1 1 1995 1 2 1996 2 3 1996
browser_web
What is the id and market share of the browser Safari?
SELECT id , market_share FROM browser WHERE name = 'Safari'
CREATE TABLE "Web_client_accelerator" ( "id" int, "name" text, "Operating_system" text, "Client" text, "Connection" text, primary key("id") ) 3 rows from Web_client_accelerator table: id name Operating_system Client Connection 1 CACHEbox Appliance (Linux) End user, ISP Broadband, Satellite, Wireless, Fiber, DSL 2 CProxy Windows user up to 756kbit/s 3 Fasterfox Windows, Mac, Linux and Mobile devices user Dialup, Wireless, Broadband, DSL CREATE TABLE "browser" ( "id" int, "name" text, "market_share" real, primary key("id") ) 3 rows from browser table: id name market_share 1 Internet Explorer 28.96 2 Firefox 18.11 3 Safari 8.54 CREATE TABLE "accelerator_compatible_browser" ( "accelerator_id" int, "browser_id" int, "compatible_since_year" int, primary key("accelerator_id", "browser_id"), foreign key ("accelerator_id") references `Web_client_accelerator`("id"), foreign key ("browser_id") references `browser`("id") ) 3 rows from accelerator_compatible_browser table: accelerator_id browser_id compatible_since_year 1 1 1995 1 2 1996 2 3 1996
browser_web
What are the name and os of web client accelerators that do not work with only a 'Broadband' type connection?
SELECT name , operating_system FROM web_client_accelerator WHERE CONNECTION != 'Broadband'
CREATE TABLE "Web_client_accelerator" ( "id" int, "name" text, "Operating_system" text, "Client" text, "Connection" text, primary key("id") ) 3 rows from Web_client_accelerator table: id name Operating_system Client Connection 1 CACHEbox Appliance (Linux) End user, ISP Broadband, Satellite, Wireless, Fiber, DSL 2 CProxy Windows user up to 756kbit/s 3 Fasterfox Windows, Mac, Linux and Mobile devices user Dialup, Wireless, Broadband, DSL CREATE TABLE "browser" ( "id" int, "name" text, "market_share" real, primary key("id") ) 3 rows from browser table: id name market_share 1 Internet Explorer 28.96 2 Firefox 18.11 3 Safari 8.54 CREATE TABLE "accelerator_compatible_browser" ( "accelerator_id" int, "browser_id" int, "compatible_since_year" int, primary key("accelerator_id", "browser_id"), foreign key ("accelerator_id") references `Web_client_accelerator`("id"), foreign key ("browser_id") references `browser`("id") ) 3 rows from accelerator_compatible_browser table: accelerator_id browser_id compatible_since_year 1 1 1995 1 2 1996 2 3 1996
browser_web
What is the name of the browser that became compatible with the accelerator 'CProxy' after year 1998 ?
SELECT T1.name FROM browser AS T1 JOIN accelerator_compatible_browser AS T2 ON T1.id = T2.browser_id JOIN web_client_accelerator AS T3 ON T2.accelerator_id = T3.id WHERE T3.name = 'CProxy' AND T2.compatible_since_year > 1998
CREATE TABLE "Web_client_accelerator" ( "id" int, "name" text, "Operating_system" text, "Client" text, "Connection" text, primary key("id") ) 3 rows from Web_client_accelerator table: id name Operating_system Client Connection 1 CACHEbox Appliance (Linux) End user, ISP Broadband, Satellite, Wireless, Fiber, DSL 2 CProxy Windows user up to 756kbit/s 3 Fasterfox Windows, Mac, Linux and Mobile devices user Dialup, Wireless, Broadband, DSL CREATE TABLE "browser" ( "id" int, "name" text, "market_share" real, primary key("id") ) 3 rows from browser table: id name market_share 1 Internet Explorer 28.96 2 Firefox 18.11 3 Safari 8.54 CREATE TABLE "accelerator_compatible_browser" ( "accelerator_id" int, "browser_id" int, "compatible_since_year" int, primary key("accelerator_id", "browser_id"), foreign key ("accelerator_id") references `Web_client_accelerator`("id"), foreign key ("browser_id") references `browser`("id") ) 3 rows from accelerator_compatible_browser table: accelerator_id browser_id compatible_since_year 1 1 1995 1 2 1996 2 3 1996
browser_web
What are the ids and names of the web accelerators that are compatible with two or more browsers?
SELECT T1.id , T1.Name FROM web_client_accelerator AS T1 JOIN accelerator_compatible_browser AS T2 ON T2.accelerator_id = T1.id GROUP BY T1.id HAVING count(*) >= 2
CREATE TABLE "Web_client_accelerator" ( "id" int, "name" text, "Operating_system" text, "Client" text, "Connection" text, primary key("id") ) 3 rows from Web_client_accelerator table: id name Operating_system Client Connection 1 CACHEbox Appliance (Linux) End user, ISP Broadband, Satellite, Wireless, Fiber, DSL 2 CProxy Windows user up to 756kbit/s 3 Fasterfox Windows, Mac, Linux and Mobile devices user Dialup, Wireless, Broadband, DSL CREATE TABLE "browser" ( "id" int, "name" text, "market_share" real, primary key("id") ) 3 rows from browser table: id name market_share 1 Internet Explorer 28.96 2 Firefox 18.11 3 Safari 8.54 CREATE TABLE "accelerator_compatible_browser" ( "accelerator_id" int, "browser_id" int, "compatible_since_year" int, primary key("accelerator_id", "browser_id"), foreign key ("accelerator_id") references `Web_client_accelerator`("id"), foreign key ("browser_id") references `browser`("id") ) 3 rows from accelerator_compatible_browser table: accelerator_id browser_id compatible_since_year 1 1 1995 1 2 1996 2 3 1996
browser_web
What is the id and name of the browser that is compatible with the most web accelerators?
SELECT T1.id , T1.name FROM browser AS T1 JOIN accelerator_compatible_browser AS T2 ON T1.id = T2.browser_id GROUP BY T1.id ORDER BY count(*) DESC LIMIT 1
CREATE TABLE "Web_client_accelerator" ( "id" int, "name" text, "Operating_system" text, "Client" text, "Connection" text, primary key("id") ) 3 rows from Web_client_accelerator table: id name Operating_system Client Connection 1 CACHEbox Appliance (Linux) End user, ISP Broadband, Satellite, Wireless, Fiber, DSL 2 CProxy Windows user up to 756kbit/s 3 Fasterfox Windows, Mac, Linux and Mobile devices user Dialup, Wireless, Broadband, DSL CREATE TABLE "browser" ( "id" int, "name" text, "market_share" real, primary key("id") ) 3 rows from browser table: id name market_share 1 Internet Explorer 28.96 2 Firefox 18.11 3 Safari 8.54 CREATE TABLE "accelerator_compatible_browser" ( "accelerator_id" int, "browser_id" int, "compatible_since_year" int, primary key("accelerator_id", "browser_id"), foreign key ("accelerator_id") references `Web_client_accelerator`("id"), foreign key ("browser_id") references `browser`("id") ) 3 rows from accelerator_compatible_browser table: accelerator_id browser_id compatible_since_year 1 1 1995 1 2 1996 2 3 1996
browser_web
When did the web accelerator 'CACHEbox' and browser 'Internet Explorer' become compatible?
SELECT T1.compatible_since_year FROM accelerator_compatible_browser AS T1 JOIN browser AS T2 ON T1.browser_id = T2.id JOIN web_client_accelerator AS T3 ON T1.accelerator_id = T3.id WHERE T3.name = 'CACHEbox' AND T2.name = 'Internet Explorer'
CREATE TABLE "Web_client_accelerator" ( "id" int, "name" text, "Operating_system" text, "Client" text, "Connection" text, primary key("id") ) 3 rows from Web_client_accelerator table: id name Operating_system Client Connection 1 CACHEbox Appliance (Linux) End user, ISP Broadband, Satellite, Wireless, Fiber, DSL 2 CProxy Windows user up to 756kbit/s 3 Fasterfox Windows, Mac, Linux and Mobile devices user Dialup, Wireless, Broadband, DSL CREATE TABLE "browser" ( "id" int, "name" text, "market_share" real, primary key("id") ) 3 rows from browser table: id name market_share 1 Internet Explorer 28.96 2 Firefox 18.11 3 Safari 8.54 CREATE TABLE "accelerator_compatible_browser" ( "accelerator_id" int, "browser_id" int, "compatible_since_year" int, primary key("accelerator_id", "browser_id"), foreign key ("accelerator_id") references `Web_client_accelerator`("id"), foreign key ("browser_id") references `browser`("id") ) 3 rows from accelerator_compatible_browser table: accelerator_id browser_id compatible_since_year 1 1 1995 1 2 1996 2 3 1996
browser_web
How many different kinds of clients are supported by the web clients accelerators?
SELECT count(DISTINCT client) FROM web_client_accelerator
CREATE TABLE "Web_client_accelerator" ( "id" int, "name" text, "Operating_system" text, "Client" text, "Connection" text, primary key("id") ) 3 rows from Web_client_accelerator table: id name Operating_system Client Connection 1 CACHEbox Appliance (Linux) End user, ISP Broadband, Satellite, Wireless, Fiber, DSL 2 CProxy Windows user up to 756kbit/s 3 Fasterfox Windows, Mac, Linux and Mobile devices user Dialup, Wireless, Broadband, DSL CREATE TABLE "browser" ( "id" int, "name" text, "market_share" real, primary key("id") ) 3 rows from browser table: id name market_share 1 Internet Explorer 28.96 2 Firefox 18.11 3 Safari 8.54 CREATE TABLE "accelerator_compatible_browser" ( "accelerator_id" int, "browser_id" int, "compatible_since_year" int, primary key("accelerator_id", "browser_id"), foreign key ("accelerator_id") references `Web_client_accelerator`("id"), foreign key ("browser_id") references `browser`("id") ) 3 rows from accelerator_compatible_browser table: accelerator_id browser_id compatible_since_year 1 1 1995 1 2 1996 2 3 1996
browser_web
How many accelerators are not compatible with the browsers listed ?
SELECT count(*) FROM web_client_accelerator WHERE id NOT IN ( SELECT accelerator_id FROM accelerator_compatible_browser );
CREATE TABLE "Web_client_accelerator" ( "id" int, "name" text, "Operating_system" text, "Client" text, "Connection" text, primary key("id") ) 3 rows from Web_client_accelerator table: id name Operating_system Client Connection 1 CACHEbox Appliance (Linux) End user, ISP Broadband, Satellite, Wireless, Fiber, DSL 2 CProxy Windows user up to 756kbit/s 3 Fasterfox Windows, Mac, Linux and Mobile devices user Dialup, Wireless, Broadband, DSL CREATE TABLE "browser" ( "id" int, "name" text, "market_share" real, primary key("id") ) 3 rows from browser table: id name market_share 1 Internet Explorer 28.96 2 Firefox 18.11 3 Safari 8.54 CREATE TABLE "accelerator_compatible_browser" ( "accelerator_id" int, "browser_id" int, "compatible_since_year" int, primary key("accelerator_id", "browser_id"), foreign key ("accelerator_id") references `Web_client_accelerator`("id"), foreign key ("browser_id") references `browser`("id") ) 3 rows from accelerator_compatible_browser table: accelerator_id browser_id compatible_since_year 1 1 1995 1 2 1996 2 3 1996
browser_web
What distinct accelerator names are compatible with the browswers that have market share higher than 15?
SELECT DISTINCT T1.name FROM web_client_accelerator AS T1 JOIN accelerator_compatible_browser AS T2 ON T2.accelerator_id = T1.id JOIN browser AS T3 ON T2.browser_id = T3.id WHERE T3.market_share > 15;
CREATE TABLE "Web_client_accelerator" ( "id" int, "name" text, "Operating_system" text, "Client" text, "Connection" text, primary key("id") ) 3 rows from Web_client_accelerator table: id name Operating_system Client Connection 1 CACHEbox Appliance (Linux) End user, ISP Broadband, Satellite, Wireless, Fiber, DSL 2 CProxy Windows user up to 756kbit/s 3 Fasterfox Windows, Mac, Linux and Mobile devices user Dialup, Wireless, Broadband, DSL CREATE TABLE "browser" ( "id" int, "name" text, "market_share" real, primary key("id") ) 3 rows from browser table: id name market_share 1 Internet Explorer 28.96 2 Firefox 18.11 3 Safari 8.54 CREATE TABLE "accelerator_compatible_browser" ( "accelerator_id" int, "browser_id" int, "compatible_since_year" int, primary key("accelerator_id", "browser_id"), foreign key ("accelerator_id") references `Web_client_accelerator`("id"), foreign key ("browser_id") references `browser`("id") ) 3 rows from accelerator_compatible_browser table: accelerator_id browser_id compatible_since_year 1 1 1995 1 2 1996 2 3 1996
browser_web
List the names of the browser that are compatible with both 'CACHEbox' and 'Fasterfox'.
SELECT T3.name FROM web_client_accelerator AS T1 JOIN accelerator_compatible_browser AS T2 ON T2.accelerator_id = T1.id JOIN browser AS T3 ON T2.browser_id = T3.id WHERE T1.name = 'CACHEbox' INTERSECT SELECT T3.name FROM web_client_accelerator AS T1 JOIN accelerator_compatible_browser AS T2 ON T2.accelerator_id = T1.id JOIN browser AS T3 ON T2.browser_id = T3.id WHERE T1.name = 'Fasterfox'
CREATE TABLE "Web_client_accelerator" ( "id" int, "name" text, "Operating_system" text, "Client" text, "Connection" text, primary key("id") ) 3 rows from Web_client_accelerator table: id name Operating_system Client Connection 1 CACHEbox Appliance (Linux) End user, ISP Broadband, Satellite, Wireless, Fiber, DSL 2 CProxy Windows user up to 756kbit/s 3 Fasterfox Windows, Mac, Linux and Mobile devices user Dialup, Wireless, Broadband, DSL CREATE TABLE "browser" ( "id" int, "name" text, "market_share" real, primary key("id") ) 3 rows from browser table: id name market_share 1 Internet Explorer 28.96 2 Firefox 18.11 3 Safari 8.54 CREATE TABLE "accelerator_compatible_browser" ( "accelerator_id" int, "browser_id" int, "compatible_since_year" int, primary key("accelerator_id", "browser_id"), foreign key ("accelerator_id") references `Web_client_accelerator`("id"), foreign key ("browser_id") references `browser`("id") ) 3 rows from accelerator_compatible_browser table: accelerator_id browser_id compatible_since_year 1 1 1995 1 2 1996 2 3 1996
browser_web
Show the accelerator names and supporting operating systems that are not compatible with the browser named 'Opera'.
SELECT name , operating_system FROM web_client_accelerator EXCEPT SELECT T1.name , T1.operating_system FROM web_client_accelerator AS T1 JOIN accelerator_compatible_browser AS T2 ON T2.accelerator_id = T1.id JOIN browser AS T3 ON T2.browser_id = T3.id WHERE T3.name = 'Opera'
CREATE TABLE "Web_client_accelerator" ( "id" int, "name" text, "Operating_system" text, "Client" text, "Connection" text, primary key("id") ) 3 rows from Web_client_accelerator table: id name Operating_system Client Connection 1 CACHEbox Appliance (Linux) End user, ISP Broadband, Satellite, Wireless, Fiber, DSL 2 CProxy Windows user up to 756kbit/s 3 Fasterfox Windows, Mac, Linux and Mobile devices user Dialup, Wireless, Broadband, DSL CREATE TABLE "browser" ( "id" int, "name" text, "market_share" real, primary key("id") ) 3 rows from browser table: id name market_share 1 Internet Explorer 28.96 2 Firefox 18.11 3 Safari 8.54 CREATE TABLE "accelerator_compatible_browser" ( "accelerator_id" int, "browser_id" int, "compatible_since_year" int, primary key("accelerator_id", "browser_id"), foreign key ("accelerator_id") references `Web_client_accelerator`("id"), foreign key ("browser_id") references `browser`("id") ) 3 rows from accelerator_compatible_browser table: accelerator_id browser_id compatible_since_year 1 1 1995 1 2 1996 2 3 1996
browser_web
Which accelerator name contains substring "Opera"?
SELECT name FROM web_client_accelerator WHERE name LIKE "%Opera%"
CREATE TABLE "Web_client_accelerator" ( "id" int, "name" text, "Operating_system" text, "Client" text, "Connection" text, primary key("id") ) 3 rows from Web_client_accelerator table: id name Operating_system Client Connection 1 CACHEbox Appliance (Linux) End user, ISP Broadband, Satellite, Wireless, Fiber, DSL 2 CProxy Windows user up to 756kbit/s 3 Fasterfox Windows, Mac, Linux and Mobile devices user Dialup, Wireless, Broadband, DSL CREATE TABLE "browser" ( "id" int, "name" text, "market_share" real, primary key("id") ) 3 rows from browser table: id name market_share 1 Internet Explorer 28.96 2 Firefox 18.11 3 Safari 8.54 CREATE TABLE "accelerator_compatible_browser" ( "accelerator_id" int, "browser_id" int, "compatible_since_year" int, primary key("accelerator_id", "browser_id"), foreign key ("accelerator_id") references `Web_client_accelerator`("id"), foreign key ("browser_id") references `browser`("id") ) 3 rows from accelerator_compatible_browser table: accelerator_id browser_id compatible_since_year 1 1 1995 1 2 1996 2 3 1996
browser_web
Find the number of web accelerators used for each Operating system.
SELECT Operating_system , count(*) FROM web_client_accelerator GROUP BY Operating_system
CREATE TABLE "Web_client_accelerator" ( "id" int, "name" text, "Operating_system" text, "Client" text, "Connection" text, primary key("id") ) 3 rows from Web_client_accelerator table: id name Operating_system Client Connection 1 CACHEbox Appliance (Linux) End user, ISP Broadband, Satellite, Wireless, Fiber, DSL 2 CProxy Windows user up to 756kbit/s 3 Fasterfox Windows, Mac, Linux and Mobile devices user Dialup, Wireless, Broadband, DSL CREATE TABLE "browser" ( "id" int, "name" text, "market_share" real, primary key("id") ) 3 rows from browser table: id name market_share 1 Internet Explorer 28.96 2 Firefox 18.11 3 Safari 8.54 CREATE TABLE "accelerator_compatible_browser" ( "accelerator_id" int, "browser_id" int, "compatible_since_year" int, primary key("accelerator_id", "browser_id"), foreign key ("accelerator_id") references `Web_client_accelerator`("id"), foreign key ("browser_id") references `browser`("id") ) 3 rows from accelerator_compatible_browser table: accelerator_id browser_id compatible_since_year 1 1 1995 1 2 1996 2 3 1996
browser_web
give me names of all compatible browsers and accelerators in the descending order of compatible year
SELECT T2.name , T3.name FROM accelerator_compatible_browser AS T1 JOIN browser AS T2 ON T1.browser_id = T2.id JOIN web_client_accelerator AS T3 ON T1.accelerator_id = T3.id ORDER BY T1.compatible_since_year DESC
CREATE TABLE "Web_client_accelerator" ( "id" int, "name" text, "Operating_system" text, "Client" text, "Connection" text, primary key("id") ) 3 rows from Web_client_accelerator table: id name Operating_system Client Connection 1 CACHEbox Appliance (Linux) End user, ISP Broadband, Satellite, Wireless, Fiber, DSL 2 CProxy Windows user up to 756kbit/s 3 Fasterfox Windows, Mac, Linux and Mobile devices user Dialup, Wireless, Broadband, DSL CREATE TABLE "browser" ( "id" int, "name" text, "market_share" real, primary key("id") ) 3 rows from browser table: id name market_share 1 Internet Explorer 28.96 2 Firefox 18.11 3 Safari 8.54 CREATE TABLE "accelerator_compatible_browser" ( "accelerator_id" int, "browser_id" int, "compatible_since_year" int, primary key("accelerator_id", "browser_id"), foreign key ("accelerator_id") references `Web_client_accelerator`("id"), foreign key ("browser_id") references `browser`("id") ) 3 rows from accelerator_compatible_browser table: accelerator_id browser_id compatible_since_year 1 1 1995 1 2 1996 2 3 1996
wrestler
How many wrestlers are there?
SELECT count(*) FROM wrestler
CREATE TABLE "wrestler" ( "Wrestler_ID" int, "Name" text, "Reign" text, "Days_held" text, "Location" text, "Event" text, PRIMARY KEY ("Wrestler_ID") ) 3 rows from wrestler table: Wrestler_ID Name Reign Days_held Location Event 1 Rey Misterio Sr. 1 344 Tijuana , Mexico Live event 2 Fishman 1 113 Tijuana , Mexico Live event 3 Villaño IV 1 1285 Tijuana , Mexico Live event CREATE TABLE "Elimination" ( "Elimination_ID" text, "Wrestler_ID" text, "Team" text, "Eliminated_By" text, "Elimination_Move" text, "Time" text, PRIMARY KEY ("Elimination_ID"), FOREIGN KEY ("Wrestler_ID") REFERENCES "wrestler"("Wrestler_ID") ) 3 rows from Elimination table: Elimination_ID Wrestler_ID Team Eliminated_By Elimination_Move Time 1 1 Team Orton Punk Go To Sleep 00:11 2 2 Team Batista Benjamin Paydirt 07:38 3 4 Team Batista Orton Rope hung DDT 10:45
wrestler
Count the number of wrestlers.
SELECT count(*) FROM wrestler
CREATE TABLE "wrestler" ( "Wrestler_ID" int, "Name" text, "Reign" text, "Days_held" text, "Location" text, "Event" text, PRIMARY KEY ("Wrestler_ID") ) 3 rows from wrestler table: Wrestler_ID Name Reign Days_held Location Event 1 Rey Misterio Sr. 1 344 Tijuana , Mexico Live event 2 Fishman 1 113 Tijuana , Mexico Live event 3 Villaño IV 1 1285 Tijuana , Mexico Live event CREATE TABLE "Elimination" ( "Elimination_ID" text, "Wrestler_ID" text, "Team" text, "Eliminated_By" text, "Elimination_Move" text, "Time" text, PRIMARY KEY ("Elimination_ID"), FOREIGN KEY ("Wrestler_ID") REFERENCES "wrestler"("Wrestler_ID") ) 3 rows from Elimination table: Elimination_ID Wrestler_ID Team Eliminated_By Elimination_Move Time 1 1 Team Orton Punk Go To Sleep 00:11 2 2 Team Batista Benjamin Paydirt 07:38 3 4 Team Batista Orton Rope hung DDT 10:45
wrestler
List the names of wrestlers in descending order of days held.
SELECT Name FROM wrestler ORDER BY Days_held DESC
CREATE TABLE "wrestler" ( "Wrestler_ID" int, "Name" text, "Reign" text, "Days_held" text, "Location" text, "Event" text, PRIMARY KEY ("Wrestler_ID") ) 3 rows from wrestler table: Wrestler_ID Name Reign Days_held Location Event 1 Rey Misterio Sr. 1 344 Tijuana , Mexico Live event 2 Fishman 1 113 Tijuana , Mexico Live event 3 Villaño IV 1 1285 Tijuana , Mexico Live event CREATE TABLE "Elimination" ( "Elimination_ID" text, "Wrestler_ID" text, "Team" text, "Eliminated_By" text, "Elimination_Move" text, "Time" text, PRIMARY KEY ("Elimination_ID"), FOREIGN KEY ("Wrestler_ID") REFERENCES "wrestler"("Wrestler_ID") ) 3 rows from Elimination table: Elimination_ID Wrestler_ID Team Eliminated_By Elimination_Move Time 1 1 Team Orton Punk Go To Sleep 00:11 2 2 Team Batista Benjamin Paydirt 07:38 3 4 Team Batista Orton Rope hung DDT 10:45
wrestler
What are the names of the wrestlers, ordered descending by days held?
SELECT Name FROM wrestler ORDER BY Days_held DESC
CREATE TABLE "wrestler" ( "Wrestler_ID" int, "Name" text, "Reign" text, "Days_held" text, "Location" text, "Event" text, PRIMARY KEY ("Wrestler_ID") ) 3 rows from wrestler table: Wrestler_ID Name Reign Days_held Location Event 1 Rey Misterio Sr. 1 344 Tijuana , Mexico Live event 2 Fishman 1 113 Tijuana , Mexico Live event 3 Villaño IV 1 1285 Tijuana , Mexico Live event CREATE TABLE "Elimination" ( "Elimination_ID" text, "Wrestler_ID" text, "Team" text, "Eliminated_By" text, "Elimination_Move" text, "Time" text, PRIMARY KEY ("Elimination_ID"), FOREIGN KEY ("Wrestler_ID") REFERENCES "wrestler"("Wrestler_ID") ) 3 rows from Elimination table: Elimination_ID Wrestler_ID Team Eliminated_By Elimination_Move Time 1 1 Team Orton Punk Go To Sleep 00:11 2 2 Team Batista Benjamin Paydirt 07:38 3 4 Team Batista Orton Rope hung DDT 10:45
wrestler
What is the name of the wrestler with the fewest days held?
SELECT Name FROM wrestler ORDER BY Days_held ASC LIMIT 1
CREATE TABLE "wrestler" ( "Wrestler_ID" int, "Name" text, "Reign" text, "Days_held" text, "Location" text, "Event" text, PRIMARY KEY ("Wrestler_ID") ) 3 rows from wrestler table: Wrestler_ID Name Reign Days_held Location Event 1 Rey Misterio Sr. 1 344 Tijuana , Mexico Live event 2 Fishman 1 113 Tijuana , Mexico Live event 3 Villaño IV 1 1285 Tijuana , Mexico Live event CREATE TABLE "Elimination" ( "Elimination_ID" text, "Wrestler_ID" text, "Team" text, "Eliminated_By" text, "Elimination_Move" text, "Time" text, PRIMARY KEY ("Elimination_ID"), FOREIGN KEY ("Wrestler_ID") REFERENCES "wrestler"("Wrestler_ID") ) 3 rows from Elimination table: Elimination_ID Wrestler_ID Team Eliminated_By Elimination_Move Time 1 1 Team Orton Punk Go To Sleep 00:11 2 2 Team Batista Benjamin Paydirt 07:38 3 4 Team Batista Orton Rope hung DDT 10:45
wrestler
Return the name of the wrestler who had the lowest number of days held.
SELECT Name FROM wrestler ORDER BY Days_held ASC LIMIT 1
CREATE TABLE "wrestler" ( "Wrestler_ID" int, "Name" text, "Reign" text, "Days_held" text, "Location" text, "Event" text, PRIMARY KEY ("Wrestler_ID") ) 3 rows from wrestler table: Wrestler_ID Name Reign Days_held Location Event 1 Rey Misterio Sr. 1 344 Tijuana , Mexico Live event 2 Fishman 1 113 Tijuana , Mexico Live event 3 Villaño IV 1 1285 Tijuana , Mexico Live event CREATE TABLE "Elimination" ( "Elimination_ID" text, "Wrestler_ID" text, "Team" text, "Eliminated_By" text, "Elimination_Move" text, "Time" text, PRIMARY KEY ("Elimination_ID"), FOREIGN KEY ("Wrestler_ID") REFERENCES "wrestler"("Wrestler_ID") ) 3 rows from Elimination table: Elimination_ID Wrestler_ID Team Eliminated_By Elimination_Move Time 1 1 Team Orton Punk Go To Sleep 00:11 2 2 Team Batista Benjamin Paydirt 07:38 3 4 Team Batista Orton Rope hung DDT 10:45
wrestler
What are the distinct reigns of wrestlers whose location is not "Tokyo,Japan" ?
SELECT DISTINCT Reign FROM wrestler WHERE LOCATION != "Tokyo , Japan"
CREATE TABLE "wrestler" ( "Wrestler_ID" int, "Name" text, "Reign" text, "Days_held" text, "Location" text, "Event" text, PRIMARY KEY ("Wrestler_ID") ) 3 rows from wrestler table: Wrestler_ID Name Reign Days_held Location Event 1 Rey Misterio Sr. 1 344 Tijuana , Mexico Live event 2 Fishman 1 113 Tijuana , Mexico Live event 3 Villaño IV 1 1285 Tijuana , Mexico Live event CREATE TABLE "Elimination" ( "Elimination_ID" text, "Wrestler_ID" text, "Team" text, "Eliminated_By" text, "Elimination_Move" text, "Time" text, PRIMARY KEY ("Elimination_ID"), FOREIGN KEY ("Wrestler_ID") REFERENCES "wrestler"("Wrestler_ID") ) 3 rows from Elimination table: Elimination_ID Wrestler_ID Team Eliminated_By Elimination_Move Time 1 1 Team Orton Punk Go To Sleep 00:11 2 2 Team Batista Benjamin Paydirt 07:38 3 4 Team Batista Orton Rope hung DDT 10:45
wrestler
Give the different reigns of wrestlers who are not located in Tokyo, Japan.
SELECT DISTINCT Reign FROM wrestler WHERE LOCATION != "Tokyo , Japan"
CREATE TABLE "wrestler" ( "Wrestler_ID" int, "Name" text, "Reign" text, "Days_held" text, "Location" text, "Event" text, PRIMARY KEY ("Wrestler_ID") ) 3 rows from wrestler table: Wrestler_ID Name Reign Days_held Location Event 1 Rey Misterio Sr. 1 344 Tijuana , Mexico Live event 2 Fishman 1 113 Tijuana , Mexico Live event 3 Villaño IV 1 1285 Tijuana , Mexico Live event CREATE TABLE "Elimination" ( "Elimination_ID" text, "Wrestler_ID" text, "Team" text, "Eliminated_By" text, "Elimination_Move" text, "Time" text, PRIMARY KEY ("Elimination_ID"), FOREIGN KEY ("Wrestler_ID") REFERENCES "wrestler"("Wrestler_ID") ) 3 rows from Elimination table: Elimination_ID Wrestler_ID Team Eliminated_By Elimination_Move Time 1 1 Team Orton Punk Go To Sleep 00:11 2 2 Team Batista Benjamin Paydirt 07:38 3 4 Team Batista Orton Rope hung DDT 10:45
wrestler
What are the names and location of the wrestlers?
SELECT Name , LOCATION FROM wrestler
CREATE TABLE "wrestler" ( "Wrestler_ID" int, "Name" text, "Reign" text, "Days_held" text, "Location" text, "Event" text, PRIMARY KEY ("Wrestler_ID") ) 3 rows from wrestler table: Wrestler_ID Name Reign Days_held Location Event 1 Rey Misterio Sr. 1 344 Tijuana , Mexico Live event 2 Fishman 1 113 Tijuana , Mexico Live event 3 Villaño IV 1 1285 Tijuana , Mexico Live event CREATE TABLE "Elimination" ( "Elimination_ID" text, "Wrestler_ID" text, "Team" text, "Eliminated_By" text, "Elimination_Move" text, "Time" text, PRIMARY KEY ("Elimination_ID"), FOREIGN KEY ("Wrestler_ID") REFERENCES "wrestler"("Wrestler_ID") ) 3 rows from Elimination table: Elimination_ID Wrestler_ID Team Eliminated_By Elimination_Move Time 1 1 Team Orton Punk Go To Sleep 00:11 2 2 Team Batista Benjamin Paydirt 07:38 3 4 Team Batista Orton Rope hung DDT 10:45
wrestler
Give the names and locations of all wrestlers.
SELECT Name , LOCATION FROM wrestler
CREATE TABLE "wrestler" ( "Wrestler_ID" int, "Name" text, "Reign" text, "Days_held" text, "Location" text, "Event" text, PRIMARY KEY ("Wrestler_ID") ) 3 rows from wrestler table: Wrestler_ID Name Reign Days_held Location Event 1 Rey Misterio Sr. 1 344 Tijuana , Mexico Live event 2 Fishman 1 113 Tijuana , Mexico Live event 3 Villaño IV 1 1285 Tijuana , Mexico Live event CREATE TABLE "Elimination" ( "Elimination_ID" text, "Wrestler_ID" text, "Team" text, "Eliminated_By" text, "Elimination_Move" text, "Time" text, PRIMARY KEY ("Elimination_ID"), FOREIGN KEY ("Wrestler_ID") REFERENCES "wrestler"("Wrestler_ID") ) 3 rows from Elimination table: Elimination_ID Wrestler_ID Team Eliminated_By Elimination_Move Time 1 1 Team Orton Punk Go To Sleep 00:11 2 2 Team Batista Benjamin Paydirt 07:38 3 4 Team Batista Orton Rope hung DDT 10:45
wrestler
What are the elimination moves of wrestlers whose team is "Team Orton"?
SELECT Elimination_Move FROM Elimination WHERE Team = "Team Orton"
CREATE TABLE "wrestler" ( "Wrestler_ID" int, "Name" text, "Reign" text, "Days_held" text, "Location" text, "Event" text, PRIMARY KEY ("Wrestler_ID") ) 3 rows from wrestler table: Wrestler_ID Name Reign Days_held Location Event 1 Rey Misterio Sr. 1 344 Tijuana , Mexico Live event 2 Fishman 1 113 Tijuana , Mexico Live event 3 Villaño IV 1 1285 Tijuana , Mexico Live event CREATE TABLE "Elimination" ( "Elimination_ID" text, "Wrestler_ID" text, "Team" text, "Eliminated_By" text, "Elimination_Move" text, "Time" text, PRIMARY KEY ("Elimination_ID"), FOREIGN KEY ("Wrestler_ID") REFERENCES "wrestler"("Wrestler_ID") ) 3 rows from Elimination table: Elimination_ID Wrestler_ID Team Eliminated_By Elimination_Move Time 1 1 Team Orton Punk Go To Sleep 00:11 2 2 Team Batista Benjamin Paydirt 07:38 3 4 Team Batista Orton Rope hung DDT 10:45
wrestler
Return the elimination movies of wrestlers on Team Orton.
SELECT Elimination_Move FROM Elimination WHERE Team = "Team Orton"
CREATE TABLE "wrestler" ( "Wrestler_ID" int, "Name" text, "Reign" text, "Days_held" text, "Location" text, "Event" text, PRIMARY KEY ("Wrestler_ID") ) 3 rows from wrestler table: Wrestler_ID Name Reign Days_held Location Event 1 Rey Misterio Sr. 1 344 Tijuana , Mexico Live event 2 Fishman 1 113 Tijuana , Mexico Live event 3 Villaño IV 1 1285 Tijuana , Mexico Live event CREATE TABLE "Elimination" ( "Elimination_ID" text, "Wrestler_ID" text, "Team" text, "Eliminated_By" text, "Elimination_Move" text, "Time" text, PRIMARY KEY ("Elimination_ID"), FOREIGN KEY ("Wrestler_ID") REFERENCES "wrestler"("Wrestler_ID") ) 3 rows from Elimination table: Elimination_ID Wrestler_ID Team Eliminated_By Elimination_Move Time 1 1 Team Orton Punk Go To Sleep 00:11 2 2 Team Batista Benjamin Paydirt 07:38 3 4 Team Batista Orton Rope hung DDT 10:45
wrestler
What are the names of wrestlers and the elimination moves?
SELECT T2.Name , T1.Elimination_Move FROM elimination AS T1 JOIN wrestler AS T2 ON T1.Wrestler_ID = T2.Wrestler_ID
CREATE TABLE "wrestler" ( "Wrestler_ID" int, "Name" text, "Reign" text, "Days_held" text, "Location" text, "Event" text, PRIMARY KEY ("Wrestler_ID") ) 3 rows from wrestler table: Wrestler_ID Name Reign Days_held Location Event 1 Rey Misterio Sr. 1 344 Tijuana , Mexico Live event 2 Fishman 1 113 Tijuana , Mexico Live event 3 Villaño IV 1 1285 Tijuana , Mexico Live event CREATE TABLE "Elimination" ( "Elimination_ID" text, "Wrestler_ID" text, "Team" text, "Eliminated_By" text, "Elimination_Move" text, "Time" text, PRIMARY KEY ("Elimination_ID"), FOREIGN KEY ("Wrestler_ID") REFERENCES "wrestler"("Wrestler_ID") ) 3 rows from Elimination table: Elimination_ID Wrestler_ID Team Eliminated_By Elimination_Move Time 1 1 Team Orton Punk Go To Sleep 00:11 2 2 Team Batista Benjamin Paydirt 07:38 3 4 Team Batista Orton Rope hung DDT 10:45
wrestler
Give the names of wrestlers and their elimination moves.
SELECT T2.Name , T1.Elimination_Move FROM elimination AS T1 JOIN wrestler AS T2 ON T1.Wrestler_ID = T2.Wrestler_ID
CREATE TABLE "wrestler" ( "Wrestler_ID" int, "Name" text, "Reign" text, "Days_held" text, "Location" text, "Event" text, PRIMARY KEY ("Wrestler_ID") ) 3 rows from wrestler table: Wrestler_ID Name Reign Days_held Location Event 1 Rey Misterio Sr. 1 344 Tijuana , Mexico Live event 2 Fishman 1 113 Tijuana , Mexico Live event 3 Villaño IV 1 1285 Tijuana , Mexico Live event CREATE TABLE "Elimination" ( "Elimination_ID" text, "Wrestler_ID" text, "Team" text, "Eliminated_By" text, "Elimination_Move" text, "Time" text, PRIMARY KEY ("Elimination_ID"), FOREIGN KEY ("Wrestler_ID") REFERENCES "wrestler"("Wrestler_ID") ) 3 rows from Elimination table: Elimination_ID Wrestler_ID Team Eliminated_By Elimination_Move Time 1 1 Team Orton Punk Go To Sleep 00:11 2 2 Team Batista Benjamin Paydirt 07:38 3 4 Team Batista Orton Rope hung DDT 10:45
wrestler
List the names of wrestlers and the teams in elimination in descending order of days held.
SELECT T2.Name , T1.Team FROM elimination AS T1 JOIN wrestler AS T2 ON T1.Wrestler_ID = T2.Wrestler_ID ORDER BY T2.Days_held DESC
CREATE TABLE "wrestler" ( "Wrestler_ID" int, "Name" text, "Reign" text, "Days_held" text, "Location" text, "Event" text, PRIMARY KEY ("Wrestler_ID") ) 3 rows from wrestler table: Wrestler_ID Name Reign Days_held Location Event 1 Rey Misterio Sr. 1 344 Tijuana , Mexico Live event 2 Fishman 1 113 Tijuana , Mexico Live event 3 Villaño IV 1 1285 Tijuana , Mexico Live event CREATE TABLE "Elimination" ( "Elimination_ID" text, "Wrestler_ID" text, "Team" text, "Eliminated_By" text, "Elimination_Move" text, "Time" text, PRIMARY KEY ("Elimination_ID"), FOREIGN KEY ("Wrestler_ID") REFERENCES "wrestler"("Wrestler_ID") ) 3 rows from Elimination table: Elimination_ID Wrestler_ID Team Eliminated_By Elimination_Move Time 1 1 Team Orton Punk Go To Sleep 00:11 2 2 Team Batista Benjamin Paydirt 07:38 3 4 Team Batista Orton Rope hung DDT 10:45
wrestler
What are the names of wrestlers and their teams in elimination, ordered descending by days held?
SELECT T2.Name , T1.Team FROM elimination AS T1 JOIN wrestler AS T2 ON T1.Wrestler_ID = T2.Wrestler_ID ORDER BY T2.Days_held DESC
CREATE TABLE "wrestler" ( "Wrestler_ID" int, "Name" text, "Reign" text, "Days_held" text, "Location" text, "Event" text, PRIMARY KEY ("Wrestler_ID") ) 3 rows from wrestler table: Wrestler_ID Name Reign Days_held Location Event 1 Rey Misterio Sr. 1 344 Tijuana , Mexico Live event 2 Fishman 1 113 Tijuana , Mexico Live event 3 Villaño IV 1 1285 Tijuana , Mexico Live event CREATE TABLE "Elimination" ( "Elimination_ID" text, "Wrestler_ID" text, "Team" text, "Eliminated_By" text, "Elimination_Move" text, "Time" text, PRIMARY KEY ("Elimination_ID"), FOREIGN KEY ("Wrestler_ID") REFERENCES "wrestler"("Wrestler_ID") ) 3 rows from Elimination table: Elimination_ID Wrestler_ID Team Eliminated_By Elimination_Move Time 1 1 Team Orton Punk Go To Sleep 00:11 2 2 Team Batista Benjamin Paydirt 07:38 3 4 Team Batista Orton Rope hung DDT 10:45
wrestler
List the time of elimination of the wrestlers with largest days held.
SELECT T1.Time FROM elimination AS T1 JOIN wrestler AS T2 ON T1.Wrestler_ID = T2.Wrestler_ID ORDER BY T2.Days_held DESC LIMIT 1
CREATE TABLE "wrestler" ( "Wrestler_ID" int, "Name" text, "Reign" text, "Days_held" text, "Location" text, "Event" text, PRIMARY KEY ("Wrestler_ID") ) 3 rows from wrestler table: Wrestler_ID Name Reign Days_held Location Event 1 Rey Misterio Sr. 1 344 Tijuana , Mexico Live event 2 Fishman 1 113 Tijuana , Mexico Live event 3 Villaño IV 1 1285 Tijuana , Mexico Live event CREATE TABLE "Elimination" ( "Elimination_ID" text, "Wrestler_ID" text, "Team" text, "Eliminated_By" text, "Elimination_Move" text, "Time" text, PRIMARY KEY ("Elimination_ID"), FOREIGN KEY ("Wrestler_ID") REFERENCES "wrestler"("Wrestler_ID") ) 3 rows from Elimination table: Elimination_ID Wrestler_ID Team Eliminated_By Elimination_Move Time 1 1 Team Orton Punk Go To Sleep 00:11 2 2 Team Batista Benjamin Paydirt 07:38 3 4 Team Batista Orton Rope hung DDT 10:45
wrestler
What is the time of elimination for the wrestler with the most days held?
SELECT T1.Time FROM elimination AS T1 JOIN wrestler AS T2 ON T1.Wrestler_ID = T2.Wrestler_ID ORDER BY T2.Days_held DESC LIMIT 1
CREATE TABLE "wrestler" ( "Wrestler_ID" int, "Name" text, "Reign" text, "Days_held" text, "Location" text, "Event" text, PRIMARY KEY ("Wrestler_ID") ) 3 rows from wrestler table: Wrestler_ID Name Reign Days_held Location Event 1 Rey Misterio Sr. 1 344 Tijuana , Mexico Live event 2 Fishman 1 113 Tijuana , Mexico Live event 3 Villaño IV 1 1285 Tijuana , Mexico Live event CREATE TABLE "Elimination" ( "Elimination_ID" text, "Wrestler_ID" text, "Team" text, "Eliminated_By" text, "Elimination_Move" text, "Time" text, PRIMARY KEY ("Elimination_ID"), FOREIGN KEY ("Wrestler_ID") REFERENCES "wrestler"("Wrestler_ID") ) 3 rows from Elimination table: Elimination_ID Wrestler_ID Team Eliminated_By Elimination_Move Time 1 1 Team Orton Punk Go To Sleep 00:11 2 2 Team Batista Benjamin Paydirt 07:38 3 4 Team Batista Orton Rope hung DDT 10:45
wrestler
Show times of elimination of wrestlers with days held more than 50.
SELECT T1.Time FROM elimination AS T1 JOIN wrestler AS T2 ON T1.Wrestler_ID = T2.Wrestler_ID WHERE T2.Days_held > 50
CREATE TABLE "wrestler" ( "Wrestler_ID" int, "Name" text, "Reign" text, "Days_held" text, "Location" text, "Event" text, PRIMARY KEY ("Wrestler_ID") ) 3 rows from wrestler table: Wrestler_ID Name Reign Days_held Location Event 1 Rey Misterio Sr. 1 344 Tijuana , Mexico Live event 2 Fishman 1 113 Tijuana , Mexico Live event 3 Villaño IV 1 1285 Tijuana , Mexico Live event CREATE TABLE "Elimination" ( "Elimination_ID" text, "Wrestler_ID" text, "Team" text, "Eliminated_By" text, "Elimination_Move" text, "Time" text, PRIMARY KEY ("Elimination_ID"), FOREIGN KEY ("Wrestler_ID") REFERENCES "wrestler"("Wrestler_ID") ) 3 rows from Elimination table: Elimination_ID Wrestler_ID Team Eliminated_By Elimination_Move Time 1 1 Team Orton Punk Go To Sleep 00:11 2 2 Team Batista Benjamin Paydirt 07:38 3 4 Team Batista Orton Rope hung DDT 10:45
wrestler
What are the times of elimination for wrestlers with over 50 days held?
SELECT T1.Time FROM elimination AS T1 JOIN wrestler AS T2 ON T1.Wrestler_ID = T2.Wrestler_ID WHERE T2.Days_held > 50
CREATE TABLE "wrestler" ( "Wrestler_ID" int, "Name" text, "Reign" text, "Days_held" text, "Location" text, "Event" text, PRIMARY KEY ("Wrestler_ID") ) 3 rows from wrestler table: Wrestler_ID Name Reign Days_held Location Event 1 Rey Misterio Sr. 1 344 Tijuana , Mexico Live event 2 Fishman 1 113 Tijuana , Mexico Live event 3 Villaño IV 1 1285 Tijuana , Mexico Live event CREATE TABLE "Elimination" ( "Elimination_ID" text, "Wrestler_ID" text, "Team" text, "Eliminated_By" text, "Elimination_Move" text, "Time" text, PRIMARY KEY ("Elimination_ID"), FOREIGN KEY ("Wrestler_ID") REFERENCES "wrestler"("Wrestler_ID") ) 3 rows from Elimination table: Elimination_ID Wrestler_ID Team Eliminated_By Elimination_Move Time 1 1 Team Orton Punk Go To Sleep 00:11 2 2 Team Batista Benjamin Paydirt 07:38 3 4 Team Batista Orton Rope hung DDT 10:45
wrestler
Show different teams in eliminations and the number of eliminations from each team.
SELECT Team , COUNT(*) FROM elimination GROUP BY Team
CREATE TABLE "wrestler" ( "Wrestler_ID" int, "Name" text, "Reign" text, "Days_held" text, "Location" text, "Event" text, PRIMARY KEY ("Wrestler_ID") ) 3 rows from wrestler table: Wrestler_ID Name Reign Days_held Location Event 1 Rey Misterio Sr. 1 344 Tijuana , Mexico Live event 2 Fishman 1 113 Tijuana , Mexico Live event 3 Villaño IV 1 1285 Tijuana , Mexico Live event CREATE TABLE "Elimination" ( "Elimination_ID" text, "Wrestler_ID" text, "Team" text, "Eliminated_By" text, "Elimination_Move" text, "Time" text, PRIMARY KEY ("Elimination_ID"), FOREIGN KEY ("Wrestler_ID") REFERENCES "wrestler"("Wrestler_ID") ) 3 rows from Elimination table: Elimination_ID Wrestler_ID Team Eliminated_By Elimination_Move Time 1 1 Team Orton Punk Go To Sleep 00:11 2 2 Team Batista Benjamin Paydirt 07:38 3 4 Team Batista Orton Rope hung DDT 10:45
wrestler
How many eliminations did each team have?
SELECT Team , COUNT(*) FROM elimination GROUP BY Team
CREATE TABLE "wrestler" ( "Wrestler_ID" int, "Name" text, "Reign" text, "Days_held" text, "Location" text, "Event" text, PRIMARY KEY ("Wrestler_ID") ) 3 rows from wrestler table: Wrestler_ID Name Reign Days_held Location Event 1 Rey Misterio Sr. 1 344 Tijuana , Mexico Live event 2 Fishman 1 113 Tijuana , Mexico Live event 3 Villaño IV 1 1285 Tijuana , Mexico Live event CREATE TABLE "Elimination" ( "Elimination_ID" text, "Wrestler_ID" text, "Team" text, "Eliminated_By" text, "Elimination_Move" text, "Time" text, PRIMARY KEY ("Elimination_ID"), FOREIGN KEY ("Wrestler_ID") REFERENCES "wrestler"("Wrestler_ID") ) 3 rows from Elimination table: Elimination_ID Wrestler_ID Team Eliminated_By Elimination_Move Time 1 1 Team Orton Punk Go To Sleep 00:11 2 2 Team Batista Benjamin Paydirt 07:38 3 4 Team Batista Orton Rope hung DDT 10:45
wrestler
Show teams that have suffered more than three eliminations.
SELECT Team FROM elimination GROUP BY Team HAVING COUNT(*) > 3
CREATE TABLE "wrestler" ( "Wrestler_ID" int, "Name" text, "Reign" text, "Days_held" text, "Location" text, "Event" text, PRIMARY KEY ("Wrestler_ID") ) 3 rows from wrestler table: Wrestler_ID Name Reign Days_held Location Event 1 Rey Misterio Sr. 1 344 Tijuana , Mexico Live event 2 Fishman 1 113 Tijuana , Mexico Live event 3 Villaño IV 1 1285 Tijuana , Mexico Live event CREATE TABLE "Elimination" ( "Elimination_ID" text, "Wrestler_ID" text, "Team" text, "Eliminated_By" text, "Elimination_Move" text, "Time" text, PRIMARY KEY ("Elimination_ID"), FOREIGN KEY ("Wrestler_ID") REFERENCES "wrestler"("Wrestler_ID") ) 3 rows from Elimination table: Elimination_ID Wrestler_ID Team Eliminated_By Elimination_Move Time 1 1 Team Orton Punk Go To Sleep 00:11 2 2 Team Batista Benjamin Paydirt 07:38 3 4 Team Batista Orton Rope hung DDT 10:45
wrestler
Which teams had more than 3 eliminations?
SELECT Team FROM elimination GROUP BY Team HAVING COUNT(*) > 3
CREATE TABLE "wrestler" ( "Wrestler_ID" int, "Name" text, "Reign" text, "Days_held" text, "Location" text, "Event" text, PRIMARY KEY ("Wrestler_ID") ) 3 rows from wrestler table: Wrestler_ID Name Reign Days_held Location Event 1 Rey Misterio Sr. 1 344 Tijuana , Mexico Live event 2 Fishman 1 113 Tijuana , Mexico Live event 3 Villaño IV 1 1285 Tijuana , Mexico Live event CREATE TABLE "Elimination" ( "Elimination_ID" text, "Wrestler_ID" text, "Team" text, "Eliminated_By" text, "Elimination_Move" text, "Time" text, PRIMARY KEY ("Elimination_ID"), FOREIGN KEY ("Wrestler_ID") REFERENCES "wrestler"("Wrestler_ID") ) 3 rows from Elimination table: Elimination_ID Wrestler_ID Team Eliminated_By Elimination_Move Time 1 1 Team Orton Punk Go To Sleep 00:11 2 2 Team Batista Benjamin Paydirt 07:38 3 4 Team Batista Orton Rope hung DDT 10:45
wrestler
Show the reign and days held of wrestlers.
SELECT Reign , Days_held FROM wrestler
CREATE TABLE "wrestler" ( "Wrestler_ID" int, "Name" text, "Reign" text, "Days_held" text, "Location" text, "Event" text, PRIMARY KEY ("Wrestler_ID") ) 3 rows from wrestler table: Wrestler_ID Name Reign Days_held Location Event 1 Rey Misterio Sr. 1 344 Tijuana , Mexico Live event 2 Fishman 1 113 Tijuana , Mexico Live event 3 Villaño IV 1 1285 Tijuana , Mexico Live event CREATE TABLE "Elimination" ( "Elimination_ID" text, "Wrestler_ID" text, "Team" text, "Eliminated_By" text, "Elimination_Move" text, "Time" text, PRIMARY KEY ("Elimination_ID"), FOREIGN KEY ("Wrestler_ID") REFERENCES "wrestler"("Wrestler_ID") ) 3 rows from Elimination table: Elimination_ID Wrestler_ID Team Eliminated_By Elimination_Move Time 1 1 Team Orton Punk Go To Sleep 00:11 2 2 Team Batista Benjamin Paydirt 07:38 3 4 Team Batista Orton Rope hung DDT 10:45
wrestler
What are the reigns and days held of all wrestlers?
SELECT Reign , Days_held FROM wrestler
CREATE TABLE "wrestler" ( "Wrestler_ID" int, "Name" text, "Reign" text, "Days_held" text, "Location" text, "Event" text, PRIMARY KEY ("Wrestler_ID") ) 3 rows from wrestler table: Wrestler_ID Name Reign Days_held Location Event 1 Rey Misterio Sr. 1 344 Tijuana , Mexico Live event 2 Fishman 1 113 Tijuana , Mexico Live event 3 Villaño IV 1 1285 Tijuana , Mexico Live event CREATE TABLE "Elimination" ( "Elimination_ID" text, "Wrestler_ID" text, "Team" text, "Eliminated_By" text, "Elimination_Move" text, "Time" text, PRIMARY KEY ("Elimination_ID"), FOREIGN KEY ("Wrestler_ID") REFERENCES "wrestler"("Wrestler_ID") ) 3 rows from Elimination table: Elimination_ID Wrestler_ID Team Eliminated_By Elimination_Move Time 1 1 Team Orton Punk Go To Sleep 00:11 2 2 Team Batista Benjamin Paydirt 07:38 3 4 Team Batista Orton Rope hung DDT 10:45
wrestler
What are the names of wrestlers days held less than 100?
SELECT Name FROM wrestler WHERE Days_held < 100
CREATE TABLE "wrestler" ( "Wrestler_ID" int, "Name" text, "Reign" text, "Days_held" text, "Location" text, "Event" text, PRIMARY KEY ("Wrestler_ID") ) 3 rows from wrestler table: Wrestler_ID Name Reign Days_held Location Event 1 Rey Misterio Sr. 1 344 Tijuana , Mexico Live event 2 Fishman 1 113 Tijuana , Mexico Live event 3 Villaño IV 1 1285 Tijuana , Mexico Live event CREATE TABLE "Elimination" ( "Elimination_ID" text, "Wrestler_ID" text, "Team" text, "Eliminated_By" text, "Elimination_Move" text, "Time" text, PRIMARY KEY ("Elimination_ID"), FOREIGN KEY ("Wrestler_ID") REFERENCES "wrestler"("Wrestler_ID") ) 3 rows from Elimination table: Elimination_ID Wrestler_ID Team Eliminated_By Elimination_Move Time 1 1 Team Orton Punk Go To Sleep 00:11 2 2 Team Batista Benjamin Paydirt 07:38 3 4 Team Batista Orton Rope hung DDT 10:45
wrestler
Return the names of wrestlers with fewer than 100 days held.
SELECT Name FROM wrestler WHERE Days_held < 100
CREATE TABLE "wrestler" ( "Wrestler_ID" int, "Name" text, "Reign" text, "Days_held" text, "Location" text, "Event" text, PRIMARY KEY ("Wrestler_ID") ) 3 rows from wrestler table: Wrestler_ID Name Reign Days_held Location Event 1 Rey Misterio Sr. 1 344 Tijuana , Mexico Live event 2 Fishman 1 113 Tijuana , Mexico Live event 3 Villaño IV 1 1285 Tijuana , Mexico Live event CREATE TABLE "Elimination" ( "Elimination_ID" text, "Wrestler_ID" text, "Team" text, "Eliminated_By" text, "Elimination_Move" text, "Time" text, PRIMARY KEY ("Elimination_ID"), FOREIGN KEY ("Wrestler_ID") REFERENCES "wrestler"("Wrestler_ID") ) 3 rows from Elimination table: Elimination_ID Wrestler_ID Team Eliminated_By Elimination_Move Time 1 1 Team Orton Punk Go To Sleep 00:11 2 2 Team Batista Benjamin Paydirt 07:38 3 4 Team Batista Orton Rope hung DDT 10:45
wrestler
Please show the most common reigns of wrestlers.
SELECT Reign FROM wrestler GROUP BY Reign ORDER BY COUNT(*) DESC LIMIT 1
CREATE TABLE "wrestler" ( "Wrestler_ID" int, "Name" text, "Reign" text, "Days_held" text, "Location" text, "Event" text, PRIMARY KEY ("Wrestler_ID") ) 3 rows from wrestler table: Wrestler_ID Name Reign Days_held Location Event 1 Rey Misterio Sr. 1 344 Tijuana , Mexico Live event 2 Fishman 1 113 Tijuana , Mexico Live event 3 Villaño IV 1 1285 Tijuana , Mexico Live event CREATE TABLE "Elimination" ( "Elimination_ID" text, "Wrestler_ID" text, "Team" text, "Eliminated_By" text, "Elimination_Move" text, "Time" text, PRIMARY KEY ("Elimination_ID"), FOREIGN KEY ("Wrestler_ID") REFERENCES "wrestler"("Wrestler_ID") ) 3 rows from Elimination table: Elimination_ID Wrestler_ID Team Eliminated_By Elimination_Move Time 1 1 Team Orton Punk Go To Sleep 00:11 2 2 Team Batista Benjamin Paydirt 07:38 3 4 Team Batista Orton Rope hung DDT 10:45
wrestler
Which reign is the most common among wrestlers?
SELECT Reign FROM wrestler GROUP BY Reign ORDER BY COUNT(*) DESC LIMIT 1
CREATE TABLE "wrestler" ( "Wrestler_ID" int, "Name" text, "Reign" text, "Days_held" text, "Location" text, "Event" text, PRIMARY KEY ("Wrestler_ID") ) 3 rows from wrestler table: Wrestler_ID Name Reign Days_held Location Event 1 Rey Misterio Sr. 1 344 Tijuana , Mexico Live event 2 Fishman 1 113 Tijuana , Mexico Live event 3 Villaño IV 1 1285 Tijuana , Mexico Live event CREATE TABLE "Elimination" ( "Elimination_ID" text, "Wrestler_ID" text, "Team" text, "Eliminated_By" text, "Elimination_Move" text, "Time" text, PRIMARY KEY ("Elimination_ID"), FOREIGN KEY ("Wrestler_ID") REFERENCES "wrestler"("Wrestler_ID") ) 3 rows from Elimination table: Elimination_ID Wrestler_ID Team Eliminated_By Elimination_Move Time 1 1 Team Orton Punk Go To Sleep 00:11 2 2 Team Batista Benjamin Paydirt 07:38 3 4 Team Batista Orton Rope hung DDT 10:45
wrestler
List the locations that are shared by more than two wrestlers.
SELECT LOCATION FROM wrestler GROUP BY LOCATION HAVING COUNT(*) > 2
CREATE TABLE "wrestler" ( "Wrestler_ID" int, "Name" text, "Reign" text, "Days_held" text, "Location" text, "Event" text, PRIMARY KEY ("Wrestler_ID") ) 3 rows from wrestler table: Wrestler_ID Name Reign Days_held Location Event 1 Rey Misterio Sr. 1 344 Tijuana , Mexico Live event 2 Fishman 1 113 Tijuana , Mexico Live event 3 Villaño IV 1 1285 Tijuana , Mexico Live event CREATE TABLE "Elimination" ( "Elimination_ID" text, "Wrestler_ID" text, "Team" text, "Eliminated_By" text, "Elimination_Move" text, "Time" text, PRIMARY KEY ("Elimination_ID"), FOREIGN KEY ("Wrestler_ID") REFERENCES "wrestler"("Wrestler_ID") ) 3 rows from Elimination table: Elimination_ID Wrestler_ID Team Eliminated_By Elimination_Move Time 1 1 Team Orton Punk Go To Sleep 00:11 2 2 Team Batista Benjamin Paydirt 07:38 3 4 Team Batista Orton Rope hung DDT 10:45
wrestler
Which locations are shared by more than two wrestlers?
SELECT LOCATION FROM wrestler GROUP BY LOCATION HAVING COUNT(*) > 2
CREATE TABLE "wrestler" ( "Wrestler_ID" int, "Name" text, "Reign" text, "Days_held" text, "Location" text, "Event" text, PRIMARY KEY ("Wrestler_ID") ) 3 rows from wrestler table: Wrestler_ID Name Reign Days_held Location Event 1 Rey Misterio Sr. 1 344 Tijuana , Mexico Live event 2 Fishman 1 113 Tijuana , Mexico Live event 3 Villaño IV 1 1285 Tijuana , Mexico Live event CREATE TABLE "Elimination" ( "Elimination_ID" text, "Wrestler_ID" text, "Team" text, "Eliminated_By" text, "Elimination_Move" text, "Time" text, PRIMARY KEY ("Elimination_ID"), FOREIGN KEY ("Wrestler_ID") REFERENCES "wrestler"("Wrestler_ID") ) 3 rows from Elimination table: Elimination_ID Wrestler_ID Team Eliminated_By Elimination_Move Time 1 1 Team Orton Punk Go To Sleep 00:11 2 2 Team Batista Benjamin Paydirt 07:38 3 4 Team Batista Orton Rope hung DDT 10:45
wrestler
List the names of wrestlers that have not been eliminated.
SELECT Name FROM wrestler WHERE Wrestler_ID NOT IN (SELECT Wrestler_ID FROM elimination)
CREATE TABLE "wrestler" ( "Wrestler_ID" int, "Name" text, "Reign" text, "Days_held" text, "Location" text, "Event" text, PRIMARY KEY ("Wrestler_ID") ) 3 rows from wrestler table: Wrestler_ID Name Reign Days_held Location Event 1 Rey Misterio Sr. 1 344 Tijuana , Mexico Live event 2 Fishman 1 113 Tijuana , Mexico Live event 3 Villaño IV 1 1285 Tijuana , Mexico Live event CREATE TABLE "Elimination" ( "Elimination_ID" text, "Wrestler_ID" text, "Team" text, "Eliminated_By" text, "Elimination_Move" text, "Time" text, PRIMARY KEY ("Elimination_ID"), FOREIGN KEY ("Wrestler_ID") REFERENCES "wrestler"("Wrestler_ID") ) 3 rows from Elimination table: Elimination_ID Wrestler_ID Team Eliminated_By Elimination_Move Time 1 1 Team Orton Punk Go To Sleep 00:11 2 2 Team Batista Benjamin Paydirt 07:38 3 4 Team Batista Orton Rope hung DDT 10:45
wrestler
What are the names of wrestlers who have never been eliminated?
SELECT Name FROM wrestler WHERE Wrestler_ID NOT IN (SELECT Wrestler_ID FROM elimination)
CREATE TABLE "wrestler" ( "Wrestler_ID" int, "Name" text, "Reign" text, "Days_held" text, "Location" text, "Event" text, PRIMARY KEY ("Wrestler_ID") ) 3 rows from wrestler table: Wrestler_ID Name Reign Days_held Location Event 1 Rey Misterio Sr. 1 344 Tijuana , Mexico Live event 2 Fishman 1 113 Tijuana , Mexico Live event 3 Villaño IV 1 1285 Tijuana , Mexico Live event CREATE TABLE "Elimination" ( "Elimination_ID" text, "Wrestler_ID" text, "Team" text, "Eliminated_By" text, "Elimination_Move" text, "Time" text, PRIMARY KEY ("Elimination_ID"), FOREIGN KEY ("Wrestler_ID") REFERENCES "wrestler"("Wrestler_ID") ) 3 rows from Elimination table: Elimination_ID Wrestler_ID Team Eliminated_By Elimination_Move Time 1 1 Team Orton Punk Go To Sleep 00:11 2 2 Team Batista Benjamin Paydirt 07:38 3 4 Team Batista Orton Rope hung DDT 10:45
wrestler
Show the teams that have both wrestlers eliminated by "Orton" and wrestlers eliminated by "Benjamin".
SELECT Team FROM Elimination WHERE Eliminated_By = "Orton" INTERSECT SELECT Team FROM Elimination WHERE Eliminated_By = "Benjamin"
CREATE TABLE "wrestler" ( "Wrestler_ID" int, "Name" text, "Reign" text, "Days_held" text, "Location" text, "Event" text, PRIMARY KEY ("Wrestler_ID") ) 3 rows from wrestler table: Wrestler_ID Name Reign Days_held Location Event 1 Rey Misterio Sr. 1 344 Tijuana , Mexico Live event 2 Fishman 1 113 Tijuana , Mexico Live event 3 Villaño IV 1 1285 Tijuana , Mexico Live event CREATE TABLE "Elimination" ( "Elimination_ID" text, "Wrestler_ID" text, "Team" text, "Eliminated_By" text, "Elimination_Move" text, "Time" text, PRIMARY KEY ("Elimination_ID"), FOREIGN KEY ("Wrestler_ID") REFERENCES "wrestler"("Wrestler_ID") ) 3 rows from Elimination table: Elimination_ID Wrestler_ID Team Eliminated_By Elimination_Move Time 1 1 Team Orton Punk Go To Sleep 00:11 2 2 Team Batista Benjamin Paydirt 07:38 3 4 Team Batista Orton Rope hung DDT 10:45
wrestler
What are the teams that have both wrestlers eliminated by Orton and wrestlers eliminated by Benjamin?
SELECT Team FROM Elimination WHERE Eliminated_By = "Orton" INTERSECT SELECT Team FROM Elimination WHERE Eliminated_By = "Benjamin"
CREATE TABLE "wrestler" ( "Wrestler_ID" int, "Name" text, "Reign" text, "Days_held" text, "Location" text, "Event" text, PRIMARY KEY ("Wrestler_ID") ) 3 rows from wrestler table: Wrestler_ID Name Reign Days_held Location Event 1 Rey Misterio Sr. 1 344 Tijuana , Mexico Live event 2 Fishman 1 113 Tijuana , Mexico Live event 3 Villaño IV 1 1285 Tijuana , Mexico Live event CREATE TABLE "Elimination" ( "Elimination_ID" text, "Wrestler_ID" text, "Team" text, "Eliminated_By" text, "Elimination_Move" text, "Time" text, PRIMARY KEY ("Elimination_ID"), FOREIGN KEY ("Wrestler_ID") REFERENCES "wrestler"("Wrestler_ID") ) 3 rows from Elimination table: Elimination_ID Wrestler_ID Team Eliminated_By Elimination_Move Time 1 1 Team Orton Punk Go To Sleep 00:11 2 2 Team Batista Benjamin Paydirt 07:38 3 4 Team Batista Orton Rope hung DDT 10:45
wrestler
What is the number of distinct teams that suffer elimination?
SELECT COUNT (DISTINCT team) FROM elimination
CREATE TABLE "wrestler" ( "Wrestler_ID" int, "Name" text, "Reign" text, "Days_held" text, "Location" text, "Event" text, PRIMARY KEY ("Wrestler_ID") ) 3 rows from wrestler table: Wrestler_ID Name Reign Days_held Location Event 1 Rey Misterio Sr. 1 344 Tijuana , Mexico Live event 2 Fishman 1 113 Tijuana , Mexico Live event 3 Villaño IV 1 1285 Tijuana , Mexico Live event CREATE TABLE "Elimination" ( "Elimination_ID" text, "Wrestler_ID" text, "Team" text, "Eliminated_By" text, "Elimination_Move" text, "Time" text, PRIMARY KEY ("Elimination_ID"), FOREIGN KEY ("Wrestler_ID") REFERENCES "wrestler"("Wrestler_ID") ) 3 rows from Elimination table: Elimination_ID Wrestler_ID Team Eliminated_By Elimination_Move Time 1 1 Team Orton Punk Go To Sleep 00:11 2 2 Team Batista Benjamin Paydirt 07:38 3 4 Team Batista Orton Rope hung DDT 10:45
wrestler
How many different teams have had eliminated wrestlers?
SELECT COUNT (DISTINCT team) FROM elimination
CREATE TABLE "wrestler" ( "Wrestler_ID" int, "Name" text, "Reign" text, "Days_held" text, "Location" text, "Event" text, PRIMARY KEY ("Wrestler_ID") ) 3 rows from wrestler table: Wrestler_ID Name Reign Days_held Location Event 1 Rey Misterio Sr. 1 344 Tijuana , Mexico Live event 2 Fishman 1 113 Tijuana , Mexico Live event 3 Villaño IV 1 1285 Tijuana , Mexico Live event CREATE TABLE "Elimination" ( "Elimination_ID" text, "Wrestler_ID" text, "Team" text, "Eliminated_By" text, "Elimination_Move" text, "Time" text, PRIMARY KEY ("Elimination_ID"), FOREIGN KEY ("Wrestler_ID") REFERENCES "wrestler"("Wrestler_ID") ) 3 rows from Elimination table: Elimination_ID Wrestler_ID Team Eliminated_By Elimination_Move Time 1 1 Team Orton Punk Go To Sleep 00:11 2 2 Team Batista Benjamin Paydirt 07:38 3 4 Team Batista Orton Rope hung DDT 10:45
wrestler
Show the times of elimination by "Punk" or "Orton".
SELECT TIME FROM elimination WHERE Eliminated_By = "Punk" OR Eliminated_By = "Orton"
CREATE TABLE "wrestler" ( "Wrestler_ID" int, "Name" text, "Reign" text, "Days_held" text, "Location" text, "Event" text, PRIMARY KEY ("Wrestler_ID") ) 3 rows from wrestler table: Wrestler_ID Name Reign Days_held Location Event 1 Rey Misterio Sr. 1 344 Tijuana , Mexico Live event 2 Fishman 1 113 Tijuana , Mexico Live event 3 Villaño IV 1 1285 Tijuana , Mexico Live event CREATE TABLE "Elimination" ( "Elimination_ID" text, "Wrestler_ID" text, "Team" text, "Eliminated_By" text, "Elimination_Move" text, "Time" text, PRIMARY KEY ("Elimination_ID"), FOREIGN KEY ("Wrestler_ID") REFERENCES "wrestler"("Wrestler_ID") ) 3 rows from Elimination table: Elimination_ID Wrestler_ID Team Eliminated_By Elimination_Move Time 1 1 Team Orton Punk Go To Sleep 00:11 2 2 Team Batista Benjamin Paydirt 07:38 3 4 Team Batista Orton Rope hung DDT 10:45
wrestler
What are the times of elimination for any instances in which the elimination was done by Punk or Orton?
SELECT TIME FROM elimination WHERE Eliminated_By = "Punk" OR Eliminated_By = "Orton"
CREATE TABLE "wrestler" ( "Wrestler_ID" int, "Name" text, "Reign" text, "Days_held" text, "Location" text, "Event" text, PRIMARY KEY ("Wrestler_ID") ) 3 rows from wrestler table: Wrestler_ID Name Reign Days_held Location Event 1 Rey Misterio Sr. 1 344 Tijuana , Mexico Live event 2 Fishman 1 113 Tijuana , Mexico Live event 3 Villaño IV 1 1285 Tijuana , Mexico Live event CREATE TABLE "Elimination" ( "Elimination_ID" text, "Wrestler_ID" text, "Team" text, "Eliminated_By" text, "Elimination_Move" text, "Time" text, PRIMARY KEY ("Elimination_ID"), FOREIGN KEY ("Wrestler_ID") REFERENCES "wrestler"("Wrestler_ID") ) 3 rows from Elimination table: Elimination_ID Wrestler_ID Team Eliminated_By Elimination_Move Time 1 1 Team Orton Punk Go To Sleep 00:11 2 2 Team Batista Benjamin Paydirt 07:38 3 4 Team Batista Orton Rope hung DDT 10:45
school_finance
How many schools are there?
SELECT count(*) FROM school
CREATE TABLE "School" ( "School_id" text, "School_name" text, "Location" text, "Mascot" text, "Enrollment" int, "IHSAA_Class" text, "IHSAA_Football_Class" text, "County" text, PRIMARY KEY ("School_id") ) 3 rows from School table: School_id School_name Location Mascot Enrollment IHSAA_Class IHSAA_Football_Class County 1 Bremen Bremen Lions 495 AA AA 50 Marshall 2 Culver Community Culver Cavaliers 287 A A 50 Marshall 3 Glenn Walkerton Falcons 605 AAA AAA 71 St. Joseph CREATE TABLE "budget" ( "School_id" int, "Year" int, "Budgeted" int, "total_budget_percent_budgeted" real, "Invested" int, "total_budget_percent_invested" real, "Budget_invested_percent" text, PRIMARY KEY("School_id","YEAR"), FOREIGN KEY("School_id") REFERENCES "School"("School_id") ) 3 rows from budget table: School_id Year Budgeted total_budget_percent_budgeted Invested total_budget_percent_invested Budget_invested_percent 2 1999 4979 2.0 2134 2.0 42.9 2 2000 3666 2.0 5840 2.0 159.3 2 2001 6803 2.0 8335 2.0 122.5 CREATE TABLE "endowment" ( "endowment_id" int, "School_id" int, "donator_name" text, "amount" real, PRIMARY KEY("endowment_id"), FOREIGN KEY("School_id") REFERENCES "School"("School_id") ) 3 rows from endowment table: endowment_id School_id donator_name amount 1 1 Monte Plata 9.51 2 2 San José de Ocoa 9.83 3 3 Distrito Nacional 9.55
school_finance
Count the number of schools.
SELECT count(*) FROM school
CREATE TABLE "School" ( "School_id" text, "School_name" text, "Location" text, "Mascot" text, "Enrollment" int, "IHSAA_Class" text, "IHSAA_Football_Class" text, "County" text, PRIMARY KEY ("School_id") ) 3 rows from School table: School_id School_name Location Mascot Enrollment IHSAA_Class IHSAA_Football_Class County 1 Bremen Bremen Lions 495 AA AA 50 Marshall 2 Culver Community Culver Cavaliers 287 A A 50 Marshall 3 Glenn Walkerton Falcons 605 AAA AAA 71 St. Joseph CREATE TABLE "budget" ( "School_id" int, "Year" int, "Budgeted" int, "total_budget_percent_budgeted" real, "Invested" int, "total_budget_percent_invested" real, "Budget_invested_percent" text, PRIMARY KEY("School_id","YEAR"), FOREIGN KEY("School_id") REFERENCES "School"("School_id") ) 3 rows from budget table: School_id Year Budgeted total_budget_percent_budgeted Invested total_budget_percent_invested Budget_invested_percent 2 1999 4979 2.0 2134 2.0 42.9 2 2000 3666 2.0 5840 2.0 159.3 2 2001 6803 2.0 8335 2.0 122.5 CREATE TABLE "endowment" ( "endowment_id" int, "School_id" int, "donator_name" text, "amount" real, PRIMARY KEY("endowment_id"), FOREIGN KEY("School_id") REFERENCES "School"("School_id") ) 3 rows from endowment table: endowment_id School_id donator_name amount 1 1 Monte Plata 9.51 2 2 San José de Ocoa 9.83 3 3 Distrito Nacional 9.55
school_finance
Show all school names in alphabetical order.
SELECT school_name FROM school ORDER BY school_name
CREATE TABLE "School" ( "School_id" text, "School_name" text, "Location" text, "Mascot" text, "Enrollment" int, "IHSAA_Class" text, "IHSAA_Football_Class" text, "County" text, PRIMARY KEY ("School_id") ) 3 rows from School table: School_id School_name Location Mascot Enrollment IHSAA_Class IHSAA_Football_Class County 1 Bremen Bremen Lions 495 AA AA 50 Marshall 2 Culver Community Culver Cavaliers 287 A A 50 Marshall 3 Glenn Walkerton Falcons 605 AAA AAA 71 St. Joseph CREATE TABLE "budget" ( "School_id" int, "Year" int, "Budgeted" int, "total_budget_percent_budgeted" real, "Invested" int, "total_budget_percent_invested" real, "Budget_invested_percent" text, PRIMARY KEY("School_id","YEAR"), FOREIGN KEY("School_id") REFERENCES "School"("School_id") ) 3 rows from budget table: School_id Year Budgeted total_budget_percent_budgeted Invested total_budget_percent_invested Budget_invested_percent 2 1999 4979 2.0 2134 2.0 42.9 2 2000 3666 2.0 5840 2.0 159.3 2 2001 6803 2.0 8335 2.0 122.5 CREATE TABLE "endowment" ( "endowment_id" int, "School_id" int, "donator_name" text, "amount" real, PRIMARY KEY("endowment_id"), FOREIGN KEY("School_id") REFERENCES "School"("School_id") ) 3 rows from endowment table: endowment_id School_id donator_name amount 1 1 Monte Plata 9.51 2 2 San José de Ocoa 9.83 3 3 Distrito Nacional 9.55
school_finance
List the name, location, mascot for all schools.
SELECT school_name , LOCATION , mascot FROM school
CREATE TABLE "School" ( "School_id" text, "School_name" text, "Location" text, "Mascot" text, "Enrollment" int, "IHSAA_Class" text, "IHSAA_Football_Class" text, "County" text, PRIMARY KEY ("School_id") ) 3 rows from School table: School_id School_name Location Mascot Enrollment IHSAA_Class IHSAA_Football_Class County 1 Bremen Bremen Lions 495 AA AA 50 Marshall 2 Culver Community Culver Cavaliers 287 A A 50 Marshall 3 Glenn Walkerton Falcons 605 AAA AAA 71 St. Joseph CREATE TABLE "budget" ( "School_id" int, "Year" int, "Budgeted" int, "total_budget_percent_budgeted" real, "Invested" int, "total_budget_percent_invested" real, "Budget_invested_percent" text, PRIMARY KEY("School_id","YEAR"), FOREIGN KEY("School_id") REFERENCES "School"("School_id") ) 3 rows from budget table: School_id Year Budgeted total_budget_percent_budgeted Invested total_budget_percent_invested Budget_invested_percent 2 1999 4979 2.0 2134 2.0 42.9 2 2000 3666 2.0 5840 2.0 159.3 2 2001 6803 2.0 8335 2.0 122.5 CREATE TABLE "endowment" ( "endowment_id" int, "School_id" int, "donator_name" text, "amount" real, PRIMARY KEY("endowment_id"), FOREIGN KEY("School_id") REFERENCES "School"("School_id") ) 3 rows from endowment table: endowment_id School_id donator_name amount 1 1 Monte Plata 9.51 2 2 San José de Ocoa 9.83 3 3 Distrito Nacional 9.55
school_finance
What are the total and average enrollment of all schools?
SELECT sum(enrollment) , avg(enrollment) FROM school
CREATE TABLE "School" ( "School_id" text, "School_name" text, "Location" text, "Mascot" text, "Enrollment" int, "IHSAA_Class" text, "IHSAA_Football_Class" text, "County" text, PRIMARY KEY ("School_id") ) 3 rows from School table: School_id School_name Location Mascot Enrollment IHSAA_Class IHSAA_Football_Class County 1 Bremen Bremen Lions 495 AA AA 50 Marshall 2 Culver Community Culver Cavaliers 287 A A 50 Marshall 3 Glenn Walkerton Falcons 605 AAA AAA 71 St. Joseph CREATE TABLE "budget" ( "School_id" int, "Year" int, "Budgeted" int, "total_budget_percent_budgeted" real, "Invested" int, "total_budget_percent_invested" real, "Budget_invested_percent" text, PRIMARY KEY("School_id","YEAR"), FOREIGN KEY("School_id") REFERENCES "School"("School_id") ) 3 rows from budget table: School_id Year Budgeted total_budget_percent_budgeted Invested total_budget_percent_invested Budget_invested_percent 2 1999 4979 2.0 2134 2.0 42.9 2 2000 3666 2.0 5840 2.0 159.3 2 2001 6803 2.0 8335 2.0 122.5 CREATE TABLE "endowment" ( "endowment_id" int, "School_id" int, "donator_name" text, "amount" real, PRIMARY KEY("endowment_id"), FOREIGN KEY("School_id") REFERENCES "School"("School_id") ) 3 rows from endowment table: endowment_id School_id donator_name amount 1 1 Monte Plata 9.51 2 2 San José de Ocoa 9.83 3 3 Distrito Nacional 9.55
school_finance
What are the mascots for schools with enrollments above the average?
SELECT mascot FROM school WHERE enrollment > (SELECT avg(enrollment) FROM school)
CREATE TABLE "School" ( "School_id" text, "School_name" text, "Location" text, "Mascot" text, "Enrollment" int, "IHSAA_Class" text, "IHSAA_Football_Class" text, "County" text, PRIMARY KEY ("School_id") ) 3 rows from School table: School_id School_name Location Mascot Enrollment IHSAA_Class IHSAA_Football_Class County 1 Bremen Bremen Lions 495 AA AA 50 Marshall 2 Culver Community Culver Cavaliers 287 A A 50 Marshall 3 Glenn Walkerton Falcons 605 AAA AAA 71 St. Joseph CREATE TABLE "budget" ( "School_id" int, "Year" int, "Budgeted" int, "total_budget_percent_budgeted" real, "Invested" int, "total_budget_percent_invested" real, "Budget_invested_percent" text, PRIMARY KEY("School_id","YEAR"), FOREIGN KEY("School_id") REFERENCES "School"("School_id") ) 3 rows from budget table: School_id Year Budgeted total_budget_percent_budgeted Invested total_budget_percent_invested Budget_invested_percent 2 1999 4979 2.0 2134 2.0 42.9 2 2000 3666 2.0 5840 2.0 159.3 2 2001 6803 2.0 8335 2.0 122.5 CREATE TABLE "endowment" ( "endowment_id" int, "School_id" int, "donator_name" text, "amount" real, PRIMARY KEY("endowment_id"), FOREIGN KEY("School_id") REFERENCES "School"("School_id") ) 3 rows from endowment table: endowment_id School_id donator_name amount 1 1 Monte Plata 9.51 2 2 San José de Ocoa 9.83 3 3 Distrito Nacional 9.55
school_finance
List the name of the school with the smallest enrollment.
SELECT school_name FROM school ORDER BY enrollment LIMIT 1
CREATE TABLE "School" ( "School_id" text, "School_name" text, "Location" text, "Mascot" text, "Enrollment" int, "IHSAA_Class" text, "IHSAA_Football_Class" text, "County" text, PRIMARY KEY ("School_id") ) 3 rows from School table: School_id School_name Location Mascot Enrollment IHSAA_Class IHSAA_Football_Class County 1 Bremen Bremen Lions 495 AA AA 50 Marshall 2 Culver Community Culver Cavaliers 287 A A 50 Marshall 3 Glenn Walkerton Falcons 605 AAA AAA 71 St. Joseph CREATE TABLE "budget" ( "School_id" int, "Year" int, "Budgeted" int, "total_budget_percent_budgeted" real, "Invested" int, "total_budget_percent_invested" real, "Budget_invested_percent" text, PRIMARY KEY("School_id","YEAR"), FOREIGN KEY("School_id") REFERENCES "School"("School_id") ) 3 rows from budget table: School_id Year Budgeted total_budget_percent_budgeted Invested total_budget_percent_invested Budget_invested_percent 2 1999 4979 2.0 2134 2.0 42.9 2 2000 3666 2.0 5840 2.0 159.3 2 2001 6803 2.0 8335 2.0 122.5 CREATE TABLE "endowment" ( "endowment_id" int, "School_id" int, "donator_name" text, "amount" real, PRIMARY KEY("endowment_id"), FOREIGN KEY("School_id") REFERENCES "School"("School_id") ) 3 rows from endowment table: endowment_id School_id donator_name amount 1 1 Monte Plata 9.51 2 2 San José de Ocoa 9.83 3 3 Distrito Nacional 9.55
school_finance
Show the average, maximum, minimum enrollment of all schools.
SELECT avg(enrollment) , max(enrollment) , min(enrollment) FROM school
CREATE TABLE "School" ( "School_id" text, "School_name" text, "Location" text, "Mascot" text, "Enrollment" int, "IHSAA_Class" text, "IHSAA_Football_Class" text, "County" text, PRIMARY KEY ("School_id") ) 3 rows from School table: School_id School_name Location Mascot Enrollment IHSAA_Class IHSAA_Football_Class County 1 Bremen Bremen Lions 495 AA AA 50 Marshall 2 Culver Community Culver Cavaliers 287 A A 50 Marshall 3 Glenn Walkerton Falcons 605 AAA AAA 71 St. Joseph CREATE TABLE "budget" ( "School_id" int, "Year" int, "Budgeted" int, "total_budget_percent_budgeted" real, "Invested" int, "total_budget_percent_invested" real, "Budget_invested_percent" text, PRIMARY KEY("School_id","YEAR"), FOREIGN KEY("School_id") REFERENCES "School"("School_id") ) 3 rows from budget table: School_id Year Budgeted total_budget_percent_budgeted Invested total_budget_percent_invested Budget_invested_percent 2 1999 4979 2.0 2134 2.0 42.9 2 2000 3666 2.0 5840 2.0 159.3 2 2001 6803 2.0 8335 2.0 122.5 CREATE TABLE "endowment" ( "endowment_id" int, "School_id" int, "donator_name" text, "amount" real, PRIMARY KEY("endowment_id"), FOREIGN KEY("School_id") REFERENCES "School"("School_id") ) 3 rows from endowment table: endowment_id School_id donator_name amount 1 1 Monte Plata 9.51 2 2 San José de Ocoa 9.83 3 3 Distrito Nacional 9.55
school_finance
Show each county along with the number of schools and total enrollment in each county.
SELECT county , count(*) , sum(enrollment) FROM school GROUP BY county
CREATE TABLE "School" ( "School_id" text, "School_name" text, "Location" text, "Mascot" text, "Enrollment" int, "IHSAA_Class" text, "IHSAA_Football_Class" text, "County" text, PRIMARY KEY ("School_id") ) 3 rows from School table: School_id School_name Location Mascot Enrollment IHSAA_Class IHSAA_Football_Class County 1 Bremen Bremen Lions 495 AA AA 50 Marshall 2 Culver Community Culver Cavaliers 287 A A 50 Marshall 3 Glenn Walkerton Falcons 605 AAA AAA 71 St. Joseph CREATE TABLE "budget" ( "School_id" int, "Year" int, "Budgeted" int, "total_budget_percent_budgeted" real, "Invested" int, "total_budget_percent_invested" real, "Budget_invested_percent" text, PRIMARY KEY("School_id","YEAR"), FOREIGN KEY("School_id") REFERENCES "School"("School_id") ) 3 rows from budget table: School_id Year Budgeted total_budget_percent_budgeted Invested total_budget_percent_invested Budget_invested_percent 2 1999 4979 2.0 2134 2.0 42.9 2 2000 3666 2.0 5840 2.0 159.3 2 2001 6803 2.0 8335 2.0 122.5 CREATE TABLE "endowment" ( "endowment_id" int, "School_id" int, "donator_name" text, "amount" real, PRIMARY KEY("endowment_id"), FOREIGN KEY("School_id") REFERENCES "School"("School_id") ) 3 rows from endowment table: endowment_id School_id donator_name amount 1 1 Monte Plata 9.51 2 2 San José de Ocoa 9.83 3 3 Distrito Nacional 9.55
school_finance
How many donors have endowment for school named "Glenn"?
SELECT count(DISTINCT T1.donator_name) FROM endowment AS T1 JOIN school AS T2 ON T1.school_id = T2.school_id WHERE T2.school_name = "Glenn"
CREATE TABLE "School" ( "School_id" text, "School_name" text, "Location" text, "Mascot" text, "Enrollment" int, "IHSAA_Class" text, "IHSAA_Football_Class" text, "County" text, PRIMARY KEY ("School_id") ) 3 rows from School table: School_id School_name Location Mascot Enrollment IHSAA_Class IHSAA_Football_Class County 1 Bremen Bremen Lions 495 AA AA 50 Marshall 2 Culver Community Culver Cavaliers 287 A A 50 Marshall 3 Glenn Walkerton Falcons 605 AAA AAA 71 St. Joseph CREATE TABLE "budget" ( "School_id" int, "Year" int, "Budgeted" int, "total_budget_percent_budgeted" real, "Invested" int, "total_budget_percent_invested" real, "Budget_invested_percent" text, PRIMARY KEY("School_id","YEAR"), FOREIGN KEY("School_id") REFERENCES "School"("School_id") ) 3 rows from budget table: School_id Year Budgeted total_budget_percent_budgeted Invested total_budget_percent_invested Budget_invested_percent 2 1999 4979 2.0 2134 2.0 42.9 2 2000 3666 2.0 5840 2.0 159.3 2 2001 6803 2.0 8335 2.0 122.5 CREATE TABLE "endowment" ( "endowment_id" int, "School_id" int, "donator_name" text, "amount" real, PRIMARY KEY("endowment_id"), FOREIGN KEY("School_id") REFERENCES "School"("School_id") ) 3 rows from endowment table: endowment_id School_id donator_name amount 1 1 Monte Plata 9.51 2 2 San José de Ocoa 9.83 3 3 Distrito Nacional 9.55
school_finance
List each donator name and the amount of endowment in descending order of the amount of endowment.
SELECT donator_name , sum(amount) FROM endowment GROUP BY donator_name ORDER BY sum(amount) DESC
CREATE TABLE "School" ( "School_id" text, "School_name" text, "Location" text, "Mascot" text, "Enrollment" int, "IHSAA_Class" text, "IHSAA_Football_Class" text, "County" text, PRIMARY KEY ("School_id") ) 3 rows from School table: School_id School_name Location Mascot Enrollment IHSAA_Class IHSAA_Football_Class County 1 Bremen Bremen Lions 495 AA AA 50 Marshall 2 Culver Community Culver Cavaliers 287 A A 50 Marshall 3 Glenn Walkerton Falcons 605 AAA AAA 71 St. Joseph CREATE TABLE "budget" ( "School_id" int, "Year" int, "Budgeted" int, "total_budget_percent_budgeted" real, "Invested" int, "total_budget_percent_invested" real, "Budget_invested_percent" text, PRIMARY KEY("School_id","YEAR"), FOREIGN KEY("School_id") REFERENCES "School"("School_id") ) 3 rows from budget table: School_id Year Budgeted total_budget_percent_budgeted Invested total_budget_percent_invested Budget_invested_percent 2 1999 4979 2.0 2134 2.0 42.9 2 2000 3666 2.0 5840 2.0 159.3 2 2001 6803 2.0 8335 2.0 122.5 CREATE TABLE "endowment" ( "endowment_id" int, "School_id" int, "donator_name" text, "amount" real, PRIMARY KEY("endowment_id"), FOREIGN KEY("School_id") REFERENCES "School"("School_id") ) 3 rows from endowment table: endowment_id School_id donator_name amount 1 1 Monte Plata 9.51 2 2 San José de Ocoa 9.83 3 3 Distrito Nacional 9.55
school_finance
List the names of the schools without any endowment.
SELECT school_name FROM school WHERE school_id NOT IN (SELECT school_id FROM endowment)
CREATE TABLE "School" ( "School_id" text, "School_name" text, "Location" text, "Mascot" text, "Enrollment" int, "IHSAA_Class" text, "IHSAA_Football_Class" text, "County" text, PRIMARY KEY ("School_id") ) 3 rows from School table: School_id School_name Location Mascot Enrollment IHSAA_Class IHSAA_Football_Class County 1 Bremen Bremen Lions 495 AA AA 50 Marshall 2 Culver Community Culver Cavaliers 287 A A 50 Marshall 3 Glenn Walkerton Falcons 605 AAA AAA 71 St. Joseph CREATE TABLE "budget" ( "School_id" int, "Year" int, "Budgeted" int, "total_budget_percent_budgeted" real, "Invested" int, "total_budget_percent_invested" real, "Budget_invested_percent" text, PRIMARY KEY("School_id","YEAR"), FOREIGN KEY("School_id") REFERENCES "School"("School_id") ) 3 rows from budget table: School_id Year Budgeted total_budget_percent_budgeted Invested total_budget_percent_invested Budget_invested_percent 2 1999 4979 2.0 2134 2.0 42.9 2 2000 3666 2.0 5840 2.0 159.3 2 2001 6803 2.0 8335 2.0 122.5 CREATE TABLE "endowment" ( "endowment_id" int, "School_id" int, "donator_name" text, "amount" real, PRIMARY KEY("endowment_id"), FOREIGN KEY("School_id") REFERENCES "School"("School_id") ) 3 rows from endowment table: endowment_id School_id donator_name amount 1 1 Monte Plata 9.51 2 2 San José de Ocoa 9.83 3 3 Distrito Nacional 9.55
school_finance
List all the names of schools with an endowment amount smaller than or equal to 10.
SELECT T2.school_name FROM endowment AS T1 JOIN school AS T2 ON T1.school_id = T2.school_id GROUP BY T1.school_id HAVING sum(T1.amount) <= 10
CREATE TABLE "School" ( "School_id" text, "School_name" text, "Location" text, "Mascot" text, "Enrollment" int, "IHSAA_Class" text, "IHSAA_Football_Class" text, "County" text, PRIMARY KEY ("School_id") ) 3 rows from School table: School_id School_name Location Mascot Enrollment IHSAA_Class IHSAA_Football_Class County 1 Bremen Bremen Lions 495 AA AA 50 Marshall 2 Culver Community Culver Cavaliers 287 A A 50 Marshall 3 Glenn Walkerton Falcons 605 AAA AAA 71 St. Joseph CREATE TABLE "budget" ( "School_id" int, "Year" int, "Budgeted" int, "total_budget_percent_budgeted" real, "Invested" int, "total_budget_percent_invested" real, "Budget_invested_percent" text, PRIMARY KEY("School_id","YEAR"), FOREIGN KEY("School_id") REFERENCES "School"("School_id") ) 3 rows from budget table: School_id Year Budgeted total_budget_percent_budgeted Invested total_budget_percent_invested Budget_invested_percent 2 1999 4979 2.0 2134 2.0 42.9 2 2000 3666 2.0 5840 2.0 159.3 2 2001 6803 2.0 8335 2.0 122.5 CREATE TABLE "endowment" ( "endowment_id" int, "School_id" int, "donator_name" text, "amount" real, PRIMARY KEY("endowment_id"), FOREIGN KEY("School_id") REFERENCES "School"("School_id") ) 3 rows from endowment table: endowment_id School_id donator_name amount 1 1 Monte Plata 9.51 2 2 San José de Ocoa 9.83 3 3 Distrito Nacional 9.55
school_finance
Show the names of donors who donated to both school "Glenn" and "Triton."
SELECT T1.donator_name FROM endowment AS T1 JOIN school AS T2 ON T1.school_id = T2.school_id WHERE T2.school_name = 'Glenn' INTERSECT SELECT T1.donator_name FROM endowment AS T1 JOIN school AS T2 ON T1.school_id = T2.school_id WHERE T2.school_name = 'Triton'
CREATE TABLE "School" ( "School_id" text, "School_name" text, "Location" text, "Mascot" text, "Enrollment" int, "IHSAA_Class" text, "IHSAA_Football_Class" text, "County" text, PRIMARY KEY ("School_id") ) 3 rows from School table: School_id School_name Location Mascot Enrollment IHSAA_Class IHSAA_Football_Class County 1 Bremen Bremen Lions 495 AA AA 50 Marshall 2 Culver Community Culver Cavaliers 287 A A 50 Marshall 3 Glenn Walkerton Falcons 605 AAA AAA 71 St. Joseph CREATE TABLE "budget" ( "School_id" int, "Year" int, "Budgeted" int, "total_budget_percent_budgeted" real, "Invested" int, "total_budget_percent_invested" real, "Budget_invested_percent" text, PRIMARY KEY("School_id","YEAR"), FOREIGN KEY("School_id") REFERENCES "School"("School_id") ) 3 rows from budget table: School_id Year Budgeted total_budget_percent_budgeted Invested total_budget_percent_invested Budget_invested_percent 2 1999 4979 2.0 2134 2.0 42.9 2 2000 3666 2.0 5840 2.0 159.3 2 2001 6803 2.0 8335 2.0 122.5 CREATE TABLE "endowment" ( "endowment_id" int, "School_id" int, "donator_name" text, "amount" real, PRIMARY KEY("endowment_id"), FOREIGN KEY("School_id") REFERENCES "School"("School_id") ) 3 rows from endowment table: endowment_id School_id donator_name amount 1 1 Monte Plata 9.51 2 2 San José de Ocoa 9.83 3 3 Distrito Nacional 9.55
school_finance
Show the names of all the donors except those whose donation amount less than 9.
SELECT donator_name FROM endowment EXCEPT SELECT donator_name FROM endowment WHERE amount < 9
CREATE TABLE "School" ( "School_id" text, "School_name" text, "Location" text, "Mascot" text, "Enrollment" int, "IHSAA_Class" text, "IHSAA_Football_Class" text, "County" text, PRIMARY KEY ("School_id") ) 3 rows from School table: School_id School_name Location Mascot Enrollment IHSAA_Class IHSAA_Football_Class County 1 Bremen Bremen Lions 495 AA AA 50 Marshall 2 Culver Community Culver Cavaliers 287 A A 50 Marshall 3 Glenn Walkerton Falcons 605 AAA AAA 71 St. Joseph CREATE TABLE "budget" ( "School_id" int, "Year" int, "Budgeted" int, "total_budget_percent_budgeted" real, "Invested" int, "total_budget_percent_invested" real, "Budget_invested_percent" text, PRIMARY KEY("School_id","YEAR"), FOREIGN KEY("School_id") REFERENCES "School"("School_id") ) 3 rows from budget table: School_id Year Budgeted total_budget_percent_budgeted Invested total_budget_percent_invested Budget_invested_percent 2 1999 4979 2.0 2134 2.0 42.9 2 2000 3666 2.0 5840 2.0 159.3 2 2001 6803 2.0 8335 2.0 122.5 CREATE TABLE "endowment" ( "endowment_id" int, "School_id" int, "donator_name" text, "amount" real, PRIMARY KEY("endowment_id"), FOREIGN KEY("School_id") REFERENCES "School"("School_id") ) 3 rows from endowment table: endowment_id School_id donator_name amount 1 1 Monte Plata 9.51 2 2 San José de Ocoa 9.83 3 3 Distrito Nacional 9.55
school_finance
List the amount and donor name for the largest amount of donation.
SELECT amount , donator_name FROM endowment ORDER BY amount DESC LIMIT 1
CREATE TABLE "School" ( "School_id" text, "School_name" text, "Location" text, "Mascot" text, "Enrollment" int, "IHSAA_Class" text, "IHSAA_Football_Class" text, "County" text, PRIMARY KEY ("School_id") ) 3 rows from School table: School_id School_name Location Mascot Enrollment IHSAA_Class IHSAA_Football_Class County 1 Bremen Bremen Lions 495 AA AA 50 Marshall 2 Culver Community Culver Cavaliers 287 A A 50 Marshall 3 Glenn Walkerton Falcons 605 AAA AAA 71 St. Joseph CREATE TABLE "budget" ( "School_id" int, "Year" int, "Budgeted" int, "total_budget_percent_budgeted" real, "Invested" int, "total_budget_percent_invested" real, "Budget_invested_percent" text, PRIMARY KEY("School_id","YEAR"), FOREIGN KEY("School_id") REFERENCES "School"("School_id") ) 3 rows from budget table: School_id Year Budgeted total_budget_percent_budgeted Invested total_budget_percent_invested Budget_invested_percent 2 1999 4979 2.0 2134 2.0 42.9 2 2000 3666 2.0 5840 2.0 159.3 2 2001 6803 2.0 8335 2.0 122.5 CREATE TABLE "endowment" ( "endowment_id" int, "School_id" int, "donator_name" text, "amount" real, PRIMARY KEY("endowment_id"), FOREIGN KEY("School_id") REFERENCES "School"("School_id") ) 3 rows from endowment table: endowment_id School_id donator_name amount 1 1 Monte Plata 9.51 2 2 San José de Ocoa 9.83 3 3 Distrito Nacional 9.55