db_id
stringclasses
66 values
question
stringlengths
24
325
evidence
stringlengths
1
673
gold_query
stringlengths
23
804
db_schema
stringclasses
66 values
works_cycles
Please list the total number of companies with a commission percentage of 0.018 or above, along with each company's assigned geographical location.
geographical location refers to group from SalesPerson; ComissionPct refers to commission percentage where ComissionPct > = 0.018;
SELECT T1.BusinessEntityID, T2.'Group' FROM SalesPerson AS T1 INNER JOIN SalesTerritory AS T2 USING (territoryid) WHERE T1.CommissionPct >= 0.018
CREATE TABLE ProductSubcategory ( ProductCategoryID INTEGER not null, -- Example Values: `1`, `2`, `3`, `4` | Value Statics: Total count 37 - Distinct count 4 - Null count 0 rowguid TEXT not null unique, -- ModifiedDate DATETIME default CURRENT_TIMESTAMP not null, -- Example Values: `2008-04-30 00:00:00.0` | Va...
works_cycles
Which chromoly steel product model has AdventureWorks saved in English?
Saved in English refers to product description written in English where Culture.name = 'English'
SELECT T1.ProductModelID FROM ProductModelProductDescriptionCulture AS T1 INNER JOIN Culture AS T2 USING (cultureid) INNER JOIN ProductDescription AS T3 USING (productdescriptionid) WHERE T3.Description LIKE 'Chromoly steel%' AND T2.Name = 'English'
CREATE TABLE ProductSubcategory ( ProductCategoryID INTEGER not null, -- Example Values: `1`, `2`, `3`, `4` | Value Statics: Total count 37 - Distinct count 4 - Null count 0 rowguid TEXT not null unique, -- ModifiedDate DATETIME default CURRENT_TIMESTAMP not null, -- Example Values: `2008-04-30 00:00:00.0` | Va...
works_cycles
How many accounts are in Bothell as opposed to Kenmore? What is the name of the State that comprises these two cities?
SUBTRACT(count(city = 'Bothell'), count(city = 'Kenmore'))
SELECT SUM(IIF(T1.city = 'Bothell', 1, 0)) - SUM(IIF(T1.city = 'Kenmore', 1, 0)) , stateprovincecode FROM Address AS T1 INNER JOIN StateProvince AS T2 ON T1.stateprovinceid = T2.stateprovinceid GROUP BY stateprovincecode
CREATE TABLE ProductSubcategory ( ProductCategoryID INTEGER not null, -- Example Values: `1`, `2`, `3`, `4` | Value Statics: Total count 37 - Distinct count 4 - Null count 0 rowguid TEXT not null unique, -- ModifiedDate DATETIME default CURRENT_TIMESTAMP not null, -- Example Values: `2008-04-30 00:00:00.0` | Va...
works_cycles
How long does it take for the business to receive the item it has purchased? Who is the vendor for business number 1496?
business number refers to BusinessEntityID where BusinessEntityID = 1496; how long does it take refers to AverageLeadTime
SELECT T1.AverageLeadTime, T2.Name FROM ProductVendor AS T1 INNER JOIN Vendor AS T2 USING (businessentityid) WHERE T2.BusinessEntityID = 1496 GROUP BY T1.AverageLeadTime, T2.Name
CREATE TABLE ProductSubcategory ( ProductCategoryID INTEGER not null, -- Example Values: `1`, `2`, `3`, `4` | Value Statics: Total count 37 - Distinct count 4 - Null count 0 rowguid TEXT not null unique, -- ModifiedDate DATETIME default CURRENT_TIMESTAMP not null, -- Example Values: `2008-04-30 00:00:00.0` | Va...
works_cycles
How many people work in the finance department?
null
SELECT COUNT(T2.BusinessEntityID) FROM Department AS T1 INNER JOIN EmployeeDepartmentHistory AS T2 ON T1.DepartmentID = T2.DepartmentID WHERE T1.Name = 'Finance'
CREATE TABLE ProductSubcategory ( ProductCategoryID INTEGER not null, -- Example Values: `1`, `2`, `3`, `4` | Value Statics: Total count 37 - Distinct count 4 - Null count 0 rowguid TEXT not null unique, -- ModifiedDate DATETIME default CURRENT_TIMESTAMP not null, -- Example Values: `2008-04-30 00:00:00.0` | Va...
works_cycles
What is the currency of Brazil?
null
SELECT T1.Name FROM Currency AS T1 INNER JOIN CountryRegionCurrency AS T2 ON T1.CurrencyCode = T2.CurrencyCode INNER JOIN CountryRegion AS T3 ON T2.CountryRegionCode = T3.CountryRegionCode WHERE T3.Name = 'Brazil'
CREATE TABLE ProductSubcategory ( ProductCategoryID INTEGER not null, -- Example Values: `1`, `2`, `3`, `4` | Value Statics: Total count 37 - Distinct count 4 - Null count 0 rowguid TEXT not null unique, -- ModifiedDate DATETIME default CURRENT_TIMESTAMP not null, -- Example Values: `2008-04-30 00:00:00.0` | Va...
works_cycles
Please list 3 businesses along with their IDs that use cellphones.
business along with their IDs = BusinessEntityID; Cellphones refers to PhoneNumberType.name = ‘cell’
SELECT T2.BusinessEntityID FROM PhoneNumberType AS T1 INNER JOIN PersonPhone AS T2 ON T1.PhoneNumberTypeID = T2.PhoneNumberTypeID WHERE T1.Name = 'Cell' LIMIT 3
CREATE TABLE ProductSubcategory ( ProductCategoryID INTEGER not null, -- Example Values: `1`, `2`, `3`, `4` | Value Statics: Total count 37 - Distinct count 4 - Null count 0 rowguid TEXT not null unique, -- ModifiedDate DATETIME default CURRENT_TIMESTAMP not null, -- Example Values: `2008-04-30 00:00:00.0` | Va...
works_cycles
What job is person number 322 currently holding?
person number 322 refers to PersonID = 18; job is the name of contacttype
SELECT T1.Name FROM ContactType AS T1 INNER JOIN BusinessEntityContact AS T2 ON T1.ContactTypeID = T2.ContactTypeID WHERE T2.BusinessEntityID = 332
CREATE TABLE ProductSubcategory ( ProductCategoryID INTEGER not null, -- Example Values: `1`, `2`, `3`, `4` | Value Statics: Total count 37 - Distinct count 4 - Null count 0 rowguid TEXT not null unique, -- ModifiedDate DATETIME default CURRENT_TIMESTAMP not null, -- Example Values: `2008-04-30 00:00:00.0` | Va...
works_cycles
What is the forename and birthdate of person number 18?
person number 18 refers to BusinessEntityID = 18; forename refers to FirstName
SELECT T1.FirstName, T2.BirthDate FROM Person AS T1 INNER JOIN Employee AS T2 ON T1.BusinessEntityID = T2.BusinessEntityID WHERE T1.BusinessEntityID = 18
CREATE TABLE ProductSubcategory ( ProductCategoryID INTEGER not null, -- Example Values: `1`, `2`, `3`, `4` | Value Statics: Total count 37 - Distinct count 4 - Null count 0 rowguid TEXT not null unique, -- ModifiedDate DATETIME default CURRENT_TIMESTAMP not null, -- Example Values: `2008-04-30 00:00:00.0` | Va...
works_cycles
What are the company that Adventure Works deal with that have poor credit rating? Please provide their business number.
poor credit rating means bad credit; CreditRating = 5; Business number refers to BusinessEntityID
SELECT BusinessEntityID FROM Vendor WHERE CreditRating = ( SELECT CreditRating FROM Vendor ORDER BY CreditRating DESC LIMIT 1 )
CREATE TABLE ProductSubcategory ( ProductCategoryID INTEGER not null, -- Example Values: `1`, `2`, `3`, `4` | Value Statics: Total count 37 - Distinct count 4 - Null count 0 rowguid TEXT not null unique, -- ModifiedDate DATETIME default CURRENT_TIMESTAMP not null, -- Example Values: `2008-04-30 00:00:00.0` | Va...
works_cycles
How many customers gave a product the best possible rating? Please list their names.
customers' name refers to ReviewerName; best possible ratings means the highest rating = 5
SELECT ReviewerName FROM ProductReview WHERE Rating = 5
CREATE TABLE ProductSubcategory ( ProductCategoryID INTEGER not null, -- Example Values: `1`, `2`, `3`, `4` | Value Statics: Total count 37 - Distinct count 4 - Null count 0 rowguid TEXT not null unique, -- ModifiedDate DATETIME default CURRENT_TIMESTAMP not null, -- Example Values: `2008-04-30 00:00:00.0` | Va...
works_cycles
What is the sales revenue for item number 740?
business number 1580 refers to BusinessEntityID = 1580; Net profit = SUBTRACT(LastReceiptCost,StandardPrice)
SELECT ListPrice - StandardCost FROM Product WHERE ProductID = 740
CREATE TABLE ProductSubcategory ( ProductCategoryID INTEGER not null, -- Example Values: `1`, `2`, `3`, `4` | Value Statics: Total count 37 - Distinct count 4 - Null count 0 rowguid TEXT not null unique, -- ModifiedDate DATETIME default CURRENT_TIMESTAMP not null, -- Example Values: `2008-04-30 00:00:00.0` | Va...
works_cycles
What is business number 1580's net profit?
business number 1580 refers to BusinessEntityID = 1580; Net profit = SUBTRACT(LastReceiptCost,StandardPrice)
SELECT LastReceiptCost - StandardPrice FROM ProductVendor WHERE BusinessEntityID = 1580
CREATE TABLE ProductSubcategory ( ProductCategoryID INTEGER not null, -- Example Values: `1`, `2`, `3`, `4` | Value Statics: Total count 37 - Distinct count 4 - Null count 0 rowguid TEXT not null unique, -- ModifiedDate DATETIME default CURRENT_TIMESTAMP not null, -- Example Values: `2008-04-30 00:00:00.0` | Va...
works_cycles
What is the full address of address number 11906?
address number refers to AddressID; full address refers to AddressLine1 + AddressLine2
SELECT AddressLine1, AddressLine2 FROM Address WHERE AddressID = 11906
CREATE TABLE ProductSubcategory ( ProductCategoryID INTEGER not null, -- Example Values: `1`, `2`, `3`, `4` | Value Statics: Total count 37 - Distinct count 4 - Null count 0 rowguid TEXT not null unique, -- ModifiedDate DATETIME default CURRENT_TIMESTAMP not null, -- Example Values: `2008-04-30 00:00:00.0` | Va...
works_cycles
Please list the top three employees with the most unused sick leave along with their position titles.
employees refers to BusinessEntityID; most unused sick leave refers to MAX(SickLeaveHours); position title refers to JobTitle
SELECT JobTitle FROM Employee ORDER BY SickLeaveHours DESC LIMIT 3
CREATE TABLE ProductSubcategory ( ProductCategoryID INTEGER not null, -- Example Values: `1`, `2`, `3`, `4` | Value Statics: Total count 37 - Distinct count 4 - Null count 0 rowguid TEXT not null unique, -- ModifiedDate DATETIME default CURRENT_TIMESTAMP not null, -- Example Values: `2008-04-30 00:00:00.0` | Va...
works_cycles
How many black-colored products are there that cannot be sold?
cannot be sold means product is not a salable item which refers to FinishedGoodsFlag = 0
SELECT COUNT(ProductID) FROM Product WHERE FinishedGoodsFlag = 0 AND Color = 'Black'
CREATE TABLE ProductSubcategory ( ProductCategoryID INTEGER not null, -- Example Values: `1`, `2`, `3`, `4` | Value Statics: Total count 37 - Distinct count 4 - Null count 0 rowguid TEXT not null unique, -- ModifiedDate DATETIME default CURRENT_TIMESTAMP not null, -- Example Values: `2008-04-30 00:00:00.0` | Va...
works_cycles
Please list any 3 product numbers with the lowest standard cost.
product number = productID
SELECT ProductID FROM ProductCostHistory ORDER BY StandardCost ASC LIMIT 3
CREATE TABLE ProductSubcategory ( ProductCategoryID INTEGER not null, -- Example Values: `1`, `2`, `3`, `4` | Value Statics: Total count 37 - Distinct count 4 - Null count 0 rowguid TEXT not null unique, -- ModifiedDate DATETIME default CURRENT_TIMESTAMP not null, -- Example Values: `2008-04-30 00:00:00.0` | Va...
works_cycles
How many vendors are having their products ordered with an average delivery time of 25 days?
vendors refers to distinct BusinessEntityID; average delivery time of 25 days refers to AverageLeadTime = 25 and onOrderQty > 0
SELECT COUNT(DISTINCT BusinessEntityID) FROM ProductVendor WHERE AverageLeadTime = 25
CREATE TABLE ProductSubcategory ( ProductCategoryID INTEGER not null, -- Example Values: `1`, `2`, `3`, `4` | Value Statics: Total count 37 - Distinct count 4 - Null count 0 rowguid TEXT not null unique, -- ModifiedDate DATETIME default CURRENT_TIMESTAMP not null, -- Example Values: `2008-04-30 00:00:00.0` | Va...
works_cycles
Please list the family names of any employees whose middle names begin with C.
family names refers to Last name; employee refers to PersonType = 'EM'; MiddleName starts with 'C'
SELECT LastName FROM Person WHERE PersonType = 'EM' AND MiddleName LIKE 'C%'
CREATE TABLE ProductSubcategory ( ProductCategoryID INTEGER not null, -- Example Values: `1`, `2`, `3`, `4` | Value Statics: Total count 37 - Distinct count 4 - Null count 0 rowguid TEXT not null unique, -- ModifiedDate DATETIME default CURRENT_TIMESTAMP not null, -- Example Values: `2008-04-30 00:00:00.0` | Va...
works_cycles
Please list the departments that are part of the Executive General and Administration group.
Department refers to Name where GroupName = 'Executive General and Administration'
SELECT Name FROM Department WHERE GroupName = 'Executive General and Administration'
CREATE TABLE ProductSubcategory ( ProductCategoryID INTEGER not null, -- Example Values: `1`, `2`, `3`, `4` | Value Statics: Total count 37 - Distinct count 4 - Null count 0 rowguid TEXT not null unique, -- ModifiedDate DATETIME default CURRENT_TIMESTAMP not null, -- Example Values: `2008-04-30 00:00:00.0` | Va...
works_cycles
How many vendors only consented to move on with the 500 to 15000 piece order in terms of quality?
Vendor refers to BusinessEntityId; 500 to 15000 piece order refers to MinOrderQty > 500 and MaxOrderQty < 15000
SELECT COUNT(*) FROM ProductVendor WHERE MinOrderQty > 500 AND MaxOrderQty < 15000
CREATE TABLE ProductSubcategory ( ProductCategoryID INTEGER not null, -- Example Values: `1`, `2`, `3`, `4` | Value Statics: Total count 37 - Distinct count 4 - Null count 0 rowguid TEXT not null unique, -- ModifiedDate DATETIME default CURRENT_TIMESTAMP not null, -- Example Values: `2008-04-30 00:00:00.0` | Va...
works_cycles
What is the name of the supplier number 1492?
supplier number 1492 refers to BusinessEntityId = 1492; name of the supplier = name from vendor
SELECT NAME FROM Vendor WHERE BusinessEntityID = 1492
CREATE TABLE ProductSubcategory ( ProductCategoryID INTEGER not null, -- Example Values: `1`, `2`, `3`, `4` | Value Statics: Total count 37 - Distinct count 4 - Null count 0 rowguid TEXT not null unique, -- ModifiedDate DATETIME default CURRENT_TIMESTAMP not null, -- Example Values: `2008-04-30 00:00:00.0` | Va...
works_cycles
What is the employee of company number 1's full name?
company number 1 refers to BusinessEntityId = 1; employee refers to PersonType = 'EM'; full name refers to FirstName + MiddleName + LastName
SELECT FirstName, MiddleName, LastName FROM Person WHERE BusinessEntityID = 1 AND PersonType = 'EM'
CREATE TABLE ProductSubcategory ( ProductCategoryID INTEGER not null, -- Example Values: `1`, `2`, `3`, `4` | Value Statics: Total count 37 - Distinct count 4 - Null count 0 rowguid TEXT not null unique, -- ModifiedDate DATETIME default CURRENT_TIMESTAMP not null, -- Example Values: `2008-04-30 00:00:00.0` | Va...
works_cycles
How many employees earn their salaries on a monthly basis at an hourly rate of more than 50?
employee refers to BusinessEntityID; salaries on a monthly basis refers to PayFrequency = 1; hourly rate more than 50 refers to Rate > 50
SELECT COUNT(BusinessEntityID) FROM EmployeePayHistory WHERE rate * PayFrequency > 50
CREATE TABLE ProductSubcategory ( ProductCategoryID INTEGER not null, -- Example Values: `1`, `2`, `3`, `4` | Value Statics: Total count 37 - Distinct count 4 - Null count 0 rowguid TEXT not null unique, -- ModifiedDate DATETIME default CURRENT_TIMESTAMP not null, -- Example Values: `2008-04-30 00:00:00.0` | Va...
works_cycles
List the name of the rates that apply to the provinces that are in the territory that obtained the greatest increase in sales with respect to the previous year.
sales of previous year refers to SalesLastYear; SalesYTD refers to year to date sales; increase in sales = DIVIDE(SUBTRACT(SalesYTD, SalesLastYear), SalesLastYear)*100
SELECT T2.Name FROM SalesTerritory AS T1 INNER JOIN StateProvince AS T2 ON T1.CountryRegionCode = T2.CountryRegionCode INNER JOIN SalesTaxRate AS T3 ON T2.StateProvinceID = T3.StateProvinceID ORDER BY (T1.SalesYTD - T1.SalesLastYear) / T1.SalesLastYear DESC LIMIT 1
CREATE TABLE ProductSubcategory ( ProductCategoryID INTEGER not null, -- Example Values: `1`, `2`, `3`, `4` | Value Statics: Total count 37 - Distinct count 4 - Null count 0 rowguid TEXT not null unique, -- ModifiedDate DATETIME default CURRENT_TIMESTAMP not null, -- Example Values: `2008-04-30 00:00:00.0` | Va...
student_loan
Is student281 disabled and which school is the student enrolled in?
null
SELECT T2.name, T1.school FROM enrolled AS T1 INNER JOIN disabled AS T2 ON T1.`name` = T2.`name` WHERE T1.name = 'student281'
CREATE TABLE longest_absense_from_school ( "name" TEXT default '' not null primary key, foreign key ("name") references person ("name") on update cascade on delete cascade, "month" INTEGER default 0 null, -- Example Values: `0`, `1`, `2`, `3`, `4` | Value Statics: Total count 1000 - Distinct count 10 - Null count 0 ...
student_loan
List all students that have been absent for 6 months.
absent for 6 months `month` = 6;
SELECT name FROM longest_absense_from_school WHERE `month` = 6
CREATE TABLE longest_absense_from_school ( "name" TEXT default '' not null primary key, foreign key ("name") references person ("name") on update cascade on delete cascade, "month" INTEGER default 0 null, -- Example Values: `0`, `1`, `2`, `3`, `4` | Value Statics: Total count 1000 - Distinct count 10 - Null count 0 ...
student_loan
List 10 students that have no due payments and are not males.
no due payments refers to bool = 'neg'; not males refers to not in male table
SELECT T1.name FROM no_payment_due AS T1 INNER JOIN person AS T2 ON T1.`name` = T2.`name` WHERE T2.`name` NOT IN ( SELECT name FROM male ) AND T1.bool = 'neg'
CREATE TABLE longest_absense_from_school ( "name" TEXT default '' not null primary key, foreign key ("name") references person ("name") on update cascade on delete cascade, "month" INTEGER default 0 null, -- Example Values: `0`, `1`, `2`, `3`, `4` | Value Statics: Total count 1000 - Distinct count 10 - Null count 0 ...
student_loan
Which organization did student285 enlist?
null
SELECT organ FROM enlist WHERE name = 'student285'
CREATE TABLE longest_absense_from_school ( "name" TEXT default '' not null primary key, foreign key ("name") references person ("name") on update cascade on delete cascade, "month" INTEGER default 0 null, -- Example Values: `0`, `1`, `2`, `3`, `4` | Value Statics: Total count 1000 - Distinct count 10 - Null count 0 ...
student_loan
Name all disabled students that are enrolled in SMC.
enrolled in SMC refers to school = 'smc';
SELECT T2.name FROM enrolled AS T1 INNER JOIN disabled AS T2 ON T1.`name` = T2.`name` WHERE T1.school = 'smc'
CREATE TABLE longest_absense_from_school ( "name" TEXT default '' not null primary key, foreign key ("name") references person ("name") on update cascade on delete cascade, "month" INTEGER default 0 null, -- Example Values: `0`, `1`, `2`, `3`, `4` | Value Statics: Total count 1000 - Distinct count 10 - Null count 0 ...
student_loan
List all students in the air force and which school they were enrolled at.
in the air force refers to organ = 'air_force';
SELECT T1.name, T1.school FROM enrolled AS T1 INNER JOIN enlist AS T2 ON T1.`name` = T2.`name` WHERE T2.organ = 'air_force'
CREATE TABLE longest_absense_from_school ( "name" TEXT default '' not null primary key, foreign key ("name") references person ("name") on update cascade on delete cascade, "month" INTEGER default 0 null, -- Example Values: `0`, `1`, `2`, `3`, `4` | Value Statics: Total count 1000 - Distinct count 10 - Null count 0 ...
student_loan
Which students that are in the marines have been absent for 6 months?
in the marines refers to organ = 'marines'; absent for 6 months refers to month = 6
SELECT T1.name FROM longest_absense_from_school AS T1 INNER JOIN enlist AS T2 ON T1.`name` = T2.`name` WHERE T2.organ = 'marines' AND T1.`month` = 6
CREATE TABLE longest_absense_from_school ( "name" TEXT default '' not null primary key, foreign key ("name") references person ("name") on update cascade on delete cascade, "month" INTEGER default 0 null, -- Example Values: `0`, `1`, `2`, `3`, `4` | Value Statics: Total count 1000 - Distinct count 10 - Null count 0 ...
student_loan
Name 5 students with due payments that are enlisted alongside which organization they were enlisted.
with due payments refers to bool = 'pos'; organization refers to organ
SELECT T2.organ, T1.name FROM no_payment_due AS T1 INNER JOIN enlist AS T2 ON T1.`name` = T2.`name` WHERE T1.bool = 'pos' LIMIT 5
CREATE TABLE longest_absense_from_school ( "name" TEXT default '' not null primary key, foreign key ("name") references person ("name") on update cascade on delete cascade, "month" INTEGER default 0 null, -- Example Values: `0`, `1`, `2`, `3`, `4` | Value Statics: Total count 1000 - Distinct count 10 - Null count 0 ...
student_loan
How many male students have no due payments?
have no due payments refers to bool = 'neg';
SELECT COUNT(T1.name) FROM no_payment_due AS T1 INNER JOIN male AS T2 ON T1.name = T2.name WHERE T1.bool = 'neg'
CREATE TABLE longest_absense_from_school ( "name" TEXT default '' not null primary key, foreign key ("name") references person ("name") on update cascade on delete cascade, "month" INTEGER default 0 null, -- Example Values: `0`, `1`, `2`, `3`, `4` | Value Statics: Total count 1000 - Distinct count 10 - Null count 0 ...
student_loan
How many female students are disabled?
females students are disabled refers to name that appeared in both disabled and male tables
SELECT COUNT(name) FROM disabled WHERE name NOT IN ( SELECT name FROM male )
CREATE TABLE longest_absense_from_school ( "name" TEXT default '' not null primary key, foreign key ("name") references person ("name") on update cascade on delete cascade, "month" INTEGER default 0 null, -- Example Values: `0`, `1`, `2`, `3`, `4` | Value Statics: Total count 1000 - Distinct count 10 - Null count 0 ...
student_loan
How many unemployed students are there that have been absent for 6 months?
absent for 6 months refers to month = 6;
SELECT T1.name FROM longest_absense_from_school AS T1 INNER JOIN unemployed AS T2 ON T1.`name` = T2.name WHERE T1.`month` = 6
CREATE TABLE longest_absense_from_school ( "name" TEXT default '' not null primary key, foreign key ("name") references person ("name") on update cascade on delete cascade, "month" INTEGER default 0 null, -- Example Values: `0`, `1`, `2`, `3`, `4` | Value Statics: Total count 1000 - Distinct count 10 - Null count 0 ...
student_loan
Which students that filed for bankruptcy are also in the foreign legion?
in the foreign legion refers to organ = 'foreign_legion';
SELECT T2.name FROM enlist AS T1 INNER JOIN filed_for_bankrupcy AS T2 ON T1.`name` = T2.`name` WHERE T1.organ = 'foreign_legion'
CREATE TABLE longest_absense_from_school ( "name" TEXT default '' not null primary key, foreign key ("name") references person ("name") on update cascade on delete cascade, "month" INTEGER default 0 null, -- Example Values: `0`, `1`, `2`, `3`, `4` | Value Statics: Total count 1000 - Distinct count 10 - Null count 0 ...
student_loan
Student21 is enlisted in which organization and has the student been absent?
organization refers to organ
SELECT T2.month, T1.organ FROM enlist AS T1 INNER JOIN longest_absense_from_school AS T2 ON T1.`name` = T2.`name` WHERE T1.name = 'student21'
CREATE TABLE longest_absense_from_school ( "name" TEXT default '' not null primary key, foreign key ("name") references person ("name") on update cascade on delete cascade, "month" INTEGER default 0 null, -- Example Values: `0`, `1`, `2`, `3`, `4` | Value Statics: Total count 1000 - Distinct count 10 - Null count 0 ...
student_loan
How many students from SMC are unemployed?
from SMC refers to school = 'smc';
SELECT T2.name FROM enrolled AS T1 INNER JOIN unemployed AS T2 ON T1.`name` = T2.`name` WHERE T1.school = 'smc'
CREATE TABLE longest_absense_from_school ( "name" TEXT default '' not null primary key, foreign key ("name") references person ("name") on update cascade on delete cascade, "month" INTEGER default 0 null, -- Example Values: `0`, `1`, `2`, `3`, `4` | Value Statics: Total count 1000 - Distinct count 10 - Null count 0 ...
student_loan
List out student IDs that have the longest absence duration from school.
longest absence duration refers to MAX(month)
SELECT name FROM longest_absense_from_school WHERE `month` = ( SELECT MAX(month) FROM longest_absense_from_school )
CREATE TABLE longest_absense_from_school ( "name" TEXT default '' not null primary key, foreign key ("name") references person ("name") on update cascade on delete cascade, "month" INTEGER default 0 null, -- Example Values: `0`, `1`, `2`, `3`, `4` | Value Statics: Total count 1000 - Distinct count 10 - Null count 0 ...
student_loan
Count the number of students from UCSD enlisted in the peace corps.
in the peace corps refers to organ = 'peace_corps'; from UCSD refers to school = 'ucsd';
SELECT COUNT(T1.name) FROM enlist AS T1 INNER JOIN enrolled AS T2 ON T1.`name` = T2.`name` WHERE T2.school = 'ucsd' AND T1.organ = 'peace_corps'
CREATE TABLE longest_absense_from_school ( "name" TEXT default '' not null primary key, foreign key ("name") references person ("name") on update cascade on delete cascade, "month" INTEGER default 0 null, -- Example Values: `0`, `1`, `2`, `3`, `4` | Value Statics: Total count 1000 - Distinct count 10 - Null count 0 ...
student_loan
What percentage of students who enlisted in the navy make up the number of students enrolled in OCC?
in the navy refers to organ = 'navy'; enrolled in OCC refers to school = 'occ'
SELECT CAST(SUM(IIF(T1.school = 'occ', 1.0, 0)) AS REAL) * 100 / COUNT(T1.name) FROM enrolled AS T1 INNER JOIN enlist AS T2 ON T1.`name` = T2.`name` WHERE T2.organ = 'navy'
CREATE TABLE longest_absense_from_school ( "name" TEXT default '' not null primary key, foreign key ("name") references person ("name") on update cascade on delete cascade, "month" INTEGER default 0 null, -- Example Values: `0`, `1`, `2`, `3`, `4` | Value Statics: Total count 1000 - Distinct count 10 - Null count 0 ...
student_loan
How many months has student217 been absent?
null
SELECT month FROM longest_absense_from_school WHERE name = 'student217'
CREATE TABLE longest_absense_from_school ( "name" TEXT default '' not null primary key, foreign key ("name") references person ("name") on update cascade on delete cascade, "month" INTEGER default 0 null, -- Example Values: `0`, `1`, `2`, `3`, `4` | Value Statics: Total count 1000 - Distinct count 10 - Null count 0 ...
student_loan
What is the longest time for a student from the navy department to be absent from school?
navy department refers to organ = 'navy'; longest time to be absent from school refers to MAX(month)
SELECT T1.month FROM longest_absense_from_school AS T1 INNER JOIN enlist AS T2 ON T1.`name` = T2.`name` WHERE T2.organ = 'navy' ORDER BY T1.`month` DESC LIMIT 1
CREATE TABLE longest_absense_from_school ( "name" TEXT default '' not null primary key, foreign key ("name") references person ("name") on update cascade on delete cascade, "month" INTEGER default 0 null, -- Example Values: `0`, `1`, `2`, `3`, `4` | Value Statics: Total count 1000 - Distinct count 10 - Null count 0 ...
student_loan
What is the longest students absence duration from school?
longest students absence duration MAX(month)
SELECT name, month FROM longest_absense_from_school WHERE `month` = ( SELECT MAX(month) FROM longest_absense_from_school )
CREATE TABLE longest_absense_from_school ( "name" TEXT default '' not null primary key, foreign key ("name") references person ("name") on update cascade on delete cascade, "month" INTEGER default 0 null, -- Example Values: `0`, `1`, `2`, `3`, `4` | Value Statics: Total count 1000 - Distinct count 10 - Null count 0 ...
student_loan
What is the percentage ratio of students who are enlisted in foreign legions that have a due payment?
have a due payment refers to bool = 'pos'; in foreign legions refers to organ = 'foreign_legion'; ratio refers to DIVIDE(COUNT(bool = 'pos'), COUNT(bool = 'neg'))
SELECT CAST(SUM(IIF(T1.bool = 'pos', 1, 0)) AS REAL) * 100 / SUM(IIF(T1.bool = 'neg', 1, 0)) FROM no_payment_due AS T1 INNER JOIN enlist AS T2 ON T1.`name` = T2.`name` WHERE T2.organ = 'foreign_legion'
CREATE TABLE longest_absense_from_school ( "name" TEXT default '' not null primary key, foreign key ("name") references person ("name") on update cascade on delete cascade, "month" INTEGER default 0 null, -- Example Values: `0`, `1`, `2`, `3`, `4` | Value Statics: Total count 1000 - Distinct count 10 - Null count 0 ...
student_loan
What is the number of unemployed and bankrupt students?
null
SELECT COUNT(T1.name) FROM unemployed AS T1 INNER JOIN filed_for_bankrupcy AS T2 ON T1.name = T2.name
CREATE TABLE longest_absense_from_school ( "name" TEXT default '' not null primary key, foreign key ("name") references person ("name") on update cascade on delete cascade, "month" INTEGER default 0 null, -- Example Values: `0`, `1`, `2`, `3`, `4` | Value Statics: Total count 1000 - Distinct count 10 - Null count 0 ...
student_loan
What is the total number of students in the school?
null
SELECT COUNT(name) FROM person
CREATE TABLE longest_absense_from_school ( "name" TEXT default '' not null primary key, foreign key ("name") references person ("name") on update cascade on delete cascade, "month" INTEGER default 0 null, -- Example Values: `0`, `1`, `2`, `3`, `4` | Value Statics: Total count 1000 - Distinct count 10 - Null count 0 ...
student_loan
Please check if student 124 is disabled male.
if student name appear in disabled then student is disabled and vice versa; if student name appear in male then student is male and vice versa
SELECT IIF(T2.name IS NULL, 'female', 'male') FROM male AS T1 LEFT JOIN disabled AS T2 ON T1.name = T2.name WHERE T1.name = 'student124'
CREATE TABLE longest_absense_from_school ( "name" TEXT default '' not null primary key, foreign key ("name") references person ("name") on update cascade on delete cascade, "month" INTEGER default 0 null, -- Example Values: `0`, `1`, `2`, `3`, `4` | Value Statics: Total count 1000 - Distinct count 10 - Null count 0 ...
student_loan
How many students were absence for 4 month?
absence for 4 month refers to month = 4;
SELECT COUNT(name) FROM longest_absense_from_school WHERE month = 4
CREATE TABLE longest_absense_from_school ( "name" TEXT default '' not null primary key, foreign key ("name") references person ("name") on update cascade on delete cascade, "month" INTEGER default 0 null, -- Example Values: `0`, `1`, `2`, `3`, `4` | Value Statics: Total count 1000 - Distinct count 10 - Null count 0 ...
student_loan
How many unemployed and bankrupt students that have payment dues?
have payment dues refers to bool = 'pos'
SELECT COUNT(T1.name) FROM unemployed AS T1 INNER JOIN filed_for_bankrupcy AS T2 ON T1.name = T2.name INNER JOIN no_payment_due AS T3 ON T2.name = T3.name WHERE T3.bool = 'pos'
CREATE TABLE longest_absense_from_school ( "name" TEXT default '' not null primary key, foreign key ("name") references person ("name") on update cascade on delete cascade, "month" INTEGER default 0 null, -- Example Values: `0`, `1`, `2`, `3`, `4` | Value Statics: Total count 1000 - Distinct count 10 - Null count 0 ...
student_loan
How many female students joined a marines and air force organization?
joined a marines refers to organ = 'marines'; air force organization refers to organ = 'air_force';
SELECT COUNT(name) FROM enlist WHERE organ IN ('marines', 'air_force') AND name NOT IN ( SELECT name FROM male )
CREATE TABLE longest_absense_from_school ( "name" TEXT default '' not null primary key, foreign key ("name") references person ("name") on update cascade on delete cascade, "month" INTEGER default 0 null, -- Example Values: `0`, `1`, `2`, `3`, `4` | Value Statics: Total count 1000 - Distinct count 10 - Null count 0 ...
student_loan
Does disable students join organization. If yes, please indicate the organization joined by the students.
organization refers to organ
SELECT DISTINCT T2.organ FROM disabled AS T1 INNER JOIN enlist AS T2 ON T1.`name` = T2.`name`
CREATE TABLE longest_absense_from_school ( "name" TEXT default '' not null primary key, foreign key ("name") references person ("name") on update cascade on delete cascade, "month" INTEGER default 0 null, -- Example Values: `0`, `1`, `2`, `3`, `4` | Value Statics: Total count 1000 - Distinct count 10 - Null count 0 ...
student_loan
What is the employment, disability, gender and school debt status for student180 and student117?
school debt status refers to bool; bool = 'pos' means has payment due; bool = 'neg' means doesn't has payment due; student appear in male.name means he is a male; student does not appear in male.name means she is a female;
SELECT ( SELECT COUNT(name) FROM disabled WHERE name IN ('student180', 'student117') ), ( SELECT COUNT(name) FROM unemployed WHERE name IN ('student180', 'student117') ), ( SELECT COUNT(name) FROM male WHERE name IN ('student180', 'student117') ), ( SELECT COUNT(name) FROM no_payment_due WHERE name IN ('student180', 's...
CREATE TABLE longest_absense_from_school ( "name" TEXT default '' not null primary key, foreign key ("name") references person ("name") on update cascade on delete cascade, "month" INTEGER default 0 null, -- Example Values: `0`, `1`, `2`, `3`, `4` | Value Statics: Total count 1000 - Distinct count 10 - Null count 0 ...
student_loan
List out the organization joined and school enrolled by student27, student17 and student101?
organization joined refers to organ
SELECT T1.school, T2.organ FROM enrolled AS T1 INNER JOIN enlist AS T2 ON T1.`name` = T2.`name` WHERE T1.`name` IN ('student27,student17,studetn101')
CREATE TABLE longest_absense_from_school ( "name" TEXT default '' not null primary key, foreign key ("name") references person ("name") on update cascade on delete cascade, "month" INTEGER default 0 null, -- Example Values: `0`, `1`, `2`, `3`, `4` | Value Statics: Total count 1000 - Distinct count 10 - Null count 0 ...
student_loan
How many female students are not joining any of the organization?
female students refers to enlist.name who are NOT in male.name
SELECT COUNT(name) FROM person WHERE name NOT IN ( SELECT name FROM male ) AND name NOT IN ( SELECT name FROM enrolled )
CREATE TABLE longest_absense_from_school ( "name" TEXT default '' not null primary key, foreign key ("name") references person ("name") on update cascade on delete cascade, "month" INTEGER default 0 null, -- Example Values: `0`, `1`, `2`, `3`, `4` | Value Statics: Total count 1000 - Distinct count 10 - Null count 0 ...
student_loan
What is the ratio of disable female to male students?
ratio refers to DIVIDE(COUNT(name not from male), COUNT(name from male))
SELECT CAST(SUM(IIF(T2.name IS NULL, 1, 0)) AS REAL) * 100 / COUNT(T2.name) FROM disabled AS T1 LEFT JOIN male AS T2 ON T1.`name` = T2.`name`
CREATE TABLE longest_absense_from_school ( "name" TEXT default '' not null primary key, foreign key ("name") references person ("name") on update cascade on delete cascade, "month" INTEGER default 0 null, -- Example Values: `0`, `1`, `2`, `3`, `4` | Value Statics: Total count 1000 - Distinct count 10 - Null count 0 ...
student_loan
What is the average absence period of a student?
average refers to DIVIDE(SUM(month), COUNT(name))
SELECT AVG(month) FROM longest_absense_from_school
CREATE TABLE longest_absense_from_school ( "name" TEXT default '' not null primary key, foreign key ("name") references person ("name") on update cascade on delete cascade, "month" INTEGER default 0 null, -- Example Values: `0`, `1`, `2`, `3`, `4` | Value Statics: Total count 1000 - Distinct count 10 - Null count 0 ...
student_loan
How many disabled students have never been absent from school?
never been absent from school refers to month = 0
SELECT COUNT(T1.name) FROM longest_absense_from_school AS T1 INNER JOIN disabled AS T2 ON T1.`name` = T2.`name` WHERE T1.`month` = 0
CREATE TABLE longest_absense_from_school ( "name" TEXT default '' not null primary key, foreign key ("name") references person ("name") on update cascade on delete cascade, "month" INTEGER default 0 null, -- Example Values: `0`, `1`, `2`, `3`, `4` | Value Statics: Total count 1000 - Distinct count 10 - Null count 0 ...
student_loan
Which organization does student 313 belong to?
organization refers to organ
SELECT organ FROM enlist WHERE name = 'studenT113'
CREATE TABLE longest_absense_from_school ( "name" TEXT default '' not null primary key, foreign key ("name") references person ("name") on update cascade on delete cascade, "month" INTEGER default 0 null, -- Example Values: `0`, `1`, `2`, `3`, `4` | Value Statics: Total count 1000 - Distinct count 10 - Null count 0 ...
student_loan
List out all bankrupt students that are able to make payment before due?
make payment before due refers to bool = 'neg';
SELECT T1.name FROM filed_for_bankrupcy AS T1 INNER JOIN no_payment_due AS T2 ON T1.name = T2.name WHERE T2.bool = 'neg'
CREATE TABLE longest_absense_from_school ( "name" TEXT default '' not null primary key, foreign key ("name") references person ("name") on update cascade on delete cascade, "month" INTEGER default 0 null, -- Example Values: `0`, `1`, `2`, `3`, `4` | Value Statics: Total count 1000 - Distinct count 10 - Null count 0 ...
student_loan
What is the average absence period of a disabled student?
average refers to DIVIDE(SUM(month), COUNT(name))
SELECT AVG(T1.month) FROM longest_absense_from_school AS T1 INNER JOIN disabled AS T2 ON T1.name = T2.name
CREATE TABLE longest_absense_from_school ( "name" TEXT default '' not null primary key, foreign key ("name") references person ("name") on update cascade on delete cascade, "month" INTEGER default 0 null, -- Example Values: `0`, `1`, `2`, `3`, `4` | Value Statics: Total count 1000 - Distinct count 10 - Null count 0 ...
student_loan
How many students who have never been absent from school?
have never been absent refers to `month` = 0;
SELECT COUNT(name) FROM longest_absense_from_school WHERE month = 0
CREATE TABLE longest_absense_from_school ( "name" TEXT default '' not null primary key, foreign key ("name") references person ("name") on update cascade on delete cascade, "month" INTEGER default 0 null, -- Example Values: `0`, `1`, `2`, `3`, `4` | Value Statics: Total count 1000 - Distinct count 10 - Null count 0 ...
student_loan
What is the average of absence for an employed students?
average refers to DIVIDE(SUM(month), COUNT(name))
SELECT AVG(month) FROM longest_absense_from_school WHERE name NOT IN ( SELECT name FROM unemployed )
CREATE TABLE longest_absense_from_school ( "name" TEXT default '' not null primary key, foreign key ("name") references person ("name") on update cascade on delete cascade, "month" INTEGER default 0 null, -- Example Values: `0`, `1`, `2`, `3`, `4` | Value Statics: Total count 1000 - Distinct count 10 - Null count 0 ...
student_loan
How many students enlisted in the fire-department?
enlisted in the fire-department refers to organ = 'fire_department';
SELECT COUNT(name) FROM enlist WHERE organ = 'fire_department'
CREATE TABLE longest_absense_from_school ( "name" TEXT default '' not null primary key, foreign key ("name") references person ("name") on update cascade on delete cascade, "month" INTEGER default 0 null, -- Example Values: `0`, `1`, `2`, `3`, `4` | Value Statics: Total count 1000 - Distinct count 10 - Null count 0 ...
student_loan
State the number of students do not have payment due.
do not have payment due refers to bool = 'neg';
SELECT COUNT(name) FROM no_payment_due WHERE bool = 'neg'
CREATE TABLE longest_absense_from_school ( "name" TEXT default '' not null primary key, foreign key ("name") references person ("name") on update cascade on delete cascade, "month" INTEGER default 0 null, -- Example Values: `0`, `1`, `2`, `3`, `4` | Value Statics: Total count 1000 - Distinct count 10 - Null count 0 ...
student_loan
What is the average time for a disabled student to be absent from school?
average time refers to DIVIDE(SUM(`month`), COUNT(name))
SELECT AVG(T1.month) FROM longest_absense_from_school AS T1 INNER JOIN disabled AS T2 ON T1.`name` = T2.`name`
CREATE TABLE longest_absense_from_school ( "name" TEXT default '' not null primary key, foreign key ("name") references person ("name") on update cascade on delete cascade, "month" INTEGER default 0 null, -- Example Values: `0`, `1`, `2`, `3`, `4` | Value Statics: Total count 1000 - Distinct count 10 - Null count 0 ...
student_loan
How many unemployed students are enlisted in the navy organization?
enlisted in the navy organization refers to organ = 'navy';
SELECT COUNT(T1.name) FROM unemployed AS T1 INNER JOIN enlist AS T2 ON T1.name = T2.name WHERE T2.organ = 'navy'
CREATE TABLE longest_absense_from_school ( "name" TEXT default '' not null primary key, foreign key ("name") references person ("name") on update cascade on delete cascade, "month" INTEGER default 0 null, -- Example Values: `0`, `1`, `2`, `3`, `4` | Value Statics: Total count 1000 - Distinct count 10 - Null count 0 ...
student_loan
How many students have been absent above 2 months?
absent above 2 months refers to month > 2;
SELECT COUNT(name) FROM longest_absense_from_school WHERE month > 2
CREATE TABLE longest_absense_from_school ( "name" TEXT default '' not null primary key, foreign key ("name") references person ("name") on update cascade on delete cascade, "month" INTEGER default 0 null, -- Example Values: `0`, `1`, `2`, `3`, `4` | Value Statics: Total count 1000 - Distinct count 10 - Null count 0 ...
student_loan
Mention the name of disabled students who have never been absent from school.
never been absent from school refers to month = 0
SELECT T1.name FROM disabled AS T1 INNER JOIN longest_absense_from_school AS T2 ON T1.name = T2.name WHERE T2.month = 0
CREATE TABLE longest_absense_from_school ( "name" TEXT default '' not null primary key, foreign key ("name") references person ("name") on update cascade on delete cascade, "month" INTEGER default 0 null, -- Example Values: `0`, `1`, `2`, `3`, `4` | Value Statics: Total count 1000 - Distinct count 10 - Null count 0 ...
student_loan
Which school is student829 enrolled in?
null
SELECT school FROM enrolled WHERE name = 'student829'
CREATE TABLE longest_absense_from_school ( "name" TEXT default '' not null primary key, foreign key ("name") references person ("name") on update cascade on delete cascade, "month" INTEGER default 0 null, -- Example Values: `0`, `1`, `2`, `3`, `4` | Value Statics: Total count 1000 - Distinct count 10 - Null count 0 ...
student_loan
List out the number of female students who enlisted in the air force.
enlisted in the air force refers to organ = 'air_force';
SELECT COUNT(name) FROM enlist WHERE organ = 'air_force' AND name NOT IN ( SELECT name FROM male )
CREATE TABLE longest_absense_from_school ( "name" TEXT default '' not null primary key, foreign key ("name") references person ("name") on update cascade on delete cascade, "month" INTEGER default 0 null, -- Example Values: `0`, `1`, `2`, `3`, `4` | Value Statics: Total count 1000 - Distinct count 10 - Null count 0 ...
student_loan
Give the number of students who have payment due.
who have payment due refers to bool = 'pos';
SELECT COUNT(name) FROM no_payment_due WHERE bool = 'pos'
CREATE TABLE longest_absense_from_school ( "name" TEXT default '' not null primary key, foreign key ("name") references person ("name") on update cascade on delete cascade, "month" INTEGER default 0 null, -- Example Values: `0`, `1`, `2`, `3`, `4` | Value Statics: Total count 1000 - Distinct count 10 - Null count 0 ...
student_loan
State the unemployed students who enlisted in marines.
enlisted in marines refers to organ = 'marines';
SELECT T1.name FROM unemployed AS T1 INNER JOIN enlist AS T2 ON T1.name = T2.name WHERE T2.organ = 'marines'
CREATE TABLE longest_absense_from_school ( "name" TEXT default '' not null primary key, foreign key ("name") references person ("name") on update cascade on delete cascade, "month" INTEGER default 0 null, -- Example Values: `0`, `1`, `2`, `3`, `4` | Value Statics: Total count 1000 - Distinct count 10 - Null count 0 ...
student_loan
Count the number of male students who belong to foreign legion.
belong to foreign legion refers to organ = 'foreign_legion';
SELECT COUNT(T1.name) FROM male AS T1 INNER JOIN enlist AS T2 ON T1.name = T2.name WHERE T2.organ = 'foreign_legion'
CREATE TABLE longest_absense_from_school ( "name" TEXT default '' not null primary key, foreign key ("name") references person ("name") on update cascade on delete cascade, "month" INTEGER default 0 null, -- Example Values: `0`, `1`, `2`, `3`, `4` | Value Statics: Total count 1000 - Distinct count 10 - Null count 0 ...
student_loan
State name of disabled students who have the longest duration of absense from school.
longest duration of absense refers to MAX(month)
SELECT T1.name FROM disabled AS T1 INNER JOIN longest_absense_from_school AS T2 ON T1.name = T2.name ORDER BY T2.month DESC LIMIT 1
CREATE TABLE longest_absense_from_school ( "name" TEXT default '' not null primary key, foreign key ("name") references person ("name") on update cascade on delete cascade, "month" INTEGER default 0 null, -- Example Values: `0`, `1`, `2`, `3`, `4` | Value Statics: Total count 1000 - Distinct count 10 - Null count 0 ...
student_loan
What is the percentage of unemployed students who have been absent for 5 months from school?
percentage refers to DIVIDE(COUNT(month > 5), COUNT(month))
SELECT CAST(SUM(IIF(T1.month > 5, 1, 0)) AS REAL) * 100 / COUNT(T1.month) FROM longest_absense_from_school AS T1 INNER JOIN unemployed AS T2 ON T1.name = T2.name
CREATE TABLE longest_absense_from_school ( "name" TEXT default '' not null primary key, foreign key ("name") references person ("name") on update cascade on delete cascade, "month" INTEGER default 0 null, -- Example Values: `0`, `1`, `2`, `3`, `4` | Value Statics: Total count 1000 - Distinct count 10 - Null count 0 ...
student_loan
Which department has the most disabled students?
department refers to organ; most disabled students refers to MAX(disabled.name)
SELECT T2.organ, COUNT(T1.name) FROM disabled AS T1 INNER JOIN enlist AS T2 ON T1.`name` = T2.`name` GROUP BY T2.organ ORDER BY COUNT(T1.name) DESC LIMIT 1
CREATE TABLE longest_absense_from_school ( "name" TEXT default '' not null primary key, foreign key ("name") references person ("name") on update cascade on delete cascade, "month" INTEGER default 0 null, -- Example Values: `0`, `1`, `2`, `3`, `4` | Value Statics: Total count 1000 - Distinct count 10 - Null count 0 ...
student_loan
Mention the name of unemployed students who have never been absent from school.
have never been absent from school refers to month = 0
SELECT T1.name FROM longest_absense_from_school AS T1 INNER JOIN unemployed AS T2 ON T1.name = T2.name WHERE T1.month = 0
CREATE TABLE longest_absense_from_school ( "name" TEXT default '' not null primary key, foreign key ("name") references person ("name") on update cascade on delete cascade, "month" INTEGER default 0 null, -- Example Values: `0`, `1`, `2`, `3`, `4` | Value Statics: Total count 1000 - Distinct count 10 - Null count 0 ...
student_loan
Calculate the average duration of absense of disabled students.
average refers to DIVIDE(SUM(month), COUNT(name))
SELECT AVG(T1.month) FROM longest_absense_from_school AS T1 INNER JOIN disabled AS T2 ON T1.name = T2.name
CREATE TABLE longest_absense_from_school ( "name" TEXT default '' not null primary key, foreign key ("name") references person ("name") on update cascade on delete cascade, "month" INTEGER default 0 null, -- Example Values: `0`, `1`, `2`, `3`, `4` | Value Statics: Total count 1000 - Distinct count 10 - Null count 0 ...
student_loan
State name of unemployed students who have the longest duration of absense from school.
longest duration of absense refers to MAX(month)
SELECT T1.name FROM longest_absense_from_school AS T1 INNER JOIN unemployed AS T2 ON T1.name = T2.name ORDER BY T1.month DESC LIMIT 1
CREATE TABLE longest_absense_from_school ( "name" TEXT default '' not null primary key, foreign key ("name") references person ("name") on update cascade on delete cascade, "month" INTEGER default 0 null, -- Example Values: `0`, `1`, `2`, `3`, `4` | Value Statics: Total count 1000 - Distinct count 10 - Null count 0 ...
student_loan
Name all students enlisted in the foreign legion.
in the foreign legion organ = 'foreign_legion';
SELECT name FROM enlist WHERE organ = 'foreign_legion'
CREATE TABLE longest_absense_from_school ( "name" TEXT default '' not null primary key, foreign key ("name") references person ("name") on update cascade on delete cascade, "month" INTEGER default 0 null, -- Example Values: `0`, `1`, `2`, `3`, `4` | Value Statics: Total count 1000 - Distinct count 10 - Null count 0 ...
student_loan
How many students are unemployed and have payment due?
are unemployed and have payment due refers to
SELECT COUNT(T1.name) FROM unemployed AS T1 INNER JOIN no_payment_due AS T2 ON T1.`name` = T2.`name`
CREATE TABLE longest_absense_from_school ( "name" TEXT default '' not null primary key, foreign key ("name") references person ("name") on update cascade on delete cascade, "month" INTEGER default 0 null, -- Example Values: `0`, `1`, `2`, `3`, `4` | Value Statics: Total count 1000 - Distinct count 10 - Null count 0 ...
student_loan
Mention the name of students who filed for bankruptcy and have never been absent from school.
have never been absent refers to month = 0;
SELECT T1.name FROM longest_absense_from_school AS T1 INNER JOIN filed_for_bankrupcy AS T2 ON T1.name = T2.name WHERE T1.month = 0
CREATE TABLE longest_absense_from_school ( "name" TEXT default '' not null primary key, foreign key ("name") references person ("name") on update cascade on delete cascade, "month" INTEGER default 0 null, -- Example Values: `0`, `1`, `2`, `3`, `4` | Value Statics: Total count 1000 - Distinct count 10 - Null count 0 ...
student_loan
How many unemployed disabled students have been absent for 8 months from school?
absent for 8 months refers to month = 8;
SELECT COUNT(T1.name) FROM longest_absense_from_school AS T1 INNER JOIN unemployed AS T2 ON T1.name = T2.name INNER JOIN disabled AS T3 ON T2.name = T3.name WHERE T1.month = 8
CREATE TABLE longest_absense_from_school ( "name" TEXT default '' not null primary key, foreign key ("name") references person ("name") on update cascade on delete cascade, "month" INTEGER default 0 null, -- Example Values: `0`, `1`, `2`, `3`, `4` | Value Statics: Total count 1000 - Distinct count 10 - Null count 0 ...
student_loan
What is the gender of student1000?
student name appear in Male table means student is a male, student does not appear in Male table means student is a female
SELECT IIF(T.result = 0, 'female', 'male') AS re FROM ( SELECT COUNT(name) AS result FROM male WHERE name = 'studenT1000' ) T
CREATE TABLE longest_absense_from_school ( "name" TEXT default '' not null primary key, foreign key ("name") references person ("name") on update cascade on delete cascade, "month" INTEGER default 0 null, -- Example Values: `0`, `1`, `2`, `3`, `4` | Value Statics: Total count 1000 - Distinct count 10 - Null count 0 ...
student_loan
How many disabled students have been absent for 3 months from school?
have been absent for 3 months from school refers to month = 3
SELECT COUNT(T1.name) FROM longest_absense_from_school AS T1 INNER JOIN disabled AS T2 ON T1.name = T2.name WHERE T1.month = 3
CREATE TABLE longest_absense_from_school ( "name" TEXT default '' not null primary key, foreign key ("name") references person ("name") on update cascade on delete cascade, "month" INTEGER default 0 null, -- Example Values: `0`, `1`, `2`, `3`, `4` | Value Statics: Total count 1000 - Distinct count 10 - Null count 0 ...
student_loan
Which students have absents the most?
absents the most refers to MAX(month)
SELECT name FROM longest_absense_from_school WHERE month = ( SELECT MAX(month) FROM longest_absense_from_school )
CREATE TABLE longest_absense_from_school ( "name" TEXT default '' not null primary key, foreign key ("name") references person ("name") on update cascade on delete cascade, "month" INTEGER default 0 null, -- Example Values: `0`, `1`, `2`, `3`, `4` | Value Statics: Total count 1000 - Distinct count 10 - Null count 0 ...
student_loan
State name of students who filed for bankruptcy and have the longest duration of absense from school.
longest duration of absense refers to MAX(month)
SELECT T1.name FROM longest_absense_from_school AS T1 INNER JOIN filed_for_bankrupcy AS T2 ON T1.name = T2.name ORDER BY T1.month DESC LIMIT 1
CREATE TABLE longest_absense_from_school ( "name" TEXT default '' not null primary key, foreign key ("name") references person ("name") on update cascade on delete cascade, "month" INTEGER default 0 null, -- Example Values: `0`, `1`, `2`, `3`, `4` | Value Statics: Total count 1000 - Distinct count 10 - Null count 0 ...
student_loan
How many students have been absents for more than 6 months?
absents for more than 6 months refers to month > 6
SELECT COUNT(name) FROM longest_absense_from_school WHERE month > 6
CREATE TABLE longest_absense_from_school ( "name" TEXT default '' not null primary key, foreign key ("name") references person ("name") on update cascade on delete cascade, "month" INTEGER default 0 null, -- Example Values: `0`, `1`, `2`, `3`, `4` | Value Statics: Total count 1000 - Distinct count 10 - Null count 0 ...
student_loan
Find the average number of absences for each student.
average refers to DIVIDE(SUM(month), COUNT(name))
SELECT AVG(month) FROM longest_absense_from_school
CREATE TABLE longest_absense_from_school ( "name" TEXT default '' not null primary key, foreign key ("name") references person ("name") on update cascade on delete cascade, "month" INTEGER default 0 null, -- Example Values: `0`, `1`, `2`, `3`, `4` | Value Statics: Total count 1000 - Distinct count 10 - Null count 0 ...
student_loan
How many students are disabled?
null
SELECT COUNT(name) FROM disabled
CREATE TABLE longest_absense_from_school ( "name" TEXT default '' not null primary key, foreign key ("name") references person ("name") on update cascade on delete cascade, "month" INTEGER default 0 null, -- Example Values: `0`, `1`, `2`, `3`, `4` | Value Statics: Total count 1000 - Distinct count 10 - Null count 0 ...
student_loan
How many students are enlisted in the army?
enlisted in the army refers to organ = 'army';
SELECT COUNT(name) FROM enlist WHERE organ = 'army'
CREATE TABLE longest_absense_from_school ( "name" TEXT default '' not null primary key, foreign key ("name") references person ("name") on update cascade on delete cascade, "month" INTEGER default 0 null, -- Example Values: `0`, `1`, `2`, `3`, `4` | Value Statics: Total count 1000 - Distinct count 10 - Null count 0 ...
student_loan
Among the students enlisted in marines, how many of them are disabled?
enlisted in marines refers to organ = 'marines';
SELECT COUNT(T1.name) FROM enlist AS T1 INNER JOIN disabled AS T2 ON T1.name = T2.name WHERE T1.organ = 'marines'
CREATE TABLE longest_absense_from_school ( "name" TEXT default '' not null primary key, foreign key ("name") references person ("name") on update cascade on delete cascade, "month" INTEGER default 0 null, -- Example Values: `0`, `1`, `2`, `3`, `4` | Value Statics: Total count 1000 - Distinct count 10 - Null count 0 ...
student_loan
Does student348 have a due payment?
payment due refers to bool = 'pos' means the student has payment due , bool = 'neg' means the student does not have payment due;
SELECT bool FROM no_payment_due WHERE name = 'student348'
CREATE TABLE longest_absense_from_school ( "name" TEXT default '' not null primary key, foreign key ("name") references person ("name") on update cascade on delete cascade, "month" INTEGER default 0 null, -- Example Values: `0`, `1`, `2`, `3`, `4` | Value Statics: Total count 1000 - Distinct count 10 - Null count 0 ...
student_loan
Which school has the highest number of disabled students?
highest number of disabled students refers to MAX(COUNT(disabled.name))
SELECT T.school FROM ( SELECT T2.school, COUNT(T2.name) AS num FROM disabled AS T1 INNER JOIN enrolled AS T2 ON T1.name = T2.name GROUP BY T2.school ) T ORDER BY T.num DESC LIMIT 1
CREATE TABLE longest_absense_from_school ( "name" TEXT default '' not null primary key, foreign key ("name") references person ("name") on update cascade on delete cascade, "month" INTEGER default 0 null, -- Example Values: `0`, `1`, `2`, `3`, `4` | Value Statics: Total count 1000 - Distinct count 10 - Null count 0 ...
student_loan
Sum up the number of students enlisted in foreign legion, peace corps and army.
enlisted in foreign legion refers to organ = 'foreign_legion'; peace corps refers to organ = 'peace_corps'; army refers to organ = 'army'
SELECT COUNT(name) FROM enlist WHERE organ IN ('army', 'peace_corps', 'foreign_legion')
CREATE TABLE longest_absense_from_school ( "name" TEXT default '' not null primary key, foreign key ("name") references person ("name") on update cascade on delete cascade, "month" INTEGER default 0 null, -- Example Values: `0`, `1`, `2`, `3`, `4` | Value Statics: Total count 1000 - Distinct count 10 - Null count 0 ...
student_loan
Which female students had never been absent?
had never been absent refers to month = 0
SELECT T2.name FROM male AS T1 INNER JOIN longest_absense_from_school AS T2 ON T1.name <> T2.name WHERE T2.month = 0
CREATE TABLE longest_absense_from_school ( "name" TEXT default '' not null primary key, foreign key ("name") references person ("name") on update cascade on delete cascade, "month" INTEGER default 0 null, -- Example Values: `0`, `1`, `2`, `3`, `4` | Value Statics: Total count 1000 - Distinct count 10 - Null count 0 ...
retail_world
Write the shipping company name with the telephone number of (503) 555-9931.
telephone number of (503) 555-9931 refers to Phone = '(503) 555-9931'
SELECT CompanyName FROM Shippers WHERE Phone = '(503) 555-9931'
CREATE TABLE Products ( CategoryID INTEGER, -- Example Values: `1`, `2`, `7`, `6`, `8` | Value Statics: Total count 77 - Distinct count 8 - Null count 0 Unit TEXT, -- ReorderLevel INT, -- ProductName TEXT, -- Price REAL DEFAULT 0, -- FOREIGN KEY (SupplierID) REFERENCES Suppliers (SupplierID), Supplier...
student_loan
How many male students join more than one organization?
more than one organization refers to COUNT(organ) > 1
SELECT COUNT(T.a) FROM ( SELECT COUNT(DISTINCT T1.name) AS a, COUNT(T2.organ) AS num FROM male AS T1 INNER JOIN enlist AS T2 ON T1.name = T2.name GROUP BY T1.name ) T WHERE T.num > 1
CREATE TABLE longest_absense_from_school ( "name" TEXT default '' not null primary key, foreign key ("name") references person ("name") on update cascade on delete cascade, "month" INTEGER default 0 null, -- Example Values: `0`, `1`, `2`, `3`, `4` | Value Statics: Total count 1000 - Distinct count 10 - Null count 0 ...