Dludora/Bird-minidev-sqlserver-oracle huggingface dataset:
Database: student_club

Question: Indicate the top source of funds received in September 2019 based on their amount.
Evidence: top source funds refers to MAX(source); September 2019 means date_received BETWEEN '2019-09-01' and '2019-09-30'
SQL (SQLite): SELECT source FROM income WHERE date_received BETWEEN '2019-09-01' and '2019-09-30' ORDER BY source DESC LIMIT 1
SQL (SQL Server): SELECT source FROM income WHERE date_received BETWEEN '2019-09-01' and '2019-09-30' ORDER BY source DESC OFFSET 0 ROWS FETCH NEXT 1 ROWS ONLY
SQL (Oracle): SELECT source FROM income WHERE date_received BETWEEN '2019-09-01' and '2019-09-30' ORDER BY source DESC NULLS LAST FETCH FIRST 1 ROWS ONLY

Question: How many members of the Student_Club have major in 'Physics Teaching'?
Evidence: 'Physics Teaching' is the major_name;
SQL (SQLite): SELECT COUNT(T2.member_id) FROM major AS T1 INNER JOIN member AS T2 ON T1.major_id = T2.link_to_major WHERE T1.major_name = 'Physics Teaching'
SQL (SQL Server): SELECT COUNT(T2.member_id) AS _agg1 FROM major AS T1 INNER JOIN member AS T2 ON T1.major_id = T2.link_to_major WHERE T1.major_name = 'Physics Teaching'
SQL (Oracle): SELECT COUNT(T2.member_id) FROM major T1 INNER JOIN member T2 ON T1.major_id = T2.link_to_major WHERE T1.major_name = 'Physics Teaching'

Question: Name the event with the highest amount spent on advertisement.
Evidence: Name of event refers to event_name; highest amount spent on advertisement refers to MAX(spent) where category = 'Advertisement'
SQL (SQLite): SELECT T2.event_name FROM budget AS T1 INNER JOIN event AS T2 ON T1.link_to_event = T2.event_id WHERE T1.category = 'Advertisement' ORDER BY T1.spent DESC LIMIT 1
SQL (SQL Server): SELECT T2.event_name FROM budget AS T1 INNER JOIN event AS T2 ON T1.link_to_event = T2.event_id WHERE T1.category = 'Advertisement' ORDER BY T1.spent DESC OFFSET 0 ROWS FETCH NEXT 1 ROWS ONLY
SQL (Oracle): SELECT T2.event_name FROM budget T1 INNER JOIN event T2 ON T1.link_to_event = T2.event_id WHERE T1.category = 'Advertisement' ORDER BY T1.spent DESC NULLS LAST FETCH FIRST 1 ROWS ONLY

Question: Did Maya Mclean attend the 'Women's Soccer' event?
Evidence: Maya Mclean is the full name; full name refers to first_name, last_name; 'Women's Soccer' is an event_name
SQL (SQLite): SELECT CASE WHEN T3.event_name = 'Women''s Soccer' THEN 'YES' END AS result FROM member AS T1 INNER JOIN attendance AS T2 ON T1.member_id = T2.link_to_member INNER JOIN event AS T3 ON T2.link_to_event = T3.event_id WHERE T1.first_name = 'Maya' AND T1.last_name = 'Mclean'
SQL (SQL Server): SELECT CASE WHEN T3.event_name = 'Women''s Soccer' THEN 'YES' END AS result FROM member AS T1 INNER JOIN attendance AS T2 ON T1.member_id = T2.link_to_member INNER JOIN event AS T3 ON T2.link_to_event = T3.event_id WHERE T1.first_name = 'Maya' AND T1.last_name = 'Mclean'
SQL (Oracle): SELECT CASE WHEN T3.event_name = 'Women''s Soccer' THEN 'YES' END AS result FROM member T1 INNER JOIN attendance T2 ON T1.member_id = T2.link_to_member INNER JOIN event T3 ON T2.link_to_event = T3.event_id WHERE T1.first_name = 'Maya' AND T1.last_name = 'Mclean'
Database: student_club

Question: Indicate the cost of posters for 'September Speaker' event.
Evidence: 'Posters' is the expense description; 'September Speaker' is an event name
SQL (SQLite): SELECT T3.cost FROM event AS T1 INNER JOIN budget AS T2 ON T1.event_id = T2.link_to_event INNER JOIN expense AS T3 ON T2.budget_id = T3.link_to_budget WHERE T1.event_name = 'September Speaker' AND T3.expense_description = 'Posters'
SQL (SQL Server): SELECT T3.cost FROM event AS T1 INNER JOIN budget AS T2 ON T1.event_id = T2.link_to_event INNER JOIN expense AS T3 ON T2.budget_id = T3.link_to_budget WHERE T1.event_name = 'September Speaker' AND T3.expense_description = 'Posters'
SQL (Oracle): SELECT T3.cost FROM event T1 INNER JOIN budget T2 ON T1.event_id = T2.link_to_event INNER JOIN expense T3 ON T2.budget_id = T3.link_to_budget WHERE T1.event_name = 'September Speaker' AND T3.expense_description = 'Posters'

Question: Indicate the name of the closed event whose cost has exceeded the budget the most.
Evidence: closed events refers to event_name where status = 'Closed'; exceed the budget the most refers to MIN(remaining) where remaining < 0
SQL (SQLite): SELECT T2.event_name FROM budget AS T1 INNER JOIN event AS T2 ON T2.event_id = T1.link_to_event WHERE T1.event_status = 'Closed' AND T1.remaining < 0 ORDER BY T1.remaining LIMIT 1
SQL (SQL Server): SELECT T2.event_name FROM budget AS T1 INNER JOIN event AS T2 ON T2.event_id = T1.link_to_event WHERE T1.event_status = 'Closed' AND T1.remaining < 0 ORDER BY T1.remaining OFFSET 0 ROWS FETCH NEXT 1 ROWS ONLY
SQL (Oracle): SELECT T2.event_name FROM budget T1 INNER JOIN event T2 ON T2.event_id = T1.link_to_event WHERE T1.event_status = 'Closed' AND T1.remaining < 0 ORDER BY T1.remaining NULLS FIRST FETCH FIRST 1 ROWS ONLY

Question: Identify the type of expenses and their total value approved for 'October Meeting' event.
Evidence: total value refers to SUM(cost); 'October Meeting' is an event name;
SQL (SQLite): SELECT T1.type, SUM(T3.cost) FROM event AS T1 INNER JOIN budget AS T2 ON T1.event_id = T2.link_to_event INNER JOIN expense AS T3 ON T2.budget_id = T3.link_to_budget WHERE T1.event_name = 'October Meeting'
SQL (SQL Server): SELECT MIN(T1.type) AS type, SUM(T3.cost) AS _agg1 FROM event AS T1 INNER JOIN budget AS T2 ON T1.event_id = T2.link_to_event INNER JOIN expense AS T3 ON T2.budget_id = T3.link_to_budget WHERE T1.event_name = 'October Meeting'
SQL (Oracle): SELECT MIN(T1."TYPE") type, SUM(T3.cost) FROM event T1 INNER JOIN budget T2 ON T1.event_id = T2.link_to_event INNER JOIN expense T3 ON T2.budget_id = T3.link_to_budget WHERE T1.event_name = 'October Meeting'
Database: student_club

Question: Calculate the amount budgeted for 'April Speaker' event. List all the budgeted categories for said event in an ascending order based on their amount budgeted.
Evidence: 'April Speaker' is an event name; amount budgeted refers to SUM(amount); budget categories refers to category
SQL (SQLite): SELECT T2.category, SUM(T2.amount) FROM event AS T1 JOIN budget AS T2 ON T1.event_id = T2.link_to_event WHERE T1.event_name = 'April Speaker' GROUP BY T2.category ORDER BY SUM(T2.amount) ASC
SQL (SQL Server): SELECT T2.category, SUM(T2.amount) AS _agg1 FROM event AS T1 JOIN budget AS T2 ON T1.event_id = T2.link_to_event WHERE T1.event_name = 'April Speaker' GROUP BY T2.category ORDER BY SUM(T2.amount) ASC
SQL (Oracle): SELECT T2.category, SUM(T2.amount) FROM event T1 JOIN budget T2 ON T1.event_id = T2.link_to_event WHERE T1.event_name = 'April Speaker' GROUP BY T2.category ORDER BY SUM(T2.amount) ASC

Question: Mention the total expense used on 8/20/2019.
Evidence: total expense refers SUM(cost) where expense_date = '2019-08-20'
SQL (SQLite): SELECT SUM(cost) FROM expense WHERE expense_date = '2019-08-20'
SQL (SQL Server): SELECT SUM(cost) AS _agg1 FROM expense WHERE expense_date = '2019-08-20'
SQL (Oracle): SELECT SUM(cost) FROM expense WHERE expense_date = '2019-08-20'

Question: List out the full name and total cost that member id "rec4BLdZHS2Blfp4v" incurred?
Evidence: full name refers to first_name, last name
SQL (SQLite): SELECT T1.first_name, T1.last_name, SUM(T2.cost) FROM member AS T1 INNER JOIN expense AS T2 ON T1.member_id = T2.link_to_member WHERE T1.member_id = 'rec4BLdZHS2Blfp4v'
SQL (SQL Server): SELECT MIN(T1.first_name) AS first_name, MIN(T1.last_name) AS last_name, SUM(T2.cost) AS _agg1 FROM member AS T1 INNER JOIN expense AS T2 ON T1.member_id = T2.link_to_member WHERE T1.member_id = 'rec4BLdZHS2Blfp4v'
SQL (Oracle): SELECT MIN(T1.first_name) first_name, MIN(T1.last_name) last_name, SUM(T2.cost) FROM member T1 INNER JOIN expense T2 ON T1.member_id = T2.link_to_member WHERE T1.member_id = 'rec4BLdZHS2Blfp4v'

Question: State what kind of expenses that Sacha Harrison incurred?
Evidence: kind of expenses refers to expense_description; Sacha Harrison is the full name; full name refers to first_name, last_name;
SQL (SQLite): SELECT T2.expense_description FROM member AS T1 INNER JOIN expense AS T2 ON T1.member_id = T2.link_to_member WHERE T1.first_name = 'Sacha' AND T1.last_name = 'Harrison'
SQL (SQL Server): SELECT T2.expense_description FROM member AS T1 INNER JOIN expense AS T2 ON T1.member_id = T2.link_to_member WHERE T1.first_name = 'Sacha' AND T1.last_name = 'Harrison'
SQL (Oracle): SELECT T2.expense_description FROM member T1 INNER JOIN expense T2 ON T1.member_id = T2.link_to_member WHERE T1.first_name = 'Sacha' AND T1.last_name = 'Harrison'
Database: student_club

Question: State the category of events were held at MU 215.
Evidence: 'MU 215' is the location of event; 
SQL (SQLite): SELECT DISTINCT T2.category FROM event AS T1 INNER JOIN budget AS T2 ON T1.event_id = T2.link_to_event WHERE T1.location = 'MU 215'
SQL (SQL Server): SELECT DISTINCT T2.category FROM event AS T1 INNER JOIN budget AS T2 ON T1.event_id = T2.link_to_event WHERE T1.location = 'MU 215'
SQL (Oracle): SELECT DISTINCT T2.category FROM event T1 INNER JOIN budget T2 ON T1.event_id = T2.link_to_event WHERE T1.location = 'MU 215'

Question: List the last name of members with a major in environmental engineering and include its department and college name.
Evidence: 'Environmental Engineering' is the major_name;
SQL (SQLite): SELECT T2.last_name, T1.department, T1.college FROM major AS T1 INNER JOIN member AS T2 ON T1.major_id = T2.link_to_major WHERE T2.position = 'Member' AND T1.major_name = 'Environmental Engineering'
SQL (SQL Server): SELECT T2.last_name, T1.department, T1.college FROM major AS T1 INNER JOIN member AS T2 ON T1.major_id = T2.link_to_major WHERE T2.position = 'Member' AND T1.major_name = 'Environmental Engineering'
SQL (Oracle): SELECT T2.last_name, T1.department, T1.college FROM major T1 INNER JOIN member T2 ON T1.major_id = T2.link_to_major WHERE T2.position = 'Member' AND T1.major_name = 'Environmental Engineering'

Question: What are the budget category of the events located at MU 215 and a guest speaker type with a 0 budget spent?
Evidence: budget category refers to category; events located at refers to location; type = 'Guest Speaker'; 0 budget spent refers to spent = 0; 
SQL (SQLite): SELECT DISTINCT T2.category, T1.type FROM event AS T1 INNER JOIN budget AS T2 ON T1.event_id = T2.link_to_event WHERE T1.location = 'MU 215' AND T2.spent = 0 AND T1.type = 'Guest Speaker'
SQL (SQL Server): SELECT DISTINCT T2.category, T1.type FROM event AS T1 INNER JOIN budget AS T2 ON T1.event_id = T2.link_to_event WHERE T1.location = 'MU 215' AND T2.spent = 0 AND T1.type = 'Guest Speaker'
SQL (Oracle): SELECT DISTINCT T2.category, T1."TYPE" FROM event T1 INNER JOIN budget T2 ON T1.event_id = T2.link_to_event WHERE T1.location = 'MU 215' AND T2.spent = 0 AND T1."TYPE" = 'Guest Speaker'
Database: student_club

Question: Among the members with t-shirt size of medium, what is the percentage of the amount 50 received by the Student_Club?
Evidence: t_shirt_size = 'Medium' where position = 'Member'; percentage = DIVIDE(COUNT(amount = 50), COUNT(member_id)) * 100
SQL (SQLite): SELECT CAST(SUM(CASE WHEN T2.amount = 50 THEN 1.0 ELSE 0 END) AS REAL) * 100 / COUNT(T2.income_id) FROM member AS T1 INNER JOIN income AS T2 ON T1.member_id = T2.link_to_member WHERE T1.position = 'Member' AND T1.t_shirt_size = 'Medium'
SQL (SQL Server): SELECT TRY_CAST(SUM(CASE WHEN T2.amount = 50 THEN 1.0 ELSE 0 END) AS FLOAT) * 100 / COUNT(T2.income_id) AS _agg1 FROM member AS T1 INNER JOIN income AS T2 ON T1.member_id = T2.link_to_member WHERE T1.position = 'Member' AND T1.t_shirt_size = 'Medium'
SQL (Oracle): SELECT CAST(SUM(CASE WHEN T2.amount = 50 THEN CAST(1.0 AS BINARY_DOUBLE) ELSE 0.0 END) AS BINARY_DOUBLE) * 100 / COUNT(T2.income_id) FROM member T1 INNER JOIN income T2 ON T1.member_id = T2.link_to_member WHERE T1.position = 'Member' AND T1.t_shirt_size = 'Medium'

Question: List the names of closed event as "game" that was closed from 3/15/2019 to 3/20/2020.
Evidence: name of events refers event_name; game event that was closed refers to type = 'Game' where status = 'Closed'; event_date BETWEEN '2019-03-15' and '2020-03-20'; 
SQL (SQLite): SELECT DISTINCT event_name FROM event WHERE type = 'Game' AND date(SUBSTR(event_date, 1, 10)) BETWEEN '2019-03-15' AND '2020-03-20' AND status = 'Closed'
SQL (SQL Server): SELECT DISTINCT event_name FROM event WHERE type = 'Game' AND CONVERT(DATE, SUBSTRING(event_date, 1, 10)) BETWEEN '2019-03-15' AND '2020-03-20' AND status = 'Closed'
SQL (Oracle): SELECT DISTINCT event_name FROM event WHERE "TYPE" = 'Game' AND SUBSTR(SUBSTR(event_date, 1, 10), 1, 10) BETWEEN '2019-03-15' AND '2020-03-20' AND status = 'Closed'
Database: student_club

Question: Give the full name and contact number of members who had to spend more than average on each expense.
Evidence: full name refers to first_name, last_name; contact number refers to phone; had spent more than average on each expense refers to cost > AVG(cost)
SQL (SQLite): SELECT DISTINCT T3.first_name, T3.last_name, T3.phone FROM expense AS T1 INNER JOIN budget AS T2 ON T1.link_to_budget = T2.budget_id INNER JOIN member AS T3 ON T3.member_id = T1.link_to_member WHERE T1.cost > ( SELECT AVG(T1.cost) FROM expense AS T1 INNER JOIN budget AS T2 ON T1.link_to_budget = T2.budget_id INNER JOIN member AS T3 ON T3.member_id = T1.link_to_member )
SQL (SQL Server): SELECT DISTINCT T3.first_name, T3.last_name, T3.phone FROM expense AS T1 INNER JOIN budget AS T2 ON T1.link_to_budget = T2.budget_id INNER JOIN member AS T3 ON T3.member_id = T1.link_to_member WHERE T1.cost > ( SELECT AVG(TRY_CAST(T1.cost AS FLOAT)) AS _agg1 FROM expense AS T1 INNER JOIN budget AS T2 ON T1.link_to_budget = T2.budget_id INNER JOIN member AS T3 ON T3.member_id = T1.link_to_member )
SQL (Oracle): SELECT DISTINCT T3.first_name, T3.last_name, T3.phone FROM expense T1 INNER JOIN budget T2 ON T1.link_to_budget = T2.budget_id INNER JOIN member T3 ON T3.member_id = T1.link_to_member WHERE T1.cost > ( SELECT AVG(T1.cost) FROM expense T1 INNER JOIN budget T2 ON T1.link_to_budget = T2.budget_id INNER JOIN member T3 ON T3.member_id = T1.link_to_member )

Question: Write the full name of the member who spent money for water, veggie tray and supplies and include the cost of it.
Evidence: full name refers to first_name, last name; spent money for refers expense description; expense_description = 'Water, Veggie tray, supplies'
SQL (SQLite): SELECT T2.first_name, T2.last_name, T1.cost FROM expense AS T1 INNER JOIN member AS T2 ON T1.link_to_member = T2.member_id WHERE T1.expense_description = 'Water, Veggie tray, supplies'
SQL (SQL Server): SELECT T2.first_name, T2.last_name, T1.cost FROM expense AS T1 INNER JOIN member AS T2 ON T1.link_to_member = T2.member_id WHERE T1.expense_description = 'Water, Veggie tray, supplies'
SQL (Oracle): SELECT T2.first_name, T2.last_name, T1.cost FROM expense T1 INNER JOIN member T2 ON T1.link_to_member = T2.member_id WHERE T1.expense_description = 'Water, Veggie tray, supplies'
Database: student_club

Question: Write the full names of students who received funds on the date of 9/9/2019 and include the amount received.
Evidence: full name refers to first_name, last_name, amount of funds received refers to amount, received funds on date refers to date_received
SQL (SQLite): SELECT DISTINCT T3.first_name, T3.last_name, T4.amount FROM event AS T1 INNER JOIN attendance AS T2 ON T1.event_id = T2.link_to_event INNER JOIN member AS T3 ON T3.member_id = T2.link_to_member INNER JOIN income AS T4 ON T4.link_to_member = T3.member_id WHERE T4.date_received = '2019-09-09'
SQL (SQL Server): SELECT DISTINCT T3.first_name, T3.last_name, T4.amount FROM event AS T1 INNER JOIN attendance AS T2 ON T1.event_id = T2.link_to_event INNER JOIN member AS T3 ON T3.member_id = T2.link_to_member INNER JOIN income AS T4 ON T4.link_to_member = T3.member_id WHERE T4.date_received = '2019-09-09'
SQL (Oracle): SELECT DISTINCT T3.first_name, T3.last_name, T4.amount FROM event T1 INNER JOIN attendance T2 ON T1.event_id = T2.link_to_event INNER JOIN member T3 ON T3.member_id = T2.link_to_member INNER JOIN income T4 ON T4.link_to_member = T3.member_id WHERE T4.date_received = '2019-09-09'
Database: thrombosis_prediction

Question: Are there more in-patient or outpatient who were male? What is the deviation in percentage?
Evidence: male refers to SEX = 'M'; in-patient refers to Admission = '+'; outpatient refers to Admission = '-'; percentage = DIVIDE(COUNT(ID) where SEX = 'M' and Admission = '+', COUNT(ID) where SEX  = 'M' and Admission = '-')
SQL (SQLite): SELECT CAST(SUM(CASE WHEN Admission = '+' THEN 1 ELSE 0 END) AS REAL) * 100 / SUM(CASE WHEN Admission = '-' THEN 1 ELSE 0 END) FROM Patient WHERE SEX = 'M'
SQL (SQL Server): SELECT TRY_CAST(SUM(CASE WHEN Admission = '+' THEN 1 ELSE 0 END) AS FLOAT) * 100 / SUM(CASE WHEN Admission = '-' THEN 1 ELSE 0 END) AS _agg1 FROM Patient WHERE SEX = 'M'
SQL (Oracle): SELECT CAST(SUM(CASE WHEN Admission = '+' THEN CAST(1 AS BINARY_DOUBLE) ELSE 0.0 END) AS BINARY_DOUBLE) * 100 / SUM(CASE WHEN Admission = '-' THEN CAST(1 AS BINARY_DOUBLE) ELSE 0.0 END) FROM Patient WHERE SEX = 'M'

Question: What is the percentage of female patient were born after 1930?
Evidence: female refers to Sex = 'F'; patient who were born after 1930 refers to year(Birthday) > '1930'; calculation = DIVIDE(COUNT(ID) where year(Birthday) > '1930' and SEX = 'F'), (COUNT(ID) where SEX = 'F')
SQL (SQLite): SELECT CAST(SUM(CASE WHEN STRFTIME('%Y', Birthday) > '1930' THEN 1 ELSE 0 END) AS REAL) * 100 / COUNT(*) FROM Patient WHERE SEX = 'F'
SQL (SQL Server): SELECT TRY_CAST(SUM(CASE WHEN YEAR(Birthday) > '1930' THEN 1 ELSE 0 END) AS FLOAT) * 100 / COUNT(*) AS _agg1 FROM Patient WHERE SEX = 'F'
SQL (Oracle): SELECT CAST(SUM(CASE WHEN SUBSTR(Birthday, 1, 4) > '1930' THEN CAST(1 AS BINARY_DOUBLE) ELSE 0.0 END) AS BINARY_DOUBLE) * 100 / COUNT(*) FROM Patient WHERE SEX = 'F'

Question: What is the ratio of outpatient to inpatient followed up treatment among all the 'SLE' diagnosed patient?
Evidence: 'SLE' diagnosed patient means Diagnosis = 'SLE'; inpatient refers to Admission = '+'; outpatient refers to Admission = '-'; calculation =  DIVIDE(COUNT(ID) where Diagnosis = 'SLE' and Admission = '+', COUNT(ID) where Diagnosis = 'SLE' and Admission = '-')
SQL (SQLite): SELECT SUM(CASE WHEN Admission = '+' THEN 1.0 ELSE 0 END) / SUM(CASE WHEN Admission = '-' THEN 1 ELSE 0 END) FROM Patient WHERE Diagnosis = 'SLE'
SQL (SQL Server): SELECT SUM(CASE WHEN Admission = '+' THEN 1.0 ELSE 0 END) / SUM(CASE WHEN Admission = '-' THEN 1 ELSE 0 END) AS _agg1 FROM Patient WHERE Diagnosis = 'SLE'
SQL (Oracle): SELECT SUM(CASE WHEN Admission = '+' THEN CAST(1.0 AS BINARY_DOUBLE) ELSE 0.0 END) / SUM(CASE WHEN Admission = '-' THEN CAST(1 AS BINARY_DOUBLE) ELSE 0.0 END) FROM Patient WHERE Diagnosis = 'SLE'
Database: thrombosis_prediction

Question: What is the disease patient '30609' diagnosed with. List all the date of laboratory tests done for this patient.
Evidence: '30609' is the Patient ID; disease means Diagnosis
SQL (SQLite): SELECT T1.Diagnosis, T2.Date FROM Patient AS T1 INNER JOIN Laboratory AS T2 ON T1.ID = T2.ID WHERE T1.ID = 30609
SQL (SQL Server): SELECT T1.Diagnosis, T2.Date FROM Patient AS T1 INNER JOIN Laboratory AS T2 ON T1.ID = T2.ID WHERE T1.ID = 30609
SQL (Oracle): SELECT T1.Diagnosis, T2."DATE" FROM Patient T1 INNER JOIN Laboratory T2 ON T1.ID = T2.ID WHERE T1.ID = 30609

Question: List the patient ID, sex and birthday of patient with LDH beyond normal range.
Evidence: LDH beyond normal range refers to LDH > '500';
SQL (SQLite): SELECT DISTINCT T1.ID, T1.SEX, T1.Birthday FROM Patient AS T1 INNER JOIN Laboratory AS T2 ON T1.ID = T2.ID WHERE T2.LDH > 500
SQL (SQL Server): SELECT DISTINCT T1.ID, T1.SEX, T1.Birthday FROM Patient AS T1 INNER JOIN Laboratory AS T2 ON T1.ID = T2.ID WHERE T2.LDH > 500
SQL (Oracle): SELECT DISTINCT T1.ID, T1.SEX, T1.Birthday FROM Patient T1 INNER JOIN Laboratory T2 ON T1.ID = T2.ID WHERE T2.LDH > 500

Question: State the ID and age of patient with positive degree of coagulation.
Evidence: age refers to SUBTRACT(year(current_timestamp), year(Birthday)); positive degree of coagulation refers to RVVT = '+';
SQL (SQLite): SELECT DISTINCT T1.ID, STRFTIME('%Y', CURRENT_TIMESTAMP) - STRFTIME('%Y', T1.Birthday) FROM Patient AS T1 INNER JOIN Examination AS T2 ON T1.ID = T2.ID WHERE T2.RVVT = '+'
SQL (SQL Server): SELECT DISTINCT T1.ID, YEAR(CURRENT_TIMESTAMP) - YEAR(T1.Birthday) FROM Patient AS T1 INNER JOIN Examination AS T2 ON T1.ID = T2.ID WHERE T2.RVVT = '+'
SQL (Oracle): SELECT DISTINCT T1.ID, TO_CHAR(CURRENT_TIMESTAMP, 'YYYY') - SUBSTR(T1.Birthday, 1, 4) FROM Patient T1 INNER JOIN Examination T2 ON T1.ID = T2.ID WHERE T2.RVVT = '+'

Question: For patients with severe degree of thrombosis, list their ID, sex and disease the patient is diagnosed with.
Evidence: severe degree of thrombosis refers to thrombosis = 2; disease refers to diagnosis;
SQL (SQLite): SELECT DISTINCT T1.ID, T1.SEX, T1.Diagnosis FROM Patient AS T1 INNER JOIN Examination AS T2 ON T1.ID = T2.ID WHERE T2.Thrombosis = 2
SQL (SQL Server): SELECT DISTINCT T1.ID, T1.SEX, T1.Diagnosis FROM Patient AS T1 INNER JOIN Examination AS T2 ON T1.ID = T2.ID WHERE T2.Thrombosis = 2
SQL (Oracle): SELECT DISTINCT T1.ID, T1.SEX, T1.Diagnosis FROM Patient T1 INNER JOIN Examination T2 ON T1.ID = T2.ID WHERE T2.Thrombosis = 2
Database: thrombosis_prediction

Question: How many female patients who came at the hospital in 1997 was immediately followed at the outpatient clinic?
Evidence: female refers to sex = 'F'; came at the hospital in 1997 refers to year(Description) = '1997'; immediately followed at the outpatient clinic refers to Admission = '-'
SQL (SQLite): SELECT COUNT(*) FROM Patient WHERE STRFTIME('%Y', Description) = '1997' AND SEX = 'F' AND Admission = '-'
SQL (SQL Server): SELECT COUNT(*) AS _agg1 FROM Patient WHERE YEAR(Description) = '1997' AND SEX = 'F' AND Admission = '-'
SQL (Oracle): SELECT COUNT(*) FROM Patient WHERE SUBSTR(Description, 1, 4) = '1997' AND SEX = 'F' AND Admission = '-'

Question: How many of the patients with the most serious thrombosis cases examined in 1997 are women?
Evidence: the most serious thrombosis refers to Thrombosis = '1' (the most severe one); women refers to sex = 'F'
SQL (SQLite): SELECT  COUNT(*) FROM Patient AS T1 INNER JOIN Examination AS T2 ON T1.ID = T2.ID WHERE T1.SEX = 'F' AND STRFTIME('%Y', T2.`Examination Date`) = '1997' AND T2.Thrombosis = 1
SQL (SQL Server): SELECT COUNT(*) AS _agg1 FROM Patient AS T1 INNER JOIN Examination AS T2 ON T1.ID = T2.ID WHERE T1.SEX = 'F' AND YEAR(T2.[Examination Date]) = '1997' AND T2.Thrombosis = 1
SQL (Oracle): SELECT COUNT(*) FROM Patient T1 INNER JOIN Examination T2 ON T1.ID = T2.ID WHERE T1.SEX = 'F' AND SUBSTR(T2."EXAMINATION DATE", 1, 4) = '1997' AND T2.Thrombosis = 1

Question: What are the symptoms observed by the youngest patient to ever did a medical examination? Identify their diagnosis.
Evidence: The larger the birthday value, the younger the person is, and vice versa; symptoms observed refers to the symptoms is not NULL
SQL (SQLite): SELECT T2.Symptoms, T1.Diagnosis FROM Patient AS T1 INNER JOIN Examination AS T2 ON T1.ID = T2.ID WHERE T2.Symptoms IS NOT NULL ORDER BY T1.Birthday DESC LIMIT 1
SQL (SQL Server): SELECT T2.Symptoms, T1.Diagnosis FROM Patient AS T1 INNER JOIN Examination AS T2 ON T1.ID = T2.ID WHERE T2.Symptoms IS NOT NULL ORDER BY T1.Birthday DESC OFFSET 0 ROWS FETCH NEXT 1 ROWS ONLY
SQL (Oracle): SELECT T2.Symptoms, T1.Diagnosis FROM Patient T1 INNER JOIN Examination T2 ON T1.ID = T2.ID WHERE T2.Symptoms IS NOT NULL ORDER BY T1.Birthday DESC NULLS LAST FETCH FIRST 1 ROWS ONLY