Chinastark/bird_dataset huggingface dataset:
Database: financial
Note: a2 refers to the names of districts.;
Question: List account ID and account opening date for accounts from 'Prachatice'.
SQL: SELECT account.account_id, account.date FROM account INNER JOIN district ON account.district_id = district.district_id WHERE district.a2 = 'Prachatice'
Database: financial
Note: a2, a3 contains the information about district and region respectively.;
Question: State the district and region for loan ID '4990'.
SQL: SELECT district.a2, district.a3 FROM account INNER JOIN district ON account.district_id = district.district_id INNER JOIN loan ON account.account_id = loan.account_id WHERE loan.loan_id = 4990
Database: financial
Note: a2 contains district names and a3 contains region names.;
Question: Provide the account ID, district and region for loan amount greater than USD300,000.
SQL: SELECT account.account_id, district.a2, district.a3 FROM account INNER JOIN district ON account.district_id = district.district_id INNER JOIN loan ON account.account_id = loan.account_id WHERE loan.amount > 300000
Database: financial
Note: a3 refers to regions; a11 refers to average salary;
Question: List the loan ID, district and average salary for loan with duration of 60 months.
SQL: SELECT loan.loan_id, district.a2, district.a11 FROM account INNER JOIN district ON account.district_id = district.district_id INNER JOIN loan ON account.account_id = loan.account_id WHERE loan.duration = 60
Database: financial
Note: Unemployment increment rate in percentage = [(unemployment rate 2016 - unemployment rate 2015) / unemployment rate 2015] * 100; unemployment rate 2015 appears in the a12; unemployment rate 2016 appears in the a13; loan contracts which are still running where client are in debt can be presented as status = 'D';
Question: For loans contracts which are still running where client are in debt, list the district of the and the state the percentage unemployment rate increment from year 1995 to 1996.
SQL: SELECT cast((district.a13 - district.a12) AS REAL) * 100 / district.a12 FROM loan INNER JOIN account ON loan.account_id = account.account_id INNER JOIN district ON account.district_id = district.district_id WHERE loan.status = 'D'
Database: financial
Note: a2 contains the information about district.;
Question: Calculate the percentage of account from 'Decin' district for all accounts are opened in 1993.
SQL: SELECT cast(sum(district.a2 = 'Decin') AS REAL) * 100 / count(account_id) FROM district INNER JOIN account ON district.district_id = account.district_id WHERE strftime('%Y', account.date) = '1993'
Database: financial
Note: 'POPLATEK MESICNE' stands for monthly issuance;
Question: List the account IDs with monthly issuance of statements.
SQL: SELECT account_id FROM account WHERE frequency = 'POPLATEK MESICNE'
Database: financial
Note: a2 refers to districts; Female refers to gender = 'F';
Question: List the top nine districts, by descending order, from the highest to the lowest, the number of female account holders.
SQL: SELECT district.a2, count(client.client_id) FROM client INNER JOIN district ON client.district_id = district.district_id WHERE client.gender = 'F' GROUP BY district.district_id, district.a2 ORDER BY count(client.client_id) DESC LIMIT 9
Database: financial
Note: Non-credit card withdraws refers to type = 'VYDAJ'; January 1996 can be found by date LIKE '1996-01%' in the database; a2 means district names;
Question: Which are the top ten withdrawals (non-credit card) by district names for the month of January 1996?
SQL: SELECT DISTINCT district.a2 FROM district INNER JOIN account ON district.district_id = account.district_id INNER JOIN trans ON account.account_id = trans.account_id WHERE trans.type = 'VYDAJ' AND trans.date LIKE '1996-01%' ORDER BY a2 ASC LIMIT 10
Database: financial
Note: a3 contains the region names; South Bohemia is one of region names.;
Question: How many of the account holders in South Bohemia still do not own credit cards?
SQL: SELECT count(disp.account_id) FROM district INNER JOIN client ON district.district_id = client.district_id INNER JOIN disp ON client.client_id = disp.client_id WHERE district.a3 = 'south Bohemia' AND disp.type != 'OWNER'
Database: financial
Note: a3 refers to district names; Active loan refers to running contracts; status = 'C' stands for running contract, OK so far; status = 'D' stands for running contract, client in debt;
Question: Which district has highest active loan?
SQL: SELECT district.a3 FROM account INNER JOIN district ON account.district_id = district.district_id INNER JOIN loan ON account.account_id = loan.account_id WHERE loan.status IN ('C', 'D') GROUP BY district.a3 ORDER BY sum(loan.amount) DESC LIMIT 1
Database: financial
Note: Male refers to gender = 'M';
Question: What is the average loan amount by male borrowers?
SQL: SELECT avg(loan.amount) FROM client INNER JOIN disp ON client.client_id = disp.client_id INNER JOIN account ON disp.account_id = account.account_id INNER JOIN loan ON account.account_id = loan.account_id WHERE client.gender = 'M'
Database: financial
Note: a2 refers to district names; a13 refers to unemploymant rate in 1996;
Question: In 1996, which districts have the highest unemployment rate? List their branch location and district name.
SQL: SELECT district_id, a2 FROM district ORDER BY a13 DESC LIMIT 1
Database: financial
Note: a16 stands for no. of committed crimes 1996;
Question: In the branch where the largest number of crimes were committed in 1996, how many accounts were opened?
SQL: SELECT count(account.account_id) FROM district INNER JOIN account ON district.district_id = account.district_id GROUP BY district.a16 ORDER BY district.a16 DESC LIMIT 1
Database: financial
Note: Negative balance means balance < 0; operation = 'VYBER KARTOU' stands for credit card withdraw. frequency = 'POPLATEK MESICNE' stands for monthly issurance;
Question: After making a credit card withdrawal, how many account/s with monthly issuance has a negative balance?
SQL: SELECT count(trans.account_id) FROM trans INNER JOIN account ON trans.account_id = account.account_id WHERE trans.balance < 0 AND trans.operation = 'VYBER KARTOU' AND account.frequency = 'POPLATEK MESICNE'
Database: financial
Note: frequency = 'POPLATEK MESICNE' stands for monthly issurance;
Question: Between 1/1/1995 and 12/31/1997, how many loans in the amount of at least 250,000 per account that chose monthly statement issuance were approved?
SQL: SELECT count(account.account_id) FROM account INNER JOIN loan ON account.account_id = loan.account_id WHERE loan.date BETWEEN '1995-01-01' AND '1997-12-31' AND account.frequency = 'POPLATEK MESICNE' AND loan.amount >= 250000
Database: financial
Note: status = 'C' stands for running contract, OK so far; status = 'D' stands for running contract, client in debt;
Question: How many accounts have running contracts in Branch location 1?
SQL: SELECT count(account.account_id) FROM account INNER JOIN district ON account.district_id = district.district_id INNER JOIN loan ON account.account_id = loan.account_id WHERE account.district_id = 1 AND (loan.status = 'C' OR loan.status = 'D')
Database: financial
Note: Male refers to gender = 'M'; a15 stands for no. of commited crimes 1995;
Question: In the branch where the second-highest number of crimes were committed in 1995 occurred, how many male clients are there?
SQL: SELECT count(client.client_id) FROM client INNER JOIN district ON client.district_id = district.district_id WHERE client.gender = 'M' AND district.a15 = (SELECT district.a15 FROM district ORDER BY district.a15 DESC LIMIT 1, 1)
Database: financial
Note: High-level credit cards refers to the cards with the gold type.;
Question: How many high-level credit cards have "OWNER" type of disposition?
SQL: SELECT count(card.card_id) FROM card INNER JOIN disp ON card.disp_id = disp.disp_id WHERE card.type = 'gold' AND disp.type = 'OWNER'
Database: financial
Note: a2 refers to district name;
Question: How many accounts are there in the district of "Pisek"?
SQL: SELECT count(account.account_id) FROM account INNER JOIN district ON account.district_id = district.district_id WHERE district.a2 = 'Pisek'
Database: financial
Question: Which districts have transactions greater than USS$10,000 in 1997?
SQL: SELECT account.district_id FROM account INNER JOIN district ON account.district_id = district.district_id INNER JOIN trans ON account.account_id = trans.account_id WHERE strftime('%Y', trans.date) = '1997' GROUP BY account.district_id HAVING sum(trans.amount) > 10000
Database: financial
Note: k_symbol = 'SIPO' refers to household payment;
Question: Which accounts placed orders for household payment in Pisek?
SQL: SELECT DISTINCT account.account_id FROM trans INNER JOIN account ON trans.account_id = account.account_id INNER JOIN district ON account.district_id = district.district_id WHERE trans.k_symbol = 'SIPO' AND district.a2 = 'Pisek'
Database: financial
Question: What are the accounts that have gold credit cards?
SQL: SELECT disp.account_id FROM disp  INNER JOIN card ON card.disp_id = disp.disp_id  WHERE card.type = 'gold'
Database: financial
Note: operation = 'VYBER KARTOU' refers to credit card withdrawn;
Question: How much is the average amount in credit card made by account holders in a month, in year 2021?
SQL: SELECT avg(trans.amount) FROM card INNER JOIN disp ON card.disp_id = disp.disp_id INNER JOIN account ON disp.account_id = account.account_id INNER JOIN trans ON account.account_id = trans.account_id WHERE strftime('%Y', trans.date) = '1998' AND trans.operation = 'VYBER KARTOU'
Database: financial
Note: operation = 'VYBER KARTOU' refers to credit card withdrawal;
Question: Who are the account holder identification numbers whose who have transactions on the credit card with the amount is less than the average, in 1998?
SQL: SELECT trans.account_id FROM trans INNER JOIN account ON trans.account_id = account.account_id WHERE strftime('%Y', trans.date) = '1998' AND trans.operation = 'VYBER KARTOU' AND trans.amount < (SELECT avg(amount) FROM trans WHERE strftime('%Y', date) = '1998')
Database: financial
Note: Female refers to gender = 'F';
Question: Who are the female account holders who own credit cards and also have loans?
SQL: SELECT client.client_id FROM client INNER JOIN disp ON client.client_id = disp.client_id INNER JOIN account ON disp.account_id = account.account_id INNER JOIN loan ON account.account_id = loan.account_id INNER JOIN card ON disp.disp_id = card.disp_id WHERE client.gender = 'F'
Database: financial
Note: Female refers to gender = 'F'; a3 contains the region 'south Bohemia';
Question: How many female clients' accounts are in the region of South Bohemia?
SQL: SELECT count(client.client_id) FROM client INNER JOIN district ON client.district_id = district.district_id WHERE client.gender = 'F' AND district.a3 = 'south Bohemia'
Database: financial
Note: district refers to column a2; when the account type = 'OWNER', it's eligible for loans;
Question: Please list the accounts whose district is Tabor that are eligible for loans.
SQL: SELECT account.account_id FROM district INNER JOIN account ON district.district_id = account.district_id INNER JOIN disp ON account.account_id = disp.account_id WHERE disp.type = 'OWNER' AND district.a2 = 'Tabor'
Database: financial
Note: a11 represents the average salary; Salary and income share the similar meanings; when the account type = 'OWNER', it's eligible for loans;
Question: Please list the account types that are not eligible for loans, and the average income of residents in the district where the account is located exceeds $8000 but is no more than $9000.
SQL: SELECT disp.type FROM district INNER JOIN account ON district.district_id = account.district_id INNER JOIN disp ON account.account_id = disp.account_id WHERE disp.type != 'OWNER' AND district.a11 BETWEEN 8000 AND 9000
Database: financial
Note: a3 contains the region names; North Bohemia is a region.;
Question: How many accounts in North Bohemia has made a transaction with the partner's bank being AB?
SQL: SELECT count(account.account_id) FROM district INNER JOIN account ON district.district_id = account.district_id INNER JOIN trans ON account.account_id = trans.account_id WHERE trans.bank = 'AB' AND district.a3 = 'north Bohemia'
Database: financial
Note: a2 refers to district name; type = 'VYDAJ' stands for withdrawal transactions;
Question: Please list the name of the districts with accounts that made withdrawal transactions.
SQL: SELECT DISTINCT district.a2 FROM district INNER JOIN account ON district.district_id = account.district_id INNER JOIN trans ON account.account_id = trans.account_id WHERE trans.type = 'VYDAJ'
Database: financial
Note: a3 refers to region names; a15 stands for the average number of crimes commited in 1995.;
Question: What is the average number of crimes committed in 1995 in regions where the number exceeds 4000 and the region has accounts that are opened starting from the year 1997?
SQL: SELECT avg(district.a15) FROM district INNER JOIN account ON district.district_id = account.district_id WHERE strftime('%Y', account.date) >= '1997' AND district.a15 > 4000
Database: financial
Note: when the account type = 'OWNER', it's eligible for loan;
Question: How many 'classic' cards are eligible for loan?
SQL: SELECT count(card.card_id) FROM card INNER JOIN disp ON card.disp_id = disp.disp_id WHERE card.type = 'classic' AND disp.type = 'OWNER'
Database: financial
Note: district data appears in the a2; Male means that gender = 'M';
Question: How many male clients in 'Hl.m. Praha' district?
SQL: SELECT count(client.client_id) FROM client INNER JOIN district ON client.district_id = district.district_id WHERE client.gender = 'M' AND district.a2 = 'Hl.m. Praha'
Database: financial
Note: Percent of Gold = [ count(type = 'gold' and issued date < 1998) / count(all cards)] * 100%;
Question: How many percent of 'Gold' cards were issued prior to 1998?
SQL: SELECT cast(sum(TYPE = 'gold' AND strftime('%Y', issued) < '1998') AS REAL) * 100 / count(card_id) FROM card
Database: financial
Question: Who is the owner of the account with the largest loan amount?
SQL: SELECT disp.client_id FROM disp INNER JOIN account ON disp.account_id = account.account_id INNER JOIN loan ON account.account_id = loan.account_id WHERE disp.type = 'OWNER' ORDER BY loan.amount DESC LIMIT 1
Database: financial
Note: a15 contains information about number of committed crimes in 1995;
Question: What is the number of committed crimes in 1995 in the district of the account with the id 532?
SQL: SELECT district.a15 FROM district INNER JOIN `account` ON district.district_id = account.district_id WHERE account.account_id = 532
Database: financial
Question: What is the district Id of the account that placed the order with the id 33333?
SQL: SELECT district.district_id FROM `order` INNER JOIN account ON order.account_id = account.account_id INNER JOIN district ON account.district_id = district.district_id WHERE order.order_id = 33333
Database: financial
Note: operation = 'VYBER' refers to withdrawal in cash;
Question: List all the withdrawals in cash transactions that the client with the id 3356 makes.
SQL: SELECT trans.trans_id FROM client INNER JOIN disp ON client.client_id = disp.client_id INNER JOIN account ON disp.account_id = account.account_id INNER JOIN trans ON account.account_id = trans.account_id WHERE client.client_id = 3356 AND trans.operation = 'VYBER'
Database: financial
Note: frequency = 'POPLATEK TYDNE' stands for weekly issuance;
Question: Among the weekly issuance accounts, how many have a loan of under 200000?
SQL: SELECT count(loan.account_id) FROM loan INNER JOIN account ON loan.account_id = account.account_id WHERE account.frequency = 'POPLATEK TYDNE' AND loan.amount < 200000
Database: financial
Question: What type of credit card does the client with the id 13539 own?
SQL: SELECT card.type FROM disp INNER JOIN client ON disp.client_id = client.client_id INNER JOIN card ON disp.disp_id = card.disp_id WHERE client.client_id = 13539
Database: financial
Note: a3 refers to region;
Question: What is the region of the client with the id 3541 from?
SQL: SELECT district.a3 FROM district INNER JOIN client ON district.district_id = client.district_id WHERE client.client_id = 3541
Database: financial
Note: status = 'A' refers to loan contracts finished with no problems;
Question: Which district has the most accounts with loan contracts finished with no problems?
SQL: SELECT district.a2 FROM district INNER JOIN account ON district.district_id = account.district_id INNER JOIN loan ON account.account_id = loan.account_id WHERE loan.status = 'A' GROUP BY district.district_id ORDER BY count(account.account_id) DESC LIMIT 1
Database: financial
Question: Who placed the order with the id 32423?
SQL: SELECT client.client_id FROM `order` INNER JOIN account ON order.account_id = account.account_id INNER JOIN disp ON disp.account_id = account.account_id  INNER JOIN client ON disp.client_id = client.client_id WHERE order.order_id = 32423
Database: financial
Question: Please list all the transactions made by accounts from district 5.
SQL: SELECT trans.trans_id FROM district INNER JOIN account ON district.district_id = account.district_id INNER JOIN trans ON account.account_id = trans.account_id WHERE district.district_id = 5
Database: financial
Question: How many of the accounts are from Jesenik district?
SQL: SELECT count(account.account_id) FROM district INNER JOIN account ON district.district_id = account.district_id WHERE district.a2 = 'Jesenik'
Database: financial
Note: After 1996 means date >= '1997-01-01;
Question: List all the clients' IDs whose junior credit cards were issued after 1996.
SQL: SELECT disp.client_id FROM card INNER JOIN disp ON card.disp_id = disp.disp_id WHERE card.type = 'junior' AND card.issued >= '1997-01-01'
Database: financial
Note: Female refers to gender = 'F'; Woman and female are closed; Average salary can be found in a11;
Question: What percentage of clients who opened their accounts in the district with an average salary of over 10000 are women?
SQL: SELECT cast(sum(client.gender = 'F') AS REAL) * 100 / count(client.client_id) FROM district INNER JOIN client ON district.district_id = client.district_id WHERE district.a11 > 10000
Database: financial
Note: Growth rate = (sum of amount_1997 - sum of amount_1996) / (sum of amount_1996) * 100%; Male refers to gender = 'M';
Question: What was the growth rate of the total amount of loans across all accounts for a male client between 1996 and 1997?
SQL: SELECT cast((sum(CASE WHEN strftime('%Y', loan.date) = '1997' THEN loan.amount ELSE 0 END) - sum(CASE WHEN strftime('%Y', loan.date) = '1996' THEN loan.amount ELSE 0 END)) AS REAL) * 100 / sum(CASE WHEN strftime('%Y', loan.date) = '1996' THEN loan.amount ELSE 0 END) FROM loan INNER JOIN account ON loan.account_id = account.account_id INNER JOIN disp ON disp.account_id = account.account_id INNER JOIN client ON client.client_id = disp.client_id WHERE client.gender = 'M' AND disp.type = 'OWNER'
Database: financial
Note: operation = 'VYBER KARTOU' means credit card withdrawals;
Question: How many credit card withdrawals were recorded after 1995?
SQL: SELECT count(account_id) FROM trans WHERE strftime('%Y', date) > '1995' AND OPERATION = 'VYBER KARTOU'
Database: financial
Note: Difference in no. of committed crimes between 2 regions = Total no. of committed crimes in 1996 in north Bohemia - Total no. of committed crimes in 1996 in e ast Bohemia. a3 refers to region. Data about no. of committed crimes 1996 appears in a16;
Question: What was the difference in the number of crimes committed in East and North Bohemia in 1996?
SQL: SELECT sum(iif(a3 = 'east Bohemia', a16, 0)) - sum(iif(a3 = 'north Bohemia', a16, 0)) FROM district
Database: financial
Question: How many owner and disponent dispositions are there from account number 1 to account number 10?
SQL: SELECT sum(TYPE = 'OWNER') , sum(TYPE = 'DISPONENT') FROM disp WHERE account_id BETWEEN 1 AND 10
Database: financial
Note: k_symbol refers to the purpose of payments;
Question: How often does account number 3 request an account statement to be released? What was the aim of debiting 3539 in total?
SQL: SELECT account.frequency, t2.k_symbol FROM account INNER JOIN (SELECT account_id, k_symbol, sum(amount) AS total_amount FROM `order` GROUP BY account_id, k_symbol) AS t2 ON account.account_id = t2.account_id WHERE account.account_id = 3 AND t2.total_amount = 3539
Database: financial
Question: What year was account owner number 130 born?
SQL: SELECT strftime('%Y', client.birth_date) FROM client INNER JOIN disp ON client.client_id = disp.client_id INNER JOIN account ON disp.account_id = account.account_id WHERE account.account_id = 130
Database: financial
Note: frequency = 'POPLATEK PO OBRATU' stands for issuance after transaction;
Question: How many accounts have an owner disposition and request for a statement to be generated upon a transaction?
SQL: SELECT count(account.account_id) FROM account INNER JOIN disp ON account.account_id = disp.account_id WHERE disp.type = 'OWNER' AND account.frequency = 'POPLATEK PO OBRATU'
Database: financial
Question: What is the amount of debt that client number 992 has, and how is this client doing with payments?
SQL: SELECT loan.amount, loan.status FROM client INNER JOIN disp ON client.client_id = disp.client_id INNER JOIN account ON disp.account_id = account.account_id INNER JOIN loan ON account.account_id = loan.account_id WHERE client.client_id = 992
Database: financial
Question: What is the sum that client number 4's account has following transaction 851? Who owns this account, a man or a woman?
SQL: SELECT trans.balance, client.gender FROM client INNER JOIN disp ON client.client_id = disp.client_id INNER JOIN account ON disp.account_id =account.account_id INNER JOIN trans ON account.account_id = trans.account_id WHERE client.client_id = 4 AND trans.trans_id = 851
Database: financial
Question: Which kind of credit card does client number 9 possess?
SQL: SELECT card.type FROM client INNER JOIN disp ON client.client_id = disp.client_id INNER JOIN card ON disp.disp_id = card.disp_id WHERE client.client_id = 9
Database: financial
Question: How much, in total, did client number 617 pay for all of the transactions in 1998?
SQL: SELECT sum(trans.amount) FROM client INNER JOIN disp ON client.client_id = disp.client_id INNER JOIN account ON disp.account_id = account.account_id INNER JOIN trans ON account.account_id = trans.account_id WHERE strftime('%Y', trans.date)= '1998' AND client.client_id = 617
Database: financial
Question: Please provide a list of clients who were born between 1983 and 1987 and whose account branch is in East Bohemia, along with their IDs.
SQL: SELECT client.client_id, account.account_id FROM client INNER JOIN district ON client.district_id = district.district_id INNER JOIN disp ON client.client_id = disp.client_id INNER JOIN account ON district.district_id = account.district_id AND disp.account_id = account.account_id WHERE district.a3 = 'east Bohemia' AND strftime('%Y', client.birth_date) BETWEEN '1983' AND '1987'
Database: financial
Note: Female refers to gender = 'F';
Question: Please provide the IDs of the 3 female clients with the largest loans.
SQL: SELECT client.client_id FROM client INNER JOIN disp ON client.client_id= disp.client_id INNER JOIN account ON disp.account_id = account.account_id  INNER JOIN loan ON account.account_id = loan.account_id AND disp.account_id = loan.account_id WHERE client.gender = 'F' ORDER BY loan.amount DESC LIMIT 3
Database: financial
Note: Man and male refers to gender = 'M'; 'SIPO' stands for household payment;
Question: How many male customers who were born between 1974 and 1976 have made a payment on their home in excess of $4000?
SQL: SELECT count(trans.account_id) FROM trans INNER JOIN account ON trans.account_id = account.account_id INNER JOIN disp ON account.account_id = disp.account_id INNER JOIN client ON disp.client_id = client.client_id WHERE strftime('%Y', client.birth_date) BETWEEN '1974' AND '1976' AND client.gender = 'M' AND trans.amount > 4000 AND trans.k_symbol = 'SIPO'
Database: financial
Question: How many accounts in Beroun were opened after 1996?
SQL: SELECT count(account_id) FROM account INNER JOIN district ON account.district_id = district.district_id WHERE strftime('%Y', account.date) > '1996' AND district.a2 = 'Beroun'