Chinastark/bird_dataset huggingface dataset:
Database: financial
Note: Female refers to gender = 'F';
Question: How many female customers have a junior credit card?
SQL: SELECT count(client.client_id) FROM client INNER JOIN disp ON client.client_id = disp.client_id INNER JOIN card ON disp.disp_id = card.disp_id WHERE client.gender = 'F' AND card.type = 'junior'
Database: financial
Note: Female refers to gender = 'F'; Percentage of female clients in Prague branch = count[female clients with accounts in Prague branch / count(clients with accounts in Prague branch)] * 100%; a3 may contain information about Prague;
Question: What proportion of customers who have accounts at the Prague branch are female?
SQL: SELECT cast(sum(client.gender = 'F') AS REAL) / count(client.client_id) * 100 FROM district INNER JOIN client ON district.district_id = client.district_id WHERE district.a3 = 'Prague'
Database: financial
Note: 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;
Question: What percentage of male clients request for weekly statements to be issued?
SQL: SELECT cast(sum(client.gender = 'M') AS REAL) * 100 / count(client.client_id) FROM client INNER JOIN district ON client.district_id = district.district_id INNER JOIN account ON account.district_id = district.district_id INNER JOIN disp ON client.client_id = disp.client_id AND account.account_id = disp.account_id WHERE account.frequency = 'POPLATEK TYDNE'
Database: financial
Note: frequency = 'POPLATEK TYDNE' refers to weekly issuance;
Question: How many clients who choose statement of weekly issuance are Owner?
SQL: SELECT count(disp.account_id) FROM account INNER JOIN disp ON disp.account_id = account.account_id WHERE account.frequency = 'POPLATEK TYDNE' AND disp.type = 'OWNER'
Database: financial
Question: Among the accounts who have loan validity more than 24 months, list out the accounts that have the lowest approved amount and have account opening date before 1997.
SQL: SELECT loan.account_id FROM loan INNER JOIN account ON loan.account_id = account.account_id WHERE loan.duration > 24 AND strftime('%Y', account.date) < '1997' ORDER BY loan.amount ASC LIMIT 1
Database: financial
Note: Female refers to 'F' in the gender; a11 contains information about average salary;
Question: Name the account numbers of female clients who are oldest and have lowest average salary?
SQL: SELECT account.account_id FROM client INNER JOIN district ON client.district_id = district.district_id INNER JOIN account ON district.district_id = account.district_id INNER JOIN disp ON client.client_id = disp.client_id AND disp.account_id = account.account_id  WHERE client.gender = 'F' ORDER BY client.birth_date ASC, district.a11 ASC LIMIT 1
Database: financial
Note: East Bohemia appears in the column a3, which refers to the region.;
Question: How many clients who were born in 1920 stay in east Bohemia?
SQL: SELECT count(client.client_id) FROM client INNER JOIN district ON client.district_id = district.district_id WHERE strftime('%Y', client.birth_date) = '1920' AND district.a3 = 'east Bohemia'
Database: financial
Note: frequency = 'POPLATEK TYDNE' referes to weekly statement;
Question: How many loan accounts are for pre-payment of duration of 24 months with weekly issuance of statement.
SQL: SELECT count(loan.account_id) FROM account INNER JOIN loan ON account.account_id = loan.account_id WHERE loan.duration = 24 AND account.frequency = 'POPLATEK TYDNE'
Database: financial
Note: 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;
Question: What is the average amount of loan which are still on running contract with statement issuance after each transaction?
SQL: SELECT avg(loan.amount) FROM account INNER JOIN loan ON account.account_id = loan.account_id WHERE loan.status IN ('C', 'D') AND account.frequency = 'POPLATEK PO OBRATU'
Database: financial
Note: Only the owner accounts have the right to issue permanent orders or apply for loans;
Question: List all ID and district for clients that can only have the right to issue permanent orders or apply for loans.
SQL: SELECT disp.client_id, district.district_id, district.a2 FROM account INNER JOIN district ON account.district_id = district.district_id INNER JOIN disp ON account.account_id = disp.account_id WHERE disp.type = 'OWNER'
Database: financial
Note: the credit card is high-level refers to card.type = 'gold'; eligible for loans refers to disp.type = 'OWNER';
Question: Provide the IDs and age of the client with high level credit card, which is eligible for loans.
SQL: SELECT disp.client_id, strftime('%Y', CURRENT_TIMESTAMP) - strftime('%Y', client.birth_date) FROM disp INNER JOIN card ON card.disp_id = disp.disp_id INNER JOIN client ON disp.client_id = client.client_id WHERE card.type = 'gold' AND disp.type = 'OWNER'
Database: toxicology
Note: most common bond type refers MAX(COUNT(bond_type));
Question: What is the most common bond type?
SQL: SELECT t.bond_type FROM ( SELECT bond_type, count(bond_id) FROM bond GROUP BY bond_type ORDER BY count(bond_id) DESC LIMIT 1 ) AS t
Database: toxicology
Note: non-carcinogenic molecules refers to label = '-'; chlorine atoms refers to element = 'cl';
Question: In the non-carcinogenic molecules, how many contain chlorine atoms?
SQL: SELECT count(DISTINCT molecule.molecule_id) FROM molecule INNER JOIN atom ON molecule.molecule_id = atom.molecule_id WHERE atom.element = 'cl' AND molecule.label = '-'
Database: toxicology
Note: single-bonded molecules refers to bond_type = '-' ; average number of oxygen atom = AVG(element = 'o');
Question: Calculate the average number of oxygen atoms in single-bonded molecules.
SQL: SELECT avg(oxygen_count) FROM (SELECT atom.molecule_id, count(atom.element) AS oxygen_count FROM atom INNER JOIN bond ON atom.molecule_id = bond.molecule_id  WHERE bond.bond_type = '-' AND atom.element = 'o'  GROUP BY atom.molecule_id) AS oxygen_counts
Database: toxicology
Note: carcinogenic molecules refers to label = '+'; single-bonded refers to bond_type = '-'; average = DIVIDE(SUM(bond_type = '-'), COUNT(atom_id));
Question: On average how many carcinogenic molecules are single bonded?
SQL: SELECT avg(single_bond_count) FROM (SELECT molecule.molecule_id, count(bond.bond_type) AS single_bond_count FROM bond  INNER JOIN atom ON bond.molecule_id = atom.molecule_id INNER JOIN molecule ON molecule.molecule_id = atom.molecule_id WHERE bond.bond_type = '-' AND molecule.label = '+' GROUP BY molecule.molecule_id) AS subquery
Database: toxicology
Note: non-carcinogenic refers to label = '-'; sodium atoms refers to element = 'na';
Question: In the molecule containing sodium atoms, how many are non-carcinogenic?
SQL: SELECT count(DISTINCT molecule.molecule_id) FROM atom INNER JOIN molecule ON atom.molecule_id = molecule.molecule_id WHERE atom.element = 'na' AND molecule.label = '-'
Database: toxicology
Note: triple-bonded molecules refers to bond_type = '#'; carcinogenic refers to label = '+';
Question: Find the triple-bonded molecules which are carcinogenic.
SQL: SELECT DISTINCT molecule.molecule_id FROM bond INNER JOIN molecule ON bond.molecule_id = molecule.molecule_id WHERE bond.bond_type = '#' AND molecule.label = '+'
Database: toxicology
Note: carbon refers to element = 'c'; double-bond molecules refers to bond_type = '='; percentage = DIVIDE(SUM(element = 'c'), COUNT(atom_id));
Question: What is the percentage of carbon in double-bond molecules?
SQL: SELECT cast(count(DISTINCT CASE WHEN atom.element = 'c' THEN atom.atom_id ELSE NULL END) AS REAL) * 100 / count(DISTINCT atom.atom_id) FROM atom INNER JOIN bond ON atom.molecule_id = bond.molecule_id WHERE bond.bond_type = '='
Database: toxicology
Note: triple type bonds refers to bond_type = '#';
Question: How many triple type bonds are there?
SQL: SELECT count(t.bond_id) FROM bond AS t WHERE t.bond_type = '#'
Database: toxicology
Note: atoms with no bromine refers to element ! = 'br';
Question: In how many atoms is there no bromine?
SQL: SELECT count(DISTINCT t.atom_id) FROM atom AS t WHERE t.element <> 'br'
Database: toxicology
Note: first 100 molecules in number order refers to molecule_id between 'TR000' and 'TR099'; label = '+' means molecules are carcinogenic;
Question: Of the first 100 molecules in number order, how many are carcinogenic?
SQL: SELECT count(t.molecule_id) FROM molecule AS t WHERE molecule_id BETWEEN 'TR000' AND 'TR099' AND t.label = '+'
Database: toxicology
Note: carbon refers to element = 'c';
Question: Identify by their ID the molecules in which there is carbon.
SQL: SELECT t.molecule_id FROM atom AS t WHERE t.element = 'c'
Database: toxicology
Note: TR004_8_9 bond atoms refers to bond_id = 'TR004_8_9';
Question: What elements are in the TR004_8_9 bond atoms?
SQL: SELECT DISTINCT atom.element FROM atom INNER JOIN connected ON atom.atom_id = connected.atom_id WHERE connected.bond_id = 'TR004_8_9'
Database: toxicology
Note: double type bond refers to bond_type = '=';
Question: What elements are in a double type bond?
SQL: SELECT DISTINCT atom.element FROM atom INNER JOIN bond ON atom.molecule_id = bond.molecule_id INNER JOIN connected ON atom.atom_id = connected.atom_id WHERE bond.bond_type = '='
Database: toxicology
Note: with hydrogen refers to element = 'h'; label most numerous in atoms refers to MAX(COUNT(label));
Question: Which type of label is the most numerous in atoms with hydrogen?
SQL: SELECT t.label FROM ( SELECT molecule.label, count(molecule.molecule_id) FROM atom INNER JOIN molecule ON atom.molecule_id = molecule.molecule_id WHERE atom.element = 'h' GROUP BY molecule.label ORDER BY count(molecule.molecule_id) DESC LIMIT 1 ) t
Database: toxicology
Note: type of bond refers to bond_type; chlorine refers to element = 'cl';
Question: Chlorine is in what type of bond?
SQL: SELECT DISTINCT bond.bond_type FROM bond INNER JOIN connected ON bond.bond_id = connected.bond_id INNER JOIN atom ON connected.atom_id = atom.atom_id WHERE atom.element = 'cl'
Database: toxicology
Note: single type bond refers to bond_type = '-';
Question: What atoms are connected in single type bonds?
SQL: SELECT connected.atom_id, connected.atom_id2 FROM bond INNER JOIN connected ON bond.bond_id = connected.bond_id WHERE bond.bond_type = '-'
Database: toxicology
Note: label = '-' means molecules are non-carcinogenic;
Question: Indicate which atoms are connected in non-carcinogenic type molecules.
SQL: SELECT DISTINCT atom.atom_id FROM atom INNER JOIN molecule ON atom.molecule_id = molecule.molecule_id INNER JOIN connected ON atom.atom_id = connected.atom_id WHERE molecule.label = '-'
Database: toxicology
Note: label = '-' means molecules are non-carcinogenic; least numerous refers to MIN(COUNT(element));
Question: Which element is the least numerous in non-carcinogenic molecules?
SQL: SELECT t.element FROM (SELECT atom.element, count(DISTINCT atom.molecule_id) FROM atom INNER JOIN molecule ON atom.molecule_id = molecule.molecule_id WHERE molecule.label = '-' GROUP BY atom.element ORDER BY count(DISTINCT atom.molecule_id) ASC LIMIT 1) t
Database: toxicology
Note: 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;
Question: What type of bond is there between the atoms TR004_8 and TR004_20?
SQL: SELECT bond.bond_type FROM bond INNER JOIN connected ON bond.bond_id = connected.bond_id WHERE connected.atom_id = 'TR004_8' AND connected.atom_id2 = 'TR004_20' OR connected.atom_id2 = 'TR004_8' AND connected.atom_id = 'TR004_20'
Database: toxicology
Note: tin refers to element ! = 'sn'; label = '+' mean molecules are carcinogenic; label = '-' means molecules are non-carcinogenic;
Question: What type of label is not on molecules with atoms with tin?
SQL: SELECT DISTINCT molecule.label FROM atom INNER JOIN molecule ON atom.molecule_id = molecule.molecule_id WHERE atom.element != 'sn'
Database: toxicology
Note: 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;
Question: How many atoms with iodine and with sulfur type elements are there in single bond molecules?
SQL: SELECT count(DISTINCT CASE WHEN atom.element = 'i' THEN atom.atom_id ELSE NULL END) AS iodine_nums , count(DISTINCT CASE WHEN atom.element = 's' THEN atom.atom_id ELSE NULL END) AS sulfur_nums FROM atom INNER JOIN connected ON atom.atom_id = connected.atom_id INNER JOIN bond ON connected.bond_id = bond.bond_id WHERE bond.bond_type = '-'
Database: toxicology
Note: triple bond refers to bond_type = '#';
Question: Identify all connected atoms with a triple bond.
SQL: SELECT connected.atom_id, connected.atom_id2 FROM bond INNER JOIN connected ON bond.bond_id = connected.bond_id WHERE bond.bond_type = '#'
Database: toxicology
Note: TR181 molecule refers to molecule_id = 'TR181';
Question: Identify all the atoms that are connected to the atoms of the TR181 molecule.
SQL: SELECT connected.atom_id, connected.atom_id2 FROM atom INNER JOIN connected ON connected.atom_id = atom.atom_id WHERE atom.molecule_id = 'TR181'
Database: toxicology
Note: 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;
Question: What percentage of carcinogenic-type molecules does not contain fluorine?
SQL: SELECT cast(count(DISTINCT CASE WHEN atom.element <> 'f' THEN molecule.molecule_id ELSE NULL END) AS REAL) * 100 / count(DISTINCT molecule.molecule_id) FROM atom INNER JOIN molecule ON atom.molecule_id = molecule.molecule_id WHERE molecule.label = '+'
Database: toxicology
Note: label = '+' mean molecules are carcinogenic; triple bond refers to bond_type = '#'; percentage = DIVIDE(SUM(bond_type = '#') * 100, COUNT(bond_id)) as percent where label = '+';
Question: What is the percentage of carcinogenic molecules in triple type bonds?
SQL: SELECT cast(count(DISTINCT CASE WHEN molecule.label = '+' THEN molecule.molecule_id ELSE NULL END) AS REAL) * 100 / count(DISTINCT molecule.molecule_id) FROM atom INNER JOIN molecule ON atom.molecule_id = molecule.molecule_id INNER JOIN bond ON molecule.molecule_id = bond.molecule_id WHERE bond.bond_type = '#'
Database: toxicology
Note: TR000 is the molecule id;
Question: Please list top three elements of the toxicology of the molecule TR000 in alphabetical order.
SQL: SELECT DISTINCT t.element FROM atom AS t WHERE t.molecule_id = 'TR000' ORDER BY t.element LIMIT 3
Database: toxicology
Note: TR001 is the molecule id; TR001_2_6 is the bond id;
Question: What are the atoms that are bonded in the molecule TR001 with the bond ID of TR001_2_6?
SQL: SELECT substr(t.bond_id, 1, 7) AS atom_id1 , t.molecule_id || substr(t.bond_id, 8, 2) AS atom_id2 FROM bond AS t WHERE t.molecule_id = 'TR001' AND t.bond_id = 'TR001_2_6'
Database: toxicology
Note: label = '+' means molecules are carcinogenic; label = '-' means molecules are non-carcinogenic; difference = SUBTRACT(SUM(label = '+'), SUM(label = '-'));
Question: What is the difference between the number of molecules that are carcinogenic and those that are not?
SQL: SELECT count(CASE WHEN t.label = '+' THEN t.molecule_id ELSE NULL END) - count(CASE WHEN t.label = '-' THEN t.molecule_id ELSE NULL END) AS diff_car_notcar FROM molecule t
Database: toxicology
Note: TR000_2_5 is the bond id;
Question: What are the atom IDs of the bond TR000_2_5?
SQL: SELECT t.atom_id FROM connected AS t WHERE t.bond_id = 'TR000_2_5'
Database: toxicology
Note: TR000_2 is the atom id; atom ID 2 refers to atom_id2;
Question: What are the bond IDs that have the same atom ID 2 of TR000_2?
SQL: SELECT t.bond_id FROM connected AS t WHERE t.atom_id2 = 'TR000_2'
Database: toxicology
Note: double bond refers to bond_type = ' = ';
Question: Please list top five molecules that have double bonds in alphabetical order.
SQL: SELECT DISTINCT t.molecule_id FROM bond AS t WHERE t.bond_type = '=' ORDER BY t.molecule_id LIMIT 5
Database: toxicology
Note: 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';
Question: What is the percentage of double bonds in the molecule TR008? Please provide your answer as a percentage with five decimal places.
SQL: SELECT round(cast(count(CASE WHEN t.bond_type = '=' THEN t.bond_id ELSE NULL END) AS REAL) * 100 / count(t.bond_id),5) FROM bond AS t WHERE t.molecule_id = 'TR008'
Database: toxicology
Note: label = '+' mean molecules are carcinogenic; percentage = DIVIDE(SUM(label = '+'), COUNT(molecule_id)) as percent;
Question: What is the percentage of molecules that are carcinogenic? Please provide your answer as a percentage with three decimal places.
SQL: SELECT round(cast(count(CASE WHEN t.label = '+' THEN t.molecule_id ELSE NULL END) AS REAL) * 100 / count(t.molecule_id),3) FROM molecule t
Database: toxicology
Note: hydrogen refers to element = 'h'; TR206 is the molecule id; percentage = DIVIDE(SUM(element = 'h'), COUNT(atom_id)) as percent where molecule_id = 'TR206';
Question: How much of the hydrogen in molecule TR206 is accounted for? Please provide your answer as a percentage with four decimal places.
SQL: SELECT round(cast(count(CASE WHEN t.element = 'h' THEN t.atom_id ELSE NULL END) AS REAL) * 100 / count(t.atom_id),4) FROM atom AS t WHERE t.molecule_id = 'TR206'
Database: toxicology
Note: type of bond refers to bond_type; TR000 is the molecule id;
Question: What is the type of bond that molecule TR000 has when involved in any bonds?
SQL: SELECT DISTINCT t.bond_type FROM bond AS t WHERE t.molecule_id = 'TR000'
Database: toxicology
Note: TR060 is the molecule id;
Question: What are the elements of the toxicology and label of molecule TR060?
SQL: SELECT DISTINCT atom.element, molecule.label FROM atom INNER JOIN molecule ON atom.molecule_id = molecule.molecule_id WHERE molecule.molecule_id = 'TR060'
Database: toxicology
Note: TR010 is the molecule id; majority of the bond found refers to MAX(COUNT(bond_type));
Question: Which bond type accounted for the majority of the bonds found in molecule TR010 and state whether or not this molecule is carcinogenic?
SQL: SELECT t.bond_type FROM ( SELECT bond.bond_type, count(bond.molecule_id) FROM bond  WHERE bond.molecule_id = 'TR010' GROUP BY bond.bond_type ORDER BY count(bond.molecule_id) DESC LIMIT 1 ) AS t
Database: toxicology
Note: 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;
Question: Please list top three molecules that have single bonds between two atoms and are not carcinogenic in alphabetical order.
SQL: SELECT DISTINCT molecule.molecule_id FROM bond INNER JOIN molecule ON bond.molecule_id = molecule.molecule_id WHERE bond.bond_type = '-' AND molecule.label = '-' ORDER BY molecule.molecule_id LIMIT 3
Database: toxicology
Note: TR006 is the molecule id;
Question: Please list top two bonds that happened with the molecule TR006 in alphabetical order.
SQL: SELECT DISTINCT connected.bond_id FROM atom INNER JOIN connected ON atom.atom_id = connected.atom_id WHERE atom.molecule_id = 'TR006' ORDER BY connected.bond_id LIMIT 2
Database: toxicology
Note: TR009 is the molecule id;  involved atom 12 refers to atom_id = 'TR009_12' or atom_id2 = 'TR009_12';
Question: How many bonds which involved atom 12 does molecule TR009 have?
SQL: SELECT count(connected.bond_id) FROM bond INNER JOIN connected ON bond.bond_id = connected.bond_id WHERE bond.molecule_id = 'TR009' AND connected.atom_id = bond.molecule_id || '_1' AND connected.atom_id2 = bond.molecule_id || '_2'
Database: toxicology
Note: label = '+' mean molecules are carcinogenic; have bromine element refers to element = 'br';
Question: How many molecules are carcinogenic and have the bromine element?
SQL: SELECT count(DISTINCT molecule.molecule_id) FROM atom INNER JOIN molecule ON atom.molecule_id = molecule.molecule_id WHERE molecule.label = '+' AND atom.element = 'br'
Database: toxicology
Note: atoms refer to atom_id or atom_id2;
Question: What are the bond type and the atoms of the bond ID of TR001_6_9?
SQL: SELECT bond.bond_type, connected.atom_id, connected.atom_id2 FROM bond INNER JOIN connected ON bond.bond_id = connected.bond_id WHERE connected.bond_id = 'TR001_6_9'
Database: toxicology
Note: TR001_10 is the atom id; label = '+' mean molecules are carcinogenic;
Question: Which molecule does the atom TR001_10 belong to? Please state whether this molecule is carcinogenic or not.
SQL: SELECT molecule.molecule_id , iif(molecule.label = '+', 'YES', 'NO') AS flag_carcinogenic FROM atom INNER JOIN molecule ON atom.molecule_id = molecule.molecule_id WHERE atom.atom_id = 'TR001_10'
Database: toxicology
Note: triple bond refers to bond_type = '#';
Question: How many molecules have a triple bond type?
SQL: SELECT count(DISTINCT t.molecule_id) FROM bond AS t WHERE t.bond_type = '#'
Database: toxicology
Note: connections refers to bond_id; atom 19 refers to atom_id like 'TR%_19';
Question: How many connections does the atom 19 have?
SQL: SELECT count(t.bond_id) FROM connected AS t WHERE substr(t.atom_id, -2) = '19'
Database: toxicology
Note: TR004 is the molecule id;
Question: List all the elements of the toxicology of the molecule "TR004".
SQL: SELECT DISTINCT t.element FROM atom AS t WHERE t.molecule_id = 'TR004'
Database: toxicology
Note: label = '-' means molecules are non-carcinogenic;
Question: How many of the molecules are not carcinogenic?
SQL: SELECT count(t.molecule_id) FROM molecule AS t WHERE t.label = '-'
Database: toxicology
Note: atoms from 21 to 25 refers to SUBSTR(atom_id, 7, 2) between '21' and '25'; label = '+' mean molecules are carcinogenic;
Question: Among all the atoms from 21 to 25, list all the molecules that are carcinogenic.
SQL: SELECT DISTINCT molecule.molecule_id FROM atom INNER JOIN molecule ON atom.molecule_id = molecule.molecule_id WHERE substr(atom.atom_id, -2) BETWEEN '21' AND '25' AND molecule.label = '+'
Database: toxicology
Note: have phosphorus as atom elements refers to element = 'p'; have nitrogen as atom elements refers to element = 'n';
Question: What are the bonds that have phosphorus and nitrogen as their atom elements?
SQL: SELECT connected.bond_id FROM atom INNER JOIN connected ON atom.atom_id = connected.atom_id WHERE connected.bond_id IN ( SELECT connected.bond_id FROM connected INNER JOIN atom ON connected.atom_id = atom.atom_id WHERE atom.element = 'p' ) AND atom.element = 'n'
Database: toxicology
Note: double bond refers to bond_type = ' = '; label = '+' mean molecules are carcinogenic;
Question: Is the molecule with the most double bonds carcinogenic?
SQL: SELECT molecule.label FROM molecule 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 molecule.molecule_id = t2.molecule_id
Database: toxicology
Note: atoms with the element iodine refers to element = 'i'; average = DIVIDE(COUND(bond_id), COUNT(atom_id)) where element = 'i';
Question: What is the average number of bonds the atoms with the element iodine have?
SQL: SELECT cast(count(connected.bond_id) AS REAL) / count(atom.atom_id) FROM atom INNER JOIN connected ON atom.atom_id = connected.atom_id WHERE atom.element = 'i'
Database: toxicology
Note: bond ID of atom 45 refers to SUBSTR(atom_id, 7, 2) + 0 = 45; double bond refers to bond_type = ' = '; single bond refers to bond_type = '-'; triple bond refers to bond_type = '#';
Question: List the bond type and the bond ID of the atom 45.
SQL: SELECT bond.bond_type, bond.bond_id FROM bond INNER JOIN connected ON bond.bond_id = connected.bond_id WHERE substr(connected.atom_id, 7, 2) = '45'
Database: toxicology
Note: atoms cannot bond with other atoms means atom_id NOT in connected table;
Question: List all the elements of atoms that can not bond with any other atoms.
SQL: SELECT DISTINCT t.element FROM atom AS t WHERE t.element NOT IN ( SELECT DISTINCT atom.element FROM atom INNER JOIN connected ON atom.atom_id = connected.atom_id )