question
stringlengths 23
286
| db_id
stringclasses 11
values | evidence
stringlengths 0
468
| SQL
stringlengths 35
1.58k
| difficulty
stringclasses 3
values | question_id
int64 5
1.53k
|
---|---|---|---|---|---|
On average how many carcinogenic molecules are single bonded? | toxicology | 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 | 198 |
Find the triple-bonded molecules which are carcinogenic. | toxicology | triple-bonded molecules refers to bond_type = '#'; carcinogenic refers to label = '+' | SELECT DISTINCT
`T2`.`molecule_id`
FROM `bond` AS `T1`
INNER JOIN `molecule` AS `T2`
ON `T1`.`molecule_id` = `T2`.`molecule_id`
WHERE
`T1`.`bond_type` = '#' AND `T2`.`label` = '+' | simple | 200 |
What is the percentage of carbon in double-bond molecules? | toxicology | carbon refers to element = 'c'; double-bond molecules refers to bond_type = '='; percentage = DIVIDE(SUM(element = 'c'), COUNT(atom_id)) | SELECT
CAST(COUNT(DISTINCT CASE WHEN `T1`.`element` = 'c' THEN `T1`.`atom_id` ELSE NULL END) AS DOUBLE) * 100 / COUNT(DISTINCT `T1`.`atom_id`)
FROM `atom` AS `T1`
INNER JOIN `bond` AS `T2`
ON `T1`.`molecule_id` = `T2`.`molecule_id`
WHERE
`T2`.`bond_type` = '=' | moderate | 201 |
What elements are in the TR004_8_9 bond atoms? | toxicology | TR004_8_9 bond atoms refers to bond_id = 'TR004_8_9'; | SELECT DISTINCT
`T1`.`element`
FROM `atom` AS `T1`
INNER JOIN `connected` AS `T2`
ON `T1`.`atom_id` = `T2`.`atom_id`
WHERE
`T2`.`bond_id` = 'TR004_8_9' | challenging | 206 |
What elements are in a double type bond? | toxicology | double type bond refers to bond_type = '='; | SELECT DISTINCT
`T1`.`element`
FROM `atom` AS `T1`
INNER JOIN `bond` AS `T2`
ON `T1`.`molecule_id` = `T2`.`molecule_id`
INNER JOIN `connected` AS `T3`
ON `T1`.`atom_id` = `T3`.`atom_id`
WHERE
`T2`.`bond_type` = '=' | challenging | 207 |
Which type of label is the most numerous in atoms with hydrogen? | toxicology | with hydrogen refers to element = 'h'; label most numerous in atoms refers to MAX(COUNT(label)); | SELECT
`T`.`label`
FROM (
SELECT
`T2`.`label`,
COUNT(`T2`.`molecule_id`)
FROM `atom` AS `T1`
INNER JOIN `molecule` AS `T2`
ON `T1`.`molecule_id` = `T2`.`molecule_id`
WHERE
`T1`.`element` = 'h'
GROUP BY
`T2`.`label`
ORDER BY
COUNT(`T2`.`molecule_id`) DESC
LIMIT 1
) AS `t` | moderate | 208 |
Which element is the least numerous in non-carcinogenic molecules? | toxicology | label = '-' means molecules are non-carcinogenic; least numerous refers to MIN(COUNT(element)); | SELECT
`T`.`element`
FROM (
SELECT
`T1`.`element`,
COUNT(DISTINCT `T1`.`molecule_id`)
FROM `atom` AS `T1`
INNER JOIN `molecule` AS `T2`
ON `T1`.`molecule_id` = `T2`.`molecule_id`
WHERE
`T2`.`label` = '-'
GROUP BY
`T1`.`element`
ORDER BY
COUNT(DISTINCT `T1`.`molecule_id`) ASC
LIMIT 1
) AS `t` | challenging | 212 |
What type of bond is there between the atoms TR004_8 and TR004_20? | toxicology | type of bond refers to bond_type; between the atoms TR004_8 and TR004_20 refers to atom_id = 'TR004_8' AND atom_id2 = 'TR004_20' OR another way around | SELECT
`T1`.`bond_type`
FROM `bond` AS `T1`
INNER JOIN `connected` AS `T2`
ON `T1`.`bond_id` = `T2`.`bond_id`
WHERE
`T2`.`atom_id` = 'TR004_8'
AND `T2`.`atom_id2` = 'TR004_20'
OR `T2`.`atom_id2` = 'TR004_8'
AND `T2`.`atom_id` = 'TR004_20' | moderate | 213 |
How many atoms with iodine and with sulfur type elements are there in single bond molecules? | toxicology | with iodine element refer to element = 'i'; with sulfur element refers to element = 's'; single type bond refers to bond_type = '-'; Should consider the distinct atoms when counting; | SELECT
COUNT(DISTINCT CASE WHEN `T1`.`element` = 'i' THEN `T1`.`atom_id` ELSE NULL END) AS `iodine_nums`,
COUNT(DISTINCT CASE WHEN `T1`.`element` = 's' THEN `T1`.`atom_id` ELSE NULL END) AS `sulfur_nums`
FROM `atom` AS `T1`
INNER JOIN `connected` AS `T2`
ON `T1`.`atom_id` = `T2`.`atom_id`
INNER JOIN `bond` AS `T3`
ON `T2`.`bond_id` = `T3`.`bond_id`
WHERE
`T3`.`bond_type` = '-' | challenging | 215 |
What percentage of carcinogenic-type molecules does not contain fluorine? | toxicology | label = '+' mean molecules are carcinogenic; contain fluorine refers to element = 'f'; percentage = DIVIDE(SUM(element = 'f') * 100, COUNT(molecule_id)) where label = '+'; Should consider the distinct atoms when counting; | SELECT
CAST(COUNT(DISTINCT CASE WHEN `T1`.`element` <> 'f' THEN `T2`.`molecule_id` ELSE NULL END) AS DOUBLE) * 100 / COUNT(DISTINCT `T2`.`molecule_id`)
FROM `atom` AS `T1`
INNER JOIN `molecule` AS `T2`
ON `T1`.`molecule_id` = `T2`.`molecule_id`
WHERE
`T2`.`label` = '+' | challenging | 218 |
What is the percentage of carcinogenic molecules in triple type bonds? | toxicology | label = '+' mean molecules are carcinogenic; triple bond refers to bond_type = '#'; percentage = DIVIDE(SUM(bond_type = '#') * 100, COUNT(bond_id)) as percent where label = '+' | SELECT
CAST(COUNT(DISTINCT CASE WHEN `T2`.`label` = '+' THEN `T2`.`molecule_id` ELSE NULL END) AS DOUBLE) * 100 / COUNT(DISTINCT `T2`.`molecule_id`)
FROM `atom` AS `T1`
INNER JOIN `molecule` AS `T2`
ON `T1`.`molecule_id` = `T2`.`molecule_id`
INNER JOIN `bond` AS `T3`
ON `T2`.`molecule_id` = `T3`.`molecule_id`
WHERE
`T3`.`bond_type` = '#' | challenging | 219 |
Please list top three elements of the toxicology of the molecule TR000 in alphabetical order. | toxicology | TR000 is the molecule id; | SELECT DISTINCT
`T`.`element`
FROM `atom` AS `T`
WHERE
`T`.`molecule_id` = 'TR000'
ORDER BY
`T`.`element`
LIMIT 3 | challenging | 220 |
What is the percentage of double bonds in the molecule TR008? Please provide your answer as a percentage with five decimal places. | toxicology | double bond refers to bond_type = '='; TR008 is the molecule id; percentage = DIVIDE(SUM(bond_type = '='), COUNT(bond_id)) as percent where molecule_id = 'TR008' | SELECT
ROUND(
CAST(COUNT(CASE WHEN `T`.`bond_type` = '=' THEN `T`.`bond_id` ELSE NULL END) AS DOUBLE) * 100 / COUNT(`T`.`bond_id`),
5
)
FROM `bond` AS `T`
WHERE
`T`.`molecule_id` = 'TR008' | moderate | 226 |
What is the percentage of molecules that are carcinogenic? Please provide your answer as a percentage with three decimal places. | toxicology | label = '+' mean molecules are carcinogenic; percentage = DIVIDE(SUM(label = '+'), COUNT(molecule_id)) as percent | SELECT
ROUND(
CAST(COUNT(CASE WHEN `T`.`label` = '+' THEN `T`.`molecule_id` ELSE NULL END) AS DOUBLE) * 100 / COUNT(`T`.`molecule_id`),
3
)
FROM `molecule` AS `t` | simple | 227 |
How much of the hydrogen in molecule TR206 is accounted for? Please provide your answer as a percentage with four decimal places. | toxicology | hydrogen refers to element = 'h'; TR206 is the molecule id; percentage = DIVIDE(SUM(element = 'h'), COUNT(atom_id)) as percent where molecule_id = 'TR206' | SELECT
ROUND(
CAST(COUNT(CASE WHEN `T`.`element` = 'h' THEN `T`.`atom_id` ELSE NULL END) AS DOUBLE) * 100 / COUNT(`T`.`atom_id`),
4
)
FROM `atom` AS `T`
WHERE
`T`.`molecule_id` = 'TR206' | moderate | 228 |
What are the elements of the toxicology and label of molecule TR060? | toxicology | TR060 is the molecule id; | SELECT DISTINCT
`T1`.`element`,
`T2`.`label`
FROM `atom` AS `T1`
INNER JOIN `molecule` AS `T2`
ON `T1`.`molecule_id` = `T2`.`molecule_id`
WHERE
`T2`.`molecule_id` = 'TR060' | challenging | 230 |
Which bond type accounted for the majority of the bonds found in molecule TR010 and state whether or not this molecule is carcinogenic? | toxicology | TR010 is the molecule id; majority of the bond found refers to MAX(COUNT(bond_type)); | SELECT
`T`.`bond_type`
FROM (
SELECT
`T1`.`bond_type`,
COUNT(`T1`.`molecule_id`)
FROM `bond` AS `T1`
WHERE
`T1`.`molecule_id` = 'TR010'
GROUP BY
`T1`.`bond_type`
ORDER BY
COUNT(`T1`.`molecule_id`) DESC
LIMIT 1
) AS `T` | challenging | 231 |
Please list top three molecules that have single bonds between two atoms and are not carcinogenic in alphabetical order. | toxicology | label = '-' means molecules are not carcinogenic; single type bond refers to bond_type = '-'; list top three molecules refers to return molecule_id and order by molecule_id; | SELECT DISTINCT
`T2`.`molecule_id`
FROM `bond` AS `T1`
INNER JOIN `molecule` AS `T2`
ON `T1`.`molecule_id` = `T2`.`molecule_id`
WHERE
`T1`.`bond_type` = '-' AND `T2`.`label` = '-'
ORDER BY
`T2`.`molecule_id`
LIMIT 3 | moderate | 232 |
How many bonds which involved atom 12 does molecule TR009 have? | toxicology | TR009 is the molecule id; involved atom 12 refers to atom_id = 'TR009_12' or atom_id2 = 'TR009_12' | SELECT
COUNT(`T2`.`bond_id`)
FROM `bond` AS `T1`
INNER JOIN `connected` AS `T2`
ON `T1`.`bond_id` = `T2`.`bond_id`
WHERE
`T1`.`molecule_id` = 'TR009'
AND `T2`.`atom_id` = CONCAT(`T1`.`molecule_id`, '_1')
OR `T2`.`atom_id2` = CONCAT(`T1`.`molecule_id`, '_2') | moderate | 234 |
What are the bond type and the atoms of the bond ID of TR001_6_9? | toxicology | atoms refer to atom_id or atom_id2 | SELECT
`T1`.`bond_type`,
`T2`.`atom_id`,
`T2`.`atom_id2`
FROM `bond` AS `T1`
INNER JOIN `connected` AS `T2`
ON `T1`.`bond_id` = `T2`.`bond_id`
WHERE
`T2`.`bond_id` = 'TR001_6_9' | moderate | 236 |
How many connections does the atom 19 have? | toxicology | connections refers to bond_id; atom 19 refers to atom_id like 'TR%_19'; | SELECT
COUNT(`T`.`bond_id`)
FROM `connected` AS `T`
WHERE
SUBSTR(`T`.`atom_id`, -2) = '19' | simple | 239 |
List all the elements of the toxicology of the molecule "TR004". | toxicology | TR004 is the molecule id; | SELECT DISTINCT
`T`.`element`
FROM `atom` AS `T`
WHERE
`T`.`molecule_id` = 'TR004' | challenging | 240 |
Among all the atoms from 21 to 25, list all the molecules that are carcinogenic. | toxicology | atoms from 21 to 25 refers to SUBSTR(atom_id, 7, 2) between '21' and '25'; label = '+' mean molecules are carcinogenic | SELECT DISTINCT
`T2`.`molecule_id`
FROM `atom` AS `T1`
INNER JOIN `molecule` AS `T2`
ON `T1`.`molecule_id` = `T2`.`molecule_id`
WHERE
SUBSTR(`T1`.`atom_id`, -2) BETWEEN '21' AND '25' AND `T2`.`label` = '+' | moderate | 242 |
What are the bonds that have phosphorus and nitrogen as their atom elements? | toxicology | have phosphorus as atom elements refers to element = 'p'; have nitrogen as atom elements refers to element = 'n' | SELECT
`T2`.`bond_id`
FROM `atom` AS `T1`
INNER JOIN `connected` AS `T2`
ON `T1`.`atom_id` = `T2`.`atom_id`
WHERE
`T2`.`bond_id` IN (
SELECT
`T3`.`bond_id`
FROM `connected` AS `T3`
INNER JOIN `atom` AS `T4`
ON `T3`.`atom_id` = `T4`.`atom_id`
WHERE
`T4`.`element` = 'p'
)
AND `T1`.`element` = 'n' | moderate | 243 |
Is the molecule with the most double bonds carcinogenic? | toxicology | double bond refers to bond_type = ' = '; label = '+' mean molecules are carcinogenic | SELECT
`T1`.`label`
FROM `molecule` AS `T1`
INNER JOIN (
SELECT
`T`.`molecule_id`,
COUNT(`T`.`bond_type`)
FROM `bond` AS `T`
WHERE
`T`.`bond_type` = '='
GROUP BY
`T`.`molecule_id`
ORDER BY
COUNT(`T`.`bond_type`) DESC
LIMIT 1
) AS `T2`
ON `T1`.`molecule_id` = `T2`.`molecule_id` | moderate | 244 |
What is the average number of bonds the atoms with the element iodine have? | toxicology | atoms with the element iodine refers to element = 'i'; average = DIVIDE(COUND(bond_id), COUNT(atom_id)) where element = 'i' | SELECT
CAST(COUNT(`T2`.`bond_id`) AS DOUBLE) / COUNT(`T1`.`atom_id`)
FROM `atom` AS `T1`
INNER JOIN `connected` AS `T2`
ON `T1`.`atom_id` = `T2`.`atom_id`
WHERE
`T1`.`element` = 'i' | moderate | 245 |
List all the elements of atoms that can not bond with any other atoms. | toxicology | atoms cannot bond with other atoms means atom_id NOT in connected table; | SELECT DISTINCT
`T`.`element`
FROM `atom` AS `T`
WHERE
NOT `T`.`element` IN (
SELECT DISTINCT
`T1`.`element`
FROM `atom` AS `T1`
INNER JOIN `connected` AS `T2`
ON `T1`.`atom_id` = `T2`.`atom_id`
) | challenging | 247 |
What are the atoms of the triple bond with the molecule "TR041"? | toxicology | TR041 is the molecule id; triple bond refers to bond_type = '#'; | SELECT
`T2`.`atom_id`,
`T2`.`atom_id2`
FROM `atom` AS `T1`
INNER JOIN `connected` AS `T2`
ON `T1`.`atom_id` = `T2`.`atom_id`
INNER JOIN `bond` AS `T3`
ON `T2`.`bond_id` = `T3`.`bond_id`
WHERE
`T3`.`bond_type` = '#' AND `T3`.`molecule_id` = 'TR041' | simple | 248 |
What are the elements of the atoms of TR144_8_19? | toxicology | TR144_8_19 is the bond id; | SELECT
`T2`.`element`
FROM `connected` AS `T1`
INNER JOIN `atom` AS `T2`
ON `T1`.`atom_id` = `T2`.`atom_id`
WHERE
`T1`.`bond_id` = 'TR144_8_19' | challenging | 249 |
List the elements of all the triple bonds. | toxicology | triple bond refers to bond_type = '#'; | SELECT DISTINCT
`T3`.`element`
FROM `bond` AS `T1`
INNER JOIN `connected` AS `T2`
ON `T1`.`bond_id` = `T2`.`bond_id`
INNER JOIN `atom` AS `T3`
ON `T2`.`atom_id` = `T3`.`atom_id`
WHERE
`T1`.`bond_type` = '#' | challenging | 253 |
What proportion of single bonds are carcinogenic? Please provide your answer as a percentage with five decimal places. | toxicology | single bond refers to bond_type = '-'; label = '+' mean molecules are carcinogenic; proportion = DIVIDE(SUM(label = '+') * 100, COUNT(bond_id)) where bond_type = '-' | SELECT
ROUND(
CAST(COUNT(CASE WHEN `T2`.`label` = '+' THEN `T1`.`bond_id` ELSE NULL END) AS DOUBLE) * 100 / COUNT(`T1`.`bond_id`),
5
)
FROM `bond` AS `T1`
INNER JOIN `molecule` AS `T2`
ON `T1`.`molecule_id` = `T2`.`molecule_id`
WHERE
`T1`.`bond_type` = '-' | moderate | 255 |
Calculate the total atoms with triple-bond molecules containing the element phosphorus or bromine. | toxicology | triple bond refers to bond_type = '#'; phosphorus refers to element = 'p'; bromine refers to element = 'br' | SELECT
COUNT(`T1`.`atom_id`)
FROM `atom` AS `T1`
INNER JOIN `molecule` AS `T2`
ON `T1`.`molecule_id` = `T2`.`molecule_id`
INNER JOIN `bond` AS `T3`
ON `T2`.`molecule_id` = `T3`.`molecule_id`
WHERE
`T3`.`bond_type` = '#' AND `T1`.`element` IN ('p', 'br') | moderate | 260 |
What is the composition of element chlorine in percentage among the single bond molecules? | toxicology | element chlorine refers to element = 'cl'; single bond refers to bond_type = '-'; percentage = DIVIDE(SUM(element = 'cl'), COUNT(atom_id)) as percent where bond_type = '-' | SELECT
CAST(COUNT(CASE WHEN `T`.`element` = 'cl' THEN `T`.`atom_id` ELSE NULL END) AS DOUBLE) * 100 / COUNT(`T`.`atom_id`)
FROM (
SELECT
`T1`.`atom_id`,
`T1`.`element`
FROM `atom` AS `T1`
INNER JOIN `molecule` AS `T2`
ON `T1`.`molecule_id` = `T2`.`molecule_id`
INNER JOIN `bond` AS `T3`
ON `T2`.`molecule_id` = `T3`.`molecule_id`
WHERE
`T3`.`bond_type` = '-'
) AS `T` | challenging | 263 |
What are the elements for bond id TR001_10_11? | toxicology | TR001_10_11 is the bond id; | SELECT
`T2`.`element`
FROM `connected` AS `T1`
INNER JOIN `atom` AS `T2`
ON `T1`.`atom_id` = `T2`.`atom_id`
WHERE
`T1`.`bond_id` = 'TR001_10_11' | challenging | 268 |
What is the percentage of element chlorine in carcinogenic molecules? | toxicology | chlorine refers to element = 'cl'; label = '+' mean molecules are carcinogenic; percentage = DIVIDE(SUM(element = 'pb'); COUNT(molecule_id)) as percentage where label = '+' | SELECT
CAST(COUNT(CASE WHEN `T1`.`element` = 'cl' THEN `T1`.`element` ELSE NULL END) AS DOUBLE) * 100 / COUNT(`T1`.`element`)
FROM `atom` AS `T1`
INNER JOIN `molecule` AS `T2`
ON `T1`.`molecule_id` = `T2`.`molecule_id`
WHERE
`T2`.`label` = '+' | moderate | 273 |
Tally the toxicology element of the 4th atom of each molecule that was carcinogenic. | toxicology | label = '+' means molecules are carcinogenic; 4th atom of each molecule refers to substr(atom_id, 7, 1) = '4'; | SELECT DISTINCT
`T1`.`element`
FROM `atom` AS `T1`
INNER JOIN `molecule` AS `T2`
ON `T1`.`molecule_id` = `T2`.`molecule_id`
WHERE
`T2`.`label` = '+'
AND SUBSTR(`T1`.`atom_id`, -1) = '4'
AND LENGTH(`T1`.`atom_id`) = 7 | challenging | 281 |
What is the ratio of Hydrogen elements in molecule ID TR006? List the ratio with its label. | toxicology | hydrogen refers to element = 'h'; ratio = DIVIDE(SUM(element = 'h'), count(element)) where molecule_id = 'TR006' ; label = '+' mean molecules are carcinogenic; label = '-' means molecules are non-carcinogenic | WITH SubQuery AS (SELECT DISTINCT T1.atom_id, T1.element, T1.molecule_id, T2.label FROM atom AS T1 INNER JOIN molecule AS T2 ON T1.molecule_id = T2.molecule_id WHERE T2.molecule_id = 'TR006') SELECT CAST(COUNT(CASE WHEN element = 'h' THEN atom_id ELSE NULL END) AS DECIMAL(10,2)) / NULLIF(COUNT(atom_id), 0) AS ratio, label FROM SubQuery GROUP BY label | challenging | 282 |
Which non-carcinogenic molecules consisted more than 5 atoms? | toxicology | label = '-' means molecules are non-carcinogenic; molecules consisted more than 5 atoms refers to COUNT(molecule_id) > 5 | SELECT
`T`.`molecule_id`
FROM (
SELECT
`T1`.`molecule_id`,
COUNT(`T2`.`atom_id`)
FROM `molecule` AS `T1`
INNER JOIN `atom` AS `T2`
ON `T1`.`molecule_id` = `T2`.`molecule_id`
WHERE
`T1`.`label` = '-'
GROUP BY
`T1`.`molecule_id`
HAVING
COUNT(`T2`.`atom_id`) > 5
) AS `t` | moderate | 327 |
How many schools with an average score in Math greater than 400 in the SAT test are exclusively virtual? | california_schools | Exclusively virtual refers to Virtual = 'F' | SELECT COUNT(DISTINCT `T2`.`School`) FROM `satscores` AS `T1` INNER JOIN `schools` AS `T2` ON `T1`.`cds` = `T2`.`CDSCode` WHERE `T2`.`Virtual` = 'F' AND `T1`.`AvgScrMath` > 400 | simple | 5 |
Please list the codes of the schools with a total enrollment of over 500. | california_schools | Total enrollment can be represented by `Enrollment (K-12)` + `Enrollment (Ages 5-17)` | SELECT
`T2`.`CDSCode`
FROM `schools` AS `T1`
INNER JOIN `frpm` AS `T2`
ON `T1`.`CDSCode` = `T2`.`CDSCode`
WHERE
`T2`.`Enrollment (K-12)` + `T2`.`Enrollment (Ages 5-17)` > 500 | simple | 11 |
Among the schools with an SAT excellence rate of over 0.3, what is the highest eligible free rate for students aged 5-17? | california_schools | Excellence rate = NumGE1500 / NumTstTakr; Eligible free rates for students aged 5-17 = `Free Meal Count (Ages 5-17)` / `Enrollment (Ages 5-17)` | SELECT
MAX(
CAST(`T1`.`Free Meal Count (Ages 5-17)` AS DOUBLE) / `T1`.`Enrollment (Ages 5-17)`
)
FROM `frpm` AS `T1`
INNER JOIN `satscores` AS `T2`
ON `T1`.`CDSCode` = `T2`.`cds`
WHERE
CAST(`T2`.`NumGE1500` AS DOUBLE) / `T2`.`NumTstTakr` > 0.3 | moderate | 12 |
Rank schools by their average score in Writing where the score is greater than 499, showing their charter numbers. | california_schools | Valid charter number means the number is not null | SELECT
`CharterNum`,
`AvgScrWrite`,
RANK() OVER (ORDER BY `AvgScrWrite` DESC) AS `WritingScoreRank`
FROM `schools` AS `T1`
INNER JOIN `satscores` AS `T2`
ON `T1`.`CDSCode` = `T2`.`cds`
WHERE
`T2`.`AvgScrWrite` > 499 AND NOT `CharterNum` IS NULL | simple | 17 |
List the names of schools with more than 30 difference in enrollements between K-12 and ages 5-17? Please also give the full street adress of the schools. | california_schools | Diffrence in enrollement = `Enrollment (K-12)` - `Enrollment (Ages 5-17)` | SELECT
`T1`.`School`,
`T1`.`Street`
FROM `schools` AS `T1`
INNER JOIN `frpm` AS `T2`
ON `T1`.`CDSCode` = `T2`.`CDSCode`
WHERE
`T2`.`Enrollment (K-12)` - `T2`.`Enrollment (Ages 5-17)` > 30 | moderate | 23 |
Give the names of the schools with the percent eligible for free meals in K-12 is more than 0.1 and test takers whose test score is greater than or equal to 1500? | california_schools | Percent eligible for free meals = Free Meal Count (K-12) / Total (Enrollment (K-12) | SELECT
`T2`.`School Name`
FROM `satscores` AS `T1`
INNER JOIN `frpm` AS `T2`
ON `T1`.`cds` = `T2`.`CDSCode`
WHERE
CAST(`T2`.`Free Meal Count (K-12)` AS DOUBLE) / `T2`.`Enrollment (K-12)` > 0.1
AND `T1`.`NumGE1500` > 0 | moderate | 24 |
Name schools in Riverside which the average of average math score for SAT is grater than 400, what is the funding type of these schools? | california_schools | Average of average math = sum(average math scores) / count(schools). | SELECT
`T1`.`sname`,
`T2`.`Charter Funding Type`
FROM `satscores` AS `T1`
INNER JOIN `frpm` AS `T2`
ON `T1`.`cds` = `T2`.`CDSCode`
WHERE
`T2`.`District Name` LIKE 'Riverside%'
GROUP BY
`T1`.`sname`,
`T2`.`Charter Funding Type`
HAVING
CAST(SUM(`T1`.`AvgScrMath`) AS DOUBLE) / COUNT(`T1`.`cds`) > 400 | moderate | 25 |
State the names and full communication address of high schools in Monterey which has more than 800 free or reduced price meals for ages 15-17? | california_schools | Full communication address should include Street, City, State and zip code if any. | SELECT
`T1`.`School Name`,
`T2`.`Street`,
`T2`.`City`,
`T2`.`State`,
`T2`.`Zip`
FROM `frpm` AS `T1`
INNER JOIN `schools` AS `T2`
ON `T1`.`CDSCode` = `T2`.`CDSCode`
WHERE
`T2`.`County` = 'Monterey'
AND `T1`.`Free Meal Count (Ages 5-17)` > 800
AND `T1`.`School Type` = 'High Schools (Public)' | moderate | 26 |
What is the average score in writing for the schools that were opened after 1991 or closed before 2000? List the school names along with the score. Also, list the communication number of the schools if there is any. | california_schools | Communication number refers to phone number. | SELECT
`T2`.`School`,
`T1`.`AvgScrWrite`,
`T2`.`Phone`
FROM `schools` AS `T2`
LEFT JOIN `satscores` AS `T1`
ON `T2`.`CDSCode` = `T1`.`cds`
WHERE
DATE_FORMAT(CAST(`T2`.`OpenDate` AS DATETIME), '%Y') > '1991'
OR DATE_FORMAT(CAST(`T2`.`ClosedDate` AS DATETIME), '%Y') < '2000' | moderate | 27 |
Consider the average difference between K-12 enrollment and 15-17 enrollment of schools that are locally funded, list the names and DOC type of schools which has a difference above this average. | california_schools | Difference between K-12 enrollment and 15-17 enrollment can be computed by `Enrollment (K-12)` - `Enrollment (Ages 5-17)` | SELECT
`T2`.`School`,
`T2`.`DOC`
FROM `frpm` AS `T1`
INNER JOIN `schools` AS `T2`
ON `T1`.`CDSCode` = `T2`.`CDSCode`
WHERE
`T2`.`FundingType` = 'Locally funded'
AND (
`T1`.`Enrollment (K-12)` - `T1`.`Enrollment (Ages 5-17)`
) > (
SELECT
AVG(`T3`.`Enrollment (K-12)` - `T3`.`Enrollment (Ages 5-17)`)
FROM `frpm` AS `T3`
INNER JOIN `schools` AS `T4`
ON `T3`.`CDSCode` = `T4`.`CDSCode`
WHERE
`T4`.`FundingType` = 'Locally funded'
) | challenging | 28 |
What is the eligible free rate of the 10th and 11th schools with the highest enrolment for students in grades 1 through 12? | california_schools | K-12 refers to students in grades 1 through 12; Eligible free rate for K-12 = `Free Meal Count (K-12)` / `Enrollment (K-12)` | SELECT
CAST(`Free Meal Count (K-12)` AS DOUBLE) / `Enrollment (K-12)`
FROM `frpm`
ORDER BY
`Enrollment (K-12)` DESC
LIMIT 2
OFFSET 9 | moderate | 31 |
What is the eligible free or reduced price meal rate for the top 5 schools in grades 1-12 with the highest free or reduced price meal count of the schools with the ownership code 66? | california_schools | grades 1-12 means K-12; Eligible free or reduced price meal rate for K-12 = `FRPM Count (K-12)` / `Enrollment (K-12)` | SELECT
CAST(`T1`.`FRPM Count (K-12)` AS DOUBLE) / `T1`.`Enrollment (K-12)`
FROM `frpm` AS `T1`
INNER JOIN `schools` AS `T2`
ON `T1`.`CDSCode` = `T2`.`CDSCode`
WHERE
`T2`.`SOC` = 66
ORDER BY
`T1`.`FRPM Count (K-12)` DESC
LIMIT 5 | moderate | 32 |
What is the complete address of the school with the lowest excellence rate? Indicate the Street, City, Zip and State. | california_schools | Execellence Rate = NumGE1500 / NumTstTakr; complete address has Street, City, State, Zip code | SELECT
`T2`.`Street`,
`T2`.`City`,
`T2`.`State`,
`T2`.`Zip`
FROM `satscores` AS `T1`
INNER JOIN `schools` AS `T2`
ON `T1`.`cds` = `T2`.`CDSCode`
ORDER BY
CAST(`T1`.`NumGE1500` AS DOUBLE) / `T1`.`NumTstTakr` ASC
LIMIT 1 | moderate | 37 |
Under whose administration is the school with the highest number of students scoring 1500 or more on the SAT? Indicate their full names. | california_schools | full name means first name, last name; There are at most 3 administrators for each school; SAT Scores are greater or equal to 1500 refers to NumGE1500 | SELECT
`T2`.`AdmFName1`,
`T2`.`AdmLName1`,
`T2`.`AdmFName2`,
`T2`.`AdmLName2`,
`T2`.`AdmFName3`,
`T2`.`AdmLName3`
FROM `satscores` AS `T1`
INNER JOIN `schools` AS `T2`
ON `T1`.`cds` = `T2`.`CDSCode`
ORDER BY
`T1`.`NumGE1500` DESC
LIMIT 1 | challenging | 36 |
What is the average number of test takers from Fresno schools that opened between 1/1/1980 and 12/31/1980? | california_schools | between 1/1/1980 and 12/31/1980 means the year = 1980 | SELECT
AVG(`T1`.`NumTstTakr`)
FROM `satscores` AS `T1`
INNER JOIN `schools` AS `T2`
ON `T1`.`cds` = `T2`.`CDSCode`
WHERE
DATE_FORMAT(CAST(`T2`.`OpenDate` AS DATETIME), '%Y') = '1980'
AND `T2`.`County` = 'Fresno' | simple | 39 |
What is the telephone number for the school with the lowest average score in reading in Fresno Unified? | california_schools | Fresno Unified is a name of district; | SELECT
`T2`.`Phone`
FROM `satscores` AS `T1`
INNER JOIN `schools` AS `T2`
ON `T1`.`cds` = `T2`.`CDSCode`
WHERE
`T2`.`District` = 'Fresno Unified' AND NOT `T1`.`AvgScrRead` IS NULL
ORDER BY
`T1`.`AvgScrRead` ASC
LIMIT 1 | moderate | 40 |
List the names of virtual schools that are among the top 5 in their respective counties based on average reading scores. | california_schools | Exclusively virtual refers to Virtual = 'F'; respective counties means PARTITION BY County | SELECT School FROM ( SELECT T2.School, T1.AvgScrRead, RANK() OVER (PARTITION BY T2.County ORDER BY T1.AvgScrRead DESC) AS rnk FROM satscores AS T1 INNER JOIN schools AS T2 ON T1.cds = T2.CDSCode WHERE T2.Virtual = 'F') ranked_schools WHERE rnk <= 5 | simple | 41 |
What is the average writing score of each of the schools managed by Ricci Ulrich? List the schools and the corresponding average writing scores. | california_schools | Usually, administrators manage the school stuff. | SELECT
`T2`.`School`,
`T1`.`AvgScrWrite`
FROM `satscores` AS `T1`
INNER JOIN `schools` AS `T2`
ON `T1`.`cds` = `T2`.`CDSCode`
WHERE
`T2`.`AdmFName1` = 'Ricci' AND `T2`.`AdmLName1` = 'Ulrich' | moderate | 45 |
Which state special schools have the highest number of enrollees from grades 1 through 12? | california_schools | State Special Schools refers to DOC = 31; Grades 1 through 12 means K-12 | SELECT
`T2`.`School`
FROM `frpm` AS `T1`
INNER JOIN `schools` AS `T2`
ON `T1`.`CDSCode` = `T2`.`CDSCode`
WHERE
`T2`.`DOC` = 31
ORDER BY
`T1`.`Enrollment (K-12)` DESC
LIMIT 1 | simple | 46 |
What is the monthly average number of schools that opened in Alameda County under the jurisdiction of the Elementary School District in 1980? | california_schools | Elementary School District refers to DOC = 52; Monthly average number of schools that opened in 1980 = count(schools that opened in 1980) / 12 | SELECT
CAST(COUNT(`School`) AS DOUBLE) / 12
FROM `schools`
WHERE
`DOC` = 52
AND `County` = 'Alameda'
AND DATE_FORMAT(CAST(`OpenDate` AS DATETIME), '%Y') = '1980' | moderate | 47 |
What is the ratio of merged Unified School District schools in Orange County to merged Elementary School District schools? | california_schools | Elementary School District refers to DOC = 52; Unified School District refers to DOC = 54. | SELECT
CAST(SUM(CASE WHEN `DOC` = 54 THEN 1 ELSE 0 END) AS DOUBLE) / SUM(CASE WHEN `DOC` = 52 THEN 1 ELSE 0 END)
FROM `schools`
WHERE
`StatusType` = 'Merged' AND `County` = 'Orange' | moderate | 48 |
What is the postal street address for the school with the 7th highest Math average? Indicate the school's name. | california_schools | Postal street and mailing street are synonyms. | SELECT
`T2`.`MailStreet`,
`T2`.`School`
FROM `satscores` AS `T1`
INNER JOIN `schools` AS `T2`
ON `T1`.`cds` = `T2`.`CDSCode`
ORDER BY
`T1`.`AvgScrMath` DESC
LIMIT 1
OFFSET 6 | simple | 50 |
What is the total number of non-chartered schools in the county of Los Angeles with a percent (%) of eligible free meals for grades 1 through 12 that is less than 0.18%? | california_schools | non-chartered schools refer to schools whose Charter = 0; K-12 means grades 1 through 12; percent of eligible free rate for K-12 = `Free Meal Count (K-12)` * 100 / `Enrollment (K-12)` | SELECT
COUNT(`T2`.`School`)
FROM `frpm` AS `T1`
INNER JOIN `schools` AS `T2`
ON `T1`.`CDSCode` = `T2`.`CDSCode`
WHERE
`T2`.`County` = 'Los Angeles'
AND `T2`.`Charter` = 0
AND CAST(`T1`.`Free Meal Count (K-12)` AS DOUBLE) * 100 / `T1`.`Enrollment (K-12)` < 0.18 | challenging | 62 |
How many students from the ages of 5 to 17 are enrolled at the State Special School school in Fremont for the 2014-2015 academic year? | california_schools | State Special School means EdOpsCode = 'SSS' | SELECT
`T1`.`Enrollment (Ages 5-17)`
FROM `frpm` AS `T1`
INNER JOIN `schools` AS `T2`
ON `T1`.`CDSCode` = `T2`.`CDSCode`
WHERE
`T2`.`EdOpsCode` = 'SSS'
AND `T2`.`City` = 'Fremont'
AND `T1`.`Academic Year` BETWEEN 2014 AND 2015 | moderate | 72 |
Which schools served a grade span of Kindergarten to 9th grade in the county of Los Angeles and what is its Percent (%) Eligible FRPM (Ages 5-17)? | california_schools | Percent (%) Eligible FRPM (Ages 5-17) can be acquired by `FRPM Count (Ages 5-17)` / `Enrollment (Ages 5-17)` * 100 | SELECT
`T2`.`School`,
`T1`.`FRPM Count (Ages 5-17)` * 100 / `T1`.`Enrollment (Ages 5-17)`
FROM `frpm` AS `T1`
INNER JOIN `schools` AS `T2`
ON `T1`.`CDSCode` = `T2`.`CDSCode`
WHERE
`T2`.`County` = 'Los Angeles' AND `T2`.`GSserved` = 'K-9' | moderate | 77 |
Between San Diego and Santa Barbara, which county offers the most number of schools that does not offer physical building? Indicate the amount. | california_schools | 'Does not offer physical building' means Virtual = F in the database. | SELECT
`County`,
COUNT(`Virtual`)
FROM `schools`
WHERE
(
`County` = 'San Diego' OR `County` = 'Santa Barbara'
) AND `Virtual` = 'F'
GROUP BY
`County`
ORDER BY
COUNT(`Virtual`) DESC
LIMIT 1 | moderate | 79 |
What is the grade span offered in the school with the highest longitude? | california_schools | the highest longitude refers to the school with the maximum absolute longitude value. | SELECT
`GSoffered`
FROM `schools`
ORDER BY
ABS(`longitude`) DESC
LIMIT 1 | simple | 82 |
Of the schools that offers a magnet program serving a grade span of Kindergarten to 8th grade, how many offers Multiple Provision Types? List the number of cities that offers a Kindergarten to 8th grade span and indicate how many schools are there serving such grade span for each city. | california_schools | Kindergarten to 8th grade refers to K-8; 'Offers a magnet program' means Magnet = 1; Multiple Provision Types refers to `NSLP Provision Status` = 'Multiple Provision Types' | SELECT
`T2`.`City`,
COUNT(`T2`.`CDSCode`)
FROM `frpm` AS `T1`
INNER JOIN `schools` AS `T2`
ON `T1`.`CDSCode` = `T2`.`CDSCode`
WHERE
`T2`.`Magnet` = 1
AND `T2`.`GSoffered` = 'K-8'
AND `T1`.`NSLP Provision Status` = 'Multiple Provision Types'
GROUP BY
`T2`.`City` | challenging | 83 |
What is the Percent (%) Eligible Free (K-12) in the school administered by an administrator whose first name is Alusine. List the district code of the school. | california_schools | Percent (%) Eligible Free (K-12) = `Free Meal Count (K-12)` / `Enrollment (K-12)` * 100% | SELECT
`T1`.`Free Meal Count (K-12)` * 100 / `T1`.`Enrollment (K-12)`,
`T1`.`District Code`
FROM `frpm` AS `T1`
INNER JOIN `schools` AS `T2`
ON `T1`.`CDSCode` = `T2`.`CDSCode`
WHERE
`T2`.`AdmFName1` = 'Alusine' | moderate | 85 |
What are the valid e-mail addresses of the administrator of the school located in the San Bernardino county, City of San Bernardino City Unified that opened between 1/1/2009 to 12/31/2010 whose school types are public Intermediate/Middle Schools and Unified Schools? | california_schools | Intermediate/Middle Schools refers to SOC = 62; Unified School refers to DOC = 54; years between 2009 and 2010 can refer to 'between 1/1/2009 to 12/31/2010' | SELECT
`T2`.`AdmEmail1`,
`T2`.`AdmEmail2`
FROM `frpm` AS `T1`
INNER JOIN `schools` AS `T2`
ON `T1`.`CDSCode` = `T2`.`CDSCode`
WHERE
`T2`.`County` = 'San Bernardino'
AND `T2`.`City` = 'San Bernardino'
AND `T2`.`DOC` = 54
AND DATE_FORMAT(CAST(`T2`.`OpenDate` AS DATETIME), '%Y') BETWEEN '2009' AND '2010'
AND `T2`.`SOC` = 62 | challenging | 87 |
How many accounts who choose issuance after transaction are staying in East Bohemia region? | financial | A3 contains the data of region; 'POPLATEK PO OBRATU' represents for 'issuance after transaction'. | SELECT
COUNT(`T2`.`account_id`)
FROM `district` AS `T1`
INNER JOIN `account` AS `T2`
ON `T1`.`district_id` = `T2`.`district_id`
WHERE
`T1`.`A3` = 'east Bohemia' AND `T2`.`frequency` = 'POPLATEK PO OBRATU' | moderate | 89 |
List out the no. of districts that have female average salary is more than 6000 but less than 10000? | financial | A11 refers to average salary; Female mapps to gender = 'F' | SELECT
COUNT(DISTINCT `T2`.`district_id`)
FROM `client` AS `T1`
INNER JOIN `district` AS `T2`
ON `T1`.`district_id` = `T2`.`district_id`
WHERE
`T1`.`gender` = 'F' AND `T2`.`A11` BETWEEN 6000 AND 10000 | simple | 92 |
How many male customers who are living in North Bohemia have average salary greater than 8000? | financial | Male means that gender = 'M'; A3 refers to region; A11 pertains to average salary. | SELECT
COUNT(`T1`.`client_id`)
FROM `client` AS `T1`
INNER JOIN `district` AS `T2`
ON `T1`.`district_id` = `T2`.`district_id`
WHERE
`T1`.`gender` = 'M' AND `T2`.`A3` = 'north Bohemia' AND `T2`.`A11` > 8000 | moderate | 93 |
List out the account numbers of female clients who are oldest and has lowest average salary, calculate the gap between this lowest average salary with the highest average salary? | financial | Female means gender = 'F'; A11 refers to average salary; Gap = highest average salary - lowest average salary; If the person A's birthdate > B's birthdate, it means that person B is order than person A. | SELECT
`T1`.`account_id`,
(
SELECT
MAX(`A11`) - MIN(`A11`)
FROM `district`
)
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`
INNER JOIN `client` AS `T4`
ON `T3`.`client_id` = `T4`.`client_id`
WHERE
`T2`.`district_id` = (
SELECT
`district_id`
FROM `client`
WHERE
`gender` = 'F'
ORDER BY
`birth_date` ASC
LIMIT 1
)
ORDER BY
`T2`.`A11` DESC
LIMIT 1 | challenging | 94 |
List out the account numbers of clients who are youngest and have highest average salary? | financial | If the person A's birthdate < B's birthdate, it means that person B is younger than person A; A11 refers to average salary | SELECT
`T1`.`account_id`
FROM `account` AS `T1`
INNER JOIN `disp` AS `T2`
ON `T1`.`account_id` = `T2`.`account_id`
INNER JOIN `client` AS `T3`
ON `T2`.`client_id` = `T3`.`client_id`
INNER JOIN `district` AS `T4`
ON `T4`.`district_id` = `T1`.`district_id`
WHERE
`T2`.`client_id` = (
SELECT
`client_id`
FROM `client`
ORDER BY
`birth_date` DESC
LIMIT 1
)
GROUP BY
`T4`.`A11`,
`T1`.`account_id` | moderate | 95 |
Among the accounts who have approved loan date in 1997, list out the accounts that have the lowest approved amount and choose weekly issuance statement. | financial | 'POPLATEK TYDNE' stands for weekly issuance | SELECT
`T2`.`account_id`
FROM `loan` AS `T1`
INNER JOIN `account` AS `T2`
ON `T1`.`account_id` = `T2`.`account_id`
WHERE
DATE_FORMAT(CAST(`T1`.`date` AS DATETIME), '%Y') = '1997'
AND `T2`.`frequency` = 'POPLATEK TYDNE'
ORDER BY
`T1`.`amount`
LIMIT 1 | moderate | 98 |
Among the accounts who have loan validity more than 12 months, list out the accounts that have the highest approved amount and have account opening date in 1993. | financial | Loan validity more than 12 months refers to duration > 12 | SELECT
`T1`.`account_id`
FROM `loan` AS `T1`
INNER JOIN `account` AS `T2`
ON `T1`.`account_id` = `T2`.`account_id`
WHERE
DATE_FORMAT(CAST(`T2`.`date` AS DATETIME), '%Y') = '1993'
AND `T1`.`duration` > 12
ORDER BY
`T1`.`amount` DESC
LIMIT 1 | moderate | 99 |
Among the account opened, how many female customers who were born before 1950 and stayed in Sokolov? | financial | Customers refer to clients; Female refers to gender = 'F'; Names of districts appear in column A2 | SELECT
COUNT(`T2`.`client_id`)
FROM `district` AS `T1`
INNER JOIN `client` AS `T2`
ON `T1`.`district_id` = `T2`.`district_id`
WHERE
`T2`.`gender` = 'F'
AND DATE_FORMAT(CAST(`T2`.`birth_date` AS DATETIME), '%Y') < '1950'
AND `T1`.`A2` = 'Sokolov' | moderate | 100 |
For the female client who was born in 1976/1/29, which district did she opened her account? | financial | Female refers to gender = 'F'; A2 refers to district names | SELECT
`T1`.`A2`
FROM `district` AS `T1`
INNER JOIN `client` AS `T2`
ON `T1`.`district_id` = `T2`.`district_id`
WHERE
`T2`.`birth_date` = '1976-01-29' AND `T2`.`gender` = 'F' | simple | 112 |
For the branch which located in the south Bohemia with biggest number of inhabitants, what is the percentage of the male clients? | financial | Percentage of the male clients = DIVIDE(COUNT(male clients), COUNT(clients)) * 100; Male refers to gender = 'M', A3 is the region name. A4 contains the information about inhabitants. | SELECT
CAST(SUM(`T1`.`gender` = 'M') AS DOUBLE) * 100 / COUNT(`T1`.`client_id`)
FROM `client` AS `T1`
INNER JOIN `district` AS `T2`
ON `T1`.`district_id` = `T2`.`district_id`
WHERE
`T2`.`A3` = 'south Bohemia'
GROUP BY
`T2`.`A4`
ORDER BY
`T2`.`A4` DESC
LIMIT 1 | challenging | 115 |
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? | financial | Increase rate of his/her account balance = [(balance of date A - balance of date B) / balance of Date B] * 100% | SELECT
CAST((
SUM(CASE WHEN `T3`.`date` = '1998-12-27' THEN `T3`.`balance` ELSE 0 END) - SUM(CASE WHEN `T3`.`date` = '1993-03-22' THEN `T3`.`balance` ELSE 0 END)
) AS DOUBLE) * 100 / SUM(CASE WHEN `T3`.`date` = '1993-03-22' THEN `T3`.`balance` ELSE 0 END)
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` = '1993-07-05' | challenging | 116 |
What is the percentage of loan amount that has been fully paid with no issue. | financial | Loan paid with no issue means contract finished, no problems; status = 'A' means contract finished, no problems; Percentage of accounts by condition = [(total(amount) & condition) / (total amount)] * 100% | SELECT
(
CAST(SUM(CASE WHEN `status` = 'A' THEN `amount` ELSE 0 END) AS DOUBLE) * 100
) / SUM(`amount`)
FROM `loan` | moderate | 117 |
For loan amount less than USD100,000, what is the percentage of accounts that is still running with no issue. | financial | Status = 'C' stands for running contract, ok so far; Percentage of accounts by condition = [(total(amount) & condition) / (total amount)] * 100. | SELECT
CAST(SUM(`status` = 'C') AS DOUBLE) * 100 / COUNT(`account_id`)
FROM `loan`
WHERE
`amount` < 100000 | moderate | 118 |
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. | financial | 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' | SELECT
CAST((
`T3`.`A13` - `T3`.`A12`
) AS DOUBLE) * 100 / `T3`.`A12`
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' | challenging | 125 |
List the top nine districts, by descending order, from the highest to the lowest, the number of female account holders. | financial | 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 | 128 |
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? | financial | 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 | 136 |
How many accounts have running contracts in Branch location 1? | financial | Status = 'C' stands for running contract, OK so far; Status = 'D' stands for running contract, client in debt | SELECT
COUNT(`T1`.`account_id`)
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
`T1`.`district_id` = 1 AND (
`T3`.`status` = 'C' OR `T3`.`status` = 'D'
) | moderate | 137 |
In the branch where the second-highest number of crimes were committed in 1995 occurred, how many male clients are there? | financial | Male refers to gender = 'M'; A15 stands for no. of commited crimes 1995 | SELECT
COUNT(`T1`.`client_id`)
FROM `client` AS `T1`
INNER JOIN `district` AS `T2`
ON `T1`.`district_id` = `T2`.`district_id`
WHERE
`T1`.`gender` = 'M'
AND `T2`.`A15` = (
SELECT
`T3`.`A15`
FROM `district` AS `T3`
ORDER BY
`T3`.`A15` DESC
LIMIT 1
OFFSET 1
) | moderate | 138 |
Which are the top ten withdrawals (non-credit card) by district names for the month of January 1996? | financial | 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 DISTINCT
`T1`.`A2`
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%'
ORDER BY
`A2` ASC
LIMIT 10 | moderate | 129 |
How many accounts have running contracts in Branch location 1? | financial | Status = 'C' stands for running contract, OK so far; Status = 'D' stands for running contract, client in debt | SELECT
COUNT(`T1`.`account_id`)
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
`T1`.`district_id` = 1 AND (
`T3`.`status` = 'C' OR `T3`.`status` = 'D'
) | moderate | 137 |
In the branch where the second-highest number of crimes were committed in 1995 occurred, how many male clients are there? | financial | Male refers to gender = 'M'; A15 stands for no. of commited crimes 1995 | SELECT
COUNT(`T1`.`client_id`)
FROM `client` AS `T1`
INNER JOIN `district` AS `T2`
ON `T1`.`district_id` = `T2`.`district_id`
WHERE
`T1`.`gender` = 'M'
AND `T2`.`A15` = (
SELECT
`T3`.`A15`
FROM `district` AS `T3`
ORDER BY
`T3`.`A15` DESC
LIMIT 1
OFFSET 1
) | moderate | 138 |
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? | financial | Operation = 'VYBER KARTOU' refers to credit card withdrawal | SELECT
`T1`.`account_id`
FROM `trans` AS `T1`
INNER JOIN `account` AS `T2`
ON `T1`.`account_id` = `T2`.`account_id`
WHERE
DATE_FORMAT(CAST(`T1`.`date` AS DATETIME), '%Y') = '1998'
AND `T1`.`operation` = 'VYBER KARTOU'
AND `T1`.`amount` < (
SELECT
AVG(`amount`)
FROM `trans`
WHERE
DATE_FORMAT(CAST(`date` AS DATETIME), '%Y') = '1998'
) | moderate | 145 |
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. | financial | A11 represents the average salary; Salary and income share the similar meanings; when the account type = 'OWNER', it's eligible for loans | SELECT
`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 | 149 |
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? | financial | A3 refers to region names; A15 stands for the average number of crimes commited in 1995. | SELECT
AVG(`T1`.`A15`)
FROM `district` AS `T1`
INNER JOIN `account` AS `T2`
ON `T1`.`district_id` = `T2`.`district_id`
WHERE
DATE_FORMAT(CAST(`T2`.`date` AS DATETIME), '%Y') >= '1997' AND `T1`.`A15` > 4000 | moderate | 152 |
List all the withdrawals in cash transactions that the client with the id 3356 makes. | financial | 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 | 159 |
What percentage of clients who opened their accounts in the district with an average salary of over 10000 are women? | financial | Female refers to gender = 'F'; Woman and female are closed; Average salary can be found in A11 | SELECT
CAST(SUM(`T2`.`gender` = 'F') AS DOUBLE) * 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 | 168 |
What was the growth rate of the total amount of loans across all accounts for a male client between 1996 and 1997? | financial | 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 DATE_FORMAT(CAST(`T1`.`date` AS DATETIME), '%Y') = '1997'
THEN `T1`.`amount`
ELSE 0
END
) - SUM(
CASE
WHEN DATE_FORMAT(CAST(`T1`.`date` AS DATETIME), '%Y') = '1996'
THEN `T1`.`amount`
ELSE 0
END
)
) AS DOUBLE) * 100 / SUM(
CASE
WHEN DATE_FORMAT(CAST(`T1`.`date` AS DATETIME), '%Y') = '1996'
THEN `T1`.`amount`
ELSE 0
END
)
FROM `loan` AS `T1`
INNER JOIN `account` AS `T2`
ON `T1`.`account_id` = `T2`.`account_id`
INNER JOIN `disp` AS `T3`
ON `T3`.`account_id` = `T2`.`account_id`
INNER JOIN `client` AS `T4`
ON `T4`.`client_id` = `T3`.`client_id`
WHERE
`T4`.`gender` = 'M' AND `T3`.`type` = 'OWNER' | challenging | 169 |
How often does account number 3 request an account statement to be released? What was the aim of debiting 3539 in total? | financial | 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 | 173 |
What percentage of male clients request for weekly statements to be issued? | financial | 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 DOUBLE) * 100 / COUNT(`T1`.`client_id`)
FROM `client` AS `T1`
INNER JOIN `district` AS `T3`
ON `T1`.`district_id` = `T3`.`district_id`
INNER JOIN `account` AS `T2`
ON `T2`.`district_id` = `T3`.`district_id`
INNER JOIN `disp` AS `T4`
ON `T1`.`client_id` = `T4`.`client_id` AND `T2`.`account_id` = `T4`.`account_id`
WHERE
`T2`.`frequency` = 'POPLATEK TYDNE' | moderate | 186 |
Name the account numbers of female clients who are oldest and have lowest average salary? | financial | 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 | 189 |
What is the average amount of loan which are still on running contract with statement issuance after each transaction? | financial | 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 | 192 |
Provide the IDs and age of the client with high level credit card, which is eligible for loans. | financial | the credit card is high-level refers to card.type = 'gold'; eligible for loans refers to disp.type = 'OWNER' | SELECT
`T1`.`client_id`,
DATE_FORMAT(CAST(CURRENT_TIMESTAMP() AS DATETIME), '%Y') - DATE_FORMAT(CAST(`T3`.`birth_date` AS DATETIME), '%Y')
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 | 194 |