question_id int64 0 1.53k | db_id stringclasses 11
values | question stringlengths 23 477 | evidence stringlengths 0 482 | SQL stringlengths 29 3.69k | difficulty stringclasses 3
values |
|---|---|---|---|---|---|
100 | financial | What is the average age at account opening, total number with loans, number with successfully completed loans, and number currently in debt for female clients born before 1950 from Sokolov who own accounts? Also, what are the earliest and latest years these accounts were opened? | Female refers to gender = 'F'; Sokolov is a district name in column A2; loan status 'A' means contract finished with no problems, 'D' means running contract with client in debt; only account owners are considered | WITH female_clients_from_sokolov AS (
SELECT
c.client_id,
c.birth_date,
STRFTIME('%Y', c.birth_date) AS birth_year,
d.A2 AS district_name
FROM
client c
INNER JOIN
district d ON c.district_id = d.district_id
WHERE
c.gender = 'F'
AND STR... | challenging |
101 | financial | List out the accounts who have the earliest trading date in 1995 ? | SELECT DISTINCT account_id
FROM trans
WHERE STRFTIME('%Y', date) = '1995'
AND date = (SELECT MIN(date) FROM trans WHERE STRFTIME('%Y', date) = '1995')
ORDER BY account_id ASC; | simple | |
102 | financial | State different accounts who have account opening date before 1997 and own an amount of money greater than 3000USD | SELECT DISTINCT T2.account_id FROM trans AS T1 INNER JOIN account AS T2 ON T1.account_id = T2.account_id WHERE STRFTIME('%Y', T2.date) < '1997' AND T1.amount > 3000 | simple | |
103 | financial | For all clients who received their credit card on March 3rd, 1994, provide a comprehensive profile including their personal information, banking activity, loan history, and district characteristics. Categorize them as borrowers based on their age and loan status, and rank them by age within their gender group. | Active loans refers to status = 'A'. Young borrower means age at card issue is less than 30 years old with at least one loan. Mature borrower means age at card issue is 30 or older with at least one loan. | WITH ClientCardInfo AS (
SELECT
c.client_id,
c.gender,
c.birth_date,
cd.issued,
cd.type AS card_type,
STRFTIME('%Y', c.birth_date) AS birth_year,
STRFTIME('%Y', cd.issued) - STRFTIME('%Y', c.birth_date) AS age_at_card_issue
FROM client c
JOIN disp d O... | challenging |
104 | financial | For the transaction of 840 on October 14, 1998, provide detailed information about the account including when it was opened, how long it had been open, the account owner's gender and age at the time, the total number of transactions up to that date, how many cards were issued, and whether the account had a loan before ... | Transaction date is 1998-10-14 and transaction amount is 840. Account owner refers to disposition type = 'OWNER'. | WITH TransactionDetails AS (
SELECT
t.account_id,
t.amount,
t.date AS transaction_date,
t.type,
t.operation,
t.balance,
t.k_symbol,
a.date AS account_opening_date,
a.frequency,
d.district_id,
d.A2 AS district_name,
d.A3... | challenging |
105 | financial | For the loan approved on August 25, 1994, provide a comprehensive profile including: the district information (name, region, average salary rank, unemployment rank), how long the account was open before the loan, the demographics of clients in that district (total count, gender breakdown, average age), and the account'... | Income transactions refer to type = 'PRIJEM'. Average age is calculated as of the loan date 1994-08-25. | WITH LoanAccounts AS (
SELECT
T2.account_id,
T2.date AS loan_date,
T1.district_id,
T1.date AS account_open_date,
JULIANDAY(T2.date) - JULIANDAY(T1.date) AS days_since_account_opened
FROM
account AS T1
INNER JOIN
loan AS T2 ON T1.account_id = T2.acc... | challenging |
106 | financial | For the client who received a credit card on October 21, 1996, what are the complete details of their largest transaction, including their personal information, district details, and any associated loans or orders? | Card issued date refers to issued = '1996-10-21'; largest transaction refers to MAX(amount) | WITH TransactionStats AS (
SELECT
T4.account_id,
T4.trans_id,
T4.amount,
T4.type,
T4.date,
T4.balance,
RANK() OVER (PARTITION BY T4.account_id ORDER BY T4.amount DESC) as amount_rank
FROM trans AS T4
),
ClientCards AS (
SELECT
T2.client_id,
... | challenging |
107 | financial | What is the gender of the oldest client who opened his/her account in the highest average salary branch? | Earlier birthdate refers to older age; A11 refers to average salary | SELECT T2.gender FROM district AS T1 INNER JOIN client AS T2 ON T1.district_id = T2.district_id ORDER BY T1.A11 DESC, T2.birth_date ASC LIMIT 1 | simple |
108 | financial | For the client who applied the biggest loan, what was his/her first amount of transaction after opened the account? | WITH max_loan_account AS (
SELECT l.account_id, a.date AS account_open_date
FROM loan l
JOIN account a ON l.account_id = a.account_id
ORDER BY l.amount DESC
LIMIT 1
)
SELECT t.amount
FROM trans t
JOIN max_loan_account m ON t.account_id = m.account_id
WHERE t.date >= m.account_open_date
ORDER BY t.da... | simple | |
109 | financial | How many clients opened their accounts in Jesenik branch were women? | A2 has region names; Woman and female share the same meaning; female refers to gender = 'F' | SELECT COUNT(DISTINCT 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 district ON account.district_id = district.district_id
WHERE client.gender = 'F' AND district.A2 = 'Jesenik' AND disp.type = 'OWNER' | simple |
110 | financial | What is the disposition id of the client who made 5100 USD transaction in 1998/9/2? | SELECT T1.disp_id FROM disp AS T1 INNER JOIN account AS T2 ON T1.account_id = T2.account_id INNER JOIN trans AS T3 ON T2.account_id = T3.account_id WHERE T3.date='1998-09-02' AND T3.amount = 5100 | simple | |
111 | financial | What are the comprehensive statistics for accounts opened in Litomerice in 1996, including client demographics, transaction activity, loan information, and quarterly distribution of account openings? | Litomerice is a district name; PRIJEM refers to deposits/credits, VYDAJ refers to withdrawals/debits; loan status 'A' indicates good loans, 'B' indicates bad loans | WITH AccountsInLitomerice1996 AS (
SELECT
T2.account_id,
T2.date,
T1.A2 AS district_name,
STRFTIME('%m', T2.date) AS month_opened
FROM
district AS T1
INNER JOIN
account AS T2 ON T1.district_id = T2.district_id
WHERE
STRFTIME('%Y', T2.date) = ... | challenging |
112 | financial | For the female client born on January 29, 1976, provide a comprehensive analysis of all her owned accounts including their locations, transaction activity, financial products, and regional economic indicators. | PRIJEM refers to incoming transactions (credits), VYDAJ refers to outgoing transactions (debits). Account district refers to the district where the account was opened, which may differ from the client's residence district. | WITH female_client AS (
SELECT
c.client_id,
c.birth_date,
c.district_id,
d.A2 AS district_name
FROM client c
JOIN district d ON c.district_id = d.district_id
WHERE c.birth_date = '1976-01-29' AND c.gender = 'F'
),
client_accounts AS (
SELECT
fc.client_id,
... | challenging |
113 | financial | For the client who applied for a 98832 USD loan on January 3rd, 1996, provide a comprehensive profile including their birthday, age at the time of loan application, location, transaction history before the loan, expense-to-income ratio, balance range, credit card information, and number of previous loans. | PRIJEM refers to incoming transactions (credits), VYDAJ refers to outgoing transactions (debits). Expense to income ratio is calculated as (total expenses / total income) * 100. | WITH LoanClient AS (
SELECT
T1.loan_id,
T1.account_id,
T1.date AS loan_date,
T1.amount,
T1.duration,
T1.payments,
T1.status,
T4.client_id,
T4.birth_date,
T4.gender,
T4.district_id AS client_district_id,
T2.district_id A... | challenging |
114 | financial | For the first client who opened his/her account in Prague, what is his/her account ID? | A3 stands for region names | SELECT T1.account_id
FROM account AS T1
INNER JOIN district AS T2 ON T1.district_id = T2.district_id
WHERE T2.A3 = 'Prague'
ORDER BY T1.date ASC
LIMIT 1; | simple |
115 | financial | What is the district name, number of inhabitants, total number of clients, number of male clients, and percentage of male clients for the most populated district in the south Bohemia region? | Percentage of male clients = (number of male clients / total number of clients) * 100. Male refers to gender = 'M'. A3 is the region name, A2 is the district name, and A4 contains the number of inhabitants. | WITH RegionStats AS (
SELECT
d.district_id,
d.A3 AS region,
CAST(d.A4 AS INTEGER) AS inhabitants,
COUNT(DISTINCT c.client_id) AS total_clients,
SUM(CASE WHEN c.gender = 'M' THEN 1 ELSE 0 END) AS male_clients,
RANK() OVER (PARTITION BY d.A3 ORDER BY CAST(d.A4 AS INTEG... | challenging |
116 | financial | For the client whose loan was approved first in 1993/7/5, what is the increase rate of his/her account balance from 1993/3/22 to 1998/12/27? | Increase rate of his/her account balance = [(balance of date A - balance of date B) / balance of Date B] * 100% | SELECT CAST((SUM(IIF(T3.date = '1998-12-27', T3.balance, 0)) - SUM(IIF(T3.date = '1993-03-22', T3.balance, 0))) AS REAL) * 100 / SUM(IIF(T3.date = '1993-03-22', T3.balance, 0)) FROM loan AS T1 INNER JOIN account AS T2 ON T1.account_id = T2.account_id INNER JOIN trans AS T3 ON T3.account_id = T2.account_id WHERE T1.date... | challenging |
117 | financial | For each region, what percentage of the total loan amount has been fully paid without issues, and what percentage of loans were successfully completed? Also include the average interest paid on successful loans compared to all loans. | Loan paid with no issue refers to status = 'A'; Interest paid = (monthly payments * duration) - loan amount; Percentage = (amount with status 'A' / total amount) * 100% | WITH LoansByDistrict AS (
SELECT
d.A2 AS district_name,
d.A3 AS region,
l.status,
l.amount,
l.duration,
l.payments,
a.frequency,
strftime('%Y', l.date) AS loan_year,
CASE
WHEN c.gender = 'M' THEN 'Male'
WHEN c.gender =... | challenging |
118 | financial | For loans under $100,000, what is the percentage of loans running with no issues in each region and loan size category, and how does each region's performance compare to the overall average? | Status = 'C' means running contract with no issues; Small loans are under $50,000, Medium loans are $50,000-$99,999; Percentage is calculated by dividing loans with status 'C' by total loans and multiplying by 100 | WITH LoanStatusByRegion AS (
SELECT
d.A3 AS region,
l.status,
l.amount,
l.duration,
CASE
WHEN l.status = 'C' THEN 1
ELSE 0
END AS is_running_ok,
CASE
WHEN l.amount < 50000 THEN 'Small'
WHEN l.amount < 100000 T... | challenging |
119 | financial | For accounts opened in 1993 with statements issued after transactions, provide a comprehensive analysis including district information, transaction activity, client demographics, loan details, and risk assessment. | 'POPLATEK PO OBRATU' means statement issued after transaction. District names are in A2, regions in A3, and A10 represents the ratio of urban inhabitants. Transaction types: 'PRIJEM' = income, 'VYDAJ' = expense. Loan status: 'A' = running contract, 'B' = finished contract, 'C' = defaulted loan. | WITH AccountsIn1993 AS (
SELECT
T1.account_id,
T1.district_id,
T1.date AS account_open_date
FROM account AS T1
WHERE T1.frequency = 'POPLATEK PO OBRATU'
AND STRFTIME('%Y', T1.date) = '1993'
),
AccountStats AS (
SELECT
a.account_id,
COUNT(DISTINCT t.trans_... | challenging |
120 | financial | From Year 1995 to 2000, who are the accounts holders from 'east Bohemia'. State the account ID the frequency of statement issuance. | Accounts holder refers to the person who own this account. | SELECT T1.account_id, T1.frequency FROM account AS T1 INNER JOIN district AS T2 ON T1.district_id = T2.district_id WHERE T2.A3 = 'east Bohemia' AND STRFTIME('%Y', T1.date) BETWEEN '1995' AND '2000' | moderate |
121 | financial | For accounts opened in Prachatice district, provide a comprehensive financial profile including account details, owner demographics, transaction statistics, loan information, customer categorization, and rank them by net balance from highest to lowest. | A2 refers to district names. PRIJEM refers to incoming transactions (credits), VYDAJ refers to outgoing transactions (debits). Net balance is calculated as total income minus total expense. Customer category is determined by loan count and transaction activity: High Activity (has loans and >10 transactions), Loan Custo... | WITH AccountsInPrachatice AS (
SELECT a.account_id, a.date, a.district_id
FROM account AS a
INNER JOIN district AS d ON a.district_id = d.district_id
WHERE d.A2 = 'Prachatice'
),
ClientsWithPrachaticeAccounts AS (
SELECT c.client_id, c.gender, c.birth_date, d.disp_id, d.account_id
FROM client AS... | challenging |
122 | financial | For loan ID 4990, provide a comprehensive profile including the borrower's demographics, loan details with status description, district economic indicators, and how this loan ranks among other loans in the same district. | Status descriptions: A = Running - OK, B = Running - Issues, C = Finished - No Issues, D = Finished - Issues. Problematic loans are those with status B or D. District information includes A2 for district name, A3 for region, A11 for average salary, and A12 for unemployment rate in 1995. | WITH LoanStats AS (
SELECT
l.loan_id,
l.account_id,
l.amount,
l.duration,
l.status,
CASE
WHEN l.status = 'A' THEN 'Running - OK'
WHEN l.status = 'B' THEN 'Running - Issues'
WHEN l.status = 'C' THEN 'Finished - No Issues'
WHEN l.status = 'D' THEN 'Finished - Issues'
... | challenging |
123 | financial | For accounts with loans exceeding $300,000 in districts where the average salary is above the national average, show me the account details including district, region, loan statistics, account owner demographics, income classification, transaction activity, savings ratio, and how they rank within their region by maximu... | Average salary refers to A11 in the district table. Income categories are classified as High Income (total income > 1,000,000), Medium Income (total income > 500,000), or Low Income (otherwise). PRIJEM represents incoming transactions and VYDAJ represents outgoing transactions. Savings ratio is calculated as (total inc... | WITH LoanStatistics AS (
SELECT
account_id,
AVG(amount) AS avg_loan_amount,
MAX(amount) AS max_loan_amount,
COUNT(*) AS loan_count
FROM loan
GROUP BY account_id
HAVING MAX(amount) > 300000
),
ClientDetails AS (
SELECT
c.client_id,
c.gender,
C... | challenging |
124 | financial | For 60-month loans, show me the top 3 largest loans in each district, including the district's average salary, loan details, client demographics, transaction history, and calculated interest rate. Order the results by highest average salary and loan amount. | A2 refers to district name; A11 refers to average salary; loan status: A = Finished - OK, B = Finished - Default, C = Running - OK, D = Running - Default; interest rate is calculated as (total payments - loan amount) / loan amount * 100 | WITH LoanStatistics AS (
SELECT
T3.loan_id,
T2.A2 AS district_name,
T2.A11 AS avg_salary,
T3.amount,
T3.duration,
T3.payments,
T3.status,
T3.account_id,
ROW_NUMBER() OVER (PARTITION BY T2.A2 ORDER BY T3.amount DESC) AS district_loan_rank
FROM account AS T1
INNER JOIN district... | challenging |
125 | financial | For loan contracts which are still running where clients are in debt, list the district and state the percentage unemployment rate increment from 1995 to 1996. | Unemployment increment rate in percentage = [(unemployment rate 1996 - unemployment rate 1995) / unemployment rate 2015] * 100; unemployment rate 1995 appears in the A12; unemployment rate 1996 appears in the A13; Loan contracts which are still running where client are in debt can be presented as status = 'D' | SELECT DISTINCT T3.A2 AS district_name, CAST((T3.A13 - T3.A12) AS REAL) * 100 / NULLIF(T3.A12,0) AS unemployment_increment FROM loan AS T1 INNER JOIN account AS T2 ON T1.account_id = T2.account_id INNER JOIN district AS T3 ON T2.district_id = T3.district_id WHERE T1.status = 'D' ORDER BY district_name ASC | challenging |
126 | financial | For accounts opened in 1993, provide a monthly breakdown showing the percentage of accounts from Decin district, average transaction statistics, and indicate whether each month's Decin percentage is above, below, or equal to the overall yearly average. | A2 refers to district name. PRIJEM refers to income transactions and VYDAJ refers to expense transactions. | WITH AccountsOpenedIn1993 AS (
SELECT
a.account_id,
a.district_id,
d.A2 AS district_name,
STRFTIME('%m', a.date) AS opening_month
FROM
account a
JOIN
district d ON a.district_id = d.district_id
WHERE
STRFTIME('%Y', a.date) = '1993'
),
AccountsW... | challenging |
127 | financial | For accounts with monthly statement issuance, provide a comprehensive financial profile including client demographics, transaction activity, loan details, and rankings by transaction volume and cash flow performance. | Monthly statement issuance refers to frequency = 'POPLATEK MESICNE'. Net cash flow is calculated as total income minus total expense. Active loans have status 'A' and completed loans have status 'B'. | WITH MonthlyAccounts AS (
SELECT
account_id,
district_id,
date AS account_open_date
FROM
account
WHERE
frequency = 'POPLATEK MESICNE'
),
AccountTransactions AS (
SELECT
ma.account_id,
COUNT(t.trans_id) AS transaction_count,
SUM(CASE WHEN t.type = 'PRIJEM' THEN t.amount ELS... | challenging |
128 | financial | List the top nine districts, by descending order, from the highest to the lowest, the number of female account holders. | A2 refers to districts; Female refers to gender = 'F' | SELECT T2.A2, COUNT(T1.client_id) FROM client AS T1 INNER JOIN district AS T2 ON T1.district_id = T2.district_id WHERE T1.gender = 'F' GROUP BY T2.district_id, T2.A2 ORDER BY COUNT(T1.client_id) DESC LIMIT 9 | moderate |
129 | financial | Which are the top ten withdrawals (non-credit card) by district names for the month of January 1996? | 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 | SELECT
T1.A2 AS district_name,
SUM(T3.amount) AS total_non_credit_withdrawals
FROM district AS T1
INNER JOIN account AS T2 ON T1.district_id = T2.district_id
INNER JOIN trans AS T3 ON T2.account_id = T3.account_id
WHERE
T3.type = 'VYDAJ'
AND T3.date LIKE '1996-01%'
GROUP BY T1.A2
ORDER BY tota... | moderate |
130 | financial | How many of the account holders in South Bohemia still do not own credit cards? | A3 contains the region names; South Bohemia is one of region names. | SELECT COUNT(T3.account_id) FROM district AS T1 INNER JOIN client AS T2 ON T1.district_id = T2.district_id INNER JOIN disp AS T3 ON T2.client_id = T3.client_id WHERE T1.A3 = 'south Bohemia' AND T3.type != 'OWNER' | moderate |
131 | financial | Which district has highest active loan? | 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 | SELECT T2.A3 FROM account AS T1 INNER JOIN district AS T2 ON T1.district_id = T2.district_id INNER JOIN loan AS T3 ON T1.account_id = T3.account_id WHERE T3.status IN ('C', 'D') GROUP BY T2.A3 ORDER BY SUM(T3.amount) DESC LIMIT 1 | moderate |
132 | financial | What is the average loan amount by male borrowers? | Male refers to gender = 'M' | SELECT AVG(T4.amount) FROM client AS T1 INNER JOIN disp AS T2 ON T1.client_id = T2.client_id INNER JOIN account AS T3 ON T2.account_id = T3.account_id INNER JOIN loan AS T4 ON T3.account_id = T4.account_id WHERE T1.gender = 'M' | simple |
133 | financial | In 1996, which districts have the highest unemployment rate? List their branch location and district name. | A2 refers to district names; A13 refers to unemploymant rate in 1996 | SELECT district_id, A2 FROM district WHERE A13 = (SELECT A13 FROM district ORDER BY A13 DESC LIMIT 1) | simple |
134 | financial | For the district with the highest number of crimes in 1996, provide details including the district name, region, population, number of crimes, percentage increase in crimes from 1995 to 1996, and how many accounts were opened there. | A16 refers to the number of committed crimes in 1996; A15 refers to the number of committed crimes in 1995 | WITH CrimeStats AS (
SELECT
district_id,
A16 AS crimes_1996,
RANK() OVER (ORDER BY A16 DESC) AS crime_rank
FROM district
),
AccountsByDistrict AS (
SELECT
a.district_id,
COUNT(a.account_id) AS account_count,
AVG(JULIANDAY('1996-12-31') - JULIANDAY(a.date))/3... | challenging |
135 | financial | For accounts with monthly issuance that went into negative balance after a credit card withdrawal, what are the statistics including average negative balance, maximum withdrawal amount, average number of cards per account, total gold cards, average owner age, and gender distribution of account owners? | Negative balance means balance < 0; credit card withdrawal refers to operation = 'VYBER KARTOU'; monthly issuance refers to frequency = 'POPLATEK MESICNE'; owner age is calculated as of January 1, 2000 | WITH AccountWithNegativeBalance AS (
SELECT
t.account_id,
t.date AS transaction_date,
t.balance,
t.operation,
t.amount,
a.frequency,
ROW_NUMBER() OVER (PARTITION BY t.account_id ORDER BY t.date DESC) AS rn
FROM
trans t
INNER JOIN
acc... | challenging |
136 | financial | 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? | Frequency = 'POPLATEK MESICNE' stands for monthly issurance | SELECT COUNT(T1.account_id)
FROM account AS T1
INNER JOIN loan AS T2 ON T1.account_id = T2.account_id
WHERE T2.date BETWEEN '1995-01-01' AND '1997-12-31'
AND T1.frequency = 'POPLATEK MESICNE'
AND T2.amount >= 250000; | moderate |
137 | financial | What are the demographics and financial statistics of account owners with running loan contracts in district 1, including their average remaining debt, gender distribution, age, card ownership, transaction activity, and account balances? | Running loan contracts include status 'C' (running contract, OK so far) and status 'D' (running contract, client in debt). Remaining debt is calculated as loan amount minus total payments made (payments * duration). | WITH AccountsWithRunningLoans AS (
SELECT
a.account_id,
a.district_id,
l.status,
l.amount,
l.duration,
l.payments,
(l.amount - (l.payments * l.duration)) AS remaining_debt
FROM account AS a
INNER JOIN loan AS l ON a.account_id = l.account_id
WHERE... | challenging |
138 | financial | For the district with the second-highest number of crimes committed in 1995, provide a comprehensive breakdown of all male clients including their total count, the crime count for that year, total accounts, loans, credit cards, average dispositions per client, number of clients with loans, and age distribution across y... | Male refers to gender = 'M'; A15 refers to number of committed crimes in 1995; Age is calculated from birth_date to current date | WITH CrimeRanking AS (
SELECT
district_id,
A15,
RANK() OVER (ORDER BY A15 DESC) as crime_rank
FROM district
),
SecondHighestCrimeDistrict AS (
SELECT district_id, A15
FROM CrimeRanking
WHERE crime_rank = 2
),
ClientStats AS (
SELECT
c.client_id,
c.gender... | challenging |
139 | financial | What is the demographic and financial profile of gold credit card owners with account balances averaging over 1,000, broken down by gender? | Gold credit card owners refer to cards with type = 'gold' and disposition type = 'OWNER'. High balance accounts refer to accounts where avg_balance > 1000. | WITH gold_owner_cards AS (
SELECT
c.card_id,
c.disp_id,
c.type AS card_type,
c.issued,
d.account_id,
d.client_id,
d.type AS disp_type
FROM card AS c
INNER JOIN disp AS d ON c.disp_id = d.disp_id
WHERE c.type = 'gold' AND d.type = 'OWNER'
),
client... | challenging |
140 | financial | What is the comprehensive financial profile of all accounts in the Pisek district, including the total number of accounts, average transactions per account, total deposits and withdrawals, average maximum balance, total credit cards issued, total loans issued, percentage of active loan amounts, and number of unique acc... | Active loans refer to status = 'A'; PRIJEM refers to deposits; VYDAJ refers to withdrawals; account owners refer to disposition type = 'OWNER' | WITH PisekAccounts AS (
SELECT
a.account_id,
a.district_id,
a.frequency,
a.date,
d.A2 AS district_name
FROM account AS a
INNER JOIN district AS d ON a.district_id = d.district_id
WHERE d.A2 = 'Pisek'
),
AccountStats AS (
SELECT
pa.account_id,
... | challenging |
141 | financial | Which districts have transactions greater than USD$10,000 in 1997? | SELECT district_id
FROM account AS T1
INNER JOIN trans AS T3 ON T1.account_id = T3.account_id
WHERE STRFTIME('%Y', T3.date) = '1997'
GROUP BY district_id
HAVING SUM(T3.amount) > 10000 | simple | |
142 | financial | Which accounts placed orders for household payment in Pisek? | k_symbol = 'SIPO' refers to household payment | SELECT DISTINCT T2.account_id FROM trans AS T1 INNER JOIN account AS T2 ON T1.account_id = T2.account_id INNER JOIN district AS T3 ON T2.district_id = T3.district_id WHERE T1.k_symbol = 'SIPO' AND T3.A2 = 'Pisek' | simple |
143 | financial | For each account with gold credit cards, provide a comprehensive financial profile including the number of gold cards, location details, transaction history, balance statistics, loan information, and rank the accounts by their average balance. | Transaction income refers to type = 'PRIJEM'; transaction expense refers to type = 'VYDAJ'; good loans refers to status = 'A'; bad loans refers to status = 'B'. | WITH GoldCardAccounts AS (
SELECT
T2.account_id,
COUNT(T1.card_id) AS gold_card_count
FROM disp AS T2
INNER JOIN card AS T1 ON T1.disp_id = T2.disp_id
WHERE T1.type = 'gold'
GROUP BY T2.account_id
),
AccountDetails AS (
SELECT
a.account_id,
a.district_id,
... | challenging |
144 | financial | What is the breakdown of credit card transaction patterns in 1998 by region, district, gender, and card type, including average transaction amounts, total spending, and how these amounts compare to district average salaries? | Credit card transactions refer to operation = 'VYBER KARTOU'. Only account owners with credit cards are considered. | WITH CardHolders AS (
SELECT
c.client_id,
c.gender,
d.disp_id,
d.account_id,
a.district_id,
cd.type AS card_type,
cd.issued AS card_issue_date
FROM client c
JOIN disp d ON c.client_id = d.client_id
JOIN card cd ON d.disp_id = cd.disp_id
JOIN a... | challenging |
145 | financial | 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? | Operation = 'VYBER KARTOU' refers to credit card withdrawal | SELECT DISTINCT T1.account_id FROM trans AS T1 INNER JOIN account AS T2 ON T1.account_id = T2.account_id WHERE STRFTIME('%Y', T1.date) = '1998' AND T1.operation = 'VYBER KARTOU' AND T1.amount < (SELECT AVG(amount) FROM trans WHERE STRFTIME('%Y', date) = '1998') | moderate |
146 | financial | What are the top 100 female account owners with credit cards and loans, ranked by their total loan amounts, showing their financial profile including card details, loan status, transaction statistics, savings rate, and regional loan ranking? | Female refers to gender = 'F'; OWNER refers to type = 'OWNER'; loan status 'A' means 'Good Standing' and 'B' means 'Default'; savings rate is calculated as (total income - total expense) / total income * 100%; only adult clients (age >= 18) are included | WITH AccountOwners AS (
SELECT
T1.client_id,
T1.gender,
T1.birth_date,
T2.account_id,
T2.disp_id,
T5.district_id,
T5.frequency
FROM client AS T1
INNER JOIN disp AS T2 ON T1.client_id = T2.client_id
INNER JOIN account AS T5 ON T2.account_id = T5.ac... | challenging |
147 | financial | What is the demographic and financial profile of female account owners in south Bohemia, broken down by district and age group, including their average transaction activity, net balance, loan amounts, and active loan rates? | Female refers to gender = 'F'; south Bohemia refers to region A3 = 'south Bohemia'; age categories are Young (born after 1980), Middle-aged (born 1960-1980), and Senior (born before 1960); net balance = total income - total expense; active loans refer to loan status = 'A' | WITH ClientAccounts AS (
SELECT
c.client_id,
c.gender,
a.account_id,
d.A3 AS region,
d.A2 AS district_name,
CASE
WHEN c.birth_date > '1980-01-01' THEN 'Young'
WHEN c.birth_date BETWEEN '1960-01-01' AND '1980-01-01' THEN 'Middle-aged'
... | challenging |
148 | financial | For account owners in the Tabor district, provide a comprehensive customer profile including their demographics, transaction history, loan history, credit status, and customer priority ranking based on average balance. | District refers to A2; account owners are those with type = 'OWNER'; credit status is determined by loan repayment history where status 'A' indicates good loans and 'B' indicates bad loans; customer priority is based on age and average balance thresholds. | WITH EligibleAccounts AS (
SELECT
T2.account_id,
T2.district_id,
T2.date AS account_open_date,
T1.A2 AS district_name,
T3.client_id
FROM district AS T1
INNER JOIN account AS T2 ON T1.district_id = T2.district_id
INNER JOIN disp AS T3 ON T2.account_id = T3.accou... | challenging |
149 | financial | 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. | A11 represents the average salary; Salary and income share the similar meanings; when the account type = 'OWNER', it's eligible for loans | SELECT DISTINCT T3.type FROM district AS T1 INNER JOIN account AS T2 ON T1.district_id = T2.district_id INNER JOIN disp AS T3 ON T2.account_id = T3.account_id WHERE T3.type != 'OWNER' AND T1.A11 BETWEEN 8000 AND 9000 | challenging |
150 | financial | How many accounts in North Bohemia has made a transaction with the partner's bank being AB? | A3 contains the region names; North Bohemia is a region. | SELECT COUNT(T2.account_id) FROM district AS T1 INNER JOIN account AS T2 ON T1.district_id = T2.district_id INNER JOIN trans AS T3 ON T2.account_id = T3.account_id WHERE T3.bank = 'AB' AND T1.A3 = 'north Bohemia' | moderate |
151 | financial | For each district with withdrawal transactions, provide a comprehensive analysis including the total number and amount of withdrawals, demographic information, withdrawal per capita, and rank the districts by total withdrawal amount. Also categorize each district by unemployment level. | Withdrawal transactions refer to type = 'VYDAJ'. District name refers to A2. Unemployment category is based on 1995 unemployment rate: High (>2.0), Medium (1.0-2.0), Low (<1.0). | WITH district_withdrawal_counts AS (
SELECT
T1.district_id,
T1.A2 AS district_name,
COUNT(DISTINCT T3.trans_id) AS withdrawal_count,
SUM(T3.amount) AS total_withdrawal_amount,
AVG(T3.amount) AS avg_withdrawal_amount
FROM district AS T1
INNER JOIN account AS T2 ON T1... | challenging |
152 | financial | 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? | A15 stands for the average number of crimes committed in 1995. | SELECT AVG(sub.A15) AS avg_crimes_1995
FROM (
SELECT DISTINCT
T1.district_id,
T1.A15
FROM district AS T1
INNER JOIN account AS T2 ON T1.district_id = T2.district_id
WHERE STRFTIME('%Y', T2.date) >= '1997'
AND T1.A15 > 4000
) AS sub; | moderate |
153 | financial | For each district, how many classic credit card holders who are account owners are there, and what are their average loan amounts, account balances, loan performance, district salary, and unemployment rate? | Account owners refer to disp.type = 'OWNER'. Good loans refer to status = 'A' and bad loans refer to status = 'B'. Account balance is calculated as total income minus total expense. | WITH loan_stats AS (
SELECT
l.account_id,
COUNT(l.loan_id) AS loan_count,
AVG(l.amount) AS avg_loan_amount,
SUM(CASE WHEN l.status = 'A' THEN 1 ELSE 0 END) AS good_loans,
SUM(CASE WHEN l.status = 'B' THEN 1 ELSE 0 END) AS bad_loans
FROM loan l
GROUP BY l.account_id
)... | challenging |
154 | financial | What is the financial profile and banking behavior of male clients in Prague district, broken down by age groups (Young, Middle-aged, and Senior)? | Young clients are under 30 years old, Middle-aged clients are between 30 and 50 years old, and Senior clients are over 50 years old. Status 'A' indicates good loans and status 'B' indicates bad loans. PRIJEM represents income transactions and VYDAJ represents expense transactions. | WITH PrahaClients AS (
SELECT
c.client_id,
c.gender,
c.birth_date,
d.A2 AS district_name,
CASE
WHEN strftime('%Y', 'now') - strftime('%Y', c.birth_date) - (strftime('%m-%d', 'now') < strftime('%m-%d', c.birth_date)) < 30 THEN 'Young'
WHEN strftime('%... | challenging |
155 | financial | What percentage of gold credit cards were issued before 1998, both overall and broken down by region? | Percentage of gold cards issued before 1998 = count(gold cards issued before 1998) / count(all gold cards) * 100. Region refers to A3 in district table. | WITH GoldCardStats AS (
SELECT
c.card_id,
STRFTIME('%Y', c.issued) AS issue_year,
d.account_id,
CASE WHEN STRFTIME('%Y', c.issued) < '1998' THEN 1 ELSE 0 END AS is_pre_1998
FROM card c
JOIN disp d ON c.disp_id = d.disp_id
WHERE c.type = 'gold'
),
AccountDetails AS (
... | challenging |
156 | financial | What are the demographic, financial, and transaction details of the account owner who has the largest loan amount, including their age category, savings rate, and the economic status of their district? | Savings rate is calculated as (total income - total expense) / total income * 100. Age categories are: Young (under 30), Middle-aged (30-50), Senior (over 50). High unemployment area refers to districts with unemployment rate above 1.0%. | WITH LoanRanking AS (
SELECT
l.account_id,
l.amount,
l.loan_id,
RANK() OVER (ORDER BY l.amount DESC) as loan_rank
FROM loan l
),
AccountOwners AS (
SELECT
d.client_id,
d.account_id,
c.gender,
c.birth_date,
CAST(strftime('%Y', 'now') -... | challenging |
157 | financial | For account 532, what is the crime trend and ranking of its district, including the percentage change in crimes between 1995 and 1996, how many loans and transactions the account has, and how it compares to the average crime rate across all districts? | A15 refers to number of committed crimes in 1995; A16 refers to number of committed crimes in 1996; status = 'B' means bad loan | WITH CrimesByDistrict AS (
SELECT
d.district_id,
d.A2 AS district_name,
d.A15 AS crimes_1995,
d.A16 AS crimes_1996,
CASE
WHEN d.A16 > d.A15 THEN 'Increased'
WHEN d.A16 < d.A15 THEN 'Decreased'
ELSE 'Unchanged'
END AS crime_trend,
... | challenging |
158 | financial | For the account that placed order 33333, provide a comprehensive profile including the district's economic ranking by salary, account transaction history, ownership details, loan status, and order information. | PRIJEM refers to incoming transactions (credits), VYDAJ refers to outgoing transactions (debits). Loan status A, B, or C indicates active loans. | WITH OrderInfo AS (
SELECT
T1.order_id,
T1.account_id,
T1.amount AS order_amount,
T1.k_symbol AS order_purpose,
T2.district_id,
T2.date AS account_creation_date
FROM `order` AS T1
INNER JOIN account AS T2 ON T1.account_id = T2.account_id
WHERE T1.order_id... | challenging |
159 | financial | List all the withdrawals in cash transactions that the client with the id 3356 makes. | operation = 'VYBER' refers to withdrawal in cash | SELECT T4.trans_id FROM client AS T1 INNER JOIN disp AS T2 ON T1.client_id = T2.client_id INNER JOIN account AS T3 ON T2.account_id = T3.account_id INNER JOIN trans AS T4 ON T3.account_id = T4.account_id WHERE T1.client_id = 3356 AND T4.operation = 'VYBER' | simple |
160 | financial | Among the weekly issuance accounts, how many have a loan of under 200000? | frequency = 'POPLATEK TYDNE' stands for weekly issuance | SELECT COUNT(T1.account_id)
FROM loan AS T1
INNER JOIN account AS T2 ON T1.account_id = T2.account_id
WHERE T2.frequency = 'POPLATEK TYDNE' AND T1.amount < 200000; | simple |
161 | financial | What is the complete customer profile for client 13539, including their demographics, credit card details, district information with salary ranking, transaction activity, customer segment classification, and loan count? | Customer segment is classified as 'Premium' for gold card holders, 'Long-term Classic' for classic card holders with cards older than 5 years, and 'Standard' for all others. PRIJEM refers to income transactions and VYDAJ refers to expense transactions. | WITH client_account_info AS (
SELECT
d.client_id,
d.account_id,
d.disp_id,
c.gender,
c.birth_date,
CAST(strftime('%Y', 'now') AS INTEGER) - CAST(strftime('%Y', c.birth_date) AS INTEGER) AS client_age,
a.district_id,
a.frequency
FROM disp d
JOIN... | challenging |
162 | financial | For client 3541, what are the complete financial details of all their accounts including region, loan information, transaction statistics, net balance, and how many other clients are in the same region, ordered by account activity? | PRIJEM refers to incoming transactions; VYDAJ refers to outgoing transactions; net balance = total income - total expense; account activity is measured by transaction count | WITH ClientRegionInfo AS (
SELECT
c.client_id,
d.district_id,
d.A2 AS district_name,
d.A3 AS region,
d.A11 AS avg_salary,
d.A12 AS unemployment_rate_1995
FROM
client AS c
INNER JOIN
district AS d ON c.district_id = d.district_id
WHERE
... | challenging |
163 | financial | Which district has the most accounts with loan contracts finished with no problems? | status = 'A' refers to loan contracts finished with no problems | SELECT T1.A2
FROM District AS T1
INNER JOIN Account AS T2 ON T1.District_id = T2.District_id
INNER JOIN Loan AS T3 ON T2.Account_id = T3.Account_id
WHERE T3.status = 'A'
GROUP BY T1.District_id
ORDER BY COUNT(T2.Account_id) DESC
LIMIT 1; | moderate |
164 | financial | For order 32423, provide a comprehensive profile of the account owner including their demographics, order details, loan status, transaction history, and number of credit cards. | Account owner refers to disp.type = 'OWNER'; transaction history includes total income (type = 'PRIJEM'), total expense (type = 'VYDAJ'), and net balance. | WITH client_info AS (
SELECT
c.client_id,
c.gender,
CAST(strftime('%Y', 'now') - strftime('%Y', c.birth_date) AS INTEGER) AS age,
d.A2 AS district_name,
d.A3 AS region
FROM client c
JOIN district d ON c.district_id = d.district_id
),
order_details AS (
SELECT
o.order_id,
o.account_... | challenging |
165 | financial | Please list all the transactions made by accounts from district 5. | SELECT T3.trans_id FROM district AS T1 INNER JOIN account AS T2 ON T1.district_id = T2.district_id INNER JOIN trans AS T3 ON T2.account_id = T3.account_id WHERE T1.district_id = 5 | simple | |
166 | financial | What is the comprehensive banking activity profile for accounts in Jesenik district, including the total number of accounts, transaction patterns, loan statistics with their repayment status, average balances, and the gender distribution of clients? | Good loans refer to status = 'A'; bad loans refer to status = 'B'. PRIJEM represents incoming transactions and VYDAJ represents outgoing transactions. | WITH district_accounts AS (
SELECT
d.district_id,
d.A2 AS district_name,
a.account_id,
a.date AS account_creation_date,
COUNT(l.loan_id) AS loan_count,
SUM(CASE WHEN l.status = 'A' THEN 1 ELSE 0 END) AS good_loans,
SUM(CASE WHEN l.status = 'B' THEN 1 ELSE 0 END) AS bad_loans,
AVG(l.am... | challenging |
167 | financial | List all the clients' IDs whose junior credit cards were issued after 1996. | After 1996 means date > = '1997-01-01 | SELECT T2.client_id FROM card AS T1 INNER JOIN disp AS T2 ON T1.disp_id = T2.disp_id WHERE T1.type = 'junior' AND T1.issued >= '1997-01-01' | simple |
168 | financial | What percentage of clients who opened their accounts in the district with an average salary of over 10000 are women? | Female refers to gender = 'F'; Woman and female are closed; Average salary can be found in A11 | SELECT CAST(SUM(T2.gender = 'F') AS REAL) * 100 / COUNT(T2.client_id)
FROM district AS T1
INNER JOIN client AS T2 ON T1.district_id = T2.district_id
WHERE T1.A11 > 10000; | moderate |
169 | financial | What was the growth rate of the total amount of loans across all accounts for a male client between 1996 and 1997? | Growth rate = (sum of amount_1997 - sum of amount_1996) / (sum of amount_1996) * 100%; Male refers to gender = 'M' | SELECT CAST((SUM(CASE WHEN STRFTIME('%Y', T1.date) = '1997' THEN T1.amount ELSE 0 END) -
SUM(CASE WHEN STRFTIME('%Y', T1.date) = '1996' THEN T1.amount ELSE 0 END)) AS REAL) * 100 /
SUM(CASE WHEN STRFTIME('%Y', T1.date) = '1996' THEN T1.amount ELSE 0 END)
FROM loan AS T1
INNER JOIN account AS T2 ON T... | challenging |
170 | financial | How many credit card withdrawals were recorded after 1995? | Operation = 'VYBER KARTOU' means credit card withdrawals | SELECT COUNT(account_id) FROM trans WHERE STRFTIME('%Y', date) > '1995' AND operation = 'VYBER KARTOU' | simple |
171 | financial | What was the difference in the number of crimes committed in East and North Bohemia in 1996? | 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 | SELECT SUM(IIF(A3 = 'north Bohemia', A16, 0)) - SUM(IIF(A3 = 'east Bohemia', A16, 0)) FROM district | moderate |
172 | financial | How many owner and disponent dispositions are there from account number 1 to account number 10? | SELECT SUM(type = 'OWNER') , SUM(type = 'DISPONENT') FROM disp WHERE account_id BETWEEN 1 AND 10 | simple | |
173 | financial | How often does account number 3 request an account statement to be released? What was the aim of debiting 3539 in total? | k_symbol refers to the purpose of payments | SELECT T1.frequency, T2.k_symbol FROM account AS T1 INNER JOIN (SELECT account_id, k_symbol, SUM(amount) AS total_amount FROM `order` GROUP BY account_id, k_symbol) AS T2 ON T1.account_id = T2.account_id WHERE T1.account_id = 3 AND T2.total_amount = 3539 | challenging |
174 | financial | What year was account owner number 130 born? | SELECT STRFTIME('%Y', T1.birth_date) FROM client AS T1 INNER JOIN disp AS T3 ON T1.client_id = T3.client_id INNER JOIN account AS T2 ON T3.account_id = T2.account_id WHERE T2.account_id = 130 | simple | |
175 | financial | For accounts with owner disposition that request statements after each transaction, what are the regional and district-level statistics including the number of accounts, average district salary, loan adoption rate, average loan amount, transaction activity, and account balances? | Statements after transaction refers to frequency = 'POPLATEK PO OBRATU'; owner disposition refers to type = 'OWNER' in disp table | WITH owner_accounts AS (
SELECT DISTINCT a.account_id, a.district_id, a.frequency, a.date
FROM account a
JOIN disp d ON a.account_id = d.account_id
WHERE d.type = 'OWNER' AND a.frequency = 'POPLATEK PO OBRATU'
),
district_stats AS (
SELECT
d.district_id,
d.A2 AS district_name,
... | challenging |
176 | financial | What is the amount of debt that client number 992 has, and how is this client doing with payments? | SELECT T4.amount, T4.status FROM client AS T1 INNER JOIN disp AS T2 ON T1.client_id = T2.client_id INNER JOIN account AS T3 on T2.account_id = T3.account_id INNER JOIN loan AS T4 ON T3.account_id = T4.account_id WHERE T1.client_id = 992 | simple | |
177 | financial | What is the sum that client number 4's account has following transaction 851? Who owns this account, a man or a woman? | SELECT T4.balance, T1.gender FROM client AS T1 INNER JOIN disp AS T2 ON T1.client_id = T2.client_id INNER JOIN account AS T3 ON T2.account_id =T3.account_id INNER JOIN trans AS T4 ON T3.account_id = T4.account_id WHERE T1.client_id = 4 AND T4.trans_id = 851 | simple | |
178 | financial | What are the complete details of client number 9 including their gender, birth date, credit card type, when the card was issued, customer status, total number of accounts owned, and how long they've had their most recent card? | Customer status is determined by card type: gold card holders are Premium Customers and classic card holders are Regular Customers. | SELECT
cl.client_id,
cl.gender,
DATE(cl.birth_date) AS birth_date,
cd.type AS card_type,
DATE(cd.issued) AS card_issued_date,
CASE
WHEN cd.type = 'gold' THEN 'Premium Customer'
WHEN cd.type = 'classic' THEN 'Regular Customer'
ELSE 'Other Customer Type'
END AS custom... | challenging |
179 | financial | How much, in total, did client number 617 pay for all of the transactions in 1998? | SELECT SUM(T2.amount) FROM disp AS T1 INNER JOIN trans AS T2 ON T2.account_id = T1.account_id WHERE STRFTIME('%Y', T2.date) = '1998' AND T1.client_id = 617 | simple | |
180 | financial | Please provide a list of clients who were born between 1983 and 1987 and whose account branch is in East Bohemia, along with their account IDs. | SELECT T1.client_id, T3.account_id
FROM client AS T1
INNER JOIN district AS T2 ON T1.district_id = T2.district_id
INNER JOIN disp AS T4 ON T1.client_id = T4.client_id
INNER JOIN account AS T3 ON T2.district_id = T3.district_id AND T4.account_id = T3.account_id
WHERE T2.A3 = 'east Bohemia' AND STRFTIME('%Y', T1.birth_da... | moderate | |
181 | financial | For the top 3 female clients with the largest loans, what are their loan details including total payments, interest paid, loan status, location, transaction activity, income category, and age? | Female refers to gender = 'F'; total payments = monthly payments * duration; interest paid = total payments - loan amount; income category is based on total income compared to loan amount (High: >2x loan, Medium: >1x loan, Low: otherwise) | WITH client_loans AS (
SELECT
c.client_id,
c.gender,
d.account_id,
l.loan_id,
l.amount,
l.duration,
l.payments,
l.status,
a.district_id,
di.A2 AS district_name,
di.A3 AS region,
RANK() OVER (PARTITION BY c.gender ORDER ... | challenging |
182 | financial | How many male customers who were born between 1974 and 1976 have made a payment on their home in excess of $4000? | Man and male refers to gender = 'M'; 'SIPO' stands for household payment | SELECT COUNT(T1.account_id) FROM trans AS T1 INNER JOIN account AS T2 ON T1.account_id = T2.account_id INNER JOIN disp AS T4 ON T2.account_id = T4.account_id INNER JOIN client AS T3 ON T4.client_id = T3.client_id WHERE STRFTIME('%Y', T3.birth_date) BETWEEN '1974' AND '1976' AND T3.gender = 'M' AND T1.amount > 4000 AND ... | moderate |
183 | financial | For accounts opened in Beroun after 1996, what are the yearly statistics including account owner demographics, transaction volumes, loan performance, and credit card distribution? | Account owner demographics include gender distribution and average age. Transaction volumes include total income and expenses. Loan performance includes success rate calculated as successful loans divided by total loans. Statistics should be grouped by the year the account was opened. | WITH AccountsInBeroun AS (
SELECT
a.account_id,
a.date,
d.A2 AS district_name,
STRFTIME('%Y', a.date) AS opening_year,
a.frequency
FROM
account AS a
INNER JOIN
district AS d ON a.district_id = d.district_id
WHERE
d.A2 = 'Beroun' AND STR... | challenging |
184 | financial | How many female customers have a junior credit card? | Female refers to gender = 'F' | SELECT COUNT(T1.client_id) FROM client AS T1 INNER JOIN disp AS T2 ON T1.client_id = T2.client_id INNER JOIN card AS T3 ON T2.disp_id = T3.disp_id WHERE T1.gender = 'F' AND T3.type = 'junior' | simple |
185 | financial | What proportion of customers who have accounts at the Prague branch are female? | Female refers to gender = 'F'; Proportion = [number of female clients with accounts in the Prague region / number of clients with accounts in the Prague region] * 100%. | SELECT CAST(SUM(T2.gender = 'F') AS REAL) / COUNT(T2.client_id) * 100
FROM district AS T1
INNER JOIN client AS T2 ON T1.district_id = T2.district_id
WHERE T1.A3 = 'Prague'; | moderate |
186 | financial | What percentage of male clients request for weekly statements to be issued? | Percentage of male clients = [count(male clients who requested weekly statements / count(clients who requested weekly statements)] * 100%; Male means gender = 'M'; 'POPLATEK TYDNE' stands for weekly issuance | SELECT CAST(SUM(T1.gender = 'M') AS REAL) * 100 / COUNT(T1.client_id) FROM client AS T1 INNER JOIN account AS T2 ON T2.district_id = T1.district_id INNER JOIN disp as T3 on T1.client_id = T3.client_id AND T2.account_id = T3.account_id WHERE T2.frequency = 'POPLATEK TYDNE' | moderate |
187 | financial | What are the key statistics for account owners with weekly statement issuance, including how many owners there are, their average number of transactions, how many have credit cards, how many are high-volume clients with over 10,000 in total transactions, the number of districts they're located in, and their average acc... | Weekly statement issuance refers to frequency = 'POPLATEK TYDNE'; high-volume clients are those with total transaction amount > 10000 | WITH ClientTransactionStats AS (
SELECT
T2.client_id,
COUNT(DISTINCT T3.trans_id) AS transaction_count,
SUM(T3.amount) AS total_transaction_amount,
AVG(T3.balance) AS avg_balance
FROM account AS T1
JOIN disp AS T2 ON T2.account_id = T1.account_id
JOIN trans AS T3 ON T3.a... | challenging |
188 | financial | For accounts with loans exceeding 24 months duration that were opened before 1997, provide comprehensive details about the account(s) with the smallest loan amount, including transaction history, card information, client demographics, and order activity. | Before 1997 does not include year 1997. PRIJEM means income transactions and VYDAJ means expense transactions. | WITH AccountsWithLongLoans AS (
SELECT
l.account_id,
l.amount,
l.duration,
a.date AS account_opening_date,
STRFTIME('%Y', a.date) AS opening_year,
d.district_id,
d.A2 AS district_name,
d.A3 AS region
FROM
loan AS l
INNER JOIN
... | challenging |
189 | financial | Name the account numbers of female clients who are oldest and have lowest average salary? | Female refers to 'F' in the gender; A11 contains information about average salary | SELECT T3.account_id
FROM client AS T1
INNER JOIN district AS T2 ON T1.district_id = T2.district_id
INNER JOIN account AS T3 ON T2.district_id = T3.district_id
INNER JOIN disp AS T4 ON T1.client_id = T4.client_id AND T4.account_id = T3.account_id
WHERE T1.gender = 'F'
ORDER BY T1.birth_date ASC, T2.A11 ASC
LIMIT 1; | moderate |
190 | financial | What are the comprehensive statistics for clients born in 1920 who live in east Bohemia, including their account activity, loan information, transaction patterns, gender distribution, and most common district? | East Bohemia refers to region A3 = 'east Bohemia'. PRIJEM transactions represent income while VYDAJ transactions represent expenses. | WITH ClientsInEastBohemia AS (
SELECT
c.client_id,
c.birth_date,
c.gender,
d.A2 AS district_name,
d.A3 AS region,
STRFTIME('%Y', c.birth_date) AS birth_year,
COUNT(DISTINCT a.account_id) AS num_accounts,
COUNT(DISTINCT l.loan_id) AS num_loans
FROM... | challenging |
191 | financial | What are the statistics for the top 50 highest loan amounts among 24-month loans with weekly statement issuance that have an owner, including total count, average loan amount, payment details, interest rates, loan status distribution, and district economic indicators? | Weekly statement issuance refers to frequency = 'POPLATEK TYDNE'. Loan status: A = contract finished no problems, B = contract finished loan not paid, C = running contract OK so far, D = running contract client in debt. | WITH LoanAccountStats AS (
SELECT
a.account_id,
a.district_id,
a.frequency,
l.duration,
l.amount,
l.payments,
l.status,
d.A2 AS district_name,
d.A3 AS region,
d.A11 AS avg_salary,
d.A12 AS unemployment_rate_1995,
ROUND(... | challenging |
192 | financial | What is the average amount of loan which are still on running contract with statement issuance after each transaction? | status = 'C' stands for running contract, OK so far; status = 'D' stands for running contract, client in debt. 'POPLATEK PO OBRATU' stands for issuance after transaction | SELECT AVG(T2.amount) FROM account AS T1 INNER JOIN loan AS T2 ON T1.account_id = T2.account_id WHERE T2.status IN ('C', 'D') AND T1.frequency = 'POPLATEK PO OBRATU' | moderate |
193 | financial | List all ID and district for clients that can only have the right to issue permanent orders or apply for loans. | Only the owner accounts have the right to issue permanent orders or apply for loans | SELECT T3.client_id, T2.district_id, T2.A2 FROM account AS T1 INNER JOIN district AS T2 ON T1.district_id = T2.district_id INNER JOIN disp AS T3 ON T1.account_id = T3.account_id WHERE T3.type = 'OWNER' | moderate |
194 | financial | Provide the IDs and age of the client with high level credit card, which is eligible for loans. | the credit card is high-level refers to card.type = 'gold'; eligible for loans refers to disp.type = 'OWNER' | SELECT T1.client_id, STRFTIME('%Y', CURRENT_TIMESTAMP) - STRFTIME('%Y', T3.birth_date) FROM disp AS T1 INNER JOIN card AS T2 ON T2.disp_id = T1.disp_id INNER JOIN client AS T3 ON T1.client_id = T3.client_id WHERE T2.type = 'gold' AND T1.type = 'OWNER' | moderate |
195 | toxicology | For the most common bond type in the database, provide comprehensive statistics including its total occurrences, how many molecules contain it, the average number of such bonds per molecule, the number of unique element pairs it connects, and which molecule labels (carcinogenic or non-carcinogenic) contain this bond ty... | most common bond type refers to the bond_type with MAX(COUNT(bond_id)); molecule label refers to '+' for carcinogenic and '-' for non-carcinogenic | WITH BondCounts AS (
SELECT
b.bond_type,
COUNT(b.bond_id) AS bond_count,
RANK() OVER (ORDER BY COUNT(b.bond_id) DESC) AS bond_rank
FROM bond b
GROUP BY b.bond_type
),
MoleculeStats AS (
SELECT
b.molecule_id,
b.bond_type,
COUNT(b.bond_id) AS bonds_per_mol... | challenging |
196 | toxicology | For non-carcinogenic molecules containing chlorine, what are the statistics including the count of such molecules, average and maximum number of chlorine atoms, average number of bonds, count of molecules with more single bonds than double bonds, and average number of bonds involving chlorine? | non-carcinogenic molecules refers to label = '-'; chlorine atoms refers to element = 'cl'; single bonds refers to bond_type = '-'; double bonds refers to bond_type = '=' | WITH ChlorineAtomCounts AS (
SELECT
m.molecule_id,
m.label,
COUNT(a.atom_id) AS chlorine_atoms
FROM
molecule m
INNER JOIN
atom a ON m.molecule_id = a.molecule_id
WHERE
a.element = 'cl'
GROUP BY
m.molecule_id, m.label
),
MoleculeBondStats A... | challenging |
197 | toxicology | Calculate the average number of oxygen atoms in single-bonded molecules. | single-bonded molecules refers to bond_type = '-' ; average number of oxygen atom = AVG(element = 'o') | SELECT AVG(oxygen_count) FROM (SELECT T1.molecule_id, COUNT(T1.element) AS oxygen_count FROM atom AS T1 INNER JOIN bond AS T2 ON T1.molecule_id = T2.molecule_id WHERE T2.bond_type = '-' AND T1.element = 'o' GROUP BY T1.molecule_id) AS oxygen_counts | moderate |
198 | toxicology | On average how many carcinogenic molecules are single bonded? | carcinogenic molecules refers to label = '+'; single-bonded refers to bond_type = '-'; average = DIVIDE(SUM(bond_type = '-'), COUNT(atom_id)) | SELECT AVG(single_bond_count) FROM (SELECT T3.molecule_id, COUNT(T1.bond_type) AS single_bond_count FROM bond AS T1 INNER JOIN atom AS T2 ON T1.molecule_id = T2.molecule_id INNER JOIN molecule AS T3 ON T3.molecule_id = T2.molecule_id WHERE T1.bond_type = '-' AND T3.label = '+' GROUP BY T3.molecule_id) AS subquery | challenging |
199 | toxicology | In the molecule containing sodium atoms, how many are non-carcinogenic? | non-carcinogenic refers to label = '-'; sodium atoms refers to element = 'na' | SELECT COUNT(DISTINCT T2.molecule_id) FROM atom AS T1 INNER JOIN molecule AS T2 ON T1.molecule_id = T2.molecule_id WHERE T1.element = 'na' AND T2.label = '-' | simple |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.