db_id
stringclasses 39
values | schema
stringclasses 39
values | question_en
stringlengths 22
155
| hardness
stringclasses 4
values | schema_llm
stringclasses 39
values | query_llm
stringlengths 25
430
| selector
stringlengths 21
191
| schema_llm_ct
stringclasses 39
values | schema_llm_columns_min
stringclasses 39
values | schema_llm_columns_min_ct
stringclasses 39
values | schema_llm_all_min
stringclasses 39
values | schema_llm_all_min_ct
stringclasses 39
values | schema_dict
stringclasses 39
values | selector_correct
stringlengths 21
191
| schema_llm_t
stringclasses 39
values | schema_llm_columns_min_t
stringclasses 39
values | schema_llm_all_min_t
stringclasses 39
values |
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
warehouse_1 |
CREATE TABLE "Boxes" (
"Code" CHAR(4) NOT NULL,
"Contents" VARCHAR(255) NOT NULL,
"Value" REAL NOT NULL,
"Warehouse" INTEGER NOT NULL,
PRIMARY KEY ("Code"),
FOREIGN KEY("Warehouse") REFERENCES "Warehouses" ("Code")
)
CREATE TABLE "Warehouses" (
"Code" INTEGER NOT NULL,
"Location" VARCHAR(255) NOT NULL,
"Capacity" INTEGER NOT NULL,
PRIMARY KEY ("Code")
) | Find the average and total capacity of all warehouses. | medium | Table Boxes (
Boxes.Code (CHAR(4)),
Boxes.Contents (VARCHAR(255)),
Boxes.Value (REAL),
Boxes.Warehouse (INTEGER),
)
Table Warehouses (
Warehouses.Code (INTEGER),
Warehouses.Location (VARCHAR(255)),
Warehouses.Capacity (INTEGER),
)
Possible JOINs:
Boxes.Warehouse = Warehouses.Code
| SELECT avg(capacity) , sum(capacity) FROM warehouses | {
'warehouses': ['code', 'capacity']
} | CREATE TABLE Boxes (
Boxes.Code (CHAR(4)),
Boxes.Contents (VARCHAR(255)),
Boxes.Value (REAL),
Boxes.Warehouse (INTEGER),
)
CREATE TABLE Warehouses (
Warehouses.Code (INTEGER),
Warehouses.Location (VARCHAR(255)),
Warehouses.Capacity (INTEGER),
)
Possible JOINs:
Boxes.Warehouse = Warehouses.Code
| Table Boxes (
Boxes.code (CHAR(4)),
Boxes.contents (VARCHAR(255)),
Boxes.value (REAL),
Boxes.warehouse (INTEGER),
)
Table Warehouses (
Warehouses.code (INTEGER),
Warehouses.location (VARCHAR(255)),
Warehouses.capacity (INTEGER),
)
Possible JOINs:
Boxes.warehouse = Warehouses.code
| CREATE TABLE Boxes (
Boxes.code (CHAR(4)),
Boxes.contents (VARCHAR(255)),
Boxes.value (REAL),
Boxes.warehouse (INTEGER),
)
CREATE TABLE Warehouses (
Warehouses.code (INTEGER),
Warehouses.location (VARCHAR(255)),
Warehouses.capacity (INTEGER),
)
Possible JOINs:
Boxes.warehouse = Warehouses.code
| Table boxes (
boxes.code (CHAR(4)),
boxes.contents (VARCHAR(255)),
boxes.value (REAL),
boxes.warehouse (INTEGER),
)
Table warehouses (
warehouses.code (INTEGER),
warehouses.location (VARCHAR(255)),
warehouses.capacity (INTEGER),
)
Possible JOINs:
boxes.warehouse = warehouses.code
| CREATE TABLE boxes (
boxes.code (CHAR(4)),
boxes.contents (VARCHAR(255)),
boxes.value (REAL),
boxes.warehouse (INTEGER),
)
CREATE TABLE warehouses (
warehouses.code (INTEGER),
warehouses.location (VARCHAR(255)),
warehouses.capacity (INTEGER),
)
Possible JOINs:
boxes.warehouse = warehouses.code
| {
'Warehouses': ['Code', 'Location', 'Capacity'],
'Boxes': ['Code', 'Contents', 'Value', 'Warehouse']
} | {
'Warehouses': ['Code', 'Capacity']
} | TABLE Boxes (
Boxes.Code (CHAR(4)),
Boxes.Contents (VARCHAR(255)),
Boxes.Value (REAL),
Boxes.Warehouse (INTEGER),
)
TABLE Warehouses (
Warehouses.Code (INTEGER),
Warehouses.Location (VARCHAR(255)),
Warehouses.Capacity (INTEGER),
)
Possible JOINs:
Boxes.Warehouse = Warehouses.Code
| TABLE Boxes (
Boxes.code (CHAR(4)),
Boxes.contents (VARCHAR(255)),
Boxes.value (REAL),
Boxes.warehouse (INTEGER),
)
TABLE Warehouses (
Warehouses.code (INTEGER),
Warehouses.location (VARCHAR(255)),
Warehouses.capacity (INTEGER),
)
Possible JOINs:
Boxes.warehouse = Warehouses.code
| TABLE boxes (
boxes.code (CHAR(4)),
boxes.contents (VARCHAR(255)),
boxes.value (REAL),
boxes.warehouse (INTEGER),
)
TABLE warehouses (
warehouses.code (INTEGER),
warehouses.location (VARCHAR(255)),
warehouses.capacity (INTEGER),
)
Possible JOINs:
boxes.warehouse = warehouses.code
|
cre_Students_Information_Systems |
CREATE TABLE Students (
`student_id` INTEGER NOT NULL,
`bio_data` VARCHAR(255) NOT NULL,
`student_details` VARCHAR(255) NOT NULL,
PRIMARY KEY (`student_id`)
)
/*
0 rows from Students table:
student_id bio_data student_details
*/
CREATE TABLE Transcripts (
`transcript_id` INTEGER NOT NULL,
`student_id` INTEGER NOT NULL,
`date_of_transcript` DATETIME(3),
`transcript_details` VARCHAR(255) NOT NULL,
PRIMARY KEY (`transcript_id`),
FOREIGN KEY (student_id) REFERENCES Students (student_id)
)
/*
0 rows from Transcripts table:
transcript_id student_id date_of_transcript transcript_details
*/
CREATE TABLE Behaviour_Monitoring (
`behaviour_monitoring_id` INTEGER NOT NULL,
`student_id` INTEGER NOT NULL,
`behaviour_monitoring_details` VARCHAR(255) NOT NULL,
PRIMARY KEY (`behaviour_monitoring_id`),
FOREIGN KEY (student_id) REFERENCES Students (student_id)
)
/*
0 rows from Behaviour_Monitoring table:
behaviour_monitoring_id student_id behaviour_monitoring_details
*/
CREATE TABLE Addresses (
`address_id` INTEGER NOT NULL,
`address_details` VARCHAR(255) NOT NULL,
PRIMARY KEY (`address_id`)
)
/*
0 rows from Addresses table:
address_id address_details
*/
CREATE TABLE Ref_Event_Types (
`event_type_code` CHAR(10) NOT NULL,
`event_type_description` VARCHAR(255) NOT NULL,
PRIMARY KEY (`event_type_code`)
)
/*
0 rows from Ref_Event_Types table:
event_type_code event_type_description
*/
CREATE TABLE Ref_Achievement_Type (
`achievement_type_code` CHAR(15) NOT NULL,
`achievement_type_description` VARCHAR(80),
PRIMARY KEY (`achievement_type_code`)
)
/*
0 rows from Ref_Achievement_Type table:
achievement_type_code achievement_type_description
*/
CREATE TABLE Ref_Address_Types (
`address_type_code` CHAR(10) NOT NULL,
`address_type_description` VARCHAR(255) NOT NULL,
PRIMARY KEY (`address_type_code`)
)
/*
0 rows from Ref_Address_Types table:
address_type_code address_type_description
*/
CREATE TABLE Ref_Detention_Type (
`detention_type_code` CHAR(10) NOT NULL,
`detention_type_description` VARCHAR(80),
PRIMARY KEY (`detention_type_code`)
)
/*
0 rows from Ref_Detention_Type table:
detention_type_code detention_type_description
*/
CREATE TABLE Student_Events (
`event_id` INTEGER NOT NULL,
`event_type_code` CHAR(10) NOT NULL,
`student_id` INTEGER NOT NULL,
`event_date` DATETIME(3),
`other_details` VARCHAR(255) NOT NULL,
PRIMARY KEY (`event_id`),
FOREIGN KEY (student_id) REFERENCES Students (student_id),
FOREIGN KEY (event_type_code) REFERENCES Ref_Event_Types (event_type_code)
)
/*
0 rows from Student_Events table:
event_id event_type_code student_id event_date other_details
*/
CREATE TABLE Teachers (
`teacher_id` INTEGER NOT NULL,
`teacher_details` VARCHAR(255),
PRIMARY KEY (`teacher_id`)
)
/*
0 rows from Teachers table:
teacher_id teacher_details
*/
CREATE TABLE Student_Loans (
`student_loan_id` INTEGER NOT NULL,
`student_id` INTEGER NOT NULL,
`date_of_loan` DATETIME(3),
`amount_of_loan` DECIMAL(15,4),
`other_details` VARCHAR(255),
PRIMARY KEY (`student_loan_id`),
FOREIGN KEY (student_id) REFERENCES Students (student_id)
)
/*
0 rows from Student_Loans table:
student_loan_id student_id date_of_loan amount_of_loan other_details
*/
CREATE TABLE Classes (
`class_id` INTEGER NOT NULL,
`student_id` INTEGER NOT NULL,
`teacher_id` INTEGER NOT NULL,
`class_details` VARCHAR(255) NOT NULL,
PRIMARY KEY (`class_id`),
FOREIGN KEY (student_id) REFERENCES Students (student_id),
FOREIGN KEY (teacher_id) REFERENCES Teachers (teacher_id)
)
/*
0 rows from Classes table:
class_id student_id teacher_id class_details
*/
CREATE TABLE Students_Addresses (
`student_address_id` INTEGER NOT NULL,
`address_id` INTEGER NOT NULL,
`address_type_code` CHAR(10) NOT NULL,
`student_id` INTEGER NOT NULL,
`date_from` DATETIME(3),
`date_to` DATETIME(3),
PRIMARY KEY (`student_address_id`),
FOREIGN KEY (student_id) REFERENCES Students (student_id),
FOREIGN KEY (address_id) REFERENCES Addresses (address_id),
FOREIGN KEY (address_type_code) REFERENCES Ref_Address_Types (address_type_code)
)
/*
0 rows from Students_Addresses table:
student_address_id address_id address_type_code student_id date_from date_to
*/
CREATE TABLE Detention (
`detention_id` INTEGER NOT NULL,
`detention_type_code` CHAR(10) NOT NULL,
`student_id` INTEGER NOT NULL,
`datetime_detention_start` DATETIME(3),
`datetime_detention_end` DATETIME(3),
`detention_summary` VARCHAR(255),
`other_details` VARCHAR(255),
PRIMARY KEY (`detention_id`),
FOREIGN KEY (student_id) REFERENCES Students (student_id),
FOREIGN KEY (detention_type_code) REFERENCES Ref_Detention_Type (detention_type_code)
)
/*
0 rows from Detention table:
detention_id detention_type_code student_id datetime_detention_start datetime_detention_end detention_summary other_details
*/
CREATE TABLE Achievements (
`achievement_id` INTEGER NOT NULL,
`achievement_type_code` CHAR(15) NOT NULL,
`student_id` INTEGER NOT NULL,
`date_achievement` DATETIME(3),
`achievement_details` VARCHAR(255),
`other_details` VARCHAR(255),
PRIMARY KEY (`achievement_id`),
FOREIGN KEY (student_id) REFERENCES Students (student_id),
FOREIGN KEY (achievement_type_code) REFERENCES Ref_Achievement_Type (achievement_type_code)
)
/*
0 rows from Achievements table:
achievement_id achievement_type_code student_id date_achievement achievement_details other_details
*/
| Count the number of students who have a detention record. | easy | Table Achievements (
Achievements.achievement_id (INTEGER),
Achievements.achievement_type_code (CHAR(15)),
Achievements.student_id (INTEGER),
Achievements.date_achievement (DATETIME(3)),
Achievements.achievement_details (VARCHAR(255)),
Achievements.other_details (VARCHAR(255)),
)
Table Addresses (
Addresses.address_id (INTEGER),
Addresses.address_details (VARCHAR(255)),
)
Table Behaviour_Monitoring (
Behaviour_Monitoring.behaviour_monitoring_id (INTEGER),
Behaviour_Monitoring.student_id (INTEGER),
Behaviour_Monitoring.behaviour_monitoring_details (VARCHAR(255)),
)
Table Classes (
Classes.class_id (INTEGER),
Classes.student_id (INTEGER),
Classes.teacher_id (INTEGER),
Classes.class_details (VARCHAR(255)),
)
Table Detention (
Detention.detention_id (INTEGER),
Detention.detention_type_code (CHAR(10)),
Detention.student_id (INTEGER),
Detention.datetime_detention_start (DATETIME(3)),
Detention.datetime_detention_end (DATETIME(3)),
Detention.detention_summary (VARCHAR(255)),
Detention.other_details (VARCHAR(255)),
)
Table Ref_Achievement_Type (
Ref_Achievement_Type.achievement_type_code (CHAR(15)),
Ref_Achievement_Type.achievement_type_description (VARCHAR(80)),
)
Table Ref_Address_Types (
Ref_Address_Types.address_type_code (CHAR(10)),
Ref_Address_Types.address_type_description (VARCHAR(255)),
)
Table Ref_Detention_Type (
Ref_Detention_Type.detention_type_code (CHAR(10)),
Ref_Detention_Type.detention_type_description (VARCHAR(80)),
)
Table Ref_Event_Types (
Ref_Event_Types.event_type_code (CHAR(10)),
Ref_Event_Types.event_type_description (VARCHAR(255)),
)
Table Student_Events (
Student_Events.event_id (INTEGER),
Student_Events.event_type_code (CHAR(10)),
Student_Events.student_id (INTEGER),
Student_Events.event_date (DATETIME(3)),
Student_Events.other_details (VARCHAR(255)),
)
Table Student_Loans (
Student_Loans.student_loan_id (INTEGER),
Student_Loans.student_id (INTEGER),
Student_Loans.date_of_loan (DATETIME(3)),
Student_Loans.amount_of_loan (DECIMAL(15,4)),
Student_Loans.other_details (VARCHAR(255)),
)
Table Students (
Students.student_id (INTEGER),
Students.bio_data (VARCHAR(255)),
Students.student_details (VARCHAR(255)),
)
Table Students_Addresses (
Students_Addresses.student_address_id (INTEGER),
Students_Addresses.address_id (INTEGER),
Students_Addresses.address_type_code (CHAR(10)),
Students_Addresses.student_id (INTEGER),
Students_Addresses.date_from (DATETIME(3)),
Students_Addresses.date_to (DATETIME(3)),
)
Table Teachers (
Teachers.teacher_id (INTEGER),
Teachers.teacher_details (VARCHAR(255)),
)
Table Transcripts (
Transcripts.transcript_id (INTEGER),
Transcripts.student_id (INTEGER),
Transcripts.date_of_transcript (DATETIME(3)),
Transcripts.transcript_details (VARCHAR(255)),
)
Possible JOINs:
Achievements.achievement_type_code = Ref_Achievement_Type.achievement_type_code
Achievements.student_id = Students.student_id
Behaviour_Monitoring.student_id = Students.student_id
Classes.student_id = Students.student_id
Classes.teacher_id = Teachers.teacher_id
Detention.detention_type_code = Ref_Detention_Type.detention_type_code
Detention.student_id = Students.student_id
Student_Events.event_type_code = Ref_Event_Types.event_type_code
Student_Events.student_id = Students.student_id
Student_Loans.student_id = Students.student_id
Students_Addresses.address_id = Addresses.address_id
Students_Addresses.address_type_code = Ref_Address_Types.address_type_code
Students_Addresses.student_id = Students.student_id
Transcripts.student_id = Students.student_id
| SELECT count(DISTINCT student_id) FROM Detention | {
'detention': ['detention_id', 'student_id']
} | CREATE TABLE Achievements (
Achievements.achievement_id (INTEGER),
Achievements.achievement_type_code (CHAR(15)),
Achievements.student_id (INTEGER),
Achievements.date_achievement (DATETIME(3)),
Achievements.achievement_details (VARCHAR(255)),
Achievements.other_details (VARCHAR(255)),
)
CREATE TABLE Addresses (
Addresses.address_id (INTEGER),
Addresses.address_details (VARCHAR(255)),
)
CREATE TABLE Behaviour_Monitoring (
Behaviour_Monitoring.behaviour_monitoring_id (INTEGER),
Behaviour_Monitoring.student_id (INTEGER),
Behaviour_Monitoring.behaviour_monitoring_details (VARCHAR(255)),
)
CREATE TABLE Classes (
Classes.class_id (INTEGER),
Classes.student_id (INTEGER),
Classes.teacher_id (INTEGER),
Classes.class_details (VARCHAR(255)),
)
CREATE TABLE Detention (
Detention.detention_id (INTEGER),
Detention.detention_type_code (CHAR(10)),
Detention.student_id (INTEGER),
Detention.datetime_detention_start (DATETIME(3)),
Detention.datetime_detention_end (DATETIME(3)),
Detention.detention_summary (VARCHAR(255)),
Detention.other_details (VARCHAR(255)),
)
CREATE TABLE Ref_Achievement_Type (
Ref_Achievement_Type.achievement_type_code (CHAR(15)),
Ref_Achievement_Type.achievement_type_description (VARCHAR(80)),
)
CREATE TABLE Ref_Address_Types (
Ref_Address_Types.address_type_code (CHAR(10)),
Ref_Address_Types.address_type_description (VARCHAR(255)),
)
CREATE TABLE Ref_Detention_Type (
Ref_Detention_Type.detention_type_code (CHAR(10)),
Ref_Detention_Type.detention_type_description (VARCHAR(80)),
)
CREATE TABLE Ref_Event_Types (
Ref_Event_Types.event_type_code (CHAR(10)),
Ref_Event_Types.event_type_description (VARCHAR(255)),
)
CREATE TABLE Student_Events (
Student_Events.event_id (INTEGER),
Student_Events.event_type_code (CHAR(10)),
Student_Events.student_id (INTEGER),
Student_Events.event_date (DATETIME(3)),
Student_Events.other_details (VARCHAR(255)),
)
CREATE TABLE Student_Loans (
Student_Loans.student_loan_id (INTEGER),
Student_Loans.student_id (INTEGER),
Student_Loans.date_of_loan (DATETIME(3)),
Student_Loans.amount_of_loan (DECIMAL(15,4)),
Student_Loans.other_details (VARCHAR(255)),
)
CREATE TABLE Students (
Students.student_id (INTEGER),
Students.bio_data (VARCHAR(255)),
Students.student_details (VARCHAR(255)),
)
CREATE TABLE Students_Addresses (
Students_Addresses.student_address_id (INTEGER),
Students_Addresses.address_id (INTEGER),
Students_Addresses.address_type_code (CHAR(10)),
Students_Addresses.student_id (INTEGER),
Students_Addresses.date_from (DATETIME(3)),
Students_Addresses.date_to (DATETIME(3)),
)
CREATE TABLE Teachers (
Teachers.teacher_id (INTEGER),
Teachers.teacher_details (VARCHAR(255)),
)
CREATE TABLE Transcripts (
Transcripts.transcript_id (INTEGER),
Transcripts.student_id (INTEGER),
Transcripts.date_of_transcript (DATETIME(3)),
Transcripts.transcript_details (VARCHAR(255)),
)
Possible JOINs:
Achievements.achievement_type_code = Ref_Achievement_Type.achievement_type_code
Achievements.student_id = Students.student_id
Behaviour_Monitoring.student_id = Students.student_id
Classes.student_id = Students.student_id
Classes.teacher_id = Teachers.teacher_id
Detention.detention_type_code = Ref_Detention_Type.detention_type_code
Detention.student_id = Students.student_id
Student_Events.event_type_code = Ref_Event_Types.event_type_code
Student_Events.student_id = Students.student_id
Student_Loans.student_id = Students.student_id
Students_Addresses.address_id = Addresses.address_id
Students_Addresses.address_type_code = Ref_Address_Types.address_type_code
Students_Addresses.student_id = Students.student_id
Transcripts.student_id = Students.student_id
| Table Achievements (
Achievements.achievement_id (INTEGER),
Achievements.achievement_type_code (CHAR(15)),
Achievements.student_id (INTEGER),
Achievements.date_achievement (DATETIME(3)),
Achievements.achievement_details (VARCHAR(255)),
Achievements.other_details (VARCHAR(255)),
)
Table Addresses (
Addresses.address_id (INTEGER),
Addresses.address_details (VARCHAR(255)),
)
Table Behaviour_Monitoring (
Behaviour_Monitoring.behaviour_monitoring_id (INTEGER),
Behaviour_Monitoring.student_id (INTEGER),
Behaviour_Monitoring.behaviour_monitoring_details (VARCHAR(255)),
)
Table Classes (
Classes.class_id (INTEGER),
Classes.student_id (INTEGER),
Classes.teacher_id (INTEGER),
Classes.class_details (VARCHAR(255)),
)
Table Detention (
Detention.detention_id (INTEGER),
Detention.detention_type_code (CHAR(10)),
Detention.student_id (INTEGER),
Detention.datetime_detention_start (DATETIME(3)),
Detention.datetime_detention_end (DATETIME(3)),
Detention.detention_summary (VARCHAR(255)),
Detention.other_details (VARCHAR(255)),
)
Table Ref_Achievement_Type (
Ref_Achievement_Type.achievement_type_code (CHAR(15)),
Ref_Achievement_Type.achievement_type_description (VARCHAR(80)),
)
Table Ref_Address_Types (
Ref_Address_Types.address_type_code (CHAR(10)),
Ref_Address_Types.address_type_description (VARCHAR(255)),
)
Table Ref_Detention_Type (
Ref_Detention_Type.detention_type_code (CHAR(10)),
Ref_Detention_Type.detention_type_description (VARCHAR(80)),
)
Table Ref_Event_Types (
Ref_Event_Types.event_type_code (CHAR(10)),
Ref_Event_Types.event_type_description (VARCHAR(255)),
)
Table Student_Events (
Student_Events.event_id (INTEGER),
Student_Events.event_type_code (CHAR(10)),
Student_Events.student_id (INTEGER),
Student_Events.event_date (DATETIME(3)),
Student_Events.other_details (VARCHAR(255)),
)
Table Student_Loans (
Student_Loans.student_loan_id (INTEGER),
Student_Loans.student_id (INTEGER),
Student_Loans.date_of_loan (DATETIME(3)),
Student_Loans.amount_of_loan (DECIMAL(15,4)),
Student_Loans.other_details (VARCHAR(255)),
)
Table Students (
Students.student_id (INTEGER),
Students.bio_data (VARCHAR(255)),
Students.student_details (VARCHAR(255)),
)
Table Students_Addresses (
Students_Addresses.student_address_id (INTEGER),
Students_Addresses.address_id (INTEGER),
Students_Addresses.address_type_code (CHAR(10)),
Students_Addresses.student_id (INTEGER),
Students_Addresses.date_from (DATETIME(3)),
Students_Addresses.date_to (DATETIME(3)),
)
Table Teachers (
Teachers.teacher_id (INTEGER),
Teachers.teacher_details (VARCHAR(255)),
)
Table Transcripts (
Transcripts.transcript_id (INTEGER),
Transcripts.student_id (INTEGER),
Transcripts.date_of_transcript (DATETIME(3)),
Transcripts.transcript_details (VARCHAR(255)),
)
Possible JOINs:
Achievements.achievement_type_code = Ref_Achievement_Type.achievement_type_code
Achievements.student_id = Students.student_id
Behaviour_Monitoring.student_id = Students.student_id
Classes.student_id = Students.student_id
Classes.teacher_id = Teachers.teacher_id
Detention.detention_type_code = Ref_Detention_Type.detention_type_code
Detention.student_id = Students.student_id
Student_Events.event_type_code = Ref_Event_Types.event_type_code
Student_Events.student_id = Students.student_id
Student_Loans.student_id = Students.student_id
Students_Addresses.address_id = Addresses.address_id
Students_Addresses.address_type_code = Ref_Address_Types.address_type_code
Students_Addresses.student_id = Students.student_id
Transcripts.student_id = Students.student_id
| CREATE TABLE Achievements (
Achievements.achievement_id (INTEGER),
Achievements.achievement_type_code (CHAR(15)),
Achievements.student_id (INTEGER),
Achievements.date_achievement (DATETIME(3)),
Achievements.achievement_details (VARCHAR(255)),
Achievements.other_details (VARCHAR(255)),
)
CREATE TABLE Addresses (
Addresses.address_id (INTEGER),
Addresses.address_details (VARCHAR(255)),
)
CREATE TABLE Behaviour_Monitoring (
Behaviour_Monitoring.behaviour_monitoring_id (INTEGER),
Behaviour_Monitoring.student_id (INTEGER),
Behaviour_Monitoring.behaviour_monitoring_details (VARCHAR(255)),
)
CREATE TABLE Classes (
Classes.class_id (INTEGER),
Classes.student_id (INTEGER),
Classes.teacher_id (INTEGER),
Classes.class_details (VARCHAR(255)),
)
CREATE TABLE Detention (
Detention.detention_id (INTEGER),
Detention.detention_type_code (CHAR(10)),
Detention.student_id (INTEGER),
Detention.datetime_detention_start (DATETIME(3)),
Detention.datetime_detention_end (DATETIME(3)),
Detention.detention_summary (VARCHAR(255)),
Detention.other_details (VARCHAR(255)),
)
CREATE TABLE Ref_Achievement_Type (
Ref_Achievement_Type.achievement_type_code (CHAR(15)),
Ref_Achievement_Type.achievement_type_description (VARCHAR(80)),
)
CREATE TABLE Ref_Address_Types (
Ref_Address_Types.address_type_code (CHAR(10)),
Ref_Address_Types.address_type_description (VARCHAR(255)),
)
CREATE TABLE Ref_Detention_Type (
Ref_Detention_Type.detention_type_code (CHAR(10)),
Ref_Detention_Type.detention_type_description (VARCHAR(80)),
)
CREATE TABLE Ref_Event_Types (
Ref_Event_Types.event_type_code (CHAR(10)),
Ref_Event_Types.event_type_description (VARCHAR(255)),
)
CREATE TABLE Student_Events (
Student_Events.event_id (INTEGER),
Student_Events.event_type_code (CHAR(10)),
Student_Events.student_id (INTEGER),
Student_Events.event_date (DATETIME(3)),
Student_Events.other_details (VARCHAR(255)),
)
CREATE TABLE Student_Loans (
Student_Loans.student_loan_id (INTEGER),
Student_Loans.student_id (INTEGER),
Student_Loans.date_of_loan (DATETIME(3)),
Student_Loans.amount_of_loan (DECIMAL(15,4)),
Student_Loans.other_details (VARCHAR(255)),
)
CREATE TABLE Students (
Students.student_id (INTEGER),
Students.bio_data (VARCHAR(255)),
Students.student_details (VARCHAR(255)),
)
CREATE TABLE Students_Addresses (
Students_Addresses.student_address_id (INTEGER),
Students_Addresses.address_id (INTEGER),
Students_Addresses.address_type_code (CHAR(10)),
Students_Addresses.student_id (INTEGER),
Students_Addresses.date_from (DATETIME(3)),
Students_Addresses.date_to (DATETIME(3)),
)
CREATE TABLE Teachers (
Teachers.teacher_id (INTEGER),
Teachers.teacher_details (VARCHAR(255)),
)
CREATE TABLE Transcripts (
Transcripts.transcript_id (INTEGER),
Transcripts.student_id (INTEGER),
Transcripts.date_of_transcript (DATETIME(3)),
Transcripts.transcript_details (VARCHAR(255)),
)
Possible JOINs:
Achievements.achievement_type_code = Ref_Achievement_Type.achievement_type_code
Achievements.student_id = Students.student_id
Behaviour_Monitoring.student_id = Students.student_id
Classes.student_id = Students.student_id
Classes.teacher_id = Teachers.teacher_id
Detention.detention_type_code = Ref_Detention_Type.detention_type_code
Detention.student_id = Students.student_id
Student_Events.event_type_code = Ref_Event_Types.event_type_code
Student_Events.student_id = Students.student_id
Student_Loans.student_id = Students.student_id
Students_Addresses.address_id = Addresses.address_id
Students_Addresses.address_type_code = Ref_Address_Types.address_type_code
Students_Addresses.student_id = Students.student_id
Transcripts.student_id = Students.student_id
| Table achievements (
achievements.achievement_id (INTEGER),
achievements.achievement_type_code (CHAR(15)),
achievements.student_id (INTEGER),
achievements.date_achievement (DATETIME(3)),
achievements.achievement_details (VARCHAR(255)),
achievements.other_details (VARCHAR(255)),
)
Table addresses (
addresses.address_id (INTEGER),
addresses.address_details (VARCHAR(255)),
)
Table behaviour_monitoring (
behaviour_monitoring.behaviour_monitoring_id (INTEGER),
behaviour_monitoring.student_id (INTEGER),
behaviour_monitoring.behaviour_monitoring_details (VARCHAR(255)),
)
Table classes (
classes.class_id (INTEGER),
classes.student_id (INTEGER),
classes.teacher_id (INTEGER),
classes.class_details (VARCHAR(255)),
)
Table detention (
detention.detention_id (INTEGER),
detention.detention_type_code (CHAR(10)),
detention.student_id (INTEGER),
detention.datetime_detention_start (DATETIME(3)),
detention.datetime_detention_end (DATETIME(3)),
detention.detention_summary (VARCHAR(255)),
detention.other_details (VARCHAR(255)),
)
Table ref_achievement_type (
ref_achievement_type.achievement_type_code (CHAR(15)),
ref_achievement_type.achievement_type_description (VARCHAR(80)),
)
Table ref_address_types (
ref_address_types.address_type_code (CHAR(10)),
ref_address_types.address_type_description (VARCHAR(255)),
)
Table ref_detention_type (
ref_detention_type.detention_type_code (CHAR(10)),
ref_detention_type.detention_type_description (VARCHAR(80)),
)
Table ref_event_types (
ref_event_types.event_type_code (CHAR(10)),
ref_event_types.event_type_description (VARCHAR(255)),
)
Table student_events (
student_events.event_id (INTEGER),
student_events.event_type_code (CHAR(10)),
student_events.student_id (INTEGER),
student_events.event_date (DATETIME(3)),
student_events.other_details (VARCHAR(255)),
)
Table student_loans (
student_loans.student_loan_id (INTEGER),
student_loans.student_id (INTEGER),
student_loans.date_of_loan (DATETIME(3)),
student_loans.amount_of_loan (DECIMAL(15,4)),
student_loans.other_details (VARCHAR(255)),
)
Table students (
students.student_id (INTEGER),
students.bio_data (VARCHAR(255)),
students.student_details (VARCHAR(255)),
)
Table students_addresses (
students_addresses.student_address_id (INTEGER),
students_addresses.address_id (INTEGER),
students_addresses.address_type_code (CHAR(10)),
students_addresses.student_id (INTEGER),
students_addresses.date_from (DATETIME(3)),
students_addresses.date_to (DATETIME(3)),
)
Table teachers (
teachers.teacher_id (INTEGER),
teachers.teacher_details (VARCHAR(255)),
)
Table transcripts (
transcripts.transcript_id (INTEGER),
transcripts.student_id (INTEGER),
transcripts.date_of_transcript (DATETIME(3)),
transcripts.transcript_details (VARCHAR(255)),
)
Possible JOINs:
achievements.achievement_type_code = ref_achievement_type.achievement_type_code
achievements.student_id = students.student_id
behaviour_monitoring.student_id = students.student_id
classes.student_id = students.student_id
classes.teacher_id = teachers.teacher_id
detention.detention_type_code = ref_detention_type.detention_type_code
detention.student_id = students.student_id
student_events.event_type_code = ref_event_types.event_type_code
student_events.student_id = students.student_id
student_loans.student_id = students.student_id
students_addresses.address_id = addresses.address_id
students_addresses.address_type_code = ref_address_types.address_type_code
students_addresses.student_id = students.student_id
transcripts.student_id = students.student_id
| CREATE TABLE achievements (
achievements.achievement_id (INTEGER),
achievements.achievement_type_code (CHAR(15)),
achievements.student_id (INTEGER),
achievements.date_achievement (DATETIME(3)),
achievements.achievement_details (VARCHAR(255)),
achievements.other_details (VARCHAR(255)),
)
CREATE TABLE addresses (
addresses.address_id (INTEGER),
addresses.address_details (VARCHAR(255)),
)
CREATE TABLE behaviour_monitoring (
behaviour_monitoring.behaviour_monitoring_id (INTEGER),
behaviour_monitoring.student_id (INTEGER),
behaviour_monitoring.behaviour_monitoring_details (VARCHAR(255)),
)
CREATE TABLE classes (
classes.class_id (INTEGER),
classes.student_id (INTEGER),
classes.teacher_id (INTEGER),
classes.class_details (VARCHAR(255)),
)
CREATE TABLE detention (
detention.detention_id (INTEGER),
detention.detention_type_code (CHAR(10)),
detention.student_id (INTEGER),
detention.datetime_detention_start (DATETIME(3)),
detention.datetime_detention_end (DATETIME(3)),
detention.detention_summary (VARCHAR(255)),
detention.other_details (VARCHAR(255)),
)
CREATE TABLE ref_achievement_type (
ref_achievement_type.achievement_type_code (CHAR(15)),
ref_achievement_type.achievement_type_description (VARCHAR(80)),
)
CREATE TABLE ref_address_types (
ref_address_types.address_type_code (CHAR(10)),
ref_address_types.address_type_description (VARCHAR(255)),
)
CREATE TABLE ref_detention_type (
ref_detention_type.detention_type_code (CHAR(10)),
ref_detention_type.detention_type_description (VARCHAR(80)),
)
CREATE TABLE ref_event_types (
ref_event_types.event_type_code (CHAR(10)),
ref_event_types.event_type_description (VARCHAR(255)),
)
CREATE TABLE student_events (
student_events.event_id (INTEGER),
student_events.event_type_code (CHAR(10)),
student_events.student_id (INTEGER),
student_events.event_date (DATETIME(3)),
student_events.other_details (VARCHAR(255)),
)
CREATE TABLE student_loans (
student_loans.student_loan_id (INTEGER),
student_loans.student_id (INTEGER),
student_loans.date_of_loan (DATETIME(3)),
student_loans.amount_of_loan (DECIMAL(15,4)),
student_loans.other_details (VARCHAR(255)),
)
CREATE TABLE students (
students.student_id (INTEGER),
students.bio_data (VARCHAR(255)),
students.student_details (VARCHAR(255)),
)
CREATE TABLE students_addresses (
students_addresses.student_address_id (INTEGER),
students_addresses.address_id (INTEGER),
students_addresses.address_type_code (CHAR(10)),
students_addresses.student_id (INTEGER),
students_addresses.date_from (DATETIME(3)),
students_addresses.date_to (DATETIME(3)),
)
CREATE TABLE teachers (
teachers.teacher_id (INTEGER),
teachers.teacher_details (VARCHAR(255)),
)
CREATE TABLE transcripts (
transcripts.transcript_id (INTEGER),
transcripts.student_id (INTEGER),
transcripts.date_of_transcript (DATETIME(3)),
transcripts.transcript_details (VARCHAR(255)),
)
Possible JOINs:
achievements.achievement_type_code = ref_achievement_type.achievement_type_code
achievements.student_id = students.student_id
behaviour_monitoring.student_id = students.student_id
classes.student_id = students.student_id
classes.teacher_id = teachers.teacher_id
detention.detention_type_code = ref_detention_type.detention_type_code
detention.student_id = students.student_id
student_events.event_type_code = ref_event_types.event_type_code
student_events.student_id = students.student_id
student_loans.student_id = students.student_id
students_addresses.address_id = addresses.address_id
students_addresses.address_type_code = ref_address_types.address_type_code
students_addresses.student_id = students.student_id
transcripts.student_id = students.student_id
| {
'Students': ['student_id', 'bio_data', 'student_details'],
'Transcripts': ['transcript_id', 'student_id', 'date_of_transcript', 'transcript_details'],
'Behaviour_Monitoring': ['behaviour_monitoring_id', 'student_id', 'behaviour_monitoring_details'],
'Addresses': ['address_id', 'address_details'],
'Ref_Event_Types': ['event_type_code', 'event_type_description'],
'Ref_Achievement_Type': ['achievement_type_code', 'achievement_type_description'],
'Ref_Address_Types': ['address_type_code', 'address_type_description'],
'Ref_Detention_Type': ['detention_type_code', 'detention_type_description'],
'Student_Events': ['event_id', 'event_type_code', 'student_id', 'event_date', 'other_details'],
'Teachers': ['teacher_id', 'teacher_details'],
'Student_Loans': ['student_loan_id', 'student_id', 'date_of_loan', 'amount_of_loan', 'other_details'],
'Classes': ['class_id', 'student_id', 'teacher_id', 'class_details'],
'Students_Addresses': ['student_address_id', 'address_id', 'address_type_code', 'student_id', 'date_from', 'date_to'],
'Detention': ['detention_id', 'detention_type_code', 'student_id', 'datetime_detention_start', 'datetime_detention_end', 'detention_summary', 'other_details'],
'Achievements': ['achievement_id', 'achievement_type_code', 'student_id', 'date_achievement', 'achievement_details', 'other_details']
} | {
'Detention': ['detention_id', 'student_id']
} | TABLE Achievements (
Achievements.achievement_id (INTEGER),
Achievements.achievement_type_code (CHAR(15)),
Achievements.student_id (INTEGER),
Achievements.date_achievement (DATETIME(3)),
Achievements.achievement_details (VARCHAR(255)),
Achievements.other_details (VARCHAR(255)),
)
TABLE Addresses (
Addresses.address_id (INTEGER),
Addresses.address_details (VARCHAR(255)),
)
TABLE Behaviour_Monitoring (
Behaviour_Monitoring.behaviour_monitoring_id (INTEGER),
Behaviour_Monitoring.student_id (INTEGER),
Behaviour_Monitoring.behaviour_monitoring_details (VARCHAR(255)),
)
TABLE Classes (
Classes.class_id (INTEGER),
Classes.student_id (INTEGER),
Classes.teacher_id (INTEGER),
Classes.class_details (VARCHAR(255)),
)
TABLE Detention (
Detention.detention_id (INTEGER),
Detention.detention_type_code (CHAR(10)),
Detention.student_id (INTEGER),
Detention.datetime_detention_start (DATETIME(3)),
Detention.datetime_detention_end (DATETIME(3)),
Detention.detention_summary (VARCHAR(255)),
Detention.other_details (VARCHAR(255)),
)
TABLE Ref_Achievement_Type (
Ref_Achievement_Type.achievement_type_code (CHAR(15)),
Ref_Achievement_Type.achievement_type_description (VARCHAR(80)),
)
TABLE Ref_Address_Types (
Ref_Address_Types.address_type_code (CHAR(10)),
Ref_Address_Types.address_type_description (VARCHAR(255)),
)
TABLE Ref_Detention_Type (
Ref_Detention_Type.detention_type_code (CHAR(10)),
Ref_Detention_Type.detention_type_description (VARCHAR(80)),
)
TABLE Ref_Event_Types (
Ref_Event_Types.event_type_code (CHAR(10)),
Ref_Event_Types.event_type_description (VARCHAR(255)),
)
TABLE Student_Events (
Student_Events.event_id (INTEGER),
Student_Events.event_type_code (CHAR(10)),
Student_Events.student_id (INTEGER),
Student_Events.event_date (DATETIME(3)),
Student_Events.other_details (VARCHAR(255)),
)
TABLE Student_Loans (
Student_Loans.student_loan_id (INTEGER),
Student_Loans.student_id (INTEGER),
Student_Loans.date_of_loan (DATETIME(3)),
Student_Loans.amount_of_loan (DECIMAL(15,4)),
Student_Loans.other_details (VARCHAR(255)),
)
TABLE Students (
Students.student_id (INTEGER),
Students.bio_data (VARCHAR(255)),
Students.student_details (VARCHAR(255)),
)
TABLE Students_Addresses (
Students_Addresses.student_address_id (INTEGER),
Students_Addresses.address_id (INTEGER),
Students_Addresses.address_type_code (CHAR(10)),
Students_Addresses.student_id (INTEGER),
Students_Addresses.date_from (DATETIME(3)),
Students_Addresses.date_to (DATETIME(3)),
)
TABLE Teachers (
Teachers.teacher_id (INTEGER),
Teachers.teacher_details (VARCHAR(255)),
)
TABLE Transcripts (
Transcripts.transcript_id (INTEGER),
Transcripts.student_id (INTEGER),
Transcripts.date_of_transcript (DATETIME(3)),
Transcripts.transcript_details (VARCHAR(255)),
)
Possible JOINs:
Achievements.achievement_type_code = Ref_Achievement_Type.achievement_type_code
Achievements.student_id = Students.student_id
Behaviour_Monitoring.student_id = Students.student_id
Classes.student_id = Students.student_id
Classes.teacher_id = Teachers.teacher_id
Detention.detention_type_code = Ref_Detention_Type.detention_type_code
Detention.student_id = Students.student_id
Student_Events.event_type_code = Ref_Event_Types.event_type_code
Student_Events.student_id = Students.student_id
Student_Loans.student_id = Students.student_id
Students_Addresses.address_id = Addresses.address_id
Students_Addresses.address_type_code = Ref_Address_Types.address_type_code
Students_Addresses.student_id = Students.student_id
Transcripts.student_id = Students.student_id
| TABLE Achievements (
Achievements.achievement_id (INTEGER),
Achievements.achievement_type_code (CHAR(15)),
Achievements.student_id (INTEGER),
Achievements.date_achievement (DATETIME(3)),
Achievements.achievement_details (VARCHAR(255)),
Achievements.other_details (VARCHAR(255)),
)
TABLE Addresses (
Addresses.address_id (INTEGER),
Addresses.address_details (VARCHAR(255)),
)
TABLE Behaviour_Monitoring (
Behaviour_Monitoring.behaviour_monitoring_id (INTEGER),
Behaviour_Monitoring.student_id (INTEGER),
Behaviour_Monitoring.behaviour_monitoring_details (VARCHAR(255)),
)
TABLE Classes (
Classes.class_id (INTEGER),
Classes.student_id (INTEGER),
Classes.teacher_id (INTEGER),
Classes.class_details (VARCHAR(255)),
)
TABLE Detention (
Detention.detention_id (INTEGER),
Detention.detention_type_code (CHAR(10)),
Detention.student_id (INTEGER),
Detention.datetime_detention_start (DATETIME(3)),
Detention.datetime_detention_end (DATETIME(3)),
Detention.detention_summary (VARCHAR(255)),
Detention.other_details (VARCHAR(255)),
)
TABLE Ref_Achievement_Type (
Ref_Achievement_Type.achievement_type_code (CHAR(15)),
Ref_Achievement_Type.achievement_type_description (VARCHAR(80)),
)
TABLE Ref_Address_Types (
Ref_Address_Types.address_type_code (CHAR(10)),
Ref_Address_Types.address_type_description (VARCHAR(255)),
)
TABLE Ref_Detention_Type (
Ref_Detention_Type.detention_type_code (CHAR(10)),
Ref_Detention_Type.detention_type_description (VARCHAR(80)),
)
TABLE Ref_Event_Types (
Ref_Event_Types.event_type_code (CHAR(10)),
Ref_Event_Types.event_type_description (VARCHAR(255)),
)
TABLE Student_Events (
Student_Events.event_id (INTEGER),
Student_Events.event_type_code (CHAR(10)),
Student_Events.student_id (INTEGER),
Student_Events.event_date (DATETIME(3)),
Student_Events.other_details (VARCHAR(255)),
)
TABLE Student_Loans (
Student_Loans.student_loan_id (INTEGER),
Student_Loans.student_id (INTEGER),
Student_Loans.date_of_loan (DATETIME(3)),
Student_Loans.amount_of_loan (DECIMAL(15,4)),
Student_Loans.other_details (VARCHAR(255)),
)
TABLE Students (
Students.student_id (INTEGER),
Students.bio_data (VARCHAR(255)),
Students.student_details (VARCHAR(255)),
)
TABLE Students_Addresses (
Students_Addresses.student_address_id (INTEGER),
Students_Addresses.address_id (INTEGER),
Students_Addresses.address_type_code (CHAR(10)),
Students_Addresses.student_id (INTEGER),
Students_Addresses.date_from (DATETIME(3)),
Students_Addresses.date_to (DATETIME(3)),
)
TABLE Teachers (
Teachers.teacher_id (INTEGER),
Teachers.teacher_details (VARCHAR(255)),
)
TABLE Transcripts (
Transcripts.transcript_id (INTEGER),
Transcripts.student_id (INTEGER),
Transcripts.date_of_transcript (DATETIME(3)),
Transcripts.transcript_details (VARCHAR(255)),
)
Possible JOINs:
Achievements.achievement_type_code = Ref_Achievement_Type.achievement_type_code
Achievements.student_id = Students.student_id
Behaviour_Monitoring.student_id = Students.student_id
Classes.student_id = Students.student_id
Classes.teacher_id = Teachers.teacher_id
Detention.detention_type_code = Ref_Detention_Type.detention_type_code
Detention.student_id = Students.student_id
Student_Events.event_type_code = Ref_Event_Types.event_type_code
Student_Events.student_id = Students.student_id
Student_Loans.student_id = Students.student_id
Students_Addresses.address_id = Addresses.address_id
Students_Addresses.address_type_code = Ref_Address_Types.address_type_code
Students_Addresses.student_id = Students.student_id
Transcripts.student_id = Students.student_id
| TABLE achievements (
achievements.achievement_id (INTEGER),
achievements.achievement_type_code (CHAR(15)),
achievements.student_id (INTEGER),
achievements.date_achievement (DATETIME(3)),
achievements.achievement_details (VARCHAR(255)),
achievements.other_details (VARCHAR(255)),
)
TABLE addresses (
addresses.address_id (INTEGER),
addresses.address_details (VARCHAR(255)),
)
TABLE behaviour_monitoring (
behaviour_monitoring.behaviour_monitoring_id (INTEGER),
behaviour_monitoring.student_id (INTEGER),
behaviour_monitoring.behaviour_monitoring_details (VARCHAR(255)),
)
TABLE classes (
classes.class_id (INTEGER),
classes.student_id (INTEGER),
classes.teacher_id (INTEGER),
classes.class_details (VARCHAR(255)),
)
TABLE detention (
detention.detention_id (INTEGER),
detention.detention_type_code (CHAR(10)),
detention.student_id (INTEGER),
detention.datetime_detention_start (DATETIME(3)),
detention.datetime_detention_end (DATETIME(3)),
detention.detention_summary (VARCHAR(255)),
detention.other_details (VARCHAR(255)),
)
TABLE ref_achievement_type (
ref_achievement_type.achievement_type_code (CHAR(15)),
ref_achievement_type.achievement_type_description (VARCHAR(80)),
)
TABLE ref_address_types (
ref_address_types.address_type_code (CHAR(10)),
ref_address_types.address_type_description (VARCHAR(255)),
)
TABLE ref_detention_type (
ref_detention_type.detention_type_code (CHAR(10)),
ref_detention_type.detention_type_description (VARCHAR(80)),
)
TABLE ref_event_types (
ref_event_types.event_type_code (CHAR(10)),
ref_event_types.event_type_description (VARCHAR(255)),
)
TABLE student_events (
student_events.event_id (INTEGER),
student_events.event_type_code (CHAR(10)),
student_events.student_id (INTEGER),
student_events.event_date (DATETIME(3)),
student_events.other_details (VARCHAR(255)),
)
TABLE student_loans (
student_loans.student_loan_id (INTEGER),
student_loans.student_id (INTEGER),
student_loans.date_of_loan (DATETIME(3)),
student_loans.amount_of_loan (DECIMAL(15,4)),
student_loans.other_details (VARCHAR(255)),
)
TABLE students (
students.student_id (INTEGER),
students.bio_data (VARCHAR(255)),
students.student_details (VARCHAR(255)),
)
TABLE students_addresses (
students_addresses.student_address_id (INTEGER),
students_addresses.address_id (INTEGER),
students_addresses.address_type_code (CHAR(10)),
students_addresses.student_id (INTEGER),
students_addresses.date_from (DATETIME(3)),
students_addresses.date_to (DATETIME(3)),
)
TABLE teachers (
teachers.teacher_id (INTEGER),
teachers.teacher_details (VARCHAR(255)),
)
TABLE transcripts (
transcripts.transcript_id (INTEGER),
transcripts.student_id (INTEGER),
transcripts.date_of_transcript (DATETIME(3)),
transcripts.transcript_details (VARCHAR(255)),
)
Possible JOINs:
achievements.achievement_type_code = ref_achievement_type.achievement_type_code
achievements.student_id = students.student_id
behaviour_monitoring.student_id = students.student_id
classes.student_id = students.student_id
classes.teacher_id = teachers.teacher_id
detention.detention_type_code = ref_detention_type.detention_type_code
detention.student_id = students.student_id
student_events.event_type_code = ref_event_types.event_type_code
student_events.student_id = students.student_id
student_loans.student_id = students.student_id
students_addresses.address_id = addresses.address_id
students_addresses.address_type_code = ref_address_types.address_type_code
students_addresses.student_id = students.student_id
transcripts.student_id = students.student_id
|
aan_1 |
CREATE TABLE "Affiliation" (
affiliation_id INTEGER NOT NULL,
name VARCHAR(255) DEFAULT NULL,
address VARCHAR(255) DEFAULT NULL,
PRIMARY KEY (affiliation_id)
)
CREATE TABLE "Author" (
author_id INTEGER NOT NULL,
name VARCHAR(255) DEFAULT NULL,
email VARCHAR(255) DEFAULT NULL,
PRIMARY KEY (author_id)
)
CREATE TABLE "Author_list" (
paper_id VARCHAR(25) NOT NULL,
author_id INTEGER NOT NULL,
affiliation_id INTEGER DEFAULT NULL,
PRIMARY KEY (paper_id, author_id),
FOREIGN KEY(affiliation_id) REFERENCES "Affiliation" (affiliation_id),
FOREIGN KEY(author_id) REFERENCES "Author" (author_id),
FOREIGN KEY(paper_id) REFERENCES "Paper" (paper_id)
)
CREATE TABLE "Citation" (
paper_id VARCHAR(25) NOT NULL,
cited_paper_id VARCHAR(25) NOT NULL,
PRIMARY KEY (paper_id, cited_paper_id),
FOREIGN KEY(cited_paper_id) REFERENCES "Paper" (paper_id),
FOREIGN KEY(paper_id) REFERENCES "Paper" (paper_id)
)
CREATE TABLE "Paper" (
paper_id VARCHAR(25) NOT NULL,
title VARCHAR(255) DEFAULT NULL,
venue VARCHAR(255) DEFAULT NULL,
year INTEGER DEFAULT NULL,
PRIMARY KEY (paper_id)
) | What is the name of the author with the most papers in 2009? | extra | Table Affiliation (
Affiliation.affiliation_id (INTEGER),
Affiliation.name (varchar(255)),
Affiliation.address (varchar(255)),
)
Table Author (
Author.author_id (INTEGER),
Author.name (varchar(255)),
Author.email (varchar(255)),
)
Table Author_list (
Author_list.paper_id (varchar(25)),
Author_list.author_id (INTEGER),
Author_list.affiliation_id (INTEGER),
)
Table Citation (
Citation.paper_id (varchar(25)),
Citation.cited_paper_id (varchar(25)),
)
Table Paper (
Paper.paper_id (varchar(25)),
Paper.title (varchar(255)),
Paper.venue (varchar(255)),
Paper.year (INTEGER),
)
Possible JOINs:
Author_list.paper_id = Paper.paper_id
Author_list.author_id = Author.author_id
Author_list.affiliation_id = Affiliation.affiliation_id
Citation.paper_id = Paper.paper_id
Citation.cited_paper_id = Paper.paper_id
| SELECT Author.name FROM Paper JOIN Author_list ON Paper.paper_id = Author_list.paper_id JOIN Author ON Author.author_id = Author_list.author_id WHERE Paper.year = 2009 GROUP BY Author_list.author_id ORDER BY count(*) DESC LIMIT 1 | {
'paper': ['paper_id', 'year'],
'author_list': ['paper_id', 'author_id'],
'author': ['author_id', 'name']
} | CREATE TABLE Affiliation (
Affiliation.affiliation_id (INTEGER),
Affiliation.name (varchar(255)),
Affiliation.address (varchar(255)),
)
CREATE TABLE Author (
Author.author_id (INTEGER),
Author.name (varchar(255)),
Author.email (varchar(255)),
)
CREATE TABLE Author_list (
Author_list.paper_id (varchar(25)),
Author_list.author_id (INTEGER),
Author_list.affiliation_id (INTEGER),
)
CREATE TABLE Citation (
Citation.paper_id (varchar(25)),
Citation.cited_paper_id (varchar(25)),
)
CREATE TABLE Paper (
Paper.paper_id (varchar(25)),
Paper.title (varchar(255)),
Paper.venue (varchar(255)),
Paper.year (INTEGER),
)
Possible JOINs:
Author_list.paper_id = Paper.paper_id
Author_list.author_id = Author.author_id
Author_list.affiliation_id = Affiliation.affiliation_id
Citation.paper_id = Paper.paper_id
Citation.cited_paper_id = Paper.paper_id
| Table Affiliation (
Affiliation.affiliation_id (INTEGER),
Affiliation.name (varchar(255)),
Affiliation.address (varchar(255)),
)
Table Author (
Author.author_id (INTEGER),
Author.name (varchar(255)),
Author.email (varchar(255)),
)
Table Author_list (
Author_list.paper_id (varchar(25)),
Author_list.author_id (INTEGER),
Author_list.affiliation_id (INTEGER),
)
Table Citation (
Citation.paper_id (varchar(25)),
Citation.cited_paper_id (varchar(25)),
)
Table Paper (
Paper.paper_id (varchar(25)),
Paper.title (varchar(255)),
Paper.venue (varchar(255)),
Paper.year (INTEGER),
)
Possible JOINs:
Author_list.paper_id = Paper.paper_id
Author_list.author_id = Author.author_id
Author_list.affiliation_id = Affiliation.affiliation_id
Citation.paper_id = Paper.paper_id
Citation.cited_paper_id = Paper.paper_id
| CREATE TABLE Affiliation (
Affiliation.affiliation_id (INTEGER),
Affiliation.name (varchar(255)),
Affiliation.address (varchar(255)),
)
CREATE TABLE Author (
Author.author_id (INTEGER),
Author.name (varchar(255)),
Author.email (varchar(255)),
)
CREATE TABLE Author_list (
Author_list.paper_id (varchar(25)),
Author_list.author_id (INTEGER),
Author_list.affiliation_id (INTEGER),
)
CREATE TABLE Citation (
Citation.paper_id (varchar(25)),
Citation.cited_paper_id (varchar(25)),
)
CREATE TABLE Paper (
Paper.paper_id (varchar(25)),
Paper.title (varchar(255)),
Paper.venue (varchar(255)),
Paper.year (INTEGER),
)
Possible JOINs:
Author_list.paper_id = Paper.paper_id
Author_list.author_id = Author.author_id
Author_list.affiliation_id = Affiliation.affiliation_id
Citation.paper_id = Paper.paper_id
Citation.cited_paper_id = Paper.paper_id
| Table affiliation (
affiliation.affiliation_id (INTEGER),
affiliation.name (varchar(255)),
affiliation.address (varchar(255)),
)
Table author (
author.author_id (INTEGER),
author.name (varchar(255)),
author.email (varchar(255)),
)
Table author_list (
author_list.paper_id (varchar(25)),
author_list.author_id (INTEGER),
author_list.affiliation_id (INTEGER),
)
Table citation (
citation.paper_id (varchar(25)),
citation.cited_paper_id (varchar(25)),
)
Table paper (
paper.paper_id (varchar(25)),
paper.title (varchar(255)),
paper.venue (varchar(255)),
paper.year (INTEGER),
)
Possible JOINs:
author_list.paper_id = paper.paper_id
author_list.author_id = author.author_id
author_list.affiliation_id = affiliation.affiliation_id
citation.paper_id = paper.paper_id
citation.cited_paper_id = paper.paper_id
| CREATE TABLE affiliation (
affiliation.affiliation_id (INTEGER),
affiliation.name (varchar(255)),
affiliation.address (varchar(255)),
)
CREATE TABLE author (
author.author_id (INTEGER),
author.name (varchar(255)),
author.email (varchar(255)),
)
CREATE TABLE author_list (
author_list.paper_id (varchar(25)),
author_list.author_id (INTEGER),
author_list.affiliation_id (INTEGER),
)
CREATE TABLE citation (
citation.paper_id (varchar(25)),
citation.cited_paper_id (varchar(25)),
)
CREATE TABLE paper (
paper.paper_id (varchar(25)),
paper.title (varchar(255)),
paper.venue (varchar(255)),
paper.year (INTEGER),
)
Possible JOINs:
author_list.paper_id = paper.paper_id
author_list.author_id = author.author_id
author_list.affiliation_id = affiliation.affiliation_id
citation.paper_id = paper.paper_id
citation.cited_paper_id = paper.paper_id
| {
'Affiliation': ['affiliation_id', 'name', 'address'],
'Author': ['author_id', 'name', 'email'],
'Author_list': ['paper_id', 'author_id', 'affiliation_id'],
'Citation': ['paper_id', 'cited_paper_id'],
'Paper': ['paper_id', 'title', 'venue', 'year']
} | {
'Paper': ['paper_id', 'year'],
'Author_list': ['paper_id', 'author_id'],
'Author': ['author_id', 'name']
} | TABLE Affiliation (
Affiliation.affiliation_id (INTEGER),
Affiliation.name (varchar(255)),
Affiliation.address (varchar(255)),
)
TABLE Author (
Author.author_id (INTEGER),
Author.name (varchar(255)),
Author.email (varchar(255)),
)
TABLE Author_list (
Author_list.paper_id (varchar(25)),
Author_list.author_id (INTEGER),
Author_list.affiliation_id (INTEGER),
)
TABLE Citation (
Citation.paper_id (varchar(25)),
Citation.cited_paper_id (varchar(25)),
)
TABLE Paper (
Paper.paper_id (varchar(25)),
Paper.title (varchar(255)),
Paper.venue (varchar(255)),
Paper.year (INTEGER),
)
Possible JOINs:
Author_list.paper_id = Paper.paper_id
Author_list.author_id = Author.author_id
Author_list.affiliation_id = Affiliation.affiliation_id
Citation.paper_id = Paper.paper_id
Citation.cited_paper_id = Paper.paper_id
| TABLE Affiliation (
Affiliation.affiliation_id (INTEGER),
Affiliation.name (varchar(255)),
Affiliation.address (varchar(255)),
)
TABLE Author (
Author.author_id (INTEGER),
Author.name (varchar(255)),
Author.email (varchar(255)),
)
TABLE Author_list (
Author_list.paper_id (varchar(25)),
Author_list.author_id (INTEGER),
Author_list.affiliation_id (INTEGER),
)
TABLE Citation (
Citation.paper_id (varchar(25)),
Citation.cited_paper_id (varchar(25)),
)
TABLE Paper (
Paper.paper_id (varchar(25)),
Paper.title (varchar(255)),
Paper.venue (varchar(255)),
Paper.year (INTEGER),
)
Possible JOINs:
Author_list.paper_id = Paper.paper_id
Author_list.author_id = Author.author_id
Author_list.affiliation_id = Affiliation.affiliation_id
Citation.paper_id = Paper.paper_id
Citation.cited_paper_id = Paper.paper_id
| TABLE affiliation (
affiliation.affiliation_id (INTEGER),
affiliation.name (varchar(255)),
affiliation.address (varchar(255)),
)
TABLE author (
author.author_id (INTEGER),
author.name (varchar(255)),
author.email (varchar(255)),
)
TABLE author_list (
author_list.paper_id (varchar(25)),
author_list.author_id (INTEGER),
author_list.affiliation_id (INTEGER),
)
TABLE citation (
citation.paper_id (varchar(25)),
citation.cited_paper_id (varchar(25)),
)
TABLE paper (
paper.paper_id (varchar(25)),
paper.title (varchar(255)),
paper.venue (varchar(255)),
paper.year (INTEGER),
)
Possible JOINs:
author_list.paper_id = paper.paper_id
author_list.author_id = author.author_id
author_list.affiliation_id = affiliation.affiliation_id
citation.paper_id = paper.paper_id
citation.cited_paper_id = paper.paper_id
|
club_leader |
CREATE TABLE club (
"Club_ID" INTEGER,
"Overall_Ranking" INTEGER,
"Team_Leader" TEXT,
"Club_Name" TEXT,
PRIMARY KEY ("Club_ID")
)
CREATE TABLE club_leader (
"Club_ID" INTEGER,
"Member_ID" INTEGER,
"Year_Join" TEXT,
PRIMARY KEY ("Club_ID", "Member_ID"),
FOREIGN KEY("Member_ID") REFERENCES member ("Member_ID"),
FOREIGN KEY("Club_ID") REFERENCES club ("Club_ID")
)
CREATE TABLE member (
"Member_ID" INTEGER,
"Name" TEXT,
"Nationality" TEXT,
"Age" INTEGER,
PRIMARY KEY ("Member_ID")
) | List the names of members that are not club leaders. | hard | Table club (
club.Club_ID (INT),
club.Overall_Ranking (INT),
club.Team_Leader (TEXT),
club.Club_Name (TEXT),
)
Table club_leader (
club_leader.Club_ID (INT),
club_leader.Member_ID (INT),
club_leader.Year_Join (TEXT),
)
Table member (
member.Member_ID (INT),
member.Name (TEXT),
member.Nationality (TEXT),
member.Age (INT),
)
Possible JOINs:
club_leader.Club_ID = club.Club_ID
club_leader.Member_ID = member.Member_ID
| SELECT Name FROM member WHERE Member_ID NOT IN (SELECT Member_ID FROM club_leader) | {
'member': ['member_id', 'name'],
'club_leader': ['club_id', 'member_id']
} | CREATE TABLE club (
club.Club_ID (INT),
club.Overall_Ranking (INT),
club.Team_Leader (TEXT),
club.Club_Name (TEXT),
)
CREATE TABLE club_leader (
club_leader.Club_ID (INT),
club_leader.Member_ID (INT),
club_leader.Year_Join (TEXT),
)
CREATE TABLE member (
member.Member_ID (INT),
member.Name (TEXT),
member.Nationality (TEXT),
member.Age (INT),
)
Possible JOINs:
club_leader.Club_ID = club.Club_ID
club_leader.Member_ID = member.Member_ID
| Table club (
club.club_id (INT),
club.overall_ranking (INT),
club.team_leader (TEXT),
club.club_name (TEXT),
)
Table club_leader (
club_leader.club_id (INT),
club_leader.member_id (INT),
club_leader.year_join (TEXT),
)
Table member (
member.member_id (INT),
member.name (TEXT),
member.nationality (TEXT),
member.age (INT),
)
Possible JOINs:
club_leader.club_id = club.club_id
club_leader.member_id = member.member_id
| CREATE TABLE club (
club.club_id (INT),
club.overall_ranking (INT),
club.team_leader (TEXT),
club.club_name (TEXT),
)
CREATE TABLE club_leader (
club_leader.club_id (INT),
club_leader.member_id (INT),
club_leader.year_join (TEXT),
)
CREATE TABLE member (
member.member_id (INT),
member.name (TEXT),
member.nationality (TEXT),
member.age (INT),
)
Possible JOINs:
club_leader.club_id = club.club_id
club_leader.member_id = member.member_id
| Table club (
club.club_id (INT),
club.overall_ranking (INT),
club.team_leader (TEXT),
club.club_name (TEXT),
)
Table club_leader (
club_leader.club_id (INT),
club_leader.member_id (INT),
club_leader.year_join (TEXT),
)
Table member (
member.member_id (INT),
member.name (TEXT),
member.nationality (TEXT),
member.age (INT),
)
Possible JOINs:
club_leader.club_id = club.club_id
club_leader.member_id = member.member_id
| CREATE TABLE club (
club.club_id (INT),
club.overall_ranking (INT),
club.team_leader (TEXT),
club.club_name (TEXT),
)
CREATE TABLE club_leader (
club_leader.club_id (INT),
club_leader.member_id (INT),
club_leader.year_join (TEXT),
)
CREATE TABLE member (
member.member_id (INT),
member.name (TEXT),
member.nationality (TEXT),
member.age (INT),
)
Possible JOINs:
club_leader.club_id = club.club_id
club_leader.member_id = member.member_id
| {
'member': ['Member_ID', 'Name', 'Nationality', 'Age'],
'club': ['Club_ID', 'Overall_Ranking', 'Team_Leader', 'Club_Name'],
'club_leader': ['Club_ID', 'Member_ID', 'Year_Join']
} | {
'member': ['Member_ID', 'Name'],
'club_leader': ['Club_ID', 'Member_ID']
} | TABLE club (
club.Club_ID (INT),
club.Overall_Ranking (INT),
club.Team_Leader (TEXT),
club.Club_Name (TEXT),
)
TABLE club_leader (
club_leader.Club_ID (INT),
club_leader.Member_ID (INT),
club_leader.Year_Join (TEXT),
)
TABLE member (
member.Member_ID (INT),
member.Name (TEXT),
member.Nationality (TEXT),
member.Age (INT),
)
Possible JOINs:
club_leader.Club_ID = club.Club_ID
club_leader.Member_ID = member.Member_ID
| TABLE club (
club.club_id (INT),
club.overall_ranking (INT),
club.team_leader (TEXT),
club.club_name (TEXT),
)
TABLE club_leader (
club_leader.club_id (INT),
club_leader.member_id (INT),
club_leader.year_join (TEXT),
)
TABLE member (
member.member_id (INT),
member.name (TEXT),
member.nationality (TEXT),
member.age (INT),
)
Possible JOINs:
club_leader.club_id = club.club_id
club_leader.member_id = member.member_id
| TABLE club (
club.club_id (INT),
club.overall_ranking (INT),
club.team_leader (TEXT),
club.club_name (TEXT),
)
TABLE club_leader (
club_leader.club_id (INT),
club_leader.member_id (INT),
club_leader.year_join (TEXT),
)
TABLE member (
member.member_id (INT),
member.name (TEXT),
member.nationality (TEXT),
member.age (INT),
)
Possible JOINs:
club_leader.club_id = club.club_id
club_leader.member_id = member.member_id
|
customers_and_orders |
CREATE TABLE "Addresses" (
address_id INTEGER,
address_details VARCHAR(255),
PRIMARY KEY (address_id)
)
CREATE TABLE "Customer_Orders" (
order_id INTEGER,
customer_id INTEGER NOT NULL,
order_date DATETIME NOT NULL,
order_status_code VARCHAR(15),
PRIMARY KEY (order_id),
FOREIGN KEY(customer_id) REFERENCES "Customers" (customer_id)
)
CREATE TABLE "Customers" (
customer_id INTEGER,
address_id INTEGER NOT NULL,
payment_method_code VARCHAR(15),
customer_number VARCHAR(20),
customer_name VARCHAR(80),
customer_address VARCHAR(255),
customer_phone VARCHAR(80),
customer_email VARCHAR(80),
PRIMARY KEY (customer_id)
)
CREATE TABLE "Order_Items" (
order_item_id INTEGER NOT NULL,
order_id INTEGER NOT NULL,
product_id INTEGER NOT NULL,
order_quantity VARCHAR(80),
FOREIGN KEY(product_id) REFERENCES "Products" (product_id),
FOREIGN KEY(order_id) REFERENCES "Customer_Orders" (order_id)
)
CREATE TABLE "Products" (
product_id INTEGER,
product_type_code VARCHAR(15),
product_name VARCHAR(80),
product_price DOUBLE,
PRIMARY KEY (product_id)
) | Show all customer names with the payment method code used by least number of customers. | hard | Table Addresses (
Addresses.address_id (INTEGER),
Addresses.address_details (VARCHAR(255)),
)
Table Customer_Orders (
Customer_Orders.order_id (INTEGER),
Customer_Orders.customer_id (INTEGER),
Customer_Orders.order_date (DATETIME),
Customer_Orders.order_status_code (VARCHAR(15)),
)
Table Customers (
Customers.customer_id (INTEGER),
Customers.address_id (INTEGER),
Customers.payment_method_code (VARCHAR(15)),
Customers.customer_number (VARCHAR(20)),
Customers.customer_name (VARCHAR(80)),
Customers.customer_address (VARCHAR(255)),
Customers.customer_phone (VARCHAR(80)),
Customers.customer_email (VARCHAR(80)),
)
Table Order_Items (
Order_Items.order_item_id (INTEGER),
Order_Items.order_id (INTEGER),
Order_Items.product_id (INTEGER),
Order_Items.order_quantity (VARCHAR(80)),
)
Table Products (
Products.product_id (INTEGER),
Products.product_type_code (VARCHAR(15)),
Products.product_name (VARCHAR(80)),
Products.product_price (DOUBLE),
)
Possible JOINs:
Customer_Orders.customer_id = Customers.customer_id
Order_Items.order_id = Customer_Orders.order_id
Order_Items.product_id = Products.product_id
| SELECT customer_name FROM Customers WHERE payment_method_code = ( SELECT payment_method_code FROM Customers GROUP BY payment_method_code ORDER BY count(*) ASC LIMIT 1) | {
'customers': ['customer_id', 'payment_method_code', 'customer_name']
} | CREATE TABLE Addresses (
Addresses.address_id (INTEGER),
Addresses.address_details (VARCHAR(255)),
)
CREATE TABLE Customer_Orders (
Customer_Orders.order_id (INTEGER),
Customer_Orders.customer_id (INTEGER),
Customer_Orders.order_date (DATETIME),
Customer_Orders.order_status_code (VARCHAR(15)),
)
CREATE TABLE Customers (
Customers.customer_id (INTEGER),
Customers.address_id (INTEGER),
Customers.payment_method_code (VARCHAR(15)),
Customers.customer_number (VARCHAR(20)),
Customers.customer_name (VARCHAR(80)),
Customers.customer_address (VARCHAR(255)),
Customers.customer_phone (VARCHAR(80)),
Customers.customer_email (VARCHAR(80)),
)
CREATE TABLE Order_Items (
Order_Items.order_item_id (INTEGER),
Order_Items.order_id (INTEGER),
Order_Items.product_id (INTEGER),
Order_Items.order_quantity (VARCHAR(80)),
)
CREATE TABLE Products (
Products.product_id (INTEGER),
Products.product_type_code (VARCHAR(15)),
Products.product_name (VARCHAR(80)),
Products.product_price (DOUBLE),
)
Possible JOINs:
Customer_Orders.customer_id = Customers.customer_id
Order_Items.order_id = Customer_Orders.order_id
Order_Items.product_id = Products.product_id
| Table Addresses (
Addresses.address_id (INTEGER),
Addresses.address_details (VARCHAR(255)),
)
Table Customer_Orders (
Customer_Orders.order_id (INTEGER),
Customer_Orders.customer_id (INTEGER),
Customer_Orders.order_date (DATETIME),
Customer_Orders.order_status_code (VARCHAR(15)),
)
Table Customers (
Customers.customer_id (INTEGER),
Customers.address_id (INTEGER),
Customers.payment_method_code (VARCHAR(15)),
Customers.customer_number (VARCHAR(20)),
Customers.customer_name (VARCHAR(80)),
Customers.customer_address (VARCHAR(255)),
Customers.customer_phone (VARCHAR(80)),
Customers.customer_email (VARCHAR(80)),
)
Table Order_Items (
Order_Items.order_item_id (INTEGER),
Order_Items.order_id (INTEGER),
Order_Items.product_id (INTEGER),
Order_Items.order_quantity (VARCHAR(80)),
)
Table Products (
Products.product_id (INTEGER),
Products.product_type_code (VARCHAR(15)),
Products.product_name (VARCHAR(80)),
Products.product_price (DOUBLE),
)
Possible JOINs:
Customer_Orders.customer_id = Customers.customer_id
Order_Items.order_id = Customer_Orders.order_id
Order_Items.product_id = Products.product_id
| CREATE TABLE Addresses (
Addresses.address_id (INTEGER),
Addresses.address_details (VARCHAR(255)),
)
CREATE TABLE Customer_Orders (
Customer_Orders.order_id (INTEGER),
Customer_Orders.customer_id (INTEGER),
Customer_Orders.order_date (DATETIME),
Customer_Orders.order_status_code (VARCHAR(15)),
)
CREATE TABLE Customers (
Customers.customer_id (INTEGER),
Customers.address_id (INTEGER),
Customers.payment_method_code (VARCHAR(15)),
Customers.customer_number (VARCHAR(20)),
Customers.customer_name (VARCHAR(80)),
Customers.customer_address (VARCHAR(255)),
Customers.customer_phone (VARCHAR(80)),
Customers.customer_email (VARCHAR(80)),
)
CREATE TABLE Order_Items (
Order_Items.order_item_id (INTEGER),
Order_Items.order_id (INTEGER),
Order_Items.product_id (INTEGER),
Order_Items.order_quantity (VARCHAR(80)),
)
CREATE TABLE Products (
Products.product_id (INTEGER),
Products.product_type_code (VARCHAR(15)),
Products.product_name (VARCHAR(80)),
Products.product_price (DOUBLE),
)
Possible JOINs:
Customer_Orders.customer_id = Customers.customer_id
Order_Items.order_id = Customer_Orders.order_id
Order_Items.product_id = Products.product_id
| Table addresses (
addresses.address_id (INTEGER),
addresses.address_details (VARCHAR(255)),
)
Table customer_orders (
customer_orders.order_id (INTEGER),
customer_orders.customer_id (INTEGER),
customer_orders.order_date (DATETIME),
customer_orders.order_status_code (VARCHAR(15)),
)
Table customers (
customers.customer_id (INTEGER),
customers.address_id (INTEGER),
customers.payment_method_code (VARCHAR(15)),
customers.customer_number (VARCHAR(20)),
customers.customer_name (VARCHAR(80)),
customers.customer_address (VARCHAR(255)),
customers.customer_phone (VARCHAR(80)),
customers.customer_email (VARCHAR(80)),
)
Table order_items (
order_items.order_item_id (INTEGER),
order_items.order_id (INTEGER),
order_items.product_id (INTEGER),
order_items.order_quantity (VARCHAR(80)),
)
Table products (
products.product_id (INTEGER),
products.product_type_code (VARCHAR(15)),
products.product_name (VARCHAR(80)),
products.product_price (DOUBLE),
)
Possible JOINs:
customer_orders.customer_id = customers.customer_id
order_items.order_id = customer_orders.order_id
order_items.product_id = products.product_id
| CREATE TABLE addresses (
addresses.address_id (INTEGER),
addresses.address_details (VARCHAR(255)),
)
CREATE TABLE customer_orders (
customer_orders.order_id (INTEGER),
customer_orders.customer_id (INTEGER),
customer_orders.order_date (DATETIME),
customer_orders.order_status_code (VARCHAR(15)),
)
CREATE TABLE customers (
customers.customer_id (INTEGER),
customers.address_id (INTEGER),
customers.payment_method_code (VARCHAR(15)),
customers.customer_number (VARCHAR(20)),
customers.customer_name (VARCHAR(80)),
customers.customer_address (VARCHAR(255)),
customers.customer_phone (VARCHAR(80)),
customers.customer_email (VARCHAR(80)),
)
CREATE TABLE order_items (
order_items.order_item_id (INTEGER),
order_items.order_id (INTEGER),
order_items.product_id (INTEGER),
order_items.order_quantity (VARCHAR(80)),
)
CREATE TABLE products (
products.product_id (INTEGER),
products.product_type_code (VARCHAR(15)),
products.product_name (VARCHAR(80)),
products.product_price (DOUBLE),
)
Possible JOINs:
customer_orders.customer_id = customers.customer_id
order_items.order_id = customer_orders.order_id
order_items.product_id = products.product_id
| {
'Products': ['product_id', 'product_type_code', 'product_name', 'product_price'],
'Addresses': ['address_id', 'address_details'],
'Customers': ['customer_id', 'address_id', 'payment_method_code', 'customer_number', 'customer_name', 'customer_address', 'customer_phone', 'customer_email'],
'Customer_Orders': ['order_id', 'customer_id', 'order_date', 'order_status_code'],
'Order_Items': ['order_item_id', 'order_id', 'product_id', 'order_quantity']
} | {
'Customers': ['customer_id', 'payment_method_code', 'customer_name']
} | TABLE Addresses (
Addresses.address_id (INTEGER),
Addresses.address_details (VARCHAR(255)),
)
TABLE Customer_Orders (
Customer_Orders.order_id (INTEGER),
Customer_Orders.customer_id (INTEGER),
Customer_Orders.order_date (DATETIME),
Customer_Orders.order_status_code (VARCHAR(15)),
)
TABLE Customers (
Customers.customer_id (INTEGER),
Customers.address_id (INTEGER),
Customers.payment_method_code (VARCHAR(15)),
Customers.customer_number (VARCHAR(20)),
Customers.customer_name (VARCHAR(80)),
Customers.customer_address (VARCHAR(255)),
Customers.customer_phone (VARCHAR(80)),
Customers.customer_email (VARCHAR(80)),
)
TABLE Order_Items (
Order_Items.order_item_id (INTEGER),
Order_Items.order_id (INTEGER),
Order_Items.product_id (INTEGER),
Order_Items.order_quantity (VARCHAR(80)),
)
TABLE Products (
Products.product_id (INTEGER),
Products.product_type_code (VARCHAR(15)),
Products.product_name (VARCHAR(80)),
Products.product_price (DOUBLE),
)
Possible JOINs:
Customer_Orders.customer_id = Customers.customer_id
Order_Items.order_id = Customer_Orders.order_id
Order_Items.product_id = Products.product_id
| TABLE Addresses (
Addresses.address_id (INTEGER),
Addresses.address_details (VARCHAR(255)),
)
TABLE Customer_Orders (
Customer_Orders.order_id (INTEGER),
Customer_Orders.customer_id (INTEGER),
Customer_Orders.order_date (DATETIME),
Customer_Orders.order_status_code (VARCHAR(15)),
)
TABLE Customers (
Customers.customer_id (INTEGER),
Customers.address_id (INTEGER),
Customers.payment_method_code (VARCHAR(15)),
Customers.customer_number (VARCHAR(20)),
Customers.customer_name (VARCHAR(80)),
Customers.customer_address (VARCHAR(255)),
Customers.customer_phone (VARCHAR(80)),
Customers.customer_email (VARCHAR(80)),
)
TABLE Order_Items (
Order_Items.order_item_id (INTEGER),
Order_Items.order_id (INTEGER),
Order_Items.product_id (INTEGER),
Order_Items.order_quantity (VARCHAR(80)),
)
TABLE Products (
Products.product_id (INTEGER),
Products.product_type_code (VARCHAR(15)),
Products.product_name (VARCHAR(80)),
Products.product_price (DOUBLE),
)
Possible JOINs:
Customer_Orders.customer_id = Customers.customer_id
Order_Items.order_id = Customer_Orders.order_id
Order_Items.product_id = Products.product_id
| TABLE addresses (
addresses.address_id (INTEGER),
addresses.address_details (VARCHAR(255)),
)
TABLE customer_orders (
customer_orders.order_id (INTEGER),
customer_orders.customer_id (INTEGER),
customer_orders.order_date (DATETIME),
customer_orders.order_status_code (VARCHAR(15)),
)
TABLE customers (
customers.customer_id (INTEGER),
customers.address_id (INTEGER),
customers.payment_method_code (VARCHAR(15)),
customers.customer_number (VARCHAR(20)),
customers.customer_name (VARCHAR(80)),
customers.customer_address (VARCHAR(255)),
customers.customer_phone (VARCHAR(80)),
customers.customer_email (VARCHAR(80)),
)
TABLE order_items (
order_items.order_item_id (INTEGER),
order_items.order_id (INTEGER),
order_items.product_id (INTEGER),
order_items.order_quantity (VARCHAR(80)),
)
TABLE products (
products.product_id (INTEGER),
products.product_type_code (VARCHAR(15)),
products.product_name (VARCHAR(80)),
products.product_price (DOUBLE),
)
Possible JOINs:
customer_orders.customer_id = customers.customer_id
order_items.order_id = customer_orders.order_id
order_items.product_id = products.product_id
|
e_commerce |
CREATE TABLE "Customer_Payment_Methods" (
customer_id INTEGER NOT NULL,
payment_method_code VARCHAR(10) NOT NULL,
FOREIGN KEY(customer_id) REFERENCES "Customers" (customer_id)
)
CREATE TABLE "Customers" (
customer_id INTEGER,
gender_code VARCHAR(1) NOT NULL,
customer_first_name VARCHAR(50),
customer_middle_initial VARCHAR(1),
customer_last_name VARCHAR(50),
email_address VARCHAR(255),
login_name VARCHAR(80),
login_password VARCHAR(20),
phone_number VARCHAR(255),
address_line_1 VARCHAR(255),
town_city VARCHAR(50),
county VARCHAR(50),
country VARCHAR(50),
PRIMARY KEY (customer_id)
)
CREATE TABLE "Invoices" (
invoice_number INTEGER,
invoice_status_code VARCHAR(10) NOT NULL,
invoice_date DATETIME,
PRIMARY KEY (invoice_number)
)
CREATE TABLE "Order_Items" (
order_item_id INTEGER,
product_id INTEGER NOT NULL,
order_id INTEGER NOT NULL,
order_item_status_code VARCHAR(10) NOT NULL,
PRIMARY KEY (order_item_id),
FOREIGN KEY(order_id) REFERENCES "Orders" (order_id),
FOREIGN KEY(product_id) REFERENCES "Products" (product_id)
)
CREATE TABLE "Orders" (
order_id INTEGER,
customer_id INTEGER NOT NULL,
order_status_code VARCHAR(10) NOT NULL,
date_order_placed DATETIME NOT NULL,
PRIMARY KEY (order_id),
FOREIGN KEY(customer_id) REFERENCES "Customers" (customer_id)
)
CREATE TABLE "Products" (
product_id INTEGER,
parent_product_id INTEGER,
product_name VARCHAR(80),
product_price DECIMAL(19, 4) DEFAULT 0,
product_color VARCHAR(50),
product_size VARCHAR(50),
product_description VARCHAR(255),
PRIMARY KEY (product_id)
)
CREATE TABLE "Shipment_Items" (
shipment_id INTEGER NOT NULL,
order_item_id INTEGER NOT NULL,
PRIMARY KEY (shipment_id, order_item_id),
FOREIGN KEY(order_item_id) REFERENCES "Order_Items" (order_item_id),
FOREIGN KEY(shipment_id) REFERENCES "Shipments" (shipment_id)
)
CREATE TABLE "Shipments" (
shipment_id INTEGER,
order_id INTEGER NOT NULL,
invoice_number INTEGER NOT NULL,
shipment_tracking_number VARCHAR(80),
shipment_date DATETIME,
PRIMARY KEY (shipment_id),
FOREIGN KEY(order_id) REFERENCES "Orders" (order_id),
FOREIGN KEY(invoice_number) REFERENCES "Invoices" (invoice_number)
) | What are the email address, town and county of the customers who are of the least common gender? | extra | Table Customer_Payment_Methods (
Customer_Payment_Methods.customer_id (INTEGER),
Customer_Payment_Methods.payment_method_code (VARCHAR(10)),
)
Table Customers (
Customers.customer_id (INTEGER),
Customers.gender_code (VARCHAR(1)),
Customers.customer_first_name (VARCHAR(50)),
Customers.customer_middle_initial (VARCHAR(1)),
Customers.customer_last_name (VARCHAR(50)),
Customers.email_address (VARCHAR(255)),
Customers.login_name (VARCHAR(80)),
Customers.login_password (VARCHAR(20)),
Customers.phone_number (VARCHAR(255)),
Customers.address_line_1 (VARCHAR(255)),
Customers.town_city (VARCHAR(50)),
Customers.county (VARCHAR(50)),
Customers.country (VARCHAR(50)),
)
Table Invoices (
Invoices.invoice_number (INTEGER),
Invoices.invoice_status_code (VARCHAR(10)),
Invoices.invoice_date (DATETIME),
)
Table Order_Items (
Order_Items.order_item_id (INTEGER),
Order_Items.product_id (INTEGER),
Order_Items.order_id (INTEGER),
Order_Items.order_item_status_code (VARCHAR(10)),
)
Table Orders (
Orders.order_id (INTEGER),
Orders.customer_id (INTEGER),
Orders.order_status_code (VARCHAR(10)),
Orders.date_order_placed (DATETIME),
)
Table Products (
Products.product_id (INTEGER),
Products.parent_product_id (INTEGER),
Products.product_name (VARCHAR(80)),
Products.product_price (DECIMAL(19,4)),
Products.product_color (VARCHAR(50)),
Products.product_size (VARCHAR(50)),
Products.product_description (VARCHAR(255)),
)
Table Shipment_Items (
Shipment_Items.shipment_id (INTEGER),
Shipment_Items.order_item_id (INTEGER),
)
Table Shipments (
Shipments.shipment_id (INTEGER),
Shipments.order_id (INTEGER),
Shipments.invoice_number (INTEGER),
Shipments.shipment_tracking_number (VARCHAR(80)),
Shipments.shipment_date (DATETIME),
)
Possible JOINs:
Customer_Payment_Methods.customer_id = Customers.customer_id
Order_Items.product_id = Products.product_id
Order_Items.order_id = Orders.order_id
Orders.customer_id = Customers.customer_id
Shipment_Items.shipment_id = Shipments.shipment_id
Shipment_Items.order_item_id = Order_Items.order_item_id
Shipments.order_id = Orders.order_id
Shipments.invoice_number = Invoices.invoice_number
| SELECT email_address , town_city , county FROM Customers WHERE gender_code = ( SELECT gender_code FROM Customers GROUP BY gender_code ORDER BY count(*) ASC LIMIT 1 ) | {
'customers': ['customer_id', 'gender_code', 'email_address', 'town_city', 'county']
} | CREATE TABLE Customer_Payment_Methods (
Customer_Payment_Methods.customer_id (INTEGER),
Customer_Payment_Methods.payment_method_code (VARCHAR(10)),
)
CREATE TABLE Customers (
Customers.customer_id (INTEGER),
Customers.gender_code (VARCHAR(1)),
Customers.customer_first_name (VARCHAR(50)),
Customers.customer_middle_initial (VARCHAR(1)),
Customers.customer_last_name (VARCHAR(50)),
Customers.email_address (VARCHAR(255)),
Customers.login_name (VARCHAR(80)),
Customers.login_password (VARCHAR(20)),
Customers.phone_number (VARCHAR(255)),
Customers.address_line_1 (VARCHAR(255)),
Customers.town_city (VARCHAR(50)),
Customers.county (VARCHAR(50)),
Customers.country (VARCHAR(50)),
)
CREATE TABLE Invoices (
Invoices.invoice_number (INTEGER),
Invoices.invoice_status_code (VARCHAR(10)),
Invoices.invoice_date (DATETIME),
)
CREATE TABLE Order_Items (
Order_Items.order_item_id (INTEGER),
Order_Items.product_id (INTEGER),
Order_Items.order_id (INTEGER),
Order_Items.order_item_status_code (VARCHAR(10)),
)
CREATE TABLE Orders (
Orders.order_id (INTEGER),
Orders.customer_id (INTEGER),
Orders.order_status_code (VARCHAR(10)),
Orders.date_order_placed (DATETIME),
)
CREATE TABLE Products (
Products.product_id (INTEGER),
Products.parent_product_id (INTEGER),
Products.product_name (VARCHAR(80)),
Products.product_price (DECIMAL(19,4)),
Products.product_color (VARCHAR(50)),
Products.product_size (VARCHAR(50)),
Products.product_description (VARCHAR(255)),
)
CREATE TABLE Shipment_Items (
Shipment_Items.shipment_id (INTEGER),
Shipment_Items.order_item_id (INTEGER),
)
CREATE TABLE Shipments (
Shipments.shipment_id (INTEGER),
Shipments.order_id (INTEGER),
Shipments.invoice_number (INTEGER),
Shipments.shipment_tracking_number (VARCHAR(80)),
Shipments.shipment_date (DATETIME),
)
Possible JOINs:
Customer_Payment_Methods.customer_id = Customers.customer_id
Order_Items.product_id = Products.product_id
Order_Items.order_id = Orders.order_id
Orders.customer_id = Customers.customer_id
Shipment_Items.shipment_id = Shipments.shipment_id
Shipment_Items.order_item_id = Order_Items.order_item_id
Shipments.order_id = Orders.order_id
Shipments.invoice_number = Invoices.invoice_number
| Table Customer_Payment_Methods (
Customer_Payment_Methods.customer_id (INTEGER),
Customer_Payment_Methods.payment_method_code (VARCHAR(10)),
)
Table Customers (
Customers.customer_id (INTEGER),
Customers.gender_code (VARCHAR(1)),
Customers.customer_first_name (VARCHAR(50)),
Customers.customer_middle_initial (VARCHAR(1)),
Customers.customer_last_name (VARCHAR(50)),
Customers.email_address (VARCHAR(255)),
Customers.login_name (VARCHAR(80)),
Customers.login_password (VARCHAR(20)),
Customers.phone_number (VARCHAR(255)),
Customers.address_line_1 (VARCHAR(255)),
Customers.town_city (VARCHAR(50)),
Customers.county (VARCHAR(50)),
Customers.country (VARCHAR(50)),
)
Table Invoices (
Invoices.invoice_number (INTEGER),
Invoices.invoice_status_code (VARCHAR(10)),
Invoices.invoice_date (DATETIME),
)
Table Order_Items (
Order_Items.order_item_id (INTEGER),
Order_Items.product_id (INTEGER),
Order_Items.order_id (INTEGER),
Order_Items.order_item_status_code (VARCHAR(10)),
)
Table Orders (
Orders.order_id (INTEGER),
Orders.customer_id (INTEGER),
Orders.order_status_code (VARCHAR(10)),
Orders.date_order_placed (DATETIME),
)
Table Products (
Products.product_id (INTEGER),
Products.parent_product_id (INTEGER),
Products.product_name (VARCHAR(80)),
Products.product_price (DECIMAL(19,4)),
Products.product_color (VARCHAR(50)),
Products.product_size (VARCHAR(50)),
Products.product_description (VARCHAR(255)),
)
Table Shipment_Items (
Shipment_Items.shipment_id (INTEGER),
Shipment_Items.order_item_id (INTEGER),
)
Table Shipments (
Shipments.shipment_id (INTEGER),
Shipments.order_id (INTEGER),
Shipments.invoice_number (INTEGER),
Shipments.shipment_tracking_number (VARCHAR(80)),
Shipments.shipment_date (DATETIME),
)
Possible JOINs:
Customer_Payment_Methods.customer_id = Customers.customer_id
Order_Items.product_id = Products.product_id
Order_Items.order_id = Orders.order_id
Orders.customer_id = Customers.customer_id
Shipment_Items.shipment_id = Shipments.shipment_id
Shipment_Items.order_item_id = Order_Items.order_item_id
Shipments.order_id = Orders.order_id
Shipments.invoice_number = Invoices.invoice_number
| CREATE TABLE Customer_Payment_Methods (
Customer_Payment_Methods.customer_id (INTEGER),
Customer_Payment_Methods.payment_method_code (VARCHAR(10)),
)
CREATE TABLE Customers (
Customers.customer_id (INTEGER),
Customers.gender_code (VARCHAR(1)),
Customers.customer_first_name (VARCHAR(50)),
Customers.customer_middle_initial (VARCHAR(1)),
Customers.customer_last_name (VARCHAR(50)),
Customers.email_address (VARCHAR(255)),
Customers.login_name (VARCHAR(80)),
Customers.login_password (VARCHAR(20)),
Customers.phone_number (VARCHAR(255)),
Customers.address_line_1 (VARCHAR(255)),
Customers.town_city (VARCHAR(50)),
Customers.county (VARCHAR(50)),
Customers.country (VARCHAR(50)),
)
CREATE TABLE Invoices (
Invoices.invoice_number (INTEGER),
Invoices.invoice_status_code (VARCHAR(10)),
Invoices.invoice_date (DATETIME),
)
CREATE TABLE Order_Items (
Order_Items.order_item_id (INTEGER),
Order_Items.product_id (INTEGER),
Order_Items.order_id (INTEGER),
Order_Items.order_item_status_code (VARCHAR(10)),
)
CREATE TABLE Orders (
Orders.order_id (INTEGER),
Orders.customer_id (INTEGER),
Orders.order_status_code (VARCHAR(10)),
Orders.date_order_placed (DATETIME),
)
CREATE TABLE Products (
Products.product_id (INTEGER),
Products.parent_product_id (INTEGER),
Products.product_name (VARCHAR(80)),
Products.product_price (DECIMAL(19,4)),
Products.product_color (VARCHAR(50)),
Products.product_size (VARCHAR(50)),
Products.product_description (VARCHAR(255)),
)
CREATE TABLE Shipment_Items (
Shipment_Items.shipment_id (INTEGER),
Shipment_Items.order_item_id (INTEGER),
)
CREATE TABLE Shipments (
Shipments.shipment_id (INTEGER),
Shipments.order_id (INTEGER),
Shipments.invoice_number (INTEGER),
Shipments.shipment_tracking_number (VARCHAR(80)),
Shipments.shipment_date (DATETIME),
)
Possible JOINs:
Customer_Payment_Methods.customer_id = Customers.customer_id
Order_Items.product_id = Products.product_id
Order_Items.order_id = Orders.order_id
Orders.customer_id = Customers.customer_id
Shipment_Items.shipment_id = Shipments.shipment_id
Shipment_Items.order_item_id = Order_Items.order_item_id
Shipments.order_id = Orders.order_id
Shipments.invoice_number = Invoices.invoice_number
| Table customer_payment_methods (
customer_payment_methods.customer_id (INTEGER),
customer_payment_methods.payment_method_code (VARCHAR(10)),
)
Table customers (
customers.customer_id (INTEGER),
customers.gender_code (VARCHAR(1)),
customers.customer_first_name (VARCHAR(50)),
customers.customer_middle_initial (VARCHAR(1)),
customers.customer_last_name (VARCHAR(50)),
customers.email_address (VARCHAR(255)),
customers.login_name (VARCHAR(80)),
customers.login_password (VARCHAR(20)),
customers.phone_number (VARCHAR(255)),
customers.address_line_1 (VARCHAR(255)),
customers.town_city (VARCHAR(50)),
customers.county (VARCHAR(50)),
customers.country (VARCHAR(50)),
)
Table invoices (
invoices.invoice_number (INTEGER),
invoices.invoice_status_code (VARCHAR(10)),
invoices.invoice_date (DATETIME),
)
Table order_items (
order_items.order_item_id (INTEGER),
order_items.product_id (INTEGER),
order_items.order_id (INTEGER),
order_items.order_item_status_code (VARCHAR(10)),
)
Table orders (
orders.order_id (INTEGER),
orders.customer_id (INTEGER),
orders.order_status_code (VARCHAR(10)),
orders.date_order_placed (DATETIME),
)
Table products (
products.product_id (INTEGER),
products.parent_product_id (INTEGER),
products.product_name (VARCHAR(80)),
products.product_price (DECIMAL(19,4)),
products.product_color (VARCHAR(50)),
products.product_size (VARCHAR(50)),
products.product_description (VARCHAR(255)),
)
Table shipment_items (
shipment_items.shipment_id (INTEGER),
shipment_items.order_item_id (INTEGER),
)
Table shipments (
shipments.shipment_id (INTEGER),
shipments.order_id (INTEGER),
shipments.invoice_number (INTEGER),
shipments.shipment_tracking_number (VARCHAR(80)),
shipments.shipment_date (DATETIME),
)
Possible JOINs:
customer_payment_methods.customer_id = customers.customer_id
order_items.product_id = products.product_id
order_items.order_id = orders.order_id
orders.customer_id = customers.customer_id
shipment_items.shipment_id = shipments.shipment_id
shipment_items.order_item_id = order_items.order_item_id
shipments.order_id = orders.order_id
shipments.invoice_number = invoices.invoice_number
| CREATE TABLE customer_payment_methods (
customer_payment_methods.customer_id (INTEGER),
customer_payment_methods.payment_method_code (VARCHAR(10)),
)
CREATE TABLE customers (
customers.customer_id (INTEGER),
customers.gender_code (VARCHAR(1)),
customers.customer_first_name (VARCHAR(50)),
customers.customer_middle_initial (VARCHAR(1)),
customers.customer_last_name (VARCHAR(50)),
customers.email_address (VARCHAR(255)),
customers.login_name (VARCHAR(80)),
customers.login_password (VARCHAR(20)),
customers.phone_number (VARCHAR(255)),
customers.address_line_1 (VARCHAR(255)),
customers.town_city (VARCHAR(50)),
customers.county (VARCHAR(50)),
customers.country (VARCHAR(50)),
)
CREATE TABLE invoices (
invoices.invoice_number (INTEGER),
invoices.invoice_status_code (VARCHAR(10)),
invoices.invoice_date (DATETIME),
)
CREATE TABLE order_items (
order_items.order_item_id (INTEGER),
order_items.product_id (INTEGER),
order_items.order_id (INTEGER),
order_items.order_item_status_code (VARCHAR(10)),
)
CREATE TABLE orders (
orders.order_id (INTEGER),
orders.customer_id (INTEGER),
orders.order_status_code (VARCHAR(10)),
orders.date_order_placed (DATETIME),
)
CREATE TABLE products (
products.product_id (INTEGER),
products.parent_product_id (INTEGER),
products.product_name (VARCHAR(80)),
products.product_price (DECIMAL(19,4)),
products.product_color (VARCHAR(50)),
products.product_size (VARCHAR(50)),
products.product_description (VARCHAR(255)),
)
CREATE TABLE shipment_items (
shipment_items.shipment_id (INTEGER),
shipment_items.order_item_id (INTEGER),
)
CREATE TABLE shipments (
shipments.shipment_id (INTEGER),
shipments.order_id (INTEGER),
shipments.invoice_number (INTEGER),
shipments.shipment_tracking_number (VARCHAR(80)),
shipments.shipment_date (DATETIME),
)
Possible JOINs:
customer_payment_methods.customer_id = customers.customer_id
order_items.product_id = products.product_id
order_items.order_id = orders.order_id
orders.customer_id = customers.customer_id
shipment_items.shipment_id = shipments.shipment_id
shipment_items.order_item_id = order_items.order_item_id
shipments.order_id = orders.order_id
shipments.invoice_number = invoices.invoice_number
| {
'Products': ['product_id', 'parent_product_id', 'product_name', 'product_price', 'product_color', 'product_size', 'product_description'],
'Customers': ['customer_id', 'gender_code', 'customer_first_name', 'customer_middle_initial', 'customer_last_name', 'email_address', 'login_name', 'login_password', 'phone_number', 'address_line_1', 'town_city', 'county', 'country'],
'Customer_Payment_Methods': ['customer_id', 'payment_method_code'],
'Invoices': ['invoice_number', 'invoice_status_code', 'invoice_date'],
'Orders': ['order_id', 'customer_id', 'order_status_code', 'date_order_placed'],
'Order_Items': ['order_item_id', 'product_id', 'order_id', 'order_item_status_code'],
'Shipments': ['shipment_id', 'order_id', 'invoice_number', 'shipment_tracking_number', 'shipment_date'],
'Shipment_Items': ['shipment_id', 'order_item_id']
} | {
'Customers': ['customer_id', 'gender_code', 'email_address', 'town_city', 'county']
} | TABLE Customer_Payment_Methods (
Customer_Payment_Methods.customer_id (INTEGER),
Customer_Payment_Methods.payment_method_code (VARCHAR(10)),
)
TABLE Customers (
Customers.customer_id (INTEGER),
Customers.gender_code (VARCHAR(1)),
Customers.customer_first_name (VARCHAR(50)),
Customers.customer_middle_initial (VARCHAR(1)),
Customers.customer_last_name (VARCHAR(50)),
Customers.email_address (VARCHAR(255)),
Customers.login_name (VARCHAR(80)),
Customers.login_password (VARCHAR(20)),
Customers.phone_number (VARCHAR(255)),
Customers.address_line_1 (VARCHAR(255)),
Customers.town_city (VARCHAR(50)),
Customers.county (VARCHAR(50)),
Customers.country (VARCHAR(50)),
)
TABLE Invoices (
Invoices.invoice_number (INTEGER),
Invoices.invoice_status_code (VARCHAR(10)),
Invoices.invoice_date (DATETIME),
)
TABLE Order_Items (
Order_Items.order_item_id (INTEGER),
Order_Items.product_id (INTEGER),
Order_Items.order_id (INTEGER),
Order_Items.order_item_status_code (VARCHAR(10)),
)
TABLE Orders (
Orders.order_id (INTEGER),
Orders.customer_id (INTEGER),
Orders.order_status_code (VARCHAR(10)),
Orders.date_order_placed (DATETIME),
)
TABLE Products (
Products.product_id (INTEGER),
Products.parent_product_id (INTEGER),
Products.product_name (VARCHAR(80)),
Products.product_price (DECIMAL(19,4)),
Products.product_color (VARCHAR(50)),
Products.product_size (VARCHAR(50)),
Products.product_description (VARCHAR(255)),
)
TABLE Shipment_Items (
Shipment_Items.shipment_id (INTEGER),
Shipment_Items.order_item_id (INTEGER),
)
TABLE Shipments (
Shipments.shipment_id (INTEGER),
Shipments.order_id (INTEGER),
Shipments.invoice_number (INTEGER),
Shipments.shipment_tracking_number (VARCHAR(80)),
Shipments.shipment_date (DATETIME),
)
Possible JOINs:
Customer_Payment_Methods.customer_id = Customers.customer_id
Order_Items.product_id = Products.product_id
Order_Items.order_id = Orders.order_id
Orders.customer_id = Customers.customer_id
Shipment_Items.shipment_id = Shipments.shipment_id
Shipment_Items.order_item_id = Order_Items.order_item_id
Shipments.order_id = Orders.order_id
Shipments.invoice_number = Invoices.invoice_number
| TABLE Customer_Payment_Methods (
Customer_Payment_Methods.customer_id (INTEGER),
Customer_Payment_Methods.payment_method_code (VARCHAR(10)),
)
TABLE Customers (
Customers.customer_id (INTEGER),
Customers.gender_code (VARCHAR(1)),
Customers.customer_first_name (VARCHAR(50)),
Customers.customer_middle_initial (VARCHAR(1)),
Customers.customer_last_name (VARCHAR(50)),
Customers.email_address (VARCHAR(255)),
Customers.login_name (VARCHAR(80)),
Customers.login_password (VARCHAR(20)),
Customers.phone_number (VARCHAR(255)),
Customers.address_line_1 (VARCHAR(255)),
Customers.town_city (VARCHAR(50)),
Customers.county (VARCHAR(50)),
Customers.country (VARCHAR(50)),
)
TABLE Invoices (
Invoices.invoice_number (INTEGER),
Invoices.invoice_status_code (VARCHAR(10)),
Invoices.invoice_date (DATETIME),
)
TABLE Order_Items (
Order_Items.order_item_id (INTEGER),
Order_Items.product_id (INTEGER),
Order_Items.order_id (INTEGER),
Order_Items.order_item_status_code (VARCHAR(10)),
)
TABLE Orders (
Orders.order_id (INTEGER),
Orders.customer_id (INTEGER),
Orders.order_status_code (VARCHAR(10)),
Orders.date_order_placed (DATETIME),
)
TABLE Products (
Products.product_id (INTEGER),
Products.parent_product_id (INTEGER),
Products.product_name (VARCHAR(80)),
Products.product_price (DECIMAL(19,4)),
Products.product_color (VARCHAR(50)),
Products.product_size (VARCHAR(50)),
Products.product_description (VARCHAR(255)),
)
TABLE Shipment_Items (
Shipment_Items.shipment_id (INTEGER),
Shipment_Items.order_item_id (INTEGER),
)
TABLE Shipments (
Shipments.shipment_id (INTEGER),
Shipments.order_id (INTEGER),
Shipments.invoice_number (INTEGER),
Shipments.shipment_tracking_number (VARCHAR(80)),
Shipments.shipment_date (DATETIME),
)
Possible JOINs:
Customer_Payment_Methods.customer_id = Customers.customer_id
Order_Items.product_id = Products.product_id
Order_Items.order_id = Orders.order_id
Orders.customer_id = Customers.customer_id
Shipment_Items.shipment_id = Shipments.shipment_id
Shipment_Items.order_item_id = Order_Items.order_item_id
Shipments.order_id = Orders.order_id
Shipments.invoice_number = Invoices.invoice_number
| TABLE customer_payment_methods (
customer_payment_methods.customer_id (INTEGER),
customer_payment_methods.payment_method_code (VARCHAR(10)),
)
TABLE customers (
customers.customer_id (INTEGER),
customers.gender_code (VARCHAR(1)),
customers.customer_first_name (VARCHAR(50)),
customers.customer_middle_initial (VARCHAR(1)),
customers.customer_last_name (VARCHAR(50)),
customers.email_address (VARCHAR(255)),
customers.login_name (VARCHAR(80)),
customers.login_password (VARCHAR(20)),
customers.phone_number (VARCHAR(255)),
customers.address_line_1 (VARCHAR(255)),
customers.town_city (VARCHAR(50)),
customers.county (VARCHAR(50)),
customers.country (VARCHAR(50)),
)
TABLE invoices (
invoices.invoice_number (INTEGER),
invoices.invoice_status_code (VARCHAR(10)),
invoices.invoice_date (DATETIME),
)
TABLE order_items (
order_items.order_item_id (INTEGER),
order_items.product_id (INTEGER),
order_items.order_id (INTEGER),
order_items.order_item_status_code (VARCHAR(10)),
)
TABLE orders (
orders.order_id (INTEGER),
orders.customer_id (INTEGER),
orders.order_status_code (VARCHAR(10)),
orders.date_order_placed (DATETIME),
)
TABLE products (
products.product_id (INTEGER),
products.parent_product_id (INTEGER),
products.product_name (VARCHAR(80)),
products.product_price (DECIMAL(19,4)),
products.product_color (VARCHAR(50)),
products.product_size (VARCHAR(50)),
products.product_description (VARCHAR(255)),
)
TABLE shipment_items (
shipment_items.shipment_id (INTEGER),
shipment_items.order_item_id (INTEGER),
)
TABLE shipments (
shipments.shipment_id (INTEGER),
shipments.order_id (INTEGER),
shipments.invoice_number (INTEGER),
shipments.shipment_tracking_number (VARCHAR(80)),
shipments.shipment_date (DATETIME),
)
Possible JOINs:
customer_payment_methods.customer_id = customers.customer_id
order_items.product_id = products.product_id
order_items.order_id = orders.order_id
orders.customer_id = customers.customer_id
shipment_items.shipment_id = shipments.shipment_id
shipment_items.order_item_id = order_items.order_item_id
shipments.order_id = orders.order_id
shipments.invoice_number = invoices.invoice_number
|
book_1 |
CREATE TABLE Client
(IdClient CHAR(10) PRIMARY KEY,
Name VARCHAR(25) NOT NULL,
Address VARCHAR(60) NOT NULL,
NumCC CHAR(16) NOT NULL)
/*
0 rows from Client table:
IdClient Name Address NumCC
*/
CREATE TABLE Orders
(IdOrder CHAR(10) PRIMARY KEY,
IdClient CHAR(10) NOT NULL REFERENCES Client on delete cascade,
DateOrder DATE,
DateExped DATE)
/*
0 rows from Orders table:
IdOrder IdClient DateOrder DateExped
*/
CREATE TABLE Author
( idAuthor NUMBER PRIMARY KEY,
Name VARCHAR(25))
/*
0 rows from Author table:
idAuthor Name
*/
CREATE TABLE Book
(ISBN CHAR(15) PRIMARY KEY,
Title VARCHAR(60) NOT NULL,
Author CHAR(4) NOT NULL,
PurchasePrice NUMBER(6,2) DEFAULT 0,
SalePrice NUMBER(6,2) DEFAULT 0)
/*
0 rows from Book table:
ISBN Title Author PurchasePrice SalePrice
*/
CREATE TABLE Author_Book
(ISBN CHAR(15),
Author NUMBER,
CONSTRAINT al_PK PRIMARY KEY (ISBN, Author),
CONSTRAINT BookA_FK FOREIGN KEY (ISBN) REFERENCES `Book`(ISBN) on delete cascade,
CONSTRAINT Author_FK FOREIGN KEY (Author) REFERENCES `Author`(idAuthorA))
/*
0 rows from Author_Book table:
ISBN Author
*/
CREATE TABLE Books_Order(
ISBN CHAR(15),
IdOrder CHAR(10),
amount NUMBER(3) CHECK (amount >0),
CONSTRAINT lp_PK PRIMARY KEY (ISBN, idOrder),
CONSTRAINT Book_FK FOREIGN KEY (ISBN) REFERENCES `Book`(ISBN) on delete cascade,
CONSTRAINT pedido_FK FOREIGN KEY (IdOrder) REFERENCES `Orders`(IdOrder) on delete cascade)
/*
0 rows from Books_Order table:
ISBN IdOrder amount
*/
| What are the titles of books that have a sale price equal to the lowest sale price across all books ? | medium | Table Author (
Author.idAuthor (NUMBER),
Author.Name (VARCHAR(25)),
)
Table Author_Book (
Author_Book.ISBN (CHAR(15)),
Author_Book.Author (NUMBER),
)
Table Book (
Book.ISBN (CHAR(15)),
Book.Title (VARCHAR(60)),
Book.Author (CHAR(4)),
Book.PurchasePrice (NUMBER(6,2)),
Book.SalePrice (NUMBER(6,2)),
)
Table Books_Order (
Books_Order.ISBN (CHAR(15)),
Books_Order.IdOrder (CHAR(10)),
Books_Order.amount (NUMBER(3)),
)
Table Client (
Client.IdClient (CHAR(10)),
Client.Name (VARCHAR(25)),
Client.Address (VARCHAR(60)),
Client.NumCC (CHAR(16)),
)
Table Orders (
Orders.IdOrder (CHAR(10)),
Orders.IdClient (CHAR(10)),
Orders.DateOrder (DATE),
Orders.DateExped (DATE),
)
Possible JOINs:
Author_Book.ISBN = Book.ISBN
Author_Book.Author = Author.idAuthorA
Books_Order.ISBN = Book.ISBN
Books_Order.IdOrder = Orders.IdOrder
Orders.IdClient = Client.IdClient
| SELECT title FROM book ORDER BY saleprice ASC LIMIT 1 | {
'book': ['isbn', 'title', 'saleprice']
} | CREATE TABLE Author (
Author.idAuthor (NUMBER),
Author.Name (VARCHAR(25)),
)
CREATE TABLE Author_Book (
Author_Book.ISBN (CHAR(15)),
Author_Book.Author (NUMBER),
)
CREATE TABLE Book (
Book.ISBN (CHAR(15)),
Book.Title (VARCHAR(60)),
Book.Author (CHAR(4)),
Book.PurchasePrice (NUMBER(6,2)),
Book.SalePrice (NUMBER(6,2)),
)
CREATE TABLE Books_Order (
Books_Order.ISBN (CHAR(15)),
Books_Order.IdOrder (CHAR(10)),
Books_Order.amount (NUMBER(3)),
)
CREATE TABLE Client (
Client.IdClient (CHAR(10)),
Client.Name (VARCHAR(25)),
Client.Address (VARCHAR(60)),
Client.NumCC (CHAR(16)),
)
CREATE TABLE Orders (
Orders.IdOrder (CHAR(10)),
Orders.IdClient (CHAR(10)),
Orders.DateOrder (DATE),
Orders.DateExped (DATE),
)
Possible JOINs:
Author_Book.ISBN = Book.ISBN
Author_Book.Author = Author.idAuthorA
Books_Order.ISBN = Book.ISBN
Books_Order.IdOrder = Orders.IdOrder
Orders.IdClient = Client.IdClient
| Table Author (
Author.idauthor (NUMBER),
Author.name (VARCHAR(25)),
)
Table Author_Book (
Author_Book.isbn (CHAR(15)),
Author_Book.author (NUMBER),
)
Table Book (
Book.isbn (CHAR(15)),
Book.title (VARCHAR(60)),
Book.author (CHAR(4)),
Book.purchaseprice (NUMBER(6,2)),
Book.saleprice (NUMBER(6,2)),
)
Table Books_Order (
Books_Order.isbn (CHAR(15)),
Books_Order.idorder (CHAR(10)),
Books_Order.amount (NUMBER(3)),
)
Table Client (
Client.idclient (CHAR(10)),
Client.name (VARCHAR(25)),
Client.address (VARCHAR(60)),
Client.numcc (CHAR(16)),
)
Table Orders (
Orders.idorder (CHAR(10)),
Orders.idclient (CHAR(10)),
Orders.dateorder (DATE),
Orders.dateexped (DATE),
)
Possible JOINs:
Author_Book.isbn = Book.isbn
Author_Book.author = Author.idauthora
Books_Order.isbn = Book.isbn
Books_Order.idorder = Orders.idorder
Orders.idclient = Client.idclient
| CREATE TABLE Author (
Author.idauthor (NUMBER),
Author.name (VARCHAR(25)),
)
CREATE TABLE Author_Book (
Author_Book.isbn (CHAR(15)),
Author_Book.author (NUMBER),
)
CREATE TABLE Book (
Book.isbn (CHAR(15)),
Book.title (VARCHAR(60)),
Book.author (CHAR(4)),
Book.purchaseprice (NUMBER(6,2)),
Book.saleprice (NUMBER(6,2)),
)
CREATE TABLE Books_Order (
Books_Order.isbn (CHAR(15)),
Books_Order.idorder (CHAR(10)),
Books_Order.amount (NUMBER(3)),
)
CREATE TABLE Client (
Client.idclient (CHAR(10)),
Client.name (VARCHAR(25)),
Client.address (VARCHAR(60)),
Client.numcc (CHAR(16)),
)
CREATE TABLE Orders (
Orders.idorder (CHAR(10)),
Orders.idclient (CHAR(10)),
Orders.dateorder (DATE),
Orders.dateexped (DATE),
)
Possible JOINs:
Author_Book.isbn = Book.isbn
Author_Book.author = Author.idauthora
Books_Order.isbn = Book.isbn
Books_Order.idorder = Orders.idorder
Orders.idclient = Client.idclient
| Table author (
author.idauthor (NUMBER),
author.name (VARCHAR(25)),
)
Table author_book (
author_book.isbn (CHAR(15)),
author_book.author (NUMBER),
)
Table book (
book.isbn (CHAR(15)),
book.title (VARCHAR(60)),
book.author (CHAR(4)),
book.purchaseprice (NUMBER(6,2)),
book.saleprice (NUMBER(6,2)),
)
Table books_order (
books_order.isbn (CHAR(15)),
books_order.idorder (CHAR(10)),
books_order.amount (NUMBER(3)),
)
Table client (
client.idclient (CHAR(10)),
client.name (VARCHAR(25)),
client.address (VARCHAR(60)),
client.numcc (CHAR(16)),
)
Table orders (
orders.idorder (CHAR(10)),
orders.idclient (CHAR(10)),
orders.dateorder (DATE),
orders.dateexped (DATE),
)
Possible JOINs:
author_book.isbn = book.isbn
author_book.author = author.idauthora
books_order.isbn = book.isbn
books_order.idorder = orders.idorder
orders.idclient = client.idclient
| CREATE TABLE author (
author.idauthor (NUMBER),
author.name (VARCHAR(25)),
)
CREATE TABLE author_book (
author_book.isbn (CHAR(15)),
author_book.author (NUMBER),
)
CREATE TABLE book (
book.isbn (CHAR(15)),
book.title (VARCHAR(60)),
book.author (CHAR(4)),
book.purchaseprice (NUMBER(6,2)),
book.saleprice (NUMBER(6,2)),
)
CREATE TABLE books_order (
books_order.isbn (CHAR(15)),
books_order.idorder (CHAR(10)),
books_order.amount (NUMBER(3)),
)
CREATE TABLE client (
client.idclient (CHAR(10)),
client.name (VARCHAR(25)),
client.address (VARCHAR(60)),
client.numcc (CHAR(16)),
)
CREATE TABLE orders (
orders.idorder (CHAR(10)),
orders.idclient (CHAR(10)),
orders.dateorder (DATE),
orders.dateexped (DATE),
)
Possible JOINs:
author_book.isbn = book.isbn
author_book.author = author.idauthora
books_order.isbn = book.isbn
books_order.idorder = orders.idorder
orders.idclient = client.idclient
| {
'Client': ['IdClient', 'Name', 'Address', 'NumCC'],
'Orders': ['IdOrder', 'IdClient', 'DateOrder', 'DateExped'],
'Author': ['idAuthor', 'Name'],
'Book': ['ISBN', 'Title', 'Author', 'PurchasePrice', 'SalePrice'],
'Author_Book': ['ISBN', 'Author'],
'Books_Order': ['ISBN', 'IdOrder', 'amount']
} | {
'Book': ['ISBN', 'Title', 'SalePrice']
} | TABLE Author (
Author.idAuthor (NUMBER),
Author.Name (VARCHAR(25)),
)
TABLE Author_Book (
Author_Book.ISBN (CHAR(15)),
Author_Book.Author (NUMBER),
)
TABLE Book (
Book.ISBN (CHAR(15)),
Book.Title (VARCHAR(60)),
Book.Author (CHAR(4)),
Book.PurchasePrice (NUMBER(6,2)),
Book.SalePrice (NUMBER(6,2)),
)
TABLE Books_Order (
Books_Order.ISBN (CHAR(15)),
Books_Order.IdOrder (CHAR(10)),
Books_Order.amount (NUMBER(3)),
)
TABLE Client (
Client.IdClient (CHAR(10)),
Client.Name (VARCHAR(25)),
Client.Address (VARCHAR(60)),
Client.NumCC (CHAR(16)),
)
TABLE Orders (
Orders.IdOrder (CHAR(10)),
Orders.IdClient (CHAR(10)),
Orders.DateOrder (DATE),
Orders.DateExped (DATE),
)
Possible JOINs:
Author_Book.ISBN = Book.ISBN
Author_Book.Author = Author.idAuthorA
Books_Order.ISBN = Book.ISBN
Books_Order.IdOrder = Orders.IdOrder
Orders.IdClient = Client.IdClient
| TABLE Author (
Author.idauthor (NUMBER),
Author.name (VARCHAR(25)),
)
TABLE Author_Book (
Author_Book.isbn (CHAR(15)),
Author_Book.author (NUMBER),
)
TABLE Book (
Book.isbn (CHAR(15)),
Book.title (VARCHAR(60)),
Book.author (CHAR(4)),
Book.purchaseprice (NUMBER(6,2)),
Book.saleprice (NUMBER(6,2)),
)
TABLE Books_Order (
Books_Order.isbn (CHAR(15)),
Books_Order.idorder (CHAR(10)),
Books_Order.amount (NUMBER(3)),
)
TABLE Client (
Client.idclient (CHAR(10)),
Client.name (VARCHAR(25)),
Client.address (VARCHAR(60)),
Client.numcc (CHAR(16)),
)
TABLE Orders (
Orders.idorder (CHAR(10)),
Orders.idclient (CHAR(10)),
Orders.dateorder (DATE),
Orders.dateexped (DATE),
)
Possible JOINs:
Author_Book.isbn = Book.isbn
Author_Book.author = Author.idauthora
Books_Order.isbn = Book.isbn
Books_Order.idorder = Orders.idorder
Orders.idclient = Client.idclient
| TABLE author (
author.idauthor (NUMBER),
author.name (VARCHAR(25)),
)
TABLE author_book (
author_book.isbn (CHAR(15)),
author_book.author (NUMBER),
)
TABLE book (
book.isbn (CHAR(15)),
book.title (VARCHAR(60)),
book.author (CHAR(4)),
book.purchaseprice (NUMBER(6,2)),
book.saleprice (NUMBER(6,2)),
)
TABLE books_order (
books_order.isbn (CHAR(15)),
books_order.idorder (CHAR(10)),
books_order.amount (NUMBER(3)),
)
TABLE client (
client.idclient (CHAR(10)),
client.name (VARCHAR(25)),
client.address (VARCHAR(60)),
client.numcc (CHAR(16)),
)
TABLE orders (
orders.idorder (CHAR(10)),
orders.idclient (CHAR(10)),
orders.dateorder (DATE),
orders.dateexped (DATE),
)
Possible JOINs:
author_book.isbn = book.isbn
author_book.author = author.idauthora
books_order.isbn = book.isbn
books_order.idorder = orders.idorder
orders.idclient = client.idclient
|
e_commerce |
CREATE TABLE "Customer_Payment_Methods" (
customer_id INTEGER NOT NULL,
payment_method_code VARCHAR(10) NOT NULL,
FOREIGN KEY(customer_id) REFERENCES "Customers" (customer_id)
)
CREATE TABLE "Customers" (
customer_id INTEGER,
gender_code VARCHAR(1) NOT NULL,
customer_first_name VARCHAR(50),
customer_middle_initial VARCHAR(1),
customer_last_name VARCHAR(50),
email_address VARCHAR(255),
login_name VARCHAR(80),
login_password VARCHAR(20),
phone_number VARCHAR(255),
address_line_1 VARCHAR(255),
town_city VARCHAR(50),
county VARCHAR(50),
country VARCHAR(50),
PRIMARY KEY (customer_id)
)
CREATE TABLE "Invoices" (
invoice_number INTEGER,
invoice_status_code VARCHAR(10) NOT NULL,
invoice_date DATETIME,
PRIMARY KEY (invoice_number)
)
CREATE TABLE "Order_Items" (
order_item_id INTEGER,
product_id INTEGER NOT NULL,
order_id INTEGER NOT NULL,
order_item_status_code VARCHAR(10) NOT NULL,
PRIMARY KEY (order_item_id),
FOREIGN KEY(order_id) REFERENCES "Orders" (order_id),
FOREIGN KEY(product_id) REFERENCES "Products" (product_id)
)
CREATE TABLE "Orders" (
order_id INTEGER,
customer_id INTEGER NOT NULL,
order_status_code VARCHAR(10) NOT NULL,
date_order_placed DATETIME NOT NULL,
PRIMARY KEY (order_id),
FOREIGN KEY(customer_id) REFERENCES "Customers" (customer_id)
)
CREATE TABLE "Products" (
product_id INTEGER,
parent_product_id INTEGER,
product_name VARCHAR(80),
product_price DECIMAL(19, 4) DEFAULT 0,
product_color VARCHAR(50),
product_size VARCHAR(50),
product_description VARCHAR(255),
PRIMARY KEY (product_id)
)
CREATE TABLE "Shipment_Items" (
shipment_id INTEGER NOT NULL,
order_item_id INTEGER NOT NULL,
PRIMARY KEY (shipment_id, order_item_id),
FOREIGN KEY(order_item_id) REFERENCES "Order_Items" (order_item_id),
FOREIGN KEY(shipment_id) REFERENCES "Shipments" (shipment_id)
)
CREATE TABLE "Shipments" (
shipment_id INTEGER,
order_id INTEGER NOT NULL,
invoice_number INTEGER NOT NULL,
shipment_tracking_number VARCHAR(80),
shipment_date DATETIME,
PRIMARY KEY (shipment_id),
FOREIGN KEY(order_id) REFERENCES "Orders" (order_id),
FOREIGN KEY(invoice_number) REFERENCES "Invoices" (invoice_number)
) | List the invoices' status, date and the date of shipment. | medium | Table Customer_Payment_Methods (
Customer_Payment_Methods.customer_id (INTEGER),
Customer_Payment_Methods.payment_method_code (VARCHAR(10)),
)
Table Customers (
Customers.customer_id (INTEGER),
Customers.gender_code (VARCHAR(1)),
Customers.customer_first_name (VARCHAR(50)),
Customers.customer_middle_initial (VARCHAR(1)),
Customers.customer_last_name (VARCHAR(50)),
Customers.email_address (VARCHAR(255)),
Customers.login_name (VARCHAR(80)),
Customers.login_password (VARCHAR(20)),
Customers.phone_number (VARCHAR(255)),
Customers.address_line_1 (VARCHAR(255)),
Customers.town_city (VARCHAR(50)),
Customers.county (VARCHAR(50)),
Customers.country (VARCHAR(50)),
)
Table Invoices (
Invoices.invoice_number (INTEGER),
Invoices.invoice_status_code (VARCHAR(10)),
Invoices.invoice_date (DATETIME),
)
Table Order_Items (
Order_Items.order_item_id (INTEGER),
Order_Items.product_id (INTEGER),
Order_Items.order_id (INTEGER),
Order_Items.order_item_status_code (VARCHAR(10)),
)
Table Orders (
Orders.order_id (INTEGER),
Orders.customer_id (INTEGER),
Orders.order_status_code (VARCHAR(10)),
Orders.date_order_placed (DATETIME),
)
Table Products (
Products.product_id (INTEGER),
Products.parent_product_id (INTEGER),
Products.product_name (VARCHAR(80)),
Products.product_price (DECIMAL(19,4)),
Products.product_color (VARCHAR(50)),
Products.product_size (VARCHAR(50)),
Products.product_description (VARCHAR(255)),
)
Table Shipment_Items (
Shipment_Items.shipment_id (INTEGER),
Shipment_Items.order_item_id (INTEGER),
)
Table Shipments (
Shipments.shipment_id (INTEGER),
Shipments.order_id (INTEGER),
Shipments.invoice_number (INTEGER),
Shipments.shipment_tracking_number (VARCHAR(80)),
Shipments.shipment_date (DATETIME),
)
Possible JOINs:
Customer_Payment_Methods.customer_id = Customers.customer_id
Order_Items.product_id = Products.product_id
Order_Items.order_id = Orders.order_id
Orders.customer_id = Customers.customer_id
Shipment_Items.shipment_id = Shipments.shipment_id
Shipment_Items.order_item_id = Order_Items.order_item_id
Shipments.order_id = Orders.order_id
Shipments.invoice_number = Invoices.invoice_number
| SELECT Invoices.invoice_status_code , Invoices.invoice_date , Shipments.shipment_date FROM Invoices JOIN Shipments ON Invoices.invoice_number = Shipments.invoice_number | {
'invoices': ['invoice_number', 'invoice_status_code', 'invoice_date'],
'shipments': ['shipment_id', 'invoice_number', 'shipment_date']
} | CREATE TABLE Customer_Payment_Methods (
Customer_Payment_Methods.customer_id (INTEGER),
Customer_Payment_Methods.payment_method_code (VARCHAR(10)),
)
CREATE TABLE Customers (
Customers.customer_id (INTEGER),
Customers.gender_code (VARCHAR(1)),
Customers.customer_first_name (VARCHAR(50)),
Customers.customer_middle_initial (VARCHAR(1)),
Customers.customer_last_name (VARCHAR(50)),
Customers.email_address (VARCHAR(255)),
Customers.login_name (VARCHAR(80)),
Customers.login_password (VARCHAR(20)),
Customers.phone_number (VARCHAR(255)),
Customers.address_line_1 (VARCHAR(255)),
Customers.town_city (VARCHAR(50)),
Customers.county (VARCHAR(50)),
Customers.country (VARCHAR(50)),
)
CREATE TABLE Invoices (
Invoices.invoice_number (INTEGER),
Invoices.invoice_status_code (VARCHAR(10)),
Invoices.invoice_date (DATETIME),
)
CREATE TABLE Order_Items (
Order_Items.order_item_id (INTEGER),
Order_Items.product_id (INTEGER),
Order_Items.order_id (INTEGER),
Order_Items.order_item_status_code (VARCHAR(10)),
)
CREATE TABLE Orders (
Orders.order_id (INTEGER),
Orders.customer_id (INTEGER),
Orders.order_status_code (VARCHAR(10)),
Orders.date_order_placed (DATETIME),
)
CREATE TABLE Products (
Products.product_id (INTEGER),
Products.parent_product_id (INTEGER),
Products.product_name (VARCHAR(80)),
Products.product_price (DECIMAL(19,4)),
Products.product_color (VARCHAR(50)),
Products.product_size (VARCHAR(50)),
Products.product_description (VARCHAR(255)),
)
CREATE TABLE Shipment_Items (
Shipment_Items.shipment_id (INTEGER),
Shipment_Items.order_item_id (INTEGER),
)
CREATE TABLE Shipments (
Shipments.shipment_id (INTEGER),
Shipments.order_id (INTEGER),
Shipments.invoice_number (INTEGER),
Shipments.shipment_tracking_number (VARCHAR(80)),
Shipments.shipment_date (DATETIME),
)
Possible JOINs:
Customer_Payment_Methods.customer_id = Customers.customer_id
Order_Items.product_id = Products.product_id
Order_Items.order_id = Orders.order_id
Orders.customer_id = Customers.customer_id
Shipment_Items.shipment_id = Shipments.shipment_id
Shipment_Items.order_item_id = Order_Items.order_item_id
Shipments.order_id = Orders.order_id
Shipments.invoice_number = Invoices.invoice_number
| Table Customer_Payment_Methods (
Customer_Payment_Methods.customer_id (INTEGER),
Customer_Payment_Methods.payment_method_code (VARCHAR(10)),
)
Table Customers (
Customers.customer_id (INTEGER),
Customers.gender_code (VARCHAR(1)),
Customers.customer_first_name (VARCHAR(50)),
Customers.customer_middle_initial (VARCHAR(1)),
Customers.customer_last_name (VARCHAR(50)),
Customers.email_address (VARCHAR(255)),
Customers.login_name (VARCHAR(80)),
Customers.login_password (VARCHAR(20)),
Customers.phone_number (VARCHAR(255)),
Customers.address_line_1 (VARCHAR(255)),
Customers.town_city (VARCHAR(50)),
Customers.county (VARCHAR(50)),
Customers.country (VARCHAR(50)),
)
Table Invoices (
Invoices.invoice_number (INTEGER),
Invoices.invoice_status_code (VARCHAR(10)),
Invoices.invoice_date (DATETIME),
)
Table Order_Items (
Order_Items.order_item_id (INTEGER),
Order_Items.product_id (INTEGER),
Order_Items.order_id (INTEGER),
Order_Items.order_item_status_code (VARCHAR(10)),
)
Table Orders (
Orders.order_id (INTEGER),
Orders.customer_id (INTEGER),
Orders.order_status_code (VARCHAR(10)),
Orders.date_order_placed (DATETIME),
)
Table Products (
Products.product_id (INTEGER),
Products.parent_product_id (INTEGER),
Products.product_name (VARCHAR(80)),
Products.product_price (DECIMAL(19,4)),
Products.product_color (VARCHAR(50)),
Products.product_size (VARCHAR(50)),
Products.product_description (VARCHAR(255)),
)
Table Shipment_Items (
Shipment_Items.shipment_id (INTEGER),
Shipment_Items.order_item_id (INTEGER),
)
Table Shipments (
Shipments.shipment_id (INTEGER),
Shipments.order_id (INTEGER),
Shipments.invoice_number (INTEGER),
Shipments.shipment_tracking_number (VARCHAR(80)),
Shipments.shipment_date (DATETIME),
)
Possible JOINs:
Customer_Payment_Methods.customer_id = Customers.customer_id
Order_Items.product_id = Products.product_id
Order_Items.order_id = Orders.order_id
Orders.customer_id = Customers.customer_id
Shipment_Items.shipment_id = Shipments.shipment_id
Shipment_Items.order_item_id = Order_Items.order_item_id
Shipments.order_id = Orders.order_id
Shipments.invoice_number = Invoices.invoice_number
| CREATE TABLE Customer_Payment_Methods (
Customer_Payment_Methods.customer_id (INTEGER),
Customer_Payment_Methods.payment_method_code (VARCHAR(10)),
)
CREATE TABLE Customers (
Customers.customer_id (INTEGER),
Customers.gender_code (VARCHAR(1)),
Customers.customer_first_name (VARCHAR(50)),
Customers.customer_middle_initial (VARCHAR(1)),
Customers.customer_last_name (VARCHAR(50)),
Customers.email_address (VARCHAR(255)),
Customers.login_name (VARCHAR(80)),
Customers.login_password (VARCHAR(20)),
Customers.phone_number (VARCHAR(255)),
Customers.address_line_1 (VARCHAR(255)),
Customers.town_city (VARCHAR(50)),
Customers.county (VARCHAR(50)),
Customers.country (VARCHAR(50)),
)
CREATE TABLE Invoices (
Invoices.invoice_number (INTEGER),
Invoices.invoice_status_code (VARCHAR(10)),
Invoices.invoice_date (DATETIME),
)
CREATE TABLE Order_Items (
Order_Items.order_item_id (INTEGER),
Order_Items.product_id (INTEGER),
Order_Items.order_id (INTEGER),
Order_Items.order_item_status_code (VARCHAR(10)),
)
CREATE TABLE Orders (
Orders.order_id (INTEGER),
Orders.customer_id (INTEGER),
Orders.order_status_code (VARCHAR(10)),
Orders.date_order_placed (DATETIME),
)
CREATE TABLE Products (
Products.product_id (INTEGER),
Products.parent_product_id (INTEGER),
Products.product_name (VARCHAR(80)),
Products.product_price (DECIMAL(19,4)),
Products.product_color (VARCHAR(50)),
Products.product_size (VARCHAR(50)),
Products.product_description (VARCHAR(255)),
)
CREATE TABLE Shipment_Items (
Shipment_Items.shipment_id (INTEGER),
Shipment_Items.order_item_id (INTEGER),
)
CREATE TABLE Shipments (
Shipments.shipment_id (INTEGER),
Shipments.order_id (INTEGER),
Shipments.invoice_number (INTEGER),
Shipments.shipment_tracking_number (VARCHAR(80)),
Shipments.shipment_date (DATETIME),
)
Possible JOINs:
Customer_Payment_Methods.customer_id = Customers.customer_id
Order_Items.product_id = Products.product_id
Order_Items.order_id = Orders.order_id
Orders.customer_id = Customers.customer_id
Shipment_Items.shipment_id = Shipments.shipment_id
Shipment_Items.order_item_id = Order_Items.order_item_id
Shipments.order_id = Orders.order_id
Shipments.invoice_number = Invoices.invoice_number
| Table customer_payment_methods (
customer_payment_methods.customer_id (INTEGER),
customer_payment_methods.payment_method_code (VARCHAR(10)),
)
Table customers (
customers.customer_id (INTEGER),
customers.gender_code (VARCHAR(1)),
customers.customer_first_name (VARCHAR(50)),
customers.customer_middle_initial (VARCHAR(1)),
customers.customer_last_name (VARCHAR(50)),
customers.email_address (VARCHAR(255)),
customers.login_name (VARCHAR(80)),
customers.login_password (VARCHAR(20)),
customers.phone_number (VARCHAR(255)),
customers.address_line_1 (VARCHAR(255)),
customers.town_city (VARCHAR(50)),
customers.county (VARCHAR(50)),
customers.country (VARCHAR(50)),
)
Table invoices (
invoices.invoice_number (INTEGER),
invoices.invoice_status_code (VARCHAR(10)),
invoices.invoice_date (DATETIME),
)
Table order_items (
order_items.order_item_id (INTEGER),
order_items.product_id (INTEGER),
order_items.order_id (INTEGER),
order_items.order_item_status_code (VARCHAR(10)),
)
Table orders (
orders.order_id (INTEGER),
orders.customer_id (INTEGER),
orders.order_status_code (VARCHAR(10)),
orders.date_order_placed (DATETIME),
)
Table products (
products.product_id (INTEGER),
products.parent_product_id (INTEGER),
products.product_name (VARCHAR(80)),
products.product_price (DECIMAL(19,4)),
products.product_color (VARCHAR(50)),
products.product_size (VARCHAR(50)),
products.product_description (VARCHAR(255)),
)
Table shipment_items (
shipment_items.shipment_id (INTEGER),
shipment_items.order_item_id (INTEGER),
)
Table shipments (
shipments.shipment_id (INTEGER),
shipments.order_id (INTEGER),
shipments.invoice_number (INTEGER),
shipments.shipment_tracking_number (VARCHAR(80)),
shipments.shipment_date (DATETIME),
)
Possible JOINs:
customer_payment_methods.customer_id = customers.customer_id
order_items.product_id = products.product_id
order_items.order_id = orders.order_id
orders.customer_id = customers.customer_id
shipment_items.shipment_id = shipments.shipment_id
shipment_items.order_item_id = order_items.order_item_id
shipments.order_id = orders.order_id
shipments.invoice_number = invoices.invoice_number
| CREATE TABLE customer_payment_methods (
customer_payment_methods.customer_id (INTEGER),
customer_payment_methods.payment_method_code (VARCHAR(10)),
)
CREATE TABLE customers (
customers.customer_id (INTEGER),
customers.gender_code (VARCHAR(1)),
customers.customer_first_name (VARCHAR(50)),
customers.customer_middle_initial (VARCHAR(1)),
customers.customer_last_name (VARCHAR(50)),
customers.email_address (VARCHAR(255)),
customers.login_name (VARCHAR(80)),
customers.login_password (VARCHAR(20)),
customers.phone_number (VARCHAR(255)),
customers.address_line_1 (VARCHAR(255)),
customers.town_city (VARCHAR(50)),
customers.county (VARCHAR(50)),
customers.country (VARCHAR(50)),
)
CREATE TABLE invoices (
invoices.invoice_number (INTEGER),
invoices.invoice_status_code (VARCHAR(10)),
invoices.invoice_date (DATETIME),
)
CREATE TABLE order_items (
order_items.order_item_id (INTEGER),
order_items.product_id (INTEGER),
order_items.order_id (INTEGER),
order_items.order_item_status_code (VARCHAR(10)),
)
CREATE TABLE orders (
orders.order_id (INTEGER),
orders.customer_id (INTEGER),
orders.order_status_code (VARCHAR(10)),
orders.date_order_placed (DATETIME),
)
CREATE TABLE products (
products.product_id (INTEGER),
products.parent_product_id (INTEGER),
products.product_name (VARCHAR(80)),
products.product_price (DECIMAL(19,4)),
products.product_color (VARCHAR(50)),
products.product_size (VARCHAR(50)),
products.product_description (VARCHAR(255)),
)
CREATE TABLE shipment_items (
shipment_items.shipment_id (INTEGER),
shipment_items.order_item_id (INTEGER),
)
CREATE TABLE shipments (
shipments.shipment_id (INTEGER),
shipments.order_id (INTEGER),
shipments.invoice_number (INTEGER),
shipments.shipment_tracking_number (VARCHAR(80)),
shipments.shipment_date (DATETIME),
)
Possible JOINs:
customer_payment_methods.customer_id = customers.customer_id
order_items.product_id = products.product_id
order_items.order_id = orders.order_id
orders.customer_id = customers.customer_id
shipment_items.shipment_id = shipments.shipment_id
shipment_items.order_item_id = order_items.order_item_id
shipments.order_id = orders.order_id
shipments.invoice_number = invoices.invoice_number
| {
'Products': ['product_id', 'parent_product_id', 'product_name', 'product_price', 'product_color', 'product_size', 'product_description'],
'Customers': ['customer_id', 'gender_code', 'customer_first_name', 'customer_middle_initial', 'customer_last_name', 'email_address', 'login_name', 'login_password', 'phone_number', 'address_line_1', 'town_city', 'county', 'country'],
'Customer_Payment_Methods': ['customer_id', 'payment_method_code'],
'Invoices': ['invoice_number', 'invoice_status_code', 'invoice_date'],
'Orders': ['order_id', 'customer_id', 'order_status_code', 'date_order_placed'],
'Order_Items': ['order_item_id', 'product_id', 'order_id', 'order_item_status_code'],
'Shipments': ['shipment_id', 'order_id', 'invoice_number', 'shipment_tracking_number', 'shipment_date'],
'Shipment_Items': ['shipment_id', 'order_item_id']
} | {
'Invoices': ['invoice_number', 'invoice_status_code', 'invoice_date'],
'Shipments': ['shipment_id', 'invoice_number', 'shipment_date']
} | TABLE Customer_Payment_Methods (
Customer_Payment_Methods.customer_id (INTEGER),
Customer_Payment_Methods.payment_method_code (VARCHAR(10)),
)
TABLE Customers (
Customers.customer_id (INTEGER),
Customers.gender_code (VARCHAR(1)),
Customers.customer_first_name (VARCHAR(50)),
Customers.customer_middle_initial (VARCHAR(1)),
Customers.customer_last_name (VARCHAR(50)),
Customers.email_address (VARCHAR(255)),
Customers.login_name (VARCHAR(80)),
Customers.login_password (VARCHAR(20)),
Customers.phone_number (VARCHAR(255)),
Customers.address_line_1 (VARCHAR(255)),
Customers.town_city (VARCHAR(50)),
Customers.county (VARCHAR(50)),
Customers.country (VARCHAR(50)),
)
TABLE Invoices (
Invoices.invoice_number (INTEGER),
Invoices.invoice_status_code (VARCHAR(10)),
Invoices.invoice_date (DATETIME),
)
TABLE Order_Items (
Order_Items.order_item_id (INTEGER),
Order_Items.product_id (INTEGER),
Order_Items.order_id (INTEGER),
Order_Items.order_item_status_code (VARCHAR(10)),
)
TABLE Orders (
Orders.order_id (INTEGER),
Orders.customer_id (INTEGER),
Orders.order_status_code (VARCHAR(10)),
Orders.date_order_placed (DATETIME),
)
TABLE Products (
Products.product_id (INTEGER),
Products.parent_product_id (INTEGER),
Products.product_name (VARCHAR(80)),
Products.product_price (DECIMAL(19,4)),
Products.product_color (VARCHAR(50)),
Products.product_size (VARCHAR(50)),
Products.product_description (VARCHAR(255)),
)
TABLE Shipment_Items (
Shipment_Items.shipment_id (INTEGER),
Shipment_Items.order_item_id (INTEGER),
)
TABLE Shipments (
Shipments.shipment_id (INTEGER),
Shipments.order_id (INTEGER),
Shipments.invoice_number (INTEGER),
Shipments.shipment_tracking_number (VARCHAR(80)),
Shipments.shipment_date (DATETIME),
)
Possible JOINs:
Customer_Payment_Methods.customer_id = Customers.customer_id
Order_Items.product_id = Products.product_id
Order_Items.order_id = Orders.order_id
Orders.customer_id = Customers.customer_id
Shipment_Items.shipment_id = Shipments.shipment_id
Shipment_Items.order_item_id = Order_Items.order_item_id
Shipments.order_id = Orders.order_id
Shipments.invoice_number = Invoices.invoice_number
| TABLE Customer_Payment_Methods (
Customer_Payment_Methods.customer_id (INTEGER),
Customer_Payment_Methods.payment_method_code (VARCHAR(10)),
)
TABLE Customers (
Customers.customer_id (INTEGER),
Customers.gender_code (VARCHAR(1)),
Customers.customer_first_name (VARCHAR(50)),
Customers.customer_middle_initial (VARCHAR(1)),
Customers.customer_last_name (VARCHAR(50)),
Customers.email_address (VARCHAR(255)),
Customers.login_name (VARCHAR(80)),
Customers.login_password (VARCHAR(20)),
Customers.phone_number (VARCHAR(255)),
Customers.address_line_1 (VARCHAR(255)),
Customers.town_city (VARCHAR(50)),
Customers.county (VARCHAR(50)),
Customers.country (VARCHAR(50)),
)
TABLE Invoices (
Invoices.invoice_number (INTEGER),
Invoices.invoice_status_code (VARCHAR(10)),
Invoices.invoice_date (DATETIME),
)
TABLE Order_Items (
Order_Items.order_item_id (INTEGER),
Order_Items.product_id (INTEGER),
Order_Items.order_id (INTEGER),
Order_Items.order_item_status_code (VARCHAR(10)),
)
TABLE Orders (
Orders.order_id (INTEGER),
Orders.customer_id (INTEGER),
Orders.order_status_code (VARCHAR(10)),
Orders.date_order_placed (DATETIME),
)
TABLE Products (
Products.product_id (INTEGER),
Products.parent_product_id (INTEGER),
Products.product_name (VARCHAR(80)),
Products.product_price (DECIMAL(19,4)),
Products.product_color (VARCHAR(50)),
Products.product_size (VARCHAR(50)),
Products.product_description (VARCHAR(255)),
)
TABLE Shipment_Items (
Shipment_Items.shipment_id (INTEGER),
Shipment_Items.order_item_id (INTEGER),
)
TABLE Shipments (
Shipments.shipment_id (INTEGER),
Shipments.order_id (INTEGER),
Shipments.invoice_number (INTEGER),
Shipments.shipment_tracking_number (VARCHAR(80)),
Shipments.shipment_date (DATETIME),
)
Possible JOINs:
Customer_Payment_Methods.customer_id = Customers.customer_id
Order_Items.product_id = Products.product_id
Order_Items.order_id = Orders.order_id
Orders.customer_id = Customers.customer_id
Shipment_Items.shipment_id = Shipments.shipment_id
Shipment_Items.order_item_id = Order_Items.order_item_id
Shipments.order_id = Orders.order_id
Shipments.invoice_number = Invoices.invoice_number
| TABLE customer_payment_methods (
customer_payment_methods.customer_id (INTEGER),
customer_payment_methods.payment_method_code (VARCHAR(10)),
)
TABLE customers (
customers.customer_id (INTEGER),
customers.gender_code (VARCHAR(1)),
customers.customer_first_name (VARCHAR(50)),
customers.customer_middle_initial (VARCHAR(1)),
customers.customer_last_name (VARCHAR(50)),
customers.email_address (VARCHAR(255)),
customers.login_name (VARCHAR(80)),
customers.login_password (VARCHAR(20)),
customers.phone_number (VARCHAR(255)),
customers.address_line_1 (VARCHAR(255)),
customers.town_city (VARCHAR(50)),
customers.county (VARCHAR(50)),
customers.country (VARCHAR(50)),
)
TABLE invoices (
invoices.invoice_number (INTEGER),
invoices.invoice_status_code (VARCHAR(10)),
invoices.invoice_date (DATETIME),
)
TABLE order_items (
order_items.order_item_id (INTEGER),
order_items.product_id (INTEGER),
order_items.order_id (INTEGER),
order_items.order_item_status_code (VARCHAR(10)),
)
TABLE orders (
orders.order_id (INTEGER),
orders.customer_id (INTEGER),
orders.order_status_code (VARCHAR(10)),
orders.date_order_placed (DATETIME),
)
TABLE products (
products.product_id (INTEGER),
products.parent_product_id (INTEGER),
products.product_name (VARCHAR(80)),
products.product_price (DECIMAL(19,4)),
products.product_color (VARCHAR(50)),
products.product_size (VARCHAR(50)),
products.product_description (VARCHAR(255)),
)
TABLE shipment_items (
shipment_items.shipment_id (INTEGER),
shipment_items.order_item_id (INTEGER),
)
TABLE shipments (
shipments.shipment_id (INTEGER),
shipments.order_id (INTEGER),
shipments.invoice_number (INTEGER),
shipments.shipment_tracking_number (VARCHAR(80)),
shipments.shipment_date (DATETIME),
)
Possible JOINs:
customer_payment_methods.customer_id = customers.customer_id
order_items.product_id = products.product_id
order_items.order_id = orders.order_id
orders.customer_id = customers.customer_id
shipment_items.shipment_id = shipments.shipment_id
shipment_items.order_item_id = order_items.order_item_id
shipments.order_id = orders.order_id
shipments.invoice_number = invoices.invoice_number
|
art_1 |
CREATE TABLE "Artists" (
"artistID" INTEGER,
lname TEXT,
fname TEXT,
"birthYear" INTEGER,
"deathYear" INTEGER,
PRIMARY KEY ("artistID")
)
CREATE TABLE "Paintings" (
"paintingID" INTEGER,
title TEXT,
year INTEGER,
height_mm INTEGER,
width_mm INTEGER,
medium TEXT,
"mediumOn" TEXT,
location TEXT,
"painterID" INTEGER,
PRIMARY KEY ("paintingID"),
FOREIGN KEY("painterID") REFERENCES "Artists" ("artistID")
)
CREATE TABLE "Sculptures" (
"sculptureID" INTEGER,
title TEXT,
year INTEGER,
medium TEXT,
location TEXT,
"sculptorID" INTEGER,
PRIMARY KEY ("sculptureID"),
FOREIGN KEY("sculptorID") REFERENCES "Artists" ("artistID")
) | What are the first and last names of the artists who have not only medium oil paintings but also paintings with the lithographic medium? | extra | Table Artists (
Artists.artistID (INTEGER),
Artists.lname (TEXT),
Artists.fname (TEXT),
Artists.birthYear (INTEGER),
Artists.deathYear (INTEGER),
)
Table Paintings (
Paintings.paintingID (INTEGER),
Paintings.title (TEXT),
Paintings.year (INTEGER),
Paintings.height_mm (INTEGER),
Paintings.width_mm (INTEGER),
Paintings.medium (TEXT),
Paintings.mediumOn (TEXT),
Paintings.location (TEXT),
Paintings.painterID (INTEGER),
)
Table Sculptures (
Sculptures.sculptureID (INTEGER),
Sculptures.title (TEXT),
Sculptures.year (INTEGER),
Sculptures.medium (TEXT),
Sculptures.location (TEXT),
Sculptures.sculptorID (INTEGER),
)
Possible JOINs:
Paintings.painterID = Artists.artistID
Sculptures.sculptorID = Artists.artistID
| SELECT artists.lname , artists.fname FROM artists JOIN paintings ON artists.artistID = paintings.painterID WHERE paintings.medium = "oil" INTERSECT SELECT artists.lname , artists.fname FROM artists JOIN paintings ON artists.artistID = paintings.painterID WHERE paintings.medium = "lithograph" | {
'artists': ['artistid', 'lname', 'fname'],
'paintings': ['paintingid', 'medium', 'painterid']
} | CREATE TABLE Artists (
Artists.artistID (INTEGER),
Artists.lname (TEXT),
Artists.fname (TEXT),
Artists.birthYear (INTEGER),
Artists.deathYear (INTEGER),
)
CREATE TABLE Paintings (
Paintings.paintingID (INTEGER),
Paintings.title (TEXT),
Paintings.year (INTEGER),
Paintings.height_mm (INTEGER),
Paintings.width_mm (INTEGER),
Paintings.medium (TEXT),
Paintings.mediumOn (TEXT),
Paintings.location (TEXT),
Paintings.painterID (INTEGER),
)
CREATE TABLE Sculptures (
Sculptures.sculptureID (INTEGER),
Sculptures.title (TEXT),
Sculptures.year (INTEGER),
Sculptures.medium (TEXT),
Sculptures.location (TEXT),
Sculptures.sculptorID (INTEGER),
)
Possible JOINs:
Paintings.painterID = Artists.artistID
Sculptures.sculptorID = Artists.artistID
| Table Artists (
Artists.artistid (INTEGER),
Artists.lname (TEXT),
Artists.fname (TEXT),
Artists.birthyear (INTEGER),
Artists.deathyear (INTEGER),
)
Table Paintings (
Paintings.paintingid (INTEGER),
Paintings.title (TEXT),
Paintings.year (INTEGER),
Paintings.height_mm (INTEGER),
Paintings.width_mm (INTEGER),
Paintings.medium (TEXT),
Paintings.mediumon (TEXT),
Paintings.location (TEXT),
Paintings.painterid (INTEGER),
)
Table Sculptures (
Sculptures.sculptureid (INTEGER),
Sculptures.title (TEXT),
Sculptures.year (INTEGER),
Sculptures.medium (TEXT),
Sculptures.location (TEXT),
Sculptures.sculptorid (INTEGER),
)
Possible JOINs:
Paintings.painterid = Artists.artistid
Sculptures.sculptorid = Artists.artistid
| CREATE TABLE Artists (
Artists.artistid (INTEGER),
Artists.lname (TEXT),
Artists.fname (TEXT),
Artists.birthyear (INTEGER),
Artists.deathyear (INTEGER),
)
CREATE TABLE Paintings (
Paintings.paintingid (INTEGER),
Paintings.title (TEXT),
Paintings.year (INTEGER),
Paintings.height_mm (INTEGER),
Paintings.width_mm (INTEGER),
Paintings.medium (TEXT),
Paintings.mediumon (TEXT),
Paintings.location (TEXT),
Paintings.painterid (INTEGER),
)
CREATE TABLE Sculptures (
Sculptures.sculptureid (INTEGER),
Sculptures.title (TEXT),
Sculptures.year (INTEGER),
Sculptures.medium (TEXT),
Sculptures.location (TEXT),
Sculptures.sculptorid (INTEGER),
)
Possible JOINs:
Paintings.painterid = Artists.artistid
Sculptures.sculptorid = Artists.artistid
| Table artists (
artists.artistid (INTEGER),
artists.lname (TEXT),
artists.fname (TEXT),
artists.birthyear (INTEGER),
artists.deathyear (INTEGER),
)
Table paintings (
paintings.paintingid (INTEGER),
paintings.title (TEXT),
paintings.year (INTEGER),
paintings.height_mm (INTEGER),
paintings.width_mm (INTEGER),
paintings.medium (TEXT),
paintings.mediumon (TEXT),
paintings.location (TEXT),
paintings.painterid (INTEGER),
)
Table sculptures (
sculptures.sculptureid (INTEGER),
sculptures.title (TEXT),
sculptures.year (INTEGER),
sculptures.medium (TEXT),
sculptures.location (TEXT),
sculptures.sculptorid (INTEGER),
)
Possible JOINs:
paintings.painterid = artists.artistid
sculptures.sculptorid = artists.artistid
| CREATE TABLE artists (
artists.artistid (INTEGER),
artists.lname (TEXT),
artists.fname (TEXT),
artists.birthyear (INTEGER),
artists.deathyear (INTEGER),
)
CREATE TABLE paintings (
paintings.paintingid (INTEGER),
paintings.title (TEXT),
paintings.year (INTEGER),
paintings.height_mm (INTEGER),
paintings.width_mm (INTEGER),
paintings.medium (TEXT),
paintings.mediumon (TEXT),
paintings.location (TEXT),
paintings.painterid (INTEGER),
)
CREATE TABLE sculptures (
sculptures.sculptureid (INTEGER),
sculptures.title (TEXT),
sculptures.year (INTEGER),
sculptures.medium (TEXT),
sculptures.location (TEXT),
sculptures.sculptorid (INTEGER),
)
Possible JOINs:
paintings.painterid = artists.artistid
sculptures.sculptorid = artists.artistid
| {
'Artists': ['artistID', 'lname', 'fname', 'birthYear', 'deathYear'],
'Paintings': ['paintingID', 'title', 'year', 'height_mm', 'width_mm', 'medium', 'mediumOn', 'location', 'painterID'],
'Sculptures': ['sculptureID', 'title', 'year', 'medium', 'location', 'sculptorID']
} | {
'Artists': ['artistID', 'lname', 'fname'],
'Paintings': ['paintingID', 'medium', 'painterID']
} | TABLE Artists (
Artists.artistID (INTEGER),
Artists.lname (TEXT),
Artists.fname (TEXT),
Artists.birthYear (INTEGER),
Artists.deathYear (INTEGER),
)
TABLE Paintings (
Paintings.paintingID (INTEGER),
Paintings.title (TEXT),
Paintings.year (INTEGER),
Paintings.height_mm (INTEGER),
Paintings.width_mm (INTEGER),
Paintings.medium (TEXT),
Paintings.mediumOn (TEXT),
Paintings.location (TEXT),
Paintings.painterID (INTEGER),
)
TABLE Sculptures (
Sculptures.sculptureID (INTEGER),
Sculptures.title (TEXT),
Sculptures.year (INTEGER),
Sculptures.medium (TEXT),
Sculptures.location (TEXT),
Sculptures.sculptorID (INTEGER),
)
Possible JOINs:
Paintings.painterID = Artists.artistID
Sculptures.sculptorID = Artists.artistID
| TABLE Artists (
Artists.artistid (INTEGER),
Artists.lname (TEXT),
Artists.fname (TEXT),
Artists.birthyear (INTEGER),
Artists.deathyear (INTEGER),
)
TABLE Paintings (
Paintings.paintingid (INTEGER),
Paintings.title (TEXT),
Paintings.year (INTEGER),
Paintings.height_mm (INTEGER),
Paintings.width_mm (INTEGER),
Paintings.medium (TEXT),
Paintings.mediumon (TEXT),
Paintings.location (TEXT),
Paintings.painterid (INTEGER),
)
TABLE Sculptures (
Sculptures.sculptureid (INTEGER),
Sculptures.title (TEXT),
Sculptures.year (INTEGER),
Sculptures.medium (TEXT),
Sculptures.location (TEXT),
Sculptures.sculptorid (INTEGER),
)
Possible JOINs:
Paintings.painterid = Artists.artistid
Sculptures.sculptorid = Artists.artistid
| TABLE artists (
artists.artistid (INTEGER),
artists.lname (TEXT),
artists.fname (TEXT),
artists.birthyear (INTEGER),
artists.deathyear (INTEGER),
)
TABLE paintings (
paintings.paintingid (INTEGER),
paintings.title (TEXT),
paintings.year (INTEGER),
paintings.height_mm (INTEGER),
paintings.width_mm (INTEGER),
paintings.medium (TEXT),
paintings.mediumon (TEXT),
paintings.location (TEXT),
paintings.painterid (INTEGER),
)
TABLE sculptures (
sculptures.sculptureid (INTEGER),
sculptures.title (TEXT),
sculptures.year (INTEGER),
sculptures.medium (TEXT),
sculptures.location (TEXT),
sculptures.sculptorid (INTEGER),
)
Possible JOINs:
paintings.painterid = artists.artistid
sculptures.sculptorid = artists.artistid
|
car_racing |
CREATE TABLE "country" (
"Country_Id" int,
"Country" text,
"Capital" text,
"Official_native_language" text,
"Regoin" text,
PRIMARY KEY ("Country_Id")
)
/*
0 rows from country table:
Country_Id Country Capital Official_native_language Regoin
*/
CREATE TABLE `team` (
"Team_ID" int,
"Team" text,
"Make" text,
"Manager" text,
"Sponsor" text,
"Car_Owner" text,
PRIMARY KEY ("Team_ID")
)
/*
0 rows from team table:
Team_ID Team Make Manager Sponsor Car_Owner
*/
CREATE TABLE `driver` (
"Driver_ID" int,
"Driver" text,
"Country" int,
"Age" int,
"Car_#" real,
"Make" text,
"Points" text,
"Laps" real,
"Winnings" text,
PRIMARY KEY ("Driver_ID"),
FOREIGN KEY (`Country`) REFERENCES `country`(`Country_ID`)
)
/*
0 rows from driver table:
Driver_ID Driver Country Age Car_# Make Points Laps Winnings
*/
CREATE TABLE `team_driver` (
"Team_ID" int,
"Driver_ID" int,
PRIMARY KEY ("Team_ID","Driver_ID"),
FOREIGN KEY (`Team_ID`) REFERENCES `team`(`Team_ID`),
FOREIGN KEY (`Driver_ID`) REFERENCES `driver`(`Driver_ID`)
)
/*
0 rows from team_driver table:
Team_ID Driver_ID
*/
| What are the managers and sponsors of teams? Sort the results by Car Owners. | medium | Table country (
country.Country_Id (INT),
country.Country (TEXT),
country.Capital (TEXT),
country.Official_native_language (TEXT),
country.Regoin (TEXT),
)
Table driver (
driver.Driver_ID (INT),
driver.Driver (TEXT),
driver.Country (INT),
driver.Age (INT),
driver.Car_# (REAL),
driver.Make (TEXT),
driver.Points (TEXT),
driver.Laps (REAL),
driver.Winnings (TEXT),
)
Table team (
team.Team_ID (INT),
team.Team (TEXT),
team.Make (TEXT),
team.Manager (TEXT),
team.Sponsor (TEXT),
team.Car_Owner (TEXT),
)
Table team_driver (
team_driver.Team_ID (INT),
team_driver.Driver_ID (INT),
)
Possible JOINs:
driver.Country = country.Country_ID
team_driver.Team_ID = team.Team_ID
team_driver.Driver_ID = driver.Driver_ID
| SELECT Manager , Sponsor FROM team ORDER BY Car_Owner | {
'team': ['team_id', 'team', 'manager', 'sponsor', 'car_owner']
} | CREATE TABLE country (
country.Country_Id (INT),
country.Country (TEXT),
country.Capital (TEXT),
country.Official_native_language (TEXT),
country.Regoin (TEXT),
)
CREATE TABLE driver (
driver.Driver_ID (INT),
driver.Driver (TEXT),
driver.Country (INT),
driver.Age (INT),
driver.Car_# (REAL),
driver.Make (TEXT),
driver.Points (TEXT),
driver.Laps (REAL),
driver.Winnings (TEXT),
)
CREATE TABLE team (
team.Team_ID (INT),
team.Team (TEXT),
team.Make (TEXT),
team.Manager (TEXT),
team.Sponsor (TEXT),
team.Car_Owner (TEXT),
)
CREATE TABLE team_driver (
team_driver.Team_ID (INT),
team_driver.Driver_ID (INT),
)
Possible JOINs:
driver.Country = country.Country_ID
team_driver.Team_ID = team.Team_ID
team_driver.Driver_ID = driver.Driver_ID
| Table country (
country.country_id (INT),
country.country (TEXT),
country.capital (TEXT),
country.official_native_language (TEXT),
country.regoin (TEXT),
)
Table driver (
driver.driver_id (INT),
driver.driver (TEXT),
driver.country (INT),
driver.age (INT),
driver.car_# (REAL),
driver.make (TEXT),
driver.points (TEXT),
driver.laps (REAL),
driver.winnings (TEXT),
)
Table team (
team.team_id (INT),
team.team (TEXT),
team.make (TEXT),
team.manager (TEXT),
team.sponsor (TEXT),
team.car_owner (TEXT),
)
Table team_driver (
team_driver.team_id (INT),
team_driver.driver_id (INT),
)
Possible JOINs:
driver.country = country.country_id
team_driver.team_id = team.team_id
team_driver.driver_id = driver.driver_id
| CREATE TABLE country (
country.country_id (INT),
country.country (TEXT),
country.capital (TEXT),
country.official_native_language (TEXT),
country.regoin (TEXT),
)
CREATE TABLE driver (
driver.driver_id (INT),
driver.driver (TEXT),
driver.country (INT),
driver.age (INT),
driver.car_# (REAL),
driver.make (TEXT),
driver.points (TEXT),
driver.laps (REAL),
driver.winnings (TEXT),
)
CREATE TABLE team (
team.team_id (INT),
team.team (TEXT),
team.make (TEXT),
team.manager (TEXT),
team.sponsor (TEXT),
team.car_owner (TEXT),
)
CREATE TABLE team_driver (
team_driver.team_id (INT),
team_driver.driver_id (INT),
)
Possible JOINs:
driver.country = country.country_id
team_driver.team_id = team.team_id
team_driver.driver_id = driver.driver_id
| Table country (
country.country_id (INT),
country.country (TEXT),
country.capital (TEXT),
country.official_native_language (TEXT),
country.regoin (TEXT),
)
Table driver (
driver.driver_id (INT),
driver.driver (TEXT),
driver.country (INT),
driver.age (INT),
driver.car_# (REAL),
driver.make (TEXT),
driver.points (TEXT),
driver.laps (REAL),
driver.winnings (TEXT),
)
Table team (
team.team_id (INT),
team.team (TEXT),
team.make (TEXT),
team.manager (TEXT),
team.sponsor (TEXT),
team.car_owner (TEXT),
)
Table team_driver (
team_driver.team_id (INT),
team_driver.driver_id (INT),
)
Possible JOINs:
driver.country = country.country_id
team_driver.team_id = team.team_id
team_driver.driver_id = driver.driver_id
| CREATE TABLE country (
country.country_id (INT),
country.country (TEXT),
country.capital (TEXT),
country.official_native_language (TEXT),
country.regoin (TEXT),
)
CREATE TABLE driver (
driver.driver_id (INT),
driver.driver (TEXT),
driver.country (INT),
driver.age (INT),
driver.car_# (REAL),
driver.make (TEXT),
driver.points (TEXT),
driver.laps (REAL),
driver.winnings (TEXT),
)
CREATE TABLE team (
team.team_id (INT),
team.team (TEXT),
team.make (TEXT),
team.manager (TEXT),
team.sponsor (TEXT),
team.car_owner (TEXT),
)
CREATE TABLE team_driver (
team_driver.team_id (INT),
team_driver.driver_id (INT),
)
Possible JOINs:
driver.country = country.country_id
team_driver.team_id = team.team_id
team_driver.driver_id = driver.driver_id
| {
'country': ['Country_Id', 'Country', 'Capital', 'Official_native_language', 'Regoin'],
'team': ['Team_ID', 'Team', 'Make', 'Manager', 'Sponsor', 'Car_Owner'],
'driver': ['Driver_ID', 'Driver', 'Country', 'Age', 'Car_#', 'Make', 'Points', 'Laps', 'Winnings'],
'team_driver': ['Team_ID', 'Driver_ID']
} | {
'team': ['Team_ID', 'Team', 'Manager', 'Sponsor', 'Car_Owner']
} | TABLE country (
country.Country_Id (INT),
country.Country (TEXT),
country.Capital (TEXT),
country.Official_native_language (TEXT),
country.Regoin (TEXT),
)
TABLE driver (
driver.Driver_ID (INT),
driver.Driver (TEXT),
driver.Country (INT),
driver.Age (INT),
driver.Car_# (REAL),
driver.Make (TEXT),
driver.Points (TEXT),
driver.Laps (REAL),
driver.Winnings (TEXT),
)
TABLE team (
team.Team_ID (INT),
team.Team (TEXT),
team.Make (TEXT),
team.Manager (TEXT),
team.Sponsor (TEXT),
team.Car_Owner (TEXT),
)
TABLE team_driver (
team_driver.Team_ID (INT),
team_driver.Driver_ID (INT),
)
Possible JOINs:
driver.Country = country.Country_ID
team_driver.Team_ID = team.Team_ID
team_driver.Driver_ID = driver.Driver_ID
| TABLE country (
country.country_id (INT),
country.country (TEXT),
country.capital (TEXT),
country.official_native_language (TEXT),
country.regoin (TEXT),
)
TABLE driver (
driver.driver_id (INT),
driver.driver (TEXT),
driver.country (INT),
driver.age (INT),
driver.car_# (REAL),
driver.make (TEXT),
driver.points (TEXT),
driver.laps (REAL),
driver.winnings (TEXT),
)
TABLE team (
team.team_id (INT),
team.team (TEXT),
team.make (TEXT),
team.manager (TEXT),
team.sponsor (TEXT),
team.car_owner (TEXT),
)
TABLE team_driver (
team_driver.team_id (INT),
team_driver.driver_id (INT),
)
Possible JOINs:
driver.country = country.country_id
team_driver.team_id = team.team_id
team_driver.driver_id = driver.driver_id
| TABLE country (
country.country_id (INT),
country.country (TEXT),
country.capital (TEXT),
country.official_native_language (TEXT),
country.regoin (TEXT),
)
TABLE driver (
driver.driver_id (INT),
driver.driver (TEXT),
driver.country (INT),
driver.age (INT),
driver.car_# (REAL),
driver.make (TEXT),
driver.points (TEXT),
driver.laps (REAL),
driver.winnings (TEXT),
)
TABLE team (
team.team_id (INT),
team.team (TEXT),
team.make (TEXT),
team.manager (TEXT),
team.sponsor (TEXT),
team.car_owner (TEXT),
)
TABLE team_driver (
team_driver.team_id (INT),
team_driver.driver_id (INT),
)
Possible JOINs:
driver.country = country.country_id
team_driver.team_id = team.team_id
team_driver.driver_id = driver.driver_id
|
book_press |
CREATE TABLE author (
"Author_ID" INTEGER,
"Name" TEXT,
"Age" INTEGER,
"Gender" TEXT,
PRIMARY KEY ("Author_ID")
)
CREATE TABLE book (
"Book_ID" INTEGER,
"Title" TEXT,
"Book_Series" TEXT,
"Author_ID" INTEGER,
"Press_ID" INTEGER,
"Sale_Amount" TEXT,
"Release_date" TEXT,
PRIMARY KEY ("Book_ID"),
FOREIGN KEY("Press_ID") REFERENCES press ("Press_ID"),
FOREIGN KEY("Author_ID") REFERENCES author ("Author_ID")
)
CREATE TABLE press (
"Press_ID" INTEGER,
"Name" TEXT,
"Month_Profits_billion" REAL,
"Year_Profits_billion" REAL,
PRIMARY KEY ("Press_ID")
) | Sorted all the press by year profits in descending order, and return press names. | easy | Table author (
author.Author_ID (INT),
author.Name (TEXT),
author.Age (INT),
author.Gender (TEXT),
)
Table book (
book.Book_ID (INT),
book.Title (TEXT),
book.Book_Series (TEXT),
book.Author_ID (INT),
book.Press_ID (INT),
book.Sale_Amount (TEXT),
book.Release_date (TEXT),
)
Table press (
press.Press_ID (INT),
press.Name (TEXT),
press.Month_Profits_billion (REAL),
press.Year_Profits_billion (REAL),
)
Possible JOINs:
book.Author_ID = author.Author_ID
book.Press_ID = press.Press_ID
| SELECT name FROM press ORDER BY Year_Profits_billion DESC | {
'press': ['press_id', 'name', 'year_profits_billion']
} | CREATE TABLE author (
author.Author_ID (INT),
author.Name (TEXT),
author.Age (INT),
author.Gender (TEXT),
)
CREATE TABLE book (
book.Book_ID (INT),
book.Title (TEXT),
book.Book_Series (TEXT),
book.Author_ID (INT),
book.Press_ID (INT),
book.Sale_Amount (TEXT),
book.Release_date (TEXT),
)
CREATE TABLE press (
press.Press_ID (INT),
press.Name (TEXT),
press.Month_Profits_billion (REAL),
press.Year_Profits_billion (REAL),
)
Possible JOINs:
book.Author_ID = author.Author_ID
book.Press_ID = press.Press_ID
| Table author (
author.author_id (INT),
author.name (TEXT),
author.age (INT),
author.gender (TEXT),
)
Table book (
book.book_id (INT),
book.title (TEXT),
book.book_series (TEXT),
book.author_id (INT),
book.press_id (INT),
book.sale_amount (TEXT),
book.release_date (TEXT),
)
Table press (
press.press_id (INT),
press.name (TEXT),
press.month_profits_billion (REAL),
press.year_profits_billion (REAL),
)
Possible JOINs:
book.author_id = author.author_id
book.press_id = press.press_id
| CREATE TABLE author (
author.author_id (INT),
author.name (TEXT),
author.age (INT),
author.gender (TEXT),
)
CREATE TABLE book (
book.book_id (INT),
book.title (TEXT),
book.book_series (TEXT),
book.author_id (INT),
book.press_id (INT),
book.sale_amount (TEXT),
book.release_date (TEXT),
)
CREATE TABLE press (
press.press_id (INT),
press.name (TEXT),
press.month_profits_billion (REAL),
press.year_profits_billion (REAL),
)
Possible JOINs:
book.author_id = author.author_id
book.press_id = press.press_id
| Table author (
author.author_id (INT),
author.name (TEXT),
author.age (INT),
author.gender (TEXT),
)
Table book (
book.book_id (INT),
book.title (TEXT),
book.book_series (TEXT),
book.author_id (INT),
book.press_id (INT),
book.sale_amount (TEXT),
book.release_date (TEXT),
)
Table press (
press.press_id (INT),
press.name (TEXT),
press.month_profits_billion (REAL),
press.year_profits_billion (REAL),
)
Possible JOINs:
book.author_id = author.author_id
book.press_id = press.press_id
| CREATE TABLE author (
author.author_id (INT),
author.name (TEXT),
author.age (INT),
author.gender (TEXT),
)
CREATE TABLE book (
book.book_id (INT),
book.title (TEXT),
book.book_series (TEXT),
book.author_id (INT),
book.press_id (INT),
book.sale_amount (TEXT),
book.release_date (TEXT),
)
CREATE TABLE press (
press.press_id (INT),
press.name (TEXT),
press.month_profits_billion (REAL),
press.year_profits_billion (REAL),
)
Possible JOINs:
book.author_id = author.author_id
book.press_id = press.press_id
| {
'author': ['Author_ID', 'Name', 'Age', 'Gender'],
'press': ['Press_ID', 'Name', 'Month_Profits_billion', 'Year_Profits_billion'],
'book': ['Book_ID', 'Title', 'Book_Series', 'Author_ID', 'Press_ID', 'Sale_Amount', 'Release_date']
} | {
'press': ['Press_ID', 'Name', 'Year_Profits_billion']
} | TABLE author (
author.Author_ID (INT),
author.Name (TEXT),
author.Age (INT),
author.Gender (TEXT),
)
TABLE book (
book.Book_ID (INT),
book.Title (TEXT),
book.Book_Series (TEXT),
book.Author_ID (INT),
book.Press_ID (INT),
book.Sale_Amount (TEXT),
book.Release_date (TEXT),
)
TABLE press (
press.Press_ID (INT),
press.Name (TEXT),
press.Month_Profits_billion (REAL),
press.Year_Profits_billion (REAL),
)
Possible JOINs:
book.Author_ID = author.Author_ID
book.Press_ID = press.Press_ID
| TABLE author (
author.author_id (INT),
author.name (TEXT),
author.age (INT),
author.gender (TEXT),
)
TABLE book (
book.book_id (INT),
book.title (TEXT),
book.book_series (TEXT),
book.author_id (INT),
book.press_id (INT),
book.sale_amount (TEXT),
book.release_date (TEXT),
)
TABLE press (
press.press_id (INT),
press.name (TEXT),
press.month_profits_billion (REAL),
press.year_profits_billion (REAL),
)
Possible JOINs:
book.author_id = author.author_id
book.press_id = press.press_id
| TABLE author (
author.author_id (INT),
author.name (TEXT),
author.age (INT),
author.gender (TEXT),
)
TABLE book (
book.book_id (INT),
book.title (TEXT),
book.book_series (TEXT),
book.author_id (INT),
book.press_id (INT),
book.sale_amount (TEXT),
book.release_date (TEXT),
)
TABLE press (
press.press_id (INT),
press.name (TEXT),
press.month_profits_billion (REAL),
press.year_profits_billion (REAL),
)
Possible JOINs:
book.author_id = author.author_id
book.press_id = press.press_id
|
vehicle_driver |
CREATE TABLE driver (
"Driver_ID" INTEGER,
"Name" TEXT,
"Citizenship" TEXT,
"Racing_Series" TEXT,
PRIMARY KEY ("Driver_ID")
)
CREATE TABLE vehicle (
"Vehicle_ID" INTEGER,
"Model" TEXT,
"Build_Year" TEXT,
"Top_Speed" INTEGER,
"Power" INTEGER,
"Builder" TEXT,
"Total_Production" TEXT,
PRIMARY KEY ("Vehicle_ID")
)
CREATE TABLE vehicle_driver (
"Driver_ID" INTEGER,
"Vehicle_ID" INTEGER,
PRIMARY KEY ("Driver_ID", "Vehicle_ID"),
FOREIGN KEY("Driver_ID") REFERENCES driver ("Driver_ID"),
FOREIGN KEY("Vehicle_ID") REFERENCES vehicle ("Vehicle_ID")
) | How many drivers have raced in 'NASCAR'? | easy | Table driver (
driver.Driver_ID (INT),
driver.Name (TEXT),
driver.Citizenship (TEXT),
driver.Racing_Series (TEXT),
)
Table vehicle (
vehicle.Vehicle_ID (INT),
vehicle.Model (TEXT),
vehicle.Build_Year (TEXT),
vehicle.Top_Speed (INT),
vehicle.Power (INT),
vehicle.Builder (TEXT),
vehicle.Total_Production (TEXT),
)
Table vehicle_driver (
vehicle_driver.Driver_ID (INT),
vehicle_driver.Vehicle_ID (INT),
)
Possible JOINs:
vehicle_driver.Driver_ID = driver.Driver_ID
vehicle_driver.Vehicle_ID = vehicle.Vehicle_ID
| SELECT count(*) FROM driver WHERE Racing_Series = 'NASCAR' | {
'driver': ['driver_id', 'racing_series']
} | CREATE TABLE driver (
driver.Driver_ID (INT),
driver.Name (TEXT),
driver.Citizenship (TEXT),
driver.Racing_Series (TEXT),
)
CREATE TABLE vehicle (
vehicle.Vehicle_ID (INT),
vehicle.Model (TEXT),
vehicle.Build_Year (TEXT),
vehicle.Top_Speed (INT),
vehicle.Power (INT),
vehicle.Builder (TEXT),
vehicle.Total_Production (TEXT),
)
CREATE TABLE vehicle_driver (
vehicle_driver.Driver_ID (INT),
vehicle_driver.Vehicle_ID (INT),
)
Possible JOINs:
vehicle_driver.Driver_ID = driver.Driver_ID
vehicle_driver.Vehicle_ID = vehicle.Vehicle_ID
| Table driver (
driver.driver_id (INT),
driver.name (TEXT),
driver.citizenship (TEXT),
driver.racing_series (TEXT),
)
Table vehicle (
vehicle.vehicle_id (INT),
vehicle.model (TEXT),
vehicle.build_year (TEXT),
vehicle.top_speed (INT),
vehicle.power (INT),
vehicle.builder (TEXT),
vehicle.total_production (TEXT),
)
Table vehicle_driver (
vehicle_driver.driver_id (INT),
vehicle_driver.vehicle_id (INT),
)
Possible JOINs:
vehicle_driver.driver_id = driver.driver_id
vehicle_driver.vehicle_id = vehicle.vehicle_id
| CREATE TABLE driver (
driver.driver_id (INT),
driver.name (TEXT),
driver.citizenship (TEXT),
driver.racing_series (TEXT),
)
CREATE TABLE vehicle (
vehicle.vehicle_id (INT),
vehicle.model (TEXT),
vehicle.build_year (TEXT),
vehicle.top_speed (INT),
vehicle.power (INT),
vehicle.builder (TEXT),
vehicle.total_production (TEXT),
)
CREATE TABLE vehicle_driver (
vehicle_driver.driver_id (INT),
vehicle_driver.vehicle_id (INT),
)
Possible JOINs:
vehicle_driver.driver_id = driver.driver_id
vehicle_driver.vehicle_id = vehicle.vehicle_id
| Table driver (
driver.driver_id (INT),
driver.name (TEXT),
driver.citizenship (TEXT),
driver.racing_series (TEXT),
)
Table vehicle (
vehicle.vehicle_id (INT),
vehicle.model (TEXT),
vehicle.build_year (TEXT),
vehicle.top_speed (INT),
vehicle.power (INT),
vehicle.builder (TEXT),
vehicle.total_production (TEXT),
)
Table vehicle_driver (
vehicle_driver.driver_id (INT),
vehicle_driver.vehicle_id (INT),
)
Possible JOINs:
vehicle_driver.driver_id = driver.driver_id
vehicle_driver.vehicle_id = vehicle.vehicle_id
| CREATE TABLE driver (
driver.driver_id (INT),
driver.name (TEXT),
driver.citizenship (TEXT),
driver.racing_series (TEXT),
)
CREATE TABLE vehicle (
vehicle.vehicle_id (INT),
vehicle.model (TEXT),
vehicle.build_year (TEXT),
vehicle.top_speed (INT),
vehicle.power (INT),
vehicle.builder (TEXT),
vehicle.total_production (TEXT),
)
CREATE TABLE vehicle_driver (
vehicle_driver.driver_id (INT),
vehicle_driver.vehicle_id (INT),
)
Possible JOINs:
vehicle_driver.driver_id = driver.driver_id
vehicle_driver.vehicle_id = vehicle.vehicle_id
| {
'vehicle': ['Vehicle_ID', 'Model', 'Build_Year', 'Top_Speed', 'Power', 'Builder', 'Total_Production'],
'driver': ['Driver_ID', 'Name', 'Citizenship', 'Racing_Series'],
'vehicle_driver': ['Driver_ID', 'Vehicle_ID']
} | {
'driver': ['Driver_ID', 'Racing_Series']
} | TABLE driver (
driver.Driver_ID (INT),
driver.Name (TEXT),
driver.Citizenship (TEXT),
driver.Racing_Series (TEXT),
)
TABLE vehicle (
vehicle.Vehicle_ID (INT),
vehicle.Model (TEXT),
vehicle.Build_Year (TEXT),
vehicle.Top_Speed (INT),
vehicle.Power (INT),
vehicle.Builder (TEXT),
vehicle.Total_Production (TEXT),
)
TABLE vehicle_driver (
vehicle_driver.Driver_ID (INT),
vehicle_driver.Vehicle_ID (INT),
)
Possible JOINs:
vehicle_driver.Driver_ID = driver.Driver_ID
vehicle_driver.Vehicle_ID = vehicle.Vehicle_ID
| TABLE driver (
driver.driver_id (INT),
driver.name (TEXT),
driver.citizenship (TEXT),
driver.racing_series (TEXT),
)
TABLE vehicle (
vehicle.vehicle_id (INT),
vehicle.model (TEXT),
vehicle.build_year (TEXT),
vehicle.top_speed (INT),
vehicle.power (INT),
vehicle.builder (TEXT),
vehicle.total_production (TEXT),
)
TABLE vehicle_driver (
vehicle_driver.driver_id (INT),
vehicle_driver.vehicle_id (INT),
)
Possible JOINs:
vehicle_driver.driver_id = driver.driver_id
vehicle_driver.vehicle_id = vehicle.vehicle_id
| TABLE driver (
driver.driver_id (INT),
driver.name (TEXT),
driver.citizenship (TEXT),
driver.racing_series (TEXT),
)
TABLE vehicle (
vehicle.vehicle_id (INT),
vehicle.model (TEXT),
vehicle.build_year (TEXT),
vehicle.top_speed (INT),
vehicle.power (INT),
vehicle.builder (TEXT),
vehicle.total_production (TEXT),
)
TABLE vehicle_driver (
vehicle_driver.driver_id (INT),
vehicle_driver.vehicle_id (INT),
)
Possible JOINs:
vehicle_driver.driver_id = driver.driver_id
vehicle_driver.vehicle_id = vehicle.vehicle_id
|
region_building |
CREATE TABLE building (
"Building_ID" INTEGER,
"Region_ID" INTEGER,
"Name" TEXT,
"Address" TEXT,
"Number_of_Stories" INTEGER,
"Completed_Year" INTEGER,
PRIMARY KEY ("Building_ID"),
FOREIGN KEY("Region_ID") REFERENCES region ("Region_ID")
)
CREATE TABLE region (
"Region_ID" INTEGER,
"Name" TEXT,
"Capital" TEXT,
"Area" INTEGER,
"Population" INTEGER,
PRIMARY KEY ("Region_ID")
) | Give me a list of distinct building addresses. | easy | Table building (
building.Building_ID (INT),
building.Region_ID (INT),
building.Name (TEXT),
building.Address (TEXT),
building.Number_of_Stories (INT),
building.Completed_Year (INT),
)
Table region (
region.Region_ID (INT),
region.Name (TEXT),
region.Capital (TEXT),
region.Area (INT),
region.Population (INT),
)
Possible JOINs:
building.Region_ID = region.Region_ID
| SELECT DISTINCT Address FROM building | {
'building': ['building_id', 'address']
} | CREATE TABLE building (
building.Building_ID (INT),
building.Region_ID (INT),
building.Name (TEXT),
building.Address (TEXT),
building.Number_of_Stories (INT),
building.Completed_Year (INT),
)
CREATE TABLE region (
region.Region_ID (INT),
region.Name (TEXT),
region.Capital (TEXT),
region.Area (INT),
region.Population (INT),
)
Possible JOINs:
building.Region_ID = region.Region_ID
| Table building (
building.building_id (INT),
building.region_id (INT),
building.name (TEXT),
building.address (TEXT),
building.number_of_stories (INT),
building.completed_year (INT),
)
Table region (
region.region_id (INT),
region.name (TEXT),
region.capital (TEXT),
region.area (INT),
region.population (INT),
)
Possible JOINs:
building.region_id = region.region_id
| CREATE TABLE building (
building.building_id (INT),
building.region_id (INT),
building.name (TEXT),
building.address (TEXT),
building.number_of_stories (INT),
building.completed_year (INT),
)
CREATE TABLE region (
region.region_id (INT),
region.name (TEXT),
region.capital (TEXT),
region.area (INT),
region.population (INT),
)
Possible JOINs:
building.region_id = region.region_id
| Table building (
building.building_id (INT),
building.region_id (INT),
building.name (TEXT),
building.address (TEXT),
building.number_of_stories (INT),
building.completed_year (INT),
)
Table region (
region.region_id (INT),
region.name (TEXT),
region.capital (TEXT),
region.area (INT),
region.population (INT),
)
Possible JOINs:
building.region_id = region.region_id
| CREATE TABLE building (
building.building_id (INT),
building.region_id (INT),
building.name (TEXT),
building.address (TEXT),
building.number_of_stories (INT),
building.completed_year (INT),
)
CREATE TABLE region (
region.region_id (INT),
region.name (TEXT),
region.capital (TEXT),
region.area (INT),
region.population (INT),
)
Possible JOINs:
building.region_id = region.region_id
| {
'building': ['Building_ID', 'Region_ID', 'Name', 'Address', 'Number_of_Stories', 'Completed_Year'],
'region': ['Region_ID', 'Name', 'Capital', 'Area', 'Population']
} | {
'building': ['Building_ID', 'Address']
} | TABLE building (
building.Building_ID (INT),
building.Region_ID (INT),
building.Name (TEXT),
building.Address (TEXT),
building.Number_of_Stories (INT),
building.Completed_Year (INT),
)
TABLE region (
region.Region_ID (INT),
region.Name (TEXT),
region.Capital (TEXT),
region.Area (INT),
region.Population (INT),
)
Possible JOINs:
building.Region_ID = region.Region_ID
| TABLE building (
building.building_id (INT),
building.region_id (INT),
building.name (TEXT),
building.address (TEXT),
building.number_of_stories (INT),
building.completed_year (INT),
)
TABLE region (
region.region_id (INT),
region.name (TEXT),
region.capital (TEXT),
region.area (INT),
region.population (INT),
)
Possible JOINs:
building.region_id = region.region_id
| TABLE building (
building.building_id (INT),
building.region_id (INT),
building.name (TEXT),
building.address (TEXT),
building.number_of_stories (INT),
building.completed_year (INT),
)
TABLE region (
region.region_id (INT),
region.name (TEXT),
region.capital (TEXT),
region.area (INT),
region.population (INT),
)
Possible JOINs:
building.region_id = region.region_id
|
vehicle_driver |
CREATE TABLE driver (
"Driver_ID" INTEGER,
"Name" TEXT,
"Citizenship" TEXT,
"Racing_Series" TEXT,
PRIMARY KEY ("Driver_ID")
)
CREATE TABLE vehicle (
"Vehicle_ID" INTEGER,
"Model" TEXT,
"Build_Year" TEXT,
"Top_Speed" INTEGER,
"Power" INTEGER,
"Builder" TEXT,
"Total_Production" TEXT,
PRIMARY KEY ("Vehicle_ID")
)
CREATE TABLE vehicle_driver (
"Driver_ID" INTEGER,
"Vehicle_ID" INTEGER,
PRIMARY KEY ("Driver_ID", "Vehicle_ID"),
FOREIGN KEY("Driver_ID") REFERENCES driver ("Driver_ID"),
FOREIGN KEY("Vehicle_ID") REFERENCES vehicle ("Vehicle_ID")
) | What are the name and citizenship of the drivers who have driven the vehicle model 'DJ1'? | hard | Table driver (
driver.Driver_ID (INT),
driver.Name (TEXT),
driver.Citizenship (TEXT),
driver.Racing_Series (TEXT),
)
Table vehicle (
vehicle.Vehicle_ID (INT),
vehicle.Model (TEXT),
vehicle.Build_Year (TEXT),
vehicle.Top_Speed (INT),
vehicle.Power (INT),
vehicle.Builder (TEXT),
vehicle.Total_Production (TEXT),
)
Table vehicle_driver (
vehicle_driver.Driver_ID (INT),
vehicle_driver.Vehicle_ID (INT),
)
Possible JOINs:
vehicle_driver.Driver_ID = driver.Driver_ID
vehicle_driver.Vehicle_ID = vehicle.Vehicle_ID
| SELECT driver.name , driver.citizenship FROM driver JOIN vehicle_driver ON driver.driver_id = vehicle_driver.driver_id JOIN vehicle ON vehicle_driver.vehicle_id = vehicle.vehicle_id WHERE vehicle.model = 'DJ1' | {
'driver': ['driver_id', 'name', 'citizenship'],
'vehicle_driver': ['driver_id', 'vehicle_id'],
'vehicle': ['vehicle_id', 'model']
} | CREATE TABLE driver (
driver.Driver_ID (INT),
driver.Name (TEXT),
driver.Citizenship (TEXT),
driver.Racing_Series (TEXT),
)
CREATE TABLE vehicle (
vehicle.Vehicle_ID (INT),
vehicle.Model (TEXT),
vehicle.Build_Year (TEXT),
vehicle.Top_Speed (INT),
vehicle.Power (INT),
vehicle.Builder (TEXT),
vehicle.Total_Production (TEXT),
)
CREATE TABLE vehicle_driver (
vehicle_driver.Driver_ID (INT),
vehicle_driver.Vehicle_ID (INT),
)
Possible JOINs:
vehicle_driver.Driver_ID = driver.Driver_ID
vehicle_driver.Vehicle_ID = vehicle.Vehicle_ID
| Table driver (
driver.driver_id (INT),
driver.name (TEXT),
driver.citizenship (TEXT),
driver.racing_series (TEXT),
)
Table vehicle (
vehicle.vehicle_id (INT),
vehicle.model (TEXT),
vehicle.build_year (TEXT),
vehicle.top_speed (INT),
vehicle.power (INT),
vehicle.builder (TEXT),
vehicle.total_production (TEXT),
)
Table vehicle_driver (
vehicle_driver.driver_id (INT),
vehicle_driver.vehicle_id (INT),
)
Possible JOINs:
vehicle_driver.driver_id = driver.driver_id
vehicle_driver.vehicle_id = vehicle.vehicle_id
| CREATE TABLE driver (
driver.driver_id (INT),
driver.name (TEXT),
driver.citizenship (TEXT),
driver.racing_series (TEXT),
)
CREATE TABLE vehicle (
vehicle.vehicle_id (INT),
vehicle.model (TEXT),
vehicle.build_year (TEXT),
vehicle.top_speed (INT),
vehicle.power (INT),
vehicle.builder (TEXT),
vehicle.total_production (TEXT),
)
CREATE TABLE vehicle_driver (
vehicle_driver.driver_id (INT),
vehicle_driver.vehicle_id (INT),
)
Possible JOINs:
vehicle_driver.driver_id = driver.driver_id
vehicle_driver.vehicle_id = vehicle.vehicle_id
| Table driver (
driver.driver_id (INT),
driver.name (TEXT),
driver.citizenship (TEXT),
driver.racing_series (TEXT),
)
Table vehicle (
vehicle.vehicle_id (INT),
vehicle.model (TEXT),
vehicle.build_year (TEXT),
vehicle.top_speed (INT),
vehicle.power (INT),
vehicle.builder (TEXT),
vehicle.total_production (TEXT),
)
Table vehicle_driver (
vehicle_driver.driver_id (INT),
vehicle_driver.vehicle_id (INT),
)
Possible JOINs:
vehicle_driver.driver_id = driver.driver_id
vehicle_driver.vehicle_id = vehicle.vehicle_id
| CREATE TABLE driver (
driver.driver_id (INT),
driver.name (TEXT),
driver.citizenship (TEXT),
driver.racing_series (TEXT),
)
CREATE TABLE vehicle (
vehicle.vehicle_id (INT),
vehicle.model (TEXT),
vehicle.build_year (TEXT),
vehicle.top_speed (INT),
vehicle.power (INT),
vehicle.builder (TEXT),
vehicle.total_production (TEXT),
)
CREATE TABLE vehicle_driver (
vehicle_driver.driver_id (INT),
vehicle_driver.vehicle_id (INT),
)
Possible JOINs:
vehicle_driver.driver_id = driver.driver_id
vehicle_driver.vehicle_id = vehicle.vehicle_id
| {
'vehicle': ['Vehicle_ID', 'Model', 'Build_Year', 'Top_Speed', 'Power', 'Builder', 'Total_Production'],
'driver': ['Driver_ID', 'Name', 'Citizenship', 'Racing_Series'],
'vehicle_driver': ['Driver_ID', 'Vehicle_ID']
} | {
'driver': ['Driver_ID', 'Name', 'Citizenship'],
'vehicle_driver': ['Driver_ID', 'Vehicle_ID'],
'vehicle': ['Vehicle_ID', 'Model']
} | TABLE driver (
driver.Driver_ID (INT),
driver.Name (TEXT),
driver.Citizenship (TEXT),
driver.Racing_Series (TEXT),
)
TABLE vehicle (
vehicle.Vehicle_ID (INT),
vehicle.Model (TEXT),
vehicle.Build_Year (TEXT),
vehicle.Top_Speed (INT),
vehicle.Power (INT),
vehicle.Builder (TEXT),
vehicle.Total_Production (TEXT),
)
TABLE vehicle_driver (
vehicle_driver.Driver_ID (INT),
vehicle_driver.Vehicle_ID (INT),
)
Possible JOINs:
vehicle_driver.Driver_ID = driver.Driver_ID
vehicle_driver.Vehicle_ID = vehicle.Vehicle_ID
| TABLE driver (
driver.driver_id (INT),
driver.name (TEXT),
driver.citizenship (TEXT),
driver.racing_series (TEXT),
)
TABLE vehicle (
vehicle.vehicle_id (INT),
vehicle.model (TEXT),
vehicle.build_year (TEXT),
vehicle.top_speed (INT),
vehicle.power (INT),
vehicle.builder (TEXT),
vehicle.total_production (TEXT),
)
TABLE vehicle_driver (
vehicle_driver.driver_id (INT),
vehicle_driver.vehicle_id (INT),
)
Possible JOINs:
vehicle_driver.driver_id = driver.driver_id
vehicle_driver.vehicle_id = vehicle.vehicle_id
| TABLE driver (
driver.driver_id (INT),
driver.name (TEXT),
driver.citizenship (TEXT),
driver.racing_series (TEXT),
)
TABLE vehicle (
vehicle.vehicle_id (INT),
vehicle.model (TEXT),
vehicle.build_year (TEXT),
vehicle.top_speed (INT),
vehicle.power (INT),
vehicle.builder (TEXT),
vehicle.total_production (TEXT),
)
TABLE vehicle_driver (
vehicle_driver.driver_id (INT),
vehicle_driver.vehicle_id (INT),
)
Possible JOINs:
vehicle_driver.driver_id = driver.driver_id
vehicle_driver.vehicle_id = vehicle.vehicle_id
|
car_racing |
CREATE TABLE "country" (
"Country_Id" int,
"Country" text,
"Capital" text,
"Official_native_language" text,
"Regoin" text,
PRIMARY KEY ("Country_Id")
)
/*
0 rows from country table:
Country_Id Country Capital Official_native_language Regoin
*/
CREATE TABLE `team` (
"Team_ID" int,
"Team" text,
"Make" text,
"Manager" text,
"Sponsor" text,
"Car_Owner" text,
PRIMARY KEY ("Team_ID")
)
/*
0 rows from team table:
Team_ID Team Make Manager Sponsor Car_Owner
*/
CREATE TABLE `driver` (
"Driver_ID" int,
"Driver" text,
"Country" int,
"Age" int,
"Car_#" real,
"Make" text,
"Points" text,
"Laps" real,
"Winnings" text,
PRIMARY KEY ("Driver_ID"),
FOREIGN KEY (`Country`) REFERENCES `country`(`Country_ID`)
)
/*
0 rows from driver table:
Driver_ID Driver Country Age Car_# Make Points Laps Winnings
*/
CREATE TABLE `team_driver` (
"Team_ID" int,
"Driver_ID" int,
PRIMARY KEY ("Team_ID","Driver_ID"),
FOREIGN KEY (`Team_ID`) REFERENCES `team`(`Team_ID`),
FOREIGN KEY (`Driver_ID`) REFERENCES `driver`(`Driver_ID`)
)
/*
0 rows from team_driver table:
Team_ID Driver_ID
*/
| Find the countries where no driver come from. | hard | Table country (
country.Country_Id (INT),
country.Country (TEXT),
country.Capital (TEXT),
country.Official_native_language (TEXT),
country.Regoin (TEXT),
)
Table driver (
driver.Driver_ID (INT),
driver.Driver (TEXT),
driver.Country (INT),
driver.Age (INT),
driver.Car_# (REAL),
driver.Make (TEXT),
driver.Points (TEXT),
driver.Laps (REAL),
driver.Winnings (TEXT),
)
Table team (
team.Team_ID (INT),
team.Team (TEXT),
team.Make (TEXT),
team.Manager (TEXT),
team.Sponsor (TEXT),
team.Car_Owner (TEXT),
)
Table team_driver (
team_driver.Team_ID (INT),
team_driver.Driver_ID (INT),
)
Possible JOINs:
driver.Country = country.Country_ID
team_driver.Team_ID = team.Team_ID
team_driver.Driver_ID = driver.Driver_ID
| SELECT country FROM country WHERE country_id NOT IN (SELECT country FROM driver) | {
'country': ['country_id', 'country'],
'driver': ['driver_id', 'driver', 'country']
} | CREATE TABLE country (
country.Country_Id (INT),
country.Country (TEXT),
country.Capital (TEXT),
country.Official_native_language (TEXT),
country.Regoin (TEXT),
)
CREATE TABLE driver (
driver.Driver_ID (INT),
driver.Driver (TEXT),
driver.Country (INT),
driver.Age (INT),
driver.Car_# (REAL),
driver.Make (TEXT),
driver.Points (TEXT),
driver.Laps (REAL),
driver.Winnings (TEXT),
)
CREATE TABLE team (
team.Team_ID (INT),
team.Team (TEXT),
team.Make (TEXT),
team.Manager (TEXT),
team.Sponsor (TEXT),
team.Car_Owner (TEXT),
)
CREATE TABLE team_driver (
team_driver.Team_ID (INT),
team_driver.Driver_ID (INT),
)
Possible JOINs:
driver.Country = country.Country_ID
team_driver.Team_ID = team.Team_ID
team_driver.Driver_ID = driver.Driver_ID
| Table country (
country.country_id (INT),
country.country (TEXT),
country.capital (TEXT),
country.official_native_language (TEXT),
country.regoin (TEXT),
)
Table driver (
driver.driver_id (INT),
driver.driver (TEXT),
driver.country (INT),
driver.age (INT),
driver.car_# (REAL),
driver.make (TEXT),
driver.points (TEXT),
driver.laps (REAL),
driver.winnings (TEXT),
)
Table team (
team.team_id (INT),
team.team (TEXT),
team.make (TEXT),
team.manager (TEXT),
team.sponsor (TEXT),
team.car_owner (TEXT),
)
Table team_driver (
team_driver.team_id (INT),
team_driver.driver_id (INT),
)
Possible JOINs:
driver.country = country.country_id
team_driver.team_id = team.team_id
team_driver.driver_id = driver.driver_id
| CREATE TABLE country (
country.country_id (INT),
country.country (TEXT),
country.capital (TEXT),
country.official_native_language (TEXT),
country.regoin (TEXT),
)
CREATE TABLE driver (
driver.driver_id (INT),
driver.driver (TEXT),
driver.country (INT),
driver.age (INT),
driver.car_# (REAL),
driver.make (TEXT),
driver.points (TEXT),
driver.laps (REAL),
driver.winnings (TEXT),
)
CREATE TABLE team (
team.team_id (INT),
team.team (TEXT),
team.make (TEXT),
team.manager (TEXT),
team.sponsor (TEXT),
team.car_owner (TEXT),
)
CREATE TABLE team_driver (
team_driver.team_id (INT),
team_driver.driver_id (INT),
)
Possible JOINs:
driver.country = country.country_id
team_driver.team_id = team.team_id
team_driver.driver_id = driver.driver_id
| Table country (
country.country_id (INT),
country.country (TEXT),
country.capital (TEXT),
country.official_native_language (TEXT),
country.regoin (TEXT),
)
Table driver (
driver.driver_id (INT),
driver.driver (TEXT),
driver.country (INT),
driver.age (INT),
driver.car_# (REAL),
driver.make (TEXT),
driver.points (TEXT),
driver.laps (REAL),
driver.winnings (TEXT),
)
Table team (
team.team_id (INT),
team.team (TEXT),
team.make (TEXT),
team.manager (TEXT),
team.sponsor (TEXT),
team.car_owner (TEXT),
)
Table team_driver (
team_driver.team_id (INT),
team_driver.driver_id (INT),
)
Possible JOINs:
driver.country = country.country_id
team_driver.team_id = team.team_id
team_driver.driver_id = driver.driver_id
| CREATE TABLE country (
country.country_id (INT),
country.country (TEXT),
country.capital (TEXT),
country.official_native_language (TEXT),
country.regoin (TEXT),
)
CREATE TABLE driver (
driver.driver_id (INT),
driver.driver (TEXT),
driver.country (INT),
driver.age (INT),
driver.car_# (REAL),
driver.make (TEXT),
driver.points (TEXT),
driver.laps (REAL),
driver.winnings (TEXT),
)
CREATE TABLE team (
team.team_id (INT),
team.team (TEXT),
team.make (TEXT),
team.manager (TEXT),
team.sponsor (TEXT),
team.car_owner (TEXT),
)
CREATE TABLE team_driver (
team_driver.team_id (INT),
team_driver.driver_id (INT),
)
Possible JOINs:
driver.country = country.country_id
team_driver.team_id = team.team_id
team_driver.driver_id = driver.driver_id
| {
'country': ['Country_Id', 'Country', 'Capital', 'Official_native_language', 'Regoin'],
'team': ['Team_ID', 'Team', 'Make', 'Manager', 'Sponsor', 'Car_Owner'],
'driver': ['Driver_ID', 'Driver', 'Country', 'Age', 'Car_#', 'Make', 'Points', 'Laps', 'Winnings'],
'team_driver': ['Team_ID', 'Driver_ID']
} | {
'country': ['Country_Id', 'Country'],
'driver': ['Driver_ID', 'Driver', 'Country']
} | TABLE country (
country.Country_Id (INT),
country.Country (TEXT),
country.Capital (TEXT),
country.Official_native_language (TEXT),
country.Regoin (TEXT),
)
TABLE driver (
driver.Driver_ID (INT),
driver.Driver (TEXT),
driver.Country (INT),
driver.Age (INT),
driver.Car_# (REAL),
driver.Make (TEXT),
driver.Points (TEXT),
driver.Laps (REAL),
driver.Winnings (TEXT),
)
TABLE team (
team.Team_ID (INT),
team.Team (TEXT),
team.Make (TEXT),
team.Manager (TEXT),
team.Sponsor (TEXT),
team.Car_Owner (TEXT),
)
TABLE team_driver (
team_driver.Team_ID (INT),
team_driver.Driver_ID (INT),
)
Possible JOINs:
driver.Country = country.Country_ID
team_driver.Team_ID = team.Team_ID
team_driver.Driver_ID = driver.Driver_ID
| TABLE country (
country.country_id (INT),
country.country (TEXT),
country.capital (TEXT),
country.official_native_language (TEXT),
country.regoin (TEXT),
)
TABLE driver (
driver.driver_id (INT),
driver.driver (TEXT),
driver.country (INT),
driver.age (INT),
driver.car_# (REAL),
driver.make (TEXT),
driver.points (TEXT),
driver.laps (REAL),
driver.winnings (TEXT),
)
TABLE team (
team.team_id (INT),
team.team (TEXT),
team.make (TEXT),
team.manager (TEXT),
team.sponsor (TEXT),
team.car_owner (TEXT),
)
TABLE team_driver (
team_driver.team_id (INT),
team_driver.driver_id (INT),
)
Possible JOINs:
driver.country = country.country_id
team_driver.team_id = team.team_id
team_driver.driver_id = driver.driver_id
| TABLE country (
country.country_id (INT),
country.country (TEXT),
country.capital (TEXT),
country.official_native_language (TEXT),
country.regoin (TEXT),
)
TABLE driver (
driver.driver_id (INT),
driver.driver (TEXT),
driver.country (INT),
driver.age (INT),
driver.car_# (REAL),
driver.make (TEXT),
driver.points (TEXT),
driver.laps (REAL),
driver.winnings (TEXT),
)
TABLE team (
team.team_id (INT),
team.team (TEXT),
team.make (TEXT),
team.manager (TEXT),
team.sponsor (TEXT),
team.car_owner (TEXT),
)
TABLE team_driver (
team_driver.team_id (INT),
team_driver.driver_id (INT),
)
Possible JOINs:
driver.country = country.country_id
team_driver.team_id = team.team_id
team_driver.driver_id = driver.driver_id
|
warehouse_1 |
CREATE TABLE "Boxes" (
"Code" CHAR(4) NOT NULL,
"Contents" VARCHAR(255) NOT NULL,
"Value" REAL NOT NULL,
"Warehouse" INTEGER NOT NULL,
PRIMARY KEY ("Code"),
FOREIGN KEY("Warehouse") REFERENCES "Warehouses" ("Code")
)
CREATE TABLE "Warehouses" (
"Code" INTEGER NOT NULL,
"Location" VARCHAR(255) NOT NULL,
"Capacity" INTEGER NOT NULL,
PRIMARY KEY ("Code")
) | Find the total, average, and maximum capacity for different locations. | medium | Table Boxes (
Boxes.Code (CHAR(4)),
Boxes.Contents (VARCHAR(255)),
Boxes.Value (REAL),
Boxes.Warehouse (INTEGER),
)
Table Warehouses (
Warehouses.Code (INTEGER),
Warehouses.Location (VARCHAR(255)),
Warehouses.Capacity (INTEGER),
)
Possible JOINs:
Boxes.Warehouse = Warehouses.Code
| SELECT sum(capacity) , avg(capacity) , max(capacity) , LOCATION FROM warehouses GROUP BY LOCATION | {
'warehouses': ['code', 'location', 'capacity']
} | CREATE TABLE Boxes (
Boxes.Code (CHAR(4)),
Boxes.Contents (VARCHAR(255)),
Boxes.Value (REAL),
Boxes.Warehouse (INTEGER),
)
CREATE TABLE Warehouses (
Warehouses.Code (INTEGER),
Warehouses.Location (VARCHAR(255)),
Warehouses.Capacity (INTEGER),
)
Possible JOINs:
Boxes.Warehouse = Warehouses.Code
| Table Boxes (
Boxes.code (CHAR(4)),
Boxes.contents (VARCHAR(255)),
Boxes.value (REAL),
Boxes.warehouse (INTEGER),
)
Table Warehouses (
Warehouses.code (INTEGER),
Warehouses.location (VARCHAR(255)),
Warehouses.capacity (INTEGER),
)
Possible JOINs:
Boxes.warehouse = Warehouses.code
| CREATE TABLE Boxes (
Boxes.code (CHAR(4)),
Boxes.contents (VARCHAR(255)),
Boxes.value (REAL),
Boxes.warehouse (INTEGER),
)
CREATE TABLE Warehouses (
Warehouses.code (INTEGER),
Warehouses.location (VARCHAR(255)),
Warehouses.capacity (INTEGER),
)
Possible JOINs:
Boxes.warehouse = Warehouses.code
| Table boxes (
boxes.code (CHAR(4)),
boxes.contents (VARCHAR(255)),
boxes.value (REAL),
boxes.warehouse (INTEGER),
)
Table warehouses (
warehouses.code (INTEGER),
warehouses.location (VARCHAR(255)),
warehouses.capacity (INTEGER),
)
Possible JOINs:
boxes.warehouse = warehouses.code
| CREATE TABLE boxes (
boxes.code (CHAR(4)),
boxes.contents (VARCHAR(255)),
boxes.value (REAL),
boxes.warehouse (INTEGER),
)
CREATE TABLE warehouses (
warehouses.code (INTEGER),
warehouses.location (VARCHAR(255)),
warehouses.capacity (INTEGER),
)
Possible JOINs:
boxes.warehouse = warehouses.code
| {
'Warehouses': ['Code', 'Location', 'Capacity'],
'Boxes': ['Code', 'Contents', 'Value', 'Warehouse']
} | {
'Warehouses': ['Code', 'Location', 'Capacity']
} | TABLE Boxes (
Boxes.Code (CHAR(4)),
Boxes.Contents (VARCHAR(255)),
Boxes.Value (REAL),
Boxes.Warehouse (INTEGER),
)
TABLE Warehouses (
Warehouses.Code (INTEGER),
Warehouses.Location (VARCHAR(255)),
Warehouses.Capacity (INTEGER),
)
Possible JOINs:
Boxes.Warehouse = Warehouses.Code
| TABLE Boxes (
Boxes.code (CHAR(4)),
Boxes.contents (VARCHAR(255)),
Boxes.value (REAL),
Boxes.warehouse (INTEGER),
)
TABLE Warehouses (
Warehouses.code (INTEGER),
Warehouses.location (VARCHAR(255)),
Warehouses.capacity (INTEGER),
)
Possible JOINs:
Boxes.warehouse = Warehouses.code
| TABLE boxes (
boxes.code (CHAR(4)),
boxes.contents (VARCHAR(255)),
boxes.value (REAL),
boxes.warehouse (INTEGER),
)
TABLE warehouses (
warehouses.code (INTEGER),
warehouses.location (VARCHAR(255)),
warehouses.capacity (INTEGER),
)
Possible JOINs:
boxes.warehouse = warehouses.code
|
aan_1 |
CREATE TABLE "Affiliation" (
affiliation_id INTEGER NOT NULL,
name VARCHAR(255) DEFAULT NULL,
address VARCHAR(255) DEFAULT NULL,
PRIMARY KEY (affiliation_id)
)
CREATE TABLE "Author" (
author_id INTEGER NOT NULL,
name VARCHAR(255) DEFAULT NULL,
email VARCHAR(255) DEFAULT NULL,
PRIMARY KEY (author_id)
)
CREATE TABLE "Author_list" (
paper_id VARCHAR(25) NOT NULL,
author_id INTEGER NOT NULL,
affiliation_id INTEGER DEFAULT NULL,
PRIMARY KEY (paper_id, author_id),
FOREIGN KEY(affiliation_id) REFERENCES "Affiliation" (affiliation_id),
FOREIGN KEY(author_id) REFERENCES "Author" (author_id),
FOREIGN KEY(paper_id) REFERENCES "Paper" (paper_id)
)
CREATE TABLE "Citation" (
paper_id VARCHAR(25) NOT NULL,
cited_paper_id VARCHAR(25) NOT NULL,
PRIMARY KEY (paper_id, cited_paper_id),
FOREIGN KEY(cited_paper_id) REFERENCES "Paper" (paper_id),
FOREIGN KEY(paper_id) REFERENCES "Paper" (paper_id)
)
CREATE TABLE "Paper" (
paper_id VARCHAR(25) NOT NULL,
title VARCHAR(255) DEFAULT NULL,
venue VARCHAR(255) DEFAULT NULL,
year INTEGER DEFAULT NULL,
PRIMARY KEY (paper_id)
) | List all affiliations with ascending ordered number of papers. | hard | Table Affiliation (
Affiliation.affiliation_id (INTEGER),
Affiliation.name (varchar(255)),
Affiliation.address (varchar(255)),
)
Table Author (
Author.author_id (INTEGER),
Author.name (varchar(255)),
Author.email (varchar(255)),
)
Table Author_list (
Author_list.paper_id (varchar(25)),
Author_list.author_id (INTEGER),
Author_list.affiliation_id (INTEGER),
)
Table Citation (
Citation.paper_id (varchar(25)),
Citation.cited_paper_id (varchar(25)),
)
Table Paper (
Paper.paper_id (varchar(25)),
Paper.title (varchar(255)),
Paper.venue (varchar(255)),
Paper.year (INTEGER),
)
Possible JOINs:
Author_list.paper_id = Paper.paper_id
Author_list.author_id = Author.author_id
Author_list.affiliation_id = Affiliation.affiliation_id
Citation.paper_id = Paper.paper_id
Citation.cited_paper_id = Paper.paper_id
| SELECT Affiliation.name FROM Affiliation JOIN Author_list ON Affiliation.affiliation_id = Author_list.affiliation_id GROUP BY Affiliation.affiliation_id ORDER BY count(*) DESC | {
'affiliation': ['affiliation_id', 'name'],
'author_list': ['paper_id', 'affiliation_id']
} | CREATE TABLE Affiliation (
Affiliation.affiliation_id (INTEGER),
Affiliation.name (varchar(255)),
Affiliation.address (varchar(255)),
)
CREATE TABLE Author (
Author.author_id (INTEGER),
Author.name (varchar(255)),
Author.email (varchar(255)),
)
CREATE TABLE Author_list (
Author_list.paper_id (varchar(25)),
Author_list.author_id (INTEGER),
Author_list.affiliation_id (INTEGER),
)
CREATE TABLE Citation (
Citation.paper_id (varchar(25)),
Citation.cited_paper_id (varchar(25)),
)
CREATE TABLE Paper (
Paper.paper_id (varchar(25)),
Paper.title (varchar(255)),
Paper.venue (varchar(255)),
Paper.year (INTEGER),
)
Possible JOINs:
Author_list.paper_id = Paper.paper_id
Author_list.author_id = Author.author_id
Author_list.affiliation_id = Affiliation.affiliation_id
Citation.paper_id = Paper.paper_id
Citation.cited_paper_id = Paper.paper_id
| Table Affiliation (
Affiliation.affiliation_id (INTEGER),
Affiliation.name (varchar(255)),
Affiliation.address (varchar(255)),
)
Table Author (
Author.author_id (INTEGER),
Author.name (varchar(255)),
Author.email (varchar(255)),
)
Table Author_list (
Author_list.paper_id (varchar(25)),
Author_list.author_id (INTEGER),
Author_list.affiliation_id (INTEGER),
)
Table Citation (
Citation.paper_id (varchar(25)),
Citation.cited_paper_id (varchar(25)),
)
Table Paper (
Paper.paper_id (varchar(25)),
Paper.title (varchar(255)),
Paper.venue (varchar(255)),
Paper.year (INTEGER),
)
Possible JOINs:
Author_list.paper_id = Paper.paper_id
Author_list.author_id = Author.author_id
Author_list.affiliation_id = Affiliation.affiliation_id
Citation.paper_id = Paper.paper_id
Citation.cited_paper_id = Paper.paper_id
| CREATE TABLE Affiliation (
Affiliation.affiliation_id (INTEGER),
Affiliation.name (varchar(255)),
Affiliation.address (varchar(255)),
)
CREATE TABLE Author (
Author.author_id (INTEGER),
Author.name (varchar(255)),
Author.email (varchar(255)),
)
CREATE TABLE Author_list (
Author_list.paper_id (varchar(25)),
Author_list.author_id (INTEGER),
Author_list.affiliation_id (INTEGER),
)
CREATE TABLE Citation (
Citation.paper_id (varchar(25)),
Citation.cited_paper_id (varchar(25)),
)
CREATE TABLE Paper (
Paper.paper_id (varchar(25)),
Paper.title (varchar(255)),
Paper.venue (varchar(255)),
Paper.year (INTEGER),
)
Possible JOINs:
Author_list.paper_id = Paper.paper_id
Author_list.author_id = Author.author_id
Author_list.affiliation_id = Affiliation.affiliation_id
Citation.paper_id = Paper.paper_id
Citation.cited_paper_id = Paper.paper_id
| Table affiliation (
affiliation.affiliation_id (INTEGER),
affiliation.name (varchar(255)),
affiliation.address (varchar(255)),
)
Table author (
author.author_id (INTEGER),
author.name (varchar(255)),
author.email (varchar(255)),
)
Table author_list (
author_list.paper_id (varchar(25)),
author_list.author_id (INTEGER),
author_list.affiliation_id (INTEGER),
)
Table citation (
citation.paper_id (varchar(25)),
citation.cited_paper_id (varchar(25)),
)
Table paper (
paper.paper_id (varchar(25)),
paper.title (varchar(255)),
paper.venue (varchar(255)),
paper.year (INTEGER),
)
Possible JOINs:
author_list.paper_id = paper.paper_id
author_list.author_id = author.author_id
author_list.affiliation_id = affiliation.affiliation_id
citation.paper_id = paper.paper_id
citation.cited_paper_id = paper.paper_id
| CREATE TABLE affiliation (
affiliation.affiliation_id (INTEGER),
affiliation.name (varchar(255)),
affiliation.address (varchar(255)),
)
CREATE TABLE author (
author.author_id (INTEGER),
author.name (varchar(255)),
author.email (varchar(255)),
)
CREATE TABLE author_list (
author_list.paper_id (varchar(25)),
author_list.author_id (INTEGER),
author_list.affiliation_id (INTEGER),
)
CREATE TABLE citation (
citation.paper_id (varchar(25)),
citation.cited_paper_id (varchar(25)),
)
CREATE TABLE paper (
paper.paper_id (varchar(25)),
paper.title (varchar(255)),
paper.venue (varchar(255)),
paper.year (INTEGER),
)
Possible JOINs:
author_list.paper_id = paper.paper_id
author_list.author_id = author.author_id
author_list.affiliation_id = affiliation.affiliation_id
citation.paper_id = paper.paper_id
citation.cited_paper_id = paper.paper_id
| {
'Affiliation': ['affiliation_id', 'name', 'address'],
'Author': ['author_id', 'name', 'email'],
'Author_list': ['paper_id', 'author_id', 'affiliation_id'],
'Citation': ['paper_id', 'cited_paper_id'],
'Paper': ['paper_id', 'title', 'venue', 'year']
} | {
'Affiliation': ['affiliation_id', 'name'],
'Author_list': ['paper_id', 'affiliation_id']
} | TABLE Affiliation (
Affiliation.affiliation_id (INTEGER),
Affiliation.name (varchar(255)),
Affiliation.address (varchar(255)),
)
TABLE Author (
Author.author_id (INTEGER),
Author.name (varchar(255)),
Author.email (varchar(255)),
)
TABLE Author_list (
Author_list.paper_id (varchar(25)),
Author_list.author_id (INTEGER),
Author_list.affiliation_id (INTEGER),
)
TABLE Citation (
Citation.paper_id (varchar(25)),
Citation.cited_paper_id (varchar(25)),
)
TABLE Paper (
Paper.paper_id (varchar(25)),
Paper.title (varchar(255)),
Paper.venue (varchar(255)),
Paper.year (INTEGER),
)
Possible JOINs:
Author_list.paper_id = Paper.paper_id
Author_list.author_id = Author.author_id
Author_list.affiliation_id = Affiliation.affiliation_id
Citation.paper_id = Paper.paper_id
Citation.cited_paper_id = Paper.paper_id
| TABLE Affiliation (
Affiliation.affiliation_id (INTEGER),
Affiliation.name (varchar(255)),
Affiliation.address (varchar(255)),
)
TABLE Author (
Author.author_id (INTEGER),
Author.name (varchar(255)),
Author.email (varchar(255)),
)
TABLE Author_list (
Author_list.paper_id (varchar(25)),
Author_list.author_id (INTEGER),
Author_list.affiliation_id (INTEGER),
)
TABLE Citation (
Citation.paper_id (varchar(25)),
Citation.cited_paper_id (varchar(25)),
)
TABLE Paper (
Paper.paper_id (varchar(25)),
Paper.title (varchar(255)),
Paper.venue (varchar(255)),
Paper.year (INTEGER),
)
Possible JOINs:
Author_list.paper_id = Paper.paper_id
Author_list.author_id = Author.author_id
Author_list.affiliation_id = Affiliation.affiliation_id
Citation.paper_id = Paper.paper_id
Citation.cited_paper_id = Paper.paper_id
| TABLE affiliation (
affiliation.affiliation_id (INTEGER),
affiliation.name (varchar(255)),
affiliation.address (varchar(255)),
)
TABLE author (
author.author_id (INTEGER),
author.name (varchar(255)),
author.email (varchar(255)),
)
TABLE author_list (
author_list.paper_id (varchar(25)),
author_list.author_id (INTEGER),
author_list.affiliation_id (INTEGER),
)
TABLE citation (
citation.paper_id (varchar(25)),
citation.cited_paper_id (varchar(25)),
)
TABLE paper (
paper.paper_id (varchar(25)),
paper.title (varchar(255)),
paper.venue (varchar(255)),
paper.year (INTEGER),
)
Possible JOINs:
author_list.paper_id = paper.paper_id
author_list.author_id = author.author_id
author_list.affiliation_id = affiliation.affiliation_id
citation.paper_id = paper.paper_id
citation.cited_paper_id = paper.paper_id
|
real_estate_rentals |
CREATE TABLE "Addresses" (
address_id INTEGER,
line_1_number_building VARCHAR(80),
line_2_number_street VARCHAR(80),
line_3_area_locality VARCHAR(80),
town_city VARCHAR(80),
zip_postcode VARCHAR(20),
county_state_province VARCHAR(80),
country VARCHAR(50),
other_address_details VARCHAR(255),
PRIMARY KEY (address_id)
)
CREATE TABLE "Features" (
feature_id INTEGER,
feature_name VARCHAR(80),
feature_description VARCHAR(80),
PRIMARY KEY (feature_id)
)
CREATE TABLE "Properties" (
property_id INTEGER,
property_address_id INTEGER NOT NULL,
owner_user_id INTEGER NOT NULL,
property_type_code VARCHAR(15) NOT NULL,
date_on_market DATETIME,
date_off_market DATETIME,
property_name VARCHAR(80),
property_description VARCHAR(255),
garage_yn VARCHAR(1),
parking_lots VARCHAR(1),
room_count VARCHAR(10),
vendor_requested_price DOUBLE,
price_min DOUBLE,
price_max DOUBLE,
other_property_details VARCHAR(255),
PRIMARY KEY (property_id),
FOREIGN KEY(property_type_code) REFERENCES "Ref_Property_Types" (property_type_code),
FOREIGN KEY(property_address_id) REFERENCES "Addresses" (address_id),
FOREIGN KEY(owner_user_id) REFERENCES "Users" (user_id)
)
CREATE TABLE "Property_Features" (
property_id INTEGER NOT NULL,
feature_id INTEGER NOT NULL,
feature_value VARCHAR(80),
property_feature_description VARCHAR(80),
FOREIGN KEY(property_id) REFERENCES "Properties" (property_id),
FOREIGN KEY(feature_id) REFERENCES "Features" (feature_id)
)
CREATE TABLE "Property_Photos" (
property_id INTEGER NOT NULL,
photo_seq INTEGER NOT NULL,
photo_title VARCHAR(30),
photo_description VARCHAR(255),
photo_filename VARCHAR(255),
FOREIGN KEY(property_id) REFERENCES "Properties" (property_id)
)
CREATE TABLE "Ref_Age_Categories" (
age_category_code VARCHAR(15),
age_category_description VARCHAR(80),
PRIMARY KEY (age_category_code)
)
CREATE TABLE "Ref_Property_Types" (
property_type_code VARCHAR(15),
property_type_description VARCHAR(80),
PRIMARY KEY (property_type_code)
)
CREATE TABLE "Ref_Room_Types" (
room_type_code VARCHAR(15),
room_type_description VARCHAR(80),
PRIMARY KEY (room_type_code)
)
CREATE TABLE "Ref_User_Categories" (
user_category_code VARCHAR(15),
user_category_description VARCHAR(80),
PRIMARY KEY (user_category_code)
)
CREATE TABLE "Rooms" (
property_id INTEGER NOT NULL,
room_number VARCHAR(10) NOT NULL,
room_type_code VARCHAR(15) NOT NULL,
room_size VARCHAR(20),
other_room_details VARCHAR(255),
FOREIGN KEY(room_type_code) REFERENCES "Ref_Room_Types" (room_type_code),
FOREIGN KEY(property_id) REFERENCES "Properties" (property_id)
)
CREATE TABLE "User_Property_History" (
user_id INTEGER NOT NULL,
property_id INTEGER NOT NULL,
datestamp DATETIME NOT NULL,
FOREIGN KEY(property_id) REFERENCES "Properties" (property_id),
FOREIGN KEY(user_id) REFERENCES "Users" (user_id)
)
CREATE TABLE "User_Searches" (
user_id INTEGER NOT NULL,
search_seq INTEGER NOT NULL,
search_datetime DATETIME,
search_string VARCHAR(80),
FOREIGN KEY(user_id) REFERENCES "Users" (user_id)
)
CREATE TABLE "Users" (
user_id INTEGER,
age_category_code VARCHAR(15),
user_category_code VARCHAR(15),
user_address_id INTEGER NOT NULL,
is_buyer VARCHAR(1),
is_seller VARCHAR(1),
login_name VARCHAR(25),
password VARCHAR(8),
date_registered DATETIME,
first_name VARCHAR(80),
middle_name VARCHAR(80),
last_name VARCHAR(80),
other_user_details VARCHAR(255),
PRIMARY KEY (user_id)
) | What is the age range category of the user who made the first search? | hard | Table Addresses (
Addresses.address_id (INTEGER),
Addresses.line_1_number_building (VARCHAR(80)),
Addresses.line_2_number_street (VARCHAR(80)),
Addresses.line_3_area_locality (VARCHAR(80)),
Addresses.town_city (VARCHAR(80)),
Addresses.zip_postcode (VARCHAR(20)),
Addresses.county_state_province (VARCHAR(80)),
Addresses.country (VARCHAR(50)),
Addresses.other_address_details (VARCHAR(255)),
)
Table Features (
Features.feature_id (INTEGER),
Features.feature_name (VARCHAR(80)),
Features.feature_description (VARCHAR(80)),
)
Table Properties (
Properties.property_id (INTEGER),
Properties.property_address_id (INTEGER),
Properties.owner_user_id (INTEGER),
Properties.property_type_code (VARCHAR(15)),
Properties.date_on_market (DATETIME),
Properties.date_off_market (DATETIME),
Properties.property_name (VARCHAR(80)),
Properties.property_description (VARCHAR(255)),
Properties.garage_yn (VARCHAR(1)),
Properties.parking_lots (VARCHAR(1)),
Properties.room_count (VARCHAR(10)),
Properties.vendor_requested_price (DOUBLE),
Properties.price_min (DOUBLE),
Properties.price_max (DOUBLE),
Properties.other_property_details (VARCHAR(255)),
)
Table Property_Features (
Property_Features.property_id (INTEGER),
Property_Features.feature_id (INTEGER),
Property_Features.feature_value (VARCHAR(80)),
Property_Features.property_feature_description (VARCHAR(80)),
)
Table Property_Photos (
Property_Photos.property_id (INTEGER),
Property_Photos.photo_seq (INTEGER),
Property_Photos.photo_title (VARCHAR(30)),
Property_Photos.photo_description (VARCHAR(255)),
Property_Photos.photo_filename (VARCHAR(255)),
)
Table Ref_Age_Categories (
Ref_Age_Categories.age_category_code (VARCHAR(15)),
Ref_Age_Categories.age_category_description (VARCHAR(80)),
)
Table Ref_Property_Types (
Ref_Property_Types.property_type_code (VARCHAR(15)),
Ref_Property_Types.property_type_description (VARCHAR(80)),
)
Table Ref_Room_Types (
Ref_Room_Types.room_type_code (VARCHAR(15)),
Ref_Room_Types.room_type_description (VARCHAR(80)),
)
Table Ref_User_Categories (
Ref_User_Categories.user_category_code (VARCHAR(15)),
Ref_User_Categories.user_category_description (VARCHAR(80)),
)
Table Rooms (
Rooms.property_id (INTEGER),
Rooms.room_number (VARCHAR(10)),
Rooms.room_type_code (VARCHAR(15)),
Rooms.room_size (VARCHAR(20)),
Rooms.other_room_details (VARCHAR(255)),
)
Table User_Property_History (
User_Property_History.user_id (INTEGER),
User_Property_History.property_id (INTEGER),
User_Property_History.datestamp (DATETIME),
)
Table User_Searches (
User_Searches.user_id (INTEGER),
User_Searches.search_seq (INTEGER),
User_Searches.search_datetime (DATETIME),
User_Searches.search_string (VARCHAR(80)),
)
Table Users (
Users.user_id (INTEGER),
Users.age_category_code (VARCHAR(15)),
Users.user_category_code (VARCHAR(15)),
Users.user_address_id (INTEGER),
Users.is_buyer (VARCHAR(1)),
Users.is_seller (VARCHAR(1)),
Users.login_name (VARCHAR(25)),
Users.password (VARCHAR(8)),
Users.date_registered (DATETIME),
Users.first_name (VARCHAR(80)),
Users.middle_name (VARCHAR(80)),
Users.last_name (VARCHAR(80)),
Users.other_user_details (VARCHAR(255)),
)
Possible JOINs:
Properties.property_address_id = Addresses.address_id
Properties.owner_user_id = Users.user_id
Properties.property_type_code = Ref_Property_Types.property_type_code
Property_Features.property_id = Properties.property_id
Property_Features.feature_id = Features.feature_id
Property_Photos.property_id = Properties.property_id
Rooms.property_id = Properties.property_id
Rooms.room_type_code = Ref_Room_Types.room_type_code
User_Property_History.user_id = Users.user_id
User_Property_History.property_id = Properties.property_id
User_Searches.user_id = Users.user_id
| SELECT Users.age_category_code FROM Users JOIN User_Searches ON Users.user_id = User_Searches.user_id ORDER BY User_Searches.search_datetime LIMIT 1; | {
'users': ['user_id', 'age_category_code'],
'user_searches': ['user_id', 'search_datetime']
} | CREATE TABLE Addresses (
Addresses.address_id (INTEGER),
Addresses.line_1_number_building (VARCHAR(80)),
Addresses.line_2_number_street (VARCHAR(80)),
Addresses.line_3_area_locality (VARCHAR(80)),
Addresses.town_city (VARCHAR(80)),
Addresses.zip_postcode (VARCHAR(20)),
Addresses.county_state_province (VARCHAR(80)),
Addresses.country (VARCHAR(50)),
Addresses.other_address_details (VARCHAR(255)),
)
CREATE TABLE Features (
Features.feature_id (INTEGER),
Features.feature_name (VARCHAR(80)),
Features.feature_description (VARCHAR(80)),
)
CREATE TABLE Properties (
Properties.property_id (INTEGER),
Properties.property_address_id (INTEGER),
Properties.owner_user_id (INTEGER),
Properties.property_type_code (VARCHAR(15)),
Properties.date_on_market (DATETIME),
Properties.date_off_market (DATETIME),
Properties.property_name (VARCHAR(80)),
Properties.property_description (VARCHAR(255)),
Properties.garage_yn (VARCHAR(1)),
Properties.parking_lots (VARCHAR(1)),
Properties.room_count (VARCHAR(10)),
Properties.vendor_requested_price (DOUBLE),
Properties.price_min (DOUBLE),
Properties.price_max (DOUBLE),
Properties.other_property_details (VARCHAR(255)),
)
CREATE TABLE Property_Features (
Property_Features.property_id (INTEGER),
Property_Features.feature_id (INTEGER),
Property_Features.feature_value (VARCHAR(80)),
Property_Features.property_feature_description (VARCHAR(80)),
)
CREATE TABLE Property_Photos (
Property_Photos.property_id (INTEGER),
Property_Photos.photo_seq (INTEGER),
Property_Photos.photo_title (VARCHAR(30)),
Property_Photos.photo_description (VARCHAR(255)),
Property_Photos.photo_filename (VARCHAR(255)),
)
CREATE TABLE Ref_Age_Categories (
Ref_Age_Categories.age_category_code (VARCHAR(15)),
Ref_Age_Categories.age_category_description (VARCHAR(80)),
)
CREATE TABLE Ref_Property_Types (
Ref_Property_Types.property_type_code (VARCHAR(15)),
Ref_Property_Types.property_type_description (VARCHAR(80)),
)
CREATE TABLE Ref_Room_Types (
Ref_Room_Types.room_type_code (VARCHAR(15)),
Ref_Room_Types.room_type_description (VARCHAR(80)),
)
CREATE TABLE Ref_User_Categories (
Ref_User_Categories.user_category_code (VARCHAR(15)),
Ref_User_Categories.user_category_description (VARCHAR(80)),
)
CREATE TABLE Rooms (
Rooms.property_id (INTEGER),
Rooms.room_number (VARCHAR(10)),
Rooms.room_type_code (VARCHAR(15)),
Rooms.room_size (VARCHAR(20)),
Rooms.other_room_details (VARCHAR(255)),
)
CREATE TABLE User_Property_History (
User_Property_History.user_id (INTEGER),
User_Property_History.property_id (INTEGER),
User_Property_History.datestamp (DATETIME),
)
CREATE TABLE User_Searches (
User_Searches.user_id (INTEGER),
User_Searches.search_seq (INTEGER),
User_Searches.search_datetime (DATETIME),
User_Searches.search_string (VARCHAR(80)),
)
CREATE TABLE Users (
Users.user_id (INTEGER),
Users.age_category_code (VARCHAR(15)),
Users.user_category_code (VARCHAR(15)),
Users.user_address_id (INTEGER),
Users.is_buyer (VARCHAR(1)),
Users.is_seller (VARCHAR(1)),
Users.login_name (VARCHAR(25)),
Users.password (VARCHAR(8)),
Users.date_registered (DATETIME),
Users.first_name (VARCHAR(80)),
Users.middle_name (VARCHAR(80)),
Users.last_name (VARCHAR(80)),
Users.other_user_details (VARCHAR(255)),
)
Possible JOINs:
Properties.property_address_id = Addresses.address_id
Properties.owner_user_id = Users.user_id
Properties.property_type_code = Ref_Property_Types.property_type_code
Property_Features.property_id = Properties.property_id
Property_Features.feature_id = Features.feature_id
Property_Photos.property_id = Properties.property_id
Rooms.property_id = Properties.property_id
Rooms.room_type_code = Ref_Room_Types.room_type_code
User_Property_History.user_id = Users.user_id
User_Property_History.property_id = Properties.property_id
User_Searches.user_id = Users.user_id
| Table Addresses (
Addresses.address_id (INTEGER),
Addresses.line_1_number_building (VARCHAR(80)),
Addresses.line_2_number_street (VARCHAR(80)),
Addresses.line_3_area_locality (VARCHAR(80)),
Addresses.town_city (VARCHAR(80)),
Addresses.zip_postcode (VARCHAR(20)),
Addresses.county_state_province (VARCHAR(80)),
Addresses.country (VARCHAR(50)),
Addresses.other_address_details (VARCHAR(255)),
)
Table Features (
Features.feature_id (INTEGER),
Features.feature_name (VARCHAR(80)),
Features.feature_description (VARCHAR(80)),
)
Table Properties (
Properties.property_id (INTEGER),
Properties.property_address_id (INTEGER),
Properties.owner_user_id (INTEGER),
Properties.property_type_code (VARCHAR(15)),
Properties.date_on_market (DATETIME),
Properties.date_off_market (DATETIME),
Properties.property_name (VARCHAR(80)),
Properties.property_description (VARCHAR(255)),
Properties.garage_yn (VARCHAR(1)),
Properties.parking_lots (VARCHAR(1)),
Properties.room_count (VARCHAR(10)),
Properties.vendor_requested_price (DOUBLE),
Properties.price_min (DOUBLE),
Properties.price_max (DOUBLE),
Properties.other_property_details (VARCHAR(255)),
)
Table Property_Features (
Property_Features.property_id (INTEGER),
Property_Features.feature_id (INTEGER),
Property_Features.feature_value (VARCHAR(80)),
Property_Features.property_feature_description (VARCHAR(80)),
)
Table Property_Photos (
Property_Photos.property_id (INTEGER),
Property_Photos.photo_seq (INTEGER),
Property_Photos.photo_title (VARCHAR(30)),
Property_Photos.photo_description (VARCHAR(255)),
Property_Photos.photo_filename (VARCHAR(255)),
)
Table Ref_Age_Categories (
Ref_Age_Categories.age_category_code (VARCHAR(15)),
Ref_Age_Categories.age_category_description (VARCHAR(80)),
)
Table Ref_Property_Types (
Ref_Property_Types.property_type_code (VARCHAR(15)),
Ref_Property_Types.property_type_description (VARCHAR(80)),
)
Table Ref_Room_Types (
Ref_Room_Types.room_type_code (VARCHAR(15)),
Ref_Room_Types.room_type_description (VARCHAR(80)),
)
Table Ref_User_Categories (
Ref_User_Categories.user_category_code (VARCHAR(15)),
Ref_User_Categories.user_category_description (VARCHAR(80)),
)
Table Rooms (
Rooms.property_id (INTEGER),
Rooms.room_number (VARCHAR(10)),
Rooms.room_type_code (VARCHAR(15)),
Rooms.room_size (VARCHAR(20)),
Rooms.other_room_details (VARCHAR(255)),
)
Table User_Property_History (
User_Property_History.user_id (INTEGER),
User_Property_History.property_id (INTEGER),
User_Property_History.datestamp (DATETIME),
)
Table User_Searches (
User_Searches.user_id (INTEGER),
User_Searches.search_seq (INTEGER),
User_Searches.search_datetime (DATETIME),
User_Searches.search_string (VARCHAR(80)),
)
Table Users (
Users.user_id (INTEGER),
Users.age_category_code (VARCHAR(15)),
Users.user_category_code (VARCHAR(15)),
Users.user_address_id (INTEGER),
Users.is_buyer (VARCHAR(1)),
Users.is_seller (VARCHAR(1)),
Users.login_name (VARCHAR(25)),
Users.password (VARCHAR(8)),
Users.date_registered (DATETIME),
Users.first_name (VARCHAR(80)),
Users.middle_name (VARCHAR(80)),
Users.last_name (VARCHAR(80)),
Users.other_user_details (VARCHAR(255)),
)
Possible JOINs:
Properties.property_address_id = Addresses.address_id
Properties.owner_user_id = Users.user_id
Properties.property_type_code = Ref_Property_Types.property_type_code
Property_Features.property_id = Properties.property_id
Property_Features.feature_id = Features.feature_id
Property_Photos.property_id = Properties.property_id
Rooms.property_id = Properties.property_id
Rooms.room_type_code = Ref_Room_Types.room_type_code
User_Property_History.user_id = Users.user_id
User_Property_History.property_id = Properties.property_id
User_Searches.user_id = Users.user_id
| CREATE TABLE Addresses (
Addresses.address_id (INTEGER),
Addresses.line_1_number_building (VARCHAR(80)),
Addresses.line_2_number_street (VARCHAR(80)),
Addresses.line_3_area_locality (VARCHAR(80)),
Addresses.town_city (VARCHAR(80)),
Addresses.zip_postcode (VARCHAR(20)),
Addresses.county_state_province (VARCHAR(80)),
Addresses.country (VARCHAR(50)),
Addresses.other_address_details (VARCHAR(255)),
)
CREATE TABLE Features (
Features.feature_id (INTEGER),
Features.feature_name (VARCHAR(80)),
Features.feature_description (VARCHAR(80)),
)
CREATE TABLE Properties (
Properties.property_id (INTEGER),
Properties.property_address_id (INTEGER),
Properties.owner_user_id (INTEGER),
Properties.property_type_code (VARCHAR(15)),
Properties.date_on_market (DATETIME),
Properties.date_off_market (DATETIME),
Properties.property_name (VARCHAR(80)),
Properties.property_description (VARCHAR(255)),
Properties.garage_yn (VARCHAR(1)),
Properties.parking_lots (VARCHAR(1)),
Properties.room_count (VARCHAR(10)),
Properties.vendor_requested_price (DOUBLE),
Properties.price_min (DOUBLE),
Properties.price_max (DOUBLE),
Properties.other_property_details (VARCHAR(255)),
)
CREATE TABLE Property_Features (
Property_Features.property_id (INTEGER),
Property_Features.feature_id (INTEGER),
Property_Features.feature_value (VARCHAR(80)),
Property_Features.property_feature_description (VARCHAR(80)),
)
CREATE TABLE Property_Photos (
Property_Photos.property_id (INTEGER),
Property_Photos.photo_seq (INTEGER),
Property_Photos.photo_title (VARCHAR(30)),
Property_Photos.photo_description (VARCHAR(255)),
Property_Photos.photo_filename (VARCHAR(255)),
)
CREATE TABLE Ref_Age_Categories (
Ref_Age_Categories.age_category_code (VARCHAR(15)),
Ref_Age_Categories.age_category_description (VARCHAR(80)),
)
CREATE TABLE Ref_Property_Types (
Ref_Property_Types.property_type_code (VARCHAR(15)),
Ref_Property_Types.property_type_description (VARCHAR(80)),
)
CREATE TABLE Ref_Room_Types (
Ref_Room_Types.room_type_code (VARCHAR(15)),
Ref_Room_Types.room_type_description (VARCHAR(80)),
)
CREATE TABLE Ref_User_Categories (
Ref_User_Categories.user_category_code (VARCHAR(15)),
Ref_User_Categories.user_category_description (VARCHAR(80)),
)
CREATE TABLE Rooms (
Rooms.property_id (INTEGER),
Rooms.room_number (VARCHAR(10)),
Rooms.room_type_code (VARCHAR(15)),
Rooms.room_size (VARCHAR(20)),
Rooms.other_room_details (VARCHAR(255)),
)
CREATE TABLE User_Property_History (
User_Property_History.user_id (INTEGER),
User_Property_History.property_id (INTEGER),
User_Property_History.datestamp (DATETIME),
)
CREATE TABLE User_Searches (
User_Searches.user_id (INTEGER),
User_Searches.search_seq (INTEGER),
User_Searches.search_datetime (DATETIME),
User_Searches.search_string (VARCHAR(80)),
)
CREATE TABLE Users (
Users.user_id (INTEGER),
Users.age_category_code (VARCHAR(15)),
Users.user_category_code (VARCHAR(15)),
Users.user_address_id (INTEGER),
Users.is_buyer (VARCHAR(1)),
Users.is_seller (VARCHAR(1)),
Users.login_name (VARCHAR(25)),
Users.password (VARCHAR(8)),
Users.date_registered (DATETIME),
Users.first_name (VARCHAR(80)),
Users.middle_name (VARCHAR(80)),
Users.last_name (VARCHAR(80)),
Users.other_user_details (VARCHAR(255)),
)
Possible JOINs:
Properties.property_address_id = Addresses.address_id
Properties.owner_user_id = Users.user_id
Properties.property_type_code = Ref_Property_Types.property_type_code
Property_Features.property_id = Properties.property_id
Property_Features.feature_id = Features.feature_id
Property_Photos.property_id = Properties.property_id
Rooms.property_id = Properties.property_id
Rooms.room_type_code = Ref_Room_Types.room_type_code
User_Property_History.user_id = Users.user_id
User_Property_History.property_id = Properties.property_id
User_Searches.user_id = Users.user_id
| Table addresses (
addresses.address_id (INTEGER),
addresses.line_1_number_building (VARCHAR(80)),
addresses.line_2_number_street (VARCHAR(80)),
addresses.line_3_area_locality (VARCHAR(80)),
addresses.town_city (VARCHAR(80)),
addresses.zip_postcode (VARCHAR(20)),
addresses.county_state_province (VARCHAR(80)),
addresses.country (VARCHAR(50)),
addresses.other_address_details (VARCHAR(255)),
)
Table features (
features.feature_id (INTEGER),
features.feature_name (VARCHAR(80)),
features.feature_description (VARCHAR(80)),
)
Table properties (
properties.property_id (INTEGER),
properties.property_address_id (INTEGER),
properties.owner_user_id (INTEGER),
properties.property_type_code (VARCHAR(15)),
properties.date_on_market (DATETIME),
properties.date_off_market (DATETIME),
properties.property_name (VARCHAR(80)),
properties.property_description (VARCHAR(255)),
properties.garage_yn (VARCHAR(1)),
properties.parking_lots (VARCHAR(1)),
properties.room_count (VARCHAR(10)),
properties.vendor_requested_price (DOUBLE),
properties.price_min (DOUBLE),
properties.price_max (DOUBLE),
properties.other_property_details (VARCHAR(255)),
)
Table property_features (
property_features.property_id (INTEGER),
property_features.feature_id (INTEGER),
property_features.feature_value (VARCHAR(80)),
property_features.property_feature_description (VARCHAR(80)),
)
Table property_photos (
property_photos.property_id (INTEGER),
property_photos.photo_seq (INTEGER),
property_photos.photo_title (VARCHAR(30)),
property_photos.photo_description (VARCHAR(255)),
property_photos.photo_filename (VARCHAR(255)),
)
Table ref_age_categories (
ref_age_categories.age_category_code (VARCHAR(15)),
ref_age_categories.age_category_description (VARCHAR(80)),
)
Table ref_property_types (
ref_property_types.property_type_code (VARCHAR(15)),
ref_property_types.property_type_description (VARCHAR(80)),
)
Table ref_room_types (
ref_room_types.room_type_code (VARCHAR(15)),
ref_room_types.room_type_description (VARCHAR(80)),
)
Table ref_user_categories (
ref_user_categories.user_category_code (VARCHAR(15)),
ref_user_categories.user_category_description (VARCHAR(80)),
)
Table rooms (
rooms.property_id (INTEGER),
rooms.room_number (VARCHAR(10)),
rooms.room_type_code (VARCHAR(15)),
rooms.room_size (VARCHAR(20)),
rooms.other_room_details (VARCHAR(255)),
)
Table user_property_history (
user_property_history.user_id (INTEGER),
user_property_history.property_id (INTEGER),
user_property_history.datestamp (DATETIME),
)
Table user_searches (
user_searches.user_id (INTEGER),
user_searches.search_seq (INTEGER),
user_searches.search_datetime (DATETIME),
user_searches.search_string (VARCHAR(80)),
)
Table users (
users.user_id (INTEGER),
users.age_category_code (VARCHAR(15)),
users.user_category_code (VARCHAR(15)),
users.user_address_id (INTEGER),
users.is_buyer (VARCHAR(1)),
users.is_seller (VARCHAR(1)),
users.login_name (VARCHAR(25)),
users.password (VARCHAR(8)),
users.date_registered (DATETIME),
users.first_name (VARCHAR(80)),
users.middle_name (VARCHAR(80)),
users.last_name (VARCHAR(80)),
users.other_user_details (VARCHAR(255)),
)
Possible JOINs:
properties.property_address_id = addresses.address_id
properties.owner_user_id = users.user_id
properties.property_type_code = ref_property_types.property_type_code
property_features.property_id = properties.property_id
property_features.feature_id = features.feature_id
property_photos.property_id = properties.property_id
rooms.property_id = properties.property_id
rooms.room_type_code = ref_room_types.room_type_code
user_property_history.user_id = users.user_id
user_property_history.property_id = properties.property_id
user_searches.user_id = users.user_id
| CREATE TABLE addresses (
addresses.address_id (INTEGER),
addresses.line_1_number_building (VARCHAR(80)),
addresses.line_2_number_street (VARCHAR(80)),
addresses.line_3_area_locality (VARCHAR(80)),
addresses.town_city (VARCHAR(80)),
addresses.zip_postcode (VARCHAR(20)),
addresses.county_state_province (VARCHAR(80)),
addresses.country (VARCHAR(50)),
addresses.other_address_details (VARCHAR(255)),
)
CREATE TABLE features (
features.feature_id (INTEGER),
features.feature_name (VARCHAR(80)),
features.feature_description (VARCHAR(80)),
)
CREATE TABLE properties (
properties.property_id (INTEGER),
properties.property_address_id (INTEGER),
properties.owner_user_id (INTEGER),
properties.property_type_code (VARCHAR(15)),
properties.date_on_market (DATETIME),
properties.date_off_market (DATETIME),
properties.property_name (VARCHAR(80)),
properties.property_description (VARCHAR(255)),
properties.garage_yn (VARCHAR(1)),
properties.parking_lots (VARCHAR(1)),
properties.room_count (VARCHAR(10)),
properties.vendor_requested_price (DOUBLE),
properties.price_min (DOUBLE),
properties.price_max (DOUBLE),
properties.other_property_details (VARCHAR(255)),
)
CREATE TABLE property_features (
property_features.property_id (INTEGER),
property_features.feature_id (INTEGER),
property_features.feature_value (VARCHAR(80)),
property_features.property_feature_description (VARCHAR(80)),
)
CREATE TABLE property_photos (
property_photos.property_id (INTEGER),
property_photos.photo_seq (INTEGER),
property_photos.photo_title (VARCHAR(30)),
property_photos.photo_description (VARCHAR(255)),
property_photos.photo_filename (VARCHAR(255)),
)
CREATE TABLE ref_age_categories (
ref_age_categories.age_category_code (VARCHAR(15)),
ref_age_categories.age_category_description (VARCHAR(80)),
)
CREATE TABLE ref_property_types (
ref_property_types.property_type_code (VARCHAR(15)),
ref_property_types.property_type_description (VARCHAR(80)),
)
CREATE TABLE ref_room_types (
ref_room_types.room_type_code (VARCHAR(15)),
ref_room_types.room_type_description (VARCHAR(80)),
)
CREATE TABLE ref_user_categories (
ref_user_categories.user_category_code (VARCHAR(15)),
ref_user_categories.user_category_description (VARCHAR(80)),
)
CREATE TABLE rooms (
rooms.property_id (INTEGER),
rooms.room_number (VARCHAR(10)),
rooms.room_type_code (VARCHAR(15)),
rooms.room_size (VARCHAR(20)),
rooms.other_room_details (VARCHAR(255)),
)
CREATE TABLE user_property_history (
user_property_history.user_id (INTEGER),
user_property_history.property_id (INTEGER),
user_property_history.datestamp (DATETIME),
)
CREATE TABLE user_searches (
user_searches.user_id (INTEGER),
user_searches.search_seq (INTEGER),
user_searches.search_datetime (DATETIME),
user_searches.search_string (VARCHAR(80)),
)
CREATE TABLE users (
users.user_id (INTEGER),
users.age_category_code (VARCHAR(15)),
users.user_category_code (VARCHAR(15)),
users.user_address_id (INTEGER),
users.is_buyer (VARCHAR(1)),
users.is_seller (VARCHAR(1)),
users.login_name (VARCHAR(25)),
users.password (VARCHAR(8)),
users.date_registered (DATETIME),
users.first_name (VARCHAR(80)),
users.middle_name (VARCHAR(80)),
users.last_name (VARCHAR(80)),
users.other_user_details (VARCHAR(255)),
)
Possible JOINs:
properties.property_address_id = addresses.address_id
properties.owner_user_id = users.user_id
properties.property_type_code = ref_property_types.property_type_code
property_features.property_id = properties.property_id
property_features.feature_id = features.feature_id
property_photos.property_id = properties.property_id
rooms.property_id = properties.property_id
rooms.room_type_code = ref_room_types.room_type_code
user_property_history.user_id = users.user_id
user_property_history.property_id = properties.property_id
user_searches.user_id = users.user_id
| {
'Ref_Age_Categories': ['age_category_code', 'age_category_description'],
'Ref_Property_Types': ['property_type_code', 'property_type_description'],
'Ref_Room_Types': ['room_type_code', 'room_type_description'],
'Ref_User_Categories': ['user_category_code', 'user_category_description'],
'Addresses': ['address_id', 'line_1_number_building', 'line_2_number_street', 'line_3_area_locality', 'town_city', 'zip_postcode', 'county_state_province', 'country', 'other_address_details'],
'Features': ['feature_id', 'feature_name', 'feature_description'],
'Users': ['user_id', 'age_category_code', 'user_category_code', 'user_address_id', 'is_buyer', 'is_seller', 'login_name', 'password', 'date_registered', 'first_name', 'middle_name', 'last_name', 'other_user_details'],
'Properties': ['property_id', 'property_address_id', 'owner_user_id', 'property_type_code', 'date_on_market', 'date_off_market', 'property_name', 'property_description', 'garage_yn', 'parking_lots', 'room_count', 'vendor_requested_price', 'price_min', 'price_max', 'other_property_details'],
'Property_Features': ['property_id', 'feature_id', 'feature_value', 'property_feature_description'],
'Property_Photos': ['property_id', 'photo_seq', 'photo_title', 'photo_description', 'photo_filename'],
'Rooms': ['property_id', 'room_number', 'room_type_code', 'room_size', 'other_room_details'],
'User_Property_History': ['user_id', 'property_id', 'datestamp'],
'User_Searches': ['user_id', 'search_seq', 'search_datetime', 'search_string']
} | {
'Users': ['user_id', 'age_category_code'],
'User_Searches': ['user_id', 'search_datetime']
} | TABLE Addresses (
Addresses.address_id (INTEGER),
Addresses.line_1_number_building (VARCHAR(80)),
Addresses.line_2_number_street (VARCHAR(80)),
Addresses.line_3_area_locality (VARCHAR(80)),
Addresses.town_city (VARCHAR(80)),
Addresses.zip_postcode (VARCHAR(20)),
Addresses.county_state_province (VARCHAR(80)),
Addresses.country (VARCHAR(50)),
Addresses.other_address_details (VARCHAR(255)),
)
TABLE Features (
Features.feature_id (INTEGER),
Features.feature_name (VARCHAR(80)),
Features.feature_description (VARCHAR(80)),
)
TABLE Properties (
Properties.property_id (INTEGER),
Properties.property_address_id (INTEGER),
Properties.owner_user_id (INTEGER),
Properties.property_type_code (VARCHAR(15)),
Properties.date_on_market (DATETIME),
Properties.date_off_market (DATETIME),
Properties.property_name (VARCHAR(80)),
Properties.property_description (VARCHAR(255)),
Properties.garage_yn (VARCHAR(1)),
Properties.parking_lots (VARCHAR(1)),
Properties.room_count (VARCHAR(10)),
Properties.vendor_requested_price (DOUBLE),
Properties.price_min (DOUBLE),
Properties.price_max (DOUBLE),
Properties.other_property_details (VARCHAR(255)),
)
TABLE Property_Features (
Property_Features.property_id (INTEGER),
Property_Features.feature_id (INTEGER),
Property_Features.feature_value (VARCHAR(80)),
Property_Features.property_feature_description (VARCHAR(80)),
)
TABLE Property_Photos (
Property_Photos.property_id (INTEGER),
Property_Photos.photo_seq (INTEGER),
Property_Photos.photo_title (VARCHAR(30)),
Property_Photos.photo_description (VARCHAR(255)),
Property_Photos.photo_filename (VARCHAR(255)),
)
TABLE Ref_Age_Categories (
Ref_Age_Categories.age_category_code (VARCHAR(15)),
Ref_Age_Categories.age_category_description (VARCHAR(80)),
)
TABLE Ref_Property_Types (
Ref_Property_Types.property_type_code (VARCHAR(15)),
Ref_Property_Types.property_type_description (VARCHAR(80)),
)
TABLE Ref_Room_Types (
Ref_Room_Types.room_type_code (VARCHAR(15)),
Ref_Room_Types.room_type_description (VARCHAR(80)),
)
TABLE Ref_User_Categories (
Ref_User_Categories.user_category_code (VARCHAR(15)),
Ref_User_Categories.user_category_description (VARCHAR(80)),
)
TABLE Rooms (
Rooms.property_id (INTEGER),
Rooms.room_number (VARCHAR(10)),
Rooms.room_type_code (VARCHAR(15)),
Rooms.room_size (VARCHAR(20)),
Rooms.other_room_details (VARCHAR(255)),
)
TABLE User_Property_History (
User_Property_History.user_id (INTEGER),
User_Property_History.property_id (INTEGER),
User_Property_History.datestamp (DATETIME),
)
TABLE User_Searches (
User_Searches.user_id (INTEGER),
User_Searches.search_seq (INTEGER),
User_Searches.search_datetime (DATETIME),
User_Searches.search_string (VARCHAR(80)),
)
TABLE Users (
Users.user_id (INTEGER),
Users.age_category_code (VARCHAR(15)),
Users.user_category_code (VARCHAR(15)),
Users.user_address_id (INTEGER),
Users.is_buyer (VARCHAR(1)),
Users.is_seller (VARCHAR(1)),
Users.login_name (VARCHAR(25)),
Users.password (VARCHAR(8)),
Users.date_registered (DATETIME),
Users.first_name (VARCHAR(80)),
Users.middle_name (VARCHAR(80)),
Users.last_name (VARCHAR(80)),
Users.other_user_details (VARCHAR(255)),
)
Possible JOINs:
Properties.property_address_id = Addresses.address_id
Properties.owner_user_id = Users.user_id
Properties.property_type_code = Ref_Property_Types.property_type_code
Property_Features.property_id = Properties.property_id
Property_Features.feature_id = Features.feature_id
Property_Photos.property_id = Properties.property_id
Rooms.property_id = Properties.property_id
Rooms.room_type_code = Ref_Room_Types.room_type_code
User_Property_History.user_id = Users.user_id
User_Property_History.property_id = Properties.property_id
User_Searches.user_id = Users.user_id
| TABLE Addresses (
Addresses.address_id (INTEGER),
Addresses.line_1_number_building (VARCHAR(80)),
Addresses.line_2_number_street (VARCHAR(80)),
Addresses.line_3_area_locality (VARCHAR(80)),
Addresses.town_city (VARCHAR(80)),
Addresses.zip_postcode (VARCHAR(20)),
Addresses.county_state_province (VARCHAR(80)),
Addresses.country (VARCHAR(50)),
Addresses.other_address_details (VARCHAR(255)),
)
TABLE Features (
Features.feature_id (INTEGER),
Features.feature_name (VARCHAR(80)),
Features.feature_description (VARCHAR(80)),
)
TABLE Properties (
Properties.property_id (INTEGER),
Properties.property_address_id (INTEGER),
Properties.owner_user_id (INTEGER),
Properties.property_type_code (VARCHAR(15)),
Properties.date_on_market (DATETIME),
Properties.date_off_market (DATETIME),
Properties.property_name (VARCHAR(80)),
Properties.property_description (VARCHAR(255)),
Properties.garage_yn (VARCHAR(1)),
Properties.parking_lots (VARCHAR(1)),
Properties.room_count (VARCHAR(10)),
Properties.vendor_requested_price (DOUBLE),
Properties.price_min (DOUBLE),
Properties.price_max (DOUBLE),
Properties.other_property_details (VARCHAR(255)),
)
TABLE Property_Features (
Property_Features.property_id (INTEGER),
Property_Features.feature_id (INTEGER),
Property_Features.feature_value (VARCHAR(80)),
Property_Features.property_feature_description (VARCHAR(80)),
)
TABLE Property_Photos (
Property_Photos.property_id (INTEGER),
Property_Photos.photo_seq (INTEGER),
Property_Photos.photo_title (VARCHAR(30)),
Property_Photos.photo_description (VARCHAR(255)),
Property_Photos.photo_filename (VARCHAR(255)),
)
TABLE Ref_Age_Categories (
Ref_Age_Categories.age_category_code (VARCHAR(15)),
Ref_Age_Categories.age_category_description (VARCHAR(80)),
)
TABLE Ref_Property_Types (
Ref_Property_Types.property_type_code (VARCHAR(15)),
Ref_Property_Types.property_type_description (VARCHAR(80)),
)
TABLE Ref_Room_Types (
Ref_Room_Types.room_type_code (VARCHAR(15)),
Ref_Room_Types.room_type_description (VARCHAR(80)),
)
TABLE Ref_User_Categories (
Ref_User_Categories.user_category_code (VARCHAR(15)),
Ref_User_Categories.user_category_description (VARCHAR(80)),
)
TABLE Rooms (
Rooms.property_id (INTEGER),
Rooms.room_number (VARCHAR(10)),
Rooms.room_type_code (VARCHAR(15)),
Rooms.room_size (VARCHAR(20)),
Rooms.other_room_details (VARCHAR(255)),
)
TABLE User_Property_History (
User_Property_History.user_id (INTEGER),
User_Property_History.property_id (INTEGER),
User_Property_History.datestamp (DATETIME),
)
TABLE User_Searches (
User_Searches.user_id (INTEGER),
User_Searches.search_seq (INTEGER),
User_Searches.search_datetime (DATETIME),
User_Searches.search_string (VARCHAR(80)),
)
TABLE Users (
Users.user_id (INTEGER),
Users.age_category_code (VARCHAR(15)),
Users.user_category_code (VARCHAR(15)),
Users.user_address_id (INTEGER),
Users.is_buyer (VARCHAR(1)),
Users.is_seller (VARCHAR(1)),
Users.login_name (VARCHAR(25)),
Users.password (VARCHAR(8)),
Users.date_registered (DATETIME),
Users.first_name (VARCHAR(80)),
Users.middle_name (VARCHAR(80)),
Users.last_name (VARCHAR(80)),
Users.other_user_details (VARCHAR(255)),
)
Possible JOINs:
Properties.property_address_id = Addresses.address_id
Properties.owner_user_id = Users.user_id
Properties.property_type_code = Ref_Property_Types.property_type_code
Property_Features.property_id = Properties.property_id
Property_Features.feature_id = Features.feature_id
Property_Photos.property_id = Properties.property_id
Rooms.property_id = Properties.property_id
Rooms.room_type_code = Ref_Room_Types.room_type_code
User_Property_History.user_id = Users.user_id
User_Property_History.property_id = Properties.property_id
User_Searches.user_id = Users.user_id
| TABLE addresses (
addresses.address_id (INTEGER),
addresses.line_1_number_building (VARCHAR(80)),
addresses.line_2_number_street (VARCHAR(80)),
addresses.line_3_area_locality (VARCHAR(80)),
addresses.town_city (VARCHAR(80)),
addresses.zip_postcode (VARCHAR(20)),
addresses.county_state_province (VARCHAR(80)),
addresses.country (VARCHAR(50)),
addresses.other_address_details (VARCHAR(255)),
)
TABLE features (
features.feature_id (INTEGER),
features.feature_name (VARCHAR(80)),
features.feature_description (VARCHAR(80)),
)
TABLE properties (
properties.property_id (INTEGER),
properties.property_address_id (INTEGER),
properties.owner_user_id (INTEGER),
properties.property_type_code (VARCHAR(15)),
properties.date_on_market (DATETIME),
properties.date_off_market (DATETIME),
properties.property_name (VARCHAR(80)),
properties.property_description (VARCHAR(255)),
properties.garage_yn (VARCHAR(1)),
properties.parking_lots (VARCHAR(1)),
properties.room_count (VARCHAR(10)),
properties.vendor_requested_price (DOUBLE),
properties.price_min (DOUBLE),
properties.price_max (DOUBLE),
properties.other_property_details (VARCHAR(255)),
)
TABLE property_features (
property_features.property_id (INTEGER),
property_features.feature_id (INTEGER),
property_features.feature_value (VARCHAR(80)),
property_features.property_feature_description (VARCHAR(80)),
)
TABLE property_photos (
property_photos.property_id (INTEGER),
property_photos.photo_seq (INTEGER),
property_photos.photo_title (VARCHAR(30)),
property_photos.photo_description (VARCHAR(255)),
property_photos.photo_filename (VARCHAR(255)),
)
TABLE ref_age_categories (
ref_age_categories.age_category_code (VARCHAR(15)),
ref_age_categories.age_category_description (VARCHAR(80)),
)
TABLE ref_property_types (
ref_property_types.property_type_code (VARCHAR(15)),
ref_property_types.property_type_description (VARCHAR(80)),
)
TABLE ref_room_types (
ref_room_types.room_type_code (VARCHAR(15)),
ref_room_types.room_type_description (VARCHAR(80)),
)
TABLE ref_user_categories (
ref_user_categories.user_category_code (VARCHAR(15)),
ref_user_categories.user_category_description (VARCHAR(80)),
)
TABLE rooms (
rooms.property_id (INTEGER),
rooms.room_number (VARCHAR(10)),
rooms.room_type_code (VARCHAR(15)),
rooms.room_size (VARCHAR(20)),
rooms.other_room_details (VARCHAR(255)),
)
TABLE user_property_history (
user_property_history.user_id (INTEGER),
user_property_history.property_id (INTEGER),
user_property_history.datestamp (DATETIME),
)
TABLE user_searches (
user_searches.user_id (INTEGER),
user_searches.search_seq (INTEGER),
user_searches.search_datetime (DATETIME),
user_searches.search_string (VARCHAR(80)),
)
TABLE users (
users.user_id (INTEGER),
users.age_category_code (VARCHAR(15)),
users.user_category_code (VARCHAR(15)),
users.user_address_id (INTEGER),
users.is_buyer (VARCHAR(1)),
users.is_seller (VARCHAR(1)),
users.login_name (VARCHAR(25)),
users.password (VARCHAR(8)),
users.date_registered (DATETIME),
users.first_name (VARCHAR(80)),
users.middle_name (VARCHAR(80)),
users.last_name (VARCHAR(80)),
users.other_user_details (VARCHAR(255)),
)
Possible JOINs:
properties.property_address_id = addresses.address_id
properties.owner_user_id = users.user_id
properties.property_type_code = ref_property_types.property_type_code
property_features.property_id = properties.property_id
property_features.feature_id = features.feature_id
property_photos.property_id = properties.property_id
rooms.property_id = properties.property_id
rooms.room_type_code = ref_room_types.room_type_code
user_property_history.user_id = users.user_id
user_property_history.property_id = properties.property_id
user_searches.user_id = users.user_id
|
university_rank |
CREATE TABLE major (
"Major_ID" INTEGER,
"Major_Name" TEXT,
"Major_Code" INTEGER,
PRIMARY KEY ("Major_ID")
)
CREATE TABLE major_ranking (
"Rank" INTEGER,
"University_ID" INTEGER,
"Major_ID" INTEGER,
PRIMARY KEY ("Rank", "Major_ID", "University_ID"),
FOREIGN KEY("Major_ID") REFERENCES major ("Major_ID"),
FOREIGN KEY("University_ID") REFERENCES university ("University_ID")
)
CREATE TABLE overall_ranking (
"Rank" INTEGER,
"University_ID" INTEGER,
"Reputation_point" INTEGER,
"Research_point" INTEGER,
"Citation_point" INTEGER,
"Total" INTEGER,
PRIMARY KEY ("University_ID"),
FOREIGN KEY("University_ID") REFERENCES university ("University_ID")
)
CREATE TABLE university (
"University_ID" INTEGER,
"University_Name" TEXT,
"City" TEXT,
"State" TEXT,
"Team_Name" TEXT,
"Affiliation" TEXT,
"Enrollment" INTEGER,
"Home_Conference" TEXT,
PRIMARY KEY ("University_ID")
) | What are the names of all teams from universities that have more people enrolled than average ? | hard | Table major (
major.Major_ID (INT),
major.Major_Name (TEXT),
major.Major_Code (INT),
)
Table major_ranking (
major_ranking.Rank (INT),
major_ranking.University_ID (INT),
major_ranking.Major_ID (INT),
)
Table overall_ranking (
overall_ranking.Rank (INT),
overall_ranking.University_ID (INT),
overall_ranking.Reputation_point (INT),
overall_ranking.Research_point (INT),
overall_ranking.Citation_point (INT),
overall_ranking.Total (INT),
)
Table university (
university.University_ID (INT),
university.University_Name (TEXT),
university.City (TEXT),
university.State (TEXT),
university.Team_Name (TEXT),
university.Affiliation (TEXT),
university.Enrollment (INT),
university.Home_Conference (TEXT),
)
Possible JOINs:
major_ranking.University_ID = university.University_ID
major_ranking.Major_ID = major.Major_ID
overall_ranking.University_ID = university.University_ID
| SELECT team_name FROM university WHERE enrollment > (SELECT avg(enrollment) FROM university) | {
'university': ['university_id', 'team_name', 'enrollment']
} | CREATE TABLE major (
major.Major_ID (INT),
major.Major_Name (TEXT),
major.Major_Code (INT),
)
CREATE TABLE major_ranking (
major_ranking.Rank (INT),
major_ranking.University_ID (INT),
major_ranking.Major_ID (INT),
)
CREATE TABLE overall_ranking (
overall_ranking.Rank (INT),
overall_ranking.University_ID (INT),
overall_ranking.Reputation_point (INT),
overall_ranking.Research_point (INT),
overall_ranking.Citation_point (INT),
overall_ranking.Total (INT),
)
CREATE TABLE university (
university.University_ID (INT),
university.University_Name (TEXT),
university.City (TEXT),
university.State (TEXT),
university.Team_Name (TEXT),
university.Affiliation (TEXT),
university.Enrollment (INT),
university.Home_Conference (TEXT),
)
Possible JOINs:
major_ranking.University_ID = university.University_ID
major_ranking.Major_ID = major.Major_ID
overall_ranking.University_ID = university.University_ID
| Table major (
major.major_id (INT),
major.major_name (TEXT),
major.major_code (INT),
)
Table major_ranking (
major_ranking.rank (INT),
major_ranking.university_id (INT),
major_ranking.major_id (INT),
)
Table overall_ranking (
overall_ranking.rank (INT),
overall_ranking.university_id (INT),
overall_ranking.reputation_point (INT),
overall_ranking.research_point (INT),
overall_ranking.citation_point (INT),
overall_ranking.total (INT),
)
Table university (
university.university_id (INT),
university.university_name (TEXT),
university.city (TEXT),
university.state (TEXT),
university.team_name (TEXT),
university.affiliation (TEXT),
university.enrollment (INT),
university.home_conference (TEXT),
)
Possible JOINs:
major_ranking.university_id = university.university_id
major_ranking.major_id = major.major_id
overall_ranking.university_id = university.university_id
| CREATE TABLE major (
major.major_id (INT),
major.major_name (TEXT),
major.major_code (INT),
)
CREATE TABLE major_ranking (
major_ranking.rank (INT),
major_ranking.university_id (INT),
major_ranking.major_id (INT),
)
CREATE TABLE overall_ranking (
overall_ranking.rank (INT),
overall_ranking.university_id (INT),
overall_ranking.reputation_point (INT),
overall_ranking.research_point (INT),
overall_ranking.citation_point (INT),
overall_ranking.total (INT),
)
CREATE TABLE university (
university.university_id (INT),
university.university_name (TEXT),
university.city (TEXT),
university.state (TEXT),
university.team_name (TEXT),
university.affiliation (TEXT),
university.enrollment (INT),
university.home_conference (TEXT),
)
Possible JOINs:
major_ranking.university_id = university.university_id
major_ranking.major_id = major.major_id
overall_ranking.university_id = university.university_id
| Table major (
major.major_id (INT),
major.major_name (TEXT),
major.major_code (INT),
)
Table major_ranking (
major_ranking.rank (INT),
major_ranking.university_id (INT),
major_ranking.major_id (INT),
)
Table overall_ranking (
overall_ranking.rank (INT),
overall_ranking.university_id (INT),
overall_ranking.reputation_point (INT),
overall_ranking.research_point (INT),
overall_ranking.citation_point (INT),
overall_ranking.total (INT),
)
Table university (
university.university_id (INT),
university.university_name (TEXT),
university.city (TEXT),
university.state (TEXT),
university.team_name (TEXT),
university.affiliation (TEXT),
university.enrollment (INT),
university.home_conference (TEXT),
)
Possible JOINs:
major_ranking.university_id = university.university_id
major_ranking.major_id = major.major_id
overall_ranking.university_id = university.university_id
| CREATE TABLE major (
major.major_id (INT),
major.major_name (TEXT),
major.major_code (INT),
)
CREATE TABLE major_ranking (
major_ranking.rank (INT),
major_ranking.university_id (INT),
major_ranking.major_id (INT),
)
CREATE TABLE overall_ranking (
overall_ranking.rank (INT),
overall_ranking.university_id (INT),
overall_ranking.reputation_point (INT),
overall_ranking.research_point (INT),
overall_ranking.citation_point (INT),
overall_ranking.total (INT),
)
CREATE TABLE university (
university.university_id (INT),
university.university_name (TEXT),
university.city (TEXT),
university.state (TEXT),
university.team_name (TEXT),
university.affiliation (TEXT),
university.enrollment (INT),
university.home_conference (TEXT),
)
Possible JOINs:
major_ranking.university_id = university.university_id
major_ranking.major_id = major.major_id
overall_ranking.university_id = university.university_id
| {
'university': ['University_ID', 'University_Name', 'City', 'State', 'Team_Name', 'Affiliation', 'Enrollment', 'Home_Conference'],
'overall_ranking': ['Rank', 'University_ID', 'Reputation_point', 'Research_point', 'Citation_point', 'Total'],
'major': ['Major_ID', 'Major_Name', 'Major_Code'],
'major_ranking': ['Rank', 'University_ID', 'Major_ID']
} | {
'university': ['University_ID', 'Team_Name', 'Enrollment']
} | TABLE major (
major.Major_ID (INT),
major.Major_Name (TEXT),
major.Major_Code (INT),
)
TABLE major_ranking (
major_ranking.Rank (INT),
major_ranking.University_ID (INT),
major_ranking.Major_ID (INT),
)
TABLE overall_ranking (
overall_ranking.Rank (INT),
overall_ranking.University_ID (INT),
overall_ranking.Reputation_point (INT),
overall_ranking.Research_point (INT),
overall_ranking.Citation_point (INT),
overall_ranking.Total (INT),
)
TABLE university (
university.University_ID (INT),
university.University_Name (TEXT),
university.City (TEXT),
university.State (TEXT),
university.Team_Name (TEXT),
university.Affiliation (TEXT),
university.Enrollment (INT),
university.Home_Conference (TEXT),
)
Possible JOINs:
major_ranking.University_ID = university.University_ID
major_ranking.Major_ID = major.Major_ID
overall_ranking.University_ID = university.University_ID
| TABLE major (
major.major_id (INT),
major.major_name (TEXT),
major.major_code (INT),
)
TABLE major_ranking (
major_ranking.rank (INT),
major_ranking.university_id (INT),
major_ranking.major_id (INT),
)
TABLE overall_ranking (
overall_ranking.rank (INT),
overall_ranking.university_id (INT),
overall_ranking.reputation_point (INT),
overall_ranking.research_point (INT),
overall_ranking.citation_point (INT),
overall_ranking.total (INT),
)
TABLE university (
university.university_id (INT),
university.university_name (TEXT),
university.city (TEXT),
university.state (TEXT),
university.team_name (TEXT),
university.affiliation (TEXT),
university.enrollment (INT),
university.home_conference (TEXT),
)
Possible JOINs:
major_ranking.university_id = university.university_id
major_ranking.major_id = major.major_id
overall_ranking.university_id = university.university_id
| TABLE major (
major.major_id (INT),
major.major_name (TEXT),
major.major_code (INT),
)
TABLE major_ranking (
major_ranking.rank (INT),
major_ranking.university_id (INT),
major_ranking.major_id (INT),
)
TABLE overall_ranking (
overall_ranking.rank (INT),
overall_ranking.university_id (INT),
overall_ranking.reputation_point (INT),
overall_ranking.research_point (INT),
overall_ranking.citation_point (INT),
overall_ranking.total (INT),
)
TABLE university (
university.university_id (INT),
university.university_name (TEXT),
university.city (TEXT),
university.state (TEXT),
university.team_name (TEXT),
university.affiliation (TEXT),
university.enrollment (INT),
university.home_conference (TEXT),
)
Possible JOINs:
major_ranking.university_id = university.university_id
major_ranking.major_id = major.major_id
overall_ranking.university_id = university.university_id
|
book_1 |
CREATE TABLE Client
(IdClient CHAR(10) PRIMARY KEY,
Name VARCHAR(25) NOT NULL,
Address VARCHAR(60) NOT NULL,
NumCC CHAR(16) NOT NULL)
/*
0 rows from Client table:
IdClient Name Address NumCC
*/
CREATE TABLE Orders
(IdOrder CHAR(10) PRIMARY KEY,
IdClient CHAR(10) NOT NULL REFERENCES Client on delete cascade,
DateOrder DATE,
DateExped DATE)
/*
0 rows from Orders table:
IdOrder IdClient DateOrder DateExped
*/
CREATE TABLE Author
( idAuthor NUMBER PRIMARY KEY,
Name VARCHAR(25))
/*
0 rows from Author table:
idAuthor Name
*/
CREATE TABLE Book
(ISBN CHAR(15) PRIMARY KEY,
Title VARCHAR(60) NOT NULL,
Author CHAR(4) NOT NULL,
PurchasePrice NUMBER(6,2) DEFAULT 0,
SalePrice NUMBER(6,2) DEFAULT 0)
/*
0 rows from Book table:
ISBN Title Author PurchasePrice SalePrice
*/
CREATE TABLE Author_Book
(ISBN CHAR(15),
Author NUMBER,
CONSTRAINT al_PK PRIMARY KEY (ISBN, Author),
CONSTRAINT BookA_FK FOREIGN KEY (ISBN) REFERENCES `Book`(ISBN) on delete cascade,
CONSTRAINT Author_FK FOREIGN KEY (Author) REFERENCES `Author`(idAuthorA))
/*
0 rows from Author_Book table:
ISBN Author
*/
CREATE TABLE Books_Order(
ISBN CHAR(15),
IdOrder CHAR(10),
amount NUMBER(3) CHECK (amount >0),
CONSTRAINT lp_PK PRIMARY KEY (ISBN, idOrder),
CONSTRAINT Book_FK FOREIGN KEY (ISBN) REFERENCES `Book`(ISBN) on delete cascade,
CONSTRAINT pedido_FK FOREIGN KEY (IdOrder) REFERENCES `Orders`(IdOrder) on delete cascade)
/*
0 rows from Books_Order table:
ISBN IdOrder amount
*/
| What is the maximum difference between the sale price and purchase price? | easy | Table Author (
Author.idAuthor (NUMBER),
Author.Name (VARCHAR(25)),
)
Table Author_Book (
Author_Book.ISBN (CHAR(15)),
Author_Book.Author (NUMBER),
)
Table Book (
Book.ISBN (CHAR(15)),
Book.Title (VARCHAR(60)),
Book.Author (CHAR(4)),
Book.PurchasePrice (NUMBER(6,2)),
Book.SalePrice (NUMBER(6,2)),
)
Table Books_Order (
Books_Order.ISBN (CHAR(15)),
Books_Order.IdOrder (CHAR(10)),
Books_Order.amount (NUMBER(3)),
)
Table Client (
Client.IdClient (CHAR(10)),
Client.Name (VARCHAR(25)),
Client.Address (VARCHAR(60)),
Client.NumCC (CHAR(16)),
)
Table Orders (
Orders.IdOrder (CHAR(10)),
Orders.IdClient (CHAR(10)),
Orders.DateOrder (DATE),
Orders.DateExped (DATE),
)
Possible JOINs:
Author_Book.ISBN = Book.ISBN
Author_Book.Author = Author.idAuthorA
Books_Order.ISBN = Book.ISBN
Books_Order.IdOrder = Orders.IdOrder
Orders.IdClient = Client.IdClient
| SELECT max(saleprice - purchaseprice) FROM Book | {
'book': ['isbn', 'purchaseprice', 'saleprice']
} | CREATE TABLE Author (
Author.idAuthor (NUMBER),
Author.Name (VARCHAR(25)),
)
CREATE TABLE Author_Book (
Author_Book.ISBN (CHAR(15)),
Author_Book.Author (NUMBER),
)
CREATE TABLE Book (
Book.ISBN (CHAR(15)),
Book.Title (VARCHAR(60)),
Book.Author (CHAR(4)),
Book.PurchasePrice (NUMBER(6,2)),
Book.SalePrice (NUMBER(6,2)),
)
CREATE TABLE Books_Order (
Books_Order.ISBN (CHAR(15)),
Books_Order.IdOrder (CHAR(10)),
Books_Order.amount (NUMBER(3)),
)
CREATE TABLE Client (
Client.IdClient (CHAR(10)),
Client.Name (VARCHAR(25)),
Client.Address (VARCHAR(60)),
Client.NumCC (CHAR(16)),
)
CREATE TABLE Orders (
Orders.IdOrder (CHAR(10)),
Orders.IdClient (CHAR(10)),
Orders.DateOrder (DATE),
Orders.DateExped (DATE),
)
Possible JOINs:
Author_Book.ISBN = Book.ISBN
Author_Book.Author = Author.idAuthorA
Books_Order.ISBN = Book.ISBN
Books_Order.IdOrder = Orders.IdOrder
Orders.IdClient = Client.IdClient
| Table Author (
Author.idauthor (NUMBER),
Author.name (VARCHAR(25)),
)
Table Author_Book (
Author_Book.isbn (CHAR(15)),
Author_Book.author (NUMBER),
)
Table Book (
Book.isbn (CHAR(15)),
Book.title (VARCHAR(60)),
Book.author (CHAR(4)),
Book.purchaseprice (NUMBER(6,2)),
Book.saleprice (NUMBER(6,2)),
)
Table Books_Order (
Books_Order.isbn (CHAR(15)),
Books_Order.idorder (CHAR(10)),
Books_Order.amount (NUMBER(3)),
)
Table Client (
Client.idclient (CHAR(10)),
Client.name (VARCHAR(25)),
Client.address (VARCHAR(60)),
Client.numcc (CHAR(16)),
)
Table Orders (
Orders.idorder (CHAR(10)),
Orders.idclient (CHAR(10)),
Orders.dateorder (DATE),
Orders.dateexped (DATE),
)
Possible JOINs:
Author_Book.isbn = Book.isbn
Author_Book.author = Author.idauthora
Books_Order.isbn = Book.isbn
Books_Order.idorder = Orders.idorder
Orders.idclient = Client.idclient
| CREATE TABLE Author (
Author.idauthor (NUMBER),
Author.name (VARCHAR(25)),
)
CREATE TABLE Author_Book (
Author_Book.isbn (CHAR(15)),
Author_Book.author (NUMBER),
)
CREATE TABLE Book (
Book.isbn (CHAR(15)),
Book.title (VARCHAR(60)),
Book.author (CHAR(4)),
Book.purchaseprice (NUMBER(6,2)),
Book.saleprice (NUMBER(6,2)),
)
CREATE TABLE Books_Order (
Books_Order.isbn (CHAR(15)),
Books_Order.idorder (CHAR(10)),
Books_Order.amount (NUMBER(3)),
)
CREATE TABLE Client (
Client.idclient (CHAR(10)),
Client.name (VARCHAR(25)),
Client.address (VARCHAR(60)),
Client.numcc (CHAR(16)),
)
CREATE TABLE Orders (
Orders.idorder (CHAR(10)),
Orders.idclient (CHAR(10)),
Orders.dateorder (DATE),
Orders.dateexped (DATE),
)
Possible JOINs:
Author_Book.isbn = Book.isbn
Author_Book.author = Author.idauthora
Books_Order.isbn = Book.isbn
Books_Order.idorder = Orders.idorder
Orders.idclient = Client.idclient
| Table author (
author.idauthor (NUMBER),
author.name (VARCHAR(25)),
)
Table author_book (
author_book.isbn (CHAR(15)),
author_book.author (NUMBER),
)
Table book (
book.isbn (CHAR(15)),
book.title (VARCHAR(60)),
book.author (CHAR(4)),
book.purchaseprice (NUMBER(6,2)),
book.saleprice (NUMBER(6,2)),
)
Table books_order (
books_order.isbn (CHAR(15)),
books_order.idorder (CHAR(10)),
books_order.amount (NUMBER(3)),
)
Table client (
client.idclient (CHAR(10)),
client.name (VARCHAR(25)),
client.address (VARCHAR(60)),
client.numcc (CHAR(16)),
)
Table orders (
orders.idorder (CHAR(10)),
orders.idclient (CHAR(10)),
orders.dateorder (DATE),
orders.dateexped (DATE),
)
Possible JOINs:
author_book.isbn = book.isbn
author_book.author = author.idauthora
books_order.isbn = book.isbn
books_order.idorder = orders.idorder
orders.idclient = client.idclient
| CREATE TABLE author (
author.idauthor (NUMBER),
author.name (VARCHAR(25)),
)
CREATE TABLE author_book (
author_book.isbn (CHAR(15)),
author_book.author (NUMBER),
)
CREATE TABLE book (
book.isbn (CHAR(15)),
book.title (VARCHAR(60)),
book.author (CHAR(4)),
book.purchaseprice (NUMBER(6,2)),
book.saleprice (NUMBER(6,2)),
)
CREATE TABLE books_order (
books_order.isbn (CHAR(15)),
books_order.idorder (CHAR(10)),
books_order.amount (NUMBER(3)),
)
CREATE TABLE client (
client.idclient (CHAR(10)),
client.name (VARCHAR(25)),
client.address (VARCHAR(60)),
client.numcc (CHAR(16)),
)
CREATE TABLE orders (
orders.idorder (CHAR(10)),
orders.idclient (CHAR(10)),
orders.dateorder (DATE),
orders.dateexped (DATE),
)
Possible JOINs:
author_book.isbn = book.isbn
author_book.author = author.idauthora
books_order.isbn = book.isbn
books_order.idorder = orders.idorder
orders.idclient = client.idclient
| {
'Client': ['IdClient', 'Name', 'Address', 'NumCC'],
'Orders': ['IdOrder', 'IdClient', 'DateOrder', 'DateExped'],
'Author': ['idAuthor', 'Name'],
'Book': ['ISBN', 'Title', 'Author', 'PurchasePrice', 'SalePrice'],
'Author_Book': ['ISBN', 'Author'],
'Books_Order': ['ISBN', 'IdOrder', 'amount']
} | {
'Book': ['ISBN', 'PurchasePrice', 'SalePrice']
} | TABLE Author (
Author.idAuthor (NUMBER),
Author.Name (VARCHAR(25)),
)
TABLE Author_Book (
Author_Book.ISBN (CHAR(15)),
Author_Book.Author (NUMBER),
)
TABLE Book (
Book.ISBN (CHAR(15)),
Book.Title (VARCHAR(60)),
Book.Author (CHAR(4)),
Book.PurchasePrice (NUMBER(6,2)),
Book.SalePrice (NUMBER(6,2)),
)
TABLE Books_Order (
Books_Order.ISBN (CHAR(15)),
Books_Order.IdOrder (CHAR(10)),
Books_Order.amount (NUMBER(3)),
)
TABLE Client (
Client.IdClient (CHAR(10)),
Client.Name (VARCHAR(25)),
Client.Address (VARCHAR(60)),
Client.NumCC (CHAR(16)),
)
TABLE Orders (
Orders.IdOrder (CHAR(10)),
Orders.IdClient (CHAR(10)),
Orders.DateOrder (DATE),
Orders.DateExped (DATE),
)
Possible JOINs:
Author_Book.ISBN = Book.ISBN
Author_Book.Author = Author.idAuthorA
Books_Order.ISBN = Book.ISBN
Books_Order.IdOrder = Orders.IdOrder
Orders.IdClient = Client.IdClient
| TABLE Author (
Author.idauthor (NUMBER),
Author.name (VARCHAR(25)),
)
TABLE Author_Book (
Author_Book.isbn (CHAR(15)),
Author_Book.author (NUMBER),
)
TABLE Book (
Book.isbn (CHAR(15)),
Book.title (VARCHAR(60)),
Book.author (CHAR(4)),
Book.purchaseprice (NUMBER(6,2)),
Book.saleprice (NUMBER(6,2)),
)
TABLE Books_Order (
Books_Order.isbn (CHAR(15)),
Books_Order.idorder (CHAR(10)),
Books_Order.amount (NUMBER(3)),
)
TABLE Client (
Client.idclient (CHAR(10)),
Client.name (VARCHAR(25)),
Client.address (VARCHAR(60)),
Client.numcc (CHAR(16)),
)
TABLE Orders (
Orders.idorder (CHAR(10)),
Orders.idclient (CHAR(10)),
Orders.dateorder (DATE),
Orders.dateexped (DATE),
)
Possible JOINs:
Author_Book.isbn = Book.isbn
Author_Book.author = Author.idauthora
Books_Order.isbn = Book.isbn
Books_Order.idorder = Orders.idorder
Orders.idclient = Client.idclient
| TABLE author (
author.idauthor (NUMBER),
author.name (VARCHAR(25)),
)
TABLE author_book (
author_book.isbn (CHAR(15)),
author_book.author (NUMBER),
)
TABLE book (
book.isbn (CHAR(15)),
book.title (VARCHAR(60)),
book.author (CHAR(4)),
book.purchaseprice (NUMBER(6,2)),
book.saleprice (NUMBER(6,2)),
)
TABLE books_order (
books_order.isbn (CHAR(15)),
books_order.idorder (CHAR(10)),
books_order.amount (NUMBER(3)),
)
TABLE client (
client.idclient (CHAR(10)),
client.name (VARCHAR(25)),
client.address (VARCHAR(60)),
client.numcc (CHAR(16)),
)
TABLE orders (
orders.idorder (CHAR(10)),
orders.idclient (CHAR(10)),
orders.dateorder (DATE),
orders.dateexped (DATE),
)
Possible JOINs:
author_book.isbn = book.isbn
author_book.author = author.idauthora
books_order.isbn = book.isbn
books_order.idorder = orders.idorder
orders.idclient = client.idclient
|
pilot_1 |
CREATE TABLE "Hangar" (
plane_name CHAR(15) NOT NULL,
location CHAR(15),
PRIMARY KEY (plane_name)
)
CREATE TABLE "PilotSkills" (
pilot_name CHAR(15) NOT NULL,
plane_name CHAR(15) NOT NULL,
age INTEGER,
PRIMARY KEY (pilot_name, plane_name),
FOREIGN KEY(plane_name) REFERENCES "Hangar" (plane_name)
) | What are the names and ages of pilots who own plane Piper Cub and are older than 35, or have F-14 Fighter and are younger than 30? | extra | Table Hangar (
Hangar.plane_name (CHAR(15)),
Hangar.location (CHAR(15)),
)
Table PilotSkills (
PilotSkills.pilot_name (CHAR(15)),
PilotSkills.plane_name (CHAR(15)),
PilotSkills.age (INTEGER),
)
Possible JOINs:
PilotSkills.plane_name = Hangar.plane_name
| SELECT pilot_name , age FROM pilotskills WHERE plane_name = 'Piper Cub' AND age > 35 UNION SELECT pilot_name , age FROM pilotskills WHERE plane_name = 'F-14 Fighter' AND age < 30 | {
'pilotskills': ['pilot_name', 'plane_name', 'age']
} | CREATE TABLE Hangar (
Hangar.plane_name (CHAR(15)),
Hangar.location (CHAR(15)),
)
CREATE TABLE PilotSkills (
PilotSkills.pilot_name (CHAR(15)),
PilotSkills.plane_name (CHAR(15)),
PilotSkills.age (INTEGER),
)
Possible JOINs:
PilotSkills.plane_name = Hangar.plane_name
| Table Hangar (
Hangar.plane_name (CHAR(15)),
Hangar.location (CHAR(15)),
)
Table PilotSkills (
PilotSkills.pilot_name (CHAR(15)),
PilotSkills.plane_name (CHAR(15)),
PilotSkills.age (INTEGER),
)
Possible JOINs:
PilotSkills.plane_name = Hangar.plane_name
| CREATE TABLE Hangar (
Hangar.plane_name (CHAR(15)),
Hangar.location (CHAR(15)),
)
CREATE TABLE PilotSkills (
PilotSkills.pilot_name (CHAR(15)),
PilotSkills.plane_name (CHAR(15)),
PilotSkills.age (INTEGER),
)
Possible JOINs:
PilotSkills.plane_name = Hangar.plane_name
| Table hangar (
hangar.plane_name (CHAR(15)),
hangar.location (CHAR(15)),
)
Table pilotskills (
pilotskills.pilot_name (CHAR(15)),
pilotskills.plane_name (CHAR(15)),
pilotskills.age (INTEGER),
)
Possible JOINs:
pilotskills.plane_name = hangar.plane_name
| CREATE TABLE hangar (
hangar.plane_name (CHAR(15)),
hangar.location (CHAR(15)),
)
CREATE TABLE pilotskills (
pilotskills.pilot_name (CHAR(15)),
pilotskills.plane_name (CHAR(15)),
pilotskills.age (INTEGER),
)
Possible JOINs:
pilotskills.plane_name = hangar.plane_name
| {
'PilotSkills': ['pilot_name', 'plane_name', 'age'],
'Hangar': ['plane_name', 'location']
} | {
'PilotSkills': ['pilot_name', 'plane_name', 'age']
} | TABLE Hangar (
Hangar.plane_name (CHAR(15)),
Hangar.location (CHAR(15)),
)
TABLE PilotSkills (
PilotSkills.pilot_name (CHAR(15)),
PilotSkills.plane_name (CHAR(15)),
PilotSkills.age (INTEGER),
)
Possible JOINs:
PilotSkills.plane_name = Hangar.plane_name
| TABLE Hangar (
Hangar.plane_name (CHAR(15)),
Hangar.location (CHAR(15)),
)
TABLE PilotSkills (
PilotSkills.pilot_name (CHAR(15)),
PilotSkills.plane_name (CHAR(15)),
PilotSkills.age (INTEGER),
)
Possible JOINs:
PilotSkills.plane_name = Hangar.plane_name
| TABLE hangar (
hangar.plane_name (CHAR(15)),
hangar.location (CHAR(15)),
)
TABLE pilotskills (
pilotskills.pilot_name (CHAR(15)),
pilotskills.plane_name (CHAR(15)),
pilotskills.age (INTEGER),
)
Possible JOINs:
pilotskills.plane_name = hangar.plane_name
|
cre_Students_Information_Systems |
CREATE TABLE Students (
`student_id` INTEGER NOT NULL,
`bio_data` VARCHAR(255) NOT NULL,
`student_details` VARCHAR(255) NOT NULL,
PRIMARY KEY (`student_id`)
)
/*
0 rows from Students table:
student_id bio_data student_details
*/
CREATE TABLE Transcripts (
`transcript_id` INTEGER NOT NULL,
`student_id` INTEGER NOT NULL,
`date_of_transcript` DATETIME(3),
`transcript_details` VARCHAR(255) NOT NULL,
PRIMARY KEY (`transcript_id`),
FOREIGN KEY (student_id) REFERENCES Students (student_id)
)
/*
0 rows from Transcripts table:
transcript_id student_id date_of_transcript transcript_details
*/
CREATE TABLE Behaviour_Monitoring (
`behaviour_monitoring_id` INTEGER NOT NULL,
`student_id` INTEGER NOT NULL,
`behaviour_monitoring_details` VARCHAR(255) NOT NULL,
PRIMARY KEY (`behaviour_monitoring_id`),
FOREIGN KEY (student_id) REFERENCES Students (student_id)
)
/*
0 rows from Behaviour_Monitoring table:
behaviour_monitoring_id student_id behaviour_monitoring_details
*/
CREATE TABLE Addresses (
`address_id` INTEGER NOT NULL,
`address_details` VARCHAR(255) NOT NULL,
PRIMARY KEY (`address_id`)
)
/*
0 rows from Addresses table:
address_id address_details
*/
CREATE TABLE Ref_Event_Types (
`event_type_code` CHAR(10) NOT NULL,
`event_type_description` VARCHAR(255) NOT NULL,
PRIMARY KEY (`event_type_code`)
)
/*
0 rows from Ref_Event_Types table:
event_type_code event_type_description
*/
CREATE TABLE Ref_Achievement_Type (
`achievement_type_code` CHAR(15) NOT NULL,
`achievement_type_description` VARCHAR(80),
PRIMARY KEY (`achievement_type_code`)
)
/*
0 rows from Ref_Achievement_Type table:
achievement_type_code achievement_type_description
*/
CREATE TABLE Ref_Address_Types (
`address_type_code` CHAR(10) NOT NULL,
`address_type_description` VARCHAR(255) NOT NULL,
PRIMARY KEY (`address_type_code`)
)
/*
0 rows from Ref_Address_Types table:
address_type_code address_type_description
*/
CREATE TABLE Ref_Detention_Type (
`detention_type_code` CHAR(10) NOT NULL,
`detention_type_description` VARCHAR(80),
PRIMARY KEY (`detention_type_code`)
)
/*
0 rows from Ref_Detention_Type table:
detention_type_code detention_type_description
*/
CREATE TABLE Student_Events (
`event_id` INTEGER NOT NULL,
`event_type_code` CHAR(10) NOT NULL,
`student_id` INTEGER NOT NULL,
`event_date` DATETIME(3),
`other_details` VARCHAR(255) NOT NULL,
PRIMARY KEY (`event_id`),
FOREIGN KEY (student_id) REFERENCES Students (student_id),
FOREIGN KEY (event_type_code) REFERENCES Ref_Event_Types (event_type_code)
)
/*
0 rows from Student_Events table:
event_id event_type_code student_id event_date other_details
*/
CREATE TABLE Teachers (
`teacher_id` INTEGER NOT NULL,
`teacher_details` VARCHAR(255),
PRIMARY KEY (`teacher_id`)
)
/*
0 rows from Teachers table:
teacher_id teacher_details
*/
CREATE TABLE Student_Loans (
`student_loan_id` INTEGER NOT NULL,
`student_id` INTEGER NOT NULL,
`date_of_loan` DATETIME(3),
`amount_of_loan` DECIMAL(15,4),
`other_details` VARCHAR(255),
PRIMARY KEY (`student_loan_id`),
FOREIGN KEY (student_id) REFERENCES Students (student_id)
)
/*
0 rows from Student_Loans table:
student_loan_id student_id date_of_loan amount_of_loan other_details
*/
CREATE TABLE Classes (
`class_id` INTEGER NOT NULL,
`student_id` INTEGER NOT NULL,
`teacher_id` INTEGER NOT NULL,
`class_details` VARCHAR(255) NOT NULL,
PRIMARY KEY (`class_id`),
FOREIGN KEY (student_id) REFERENCES Students (student_id),
FOREIGN KEY (teacher_id) REFERENCES Teachers (teacher_id)
)
/*
0 rows from Classes table:
class_id student_id teacher_id class_details
*/
CREATE TABLE Students_Addresses (
`student_address_id` INTEGER NOT NULL,
`address_id` INTEGER NOT NULL,
`address_type_code` CHAR(10) NOT NULL,
`student_id` INTEGER NOT NULL,
`date_from` DATETIME(3),
`date_to` DATETIME(3),
PRIMARY KEY (`student_address_id`),
FOREIGN KEY (student_id) REFERENCES Students (student_id),
FOREIGN KEY (address_id) REFERENCES Addresses (address_id),
FOREIGN KEY (address_type_code) REFERENCES Ref_Address_Types (address_type_code)
)
/*
0 rows from Students_Addresses table:
student_address_id address_id address_type_code student_id date_from date_to
*/
CREATE TABLE Detention (
`detention_id` INTEGER NOT NULL,
`detention_type_code` CHAR(10) NOT NULL,
`student_id` INTEGER NOT NULL,
`datetime_detention_start` DATETIME(3),
`datetime_detention_end` DATETIME(3),
`detention_summary` VARCHAR(255),
`other_details` VARCHAR(255),
PRIMARY KEY (`detention_id`),
FOREIGN KEY (student_id) REFERENCES Students (student_id),
FOREIGN KEY (detention_type_code) REFERENCES Ref_Detention_Type (detention_type_code)
)
/*
0 rows from Detention table:
detention_id detention_type_code student_id datetime_detention_start datetime_detention_end detention_summary other_details
*/
CREATE TABLE Achievements (
`achievement_id` INTEGER NOT NULL,
`achievement_type_code` CHAR(15) NOT NULL,
`student_id` INTEGER NOT NULL,
`date_achievement` DATETIME(3),
`achievement_details` VARCHAR(255),
`other_details` VARCHAR(255),
PRIMARY KEY (`achievement_id`),
FOREIGN KEY (student_id) REFERENCES Students (student_id),
FOREIGN KEY (achievement_type_code) REFERENCES Ref_Achievement_Type (achievement_type_code)
)
/*
0 rows from Achievements table:
achievement_id achievement_type_code student_id date_achievement achievement_details other_details
*/
| List the amount and date of loan for the students who have two or more achievements. | extra | Table Achievements (
Achievements.achievement_id (INTEGER),
Achievements.achievement_type_code (CHAR(15)),
Achievements.student_id (INTEGER),
Achievements.date_achievement (DATETIME(3)),
Achievements.achievement_details (VARCHAR(255)),
Achievements.other_details (VARCHAR(255)),
)
Table Addresses (
Addresses.address_id (INTEGER),
Addresses.address_details (VARCHAR(255)),
)
Table Behaviour_Monitoring (
Behaviour_Monitoring.behaviour_monitoring_id (INTEGER),
Behaviour_Monitoring.student_id (INTEGER),
Behaviour_Monitoring.behaviour_monitoring_details (VARCHAR(255)),
)
Table Classes (
Classes.class_id (INTEGER),
Classes.student_id (INTEGER),
Classes.teacher_id (INTEGER),
Classes.class_details (VARCHAR(255)),
)
Table Detention (
Detention.detention_id (INTEGER),
Detention.detention_type_code (CHAR(10)),
Detention.student_id (INTEGER),
Detention.datetime_detention_start (DATETIME(3)),
Detention.datetime_detention_end (DATETIME(3)),
Detention.detention_summary (VARCHAR(255)),
Detention.other_details (VARCHAR(255)),
)
Table Ref_Achievement_Type (
Ref_Achievement_Type.achievement_type_code (CHAR(15)),
Ref_Achievement_Type.achievement_type_description (VARCHAR(80)),
)
Table Ref_Address_Types (
Ref_Address_Types.address_type_code (CHAR(10)),
Ref_Address_Types.address_type_description (VARCHAR(255)),
)
Table Ref_Detention_Type (
Ref_Detention_Type.detention_type_code (CHAR(10)),
Ref_Detention_Type.detention_type_description (VARCHAR(80)),
)
Table Ref_Event_Types (
Ref_Event_Types.event_type_code (CHAR(10)),
Ref_Event_Types.event_type_description (VARCHAR(255)),
)
Table Student_Events (
Student_Events.event_id (INTEGER),
Student_Events.event_type_code (CHAR(10)),
Student_Events.student_id (INTEGER),
Student_Events.event_date (DATETIME(3)),
Student_Events.other_details (VARCHAR(255)),
)
Table Student_Loans (
Student_Loans.student_loan_id (INTEGER),
Student_Loans.student_id (INTEGER),
Student_Loans.date_of_loan (DATETIME(3)),
Student_Loans.amount_of_loan (DECIMAL(15,4)),
Student_Loans.other_details (VARCHAR(255)),
)
Table Students (
Students.student_id (INTEGER),
Students.bio_data (VARCHAR(255)),
Students.student_details (VARCHAR(255)),
)
Table Students_Addresses (
Students_Addresses.student_address_id (INTEGER),
Students_Addresses.address_id (INTEGER),
Students_Addresses.address_type_code (CHAR(10)),
Students_Addresses.student_id (INTEGER),
Students_Addresses.date_from (DATETIME(3)),
Students_Addresses.date_to (DATETIME(3)),
)
Table Teachers (
Teachers.teacher_id (INTEGER),
Teachers.teacher_details (VARCHAR(255)),
)
Table Transcripts (
Transcripts.transcript_id (INTEGER),
Transcripts.student_id (INTEGER),
Transcripts.date_of_transcript (DATETIME(3)),
Transcripts.transcript_details (VARCHAR(255)),
)
Possible JOINs:
Achievements.achievement_type_code = Ref_Achievement_Type.achievement_type_code
Achievements.student_id = Students.student_id
Behaviour_Monitoring.student_id = Students.student_id
Classes.student_id = Students.student_id
Classes.teacher_id = Teachers.teacher_id
Detention.detention_type_code = Ref_Detention_Type.detention_type_code
Detention.student_id = Students.student_id
Student_Events.event_type_code = Ref_Event_Types.event_type_code
Student_Events.student_id = Students.student_id
Student_Loans.student_id = Students.student_id
Students_Addresses.address_id = Addresses.address_id
Students_Addresses.address_type_code = Ref_Address_Types.address_type_code
Students_Addresses.student_id = Students.student_id
Transcripts.student_id = Students.student_id
| SELECT amount_of_loan , date_of_loan FROM Student_Loans WHERE student_id IN ( SELECT student_id FROM Achievements GROUP BY student_id HAVING count(*) >= 2 ) | {
'student_loans': ['student_loan_id', 'student_id', 'date_of_loan', 'amount_of_loan'],
'achievements': ['achievement_id', 'student_id']
} | CREATE TABLE Achievements (
Achievements.achievement_id (INTEGER),
Achievements.achievement_type_code (CHAR(15)),
Achievements.student_id (INTEGER),
Achievements.date_achievement (DATETIME(3)),
Achievements.achievement_details (VARCHAR(255)),
Achievements.other_details (VARCHAR(255)),
)
CREATE TABLE Addresses (
Addresses.address_id (INTEGER),
Addresses.address_details (VARCHAR(255)),
)
CREATE TABLE Behaviour_Monitoring (
Behaviour_Monitoring.behaviour_monitoring_id (INTEGER),
Behaviour_Monitoring.student_id (INTEGER),
Behaviour_Monitoring.behaviour_monitoring_details (VARCHAR(255)),
)
CREATE TABLE Classes (
Classes.class_id (INTEGER),
Classes.student_id (INTEGER),
Classes.teacher_id (INTEGER),
Classes.class_details (VARCHAR(255)),
)
CREATE TABLE Detention (
Detention.detention_id (INTEGER),
Detention.detention_type_code (CHAR(10)),
Detention.student_id (INTEGER),
Detention.datetime_detention_start (DATETIME(3)),
Detention.datetime_detention_end (DATETIME(3)),
Detention.detention_summary (VARCHAR(255)),
Detention.other_details (VARCHAR(255)),
)
CREATE TABLE Ref_Achievement_Type (
Ref_Achievement_Type.achievement_type_code (CHAR(15)),
Ref_Achievement_Type.achievement_type_description (VARCHAR(80)),
)
CREATE TABLE Ref_Address_Types (
Ref_Address_Types.address_type_code (CHAR(10)),
Ref_Address_Types.address_type_description (VARCHAR(255)),
)
CREATE TABLE Ref_Detention_Type (
Ref_Detention_Type.detention_type_code (CHAR(10)),
Ref_Detention_Type.detention_type_description (VARCHAR(80)),
)
CREATE TABLE Ref_Event_Types (
Ref_Event_Types.event_type_code (CHAR(10)),
Ref_Event_Types.event_type_description (VARCHAR(255)),
)
CREATE TABLE Student_Events (
Student_Events.event_id (INTEGER),
Student_Events.event_type_code (CHAR(10)),
Student_Events.student_id (INTEGER),
Student_Events.event_date (DATETIME(3)),
Student_Events.other_details (VARCHAR(255)),
)
CREATE TABLE Student_Loans (
Student_Loans.student_loan_id (INTEGER),
Student_Loans.student_id (INTEGER),
Student_Loans.date_of_loan (DATETIME(3)),
Student_Loans.amount_of_loan (DECIMAL(15,4)),
Student_Loans.other_details (VARCHAR(255)),
)
CREATE TABLE Students (
Students.student_id (INTEGER),
Students.bio_data (VARCHAR(255)),
Students.student_details (VARCHAR(255)),
)
CREATE TABLE Students_Addresses (
Students_Addresses.student_address_id (INTEGER),
Students_Addresses.address_id (INTEGER),
Students_Addresses.address_type_code (CHAR(10)),
Students_Addresses.student_id (INTEGER),
Students_Addresses.date_from (DATETIME(3)),
Students_Addresses.date_to (DATETIME(3)),
)
CREATE TABLE Teachers (
Teachers.teacher_id (INTEGER),
Teachers.teacher_details (VARCHAR(255)),
)
CREATE TABLE Transcripts (
Transcripts.transcript_id (INTEGER),
Transcripts.student_id (INTEGER),
Transcripts.date_of_transcript (DATETIME(3)),
Transcripts.transcript_details (VARCHAR(255)),
)
Possible JOINs:
Achievements.achievement_type_code = Ref_Achievement_Type.achievement_type_code
Achievements.student_id = Students.student_id
Behaviour_Monitoring.student_id = Students.student_id
Classes.student_id = Students.student_id
Classes.teacher_id = Teachers.teacher_id
Detention.detention_type_code = Ref_Detention_Type.detention_type_code
Detention.student_id = Students.student_id
Student_Events.event_type_code = Ref_Event_Types.event_type_code
Student_Events.student_id = Students.student_id
Student_Loans.student_id = Students.student_id
Students_Addresses.address_id = Addresses.address_id
Students_Addresses.address_type_code = Ref_Address_Types.address_type_code
Students_Addresses.student_id = Students.student_id
Transcripts.student_id = Students.student_id
| Table Achievements (
Achievements.achievement_id (INTEGER),
Achievements.achievement_type_code (CHAR(15)),
Achievements.student_id (INTEGER),
Achievements.date_achievement (DATETIME(3)),
Achievements.achievement_details (VARCHAR(255)),
Achievements.other_details (VARCHAR(255)),
)
Table Addresses (
Addresses.address_id (INTEGER),
Addresses.address_details (VARCHAR(255)),
)
Table Behaviour_Monitoring (
Behaviour_Monitoring.behaviour_monitoring_id (INTEGER),
Behaviour_Monitoring.student_id (INTEGER),
Behaviour_Monitoring.behaviour_monitoring_details (VARCHAR(255)),
)
Table Classes (
Classes.class_id (INTEGER),
Classes.student_id (INTEGER),
Classes.teacher_id (INTEGER),
Classes.class_details (VARCHAR(255)),
)
Table Detention (
Detention.detention_id (INTEGER),
Detention.detention_type_code (CHAR(10)),
Detention.student_id (INTEGER),
Detention.datetime_detention_start (DATETIME(3)),
Detention.datetime_detention_end (DATETIME(3)),
Detention.detention_summary (VARCHAR(255)),
Detention.other_details (VARCHAR(255)),
)
Table Ref_Achievement_Type (
Ref_Achievement_Type.achievement_type_code (CHAR(15)),
Ref_Achievement_Type.achievement_type_description (VARCHAR(80)),
)
Table Ref_Address_Types (
Ref_Address_Types.address_type_code (CHAR(10)),
Ref_Address_Types.address_type_description (VARCHAR(255)),
)
Table Ref_Detention_Type (
Ref_Detention_Type.detention_type_code (CHAR(10)),
Ref_Detention_Type.detention_type_description (VARCHAR(80)),
)
Table Ref_Event_Types (
Ref_Event_Types.event_type_code (CHAR(10)),
Ref_Event_Types.event_type_description (VARCHAR(255)),
)
Table Student_Events (
Student_Events.event_id (INTEGER),
Student_Events.event_type_code (CHAR(10)),
Student_Events.student_id (INTEGER),
Student_Events.event_date (DATETIME(3)),
Student_Events.other_details (VARCHAR(255)),
)
Table Student_Loans (
Student_Loans.student_loan_id (INTEGER),
Student_Loans.student_id (INTEGER),
Student_Loans.date_of_loan (DATETIME(3)),
Student_Loans.amount_of_loan (DECIMAL(15,4)),
Student_Loans.other_details (VARCHAR(255)),
)
Table Students (
Students.student_id (INTEGER),
Students.bio_data (VARCHAR(255)),
Students.student_details (VARCHAR(255)),
)
Table Students_Addresses (
Students_Addresses.student_address_id (INTEGER),
Students_Addresses.address_id (INTEGER),
Students_Addresses.address_type_code (CHAR(10)),
Students_Addresses.student_id (INTEGER),
Students_Addresses.date_from (DATETIME(3)),
Students_Addresses.date_to (DATETIME(3)),
)
Table Teachers (
Teachers.teacher_id (INTEGER),
Teachers.teacher_details (VARCHAR(255)),
)
Table Transcripts (
Transcripts.transcript_id (INTEGER),
Transcripts.student_id (INTEGER),
Transcripts.date_of_transcript (DATETIME(3)),
Transcripts.transcript_details (VARCHAR(255)),
)
Possible JOINs:
Achievements.achievement_type_code = Ref_Achievement_Type.achievement_type_code
Achievements.student_id = Students.student_id
Behaviour_Monitoring.student_id = Students.student_id
Classes.student_id = Students.student_id
Classes.teacher_id = Teachers.teacher_id
Detention.detention_type_code = Ref_Detention_Type.detention_type_code
Detention.student_id = Students.student_id
Student_Events.event_type_code = Ref_Event_Types.event_type_code
Student_Events.student_id = Students.student_id
Student_Loans.student_id = Students.student_id
Students_Addresses.address_id = Addresses.address_id
Students_Addresses.address_type_code = Ref_Address_Types.address_type_code
Students_Addresses.student_id = Students.student_id
Transcripts.student_id = Students.student_id
| CREATE TABLE Achievements (
Achievements.achievement_id (INTEGER),
Achievements.achievement_type_code (CHAR(15)),
Achievements.student_id (INTEGER),
Achievements.date_achievement (DATETIME(3)),
Achievements.achievement_details (VARCHAR(255)),
Achievements.other_details (VARCHAR(255)),
)
CREATE TABLE Addresses (
Addresses.address_id (INTEGER),
Addresses.address_details (VARCHAR(255)),
)
CREATE TABLE Behaviour_Monitoring (
Behaviour_Monitoring.behaviour_monitoring_id (INTEGER),
Behaviour_Monitoring.student_id (INTEGER),
Behaviour_Monitoring.behaviour_monitoring_details (VARCHAR(255)),
)
CREATE TABLE Classes (
Classes.class_id (INTEGER),
Classes.student_id (INTEGER),
Classes.teacher_id (INTEGER),
Classes.class_details (VARCHAR(255)),
)
CREATE TABLE Detention (
Detention.detention_id (INTEGER),
Detention.detention_type_code (CHAR(10)),
Detention.student_id (INTEGER),
Detention.datetime_detention_start (DATETIME(3)),
Detention.datetime_detention_end (DATETIME(3)),
Detention.detention_summary (VARCHAR(255)),
Detention.other_details (VARCHAR(255)),
)
CREATE TABLE Ref_Achievement_Type (
Ref_Achievement_Type.achievement_type_code (CHAR(15)),
Ref_Achievement_Type.achievement_type_description (VARCHAR(80)),
)
CREATE TABLE Ref_Address_Types (
Ref_Address_Types.address_type_code (CHAR(10)),
Ref_Address_Types.address_type_description (VARCHAR(255)),
)
CREATE TABLE Ref_Detention_Type (
Ref_Detention_Type.detention_type_code (CHAR(10)),
Ref_Detention_Type.detention_type_description (VARCHAR(80)),
)
CREATE TABLE Ref_Event_Types (
Ref_Event_Types.event_type_code (CHAR(10)),
Ref_Event_Types.event_type_description (VARCHAR(255)),
)
CREATE TABLE Student_Events (
Student_Events.event_id (INTEGER),
Student_Events.event_type_code (CHAR(10)),
Student_Events.student_id (INTEGER),
Student_Events.event_date (DATETIME(3)),
Student_Events.other_details (VARCHAR(255)),
)
CREATE TABLE Student_Loans (
Student_Loans.student_loan_id (INTEGER),
Student_Loans.student_id (INTEGER),
Student_Loans.date_of_loan (DATETIME(3)),
Student_Loans.amount_of_loan (DECIMAL(15,4)),
Student_Loans.other_details (VARCHAR(255)),
)
CREATE TABLE Students (
Students.student_id (INTEGER),
Students.bio_data (VARCHAR(255)),
Students.student_details (VARCHAR(255)),
)
CREATE TABLE Students_Addresses (
Students_Addresses.student_address_id (INTEGER),
Students_Addresses.address_id (INTEGER),
Students_Addresses.address_type_code (CHAR(10)),
Students_Addresses.student_id (INTEGER),
Students_Addresses.date_from (DATETIME(3)),
Students_Addresses.date_to (DATETIME(3)),
)
CREATE TABLE Teachers (
Teachers.teacher_id (INTEGER),
Teachers.teacher_details (VARCHAR(255)),
)
CREATE TABLE Transcripts (
Transcripts.transcript_id (INTEGER),
Transcripts.student_id (INTEGER),
Transcripts.date_of_transcript (DATETIME(3)),
Transcripts.transcript_details (VARCHAR(255)),
)
Possible JOINs:
Achievements.achievement_type_code = Ref_Achievement_Type.achievement_type_code
Achievements.student_id = Students.student_id
Behaviour_Monitoring.student_id = Students.student_id
Classes.student_id = Students.student_id
Classes.teacher_id = Teachers.teacher_id
Detention.detention_type_code = Ref_Detention_Type.detention_type_code
Detention.student_id = Students.student_id
Student_Events.event_type_code = Ref_Event_Types.event_type_code
Student_Events.student_id = Students.student_id
Student_Loans.student_id = Students.student_id
Students_Addresses.address_id = Addresses.address_id
Students_Addresses.address_type_code = Ref_Address_Types.address_type_code
Students_Addresses.student_id = Students.student_id
Transcripts.student_id = Students.student_id
| Table achievements (
achievements.achievement_id (INTEGER),
achievements.achievement_type_code (CHAR(15)),
achievements.student_id (INTEGER),
achievements.date_achievement (DATETIME(3)),
achievements.achievement_details (VARCHAR(255)),
achievements.other_details (VARCHAR(255)),
)
Table addresses (
addresses.address_id (INTEGER),
addresses.address_details (VARCHAR(255)),
)
Table behaviour_monitoring (
behaviour_monitoring.behaviour_monitoring_id (INTEGER),
behaviour_monitoring.student_id (INTEGER),
behaviour_monitoring.behaviour_monitoring_details (VARCHAR(255)),
)
Table classes (
classes.class_id (INTEGER),
classes.student_id (INTEGER),
classes.teacher_id (INTEGER),
classes.class_details (VARCHAR(255)),
)
Table detention (
detention.detention_id (INTEGER),
detention.detention_type_code (CHAR(10)),
detention.student_id (INTEGER),
detention.datetime_detention_start (DATETIME(3)),
detention.datetime_detention_end (DATETIME(3)),
detention.detention_summary (VARCHAR(255)),
detention.other_details (VARCHAR(255)),
)
Table ref_achievement_type (
ref_achievement_type.achievement_type_code (CHAR(15)),
ref_achievement_type.achievement_type_description (VARCHAR(80)),
)
Table ref_address_types (
ref_address_types.address_type_code (CHAR(10)),
ref_address_types.address_type_description (VARCHAR(255)),
)
Table ref_detention_type (
ref_detention_type.detention_type_code (CHAR(10)),
ref_detention_type.detention_type_description (VARCHAR(80)),
)
Table ref_event_types (
ref_event_types.event_type_code (CHAR(10)),
ref_event_types.event_type_description (VARCHAR(255)),
)
Table student_events (
student_events.event_id (INTEGER),
student_events.event_type_code (CHAR(10)),
student_events.student_id (INTEGER),
student_events.event_date (DATETIME(3)),
student_events.other_details (VARCHAR(255)),
)
Table student_loans (
student_loans.student_loan_id (INTEGER),
student_loans.student_id (INTEGER),
student_loans.date_of_loan (DATETIME(3)),
student_loans.amount_of_loan (DECIMAL(15,4)),
student_loans.other_details (VARCHAR(255)),
)
Table students (
students.student_id (INTEGER),
students.bio_data (VARCHAR(255)),
students.student_details (VARCHAR(255)),
)
Table students_addresses (
students_addresses.student_address_id (INTEGER),
students_addresses.address_id (INTEGER),
students_addresses.address_type_code (CHAR(10)),
students_addresses.student_id (INTEGER),
students_addresses.date_from (DATETIME(3)),
students_addresses.date_to (DATETIME(3)),
)
Table teachers (
teachers.teacher_id (INTEGER),
teachers.teacher_details (VARCHAR(255)),
)
Table transcripts (
transcripts.transcript_id (INTEGER),
transcripts.student_id (INTEGER),
transcripts.date_of_transcript (DATETIME(3)),
transcripts.transcript_details (VARCHAR(255)),
)
Possible JOINs:
achievements.achievement_type_code = ref_achievement_type.achievement_type_code
achievements.student_id = students.student_id
behaviour_monitoring.student_id = students.student_id
classes.student_id = students.student_id
classes.teacher_id = teachers.teacher_id
detention.detention_type_code = ref_detention_type.detention_type_code
detention.student_id = students.student_id
student_events.event_type_code = ref_event_types.event_type_code
student_events.student_id = students.student_id
student_loans.student_id = students.student_id
students_addresses.address_id = addresses.address_id
students_addresses.address_type_code = ref_address_types.address_type_code
students_addresses.student_id = students.student_id
transcripts.student_id = students.student_id
| CREATE TABLE achievements (
achievements.achievement_id (INTEGER),
achievements.achievement_type_code (CHAR(15)),
achievements.student_id (INTEGER),
achievements.date_achievement (DATETIME(3)),
achievements.achievement_details (VARCHAR(255)),
achievements.other_details (VARCHAR(255)),
)
CREATE TABLE addresses (
addresses.address_id (INTEGER),
addresses.address_details (VARCHAR(255)),
)
CREATE TABLE behaviour_monitoring (
behaviour_monitoring.behaviour_monitoring_id (INTEGER),
behaviour_monitoring.student_id (INTEGER),
behaviour_monitoring.behaviour_monitoring_details (VARCHAR(255)),
)
CREATE TABLE classes (
classes.class_id (INTEGER),
classes.student_id (INTEGER),
classes.teacher_id (INTEGER),
classes.class_details (VARCHAR(255)),
)
CREATE TABLE detention (
detention.detention_id (INTEGER),
detention.detention_type_code (CHAR(10)),
detention.student_id (INTEGER),
detention.datetime_detention_start (DATETIME(3)),
detention.datetime_detention_end (DATETIME(3)),
detention.detention_summary (VARCHAR(255)),
detention.other_details (VARCHAR(255)),
)
CREATE TABLE ref_achievement_type (
ref_achievement_type.achievement_type_code (CHAR(15)),
ref_achievement_type.achievement_type_description (VARCHAR(80)),
)
CREATE TABLE ref_address_types (
ref_address_types.address_type_code (CHAR(10)),
ref_address_types.address_type_description (VARCHAR(255)),
)
CREATE TABLE ref_detention_type (
ref_detention_type.detention_type_code (CHAR(10)),
ref_detention_type.detention_type_description (VARCHAR(80)),
)
CREATE TABLE ref_event_types (
ref_event_types.event_type_code (CHAR(10)),
ref_event_types.event_type_description (VARCHAR(255)),
)
CREATE TABLE student_events (
student_events.event_id (INTEGER),
student_events.event_type_code (CHAR(10)),
student_events.student_id (INTEGER),
student_events.event_date (DATETIME(3)),
student_events.other_details (VARCHAR(255)),
)
CREATE TABLE student_loans (
student_loans.student_loan_id (INTEGER),
student_loans.student_id (INTEGER),
student_loans.date_of_loan (DATETIME(3)),
student_loans.amount_of_loan (DECIMAL(15,4)),
student_loans.other_details (VARCHAR(255)),
)
CREATE TABLE students (
students.student_id (INTEGER),
students.bio_data (VARCHAR(255)),
students.student_details (VARCHAR(255)),
)
CREATE TABLE students_addresses (
students_addresses.student_address_id (INTEGER),
students_addresses.address_id (INTEGER),
students_addresses.address_type_code (CHAR(10)),
students_addresses.student_id (INTEGER),
students_addresses.date_from (DATETIME(3)),
students_addresses.date_to (DATETIME(3)),
)
CREATE TABLE teachers (
teachers.teacher_id (INTEGER),
teachers.teacher_details (VARCHAR(255)),
)
CREATE TABLE transcripts (
transcripts.transcript_id (INTEGER),
transcripts.student_id (INTEGER),
transcripts.date_of_transcript (DATETIME(3)),
transcripts.transcript_details (VARCHAR(255)),
)
Possible JOINs:
achievements.achievement_type_code = ref_achievement_type.achievement_type_code
achievements.student_id = students.student_id
behaviour_monitoring.student_id = students.student_id
classes.student_id = students.student_id
classes.teacher_id = teachers.teacher_id
detention.detention_type_code = ref_detention_type.detention_type_code
detention.student_id = students.student_id
student_events.event_type_code = ref_event_types.event_type_code
student_events.student_id = students.student_id
student_loans.student_id = students.student_id
students_addresses.address_id = addresses.address_id
students_addresses.address_type_code = ref_address_types.address_type_code
students_addresses.student_id = students.student_id
transcripts.student_id = students.student_id
| {
'Students': ['student_id', 'bio_data', 'student_details'],
'Transcripts': ['transcript_id', 'student_id', 'date_of_transcript', 'transcript_details'],
'Behaviour_Monitoring': ['behaviour_monitoring_id', 'student_id', 'behaviour_monitoring_details'],
'Addresses': ['address_id', 'address_details'],
'Ref_Event_Types': ['event_type_code', 'event_type_description'],
'Ref_Achievement_Type': ['achievement_type_code', 'achievement_type_description'],
'Ref_Address_Types': ['address_type_code', 'address_type_description'],
'Ref_Detention_Type': ['detention_type_code', 'detention_type_description'],
'Student_Events': ['event_id', 'event_type_code', 'student_id', 'event_date', 'other_details'],
'Teachers': ['teacher_id', 'teacher_details'],
'Student_Loans': ['student_loan_id', 'student_id', 'date_of_loan', 'amount_of_loan', 'other_details'],
'Classes': ['class_id', 'student_id', 'teacher_id', 'class_details'],
'Students_Addresses': ['student_address_id', 'address_id', 'address_type_code', 'student_id', 'date_from', 'date_to'],
'Detention': ['detention_id', 'detention_type_code', 'student_id', 'datetime_detention_start', 'datetime_detention_end', 'detention_summary', 'other_details'],
'Achievements': ['achievement_id', 'achievement_type_code', 'student_id', 'date_achievement', 'achievement_details', 'other_details']
} | {
'Student_Loans': ['student_loan_id', 'student_id', 'date_of_loan', 'amount_of_loan'],
'Achievements': ['achievement_id', 'student_id']
} | TABLE Achievements (
Achievements.achievement_id (INTEGER),
Achievements.achievement_type_code (CHAR(15)),
Achievements.student_id (INTEGER),
Achievements.date_achievement (DATETIME(3)),
Achievements.achievement_details (VARCHAR(255)),
Achievements.other_details (VARCHAR(255)),
)
TABLE Addresses (
Addresses.address_id (INTEGER),
Addresses.address_details (VARCHAR(255)),
)
TABLE Behaviour_Monitoring (
Behaviour_Monitoring.behaviour_monitoring_id (INTEGER),
Behaviour_Monitoring.student_id (INTEGER),
Behaviour_Monitoring.behaviour_monitoring_details (VARCHAR(255)),
)
TABLE Classes (
Classes.class_id (INTEGER),
Classes.student_id (INTEGER),
Classes.teacher_id (INTEGER),
Classes.class_details (VARCHAR(255)),
)
TABLE Detention (
Detention.detention_id (INTEGER),
Detention.detention_type_code (CHAR(10)),
Detention.student_id (INTEGER),
Detention.datetime_detention_start (DATETIME(3)),
Detention.datetime_detention_end (DATETIME(3)),
Detention.detention_summary (VARCHAR(255)),
Detention.other_details (VARCHAR(255)),
)
TABLE Ref_Achievement_Type (
Ref_Achievement_Type.achievement_type_code (CHAR(15)),
Ref_Achievement_Type.achievement_type_description (VARCHAR(80)),
)
TABLE Ref_Address_Types (
Ref_Address_Types.address_type_code (CHAR(10)),
Ref_Address_Types.address_type_description (VARCHAR(255)),
)
TABLE Ref_Detention_Type (
Ref_Detention_Type.detention_type_code (CHAR(10)),
Ref_Detention_Type.detention_type_description (VARCHAR(80)),
)
TABLE Ref_Event_Types (
Ref_Event_Types.event_type_code (CHAR(10)),
Ref_Event_Types.event_type_description (VARCHAR(255)),
)
TABLE Student_Events (
Student_Events.event_id (INTEGER),
Student_Events.event_type_code (CHAR(10)),
Student_Events.student_id (INTEGER),
Student_Events.event_date (DATETIME(3)),
Student_Events.other_details (VARCHAR(255)),
)
TABLE Student_Loans (
Student_Loans.student_loan_id (INTEGER),
Student_Loans.student_id (INTEGER),
Student_Loans.date_of_loan (DATETIME(3)),
Student_Loans.amount_of_loan (DECIMAL(15,4)),
Student_Loans.other_details (VARCHAR(255)),
)
TABLE Students (
Students.student_id (INTEGER),
Students.bio_data (VARCHAR(255)),
Students.student_details (VARCHAR(255)),
)
TABLE Students_Addresses (
Students_Addresses.student_address_id (INTEGER),
Students_Addresses.address_id (INTEGER),
Students_Addresses.address_type_code (CHAR(10)),
Students_Addresses.student_id (INTEGER),
Students_Addresses.date_from (DATETIME(3)),
Students_Addresses.date_to (DATETIME(3)),
)
TABLE Teachers (
Teachers.teacher_id (INTEGER),
Teachers.teacher_details (VARCHAR(255)),
)
TABLE Transcripts (
Transcripts.transcript_id (INTEGER),
Transcripts.student_id (INTEGER),
Transcripts.date_of_transcript (DATETIME(3)),
Transcripts.transcript_details (VARCHAR(255)),
)
Possible JOINs:
Achievements.achievement_type_code = Ref_Achievement_Type.achievement_type_code
Achievements.student_id = Students.student_id
Behaviour_Monitoring.student_id = Students.student_id
Classes.student_id = Students.student_id
Classes.teacher_id = Teachers.teacher_id
Detention.detention_type_code = Ref_Detention_Type.detention_type_code
Detention.student_id = Students.student_id
Student_Events.event_type_code = Ref_Event_Types.event_type_code
Student_Events.student_id = Students.student_id
Student_Loans.student_id = Students.student_id
Students_Addresses.address_id = Addresses.address_id
Students_Addresses.address_type_code = Ref_Address_Types.address_type_code
Students_Addresses.student_id = Students.student_id
Transcripts.student_id = Students.student_id
| TABLE Achievements (
Achievements.achievement_id (INTEGER),
Achievements.achievement_type_code (CHAR(15)),
Achievements.student_id (INTEGER),
Achievements.date_achievement (DATETIME(3)),
Achievements.achievement_details (VARCHAR(255)),
Achievements.other_details (VARCHAR(255)),
)
TABLE Addresses (
Addresses.address_id (INTEGER),
Addresses.address_details (VARCHAR(255)),
)
TABLE Behaviour_Monitoring (
Behaviour_Monitoring.behaviour_monitoring_id (INTEGER),
Behaviour_Monitoring.student_id (INTEGER),
Behaviour_Monitoring.behaviour_monitoring_details (VARCHAR(255)),
)
TABLE Classes (
Classes.class_id (INTEGER),
Classes.student_id (INTEGER),
Classes.teacher_id (INTEGER),
Classes.class_details (VARCHAR(255)),
)
TABLE Detention (
Detention.detention_id (INTEGER),
Detention.detention_type_code (CHAR(10)),
Detention.student_id (INTEGER),
Detention.datetime_detention_start (DATETIME(3)),
Detention.datetime_detention_end (DATETIME(3)),
Detention.detention_summary (VARCHAR(255)),
Detention.other_details (VARCHAR(255)),
)
TABLE Ref_Achievement_Type (
Ref_Achievement_Type.achievement_type_code (CHAR(15)),
Ref_Achievement_Type.achievement_type_description (VARCHAR(80)),
)
TABLE Ref_Address_Types (
Ref_Address_Types.address_type_code (CHAR(10)),
Ref_Address_Types.address_type_description (VARCHAR(255)),
)
TABLE Ref_Detention_Type (
Ref_Detention_Type.detention_type_code (CHAR(10)),
Ref_Detention_Type.detention_type_description (VARCHAR(80)),
)
TABLE Ref_Event_Types (
Ref_Event_Types.event_type_code (CHAR(10)),
Ref_Event_Types.event_type_description (VARCHAR(255)),
)
TABLE Student_Events (
Student_Events.event_id (INTEGER),
Student_Events.event_type_code (CHAR(10)),
Student_Events.student_id (INTEGER),
Student_Events.event_date (DATETIME(3)),
Student_Events.other_details (VARCHAR(255)),
)
TABLE Student_Loans (
Student_Loans.student_loan_id (INTEGER),
Student_Loans.student_id (INTEGER),
Student_Loans.date_of_loan (DATETIME(3)),
Student_Loans.amount_of_loan (DECIMAL(15,4)),
Student_Loans.other_details (VARCHAR(255)),
)
TABLE Students (
Students.student_id (INTEGER),
Students.bio_data (VARCHAR(255)),
Students.student_details (VARCHAR(255)),
)
TABLE Students_Addresses (
Students_Addresses.student_address_id (INTEGER),
Students_Addresses.address_id (INTEGER),
Students_Addresses.address_type_code (CHAR(10)),
Students_Addresses.student_id (INTEGER),
Students_Addresses.date_from (DATETIME(3)),
Students_Addresses.date_to (DATETIME(3)),
)
TABLE Teachers (
Teachers.teacher_id (INTEGER),
Teachers.teacher_details (VARCHAR(255)),
)
TABLE Transcripts (
Transcripts.transcript_id (INTEGER),
Transcripts.student_id (INTEGER),
Transcripts.date_of_transcript (DATETIME(3)),
Transcripts.transcript_details (VARCHAR(255)),
)
Possible JOINs:
Achievements.achievement_type_code = Ref_Achievement_Type.achievement_type_code
Achievements.student_id = Students.student_id
Behaviour_Monitoring.student_id = Students.student_id
Classes.student_id = Students.student_id
Classes.teacher_id = Teachers.teacher_id
Detention.detention_type_code = Ref_Detention_Type.detention_type_code
Detention.student_id = Students.student_id
Student_Events.event_type_code = Ref_Event_Types.event_type_code
Student_Events.student_id = Students.student_id
Student_Loans.student_id = Students.student_id
Students_Addresses.address_id = Addresses.address_id
Students_Addresses.address_type_code = Ref_Address_Types.address_type_code
Students_Addresses.student_id = Students.student_id
Transcripts.student_id = Students.student_id
| TABLE achievements (
achievements.achievement_id (INTEGER),
achievements.achievement_type_code (CHAR(15)),
achievements.student_id (INTEGER),
achievements.date_achievement (DATETIME(3)),
achievements.achievement_details (VARCHAR(255)),
achievements.other_details (VARCHAR(255)),
)
TABLE addresses (
addresses.address_id (INTEGER),
addresses.address_details (VARCHAR(255)),
)
TABLE behaviour_monitoring (
behaviour_monitoring.behaviour_monitoring_id (INTEGER),
behaviour_monitoring.student_id (INTEGER),
behaviour_monitoring.behaviour_monitoring_details (VARCHAR(255)),
)
TABLE classes (
classes.class_id (INTEGER),
classes.student_id (INTEGER),
classes.teacher_id (INTEGER),
classes.class_details (VARCHAR(255)),
)
TABLE detention (
detention.detention_id (INTEGER),
detention.detention_type_code (CHAR(10)),
detention.student_id (INTEGER),
detention.datetime_detention_start (DATETIME(3)),
detention.datetime_detention_end (DATETIME(3)),
detention.detention_summary (VARCHAR(255)),
detention.other_details (VARCHAR(255)),
)
TABLE ref_achievement_type (
ref_achievement_type.achievement_type_code (CHAR(15)),
ref_achievement_type.achievement_type_description (VARCHAR(80)),
)
TABLE ref_address_types (
ref_address_types.address_type_code (CHAR(10)),
ref_address_types.address_type_description (VARCHAR(255)),
)
TABLE ref_detention_type (
ref_detention_type.detention_type_code (CHAR(10)),
ref_detention_type.detention_type_description (VARCHAR(80)),
)
TABLE ref_event_types (
ref_event_types.event_type_code (CHAR(10)),
ref_event_types.event_type_description (VARCHAR(255)),
)
TABLE student_events (
student_events.event_id (INTEGER),
student_events.event_type_code (CHAR(10)),
student_events.student_id (INTEGER),
student_events.event_date (DATETIME(3)),
student_events.other_details (VARCHAR(255)),
)
TABLE student_loans (
student_loans.student_loan_id (INTEGER),
student_loans.student_id (INTEGER),
student_loans.date_of_loan (DATETIME(3)),
student_loans.amount_of_loan (DECIMAL(15,4)),
student_loans.other_details (VARCHAR(255)),
)
TABLE students (
students.student_id (INTEGER),
students.bio_data (VARCHAR(255)),
students.student_details (VARCHAR(255)),
)
TABLE students_addresses (
students_addresses.student_address_id (INTEGER),
students_addresses.address_id (INTEGER),
students_addresses.address_type_code (CHAR(10)),
students_addresses.student_id (INTEGER),
students_addresses.date_from (DATETIME(3)),
students_addresses.date_to (DATETIME(3)),
)
TABLE teachers (
teachers.teacher_id (INTEGER),
teachers.teacher_details (VARCHAR(255)),
)
TABLE transcripts (
transcripts.transcript_id (INTEGER),
transcripts.student_id (INTEGER),
transcripts.date_of_transcript (DATETIME(3)),
transcripts.transcript_details (VARCHAR(255)),
)
Possible JOINs:
achievements.achievement_type_code = ref_achievement_type.achievement_type_code
achievements.student_id = students.student_id
behaviour_monitoring.student_id = students.student_id
classes.student_id = students.student_id
classes.teacher_id = teachers.teacher_id
detention.detention_type_code = ref_detention_type.detention_type_code
detention.student_id = students.student_id
student_events.event_type_code = ref_event_types.event_type_code
student_events.student_id = students.student_id
student_loans.student_id = students.student_id
students_addresses.address_id = addresses.address_id
students_addresses.address_type_code = ref_address_types.address_type_code
students_addresses.student_id = students.student_id
transcripts.student_id = students.student_id
|
e_commerce |
CREATE TABLE "Customer_Payment_Methods" (
customer_id INTEGER NOT NULL,
payment_method_code VARCHAR(10) NOT NULL,
FOREIGN KEY(customer_id) REFERENCES "Customers" (customer_id)
)
CREATE TABLE "Customers" (
customer_id INTEGER,
gender_code VARCHAR(1) NOT NULL,
customer_first_name VARCHAR(50),
customer_middle_initial VARCHAR(1),
customer_last_name VARCHAR(50),
email_address VARCHAR(255),
login_name VARCHAR(80),
login_password VARCHAR(20),
phone_number VARCHAR(255),
address_line_1 VARCHAR(255),
town_city VARCHAR(50),
county VARCHAR(50),
country VARCHAR(50),
PRIMARY KEY (customer_id)
)
CREATE TABLE "Invoices" (
invoice_number INTEGER,
invoice_status_code VARCHAR(10) NOT NULL,
invoice_date DATETIME,
PRIMARY KEY (invoice_number)
)
CREATE TABLE "Order_Items" (
order_item_id INTEGER,
product_id INTEGER NOT NULL,
order_id INTEGER NOT NULL,
order_item_status_code VARCHAR(10) NOT NULL,
PRIMARY KEY (order_item_id),
FOREIGN KEY(order_id) REFERENCES "Orders" (order_id),
FOREIGN KEY(product_id) REFERENCES "Products" (product_id)
)
CREATE TABLE "Orders" (
order_id INTEGER,
customer_id INTEGER NOT NULL,
order_status_code VARCHAR(10) NOT NULL,
date_order_placed DATETIME NOT NULL,
PRIMARY KEY (order_id),
FOREIGN KEY(customer_id) REFERENCES "Customers" (customer_id)
)
CREATE TABLE "Products" (
product_id INTEGER,
parent_product_id INTEGER,
product_name VARCHAR(80),
product_price DECIMAL(19, 4) DEFAULT 0,
product_color VARCHAR(50),
product_size VARCHAR(50),
product_description VARCHAR(255),
PRIMARY KEY (product_id)
)
CREATE TABLE "Shipment_Items" (
shipment_id INTEGER NOT NULL,
order_item_id INTEGER NOT NULL,
PRIMARY KEY (shipment_id, order_item_id),
FOREIGN KEY(order_item_id) REFERENCES "Order_Items" (order_item_id),
FOREIGN KEY(shipment_id) REFERENCES "Shipments" (shipment_id)
)
CREATE TABLE "Shipments" (
shipment_id INTEGER,
order_id INTEGER NOT NULL,
invoice_number INTEGER NOT NULL,
shipment_tracking_number VARCHAR(80),
shipment_date DATETIME,
PRIMARY KEY (shipment_id),
FOREIGN KEY(order_id) REFERENCES "Orders" (order_id),
FOREIGN KEY(invoice_number) REFERENCES "Invoices" (invoice_number)
) | What are the status codes and dates placed for all of the orders? | medium | Table Customer_Payment_Methods (
Customer_Payment_Methods.customer_id (INTEGER),
Customer_Payment_Methods.payment_method_code (VARCHAR(10)),
)
Table Customers (
Customers.customer_id (INTEGER),
Customers.gender_code (VARCHAR(1)),
Customers.customer_first_name (VARCHAR(50)),
Customers.customer_middle_initial (VARCHAR(1)),
Customers.customer_last_name (VARCHAR(50)),
Customers.email_address (VARCHAR(255)),
Customers.login_name (VARCHAR(80)),
Customers.login_password (VARCHAR(20)),
Customers.phone_number (VARCHAR(255)),
Customers.address_line_1 (VARCHAR(255)),
Customers.town_city (VARCHAR(50)),
Customers.county (VARCHAR(50)),
Customers.country (VARCHAR(50)),
)
Table Invoices (
Invoices.invoice_number (INTEGER),
Invoices.invoice_status_code (VARCHAR(10)),
Invoices.invoice_date (DATETIME),
)
Table Order_Items (
Order_Items.order_item_id (INTEGER),
Order_Items.product_id (INTEGER),
Order_Items.order_id (INTEGER),
Order_Items.order_item_status_code (VARCHAR(10)),
)
Table Orders (
Orders.order_id (INTEGER),
Orders.customer_id (INTEGER),
Orders.order_status_code (VARCHAR(10)),
Orders.date_order_placed (DATETIME),
)
Table Products (
Products.product_id (INTEGER),
Products.parent_product_id (INTEGER),
Products.product_name (VARCHAR(80)),
Products.product_price (DECIMAL(19,4)),
Products.product_color (VARCHAR(50)),
Products.product_size (VARCHAR(50)),
Products.product_description (VARCHAR(255)),
)
Table Shipment_Items (
Shipment_Items.shipment_id (INTEGER),
Shipment_Items.order_item_id (INTEGER),
)
Table Shipments (
Shipments.shipment_id (INTEGER),
Shipments.order_id (INTEGER),
Shipments.invoice_number (INTEGER),
Shipments.shipment_tracking_number (VARCHAR(80)),
Shipments.shipment_date (DATETIME),
)
Possible JOINs:
Customer_Payment_Methods.customer_id = Customers.customer_id
Order_Items.product_id = Products.product_id
Order_Items.order_id = Orders.order_id
Orders.customer_id = Customers.customer_id
Shipment_Items.shipment_id = Shipments.shipment_id
Shipment_Items.order_item_id = Order_Items.order_item_id
Shipments.order_id = Orders.order_id
Shipments.invoice_number = Invoices.invoice_number
| SELECT order_status_code , date_order_placed FROM Orders | {
'orders': ['order_id', 'order_status_code', 'date_order_placed']
} | CREATE TABLE Customer_Payment_Methods (
Customer_Payment_Methods.customer_id (INTEGER),
Customer_Payment_Methods.payment_method_code (VARCHAR(10)),
)
CREATE TABLE Customers (
Customers.customer_id (INTEGER),
Customers.gender_code (VARCHAR(1)),
Customers.customer_first_name (VARCHAR(50)),
Customers.customer_middle_initial (VARCHAR(1)),
Customers.customer_last_name (VARCHAR(50)),
Customers.email_address (VARCHAR(255)),
Customers.login_name (VARCHAR(80)),
Customers.login_password (VARCHAR(20)),
Customers.phone_number (VARCHAR(255)),
Customers.address_line_1 (VARCHAR(255)),
Customers.town_city (VARCHAR(50)),
Customers.county (VARCHAR(50)),
Customers.country (VARCHAR(50)),
)
CREATE TABLE Invoices (
Invoices.invoice_number (INTEGER),
Invoices.invoice_status_code (VARCHAR(10)),
Invoices.invoice_date (DATETIME),
)
CREATE TABLE Order_Items (
Order_Items.order_item_id (INTEGER),
Order_Items.product_id (INTEGER),
Order_Items.order_id (INTEGER),
Order_Items.order_item_status_code (VARCHAR(10)),
)
CREATE TABLE Orders (
Orders.order_id (INTEGER),
Orders.customer_id (INTEGER),
Orders.order_status_code (VARCHAR(10)),
Orders.date_order_placed (DATETIME),
)
CREATE TABLE Products (
Products.product_id (INTEGER),
Products.parent_product_id (INTEGER),
Products.product_name (VARCHAR(80)),
Products.product_price (DECIMAL(19,4)),
Products.product_color (VARCHAR(50)),
Products.product_size (VARCHAR(50)),
Products.product_description (VARCHAR(255)),
)
CREATE TABLE Shipment_Items (
Shipment_Items.shipment_id (INTEGER),
Shipment_Items.order_item_id (INTEGER),
)
CREATE TABLE Shipments (
Shipments.shipment_id (INTEGER),
Shipments.order_id (INTEGER),
Shipments.invoice_number (INTEGER),
Shipments.shipment_tracking_number (VARCHAR(80)),
Shipments.shipment_date (DATETIME),
)
Possible JOINs:
Customer_Payment_Methods.customer_id = Customers.customer_id
Order_Items.product_id = Products.product_id
Order_Items.order_id = Orders.order_id
Orders.customer_id = Customers.customer_id
Shipment_Items.shipment_id = Shipments.shipment_id
Shipment_Items.order_item_id = Order_Items.order_item_id
Shipments.order_id = Orders.order_id
Shipments.invoice_number = Invoices.invoice_number
| Table Customer_Payment_Methods (
Customer_Payment_Methods.customer_id (INTEGER),
Customer_Payment_Methods.payment_method_code (VARCHAR(10)),
)
Table Customers (
Customers.customer_id (INTEGER),
Customers.gender_code (VARCHAR(1)),
Customers.customer_first_name (VARCHAR(50)),
Customers.customer_middle_initial (VARCHAR(1)),
Customers.customer_last_name (VARCHAR(50)),
Customers.email_address (VARCHAR(255)),
Customers.login_name (VARCHAR(80)),
Customers.login_password (VARCHAR(20)),
Customers.phone_number (VARCHAR(255)),
Customers.address_line_1 (VARCHAR(255)),
Customers.town_city (VARCHAR(50)),
Customers.county (VARCHAR(50)),
Customers.country (VARCHAR(50)),
)
Table Invoices (
Invoices.invoice_number (INTEGER),
Invoices.invoice_status_code (VARCHAR(10)),
Invoices.invoice_date (DATETIME),
)
Table Order_Items (
Order_Items.order_item_id (INTEGER),
Order_Items.product_id (INTEGER),
Order_Items.order_id (INTEGER),
Order_Items.order_item_status_code (VARCHAR(10)),
)
Table Orders (
Orders.order_id (INTEGER),
Orders.customer_id (INTEGER),
Orders.order_status_code (VARCHAR(10)),
Orders.date_order_placed (DATETIME),
)
Table Products (
Products.product_id (INTEGER),
Products.parent_product_id (INTEGER),
Products.product_name (VARCHAR(80)),
Products.product_price (DECIMAL(19,4)),
Products.product_color (VARCHAR(50)),
Products.product_size (VARCHAR(50)),
Products.product_description (VARCHAR(255)),
)
Table Shipment_Items (
Shipment_Items.shipment_id (INTEGER),
Shipment_Items.order_item_id (INTEGER),
)
Table Shipments (
Shipments.shipment_id (INTEGER),
Shipments.order_id (INTEGER),
Shipments.invoice_number (INTEGER),
Shipments.shipment_tracking_number (VARCHAR(80)),
Shipments.shipment_date (DATETIME),
)
Possible JOINs:
Customer_Payment_Methods.customer_id = Customers.customer_id
Order_Items.product_id = Products.product_id
Order_Items.order_id = Orders.order_id
Orders.customer_id = Customers.customer_id
Shipment_Items.shipment_id = Shipments.shipment_id
Shipment_Items.order_item_id = Order_Items.order_item_id
Shipments.order_id = Orders.order_id
Shipments.invoice_number = Invoices.invoice_number
| CREATE TABLE Customer_Payment_Methods (
Customer_Payment_Methods.customer_id (INTEGER),
Customer_Payment_Methods.payment_method_code (VARCHAR(10)),
)
CREATE TABLE Customers (
Customers.customer_id (INTEGER),
Customers.gender_code (VARCHAR(1)),
Customers.customer_first_name (VARCHAR(50)),
Customers.customer_middle_initial (VARCHAR(1)),
Customers.customer_last_name (VARCHAR(50)),
Customers.email_address (VARCHAR(255)),
Customers.login_name (VARCHAR(80)),
Customers.login_password (VARCHAR(20)),
Customers.phone_number (VARCHAR(255)),
Customers.address_line_1 (VARCHAR(255)),
Customers.town_city (VARCHAR(50)),
Customers.county (VARCHAR(50)),
Customers.country (VARCHAR(50)),
)
CREATE TABLE Invoices (
Invoices.invoice_number (INTEGER),
Invoices.invoice_status_code (VARCHAR(10)),
Invoices.invoice_date (DATETIME),
)
CREATE TABLE Order_Items (
Order_Items.order_item_id (INTEGER),
Order_Items.product_id (INTEGER),
Order_Items.order_id (INTEGER),
Order_Items.order_item_status_code (VARCHAR(10)),
)
CREATE TABLE Orders (
Orders.order_id (INTEGER),
Orders.customer_id (INTEGER),
Orders.order_status_code (VARCHAR(10)),
Orders.date_order_placed (DATETIME),
)
CREATE TABLE Products (
Products.product_id (INTEGER),
Products.parent_product_id (INTEGER),
Products.product_name (VARCHAR(80)),
Products.product_price (DECIMAL(19,4)),
Products.product_color (VARCHAR(50)),
Products.product_size (VARCHAR(50)),
Products.product_description (VARCHAR(255)),
)
CREATE TABLE Shipment_Items (
Shipment_Items.shipment_id (INTEGER),
Shipment_Items.order_item_id (INTEGER),
)
CREATE TABLE Shipments (
Shipments.shipment_id (INTEGER),
Shipments.order_id (INTEGER),
Shipments.invoice_number (INTEGER),
Shipments.shipment_tracking_number (VARCHAR(80)),
Shipments.shipment_date (DATETIME),
)
Possible JOINs:
Customer_Payment_Methods.customer_id = Customers.customer_id
Order_Items.product_id = Products.product_id
Order_Items.order_id = Orders.order_id
Orders.customer_id = Customers.customer_id
Shipment_Items.shipment_id = Shipments.shipment_id
Shipment_Items.order_item_id = Order_Items.order_item_id
Shipments.order_id = Orders.order_id
Shipments.invoice_number = Invoices.invoice_number
| Table customer_payment_methods (
customer_payment_methods.customer_id (INTEGER),
customer_payment_methods.payment_method_code (VARCHAR(10)),
)
Table customers (
customers.customer_id (INTEGER),
customers.gender_code (VARCHAR(1)),
customers.customer_first_name (VARCHAR(50)),
customers.customer_middle_initial (VARCHAR(1)),
customers.customer_last_name (VARCHAR(50)),
customers.email_address (VARCHAR(255)),
customers.login_name (VARCHAR(80)),
customers.login_password (VARCHAR(20)),
customers.phone_number (VARCHAR(255)),
customers.address_line_1 (VARCHAR(255)),
customers.town_city (VARCHAR(50)),
customers.county (VARCHAR(50)),
customers.country (VARCHAR(50)),
)
Table invoices (
invoices.invoice_number (INTEGER),
invoices.invoice_status_code (VARCHAR(10)),
invoices.invoice_date (DATETIME),
)
Table order_items (
order_items.order_item_id (INTEGER),
order_items.product_id (INTEGER),
order_items.order_id (INTEGER),
order_items.order_item_status_code (VARCHAR(10)),
)
Table orders (
orders.order_id (INTEGER),
orders.customer_id (INTEGER),
orders.order_status_code (VARCHAR(10)),
orders.date_order_placed (DATETIME),
)
Table products (
products.product_id (INTEGER),
products.parent_product_id (INTEGER),
products.product_name (VARCHAR(80)),
products.product_price (DECIMAL(19,4)),
products.product_color (VARCHAR(50)),
products.product_size (VARCHAR(50)),
products.product_description (VARCHAR(255)),
)
Table shipment_items (
shipment_items.shipment_id (INTEGER),
shipment_items.order_item_id (INTEGER),
)
Table shipments (
shipments.shipment_id (INTEGER),
shipments.order_id (INTEGER),
shipments.invoice_number (INTEGER),
shipments.shipment_tracking_number (VARCHAR(80)),
shipments.shipment_date (DATETIME),
)
Possible JOINs:
customer_payment_methods.customer_id = customers.customer_id
order_items.product_id = products.product_id
order_items.order_id = orders.order_id
orders.customer_id = customers.customer_id
shipment_items.shipment_id = shipments.shipment_id
shipment_items.order_item_id = order_items.order_item_id
shipments.order_id = orders.order_id
shipments.invoice_number = invoices.invoice_number
| CREATE TABLE customer_payment_methods (
customer_payment_methods.customer_id (INTEGER),
customer_payment_methods.payment_method_code (VARCHAR(10)),
)
CREATE TABLE customers (
customers.customer_id (INTEGER),
customers.gender_code (VARCHAR(1)),
customers.customer_first_name (VARCHAR(50)),
customers.customer_middle_initial (VARCHAR(1)),
customers.customer_last_name (VARCHAR(50)),
customers.email_address (VARCHAR(255)),
customers.login_name (VARCHAR(80)),
customers.login_password (VARCHAR(20)),
customers.phone_number (VARCHAR(255)),
customers.address_line_1 (VARCHAR(255)),
customers.town_city (VARCHAR(50)),
customers.county (VARCHAR(50)),
customers.country (VARCHAR(50)),
)
CREATE TABLE invoices (
invoices.invoice_number (INTEGER),
invoices.invoice_status_code (VARCHAR(10)),
invoices.invoice_date (DATETIME),
)
CREATE TABLE order_items (
order_items.order_item_id (INTEGER),
order_items.product_id (INTEGER),
order_items.order_id (INTEGER),
order_items.order_item_status_code (VARCHAR(10)),
)
CREATE TABLE orders (
orders.order_id (INTEGER),
orders.customer_id (INTEGER),
orders.order_status_code (VARCHAR(10)),
orders.date_order_placed (DATETIME),
)
CREATE TABLE products (
products.product_id (INTEGER),
products.parent_product_id (INTEGER),
products.product_name (VARCHAR(80)),
products.product_price (DECIMAL(19,4)),
products.product_color (VARCHAR(50)),
products.product_size (VARCHAR(50)),
products.product_description (VARCHAR(255)),
)
CREATE TABLE shipment_items (
shipment_items.shipment_id (INTEGER),
shipment_items.order_item_id (INTEGER),
)
CREATE TABLE shipments (
shipments.shipment_id (INTEGER),
shipments.order_id (INTEGER),
shipments.invoice_number (INTEGER),
shipments.shipment_tracking_number (VARCHAR(80)),
shipments.shipment_date (DATETIME),
)
Possible JOINs:
customer_payment_methods.customer_id = customers.customer_id
order_items.product_id = products.product_id
order_items.order_id = orders.order_id
orders.customer_id = customers.customer_id
shipment_items.shipment_id = shipments.shipment_id
shipment_items.order_item_id = order_items.order_item_id
shipments.order_id = orders.order_id
shipments.invoice_number = invoices.invoice_number
| {
'Products': ['product_id', 'parent_product_id', 'product_name', 'product_price', 'product_color', 'product_size', 'product_description'],
'Customers': ['customer_id', 'gender_code', 'customer_first_name', 'customer_middle_initial', 'customer_last_name', 'email_address', 'login_name', 'login_password', 'phone_number', 'address_line_1', 'town_city', 'county', 'country'],
'Customer_Payment_Methods': ['customer_id', 'payment_method_code'],
'Invoices': ['invoice_number', 'invoice_status_code', 'invoice_date'],
'Orders': ['order_id', 'customer_id', 'order_status_code', 'date_order_placed'],
'Order_Items': ['order_item_id', 'product_id', 'order_id', 'order_item_status_code'],
'Shipments': ['shipment_id', 'order_id', 'invoice_number', 'shipment_tracking_number', 'shipment_date'],
'Shipment_Items': ['shipment_id', 'order_item_id']
} | {
'Orders': ['order_id', 'order_status_code', 'date_order_placed']
} | TABLE Customer_Payment_Methods (
Customer_Payment_Methods.customer_id (INTEGER),
Customer_Payment_Methods.payment_method_code (VARCHAR(10)),
)
TABLE Customers (
Customers.customer_id (INTEGER),
Customers.gender_code (VARCHAR(1)),
Customers.customer_first_name (VARCHAR(50)),
Customers.customer_middle_initial (VARCHAR(1)),
Customers.customer_last_name (VARCHAR(50)),
Customers.email_address (VARCHAR(255)),
Customers.login_name (VARCHAR(80)),
Customers.login_password (VARCHAR(20)),
Customers.phone_number (VARCHAR(255)),
Customers.address_line_1 (VARCHAR(255)),
Customers.town_city (VARCHAR(50)),
Customers.county (VARCHAR(50)),
Customers.country (VARCHAR(50)),
)
TABLE Invoices (
Invoices.invoice_number (INTEGER),
Invoices.invoice_status_code (VARCHAR(10)),
Invoices.invoice_date (DATETIME),
)
TABLE Order_Items (
Order_Items.order_item_id (INTEGER),
Order_Items.product_id (INTEGER),
Order_Items.order_id (INTEGER),
Order_Items.order_item_status_code (VARCHAR(10)),
)
TABLE Orders (
Orders.order_id (INTEGER),
Orders.customer_id (INTEGER),
Orders.order_status_code (VARCHAR(10)),
Orders.date_order_placed (DATETIME),
)
TABLE Products (
Products.product_id (INTEGER),
Products.parent_product_id (INTEGER),
Products.product_name (VARCHAR(80)),
Products.product_price (DECIMAL(19,4)),
Products.product_color (VARCHAR(50)),
Products.product_size (VARCHAR(50)),
Products.product_description (VARCHAR(255)),
)
TABLE Shipment_Items (
Shipment_Items.shipment_id (INTEGER),
Shipment_Items.order_item_id (INTEGER),
)
TABLE Shipments (
Shipments.shipment_id (INTEGER),
Shipments.order_id (INTEGER),
Shipments.invoice_number (INTEGER),
Shipments.shipment_tracking_number (VARCHAR(80)),
Shipments.shipment_date (DATETIME),
)
Possible JOINs:
Customer_Payment_Methods.customer_id = Customers.customer_id
Order_Items.product_id = Products.product_id
Order_Items.order_id = Orders.order_id
Orders.customer_id = Customers.customer_id
Shipment_Items.shipment_id = Shipments.shipment_id
Shipment_Items.order_item_id = Order_Items.order_item_id
Shipments.order_id = Orders.order_id
Shipments.invoice_number = Invoices.invoice_number
| TABLE Customer_Payment_Methods (
Customer_Payment_Methods.customer_id (INTEGER),
Customer_Payment_Methods.payment_method_code (VARCHAR(10)),
)
TABLE Customers (
Customers.customer_id (INTEGER),
Customers.gender_code (VARCHAR(1)),
Customers.customer_first_name (VARCHAR(50)),
Customers.customer_middle_initial (VARCHAR(1)),
Customers.customer_last_name (VARCHAR(50)),
Customers.email_address (VARCHAR(255)),
Customers.login_name (VARCHAR(80)),
Customers.login_password (VARCHAR(20)),
Customers.phone_number (VARCHAR(255)),
Customers.address_line_1 (VARCHAR(255)),
Customers.town_city (VARCHAR(50)),
Customers.county (VARCHAR(50)),
Customers.country (VARCHAR(50)),
)
TABLE Invoices (
Invoices.invoice_number (INTEGER),
Invoices.invoice_status_code (VARCHAR(10)),
Invoices.invoice_date (DATETIME),
)
TABLE Order_Items (
Order_Items.order_item_id (INTEGER),
Order_Items.product_id (INTEGER),
Order_Items.order_id (INTEGER),
Order_Items.order_item_status_code (VARCHAR(10)),
)
TABLE Orders (
Orders.order_id (INTEGER),
Orders.customer_id (INTEGER),
Orders.order_status_code (VARCHAR(10)),
Orders.date_order_placed (DATETIME),
)
TABLE Products (
Products.product_id (INTEGER),
Products.parent_product_id (INTEGER),
Products.product_name (VARCHAR(80)),
Products.product_price (DECIMAL(19,4)),
Products.product_color (VARCHAR(50)),
Products.product_size (VARCHAR(50)),
Products.product_description (VARCHAR(255)),
)
TABLE Shipment_Items (
Shipment_Items.shipment_id (INTEGER),
Shipment_Items.order_item_id (INTEGER),
)
TABLE Shipments (
Shipments.shipment_id (INTEGER),
Shipments.order_id (INTEGER),
Shipments.invoice_number (INTEGER),
Shipments.shipment_tracking_number (VARCHAR(80)),
Shipments.shipment_date (DATETIME),
)
Possible JOINs:
Customer_Payment_Methods.customer_id = Customers.customer_id
Order_Items.product_id = Products.product_id
Order_Items.order_id = Orders.order_id
Orders.customer_id = Customers.customer_id
Shipment_Items.shipment_id = Shipments.shipment_id
Shipment_Items.order_item_id = Order_Items.order_item_id
Shipments.order_id = Orders.order_id
Shipments.invoice_number = Invoices.invoice_number
| TABLE customer_payment_methods (
customer_payment_methods.customer_id (INTEGER),
customer_payment_methods.payment_method_code (VARCHAR(10)),
)
TABLE customers (
customers.customer_id (INTEGER),
customers.gender_code (VARCHAR(1)),
customers.customer_first_name (VARCHAR(50)),
customers.customer_middle_initial (VARCHAR(1)),
customers.customer_last_name (VARCHAR(50)),
customers.email_address (VARCHAR(255)),
customers.login_name (VARCHAR(80)),
customers.login_password (VARCHAR(20)),
customers.phone_number (VARCHAR(255)),
customers.address_line_1 (VARCHAR(255)),
customers.town_city (VARCHAR(50)),
customers.county (VARCHAR(50)),
customers.country (VARCHAR(50)),
)
TABLE invoices (
invoices.invoice_number (INTEGER),
invoices.invoice_status_code (VARCHAR(10)),
invoices.invoice_date (DATETIME),
)
TABLE order_items (
order_items.order_item_id (INTEGER),
order_items.product_id (INTEGER),
order_items.order_id (INTEGER),
order_items.order_item_status_code (VARCHAR(10)),
)
TABLE orders (
orders.order_id (INTEGER),
orders.customer_id (INTEGER),
orders.order_status_code (VARCHAR(10)),
orders.date_order_placed (DATETIME),
)
TABLE products (
products.product_id (INTEGER),
products.parent_product_id (INTEGER),
products.product_name (VARCHAR(80)),
products.product_price (DECIMAL(19,4)),
products.product_color (VARCHAR(50)),
products.product_size (VARCHAR(50)),
products.product_description (VARCHAR(255)),
)
TABLE shipment_items (
shipment_items.shipment_id (INTEGER),
shipment_items.order_item_id (INTEGER),
)
TABLE shipments (
shipments.shipment_id (INTEGER),
shipments.order_id (INTEGER),
shipments.invoice_number (INTEGER),
shipments.shipment_tracking_number (VARCHAR(80)),
shipments.shipment_date (DATETIME),
)
Possible JOINs:
customer_payment_methods.customer_id = customers.customer_id
order_items.product_id = products.product_id
order_items.order_id = orders.order_id
orders.customer_id = customers.customer_id
shipment_items.shipment_id = shipments.shipment_id
shipment_items.order_item_id = order_items.order_item_id
shipments.order_id = orders.order_id
shipments.invoice_number = invoices.invoice_number
|
district_spokesman |
CREATE TABLE district (
"District_ID" INTEGER,
"Name" TEXT,
"Area_km" REAL,
"Population" REAL,
"Density_km" REAL,
"Government_website" TEXT,
PRIMARY KEY ("District_ID")
)
CREATE TABLE spokesman (
"Spokesman_ID" INTEGER,
"Name" TEXT,
"Age" INTEGER,
"Speach_title" TEXT,
"Rank_position" REAL,
"Points" REAL,
PRIMARY KEY ("Spokesman_ID")
)
CREATE TABLE spokesman_district (
"Spokesman_ID" INTEGER,
"District_ID" INTEGER,
"Start_year" TEXT,
PRIMARY KEY ("Spokesman_ID"),
FOREIGN KEY("Spokesman_ID") REFERENCES spokesman ("Spokesman_ID"),
FOREIGN KEY("District_ID") REFERENCES district ("District_ID")
) | Find the name of spokesmen who do not speak for any district. | hard | Table district (
district.District_ID (INT),
district.Name (TEXT),
district.Area_km (REAL),
district.Population (REAL),
district.Density_km (REAL),
district.Government_website (TEXT),
)
Table spokesman (
spokesman.Spokesman_ID (INT),
spokesman.Name (TEXT),
spokesman.Age (INT),
spokesman.Speach_title (TEXT),
spokesman.Rank_position (REAL),
spokesman.Points (REAL),
)
Table spokesman_district (
spokesman_district.Spokesman_ID (INT),
spokesman_district.District_ID (INT),
spokesman_district.Start_year (TEXT),
)
Possible JOINs:
spokesman_district.Spokesman_ID = spokesman.Spokesman_ID
spokesman_district.District_ID = district.District_ID
| SELECT name FROM spokesman WHERE Spokesman_ID NOT IN (SELECT Spokesman_ID FROM spokesman_district) | {
'spokesman': ['spokesman_id', 'name'],
'spokesman_district': ['spokesman_id']
} | CREATE TABLE district (
district.District_ID (INT),
district.Name (TEXT),
district.Area_km (REAL),
district.Population (REAL),
district.Density_km (REAL),
district.Government_website (TEXT),
)
CREATE TABLE spokesman (
spokesman.Spokesman_ID (INT),
spokesman.Name (TEXT),
spokesman.Age (INT),
spokesman.Speach_title (TEXT),
spokesman.Rank_position (REAL),
spokesman.Points (REAL),
)
CREATE TABLE spokesman_district (
spokesman_district.Spokesman_ID (INT),
spokesman_district.District_ID (INT),
spokesman_district.Start_year (TEXT),
)
Possible JOINs:
spokesman_district.Spokesman_ID = spokesman.Spokesman_ID
spokesman_district.District_ID = district.District_ID
| Table district (
district.district_id (INT),
district.name (TEXT),
district.area_km (REAL),
district.population (REAL),
district.density_km (REAL),
district.government_website (TEXT),
)
Table spokesman (
spokesman.spokesman_id (INT),
spokesman.name (TEXT),
spokesman.age (INT),
spokesman.speach_title (TEXT),
spokesman.rank_position (REAL),
spokesman.points (REAL),
)
Table spokesman_district (
spokesman_district.spokesman_id (INT),
spokesman_district.district_id (INT),
spokesman_district.start_year (TEXT),
)
Possible JOINs:
spokesman_district.spokesman_id = spokesman.spokesman_id
spokesman_district.district_id = district.district_id
| CREATE TABLE district (
district.district_id (INT),
district.name (TEXT),
district.area_km (REAL),
district.population (REAL),
district.density_km (REAL),
district.government_website (TEXT),
)
CREATE TABLE spokesman (
spokesman.spokesman_id (INT),
spokesman.name (TEXT),
spokesman.age (INT),
spokesman.speach_title (TEXT),
spokesman.rank_position (REAL),
spokesman.points (REAL),
)
CREATE TABLE spokesman_district (
spokesman_district.spokesman_id (INT),
spokesman_district.district_id (INT),
spokesman_district.start_year (TEXT),
)
Possible JOINs:
spokesman_district.spokesman_id = spokesman.spokesman_id
spokesman_district.district_id = district.district_id
| Table district (
district.district_id (INT),
district.name (TEXT),
district.area_km (REAL),
district.population (REAL),
district.density_km (REAL),
district.government_website (TEXT),
)
Table spokesman (
spokesman.spokesman_id (INT),
spokesman.name (TEXT),
spokesman.age (INT),
spokesman.speach_title (TEXT),
spokesman.rank_position (REAL),
spokesman.points (REAL),
)
Table spokesman_district (
spokesman_district.spokesman_id (INT),
spokesman_district.district_id (INT),
spokesman_district.start_year (TEXT),
)
Possible JOINs:
spokesman_district.spokesman_id = spokesman.spokesman_id
spokesman_district.district_id = district.district_id
| CREATE TABLE district (
district.district_id (INT),
district.name (TEXT),
district.area_km (REAL),
district.population (REAL),
district.density_km (REAL),
district.government_website (TEXT),
)
CREATE TABLE spokesman (
spokesman.spokesman_id (INT),
spokesman.name (TEXT),
spokesman.age (INT),
spokesman.speach_title (TEXT),
spokesman.rank_position (REAL),
spokesman.points (REAL),
)
CREATE TABLE spokesman_district (
spokesman_district.spokesman_id (INT),
spokesman_district.district_id (INT),
spokesman_district.start_year (TEXT),
)
Possible JOINs:
spokesman_district.spokesman_id = spokesman.spokesman_id
spokesman_district.district_id = district.district_id
| {
'district': ['District_ID', 'Name', 'Area_km', 'Population', 'Density_km', 'Government_website'],
'spokesman': ['Spokesman_ID', 'Name', 'Age', 'Speach_title', 'Rank_position', 'Points'],
'spokesman_district': ['Spokesman_ID', 'District_ID', 'Start_year']
} | {
'spokesman': ['Spokesman_ID', 'Name'],
'spokesman_district': ['Spokesman_ID']
} | TABLE district (
district.District_ID (INT),
district.Name (TEXT),
district.Area_km (REAL),
district.Population (REAL),
district.Density_km (REAL),
district.Government_website (TEXT),
)
TABLE spokesman (
spokesman.Spokesman_ID (INT),
spokesman.Name (TEXT),
spokesman.Age (INT),
spokesman.Speach_title (TEXT),
spokesman.Rank_position (REAL),
spokesman.Points (REAL),
)
TABLE spokesman_district (
spokesman_district.Spokesman_ID (INT),
spokesman_district.District_ID (INT),
spokesman_district.Start_year (TEXT),
)
Possible JOINs:
spokesman_district.Spokesman_ID = spokesman.Spokesman_ID
spokesman_district.District_ID = district.District_ID
| TABLE district (
district.district_id (INT),
district.name (TEXT),
district.area_km (REAL),
district.population (REAL),
district.density_km (REAL),
district.government_website (TEXT),
)
TABLE spokesman (
spokesman.spokesman_id (INT),
spokesman.name (TEXT),
spokesman.age (INT),
spokesman.speach_title (TEXT),
spokesman.rank_position (REAL),
spokesman.points (REAL),
)
TABLE spokesman_district (
spokesman_district.spokesman_id (INT),
spokesman_district.district_id (INT),
spokesman_district.start_year (TEXT),
)
Possible JOINs:
spokesman_district.spokesman_id = spokesman.spokesman_id
spokesman_district.district_id = district.district_id
| TABLE district (
district.district_id (INT),
district.name (TEXT),
district.area_km (REAL),
district.population (REAL),
district.density_km (REAL),
district.government_website (TEXT),
)
TABLE spokesman (
spokesman.spokesman_id (INT),
spokesman.name (TEXT),
spokesman.age (INT),
spokesman.speach_title (TEXT),
spokesman.rank_position (REAL),
spokesman.points (REAL),
)
TABLE spokesman_district (
spokesman_district.spokesman_id (INT),
spokesman_district.district_id (INT),
spokesman_district.start_year (TEXT),
)
Possible JOINs:
spokesman_district.spokesman_id = spokesman.spokesman_id
spokesman_district.district_id = district.district_id
|
car_road_race |
CREATE TABLE driver (
"Driver_ID" INTEGER,
"Driver_Name" TEXT,
"Entrant" TEXT,
"Constructor" TEXT,
"Chassis" TEXT,
"Engine" TEXT,
"Age" INTEGER,
PRIMARY KEY ("Driver_ID")
)
CREATE TABLE race (
"Road" INTEGER,
"Driver_ID" INTEGER,
"Race_Name" TEXT,
"Pole_Position" TEXT,
"Fastest_Lap" TEXT,
"Winning_driver" TEXT,
"Winning_team" TEXT,
"Report" TEXT,
PRIMARY KEY ("Road"),
FOREIGN KEY("Driver_ID") REFERENCES driver ("Driver_ID")
) | Show the constructors that are used both by drivers with age lower than 20 and drivers with age over than 30. | hard | Table driver (
driver.Driver_ID (INT),
driver.Driver_Name (TEXT),
driver.Entrant (TEXT),
driver.Constructor (TEXT),
driver.Chassis (TEXT),
driver.Engine (TEXT),
driver.Age (INT),
)
Table race (
race.Road (INT),
race.Driver_ID (INT),
race.Race_Name (TEXT),
race.Pole_Position (TEXT),
race.Fastest_Lap (TEXT),
race.Winning_driver (TEXT),
race.Winning_team (TEXT),
race.Report (TEXT),
)
Possible JOINs:
race.Driver_ID = driver.Driver_ID
| SELECT CONSTRUCTOR FROM driver WHERE Age < 20 INTERSECT SELECT CONSTRUCTOR FROM driver WHERE Age > 30 | {
'driver': ['driver_id', 'constructor', 'age']
} | CREATE TABLE driver (
driver.Driver_ID (INT),
driver.Driver_Name (TEXT),
driver.Entrant (TEXT),
driver.Constructor (TEXT),
driver.Chassis (TEXT),
driver.Engine (TEXT),
driver.Age (INT),
)
CREATE TABLE race (
race.Road (INT),
race.Driver_ID (INT),
race.Race_Name (TEXT),
race.Pole_Position (TEXT),
race.Fastest_Lap (TEXT),
race.Winning_driver (TEXT),
race.Winning_team (TEXT),
race.Report (TEXT),
)
Possible JOINs:
race.Driver_ID = driver.Driver_ID
| Table driver (
driver.driver_id (INT),
driver.driver_name (TEXT),
driver.entrant (TEXT),
driver.constructor (TEXT),
driver.chassis (TEXT),
driver.engine (TEXT),
driver.age (INT),
)
Table race (
race.road (INT),
race.driver_id (INT),
race.race_name (TEXT),
race.pole_position (TEXT),
race.fastest_lap (TEXT),
race.winning_driver (TEXT),
race.winning_team (TEXT),
race.report (TEXT),
)
Possible JOINs:
race.driver_id = driver.driver_id
| CREATE TABLE driver (
driver.driver_id (INT),
driver.driver_name (TEXT),
driver.entrant (TEXT),
driver.constructor (TEXT),
driver.chassis (TEXT),
driver.engine (TEXT),
driver.age (INT),
)
CREATE TABLE race (
race.road (INT),
race.driver_id (INT),
race.race_name (TEXT),
race.pole_position (TEXT),
race.fastest_lap (TEXT),
race.winning_driver (TEXT),
race.winning_team (TEXT),
race.report (TEXT),
)
Possible JOINs:
race.driver_id = driver.driver_id
| Table driver (
driver.driver_id (INT),
driver.driver_name (TEXT),
driver.entrant (TEXT),
driver.constructor (TEXT),
driver.chassis (TEXT),
driver.engine (TEXT),
driver.age (INT),
)
Table race (
race.road (INT),
race.driver_id (INT),
race.race_name (TEXT),
race.pole_position (TEXT),
race.fastest_lap (TEXT),
race.winning_driver (TEXT),
race.winning_team (TEXT),
race.report (TEXT),
)
Possible JOINs:
race.driver_id = driver.driver_id
| CREATE TABLE driver (
driver.driver_id (INT),
driver.driver_name (TEXT),
driver.entrant (TEXT),
driver.constructor (TEXT),
driver.chassis (TEXT),
driver.engine (TEXT),
driver.age (INT),
)
CREATE TABLE race (
race.road (INT),
race.driver_id (INT),
race.race_name (TEXT),
race.pole_position (TEXT),
race.fastest_lap (TEXT),
race.winning_driver (TEXT),
race.winning_team (TEXT),
race.report (TEXT),
)
Possible JOINs:
race.driver_id = driver.driver_id
| {
'driver': ['Driver_ID', 'Driver_Name', 'Entrant', 'Constructor', 'Chassis', 'Engine', 'Age'],
'race': ['Road', 'Driver_ID', 'Race_Name', 'Pole_Position', 'Fastest_Lap', 'Winning_driver', 'Winning_team', 'Report']
} | {
'driver': ['Driver_ID', 'Constructor', 'Age']
} | TABLE driver (
driver.Driver_ID (INT),
driver.Driver_Name (TEXT),
driver.Entrant (TEXT),
driver.Constructor (TEXT),
driver.Chassis (TEXT),
driver.Engine (TEXT),
driver.Age (INT),
)
TABLE race (
race.Road (INT),
race.Driver_ID (INT),
race.Race_Name (TEXT),
race.Pole_Position (TEXT),
race.Fastest_Lap (TEXT),
race.Winning_driver (TEXT),
race.Winning_team (TEXT),
race.Report (TEXT),
)
Possible JOINs:
race.Driver_ID = driver.Driver_ID
| TABLE driver (
driver.driver_id (INT),
driver.driver_name (TEXT),
driver.entrant (TEXT),
driver.constructor (TEXT),
driver.chassis (TEXT),
driver.engine (TEXT),
driver.age (INT),
)
TABLE race (
race.road (INT),
race.driver_id (INT),
race.race_name (TEXT),
race.pole_position (TEXT),
race.fastest_lap (TEXT),
race.winning_driver (TEXT),
race.winning_team (TEXT),
race.report (TEXT),
)
Possible JOINs:
race.driver_id = driver.driver_id
| TABLE driver (
driver.driver_id (INT),
driver.driver_name (TEXT),
driver.entrant (TEXT),
driver.constructor (TEXT),
driver.chassis (TEXT),
driver.engine (TEXT),
driver.age (INT),
)
TABLE race (
race.road (INT),
race.driver_id (INT),
race.race_name (TEXT),
race.pole_position (TEXT),
race.fastest_lap (TEXT),
race.winning_driver (TEXT),
race.winning_team (TEXT),
race.report (TEXT),
)
Possible JOINs:
race.driver_id = driver.driver_id
|
university_rank |
CREATE TABLE major (
"Major_ID" INTEGER,
"Major_Name" TEXT,
"Major_Code" INTEGER,
PRIMARY KEY ("Major_ID")
)
CREATE TABLE major_ranking (
"Rank" INTEGER,
"University_ID" INTEGER,
"Major_ID" INTEGER,
PRIMARY KEY ("Rank", "Major_ID", "University_ID"),
FOREIGN KEY("Major_ID") REFERENCES major ("Major_ID"),
FOREIGN KEY("University_ID") REFERENCES university ("University_ID")
)
CREATE TABLE overall_ranking (
"Rank" INTEGER,
"University_ID" INTEGER,
"Reputation_point" INTEGER,
"Research_point" INTEGER,
"Citation_point" INTEGER,
"Total" INTEGER,
PRIMARY KEY ("University_ID"),
FOREIGN KEY("University_ID") REFERENCES university ("University_ID")
)
CREATE TABLE university (
"University_ID" INTEGER,
"University_Name" TEXT,
"City" TEXT,
"State" TEXT,
"Team_Name" TEXT,
"Affiliation" TEXT,
"Enrollment" INTEGER,
"Home_Conference" TEXT,
PRIMARY KEY ("University_ID")
) | What is the name and rank of every university in Wisconsin? | medium | Table major (
major.Major_ID (INT),
major.Major_Name (TEXT),
major.Major_Code (INT),
)
Table major_ranking (
major_ranking.Rank (INT),
major_ranking.University_ID (INT),
major_ranking.Major_ID (INT),
)
Table overall_ranking (
overall_ranking.Rank (INT),
overall_ranking.University_ID (INT),
overall_ranking.Reputation_point (INT),
overall_ranking.Research_point (INT),
overall_ranking.Citation_point (INT),
overall_ranking.Total (INT),
)
Table university (
university.University_ID (INT),
university.University_Name (TEXT),
university.City (TEXT),
university.State (TEXT),
university.Team_Name (TEXT),
university.Affiliation (TEXT),
university.Enrollment (INT),
university.Home_Conference (TEXT),
)
Possible JOINs:
major_ranking.University_ID = university.University_ID
major_ranking.Major_ID = major.Major_ID
overall_ranking.University_ID = university.University_ID
| SELECT University.university_name , Overall_ranking.rank FROM University JOIN Overall_ranking ON University.university_id = Overall_ranking.university_id WHERE University.state = 'Wisconsin' | {
'university': ['university_id', 'university_name', 'state'],
'overall_ranking': ['rank', 'university_id']
} | CREATE TABLE major (
major.Major_ID (INT),
major.Major_Name (TEXT),
major.Major_Code (INT),
)
CREATE TABLE major_ranking (
major_ranking.Rank (INT),
major_ranking.University_ID (INT),
major_ranking.Major_ID (INT),
)
CREATE TABLE overall_ranking (
overall_ranking.Rank (INT),
overall_ranking.University_ID (INT),
overall_ranking.Reputation_point (INT),
overall_ranking.Research_point (INT),
overall_ranking.Citation_point (INT),
overall_ranking.Total (INT),
)
CREATE TABLE university (
university.University_ID (INT),
university.University_Name (TEXT),
university.City (TEXT),
university.State (TEXT),
university.Team_Name (TEXT),
university.Affiliation (TEXT),
university.Enrollment (INT),
university.Home_Conference (TEXT),
)
Possible JOINs:
major_ranking.University_ID = university.University_ID
major_ranking.Major_ID = major.Major_ID
overall_ranking.University_ID = university.University_ID
| Table major (
major.major_id (INT),
major.major_name (TEXT),
major.major_code (INT),
)
Table major_ranking (
major_ranking.rank (INT),
major_ranking.university_id (INT),
major_ranking.major_id (INT),
)
Table overall_ranking (
overall_ranking.rank (INT),
overall_ranking.university_id (INT),
overall_ranking.reputation_point (INT),
overall_ranking.research_point (INT),
overall_ranking.citation_point (INT),
overall_ranking.total (INT),
)
Table university (
university.university_id (INT),
university.university_name (TEXT),
university.city (TEXT),
university.state (TEXT),
university.team_name (TEXT),
university.affiliation (TEXT),
university.enrollment (INT),
university.home_conference (TEXT),
)
Possible JOINs:
major_ranking.university_id = university.university_id
major_ranking.major_id = major.major_id
overall_ranking.university_id = university.university_id
| CREATE TABLE major (
major.major_id (INT),
major.major_name (TEXT),
major.major_code (INT),
)
CREATE TABLE major_ranking (
major_ranking.rank (INT),
major_ranking.university_id (INT),
major_ranking.major_id (INT),
)
CREATE TABLE overall_ranking (
overall_ranking.rank (INT),
overall_ranking.university_id (INT),
overall_ranking.reputation_point (INT),
overall_ranking.research_point (INT),
overall_ranking.citation_point (INT),
overall_ranking.total (INT),
)
CREATE TABLE university (
university.university_id (INT),
university.university_name (TEXT),
university.city (TEXT),
university.state (TEXT),
university.team_name (TEXT),
university.affiliation (TEXT),
university.enrollment (INT),
university.home_conference (TEXT),
)
Possible JOINs:
major_ranking.university_id = university.university_id
major_ranking.major_id = major.major_id
overall_ranking.university_id = university.university_id
| Table major (
major.major_id (INT),
major.major_name (TEXT),
major.major_code (INT),
)
Table major_ranking (
major_ranking.rank (INT),
major_ranking.university_id (INT),
major_ranking.major_id (INT),
)
Table overall_ranking (
overall_ranking.rank (INT),
overall_ranking.university_id (INT),
overall_ranking.reputation_point (INT),
overall_ranking.research_point (INT),
overall_ranking.citation_point (INT),
overall_ranking.total (INT),
)
Table university (
university.university_id (INT),
university.university_name (TEXT),
university.city (TEXT),
university.state (TEXT),
university.team_name (TEXT),
university.affiliation (TEXT),
university.enrollment (INT),
university.home_conference (TEXT),
)
Possible JOINs:
major_ranking.university_id = university.university_id
major_ranking.major_id = major.major_id
overall_ranking.university_id = university.university_id
| CREATE TABLE major (
major.major_id (INT),
major.major_name (TEXT),
major.major_code (INT),
)
CREATE TABLE major_ranking (
major_ranking.rank (INT),
major_ranking.university_id (INT),
major_ranking.major_id (INT),
)
CREATE TABLE overall_ranking (
overall_ranking.rank (INT),
overall_ranking.university_id (INT),
overall_ranking.reputation_point (INT),
overall_ranking.research_point (INT),
overall_ranking.citation_point (INT),
overall_ranking.total (INT),
)
CREATE TABLE university (
university.university_id (INT),
university.university_name (TEXT),
university.city (TEXT),
university.state (TEXT),
university.team_name (TEXT),
university.affiliation (TEXT),
university.enrollment (INT),
university.home_conference (TEXT),
)
Possible JOINs:
major_ranking.university_id = university.university_id
major_ranking.major_id = major.major_id
overall_ranking.university_id = university.university_id
| {
'university': ['University_ID', 'University_Name', 'City', 'State', 'Team_Name', 'Affiliation', 'Enrollment', 'Home_Conference'],
'overall_ranking': ['Rank', 'University_ID', 'Reputation_point', 'Research_point', 'Citation_point', 'Total'],
'major': ['Major_ID', 'Major_Name', 'Major_Code'],
'major_ranking': ['Rank', 'University_ID', 'Major_ID']
} | {
'university': ['University_ID', 'University_Name', 'State'],
'overall_ranking': ['Rank', 'University_ID']
} | TABLE major (
major.Major_ID (INT),
major.Major_Name (TEXT),
major.Major_Code (INT),
)
TABLE major_ranking (
major_ranking.Rank (INT),
major_ranking.University_ID (INT),
major_ranking.Major_ID (INT),
)
TABLE overall_ranking (
overall_ranking.Rank (INT),
overall_ranking.University_ID (INT),
overall_ranking.Reputation_point (INT),
overall_ranking.Research_point (INT),
overall_ranking.Citation_point (INT),
overall_ranking.Total (INT),
)
TABLE university (
university.University_ID (INT),
university.University_Name (TEXT),
university.City (TEXT),
university.State (TEXT),
university.Team_Name (TEXT),
university.Affiliation (TEXT),
university.Enrollment (INT),
university.Home_Conference (TEXT),
)
Possible JOINs:
major_ranking.University_ID = university.University_ID
major_ranking.Major_ID = major.Major_ID
overall_ranking.University_ID = university.University_ID
| TABLE major (
major.major_id (INT),
major.major_name (TEXT),
major.major_code (INT),
)
TABLE major_ranking (
major_ranking.rank (INT),
major_ranking.university_id (INT),
major_ranking.major_id (INT),
)
TABLE overall_ranking (
overall_ranking.rank (INT),
overall_ranking.university_id (INT),
overall_ranking.reputation_point (INT),
overall_ranking.research_point (INT),
overall_ranking.citation_point (INT),
overall_ranking.total (INT),
)
TABLE university (
university.university_id (INT),
university.university_name (TEXT),
university.city (TEXT),
university.state (TEXT),
university.team_name (TEXT),
university.affiliation (TEXT),
university.enrollment (INT),
university.home_conference (TEXT),
)
Possible JOINs:
major_ranking.university_id = university.university_id
major_ranking.major_id = major.major_id
overall_ranking.university_id = university.university_id
| TABLE major (
major.major_id (INT),
major.major_name (TEXT),
major.major_code (INT),
)
TABLE major_ranking (
major_ranking.rank (INT),
major_ranking.university_id (INT),
major_ranking.major_id (INT),
)
TABLE overall_ranking (
overall_ranking.rank (INT),
overall_ranking.university_id (INT),
overall_ranking.reputation_point (INT),
overall_ranking.research_point (INT),
overall_ranking.citation_point (INT),
overall_ranking.total (INT),
)
TABLE university (
university.university_id (INT),
university.university_name (TEXT),
university.city (TEXT),
university.state (TEXT),
university.team_name (TEXT),
university.affiliation (TEXT),
university.enrollment (INT),
university.home_conference (TEXT),
)
Possible JOINs:
major_ranking.university_id = university.university_id
major_ranking.major_id = major.major_id
overall_ranking.university_id = university.university_id
|
address_1 |
CREATE TABLE "City" (
city_code VARCHAR(3),
city_name VARCHAR(25),
state VARCHAR(2),
country VARCHAR(25),
latitude FLOAT,
longitude FLOAT,
PRIMARY KEY (city_code)
)
CREATE TABLE "Direct_distance" (
city1_code VARCHAR(3),
city2_code VARCHAR(3),
distance INTEGER,
FOREIGN KEY(city1_code) REFERENCES "City" (city_code),
FOREIGN KEY(city2_code) REFERENCES "City" (city_code)
)
CREATE TABLE "Student" (
"StuID" INTEGER,
"LName" VARCHAR(12),
"Fname" VARCHAR(12),
"Age" INTEGER,
"Sex" VARCHAR(1),
"Major" INTEGER,
"Advisor" INTEGER,
city_code VARCHAR(3),
PRIMARY KEY ("StuID"),
FOREIGN KEY(city_code) REFERENCES "City" (city_code)
) | Count the number of cities. | easy | Table City (
City.city_code (VARCHAR(3)),
City.city_name (VARCHAR(25)),
City.state (VARCHAR(2)),
City.country (VARCHAR(25)),
City.latitude (FLOAT),
City.longitude (FLOAT),
)
Table Direct_distance (
Direct_distance.city1_code (varchar(3)),
Direct_distance.city2_code (varchar(3)),
Direct_distance.distance (INTEGER),
)
Table Student (
Student.StuID (INTEGER),
Student.LName (VARCHAR(12)),
Student.Fname (VARCHAR(12)),
Student.Age (INTEGER),
Student.Sex (VARCHAR(1)),
Student.Major (INTEGER),
Student.Advisor (INTEGER),
Student.city_code (VARCHAR(3)),
)
Possible JOINs:
Direct_distance.city1_code = City.city_code
Direct_distance.city2_code = City.city_code
Student.city_code = City.city_code
| SELECT count(*) FROM City | {
'city': ['city_code']
} | CREATE TABLE City (
City.city_code (VARCHAR(3)),
City.city_name (VARCHAR(25)),
City.state (VARCHAR(2)),
City.country (VARCHAR(25)),
City.latitude (FLOAT),
City.longitude (FLOAT),
)
CREATE TABLE Direct_distance (
Direct_distance.city1_code (varchar(3)),
Direct_distance.city2_code (varchar(3)),
Direct_distance.distance (INTEGER),
)
CREATE TABLE Student (
Student.StuID (INTEGER),
Student.LName (VARCHAR(12)),
Student.Fname (VARCHAR(12)),
Student.Age (INTEGER),
Student.Sex (VARCHAR(1)),
Student.Major (INTEGER),
Student.Advisor (INTEGER),
Student.city_code (VARCHAR(3)),
)
Possible JOINs:
Direct_distance.city1_code = City.city_code
Direct_distance.city2_code = City.city_code
Student.city_code = City.city_code
| Table City (
City.city_code (VARCHAR(3)),
City.city_name (VARCHAR(25)),
City.state (VARCHAR(2)),
City.country (VARCHAR(25)),
City.latitude (FLOAT),
City.longitude (FLOAT),
)
Table Direct_distance (
Direct_distance.city1_code (varchar(3)),
Direct_distance.city2_code (varchar(3)),
Direct_distance.distance (INTEGER),
)
Table Student (
Student.stuid (INTEGER),
Student.lname (VARCHAR(12)),
Student.fname (VARCHAR(12)),
Student.age (INTEGER),
Student.sex (VARCHAR(1)),
Student.major (INTEGER),
Student.advisor (INTEGER),
Student.city_code (VARCHAR(3)),
)
Possible JOINs:
Direct_distance.city1_code = City.city_code
Direct_distance.city2_code = City.city_code
Student.city_code = City.city_code
| CREATE TABLE City (
City.city_code (VARCHAR(3)),
City.city_name (VARCHAR(25)),
City.state (VARCHAR(2)),
City.country (VARCHAR(25)),
City.latitude (FLOAT),
City.longitude (FLOAT),
)
CREATE TABLE Direct_distance (
Direct_distance.city1_code (varchar(3)),
Direct_distance.city2_code (varchar(3)),
Direct_distance.distance (INTEGER),
)
CREATE TABLE Student (
Student.stuid (INTEGER),
Student.lname (VARCHAR(12)),
Student.fname (VARCHAR(12)),
Student.age (INTEGER),
Student.sex (VARCHAR(1)),
Student.major (INTEGER),
Student.advisor (INTEGER),
Student.city_code (VARCHAR(3)),
)
Possible JOINs:
Direct_distance.city1_code = City.city_code
Direct_distance.city2_code = City.city_code
Student.city_code = City.city_code
| Table city (
city.city_code (VARCHAR(3)),
city.city_name (VARCHAR(25)),
city.state (VARCHAR(2)),
city.country (VARCHAR(25)),
city.latitude (FLOAT),
city.longitude (FLOAT),
)
Table direct_distance (
direct_distance.city1_code (varchar(3)),
direct_distance.city2_code (varchar(3)),
direct_distance.distance (INTEGER),
)
Table student (
student.stuid (INTEGER),
student.lname (VARCHAR(12)),
student.fname (VARCHAR(12)),
student.age (INTEGER),
student.sex (VARCHAR(1)),
student.major (INTEGER),
student.advisor (INTEGER),
student.city_code (VARCHAR(3)),
)
Possible JOINs:
direct_distance.city1_code = city.city_code
direct_distance.city2_code = city.city_code
student.city_code = city.city_code
| CREATE TABLE city (
city.city_code (VARCHAR(3)),
city.city_name (VARCHAR(25)),
city.state (VARCHAR(2)),
city.country (VARCHAR(25)),
city.latitude (FLOAT),
city.longitude (FLOAT),
)
CREATE TABLE direct_distance (
direct_distance.city1_code (varchar(3)),
direct_distance.city2_code (varchar(3)),
direct_distance.distance (INTEGER),
)
CREATE TABLE student (
student.stuid (INTEGER),
student.lname (VARCHAR(12)),
student.fname (VARCHAR(12)),
student.age (INTEGER),
student.sex (VARCHAR(1)),
student.major (INTEGER),
student.advisor (INTEGER),
student.city_code (VARCHAR(3)),
)
Possible JOINs:
direct_distance.city1_code = city.city_code
direct_distance.city2_code = city.city_code
student.city_code = city.city_code
| {
'Student': ['StuID', 'LName', 'Fname', 'Age', 'Sex', 'Major', 'Advisor', 'city_code'],
'Direct_distance': ['city1_code', 'city2_code', 'distance'],
'City': ['city_code', 'city_name', 'state', 'country', 'latitude', 'longitude']
} | {
'City': ['city_code']
} | TABLE City (
City.city_code (VARCHAR(3)),
City.city_name (VARCHAR(25)),
City.state (VARCHAR(2)),
City.country (VARCHAR(25)),
City.latitude (FLOAT),
City.longitude (FLOAT),
)
TABLE Direct_distance (
Direct_distance.city1_code (varchar(3)),
Direct_distance.city2_code (varchar(3)),
Direct_distance.distance (INTEGER),
)
TABLE Student (
Student.StuID (INTEGER),
Student.LName (VARCHAR(12)),
Student.Fname (VARCHAR(12)),
Student.Age (INTEGER),
Student.Sex (VARCHAR(1)),
Student.Major (INTEGER),
Student.Advisor (INTEGER),
Student.city_code (VARCHAR(3)),
)
Possible JOINs:
Direct_distance.city1_code = City.city_code
Direct_distance.city2_code = City.city_code
Student.city_code = City.city_code
| TABLE City (
City.city_code (VARCHAR(3)),
City.city_name (VARCHAR(25)),
City.state (VARCHAR(2)),
City.country (VARCHAR(25)),
City.latitude (FLOAT),
City.longitude (FLOAT),
)
TABLE Direct_distance (
Direct_distance.city1_code (varchar(3)),
Direct_distance.city2_code (varchar(3)),
Direct_distance.distance (INTEGER),
)
TABLE Student (
Student.stuid (INTEGER),
Student.lname (VARCHAR(12)),
Student.fname (VARCHAR(12)),
Student.age (INTEGER),
Student.sex (VARCHAR(1)),
Student.major (INTEGER),
Student.advisor (INTEGER),
Student.city_code (VARCHAR(3)),
)
Possible JOINs:
Direct_distance.city1_code = City.city_code
Direct_distance.city2_code = City.city_code
Student.city_code = City.city_code
| TABLE city (
city.city_code (VARCHAR(3)),
city.city_name (VARCHAR(25)),
city.state (VARCHAR(2)),
city.country (VARCHAR(25)),
city.latitude (FLOAT),
city.longitude (FLOAT),
)
TABLE direct_distance (
direct_distance.city1_code (varchar(3)),
direct_distance.city2_code (varchar(3)),
direct_distance.distance (INTEGER),
)
TABLE student (
student.stuid (INTEGER),
student.lname (VARCHAR(12)),
student.fname (VARCHAR(12)),
student.age (INTEGER),
student.sex (VARCHAR(1)),
student.major (INTEGER),
student.advisor (INTEGER),
student.city_code (VARCHAR(3)),
)
Possible JOINs:
direct_distance.city1_code = city.city_code
direct_distance.city2_code = city.city_code
student.city_code = city.city_code
|
planet_1 |
CREATE TABLE "Client" (
"AccountNumber" INTEGER,
"Name" VARCHAR(255) NOT NULL,
PRIMARY KEY ("AccountNumber")
)
CREATE TABLE "Employee" (
"EmployeeID" INTEGER,
"Name" VARCHAR(255) NOT NULL,
"Position" VARCHAR(255) NOT NULL,
"Salary" REAL NOT NULL,
"Remarks" VARCHAR(255),
PRIMARY KEY ("EmployeeID")
)
CREATE TABLE "Has_Clearance" (
"Employee" INTEGER NOT NULL,
"Planet" INTEGER NOT NULL,
"Level" INTEGER NOT NULL,
PRIMARY KEY ("Employee", "Planet"),
FOREIGN KEY("Employee") REFERENCES "Employee" ("EmployeeID"),
FOREIGN KEY("Planet") REFERENCES "Planet" ("PlanetID")
)
CREATE TABLE "Package" (
"Shipment" INTEGER NOT NULL,
"PackageNumber" INTEGER NOT NULL,
"Contents" VARCHAR(255) NOT NULL,
"Weight" REAL NOT NULL,
"Sender" INTEGER NOT NULL,
"Recipient" INTEGER NOT NULL,
PRIMARY KEY ("Shipment", "PackageNumber"),
FOREIGN KEY("Shipment") REFERENCES "Shipment" ("ShipmentID"),
FOREIGN KEY("Sender") REFERENCES "Client" ("AccountNumber"),
FOREIGN KEY("Recipient") REFERENCES "Client" ("AccountNumber")
)
CREATE TABLE "Planet" (
"PlanetID" INTEGER,
"Name" VARCHAR(255) NOT NULL,
"Coordinates" REAL NOT NULL,
PRIMARY KEY ("PlanetID")
)
CREATE TABLE "Shipment" (
"ShipmentID" INTEGER,
"Date" DATE,
"Manager" INTEGER NOT NULL,
"Planet" INTEGER NOT NULL,
PRIMARY KEY ("ShipmentID"),
FOREIGN KEY("Manager") REFERENCES "Employee" ("EmployeeID"),
FOREIGN KEY("Planet") REFERENCES "Planet" ("PlanetID")
) | What are the number of packages sent by Zapp Brannigan and shipped on the Omicron Persei 8? | extra | Table Client (
Client.AccountNumber (INTEGER),
Client.Name (VARCHAR(255)),
)
Table Employee (
Employee.EmployeeID (INTEGER),
Employee.Name (VARCHAR(255)),
Employee.Position (VARCHAR(255)),
Employee.Salary (REAL),
Employee.Remarks (VARCHAR(255)),
)
Table Has_Clearance (
Has_Clearance.Employee (INTEGER),
Has_Clearance.Planet (INTEGER),
Has_Clearance.Level (INTEGER),
)
Table Package (
Package.Shipment (INTEGER),
Package.PackageNumber (INTEGER),
Package.Contents (VARCHAR(255)),
Package.Weight (REAL),
Package.Sender (INTEGER),
Package.Recipient (INTEGER),
)
Table Planet (
Planet.PlanetID (INTEGER),
Planet.Name (VARCHAR(255)),
Planet.Coordinates (REAL),
)
Table Shipment (
Shipment.ShipmentID (INTEGER),
Shipment.Date (DATE),
Shipment.Manager (INTEGER),
Shipment.Planet (INTEGER),
)
Possible JOINs:
Has_Clearance.Employee = Employee.EmployeeID
Has_Clearance.Planet = Planet.PlanetID
Package.Shipment = Shipment.ShipmentID
Package.Sender = Client.AccountNumber
Package.Recipient = Client.AccountNumber
Shipment.Manager = Employee.EmployeeID
Shipment.Planet = Planet.PlanetID
| SELECT T1.PackageNumber FROM PACKAGE AS T1 JOIN Client ON T1.Sender = Client.AccountNumber JOIN Shipment ON T1.Shipment = Shipment.ShipmentID JOIN Planet ON Shipment.Planet = Planet.PlanetID WHERE Client.Name = "Zapp Brannigan" AND Planet.Name = "Omicron Persei 8"; | {
'package': ['shipment'],
'client': ['accountnumber', 'name'],
'shipment': ['shipmentid', 'planet'],
'planet': ['planetid', 'name']
} | CREATE TABLE Client (
Client.AccountNumber (INTEGER),
Client.Name (VARCHAR(255)),
)
CREATE TABLE Employee (
Employee.EmployeeID (INTEGER),
Employee.Name (VARCHAR(255)),
Employee.Position (VARCHAR(255)),
Employee.Salary (REAL),
Employee.Remarks (VARCHAR(255)),
)
CREATE TABLE Has_Clearance (
Has_Clearance.Employee (INTEGER),
Has_Clearance.Planet (INTEGER),
Has_Clearance.Level (INTEGER),
)
CREATE TABLE Package (
Package.Shipment (INTEGER),
Package.PackageNumber (INTEGER),
Package.Contents (VARCHAR(255)),
Package.Weight (REAL),
Package.Sender (INTEGER),
Package.Recipient (INTEGER),
)
CREATE TABLE Planet (
Planet.PlanetID (INTEGER),
Planet.Name (VARCHAR(255)),
Planet.Coordinates (REAL),
)
CREATE TABLE Shipment (
Shipment.ShipmentID (INTEGER),
Shipment.Date (DATE),
Shipment.Manager (INTEGER),
Shipment.Planet (INTEGER),
)
Possible JOINs:
Has_Clearance.Employee = Employee.EmployeeID
Has_Clearance.Planet = Planet.PlanetID
Package.Shipment = Shipment.ShipmentID
Package.Sender = Client.AccountNumber
Package.Recipient = Client.AccountNumber
Shipment.Manager = Employee.EmployeeID
Shipment.Planet = Planet.PlanetID
| Table Client (
Client.accountnumber (INTEGER),
Client.name (VARCHAR(255)),
)
Table Employee (
Employee.employeeid (INTEGER),
Employee.name (VARCHAR(255)),
Employee.position (VARCHAR(255)),
Employee.salary (REAL),
Employee.remarks (VARCHAR(255)),
)
Table Has_Clearance (
Has_Clearance.employee (INTEGER),
Has_Clearance.planet (INTEGER),
Has_Clearance.level (INTEGER),
)
Table Package (
Package.shipment (INTEGER),
Package.packagenumber (INTEGER),
Package.contents (VARCHAR(255)),
Package.weight (REAL),
Package.sender (INTEGER),
Package.recipient (INTEGER),
)
Table Planet (
Planet.planetid (INTEGER),
Planet.name (VARCHAR(255)),
Planet.coordinates (REAL),
)
Table Shipment (
Shipment.shipmentid (INTEGER),
Shipment.date (DATE),
Shipment.manager (INTEGER),
Shipment.planet (INTEGER),
)
Possible JOINs:
Has_Clearance.employee = Employee.employeeid
Has_Clearance.planet = Planet.planetid
Package.shipment = Shipment.shipmentid
Package.sender = Client.accountnumber
Package.recipient = Client.accountnumber
Shipment.manager = Employee.employeeid
Shipment.planet = Planet.planetid
| CREATE TABLE Client (
Client.accountnumber (INTEGER),
Client.name (VARCHAR(255)),
)
CREATE TABLE Employee (
Employee.employeeid (INTEGER),
Employee.name (VARCHAR(255)),
Employee.position (VARCHAR(255)),
Employee.salary (REAL),
Employee.remarks (VARCHAR(255)),
)
CREATE TABLE Has_Clearance (
Has_Clearance.employee (INTEGER),
Has_Clearance.planet (INTEGER),
Has_Clearance.level (INTEGER),
)
CREATE TABLE Package (
Package.shipment (INTEGER),
Package.packagenumber (INTEGER),
Package.contents (VARCHAR(255)),
Package.weight (REAL),
Package.sender (INTEGER),
Package.recipient (INTEGER),
)
CREATE TABLE Planet (
Planet.planetid (INTEGER),
Planet.name (VARCHAR(255)),
Planet.coordinates (REAL),
)
CREATE TABLE Shipment (
Shipment.shipmentid (INTEGER),
Shipment.date (DATE),
Shipment.manager (INTEGER),
Shipment.planet (INTEGER),
)
Possible JOINs:
Has_Clearance.employee = Employee.employeeid
Has_Clearance.planet = Planet.planetid
Package.shipment = Shipment.shipmentid
Package.sender = Client.accountnumber
Package.recipient = Client.accountnumber
Shipment.manager = Employee.employeeid
Shipment.planet = Planet.planetid
| Table client (
client.accountnumber (INTEGER),
client.name (VARCHAR(255)),
)
Table employee (
employee.employeeid (INTEGER),
employee.name (VARCHAR(255)),
employee.position (VARCHAR(255)),
employee.salary (REAL),
employee.remarks (VARCHAR(255)),
)
Table has_clearance (
has_clearance.employee (INTEGER),
has_clearance.planet (INTEGER),
has_clearance.level (INTEGER),
)
Table package (
package.shipment (INTEGER),
package.packagenumber (INTEGER),
package.contents (VARCHAR(255)),
package.weight (REAL),
package.sender (INTEGER),
package.recipient (INTEGER),
)
Table planet (
planet.planetid (INTEGER),
planet.name (VARCHAR(255)),
planet.coordinates (REAL),
)
Table shipment (
shipment.shipmentid (INTEGER),
shipment.date (DATE),
shipment.manager (INTEGER),
shipment.planet (INTEGER),
)
Possible JOINs:
has_clearance.employee = employee.employeeid
has_clearance.planet = planet.planetid
package.shipment = shipment.shipmentid
package.sender = client.accountnumber
package.recipient = client.accountnumber
shipment.manager = employee.employeeid
shipment.planet = planet.planetid
| CREATE TABLE client (
client.accountnumber (INTEGER),
client.name (VARCHAR(255)),
)
CREATE TABLE employee (
employee.employeeid (INTEGER),
employee.name (VARCHAR(255)),
employee.position (VARCHAR(255)),
employee.salary (REAL),
employee.remarks (VARCHAR(255)),
)
CREATE TABLE has_clearance (
has_clearance.employee (INTEGER),
has_clearance.planet (INTEGER),
has_clearance.level (INTEGER),
)
CREATE TABLE package (
package.shipment (INTEGER),
package.packagenumber (INTEGER),
package.contents (VARCHAR(255)),
package.weight (REAL),
package.sender (INTEGER),
package.recipient (INTEGER),
)
CREATE TABLE planet (
planet.planetid (INTEGER),
planet.name (VARCHAR(255)),
planet.coordinates (REAL),
)
CREATE TABLE shipment (
shipment.shipmentid (INTEGER),
shipment.date (DATE),
shipment.manager (INTEGER),
shipment.planet (INTEGER),
)
Possible JOINs:
has_clearance.employee = employee.employeeid
has_clearance.planet = planet.planetid
package.shipment = shipment.shipmentid
package.sender = client.accountnumber
package.recipient = client.accountnumber
shipment.manager = employee.employeeid
shipment.planet = planet.planetid
| {
'Employee': ['EmployeeID', 'Name', 'Position', 'Salary', 'Remarks'],
'Planet': ['PlanetID', 'Name', 'Coordinates'],
'Shipment': ['ShipmentID', 'Date', 'Manager', 'Planet'],
'Has_Clearance': ['Employee', 'Planet', 'Level'],
'Client': ['AccountNumber', 'Name'],
'Package': ['Shipment', 'PackageNumber', 'Contents', 'Weight', 'Sender', 'Recipient']
} | {
'Package': ['Shipment'],
'Client': ['AccountNumber', 'Name'],
'Shipment': ['ShipmentID', 'Planet'],
'Planet': ['PlanetID', 'Name']
} | TABLE Client (
Client.AccountNumber (INTEGER),
Client.Name (VARCHAR(255)),
)
TABLE Employee (
Employee.EmployeeID (INTEGER),
Employee.Name (VARCHAR(255)),
Employee.Position (VARCHAR(255)),
Employee.Salary (REAL),
Employee.Remarks (VARCHAR(255)),
)
TABLE Has_Clearance (
Has_Clearance.Employee (INTEGER),
Has_Clearance.Planet (INTEGER),
Has_Clearance.Level (INTEGER),
)
TABLE Package (
Package.Shipment (INTEGER),
Package.PackageNumber (INTEGER),
Package.Contents (VARCHAR(255)),
Package.Weight (REAL),
Package.Sender (INTEGER),
Package.Recipient (INTEGER),
)
TABLE Planet (
Planet.PlanetID (INTEGER),
Planet.Name (VARCHAR(255)),
Planet.Coordinates (REAL),
)
TABLE Shipment (
Shipment.ShipmentID (INTEGER),
Shipment.Date (DATE),
Shipment.Manager (INTEGER),
Shipment.Planet (INTEGER),
)
Possible JOINs:
Has_Clearance.Employee = Employee.EmployeeID
Has_Clearance.Planet = Planet.PlanetID
Package.Shipment = Shipment.ShipmentID
Package.Sender = Client.AccountNumber
Package.Recipient = Client.AccountNumber
Shipment.Manager = Employee.EmployeeID
Shipment.Planet = Planet.PlanetID
| TABLE Client (
Client.accountnumber (INTEGER),
Client.name (VARCHAR(255)),
)
TABLE Employee (
Employee.employeeid (INTEGER),
Employee.name (VARCHAR(255)),
Employee.position (VARCHAR(255)),
Employee.salary (REAL),
Employee.remarks (VARCHAR(255)),
)
TABLE Has_Clearance (
Has_Clearance.employee (INTEGER),
Has_Clearance.planet (INTEGER),
Has_Clearance.level (INTEGER),
)
TABLE Package (
Package.shipment (INTEGER),
Package.packagenumber (INTEGER),
Package.contents (VARCHAR(255)),
Package.weight (REAL),
Package.sender (INTEGER),
Package.recipient (INTEGER),
)
TABLE Planet (
Planet.planetid (INTEGER),
Planet.name (VARCHAR(255)),
Planet.coordinates (REAL),
)
TABLE Shipment (
Shipment.shipmentid (INTEGER),
Shipment.date (DATE),
Shipment.manager (INTEGER),
Shipment.planet (INTEGER),
)
Possible JOINs:
Has_Clearance.employee = Employee.employeeid
Has_Clearance.planet = Planet.planetid
Package.shipment = Shipment.shipmentid
Package.sender = Client.accountnumber
Package.recipient = Client.accountnumber
Shipment.manager = Employee.employeeid
Shipment.planet = Planet.planetid
| TABLE client (
client.accountnumber (INTEGER),
client.name (VARCHAR(255)),
)
TABLE employee (
employee.employeeid (INTEGER),
employee.name (VARCHAR(255)),
employee.position (VARCHAR(255)),
employee.salary (REAL),
employee.remarks (VARCHAR(255)),
)
TABLE has_clearance (
has_clearance.employee (INTEGER),
has_clearance.planet (INTEGER),
has_clearance.level (INTEGER),
)
TABLE package (
package.shipment (INTEGER),
package.packagenumber (INTEGER),
package.contents (VARCHAR(255)),
package.weight (REAL),
package.sender (INTEGER),
package.recipient (INTEGER),
)
TABLE planet (
planet.planetid (INTEGER),
planet.name (VARCHAR(255)),
planet.coordinates (REAL),
)
TABLE shipment (
shipment.shipmentid (INTEGER),
shipment.date (DATE),
shipment.manager (INTEGER),
shipment.planet (INTEGER),
)
Possible JOINs:
has_clearance.employee = employee.employeeid
has_clearance.planet = planet.planetid
package.shipment = shipment.shipmentid
package.sender = client.accountnumber
package.recipient = client.accountnumber
shipment.manager = employee.employeeid
shipment.planet = planet.planetid
|
movie_2 |
CREATE TABLE "MovieTheaters" (
"Code" INTEGER,
"Name" VARCHAR(255) NOT NULL,
"Movie" INTEGER,
PRIMARY KEY ("Code"),
FOREIGN KEY("Movie") REFERENCES "Movies" ("Code")
)
CREATE TABLE "Movies" (
"Code" INTEGER,
"Title" VARCHAR(255) NOT NULL,
"Rating" VARCHAR(255),
PRIMARY KEY ("Code")
) | How many movies exist for each rating? | medium | Table MovieTheaters (
MovieTheaters.Code (INTEGER),
MovieTheaters.Name (VARCHAR(255)),
MovieTheaters.Movie (INTEGER),
)
Table Movies (
Movies.Code (INTEGER),
Movies.Title (VARCHAR(255)),
Movies.Rating (VARCHAR(255)),
)
Possible JOINs:
MovieTheaters.Movie = Movies.Code
| SELECT count(*) , rating FROM movies GROUP BY rating | {
'movies': ['code', 'rating']
} | CREATE TABLE MovieTheaters (
MovieTheaters.Code (INTEGER),
MovieTheaters.Name (VARCHAR(255)),
MovieTheaters.Movie (INTEGER),
)
CREATE TABLE Movies (
Movies.Code (INTEGER),
Movies.Title (VARCHAR(255)),
Movies.Rating (VARCHAR(255)),
)
Possible JOINs:
MovieTheaters.Movie = Movies.Code
| Table MovieTheaters (
MovieTheaters.code (INTEGER),
MovieTheaters.name (VARCHAR(255)),
MovieTheaters.movie (INTEGER),
)
Table Movies (
Movies.code (INTEGER),
Movies.title (VARCHAR(255)),
Movies.rating (VARCHAR(255)),
)
Possible JOINs:
MovieTheaters.movie = Movies.code
| CREATE TABLE MovieTheaters (
MovieTheaters.code (INTEGER),
MovieTheaters.name (VARCHAR(255)),
MovieTheaters.movie (INTEGER),
)
CREATE TABLE Movies (
Movies.code (INTEGER),
Movies.title (VARCHAR(255)),
Movies.rating (VARCHAR(255)),
)
Possible JOINs:
MovieTheaters.movie = Movies.code
| Table movietheaters (
movietheaters.code (INTEGER),
movietheaters.name (VARCHAR(255)),
movietheaters.movie (INTEGER),
)
Table movies (
movies.code (INTEGER),
movies.title (VARCHAR(255)),
movies.rating (VARCHAR(255)),
)
Possible JOINs:
movietheaters.movie = movies.code
| CREATE TABLE movietheaters (
movietheaters.code (INTEGER),
movietheaters.name (VARCHAR(255)),
movietheaters.movie (INTEGER),
)
CREATE TABLE movies (
movies.code (INTEGER),
movies.title (VARCHAR(255)),
movies.rating (VARCHAR(255)),
)
Possible JOINs:
movietheaters.movie = movies.code
| {
'Movies': ['Code', 'Title', 'Rating'],
'MovieTheaters': ['Code', 'Name', 'Movie']
} | {
'Movies': ['Code', 'Rating']
} | TABLE MovieTheaters (
MovieTheaters.Code (INTEGER),
MovieTheaters.Name (VARCHAR(255)),
MovieTheaters.Movie (INTEGER),
)
TABLE Movies (
Movies.Code (INTEGER),
Movies.Title (VARCHAR(255)),
Movies.Rating (VARCHAR(255)),
)
Possible JOINs:
MovieTheaters.Movie = Movies.Code
| TABLE MovieTheaters (
MovieTheaters.code (INTEGER),
MovieTheaters.name (VARCHAR(255)),
MovieTheaters.movie (INTEGER),
)
TABLE Movies (
Movies.code (INTEGER),
Movies.title (VARCHAR(255)),
Movies.rating (VARCHAR(255)),
)
Possible JOINs:
MovieTheaters.movie = Movies.code
| TABLE movietheaters (
movietheaters.code (INTEGER),
movietheaters.name (VARCHAR(255)),
movietheaters.movie (INTEGER),
)
TABLE movies (
movies.code (INTEGER),
movies.title (VARCHAR(255)),
movies.rating (VARCHAR(255)),
)
Possible JOINs:
movietheaters.movie = movies.code
|
movie_2 |
CREATE TABLE "MovieTheaters" (
"Code" INTEGER,
"Name" VARCHAR(255) NOT NULL,
"Movie" INTEGER,
PRIMARY KEY ("Code"),
FOREIGN KEY("Movie") REFERENCES "Movies" ("Code")
)
CREATE TABLE "Movies" (
"Code" INTEGER,
"Title" VARCHAR(255) NOT NULL,
"Rating" VARCHAR(255),
PRIMARY KEY ("Code")
) | Find the name of all movies that are not played in Odeon theater. | hard | Table MovieTheaters (
MovieTheaters.Code (INTEGER),
MovieTheaters.Name (VARCHAR(255)),
MovieTheaters.Movie (INTEGER),
)
Table Movies (
Movies.Code (INTEGER),
Movies.Title (VARCHAR(255)),
Movies.Rating (VARCHAR(255)),
)
Possible JOINs:
MovieTheaters.Movie = Movies.Code
| SELECT title FROM movies EXCEPT SELECT movies.title FROM movies JOIN movietheaters ON movies.code = movietheaters.movie WHERE movietheaters.name = 'Odeon' | {
'movies': ['code', 'title'],
'movietheaters': ['code', 'name', 'movie']
} | CREATE TABLE MovieTheaters (
MovieTheaters.Code (INTEGER),
MovieTheaters.Name (VARCHAR(255)),
MovieTheaters.Movie (INTEGER),
)
CREATE TABLE Movies (
Movies.Code (INTEGER),
Movies.Title (VARCHAR(255)),
Movies.Rating (VARCHAR(255)),
)
Possible JOINs:
MovieTheaters.Movie = Movies.Code
| Table MovieTheaters (
MovieTheaters.code (INTEGER),
MovieTheaters.name (VARCHAR(255)),
MovieTheaters.movie (INTEGER),
)
Table Movies (
Movies.code (INTEGER),
Movies.title (VARCHAR(255)),
Movies.rating (VARCHAR(255)),
)
Possible JOINs:
MovieTheaters.movie = Movies.code
| CREATE TABLE MovieTheaters (
MovieTheaters.code (INTEGER),
MovieTheaters.name (VARCHAR(255)),
MovieTheaters.movie (INTEGER),
)
CREATE TABLE Movies (
Movies.code (INTEGER),
Movies.title (VARCHAR(255)),
Movies.rating (VARCHAR(255)),
)
Possible JOINs:
MovieTheaters.movie = Movies.code
| Table movietheaters (
movietheaters.code (INTEGER),
movietheaters.name (VARCHAR(255)),
movietheaters.movie (INTEGER),
)
Table movies (
movies.code (INTEGER),
movies.title (VARCHAR(255)),
movies.rating (VARCHAR(255)),
)
Possible JOINs:
movietheaters.movie = movies.code
| CREATE TABLE movietheaters (
movietheaters.code (INTEGER),
movietheaters.name (VARCHAR(255)),
movietheaters.movie (INTEGER),
)
CREATE TABLE movies (
movies.code (INTEGER),
movies.title (VARCHAR(255)),
movies.rating (VARCHAR(255)),
)
Possible JOINs:
movietheaters.movie = movies.code
| {
'Movies': ['Code', 'Title', 'Rating'],
'MovieTheaters': ['Code', 'Name', 'Movie']
} | {
'Movies': ['Code', 'Title'],
'MovieTheaters': ['Code', 'Name', 'Movie']
} | TABLE MovieTheaters (
MovieTheaters.Code (INTEGER),
MovieTheaters.Name (VARCHAR(255)),
MovieTheaters.Movie (INTEGER),
)
TABLE Movies (
Movies.Code (INTEGER),
Movies.Title (VARCHAR(255)),
Movies.Rating (VARCHAR(255)),
)
Possible JOINs:
MovieTheaters.Movie = Movies.Code
| TABLE MovieTheaters (
MovieTheaters.code (INTEGER),
MovieTheaters.name (VARCHAR(255)),
MovieTheaters.movie (INTEGER),
)
TABLE Movies (
Movies.code (INTEGER),
Movies.title (VARCHAR(255)),
Movies.rating (VARCHAR(255)),
)
Possible JOINs:
MovieTheaters.movie = Movies.code
| TABLE movietheaters (
movietheaters.code (INTEGER),
movietheaters.name (VARCHAR(255)),
movietheaters.movie (INTEGER),
)
TABLE movies (
movies.code (INTEGER),
movies.title (VARCHAR(255)),
movies.rating (VARCHAR(255)),
)
Possible JOINs:
movietheaters.movie = movies.code
|
customers_and_orders |
CREATE TABLE "Addresses" (
address_id INTEGER,
address_details VARCHAR(255),
PRIMARY KEY (address_id)
)
CREATE TABLE "Customer_Orders" (
order_id INTEGER,
customer_id INTEGER NOT NULL,
order_date DATETIME NOT NULL,
order_status_code VARCHAR(15),
PRIMARY KEY (order_id),
FOREIGN KEY(customer_id) REFERENCES "Customers" (customer_id)
)
CREATE TABLE "Customers" (
customer_id INTEGER,
address_id INTEGER NOT NULL,
payment_method_code VARCHAR(15),
customer_number VARCHAR(20),
customer_name VARCHAR(80),
customer_address VARCHAR(255),
customer_phone VARCHAR(80),
customer_email VARCHAR(80),
PRIMARY KEY (customer_id)
)
CREATE TABLE "Order_Items" (
order_item_id INTEGER NOT NULL,
order_id INTEGER NOT NULL,
product_id INTEGER NOT NULL,
order_quantity VARCHAR(80),
FOREIGN KEY(product_id) REFERENCES "Products" (product_id),
FOREIGN KEY(order_id) REFERENCES "Customer_Orders" (order_id)
)
CREATE TABLE "Products" (
product_id INTEGER,
product_type_code VARCHAR(15),
product_name VARCHAR(80),
product_price DOUBLE,
PRIMARY KEY (product_id)
) | Show all customer names, ids and the number of orders by each customer. | medium | Table Addresses (
Addresses.address_id (INTEGER),
Addresses.address_details (VARCHAR(255)),
)
Table Customer_Orders (
Customer_Orders.order_id (INTEGER),
Customer_Orders.customer_id (INTEGER),
Customer_Orders.order_date (DATETIME),
Customer_Orders.order_status_code (VARCHAR(15)),
)
Table Customers (
Customers.customer_id (INTEGER),
Customers.address_id (INTEGER),
Customers.payment_method_code (VARCHAR(15)),
Customers.customer_number (VARCHAR(20)),
Customers.customer_name (VARCHAR(80)),
Customers.customer_address (VARCHAR(255)),
Customers.customer_phone (VARCHAR(80)),
Customers.customer_email (VARCHAR(80)),
)
Table Order_Items (
Order_Items.order_item_id (INTEGER),
Order_Items.order_id (INTEGER),
Order_Items.product_id (INTEGER),
Order_Items.order_quantity (VARCHAR(80)),
)
Table Products (
Products.product_id (INTEGER),
Products.product_type_code (VARCHAR(15)),
Products.product_name (VARCHAR(80)),
Products.product_price (DOUBLE),
)
Possible JOINs:
Customer_Orders.customer_id = Customers.customer_id
Order_Items.order_id = Customer_Orders.order_id
Order_Items.product_id = Products.product_id
| SELECT Customers.customer_name , Customer_orders.customer_id , count(*) FROM Customer_orders JOIN Customers ON Customer_orders.customer_id = Customers.customer_id GROUP BY Customer_orders.customer_id | {
'customer_orders': ['order_id', 'customer_id'],
'customers': ['customer_id', 'customer_name']
} | CREATE TABLE Addresses (
Addresses.address_id (INTEGER),
Addresses.address_details (VARCHAR(255)),
)
CREATE TABLE Customer_Orders (
Customer_Orders.order_id (INTEGER),
Customer_Orders.customer_id (INTEGER),
Customer_Orders.order_date (DATETIME),
Customer_Orders.order_status_code (VARCHAR(15)),
)
CREATE TABLE Customers (
Customers.customer_id (INTEGER),
Customers.address_id (INTEGER),
Customers.payment_method_code (VARCHAR(15)),
Customers.customer_number (VARCHAR(20)),
Customers.customer_name (VARCHAR(80)),
Customers.customer_address (VARCHAR(255)),
Customers.customer_phone (VARCHAR(80)),
Customers.customer_email (VARCHAR(80)),
)
CREATE TABLE Order_Items (
Order_Items.order_item_id (INTEGER),
Order_Items.order_id (INTEGER),
Order_Items.product_id (INTEGER),
Order_Items.order_quantity (VARCHAR(80)),
)
CREATE TABLE Products (
Products.product_id (INTEGER),
Products.product_type_code (VARCHAR(15)),
Products.product_name (VARCHAR(80)),
Products.product_price (DOUBLE),
)
Possible JOINs:
Customer_Orders.customer_id = Customers.customer_id
Order_Items.order_id = Customer_Orders.order_id
Order_Items.product_id = Products.product_id
| Table Addresses (
Addresses.address_id (INTEGER),
Addresses.address_details (VARCHAR(255)),
)
Table Customer_Orders (
Customer_Orders.order_id (INTEGER),
Customer_Orders.customer_id (INTEGER),
Customer_Orders.order_date (DATETIME),
Customer_Orders.order_status_code (VARCHAR(15)),
)
Table Customers (
Customers.customer_id (INTEGER),
Customers.address_id (INTEGER),
Customers.payment_method_code (VARCHAR(15)),
Customers.customer_number (VARCHAR(20)),
Customers.customer_name (VARCHAR(80)),
Customers.customer_address (VARCHAR(255)),
Customers.customer_phone (VARCHAR(80)),
Customers.customer_email (VARCHAR(80)),
)
Table Order_Items (
Order_Items.order_item_id (INTEGER),
Order_Items.order_id (INTEGER),
Order_Items.product_id (INTEGER),
Order_Items.order_quantity (VARCHAR(80)),
)
Table Products (
Products.product_id (INTEGER),
Products.product_type_code (VARCHAR(15)),
Products.product_name (VARCHAR(80)),
Products.product_price (DOUBLE),
)
Possible JOINs:
Customer_Orders.customer_id = Customers.customer_id
Order_Items.order_id = Customer_Orders.order_id
Order_Items.product_id = Products.product_id
| CREATE TABLE Addresses (
Addresses.address_id (INTEGER),
Addresses.address_details (VARCHAR(255)),
)
CREATE TABLE Customer_Orders (
Customer_Orders.order_id (INTEGER),
Customer_Orders.customer_id (INTEGER),
Customer_Orders.order_date (DATETIME),
Customer_Orders.order_status_code (VARCHAR(15)),
)
CREATE TABLE Customers (
Customers.customer_id (INTEGER),
Customers.address_id (INTEGER),
Customers.payment_method_code (VARCHAR(15)),
Customers.customer_number (VARCHAR(20)),
Customers.customer_name (VARCHAR(80)),
Customers.customer_address (VARCHAR(255)),
Customers.customer_phone (VARCHAR(80)),
Customers.customer_email (VARCHAR(80)),
)
CREATE TABLE Order_Items (
Order_Items.order_item_id (INTEGER),
Order_Items.order_id (INTEGER),
Order_Items.product_id (INTEGER),
Order_Items.order_quantity (VARCHAR(80)),
)
CREATE TABLE Products (
Products.product_id (INTEGER),
Products.product_type_code (VARCHAR(15)),
Products.product_name (VARCHAR(80)),
Products.product_price (DOUBLE),
)
Possible JOINs:
Customer_Orders.customer_id = Customers.customer_id
Order_Items.order_id = Customer_Orders.order_id
Order_Items.product_id = Products.product_id
| Table addresses (
addresses.address_id (INTEGER),
addresses.address_details (VARCHAR(255)),
)
Table customer_orders (
customer_orders.order_id (INTEGER),
customer_orders.customer_id (INTEGER),
customer_orders.order_date (DATETIME),
customer_orders.order_status_code (VARCHAR(15)),
)
Table customers (
customers.customer_id (INTEGER),
customers.address_id (INTEGER),
customers.payment_method_code (VARCHAR(15)),
customers.customer_number (VARCHAR(20)),
customers.customer_name (VARCHAR(80)),
customers.customer_address (VARCHAR(255)),
customers.customer_phone (VARCHAR(80)),
customers.customer_email (VARCHAR(80)),
)
Table order_items (
order_items.order_item_id (INTEGER),
order_items.order_id (INTEGER),
order_items.product_id (INTEGER),
order_items.order_quantity (VARCHAR(80)),
)
Table products (
products.product_id (INTEGER),
products.product_type_code (VARCHAR(15)),
products.product_name (VARCHAR(80)),
products.product_price (DOUBLE),
)
Possible JOINs:
customer_orders.customer_id = customers.customer_id
order_items.order_id = customer_orders.order_id
order_items.product_id = products.product_id
| CREATE TABLE addresses (
addresses.address_id (INTEGER),
addresses.address_details (VARCHAR(255)),
)
CREATE TABLE customer_orders (
customer_orders.order_id (INTEGER),
customer_orders.customer_id (INTEGER),
customer_orders.order_date (DATETIME),
customer_orders.order_status_code (VARCHAR(15)),
)
CREATE TABLE customers (
customers.customer_id (INTEGER),
customers.address_id (INTEGER),
customers.payment_method_code (VARCHAR(15)),
customers.customer_number (VARCHAR(20)),
customers.customer_name (VARCHAR(80)),
customers.customer_address (VARCHAR(255)),
customers.customer_phone (VARCHAR(80)),
customers.customer_email (VARCHAR(80)),
)
CREATE TABLE order_items (
order_items.order_item_id (INTEGER),
order_items.order_id (INTEGER),
order_items.product_id (INTEGER),
order_items.order_quantity (VARCHAR(80)),
)
CREATE TABLE products (
products.product_id (INTEGER),
products.product_type_code (VARCHAR(15)),
products.product_name (VARCHAR(80)),
products.product_price (DOUBLE),
)
Possible JOINs:
customer_orders.customer_id = customers.customer_id
order_items.order_id = customer_orders.order_id
order_items.product_id = products.product_id
| {
'Products': ['product_id', 'product_type_code', 'product_name', 'product_price'],
'Addresses': ['address_id', 'address_details'],
'Customers': ['customer_id', 'address_id', 'payment_method_code', 'customer_number', 'customer_name', 'customer_address', 'customer_phone', 'customer_email'],
'Customer_Orders': ['order_id', 'customer_id', 'order_date', 'order_status_code'],
'Order_Items': ['order_item_id', 'order_id', 'product_id', 'order_quantity']
} | {
'Customer_Orders': ['order_id', 'customer_id'],
'Customers': ['customer_id', 'customer_name']
} | TABLE Addresses (
Addresses.address_id (INTEGER),
Addresses.address_details (VARCHAR(255)),
)
TABLE Customer_Orders (
Customer_Orders.order_id (INTEGER),
Customer_Orders.customer_id (INTEGER),
Customer_Orders.order_date (DATETIME),
Customer_Orders.order_status_code (VARCHAR(15)),
)
TABLE Customers (
Customers.customer_id (INTEGER),
Customers.address_id (INTEGER),
Customers.payment_method_code (VARCHAR(15)),
Customers.customer_number (VARCHAR(20)),
Customers.customer_name (VARCHAR(80)),
Customers.customer_address (VARCHAR(255)),
Customers.customer_phone (VARCHAR(80)),
Customers.customer_email (VARCHAR(80)),
)
TABLE Order_Items (
Order_Items.order_item_id (INTEGER),
Order_Items.order_id (INTEGER),
Order_Items.product_id (INTEGER),
Order_Items.order_quantity (VARCHAR(80)),
)
TABLE Products (
Products.product_id (INTEGER),
Products.product_type_code (VARCHAR(15)),
Products.product_name (VARCHAR(80)),
Products.product_price (DOUBLE),
)
Possible JOINs:
Customer_Orders.customer_id = Customers.customer_id
Order_Items.order_id = Customer_Orders.order_id
Order_Items.product_id = Products.product_id
| TABLE Addresses (
Addresses.address_id (INTEGER),
Addresses.address_details (VARCHAR(255)),
)
TABLE Customer_Orders (
Customer_Orders.order_id (INTEGER),
Customer_Orders.customer_id (INTEGER),
Customer_Orders.order_date (DATETIME),
Customer_Orders.order_status_code (VARCHAR(15)),
)
TABLE Customers (
Customers.customer_id (INTEGER),
Customers.address_id (INTEGER),
Customers.payment_method_code (VARCHAR(15)),
Customers.customer_number (VARCHAR(20)),
Customers.customer_name (VARCHAR(80)),
Customers.customer_address (VARCHAR(255)),
Customers.customer_phone (VARCHAR(80)),
Customers.customer_email (VARCHAR(80)),
)
TABLE Order_Items (
Order_Items.order_item_id (INTEGER),
Order_Items.order_id (INTEGER),
Order_Items.product_id (INTEGER),
Order_Items.order_quantity (VARCHAR(80)),
)
TABLE Products (
Products.product_id (INTEGER),
Products.product_type_code (VARCHAR(15)),
Products.product_name (VARCHAR(80)),
Products.product_price (DOUBLE),
)
Possible JOINs:
Customer_Orders.customer_id = Customers.customer_id
Order_Items.order_id = Customer_Orders.order_id
Order_Items.product_id = Products.product_id
| TABLE addresses (
addresses.address_id (INTEGER),
addresses.address_details (VARCHAR(255)),
)
TABLE customer_orders (
customer_orders.order_id (INTEGER),
customer_orders.customer_id (INTEGER),
customer_orders.order_date (DATETIME),
customer_orders.order_status_code (VARCHAR(15)),
)
TABLE customers (
customers.customer_id (INTEGER),
customers.address_id (INTEGER),
customers.payment_method_code (VARCHAR(15)),
customers.customer_number (VARCHAR(20)),
customers.customer_name (VARCHAR(80)),
customers.customer_address (VARCHAR(255)),
customers.customer_phone (VARCHAR(80)),
customers.customer_email (VARCHAR(80)),
)
TABLE order_items (
order_items.order_item_id (INTEGER),
order_items.order_id (INTEGER),
order_items.product_id (INTEGER),
order_items.order_quantity (VARCHAR(80)),
)
TABLE products (
products.product_id (INTEGER),
products.product_type_code (VARCHAR(15)),
products.product_name (VARCHAR(80)),
products.product_price (DOUBLE),
)
Possible JOINs:
customer_orders.customer_id = customers.customer_id
order_items.order_id = customer_orders.order_id
order_items.product_id = products.product_id
|
aan_1 |
CREATE TABLE "Affiliation" (
affiliation_id INTEGER NOT NULL,
name VARCHAR(255) DEFAULT NULL,
address VARCHAR(255) DEFAULT NULL,
PRIMARY KEY (affiliation_id)
)
CREATE TABLE "Author" (
author_id INTEGER NOT NULL,
name VARCHAR(255) DEFAULT NULL,
email VARCHAR(255) DEFAULT NULL,
PRIMARY KEY (author_id)
)
CREATE TABLE "Author_list" (
paper_id VARCHAR(25) NOT NULL,
author_id INTEGER NOT NULL,
affiliation_id INTEGER DEFAULT NULL,
PRIMARY KEY (paper_id, author_id),
FOREIGN KEY(affiliation_id) REFERENCES "Affiliation" (affiliation_id),
FOREIGN KEY(author_id) REFERENCES "Author" (author_id),
FOREIGN KEY(paper_id) REFERENCES "Paper" (paper_id)
)
CREATE TABLE "Citation" (
paper_id VARCHAR(25) NOT NULL,
cited_paper_id VARCHAR(25) NOT NULL,
PRIMARY KEY (paper_id, cited_paper_id),
FOREIGN KEY(cited_paper_id) REFERENCES "Paper" (paper_id),
FOREIGN KEY(paper_id) REFERENCES "Paper" (paper_id)
)
CREATE TABLE "Paper" (
paper_id VARCHAR(25) NOT NULL,
title VARCHAR(255) DEFAULT NULL,
venue VARCHAR(255) DEFAULT NULL,
year INTEGER DEFAULT NULL,
PRIMARY KEY (paper_id)
) | How many papers do we have? | easy | Table Affiliation (
Affiliation.affiliation_id (INTEGER),
Affiliation.name (varchar(255)),
Affiliation.address (varchar(255)),
)
Table Author (
Author.author_id (INTEGER),
Author.name (varchar(255)),
Author.email (varchar(255)),
)
Table Author_list (
Author_list.paper_id (varchar(25)),
Author_list.author_id (INTEGER),
Author_list.affiliation_id (INTEGER),
)
Table Citation (
Citation.paper_id (varchar(25)),
Citation.cited_paper_id (varchar(25)),
)
Table Paper (
Paper.paper_id (varchar(25)),
Paper.title (varchar(255)),
Paper.venue (varchar(255)),
Paper.year (INTEGER),
)
Possible JOINs:
Author_list.paper_id = Paper.paper_id
Author_list.author_id = Author.author_id
Author_list.affiliation_id = Affiliation.affiliation_id
Citation.paper_id = Paper.paper_id
Citation.cited_paper_id = Paper.paper_id
| SELECT count(*) FROM Paper | {
'paper': ['paper_id']
} | CREATE TABLE Affiliation (
Affiliation.affiliation_id (INTEGER),
Affiliation.name (varchar(255)),
Affiliation.address (varchar(255)),
)
CREATE TABLE Author (
Author.author_id (INTEGER),
Author.name (varchar(255)),
Author.email (varchar(255)),
)
CREATE TABLE Author_list (
Author_list.paper_id (varchar(25)),
Author_list.author_id (INTEGER),
Author_list.affiliation_id (INTEGER),
)
CREATE TABLE Citation (
Citation.paper_id (varchar(25)),
Citation.cited_paper_id (varchar(25)),
)
CREATE TABLE Paper (
Paper.paper_id (varchar(25)),
Paper.title (varchar(255)),
Paper.venue (varchar(255)),
Paper.year (INTEGER),
)
Possible JOINs:
Author_list.paper_id = Paper.paper_id
Author_list.author_id = Author.author_id
Author_list.affiliation_id = Affiliation.affiliation_id
Citation.paper_id = Paper.paper_id
Citation.cited_paper_id = Paper.paper_id
| Table Affiliation (
Affiliation.affiliation_id (INTEGER),
Affiliation.name (varchar(255)),
Affiliation.address (varchar(255)),
)
Table Author (
Author.author_id (INTEGER),
Author.name (varchar(255)),
Author.email (varchar(255)),
)
Table Author_list (
Author_list.paper_id (varchar(25)),
Author_list.author_id (INTEGER),
Author_list.affiliation_id (INTEGER),
)
Table Citation (
Citation.paper_id (varchar(25)),
Citation.cited_paper_id (varchar(25)),
)
Table Paper (
Paper.paper_id (varchar(25)),
Paper.title (varchar(255)),
Paper.venue (varchar(255)),
Paper.year (INTEGER),
)
Possible JOINs:
Author_list.paper_id = Paper.paper_id
Author_list.author_id = Author.author_id
Author_list.affiliation_id = Affiliation.affiliation_id
Citation.paper_id = Paper.paper_id
Citation.cited_paper_id = Paper.paper_id
| CREATE TABLE Affiliation (
Affiliation.affiliation_id (INTEGER),
Affiliation.name (varchar(255)),
Affiliation.address (varchar(255)),
)
CREATE TABLE Author (
Author.author_id (INTEGER),
Author.name (varchar(255)),
Author.email (varchar(255)),
)
CREATE TABLE Author_list (
Author_list.paper_id (varchar(25)),
Author_list.author_id (INTEGER),
Author_list.affiliation_id (INTEGER),
)
CREATE TABLE Citation (
Citation.paper_id (varchar(25)),
Citation.cited_paper_id (varchar(25)),
)
CREATE TABLE Paper (
Paper.paper_id (varchar(25)),
Paper.title (varchar(255)),
Paper.venue (varchar(255)),
Paper.year (INTEGER),
)
Possible JOINs:
Author_list.paper_id = Paper.paper_id
Author_list.author_id = Author.author_id
Author_list.affiliation_id = Affiliation.affiliation_id
Citation.paper_id = Paper.paper_id
Citation.cited_paper_id = Paper.paper_id
| Table affiliation (
affiliation.affiliation_id (INTEGER),
affiliation.name (varchar(255)),
affiliation.address (varchar(255)),
)
Table author (
author.author_id (INTEGER),
author.name (varchar(255)),
author.email (varchar(255)),
)
Table author_list (
author_list.paper_id (varchar(25)),
author_list.author_id (INTEGER),
author_list.affiliation_id (INTEGER),
)
Table citation (
citation.paper_id (varchar(25)),
citation.cited_paper_id (varchar(25)),
)
Table paper (
paper.paper_id (varchar(25)),
paper.title (varchar(255)),
paper.venue (varchar(255)),
paper.year (INTEGER),
)
Possible JOINs:
author_list.paper_id = paper.paper_id
author_list.author_id = author.author_id
author_list.affiliation_id = affiliation.affiliation_id
citation.paper_id = paper.paper_id
citation.cited_paper_id = paper.paper_id
| CREATE TABLE affiliation (
affiliation.affiliation_id (INTEGER),
affiliation.name (varchar(255)),
affiliation.address (varchar(255)),
)
CREATE TABLE author (
author.author_id (INTEGER),
author.name (varchar(255)),
author.email (varchar(255)),
)
CREATE TABLE author_list (
author_list.paper_id (varchar(25)),
author_list.author_id (INTEGER),
author_list.affiliation_id (INTEGER),
)
CREATE TABLE citation (
citation.paper_id (varchar(25)),
citation.cited_paper_id (varchar(25)),
)
CREATE TABLE paper (
paper.paper_id (varchar(25)),
paper.title (varchar(255)),
paper.venue (varchar(255)),
paper.year (INTEGER),
)
Possible JOINs:
author_list.paper_id = paper.paper_id
author_list.author_id = author.author_id
author_list.affiliation_id = affiliation.affiliation_id
citation.paper_id = paper.paper_id
citation.cited_paper_id = paper.paper_id
| {
'Affiliation': ['affiliation_id', 'name', 'address'],
'Author': ['author_id', 'name', 'email'],
'Author_list': ['paper_id', 'author_id', 'affiliation_id'],
'Citation': ['paper_id', 'cited_paper_id'],
'Paper': ['paper_id', 'title', 'venue', 'year']
} | {
'Paper': ['paper_id']
} | TABLE Affiliation (
Affiliation.affiliation_id (INTEGER),
Affiliation.name (varchar(255)),
Affiliation.address (varchar(255)),
)
TABLE Author (
Author.author_id (INTEGER),
Author.name (varchar(255)),
Author.email (varchar(255)),
)
TABLE Author_list (
Author_list.paper_id (varchar(25)),
Author_list.author_id (INTEGER),
Author_list.affiliation_id (INTEGER),
)
TABLE Citation (
Citation.paper_id (varchar(25)),
Citation.cited_paper_id (varchar(25)),
)
TABLE Paper (
Paper.paper_id (varchar(25)),
Paper.title (varchar(255)),
Paper.venue (varchar(255)),
Paper.year (INTEGER),
)
Possible JOINs:
Author_list.paper_id = Paper.paper_id
Author_list.author_id = Author.author_id
Author_list.affiliation_id = Affiliation.affiliation_id
Citation.paper_id = Paper.paper_id
Citation.cited_paper_id = Paper.paper_id
| TABLE Affiliation (
Affiliation.affiliation_id (INTEGER),
Affiliation.name (varchar(255)),
Affiliation.address (varchar(255)),
)
TABLE Author (
Author.author_id (INTEGER),
Author.name (varchar(255)),
Author.email (varchar(255)),
)
TABLE Author_list (
Author_list.paper_id (varchar(25)),
Author_list.author_id (INTEGER),
Author_list.affiliation_id (INTEGER),
)
TABLE Citation (
Citation.paper_id (varchar(25)),
Citation.cited_paper_id (varchar(25)),
)
TABLE Paper (
Paper.paper_id (varchar(25)),
Paper.title (varchar(255)),
Paper.venue (varchar(255)),
Paper.year (INTEGER),
)
Possible JOINs:
Author_list.paper_id = Paper.paper_id
Author_list.author_id = Author.author_id
Author_list.affiliation_id = Affiliation.affiliation_id
Citation.paper_id = Paper.paper_id
Citation.cited_paper_id = Paper.paper_id
| TABLE affiliation (
affiliation.affiliation_id (INTEGER),
affiliation.name (varchar(255)),
affiliation.address (varchar(255)),
)
TABLE author (
author.author_id (INTEGER),
author.name (varchar(255)),
author.email (varchar(255)),
)
TABLE author_list (
author_list.paper_id (varchar(25)),
author_list.author_id (INTEGER),
author_list.affiliation_id (INTEGER),
)
TABLE citation (
citation.paper_id (varchar(25)),
citation.cited_paper_id (varchar(25)),
)
TABLE paper (
paper.paper_id (varchar(25)),
paper.title (varchar(255)),
paper.venue (varchar(255)),
paper.year (INTEGER),
)
Possible JOINs:
author_list.paper_id = paper.paper_id
author_list.author_id = author.author_id
author_list.affiliation_id = affiliation.affiliation_id
citation.paper_id = paper.paper_id
citation.cited_paper_id = paper.paper_id
|
planet_1 |
CREATE TABLE "Client" (
"AccountNumber" INTEGER,
"Name" VARCHAR(255) NOT NULL,
PRIMARY KEY ("AccountNumber")
)
CREATE TABLE "Employee" (
"EmployeeID" INTEGER,
"Name" VARCHAR(255) NOT NULL,
"Position" VARCHAR(255) NOT NULL,
"Salary" REAL NOT NULL,
"Remarks" VARCHAR(255),
PRIMARY KEY ("EmployeeID")
)
CREATE TABLE "Has_Clearance" (
"Employee" INTEGER NOT NULL,
"Planet" INTEGER NOT NULL,
"Level" INTEGER NOT NULL,
PRIMARY KEY ("Employee", "Planet"),
FOREIGN KEY("Employee") REFERENCES "Employee" ("EmployeeID"),
FOREIGN KEY("Planet") REFERENCES "Planet" ("PlanetID")
)
CREATE TABLE "Package" (
"Shipment" INTEGER NOT NULL,
"PackageNumber" INTEGER NOT NULL,
"Contents" VARCHAR(255) NOT NULL,
"Weight" REAL NOT NULL,
"Sender" INTEGER NOT NULL,
"Recipient" INTEGER NOT NULL,
PRIMARY KEY ("Shipment", "PackageNumber"),
FOREIGN KEY("Shipment") REFERENCES "Shipment" ("ShipmentID"),
FOREIGN KEY("Sender") REFERENCES "Client" ("AccountNumber"),
FOREIGN KEY("Recipient") REFERENCES "Client" ("AccountNumber")
)
CREATE TABLE "Planet" (
"PlanetID" INTEGER,
"Name" VARCHAR(255) NOT NULL,
"Coordinates" REAL NOT NULL,
PRIMARY KEY ("PlanetID")
)
CREATE TABLE "Shipment" (
"ShipmentID" INTEGER,
"Date" DATE,
"Manager" INTEGER NOT NULL,
"Planet" INTEGER NOT NULL,
PRIMARY KEY ("ShipmentID"),
FOREIGN KEY("Manager") REFERENCES "Employee" ("EmployeeID"),
FOREIGN KEY("Planet") REFERENCES "Planet" ("PlanetID")
) | Which employees do not have clearance in Mars? List employee's name. | hard | Table Client (
Client.AccountNumber (INTEGER),
Client.Name (VARCHAR(255)),
)
Table Employee (
Employee.EmployeeID (INTEGER),
Employee.Name (VARCHAR(255)),
Employee.Position (VARCHAR(255)),
Employee.Salary (REAL),
Employee.Remarks (VARCHAR(255)),
)
Table Has_Clearance (
Has_Clearance.Employee (INTEGER),
Has_Clearance.Planet (INTEGER),
Has_Clearance.Level (INTEGER),
)
Table Package (
Package.Shipment (INTEGER),
Package.PackageNumber (INTEGER),
Package.Contents (VARCHAR(255)),
Package.Weight (REAL),
Package.Sender (INTEGER),
Package.Recipient (INTEGER),
)
Table Planet (
Planet.PlanetID (INTEGER),
Planet.Name (VARCHAR(255)),
Planet.Coordinates (REAL),
)
Table Shipment (
Shipment.ShipmentID (INTEGER),
Shipment.Date (DATE),
Shipment.Manager (INTEGER),
Shipment.Planet (INTEGER),
)
Possible JOINs:
Has_Clearance.Employee = Employee.EmployeeID
Has_Clearance.Planet = Planet.PlanetID
Package.Shipment = Shipment.ShipmentID
Package.Sender = Client.AccountNumber
Package.Recipient = Client.AccountNumber
Shipment.Manager = Employee.EmployeeID
Shipment.Planet = Planet.PlanetID
| SELECT Name FROM Employee EXCEPT SELECT Employee.Name FROM Has_Clearance JOIN Employee ON Has_Clearance.Employee = Employee.EmployeeID JOIN Planet ON Has_Clearance.Planet = Planet.PlanetID WHERE Planet.Name = "Mars"; | {
'employee': ['employeeid', 'name'],
'has_clearance': ['employee', 'planet'],
'planet': ['planetid', 'name']
} | CREATE TABLE Client (
Client.AccountNumber (INTEGER),
Client.Name (VARCHAR(255)),
)
CREATE TABLE Employee (
Employee.EmployeeID (INTEGER),
Employee.Name (VARCHAR(255)),
Employee.Position (VARCHAR(255)),
Employee.Salary (REAL),
Employee.Remarks (VARCHAR(255)),
)
CREATE TABLE Has_Clearance (
Has_Clearance.Employee (INTEGER),
Has_Clearance.Planet (INTEGER),
Has_Clearance.Level (INTEGER),
)
CREATE TABLE Package (
Package.Shipment (INTEGER),
Package.PackageNumber (INTEGER),
Package.Contents (VARCHAR(255)),
Package.Weight (REAL),
Package.Sender (INTEGER),
Package.Recipient (INTEGER),
)
CREATE TABLE Planet (
Planet.PlanetID (INTEGER),
Planet.Name (VARCHAR(255)),
Planet.Coordinates (REAL),
)
CREATE TABLE Shipment (
Shipment.ShipmentID (INTEGER),
Shipment.Date (DATE),
Shipment.Manager (INTEGER),
Shipment.Planet (INTEGER),
)
Possible JOINs:
Has_Clearance.Employee = Employee.EmployeeID
Has_Clearance.Planet = Planet.PlanetID
Package.Shipment = Shipment.ShipmentID
Package.Sender = Client.AccountNumber
Package.Recipient = Client.AccountNumber
Shipment.Manager = Employee.EmployeeID
Shipment.Planet = Planet.PlanetID
| Table Client (
Client.accountnumber (INTEGER),
Client.name (VARCHAR(255)),
)
Table Employee (
Employee.employeeid (INTEGER),
Employee.name (VARCHAR(255)),
Employee.position (VARCHAR(255)),
Employee.salary (REAL),
Employee.remarks (VARCHAR(255)),
)
Table Has_Clearance (
Has_Clearance.employee (INTEGER),
Has_Clearance.planet (INTEGER),
Has_Clearance.level (INTEGER),
)
Table Package (
Package.shipment (INTEGER),
Package.packagenumber (INTEGER),
Package.contents (VARCHAR(255)),
Package.weight (REAL),
Package.sender (INTEGER),
Package.recipient (INTEGER),
)
Table Planet (
Planet.planetid (INTEGER),
Planet.name (VARCHAR(255)),
Planet.coordinates (REAL),
)
Table Shipment (
Shipment.shipmentid (INTEGER),
Shipment.date (DATE),
Shipment.manager (INTEGER),
Shipment.planet (INTEGER),
)
Possible JOINs:
Has_Clearance.employee = Employee.employeeid
Has_Clearance.planet = Planet.planetid
Package.shipment = Shipment.shipmentid
Package.sender = Client.accountnumber
Package.recipient = Client.accountnumber
Shipment.manager = Employee.employeeid
Shipment.planet = Planet.planetid
| CREATE TABLE Client (
Client.accountnumber (INTEGER),
Client.name (VARCHAR(255)),
)
CREATE TABLE Employee (
Employee.employeeid (INTEGER),
Employee.name (VARCHAR(255)),
Employee.position (VARCHAR(255)),
Employee.salary (REAL),
Employee.remarks (VARCHAR(255)),
)
CREATE TABLE Has_Clearance (
Has_Clearance.employee (INTEGER),
Has_Clearance.planet (INTEGER),
Has_Clearance.level (INTEGER),
)
CREATE TABLE Package (
Package.shipment (INTEGER),
Package.packagenumber (INTEGER),
Package.contents (VARCHAR(255)),
Package.weight (REAL),
Package.sender (INTEGER),
Package.recipient (INTEGER),
)
CREATE TABLE Planet (
Planet.planetid (INTEGER),
Planet.name (VARCHAR(255)),
Planet.coordinates (REAL),
)
CREATE TABLE Shipment (
Shipment.shipmentid (INTEGER),
Shipment.date (DATE),
Shipment.manager (INTEGER),
Shipment.planet (INTEGER),
)
Possible JOINs:
Has_Clearance.employee = Employee.employeeid
Has_Clearance.planet = Planet.planetid
Package.shipment = Shipment.shipmentid
Package.sender = Client.accountnumber
Package.recipient = Client.accountnumber
Shipment.manager = Employee.employeeid
Shipment.planet = Planet.planetid
| Table client (
client.accountnumber (INTEGER),
client.name (VARCHAR(255)),
)
Table employee (
employee.employeeid (INTEGER),
employee.name (VARCHAR(255)),
employee.position (VARCHAR(255)),
employee.salary (REAL),
employee.remarks (VARCHAR(255)),
)
Table has_clearance (
has_clearance.employee (INTEGER),
has_clearance.planet (INTEGER),
has_clearance.level (INTEGER),
)
Table package (
package.shipment (INTEGER),
package.packagenumber (INTEGER),
package.contents (VARCHAR(255)),
package.weight (REAL),
package.sender (INTEGER),
package.recipient (INTEGER),
)
Table planet (
planet.planetid (INTEGER),
planet.name (VARCHAR(255)),
planet.coordinates (REAL),
)
Table shipment (
shipment.shipmentid (INTEGER),
shipment.date (DATE),
shipment.manager (INTEGER),
shipment.planet (INTEGER),
)
Possible JOINs:
has_clearance.employee = employee.employeeid
has_clearance.planet = planet.planetid
package.shipment = shipment.shipmentid
package.sender = client.accountnumber
package.recipient = client.accountnumber
shipment.manager = employee.employeeid
shipment.planet = planet.planetid
| CREATE TABLE client (
client.accountnumber (INTEGER),
client.name (VARCHAR(255)),
)
CREATE TABLE employee (
employee.employeeid (INTEGER),
employee.name (VARCHAR(255)),
employee.position (VARCHAR(255)),
employee.salary (REAL),
employee.remarks (VARCHAR(255)),
)
CREATE TABLE has_clearance (
has_clearance.employee (INTEGER),
has_clearance.planet (INTEGER),
has_clearance.level (INTEGER),
)
CREATE TABLE package (
package.shipment (INTEGER),
package.packagenumber (INTEGER),
package.contents (VARCHAR(255)),
package.weight (REAL),
package.sender (INTEGER),
package.recipient (INTEGER),
)
CREATE TABLE planet (
planet.planetid (INTEGER),
planet.name (VARCHAR(255)),
planet.coordinates (REAL),
)
CREATE TABLE shipment (
shipment.shipmentid (INTEGER),
shipment.date (DATE),
shipment.manager (INTEGER),
shipment.planet (INTEGER),
)
Possible JOINs:
has_clearance.employee = employee.employeeid
has_clearance.planet = planet.planetid
package.shipment = shipment.shipmentid
package.sender = client.accountnumber
package.recipient = client.accountnumber
shipment.manager = employee.employeeid
shipment.planet = planet.planetid
| {
'Employee': ['EmployeeID', 'Name', 'Position', 'Salary', 'Remarks'],
'Planet': ['PlanetID', 'Name', 'Coordinates'],
'Shipment': ['ShipmentID', 'Date', 'Manager', 'Planet'],
'Has_Clearance': ['Employee', 'Planet', 'Level'],
'Client': ['AccountNumber', 'Name'],
'Package': ['Shipment', 'PackageNumber', 'Contents', 'Weight', 'Sender', 'Recipient']
} | {
'Employee': ['EmployeeID', 'Name'],
'Has_Clearance': ['Employee', 'Planet'],
'Planet': ['PlanetID', 'Name']
} | TABLE Client (
Client.AccountNumber (INTEGER),
Client.Name (VARCHAR(255)),
)
TABLE Employee (
Employee.EmployeeID (INTEGER),
Employee.Name (VARCHAR(255)),
Employee.Position (VARCHAR(255)),
Employee.Salary (REAL),
Employee.Remarks (VARCHAR(255)),
)
TABLE Has_Clearance (
Has_Clearance.Employee (INTEGER),
Has_Clearance.Planet (INTEGER),
Has_Clearance.Level (INTEGER),
)
TABLE Package (
Package.Shipment (INTEGER),
Package.PackageNumber (INTEGER),
Package.Contents (VARCHAR(255)),
Package.Weight (REAL),
Package.Sender (INTEGER),
Package.Recipient (INTEGER),
)
TABLE Planet (
Planet.PlanetID (INTEGER),
Planet.Name (VARCHAR(255)),
Planet.Coordinates (REAL),
)
TABLE Shipment (
Shipment.ShipmentID (INTEGER),
Shipment.Date (DATE),
Shipment.Manager (INTEGER),
Shipment.Planet (INTEGER),
)
Possible JOINs:
Has_Clearance.Employee = Employee.EmployeeID
Has_Clearance.Planet = Planet.PlanetID
Package.Shipment = Shipment.ShipmentID
Package.Sender = Client.AccountNumber
Package.Recipient = Client.AccountNumber
Shipment.Manager = Employee.EmployeeID
Shipment.Planet = Planet.PlanetID
| TABLE Client (
Client.accountnumber (INTEGER),
Client.name (VARCHAR(255)),
)
TABLE Employee (
Employee.employeeid (INTEGER),
Employee.name (VARCHAR(255)),
Employee.position (VARCHAR(255)),
Employee.salary (REAL),
Employee.remarks (VARCHAR(255)),
)
TABLE Has_Clearance (
Has_Clearance.employee (INTEGER),
Has_Clearance.planet (INTEGER),
Has_Clearance.level (INTEGER),
)
TABLE Package (
Package.shipment (INTEGER),
Package.packagenumber (INTEGER),
Package.contents (VARCHAR(255)),
Package.weight (REAL),
Package.sender (INTEGER),
Package.recipient (INTEGER),
)
TABLE Planet (
Planet.planetid (INTEGER),
Planet.name (VARCHAR(255)),
Planet.coordinates (REAL),
)
TABLE Shipment (
Shipment.shipmentid (INTEGER),
Shipment.date (DATE),
Shipment.manager (INTEGER),
Shipment.planet (INTEGER),
)
Possible JOINs:
Has_Clearance.employee = Employee.employeeid
Has_Clearance.planet = Planet.planetid
Package.shipment = Shipment.shipmentid
Package.sender = Client.accountnumber
Package.recipient = Client.accountnumber
Shipment.manager = Employee.employeeid
Shipment.planet = Planet.planetid
| TABLE client (
client.accountnumber (INTEGER),
client.name (VARCHAR(255)),
)
TABLE employee (
employee.employeeid (INTEGER),
employee.name (VARCHAR(255)),
employee.position (VARCHAR(255)),
employee.salary (REAL),
employee.remarks (VARCHAR(255)),
)
TABLE has_clearance (
has_clearance.employee (INTEGER),
has_clearance.planet (INTEGER),
has_clearance.level (INTEGER),
)
TABLE package (
package.shipment (INTEGER),
package.packagenumber (INTEGER),
package.contents (VARCHAR(255)),
package.weight (REAL),
package.sender (INTEGER),
package.recipient (INTEGER),
)
TABLE planet (
planet.planetid (INTEGER),
planet.name (VARCHAR(255)),
planet.coordinates (REAL),
)
TABLE shipment (
shipment.shipmentid (INTEGER),
shipment.date (DATE),
shipment.manager (INTEGER),
shipment.planet (INTEGER),
)
Possible JOINs:
has_clearance.employee = employee.employeeid
has_clearance.planet = planet.planetid
package.shipment = shipment.shipmentid
package.sender = client.accountnumber
package.recipient = client.accountnumber
shipment.manager = employee.employeeid
shipment.planet = planet.planetid
|
book_press |
CREATE TABLE author (
"Author_ID" INTEGER,
"Name" TEXT,
"Age" INTEGER,
"Gender" TEXT,
PRIMARY KEY ("Author_ID")
)
CREATE TABLE book (
"Book_ID" INTEGER,
"Title" TEXT,
"Book_Series" TEXT,
"Author_ID" INTEGER,
"Press_ID" INTEGER,
"Sale_Amount" TEXT,
"Release_date" TEXT,
PRIMARY KEY ("Book_ID"),
FOREIGN KEY("Press_ID") REFERENCES press ("Press_ID"),
FOREIGN KEY("Author_ID") REFERENCES author ("Author_ID")
)
CREATE TABLE press (
"Press_ID" INTEGER,
"Name" TEXT,
"Month_Profits_billion" REAL,
"Year_Profits_billion" REAL,
PRIMARY KEY ("Press_ID")
) | For each gender, return gender and the average age of authors. | medium | Table author (
author.Author_ID (INT),
author.Name (TEXT),
author.Age (INT),
author.Gender (TEXT),
)
Table book (
book.Book_ID (INT),
book.Title (TEXT),
book.Book_Series (TEXT),
book.Author_ID (INT),
book.Press_ID (INT),
book.Sale_Amount (TEXT),
book.Release_date (TEXT),
)
Table press (
press.Press_ID (INT),
press.Name (TEXT),
press.Month_Profits_billion (REAL),
press.Year_Profits_billion (REAL),
)
Possible JOINs:
book.Author_ID = author.Author_ID
book.Press_ID = press.Press_ID
| SELECT avg(age) , gender FROM author GROUP BY gender | {
'author': ['author_id', 'age', 'gender']
} | CREATE TABLE author (
author.Author_ID (INT),
author.Name (TEXT),
author.Age (INT),
author.Gender (TEXT),
)
CREATE TABLE book (
book.Book_ID (INT),
book.Title (TEXT),
book.Book_Series (TEXT),
book.Author_ID (INT),
book.Press_ID (INT),
book.Sale_Amount (TEXT),
book.Release_date (TEXT),
)
CREATE TABLE press (
press.Press_ID (INT),
press.Name (TEXT),
press.Month_Profits_billion (REAL),
press.Year_Profits_billion (REAL),
)
Possible JOINs:
book.Author_ID = author.Author_ID
book.Press_ID = press.Press_ID
| Table author (
author.author_id (INT),
author.name (TEXT),
author.age (INT),
author.gender (TEXT),
)
Table book (
book.book_id (INT),
book.title (TEXT),
book.book_series (TEXT),
book.author_id (INT),
book.press_id (INT),
book.sale_amount (TEXT),
book.release_date (TEXT),
)
Table press (
press.press_id (INT),
press.name (TEXT),
press.month_profits_billion (REAL),
press.year_profits_billion (REAL),
)
Possible JOINs:
book.author_id = author.author_id
book.press_id = press.press_id
| CREATE TABLE author (
author.author_id (INT),
author.name (TEXT),
author.age (INT),
author.gender (TEXT),
)
CREATE TABLE book (
book.book_id (INT),
book.title (TEXT),
book.book_series (TEXT),
book.author_id (INT),
book.press_id (INT),
book.sale_amount (TEXT),
book.release_date (TEXT),
)
CREATE TABLE press (
press.press_id (INT),
press.name (TEXT),
press.month_profits_billion (REAL),
press.year_profits_billion (REAL),
)
Possible JOINs:
book.author_id = author.author_id
book.press_id = press.press_id
| Table author (
author.author_id (INT),
author.name (TEXT),
author.age (INT),
author.gender (TEXT),
)
Table book (
book.book_id (INT),
book.title (TEXT),
book.book_series (TEXT),
book.author_id (INT),
book.press_id (INT),
book.sale_amount (TEXT),
book.release_date (TEXT),
)
Table press (
press.press_id (INT),
press.name (TEXT),
press.month_profits_billion (REAL),
press.year_profits_billion (REAL),
)
Possible JOINs:
book.author_id = author.author_id
book.press_id = press.press_id
| CREATE TABLE author (
author.author_id (INT),
author.name (TEXT),
author.age (INT),
author.gender (TEXT),
)
CREATE TABLE book (
book.book_id (INT),
book.title (TEXT),
book.book_series (TEXT),
book.author_id (INT),
book.press_id (INT),
book.sale_amount (TEXT),
book.release_date (TEXT),
)
CREATE TABLE press (
press.press_id (INT),
press.name (TEXT),
press.month_profits_billion (REAL),
press.year_profits_billion (REAL),
)
Possible JOINs:
book.author_id = author.author_id
book.press_id = press.press_id
| {
'author': ['Author_ID', 'Name', 'Age', 'Gender'],
'press': ['Press_ID', 'Name', 'Month_Profits_billion', 'Year_Profits_billion'],
'book': ['Book_ID', 'Title', 'Book_Series', 'Author_ID', 'Press_ID', 'Sale_Amount', 'Release_date']
} | {
'author': ['Author_ID', 'Age', 'Gender']
} | TABLE author (
author.Author_ID (INT),
author.Name (TEXT),
author.Age (INT),
author.Gender (TEXT),
)
TABLE book (
book.Book_ID (INT),
book.Title (TEXT),
book.Book_Series (TEXT),
book.Author_ID (INT),
book.Press_ID (INT),
book.Sale_Amount (TEXT),
book.Release_date (TEXT),
)
TABLE press (
press.Press_ID (INT),
press.Name (TEXT),
press.Month_Profits_billion (REAL),
press.Year_Profits_billion (REAL),
)
Possible JOINs:
book.Author_ID = author.Author_ID
book.Press_ID = press.Press_ID
| TABLE author (
author.author_id (INT),
author.name (TEXT),
author.age (INT),
author.gender (TEXT),
)
TABLE book (
book.book_id (INT),
book.title (TEXT),
book.book_series (TEXT),
book.author_id (INT),
book.press_id (INT),
book.sale_amount (TEXT),
book.release_date (TEXT),
)
TABLE press (
press.press_id (INT),
press.name (TEXT),
press.month_profits_billion (REAL),
press.year_profits_billion (REAL),
)
Possible JOINs:
book.author_id = author.author_id
book.press_id = press.press_id
| TABLE author (
author.author_id (INT),
author.name (TEXT),
author.age (INT),
author.gender (TEXT),
)
TABLE book (
book.book_id (INT),
book.title (TEXT),
book.book_series (TEXT),
book.author_id (INT),
book.press_id (INT),
book.sale_amount (TEXT),
book.release_date (TEXT),
)
TABLE press (
press.press_id (INT),
press.name (TEXT),
press.month_profits_billion (REAL),
press.year_profits_billion (REAL),
)
Possible JOINs:
book.author_id = author.author_id
book.press_id = press.press_id
|
online_exams |
CREATE TABLE "Exams" (
"Exam_ID" INTEGER NOT NULL,
"Subject_Code" CHAR(15) NOT NULL,
"Exam_Date" DATETIME,
"Exam_Name" VARCHAR(255),
PRIMARY KEY ("Exam_ID")
)
CREATE TABLE "Questions" (
"Question_ID" INTEGER NOT NULL,
"Type_of_Question_Code" VARCHAR(15) NOT NULL,
"Question_Text" VARCHAR(255),
PRIMARY KEY ("Question_ID")
)
CREATE TABLE "Questions_in_Exams" (
"Exam_ID" INTEGER NOT NULL,
"Question_ID" INTEGER NOT NULL,
PRIMARY KEY ("Exam_ID", "Question_ID"),
FOREIGN KEY("Question_ID") REFERENCES "Questions" ("Question_ID"),
FOREIGN KEY("Exam_ID") REFERENCES "Exams" ("Exam_ID")
)
CREATE TABLE "Student_Answers" (
"Student_Answer_ID" INTEGER NOT NULL,
"Exam_ID" INTEGER NOT NULL,
"Question_ID" INTEGER NOT NULL,
"Student_ID" INTEGER NOT NULL,
"Date_of_Answer" DATETIME,
"Comments" VARCHAR(255),
"Satisfactory_YN" VARCHAR(1),
"Student_Answer_Text" VARCHAR(255),
PRIMARY KEY ("Student_Answer_ID"),
FOREIGN KEY("Student_ID") REFERENCES "Students" ("Student_ID"),
FOREIGN KEY("Exam_ID", "Question_ID") REFERENCES "Questions_in_Exams" ("Exam_ID", "Question_ID")
)
CREATE TABLE "Student_Assessments" (
"Student_Answer_ID" VARCHAR(100) NOT NULL,
"Valid_Answer_ID" INTEGER NOT NULL,
"Student_Answer_Text" VARCHAR(255),
"Satisfactory_YN" CHAR(1),
"Assessment" VARCHAR(40),
PRIMARY KEY ("Student_Answer_ID"),
FOREIGN KEY("Valid_Answer_ID") REFERENCES "Valid_Answers" ("Valid_Answer_ID")
)
CREATE TABLE "Students" (
"Student_ID" INTEGER NOT NULL,
"First_Name" VARCHAR(255),
"Middle_Name" VARCHAR(255),
"Last_Name" VARCHAR(255),
"Gender_MFU" CHAR(1),
"Student_Address" VARCHAR(255),
"Email_Adress" VARCHAR(255),
"Cell_Mobile_Phone" VARCHAR(255),
"Home_Phone" VARCHAR(255),
PRIMARY KEY ("Student_ID")
)
CREATE TABLE "Valid_Answers" (
"Valid_Answer_ID" INTEGER NOT NULL,
"Question_ID" INTEGER NOT NULL,
"Valid_Answer_Text" VARCHAR(255),
PRIMARY KEY ("Valid_Answer_ID"),
FOREIGN KEY("Question_ID") REFERENCES "Questions" ("Question_ID")
) | List the dates of the exams with subject code containing the word "data", in descending order of dates. | hard | Table Exams (
Exams.Exam_ID (INTEGER),
Exams.Subject_Code (CHAR(15)),
Exams.Exam_Date (DATETIME),
Exams.Exam_Name (VARCHAR(255)),
)
Table Questions (
Questions.Question_ID (INTEGER),
Questions.Type_of_Question_Code (VARCHAR(15)),
Questions.Question_Text (VARCHAR(255)),
)
Table Questions_in_Exams (
Questions_in_Exams.Exam_ID (INTEGER),
Questions_in_Exams.Question_ID (INTEGER),
)
Table Student_Answers (
Student_Answers.Student_Answer_ID (INTEGER),
Student_Answers.Exam_ID (INTEGER),
Student_Answers.Question_ID (INTEGER),
Student_Answers.Student_ID (INTEGER),
Student_Answers.Date_of_Answer (DATETIME),
Student_Answers.Comments (VARCHAR(255)),
Student_Answers.Satisfactory_YN (VARCHAR(1)),
Student_Answers.Student_Answer_Text (VARCHAR(255)),
)
Table Student_Assessments (
Student_Assessments.Student_Answer_ID (VARCHAR(100)),
Student_Assessments.Valid_Answer_ID (INTEGER),
Student_Assessments.Student_Answer_Text (VARCHAR(255)),
Student_Assessments.Satisfactory_YN (CHAR(1)),
Student_Assessments.Assessment (VARCHAR(40)),
)
Table Students (
Students.Student_ID (INTEGER),
Students.First_Name (VARCHAR(255)),
Students.Middle_Name (VARCHAR(255)),
Students.Last_Name (VARCHAR(255)),
Students.Gender_MFU (CHAR(1)),
Students.Student_Address (VARCHAR(255)),
Students.Email_Adress (VARCHAR(255)),
Students.Cell_Mobile_Phone (VARCHAR(255)),
Students.Home_Phone (VARCHAR(255)),
)
Table Valid_Answers (
Valid_Answers.Valid_Answer_ID (INTEGER),
Valid_Answers.Question_ID (INTEGER),
Valid_Answers.Valid_Answer_Text (VARCHAR(255)),
)
Possible JOINs:
Questions_in_Exams.Exam_ID = Exams.Exam_ID
Questions_in_Exams.Question_ID = Questions.Question_ID
Student_Answers.Exam_ID = Questions_in_Exams.Exam_ID
Student_Answers.Question_ID = Questions_in_Exams.Question_ID
Student_Answers.Student_ID = Students.Student_ID
Student_Assessments.Valid_Answer_ID = Valid_Answers.Valid_Answer_ID
Valid_Answers.Question_ID = Questions.Question_ID
| SELECT Exam_Date FROM Exams WHERE Subject_Code LIKE '%data%' ORDER BY Exam_Date DESC | {
'exams': ['exam_id', 'subject_code', 'exam_date']
} | CREATE TABLE Exams (
Exams.Exam_ID (INTEGER),
Exams.Subject_Code (CHAR(15)),
Exams.Exam_Date (DATETIME),
Exams.Exam_Name (VARCHAR(255)),
)
CREATE TABLE Questions (
Questions.Question_ID (INTEGER),
Questions.Type_of_Question_Code (VARCHAR(15)),
Questions.Question_Text (VARCHAR(255)),
)
CREATE TABLE Questions_in_Exams (
Questions_in_Exams.Exam_ID (INTEGER),
Questions_in_Exams.Question_ID (INTEGER),
)
CREATE TABLE Student_Answers (
Student_Answers.Student_Answer_ID (INTEGER),
Student_Answers.Exam_ID (INTEGER),
Student_Answers.Question_ID (INTEGER),
Student_Answers.Student_ID (INTEGER),
Student_Answers.Date_of_Answer (DATETIME),
Student_Answers.Comments (VARCHAR(255)),
Student_Answers.Satisfactory_YN (VARCHAR(1)),
Student_Answers.Student_Answer_Text (VARCHAR(255)),
)
CREATE TABLE Student_Assessments (
Student_Assessments.Student_Answer_ID (VARCHAR(100)),
Student_Assessments.Valid_Answer_ID (INTEGER),
Student_Assessments.Student_Answer_Text (VARCHAR(255)),
Student_Assessments.Satisfactory_YN (CHAR(1)),
Student_Assessments.Assessment (VARCHAR(40)),
)
CREATE TABLE Students (
Students.Student_ID (INTEGER),
Students.First_Name (VARCHAR(255)),
Students.Middle_Name (VARCHAR(255)),
Students.Last_Name (VARCHAR(255)),
Students.Gender_MFU (CHAR(1)),
Students.Student_Address (VARCHAR(255)),
Students.Email_Adress (VARCHAR(255)),
Students.Cell_Mobile_Phone (VARCHAR(255)),
Students.Home_Phone (VARCHAR(255)),
)
CREATE TABLE Valid_Answers (
Valid_Answers.Valid_Answer_ID (INTEGER),
Valid_Answers.Question_ID (INTEGER),
Valid_Answers.Valid_Answer_Text (VARCHAR(255)),
)
Possible JOINs:
Questions_in_Exams.Exam_ID = Exams.Exam_ID
Questions_in_Exams.Question_ID = Questions.Question_ID
Student_Answers.Exam_ID = Questions_in_Exams.Exam_ID
Student_Answers.Question_ID = Questions_in_Exams.Question_ID
Student_Answers.Student_ID = Students.Student_ID
Student_Assessments.Valid_Answer_ID = Valid_Answers.Valid_Answer_ID
Valid_Answers.Question_ID = Questions.Question_ID
| Table Exams (
Exams.exam_id (INTEGER),
Exams.subject_code (CHAR(15)),
Exams.exam_date (DATETIME),
Exams.exam_name (VARCHAR(255)),
)
Table Questions (
Questions.question_id (INTEGER),
Questions.type_of_question_code (VARCHAR(15)),
Questions.question_text (VARCHAR(255)),
)
Table Questions_in_Exams (
Questions_in_Exams.exam_id (INTEGER),
Questions_in_Exams.question_id (INTEGER),
)
Table Student_Answers (
Student_Answers.student_answer_id (INTEGER),
Student_Answers.exam_id (INTEGER),
Student_Answers.question_id (INTEGER),
Student_Answers.student_id (INTEGER),
Student_Answers.date_of_answer (DATETIME),
Student_Answers.comments (VARCHAR(255)),
Student_Answers.satisfactory_yn (VARCHAR(1)),
Student_Answers.student_answer_text (VARCHAR(255)),
)
Table Student_Assessments (
Student_Assessments.student_answer_id (VARCHAR(100)),
Student_Assessments.valid_answer_id (INTEGER),
Student_Assessments.student_answer_text (VARCHAR(255)),
Student_Assessments.satisfactory_yn (CHAR(1)),
Student_Assessments.assessment (VARCHAR(40)),
)
Table Students (
Students.student_id (INTEGER),
Students.first_name (VARCHAR(255)),
Students.middle_name (VARCHAR(255)),
Students.last_name (VARCHAR(255)),
Students.gender_mfu (CHAR(1)),
Students.student_address (VARCHAR(255)),
Students.email_adress (VARCHAR(255)),
Students.cell_mobile_phone (VARCHAR(255)),
Students.home_phone (VARCHAR(255)),
)
Table Valid_Answers (
Valid_Answers.valid_answer_id (INTEGER),
Valid_Answers.question_id (INTEGER),
Valid_Answers.valid_answer_text (VARCHAR(255)),
)
Possible JOINs:
Questions_in_Exams.exam_id = Exams.exam_id
Questions_in_Exams.question_id = Questions.question_id
Student_Answers.exam_id = Questions_in_Exams.exam_id
Student_Answers.question_id = Questions_in_Exams.question_id
Student_Answers.student_id = Students.student_id
Student_Assessments.valid_answer_id = Valid_Answers.valid_answer_id
Valid_Answers.question_id = Questions.question_id
| CREATE TABLE Exams (
Exams.exam_id (INTEGER),
Exams.subject_code (CHAR(15)),
Exams.exam_date (DATETIME),
Exams.exam_name (VARCHAR(255)),
)
CREATE TABLE Questions (
Questions.question_id (INTEGER),
Questions.type_of_question_code (VARCHAR(15)),
Questions.question_text (VARCHAR(255)),
)
CREATE TABLE Questions_in_Exams (
Questions_in_Exams.exam_id (INTEGER),
Questions_in_Exams.question_id (INTEGER),
)
CREATE TABLE Student_Answers (
Student_Answers.student_answer_id (INTEGER),
Student_Answers.exam_id (INTEGER),
Student_Answers.question_id (INTEGER),
Student_Answers.student_id (INTEGER),
Student_Answers.date_of_answer (DATETIME),
Student_Answers.comments (VARCHAR(255)),
Student_Answers.satisfactory_yn (VARCHAR(1)),
Student_Answers.student_answer_text (VARCHAR(255)),
)
CREATE TABLE Student_Assessments (
Student_Assessments.student_answer_id (VARCHAR(100)),
Student_Assessments.valid_answer_id (INTEGER),
Student_Assessments.student_answer_text (VARCHAR(255)),
Student_Assessments.satisfactory_yn (CHAR(1)),
Student_Assessments.assessment (VARCHAR(40)),
)
CREATE TABLE Students (
Students.student_id (INTEGER),
Students.first_name (VARCHAR(255)),
Students.middle_name (VARCHAR(255)),
Students.last_name (VARCHAR(255)),
Students.gender_mfu (CHAR(1)),
Students.student_address (VARCHAR(255)),
Students.email_adress (VARCHAR(255)),
Students.cell_mobile_phone (VARCHAR(255)),
Students.home_phone (VARCHAR(255)),
)
CREATE TABLE Valid_Answers (
Valid_Answers.valid_answer_id (INTEGER),
Valid_Answers.question_id (INTEGER),
Valid_Answers.valid_answer_text (VARCHAR(255)),
)
Possible JOINs:
Questions_in_Exams.exam_id = Exams.exam_id
Questions_in_Exams.question_id = Questions.question_id
Student_Answers.exam_id = Questions_in_Exams.exam_id
Student_Answers.question_id = Questions_in_Exams.question_id
Student_Answers.student_id = Students.student_id
Student_Assessments.valid_answer_id = Valid_Answers.valid_answer_id
Valid_Answers.question_id = Questions.question_id
| Table exams (
exams.exam_id (INTEGER),
exams.subject_code (CHAR(15)),
exams.exam_date (DATETIME),
exams.exam_name (VARCHAR(255)),
)
Table questions (
questions.question_id (INTEGER),
questions.type_of_question_code (VARCHAR(15)),
questions.question_text (VARCHAR(255)),
)
Table questions_in_exams (
questions_in_exams.exam_id (INTEGER),
questions_in_exams.question_id (INTEGER),
)
Table student_answers (
student_answers.student_answer_id (INTEGER),
student_answers.exam_id (INTEGER),
student_answers.question_id (INTEGER),
student_answers.student_id (INTEGER),
student_answers.date_of_answer (DATETIME),
student_answers.comments (VARCHAR(255)),
student_answers.satisfactory_yn (VARCHAR(1)),
student_answers.student_answer_text (VARCHAR(255)),
)
Table student_assessments (
student_assessments.student_answer_id (VARCHAR(100)),
student_assessments.valid_answer_id (INTEGER),
student_assessments.student_answer_text (VARCHAR(255)),
student_assessments.satisfactory_yn (CHAR(1)),
student_assessments.assessment (VARCHAR(40)),
)
Table students (
students.student_id (INTEGER),
students.first_name (VARCHAR(255)),
students.middle_name (VARCHAR(255)),
students.last_name (VARCHAR(255)),
students.gender_mfu (CHAR(1)),
students.student_address (VARCHAR(255)),
students.email_adress (VARCHAR(255)),
students.cell_mobile_phone (VARCHAR(255)),
students.home_phone (VARCHAR(255)),
)
Table valid_answers (
valid_answers.valid_answer_id (INTEGER),
valid_answers.question_id (INTEGER),
valid_answers.valid_answer_text (VARCHAR(255)),
)
Possible JOINs:
questions_in_exams.exam_id = exams.exam_id
questions_in_exams.question_id = questions.question_id
student_answers.exam_id = questions_in_exams.exam_id
student_answers.question_id = questions_in_exams.question_id
student_answers.student_id = students.student_id
student_assessments.valid_answer_id = valid_answers.valid_answer_id
valid_answers.question_id = questions.question_id
| CREATE TABLE exams (
exams.exam_id (INTEGER),
exams.subject_code (CHAR(15)),
exams.exam_date (DATETIME),
exams.exam_name (VARCHAR(255)),
)
CREATE TABLE questions (
questions.question_id (INTEGER),
questions.type_of_question_code (VARCHAR(15)),
questions.question_text (VARCHAR(255)),
)
CREATE TABLE questions_in_exams (
questions_in_exams.exam_id (INTEGER),
questions_in_exams.question_id (INTEGER),
)
CREATE TABLE student_answers (
student_answers.student_answer_id (INTEGER),
student_answers.exam_id (INTEGER),
student_answers.question_id (INTEGER),
student_answers.student_id (INTEGER),
student_answers.date_of_answer (DATETIME),
student_answers.comments (VARCHAR(255)),
student_answers.satisfactory_yn (VARCHAR(1)),
student_answers.student_answer_text (VARCHAR(255)),
)
CREATE TABLE student_assessments (
student_assessments.student_answer_id (VARCHAR(100)),
student_assessments.valid_answer_id (INTEGER),
student_assessments.student_answer_text (VARCHAR(255)),
student_assessments.satisfactory_yn (CHAR(1)),
student_assessments.assessment (VARCHAR(40)),
)
CREATE TABLE students (
students.student_id (INTEGER),
students.first_name (VARCHAR(255)),
students.middle_name (VARCHAR(255)),
students.last_name (VARCHAR(255)),
students.gender_mfu (CHAR(1)),
students.student_address (VARCHAR(255)),
students.email_adress (VARCHAR(255)),
students.cell_mobile_phone (VARCHAR(255)),
students.home_phone (VARCHAR(255)),
)
CREATE TABLE valid_answers (
valid_answers.valid_answer_id (INTEGER),
valid_answers.question_id (INTEGER),
valid_answers.valid_answer_text (VARCHAR(255)),
)
Possible JOINs:
questions_in_exams.exam_id = exams.exam_id
questions_in_exams.question_id = questions.question_id
student_answers.exam_id = questions_in_exams.exam_id
student_answers.question_id = questions_in_exams.question_id
student_answers.student_id = students.student_id
student_assessments.valid_answer_id = valid_answers.valid_answer_id
valid_answers.question_id = questions.question_id
| {
'Students': ['Student_ID', 'First_Name', 'Middle_Name', 'Last_Name', 'Gender_MFU', 'Student_Address', 'Email_Adress', 'Cell_Mobile_Phone', 'Home_Phone'],
'Questions': ['Question_ID', 'Type_of_Question_Code', 'Question_Text'],
'Exams': ['Exam_ID', 'Subject_Code', 'Exam_Date', 'Exam_Name'],
'Questions_in_Exams': ['Exam_ID', 'Question_ID'],
'Valid_Answers': ['Valid_Answer_ID', 'Question_ID', 'Valid_Answer_Text'],
'Student_Answers': ['Student_Answer_ID', 'Exam_ID', 'Question_ID', 'Student_ID', 'Date_of_Answer', 'Comments', 'Satisfactory_YN', 'Student_Answer_Text'],
'Student_Assessments': ['Student_Answer_ID', 'Valid_Answer_ID', 'Student_Answer_Text', 'Satisfactory_YN', 'Assessment']
} | {
'Exams': ['Exam_ID', 'Subject_Code', 'Exam_Date']
} | TABLE Exams (
Exams.Exam_ID (INTEGER),
Exams.Subject_Code (CHAR(15)),
Exams.Exam_Date (DATETIME),
Exams.Exam_Name (VARCHAR(255)),
)
TABLE Questions (
Questions.Question_ID (INTEGER),
Questions.Type_of_Question_Code (VARCHAR(15)),
Questions.Question_Text (VARCHAR(255)),
)
TABLE Questions_in_Exams (
Questions_in_Exams.Exam_ID (INTEGER),
Questions_in_Exams.Question_ID (INTEGER),
)
TABLE Student_Answers (
Student_Answers.Student_Answer_ID (INTEGER),
Student_Answers.Exam_ID (INTEGER),
Student_Answers.Question_ID (INTEGER),
Student_Answers.Student_ID (INTEGER),
Student_Answers.Date_of_Answer (DATETIME),
Student_Answers.Comments (VARCHAR(255)),
Student_Answers.Satisfactory_YN (VARCHAR(1)),
Student_Answers.Student_Answer_Text (VARCHAR(255)),
)
TABLE Student_Assessments (
Student_Assessments.Student_Answer_ID (VARCHAR(100)),
Student_Assessments.Valid_Answer_ID (INTEGER),
Student_Assessments.Student_Answer_Text (VARCHAR(255)),
Student_Assessments.Satisfactory_YN (CHAR(1)),
Student_Assessments.Assessment (VARCHAR(40)),
)
TABLE Students (
Students.Student_ID (INTEGER),
Students.First_Name (VARCHAR(255)),
Students.Middle_Name (VARCHAR(255)),
Students.Last_Name (VARCHAR(255)),
Students.Gender_MFU (CHAR(1)),
Students.Student_Address (VARCHAR(255)),
Students.Email_Adress (VARCHAR(255)),
Students.Cell_Mobile_Phone (VARCHAR(255)),
Students.Home_Phone (VARCHAR(255)),
)
TABLE Valid_Answers (
Valid_Answers.Valid_Answer_ID (INTEGER),
Valid_Answers.Question_ID (INTEGER),
Valid_Answers.Valid_Answer_Text (VARCHAR(255)),
)
Possible JOINs:
Questions_in_Exams.Exam_ID = Exams.Exam_ID
Questions_in_Exams.Question_ID = Questions.Question_ID
Student_Answers.Exam_ID = Questions_in_Exams.Exam_ID
Student_Answers.Question_ID = Questions_in_Exams.Question_ID
Student_Answers.Student_ID = Students.Student_ID
Student_Assessments.Valid_Answer_ID = Valid_Answers.Valid_Answer_ID
Valid_Answers.Question_ID = Questions.Question_ID
| TABLE Exams (
Exams.exam_id (INTEGER),
Exams.subject_code (CHAR(15)),
Exams.exam_date (DATETIME),
Exams.exam_name (VARCHAR(255)),
)
TABLE Questions (
Questions.question_id (INTEGER),
Questions.type_of_question_code (VARCHAR(15)),
Questions.question_text (VARCHAR(255)),
)
TABLE Questions_in_Exams (
Questions_in_Exams.exam_id (INTEGER),
Questions_in_Exams.question_id (INTEGER),
)
TABLE Student_Answers (
Student_Answers.student_answer_id (INTEGER),
Student_Answers.exam_id (INTEGER),
Student_Answers.question_id (INTEGER),
Student_Answers.student_id (INTEGER),
Student_Answers.date_of_answer (DATETIME),
Student_Answers.comments (VARCHAR(255)),
Student_Answers.satisfactory_yn (VARCHAR(1)),
Student_Answers.student_answer_text (VARCHAR(255)),
)
TABLE Student_Assessments (
Student_Assessments.student_answer_id (VARCHAR(100)),
Student_Assessments.valid_answer_id (INTEGER),
Student_Assessments.student_answer_text (VARCHAR(255)),
Student_Assessments.satisfactory_yn (CHAR(1)),
Student_Assessments.assessment (VARCHAR(40)),
)
TABLE Students (
Students.student_id (INTEGER),
Students.first_name (VARCHAR(255)),
Students.middle_name (VARCHAR(255)),
Students.last_name (VARCHAR(255)),
Students.gender_mfu (CHAR(1)),
Students.student_address (VARCHAR(255)),
Students.email_adress (VARCHAR(255)),
Students.cell_mobile_phone (VARCHAR(255)),
Students.home_phone (VARCHAR(255)),
)
TABLE Valid_Answers (
Valid_Answers.valid_answer_id (INTEGER),
Valid_Answers.question_id (INTEGER),
Valid_Answers.valid_answer_text (VARCHAR(255)),
)
Possible JOINs:
Questions_in_Exams.exam_id = Exams.exam_id
Questions_in_Exams.question_id = Questions.question_id
Student_Answers.exam_id = Questions_in_Exams.exam_id
Student_Answers.question_id = Questions_in_Exams.question_id
Student_Answers.student_id = Students.student_id
Student_Assessments.valid_answer_id = Valid_Answers.valid_answer_id
Valid_Answers.question_id = Questions.question_id
| TABLE exams (
exams.exam_id (INTEGER),
exams.subject_code (CHAR(15)),
exams.exam_date (DATETIME),
exams.exam_name (VARCHAR(255)),
)
TABLE questions (
questions.question_id (INTEGER),
questions.type_of_question_code (VARCHAR(15)),
questions.question_text (VARCHAR(255)),
)
TABLE questions_in_exams (
questions_in_exams.exam_id (INTEGER),
questions_in_exams.question_id (INTEGER),
)
TABLE student_answers (
student_answers.student_answer_id (INTEGER),
student_answers.exam_id (INTEGER),
student_answers.question_id (INTEGER),
student_answers.student_id (INTEGER),
student_answers.date_of_answer (DATETIME),
student_answers.comments (VARCHAR(255)),
student_answers.satisfactory_yn (VARCHAR(1)),
student_answers.student_answer_text (VARCHAR(255)),
)
TABLE student_assessments (
student_assessments.student_answer_id (VARCHAR(100)),
student_assessments.valid_answer_id (INTEGER),
student_assessments.student_answer_text (VARCHAR(255)),
student_assessments.satisfactory_yn (CHAR(1)),
student_assessments.assessment (VARCHAR(40)),
)
TABLE students (
students.student_id (INTEGER),
students.first_name (VARCHAR(255)),
students.middle_name (VARCHAR(255)),
students.last_name (VARCHAR(255)),
students.gender_mfu (CHAR(1)),
students.student_address (VARCHAR(255)),
students.email_adress (VARCHAR(255)),
students.cell_mobile_phone (VARCHAR(255)),
students.home_phone (VARCHAR(255)),
)
TABLE valid_answers (
valid_answers.valid_answer_id (INTEGER),
valid_answers.question_id (INTEGER),
valid_answers.valid_answer_text (VARCHAR(255)),
)
Possible JOINs:
questions_in_exams.exam_id = exams.exam_id
questions_in_exams.question_id = questions.question_id
student_answers.exam_id = questions_in_exams.exam_id
student_answers.question_id = questions_in_exams.question_id
student_answers.student_id = students.student_id
student_assessments.valid_answer_id = valid_answers.valid_answer_id
valid_answers.question_id = questions.question_id
|
advertising_agencies |
CREATE TABLE "Agencies" (
agency_id INTEGER,
agency_details VARCHAR(255) NOT NULL,
PRIMARY KEY (agency_id)
)
CREATE TABLE "Clients" (
client_id INTEGER,
agency_id INTEGER NOT NULL,
sic_code VARCHAR(10) NOT NULL,
client_details VARCHAR(255) NOT NULL,
PRIMARY KEY (client_id),
FOREIGN KEY(agency_id) REFERENCES "Agencies" (agency_id)
)
CREATE TABLE "Invoices" (
invoice_id INTEGER,
client_id INTEGER NOT NULL,
invoice_status VARCHAR(10) NOT NULL,
invoice_details VARCHAR(255) NOT NULL,
PRIMARY KEY (invoice_id),
FOREIGN KEY(client_id) REFERENCES "Clients" (client_id)
)
CREATE TABLE "Meetings" (
meeting_id INTEGER,
client_id INTEGER NOT NULL,
meeting_outcome VARCHAR(10) NOT NULL,
meeting_type VARCHAR(10) NOT NULL,
billable_yn VARCHAR(1),
start_date_time DATETIME,
end_date_time DATETIME,
purpose_of_meeting VARCHAR(255),
other_details VARCHAR(255) NOT NULL,
PRIMARY KEY (meeting_id),
FOREIGN KEY(client_id) REFERENCES "Clients" (client_id)
)
CREATE TABLE "Payments" (
payment_id INTEGER NOT NULL,
invoice_id INTEGER NOT NULL,
payment_details VARCHAR(255) NOT NULL,
FOREIGN KEY(invoice_id) REFERENCES "Invoices" (invoice_id)
)
CREATE TABLE "Staff" (
staff_id INTEGER,
agency_id INTEGER NOT NULL,
staff_details VARCHAR(255) NOT NULL,
PRIMARY KEY (staff_id)
)
CREATE TABLE "Staff_in_Meetings" (
meeting_id INTEGER NOT NULL,
staff_id INTEGER NOT NULL,
FOREIGN KEY(staff_id) REFERENCES "Staff" (staff_id),
FOREIGN KEY(meeting_id) REFERENCES "Meetings" (meeting_id)
) | How many clients are there? | easy | Table Agencies (
Agencies.agency_id (INTEGER),
Agencies.agency_details (VARCHAR(255)),
)
Table Clients (
Clients.client_id (INTEGER),
Clients.agency_id (INTEGER),
Clients.sic_code (VARCHAR(10)),
Clients.client_details (VARCHAR(255)),
)
Table Invoices (
Invoices.invoice_id (INTEGER),
Invoices.client_id (INTEGER),
Invoices.invoice_status (VARCHAR(10)),
Invoices.invoice_details (VARCHAR(255)),
)
Table Meetings (
Meetings.meeting_id (INTEGER),
Meetings.client_id (INTEGER),
Meetings.meeting_outcome (VARCHAR(10)),
Meetings.meeting_type (VARCHAR(10)),
Meetings.billable_yn (VARCHAR(1)),
Meetings.start_date_time (DATETIME),
Meetings.end_date_time (DATETIME),
Meetings.purpose_of_meeting (VARCHAR(255)),
Meetings.other_details (VARCHAR(255)),
)
Table Payments (
Payments.payment_id (INTEGER),
Payments.invoice_id (INTEGER),
Payments.payment_details (VARCHAR(255)),
)
Table Staff (
Staff.staff_id (INTEGER),
Staff.agency_id (INTEGER),
Staff.staff_details (VARCHAR(255)),
)
Table Staff_in_Meetings (
Staff_in_Meetings.meeting_id (INTEGER),
Staff_in_Meetings.staff_id (INTEGER),
)
Possible JOINs:
Clients.agency_id = Agencies.agency_id
Invoices.client_id = Clients.client_id
Meetings.client_id = Clients.client_id
Payments.invoice_id = Invoices.invoice_id
Staff_in_Meetings.meeting_id = Meetings.meeting_id
Staff_in_Meetings.staff_id = Staff.staff_id
| SELECT count(*) FROM Clients | {
'clients': ['client_id']
} | CREATE TABLE Agencies (
Agencies.agency_id (INTEGER),
Agencies.agency_details (VARCHAR(255)),
)
CREATE TABLE Clients (
Clients.client_id (INTEGER),
Clients.agency_id (INTEGER),
Clients.sic_code (VARCHAR(10)),
Clients.client_details (VARCHAR(255)),
)
CREATE TABLE Invoices (
Invoices.invoice_id (INTEGER),
Invoices.client_id (INTEGER),
Invoices.invoice_status (VARCHAR(10)),
Invoices.invoice_details (VARCHAR(255)),
)
CREATE TABLE Meetings (
Meetings.meeting_id (INTEGER),
Meetings.client_id (INTEGER),
Meetings.meeting_outcome (VARCHAR(10)),
Meetings.meeting_type (VARCHAR(10)),
Meetings.billable_yn (VARCHAR(1)),
Meetings.start_date_time (DATETIME),
Meetings.end_date_time (DATETIME),
Meetings.purpose_of_meeting (VARCHAR(255)),
Meetings.other_details (VARCHAR(255)),
)
CREATE TABLE Payments (
Payments.payment_id (INTEGER),
Payments.invoice_id (INTEGER),
Payments.payment_details (VARCHAR(255)),
)
CREATE TABLE Staff (
Staff.staff_id (INTEGER),
Staff.agency_id (INTEGER),
Staff.staff_details (VARCHAR(255)),
)
CREATE TABLE Staff_in_Meetings (
Staff_in_Meetings.meeting_id (INTEGER),
Staff_in_Meetings.staff_id (INTEGER),
)
Possible JOINs:
Clients.agency_id = Agencies.agency_id
Invoices.client_id = Clients.client_id
Meetings.client_id = Clients.client_id
Payments.invoice_id = Invoices.invoice_id
Staff_in_Meetings.meeting_id = Meetings.meeting_id
Staff_in_Meetings.staff_id = Staff.staff_id
| Table Agencies (
Agencies.agency_id (INTEGER),
Agencies.agency_details (VARCHAR(255)),
)
Table Clients (
Clients.client_id (INTEGER),
Clients.agency_id (INTEGER),
Clients.sic_code (VARCHAR(10)),
Clients.client_details (VARCHAR(255)),
)
Table Invoices (
Invoices.invoice_id (INTEGER),
Invoices.client_id (INTEGER),
Invoices.invoice_status (VARCHAR(10)),
Invoices.invoice_details (VARCHAR(255)),
)
Table Meetings (
Meetings.meeting_id (INTEGER),
Meetings.client_id (INTEGER),
Meetings.meeting_outcome (VARCHAR(10)),
Meetings.meeting_type (VARCHAR(10)),
Meetings.billable_yn (VARCHAR(1)),
Meetings.start_date_time (DATETIME),
Meetings.end_date_time (DATETIME),
Meetings.purpose_of_meeting (VARCHAR(255)),
Meetings.other_details (VARCHAR(255)),
)
Table Payments (
Payments.payment_id (INTEGER),
Payments.invoice_id (INTEGER),
Payments.payment_details (VARCHAR(255)),
)
Table Staff (
Staff.staff_id (INTEGER),
Staff.agency_id (INTEGER),
Staff.staff_details (VARCHAR(255)),
)
Table Staff_in_Meetings (
Staff_in_Meetings.meeting_id (INTEGER),
Staff_in_Meetings.staff_id (INTEGER),
)
Possible JOINs:
Clients.agency_id = Agencies.agency_id
Invoices.client_id = Clients.client_id
Meetings.client_id = Clients.client_id
Payments.invoice_id = Invoices.invoice_id
Staff_in_Meetings.meeting_id = Meetings.meeting_id
Staff_in_Meetings.staff_id = Staff.staff_id
| CREATE TABLE Agencies (
Agencies.agency_id (INTEGER),
Agencies.agency_details (VARCHAR(255)),
)
CREATE TABLE Clients (
Clients.client_id (INTEGER),
Clients.agency_id (INTEGER),
Clients.sic_code (VARCHAR(10)),
Clients.client_details (VARCHAR(255)),
)
CREATE TABLE Invoices (
Invoices.invoice_id (INTEGER),
Invoices.client_id (INTEGER),
Invoices.invoice_status (VARCHAR(10)),
Invoices.invoice_details (VARCHAR(255)),
)
CREATE TABLE Meetings (
Meetings.meeting_id (INTEGER),
Meetings.client_id (INTEGER),
Meetings.meeting_outcome (VARCHAR(10)),
Meetings.meeting_type (VARCHAR(10)),
Meetings.billable_yn (VARCHAR(1)),
Meetings.start_date_time (DATETIME),
Meetings.end_date_time (DATETIME),
Meetings.purpose_of_meeting (VARCHAR(255)),
Meetings.other_details (VARCHAR(255)),
)
CREATE TABLE Payments (
Payments.payment_id (INTEGER),
Payments.invoice_id (INTEGER),
Payments.payment_details (VARCHAR(255)),
)
CREATE TABLE Staff (
Staff.staff_id (INTEGER),
Staff.agency_id (INTEGER),
Staff.staff_details (VARCHAR(255)),
)
CREATE TABLE Staff_in_Meetings (
Staff_in_Meetings.meeting_id (INTEGER),
Staff_in_Meetings.staff_id (INTEGER),
)
Possible JOINs:
Clients.agency_id = Agencies.agency_id
Invoices.client_id = Clients.client_id
Meetings.client_id = Clients.client_id
Payments.invoice_id = Invoices.invoice_id
Staff_in_Meetings.meeting_id = Meetings.meeting_id
Staff_in_Meetings.staff_id = Staff.staff_id
| Table agencies (
agencies.agency_id (INTEGER),
agencies.agency_details (VARCHAR(255)),
)
Table clients (
clients.client_id (INTEGER),
clients.agency_id (INTEGER),
clients.sic_code (VARCHAR(10)),
clients.client_details (VARCHAR(255)),
)
Table invoices (
invoices.invoice_id (INTEGER),
invoices.client_id (INTEGER),
invoices.invoice_status (VARCHAR(10)),
invoices.invoice_details (VARCHAR(255)),
)
Table meetings (
meetings.meeting_id (INTEGER),
meetings.client_id (INTEGER),
meetings.meeting_outcome (VARCHAR(10)),
meetings.meeting_type (VARCHAR(10)),
meetings.billable_yn (VARCHAR(1)),
meetings.start_date_time (DATETIME),
meetings.end_date_time (DATETIME),
meetings.purpose_of_meeting (VARCHAR(255)),
meetings.other_details (VARCHAR(255)),
)
Table payments (
payments.payment_id (INTEGER),
payments.invoice_id (INTEGER),
payments.payment_details (VARCHAR(255)),
)
Table staff (
staff.staff_id (INTEGER),
staff.agency_id (INTEGER),
staff.staff_details (VARCHAR(255)),
)
Table staff_in_meetings (
staff_in_meetings.meeting_id (INTEGER),
staff_in_meetings.staff_id (INTEGER),
)
Possible JOINs:
clients.agency_id = agencies.agency_id
invoices.client_id = clients.client_id
meetings.client_id = clients.client_id
payments.invoice_id = invoices.invoice_id
staff_in_meetings.meeting_id = meetings.meeting_id
staff_in_meetings.staff_id = staff.staff_id
| CREATE TABLE agencies (
agencies.agency_id (INTEGER),
agencies.agency_details (VARCHAR(255)),
)
CREATE TABLE clients (
clients.client_id (INTEGER),
clients.agency_id (INTEGER),
clients.sic_code (VARCHAR(10)),
clients.client_details (VARCHAR(255)),
)
CREATE TABLE invoices (
invoices.invoice_id (INTEGER),
invoices.client_id (INTEGER),
invoices.invoice_status (VARCHAR(10)),
invoices.invoice_details (VARCHAR(255)),
)
CREATE TABLE meetings (
meetings.meeting_id (INTEGER),
meetings.client_id (INTEGER),
meetings.meeting_outcome (VARCHAR(10)),
meetings.meeting_type (VARCHAR(10)),
meetings.billable_yn (VARCHAR(1)),
meetings.start_date_time (DATETIME),
meetings.end_date_time (DATETIME),
meetings.purpose_of_meeting (VARCHAR(255)),
meetings.other_details (VARCHAR(255)),
)
CREATE TABLE payments (
payments.payment_id (INTEGER),
payments.invoice_id (INTEGER),
payments.payment_details (VARCHAR(255)),
)
CREATE TABLE staff (
staff.staff_id (INTEGER),
staff.agency_id (INTEGER),
staff.staff_details (VARCHAR(255)),
)
CREATE TABLE staff_in_meetings (
staff_in_meetings.meeting_id (INTEGER),
staff_in_meetings.staff_id (INTEGER),
)
Possible JOINs:
clients.agency_id = agencies.agency_id
invoices.client_id = clients.client_id
meetings.client_id = clients.client_id
payments.invoice_id = invoices.invoice_id
staff_in_meetings.meeting_id = meetings.meeting_id
staff_in_meetings.staff_id = staff.staff_id
| {
'Agencies': ['agency_id', 'agency_details'],
'Staff': ['staff_id', 'agency_id', 'staff_details'],
'Clients': ['client_id', 'agency_id', 'sic_code', 'client_details'],
'Invoices': ['invoice_id', 'client_id', 'invoice_status', 'invoice_details'],
'Meetings': ['meeting_id', 'client_id', 'meeting_outcome', 'meeting_type', 'billable_yn', 'start_date_time', 'end_date_time', 'purpose_of_meeting', 'other_details'],
'Payments': ['payment_id', 'invoice_id', 'payment_details'],
'Staff_in_Meetings': ['meeting_id', 'staff_id']
} | {
'Clients': ['client_id']
} | TABLE Agencies (
Agencies.agency_id (INTEGER),
Agencies.agency_details (VARCHAR(255)),
)
TABLE Clients (
Clients.client_id (INTEGER),
Clients.agency_id (INTEGER),
Clients.sic_code (VARCHAR(10)),
Clients.client_details (VARCHAR(255)),
)
TABLE Invoices (
Invoices.invoice_id (INTEGER),
Invoices.client_id (INTEGER),
Invoices.invoice_status (VARCHAR(10)),
Invoices.invoice_details (VARCHAR(255)),
)
TABLE Meetings (
Meetings.meeting_id (INTEGER),
Meetings.client_id (INTEGER),
Meetings.meeting_outcome (VARCHAR(10)),
Meetings.meeting_type (VARCHAR(10)),
Meetings.billable_yn (VARCHAR(1)),
Meetings.start_date_time (DATETIME),
Meetings.end_date_time (DATETIME),
Meetings.purpose_of_meeting (VARCHAR(255)),
Meetings.other_details (VARCHAR(255)),
)
TABLE Payments (
Payments.payment_id (INTEGER),
Payments.invoice_id (INTEGER),
Payments.payment_details (VARCHAR(255)),
)
TABLE Staff (
Staff.staff_id (INTEGER),
Staff.agency_id (INTEGER),
Staff.staff_details (VARCHAR(255)),
)
TABLE Staff_in_Meetings (
Staff_in_Meetings.meeting_id (INTEGER),
Staff_in_Meetings.staff_id (INTEGER),
)
Possible JOINs:
Clients.agency_id = Agencies.agency_id
Invoices.client_id = Clients.client_id
Meetings.client_id = Clients.client_id
Payments.invoice_id = Invoices.invoice_id
Staff_in_Meetings.meeting_id = Meetings.meeting_id
Staff_in_Meetings.staff_id = Staff.staff_id
| TABLE Agencies (
Agencies.agency_id (INTEGER),
Agencies.agency_details (VARCHAR(255)),
)
TABLE Clients (
Clients.client_id (INTEGER),
Clients.agency_id (INTEGER),
Clients.sic_code (VARCHAR(10)),
Clients.client_details (VARCHAR(255)),
)
TABLE Invoices (
Invoices.invoice_id (INTEGER),
Invoices.client_id (INTEGER),
Invoices.invoice_status (VARCHAR(10)),
Invoices.invoice_details (VARCHAR(255)),
)
TABLE Meetings (
Meetings.meeting_id (INTEGER),
Meetings.client_id (INTEGER),
Meetings.meeting_outcome (VARCHAR(10)),
Meetings.meeting_type (VARCHAR(10)),
Meetings.billable_yn (VARCHAR(1)),
Meetings.start_date_time (DATETIME),
Meetings.end_date_time (DATETIME),
Meetings.purpose_of_meeting (VARCHAR(255)),
Meetings.other_details (VARCHAR(255)),
)
TABLE Payments (
Payments.payment_id (INTEGER),
Payments.invoice_id (INTEGER),
Payments.payment_details (VARCHAR(255)),
)
TABLE Staff (
Staff.staff_id (INTEGER),
Staff.agency_id (INTEGER),
Staff.staff_details (VARCHAR(255)),
)
TABLE Staff_in_Meetings (
Staff_in_Meetings.meeting_id (INTEGER),
Staff_in_Meetings.staff_id (INTEGER),
)
Possible JOINs:
Clients.agency_id = Agencies.agency_id
Invoices.client_id = Clients.client_id
Meetings.client_id = Clients.client_id
Payments.invoice_id = Invoices.invoice_id
Staff_in_Meetings.meeting_id = Meetings.meeting_id
Staff_in_Meetings.staff_id = Staff.staff_id
| TABLE agencies (
agencies.agency_id (INTEGER),
agencies.agency_details (VARCHAR(255)),
)
TABLE clients (
clients.client_id (INTEGER),
clients.agency_id (INTEGER),
clients.sic_code (VARCHAR(10)),
clients.client_details (VARCHAR(255)),
)
TABLE invoices (
invoices.invoice_id (INTEGER),
invoices.client_id (INTEGER),
invoices.invoice_status (VARCHAR(10)),
invoices.invoice_details (VARCHAR(255)),
)
TABLE meetings (
meetings.meeting_id (INTEGER),
meetings.client_id (INTEGER),
meetings.meeting_outcome (VARCHAR(10)),
meetings.meeting_type (VARCHAR(10)),
meetings.billable_yn (VARCHAR(1)),
meetings.start_date_time (DATETIME),
meetings.end_date_time (DATETIME),
meetings.purpose_of_meeting (VARCHAR(255)),
meetings.other_details (VARCHAR(255)),
)
TABLE payments (
payments.payment_id (INTEGER),
payments.invoice_id (INTEGER),
payments.payment_details (VARCHAR(255)),
)
TABLE staff (
staff.staff_id (INTEGER),
staff.agency_id (INTEGER),
staff.staff_details (VARCHAR(255)),
)
TABLE staff_in_meetings (
staff_in_meetings.meeting_id (INTEGER),
staff_in_meetings.staff_id (INTEGER),
)
Possible JOINs:
clients.agency_id = agencies.agency_id
invoices.client_id = clients.client_id
meetings.client_id = clients.client_id
payments.invoice_id = invoices.invoice_id
staff_in_meetings.meeting_id = meetings.meeting_id
staff_in_meetings.staff_id = staff.staff_id
|
tv_shows |
CREATE TABLE city_channel (
"ID" INTEGER,
"City" TEXT,
"Station_name" TEXT,
"Owned_Since" REAL,
"Affiliation" TEXT,
PRIMARY KEY ("ID")
)
CREATE TABLE city_channel_radio (
"City_channel_ID" INTEGER,
"Radio_ID" INTEGER,
"Is_online" BOOLEAN,
PRIMARY KEY ("City_channel_ID", "Radio_ID"),
FOREIGN KEY("Radio_ID") REFERENCES radio ("Radio_ID"),
FOREIGN KEY("City_channel_ID") REFERENCES city_channel ("ID")
)
CREATE TABLE city_channel_tv_show (
"City_channel_ID" INTEGER,
"tv_show_ID" INTEGER,
"Is_online" BOOLEAN,
"Is_free" BOOLEAN,
PRIMARY KEY ("City_channel_ID", "tv_show_ID"),
FOREIGN KEY("tv_show_ID") REFERENCES tv_show ("tv_show_ID"),
FOREIGN KEY("City_channel_ID") REFERENCES city_channel ("ID")
)
CREATE TABLE radio (
"Radio_ID" INTEGER,
"Transmitter" TEXT,
"Radio_MHz" TEXT,
"2FM_MHz" TEXT,
"RnaG_MHz" TEXT,
"Lyric_FM_MHz" TEXT,
"ERP_kW" TEXT,
PRIMARY KEY ("Radio_ID")
)
CREATE TABLE tv_show (
"tv_show_ID" INTEGER,
tv_show_name TEXT,
"Sub_tittle" TEXT,
"Next_show_name" TEXT,
"Original_Airdate" TEXT,
PRIMARY KEY ("tv_show_ID")
) | List the station names of city channels whose affiliation is not "ABC". | easy | Table city_channel (
city_channel.ID (INT),
city_channel.City (TEXT),
city_channel.Station_name (TEXT),
city_channel.Owned_Since (REAL),
city_channel.Affiliation (TEXT),
)
Table city_channel_radio (
city_channel_radio.City_channel_ID (INT),
city_channel_radio.Radio_ID (INT),
city_channel_radio.Is_online (bool),
)
Table city_channel_tv_show (
city_channel_tv_show.City_channel_ID (INT),
city_channel_tv_show.tv_show_ID (INT),
city_channel_tv_show.Is_online (bool),
city_channel_tv_show.Is_free (bool),
)
Table radio (
radio.Radio_ID (INT),
radio.Transmitter (TEXT),
radio.Radio_MHz (TEXT),
radio.2FM_MHz (TEXT),
radio.RnaG_MHz (TEXT),
radio.Lyric_FM_MHz (TEXT),
radio.ERP_kW (TEXT),
)
Table tv_show (
tv_show.tv_show_ID (INT),
tv_show.tv_show_name (TEXT),
tv_show.Sub_tittle (TEXT),
tv_show.Next_show_name (TEXT),
tv_show.Original_Airdate (TEXT),
)
Possible JOINs:
city_channel_radio.City_channel_ID = city_channel.ID
city_channel_radio.Radio_ID = radio.Radio_ID
city_channel_tv_show.City_channel_ID = city_channel.ID
city_channel_tv_show.tv_show_ID = tv_show.tv_show_ID
| SELECT Station_name FROM city_channel WHERE Affiliation != "ABC" | {
'city_channel': ['id', 'station_name', 'affiliation']
} | CREATE TABLE city_channel (
city_channel.ID (INT),
city_channel.City (TEXT),
city_channel.Station_name (TEXT),
city_channel.Owned_Since (REAL),
city_channel.Affiliation (TEXT),
)
CREATE TABLE city_channel_radio (
city_channel_radio.City_channel_ID (INT),
city_channel_radio.Radio_ID (INT),
city_channel_radio.Is_online (bool),
)
CREATE TABLE city_channel_tv_show (
city_channel_tv_show.City_channel_ID (INT),
city_channel_tv_show.tv_show_ID (INT),
city_channel_tv_show.Is_online (bool),
city_channel_tv_show.Is_free (bool),
)
CREATE TABLE radio (
radio.Radio_ID (INT),
radio.Transmitter (TEXT),
radio.Radio_MHz (TEXT),
radio.2FM_MHz (TEXT),
radio.RnaG_MHz (TEXT),
radio.Lyric_FM_MHz (TEXT),
radio.ERP_kW (TEXT),
)
CREATE TABLE tv_show (
tv_show.tv_show_ID (INT),
tv_show.tv_show_name (TEXT),
tv_show.Sub_tittle (TEXT),
tv_show.Next_show_name (TEXT),
tv_show.Original_Airdate (TEXT),
)
Possible JOINs:
city_channel_radio.City_channel_ID = city_channel.ID
city_channel_radio.Radio_ID = radio.Radio_ID
city_channel_tv_show.City_channel_ID = city_channel.ID
city_channel_tv_show.tv_show_ID = tv_show.tv_show_ID
| Table city_channel (
city_channel.id (INT),
city_channel.city (TEXT),
city_channel.station_name (TEXT),
city_channel.owned_since (REAL),
city_channel.affiliation (TEXT),
)
Table city_channel_radio (
city_channel_radio.city_channel_id (INT),
city_channel_radio.radio_id (INT),
city_channel_radio.is_online (bool),
)
Table city_channel_tv_show (
city_channel_tv_show.city_channel_id (INT),
city_channel_tv_show.tv_show_id (INT),
city_channel_tv_show.is_online (bool),
city_channel_tv_show.is_free (bool),
)
Table radio (
radio.radio_id (INT),
radio.transmitter (TEXT),
radio.radio_mhz (TEXT),
radio.2fm_mhz (TEXT),
radio.rnag_mhz (TEXT),
radio.lyric_fm_mhz (TEXT),
radio.erp_kw (TEXT),
)
Table tv_show (
tv_show.tv_show_id (INT),
tv_show.tv_show_name (TEXT),
tv_show.sub_tittle (TEXT),
tv_show.next_show_name (TEXT),
tv_show.original_airdate (TEXT),
)
Possible JOINs:
city_channel_radio.city_channel_id = city_channel.id
city_channel_radio.radio_id = radio.radio_id
city_channel_tv_show.city_channel_id = city_channel.id
city_channel_tv_show.tv_show_id = tv_show.tv_show_id
| CREATE TABLE city_channel (
city_channel.id (INT),
city_channel.city (TEXT),
city_channel.station_name (TEXT),
city_channel.owned_since (REAL),
city_channel.affiliation (TEXT),
)
CREATE TABLE city_channel_radio (
city_channel_radio.city_channel_id (INT),
city_channel_radio.radio_id (INT),
city_channel_radio.is_online (bool),
)
CREATE TABLE city_channel_tv_show (
city_channel_tv_show.city_channel_id (INT),
city_channel_tv_show.tv_show_id (INT),
city_channel_tv_show.is_online (bool),
city_channel_tv_show.is_free (bool),
)
CREATE TABLE radio (
radio.radio_id (INT),
radio.transmitter (TEXT),
radio.radio_mhz (TEXT),
radio.2fm_mhz (TEXT),
radio.rnag_mhz (TEXT),
radio.lyric_fm_mhz (TEXT),
radio.erp_kw (TEXT),
)
CREATE TABLE tv_show (
tv_show.tv_show_id (INT),
tv_show.tv_show_name (TEXT),
tv_show.sub_tittle (TEXT),
tv_show.next_show_name (TEXT),
tv_show.original_airdate (TEXT),
)
Possible JOINs:
city_channel_radio.city_channel_id = city_channel.id
city_channel_radio.radio_id = radio.radio_id
city_channel_tv_show.city_channel_id = city_channel.id
city_channel_tv_show.tv_show_id = tv_show.tv_show_id
| Table city_channel (
city_channel.id (INT),
city_channel.city (TEXT),
city_channel.station_name (TEXT),
city_channel.owned_since (REAL),
city_channel.affiliation (TEXT),
)
Table city_channel_radio (
city_channel_radio.city_channel_id (INT),
city_channel_radio.radio_id (INT),
city_channel_radio.is_online (bool),
)
Table city_channel_tv_show (
city_channel_tv_show.city_channel_id (INT),
city_channel_tv_show.tv_show_id (INT),
city_channel_tv_show.is_online (bool),
city_channel_tv_show.is_free (bool),
)
Table radio (
radio.radio_id (INT),
radio.transmitter (TEXT),
radio.radio_mhz (TEXT),
radio.2fm_mhz (TEXT),
radio.rnag_mhz (TEXT),
radio.lyric_fm_mhz (TEXT),
radio.erp_kw (TEXT),
)
Table tv_show (
tv_show.tv_show_id (INT),
tv_show.tv_show_name (TEXT),
tv_show.sub_tittle (TEXT),
tv_show.next_show_name (TEXT),
tv_show.original_airdate (TEXT),
)
Possible JOINs:
city_channel_radio.city_channel_id = city_channel.id
city_channel_radio.radio_id = radio.radio_id
city_channel_tv_show.city_channel_id = city_channel.id
city_channel_tv_show.tv_show_id = tv_show.tv_show_id
| CREATE TABLE city_channel (
city_channel.id (INT),
city_channel.city (TEXT),
city_channel.station_name (TEXT),
city_channel.owned_since (REAL),
city_channel.affiliation (TEXT),
)
CREATE TABLE city_channel_radio (
city_channel_radio.city_channel_id (INT),
city_channel_radio.radio_id (INT),
city_channel_radio.is_online (bool),
)
CREATE TABLE city_channel_tv_show (
city_channel_tv_show.city_channel_id (INT),
city_channel_tv_show.tv_show_id (INT),
city_channel_tv_show.is_online (bool),
city_channel_tv_show.is_free (bool),
)
CREATE TABLE radio (
radio.radio_id (INT),
radio.transmitter (TEXT),
radio.radio_mhz (TEXT),
radio.2fm_mhz (TEXT),
radio.rnag_mhz (TEXT),
radio.lyric_fm_mhz (TEXT),
radio.erp_kw (TEXT),
)
CREATE TABLE tv_show (
tv_show.tv_show_id (INT),
tv_show.tv_show_name (TEXT),
tv_show.sub_tittle (TEXT),
tv_show.next_show_name (TEXT),
tv_show.original_airdate (TEXT),
)
Possible JOINs:
city_channel_radio.city_channel_id = city_channel.id
city_channel_radio.radio_id = radio.radio_id
city_channel_tv_show.city_channel_id = city_channel.id
city_channel_tv_show.tv_show_id = tv_show.tv_show_id
| {
'city_channel': ['ID', 'City', 'Station_name', 'Owned_Since', 'Affiliation'],
'radio': ['Radio_ID', 'Transmitter', 'Radio_MHz', '2FM_MHz', 'RnaG_MHz', 'Lyric_FM_MHz', 'ERP_kW'],
'tv_show': ['tv_show_ID', 'tv_show_name', 'Sub_tittle', 'Next_show_name', 'Original_Airdate'],
'city_channel_radio': ['City_channel_ID', 'Radio_ID', 'Is_online'],
'city_channel_tv_show': ['City_channel_ID', 'tv_show_ID', 'Is_online', 'Is_free']
} | {
'city_channel': ['ID', 'Station_name', 'Affiliation']
} | TABLE city_channel (
city_channel.ID (INT),
city_channel.City (TEXT),
city_channel.Station_name (TEXT),
city_channel.Owned_Since (REAL),
city_channel.Affiliation (TEXT),
)
TABLE city_channel_radio (
city_channel_radio.City_channel_ID (INT),
city_channel_radio.Radio_ID (INT),
city_channel_radio.Is_online (bool),
)
TABLE city_channel_tv_show (
city_channel_tv_show.City_channel_ID (INT),
city_channel_tv_show.tv_show_ID (INT),
city_channel_tv_show.Is_online (bool),
city_channel_tv_show.Is_free (bool),
)
TABLE radio (
radio.Radio_ID (INT),
radio.Transmitter (TEXT),
radio.Radio_MHz (TEXT),
radio.2FM_MHz (TEXT),
radio.RnaG_MHz (TEXT),
radio.Lyric_FM_MHz (TEXT),
radio.ERP_kW (TEXT),
)
TABLE tv_show (
tv_show.tv_show_ID (INT),
tv_show.tv_show_name (TEXT),
tv_show.Sub_tittle (TEXT),
tv_show.Next_show_name (TEXT),
tv_show.Original_Airdate (TEXT),
)
Possible JOINs:
city_channel_radio.City_channel_ID = city_channel.ID
city_channel_radio.Radio_ID = radio.Radio_ID
city_channel_tv_show.City_channel_ID = city_channel.ID
city_channel_tv_show.tv_show_ID = tv_show.tv_show_ID
| TABLE city_channel (
city_channel.id (INT),
city_channel.city (TEXT),
city_channel.station_name (TEXT),
city_channel.owned_since (REAL),
city_channel.affiliation (TEXT),
)
TABLE city_channel_radio (
city_channel_radio.city_channel_id (INT),
city_channel_radio.radio_id (INT),
city_channel_radio.is_online (bool),
)
TABLE city_channel_tv_show (
city_channel_tv_show.city_channel_id (INT),
city_channel_tv_show.tv_show_id (INT),
city_channel_tv_show.is_online (bool),
city_channel_tv_show.is_free (bool),
)
TABLE radio (
radio.radio_id (INT),
radio.transmitter (TEXT),
radio.radio_mhz (TEXT),
radio.2fm_mhz (TEXT),
radio.rnag_mhz (TEXT),
radio.lyric_fm_mhz (TEXT),
radio.erp_kw (TEXT),
)
TABLE tv_show (
tv_show.tv_show_id (INT),
tv_show.tv_show_name (TEXT),
tv_show.sub_tittle (TEXT),
tv_show.next_show_name (TEXT),
tv_show.original_airdate (TEXT),
)
Possible JOINs:
city_channel_radio.city_channel_id = city_channel.id
city_channel_radio.radio_id = radio.radio_id
city_channel_tv_show.city_channel_id = city_channel.id
city_channel_tv_show.tv_show_id = tv_show.tv_show_id
| TABLE city_channel (
city_channel.id (INT),
city_channel.city (TEXT),
city_channel.station_name (TEXT),
city_channel.owned_since (REAL),
city_channel.affiliation (TEXT),
)
TABLE city_channel_radio (
city_channel_radio.city_channel_id (INT),
city_channel_radio.radio_id (INT),
city_channel_radio.is_online (bool),
)
TABLE city_channel_tv_show (
city_channel_tv_show.city_channel_id (INT),
city_channel_tv_show.tv_show_id (INT),
city_channel_tv_show.is_online (bool),
city_channel_tv_show.is_free (bool),
)
TABLE radio (
radio.radio_id (INT),
radio.transmitter (TEXT),
radio.radio_mhz (TEXT),
radio.2fm_mhz (TEXT),
radio.rnag_mhz (TEXT),
radio.lyric_fm_mhz (TEXT),
radio.erp_kw (TEXT),
)
TABLE tv_show (
tv_show.tv_show_id (INT),
tv_show.tv_show_name (TEXT),
tv_show.sub_tittle (TEXT),
tv_show.next_show_name (TEXT),
tv_show.original_airdate (TEXT),
)
Possible JOINs:
city_channel_radio.city_channel_id = city_channel.id
city_channel_radio.radio_id = radio.radio_id
city_channel_tv_show.city_channel_id = city_channel.id
city_channel_tv_show.tv_show_id = tv_show.tv_show_id
|
advertising_agencies |
CREATE TABLE "Agencies" (
agency_id INTEGER,
agency_details VARCHAR(255) NOT NULL,
PRIMARY KEY (agency_id)
)
CREATE TABLE "Clients" (
client_id INTEGER,
agency_id INTEGER NOT NULL,
sic_code VARCHAR(10) NOT NULL,
client_details VARCHAR(255) NOT NULL,
PRIMARY KEY (client_id),
FOREIGN KEY(agency_id) REFERENCES "Agencies" (agency_id)
)
CREATE TABLE "Invoices" (
invoice_id INTEGER,
client_id INTEGER NOT NULL,
invoice_status VARCHAR(10) NOT NULL,
invoice_details VARCHAR(255) NOT NULL,
PRIMARY KEY (invoice_id),
FOREIGN KEY(client_id) REFERENCES "Clients" (client_id)
)
CREATE TABLE "Meetings" (
meeting_id INTEGER,
client_id INTEGER NOT NULL,
meeting_outcome VARCHAR(10) NOT NULL,
meeting_type VARCHAR(10) NOT NULL,
billable_yn VARCHAR(1),
start_date_time DATETIME,
end_date_time DATETIME,
purpose_of_meeting VARCHAR(255),
other_details VARCHAR(255) NOT NULL,
PRIMARY KEY (meeting_id),
FOREIGN KEY(client_id) REFERENCES "Clients" (client_id)
)
CREATE TABLE "Payments" (
payment_id INTEGER NOT NULL,
invoice_id INTEGER NOT NULL,
payment_details VARCHAR(255) NOT NULL,
FOREIGN KEY(invoice_id) REFERENCES "Invoices" (invoice_id)
)
CREATE TABLE "Staff" (
staff_id INTEGER,
agency_id INTEGER NOT NULL,
staff_details VARCHAR(255) NOT NULL,
PRIMARY KEY (staff_id)
)
CREATE TABLE "Staff_in_Meetings" (
meeting_id INTEGER NOT NULL,
staff_id INTEGER NOT NULL,
FOREIGN KEY(staff_id) REFERENCES "Staff" (staff_id),
FOREIGN KEY(meeting_id) REFERENCES "Meetings" (meeting_id)
) | What is the staff id of the staff who attended the least meetings but attended some meeting? | hard | Table Agencies (
Agencies.agency_id (INTEGER),
Agencies.agency_details (VARCHAR(255)),
)
Table Clients (
Clients.client_id (INTEGER),
Clients.agency_id (INTEGER),
Clients.sic_code (VARCHAR(10)),
Clients.client_details (VARCHAR(255)),
)
Table Invoices (
Invoices.invoice_id (INTEGER),
Invoices.client_id (INTEGER),
Invoices.invoice_status (VARCHAR(10)),
Invoices.invoice_details (VARCHAR(255)),
)
Table Meetings (
Meetings.meeting_id (INTEGER),
Meetings.client_id (INTEGER),
Meetings.meeting_outcome (VARCHAR(10)),
Meetings.meeting_type (VARCHAR(10)),
Meetings.billable_yn (VARCHAR(1)),
Meetings.start_date_time (DATETIME),
Meetings.end_date_time (DATETIME),
Meetings.purpose_of_meeting (VARCHAR(255)),
Meetings.other_details (VARCHAR(255)),
)
Table Payments (
Payments.payment_id (INTEGER),
Payments.invoice_id (INTEGER),
Payments.payment_details (VARCHAR(255)),
)
Table Staff (
Staff.staff_id (INTEGER),
Staff.agency_id (INTEGER),
Staff.staff_details (VARCHAR(255)),
)
Table Staff_in_Meetings (
Staff_in_Meetings.meeting_id (INTEGER),
Staff_in_Meetings.staff_id (INTEGER),
)
Possible JOINs:
Clients.agency_id = Agencies.agency_id
Invoices.client_id = Clients.client_id
Meetings.client_id = Clients.client_id
Payments.invoice_id = Invoices.invoice_id
Staff_in_Meetings.meeting_id = Meetings.meeting_id
Staff_in_Meetings.staff_id = Staff.staff_id
| SELECT staff_id , count(*) FROM Staff_in_meetings GROUP BY staff_id ORDER BY count(*) ASC LIMIT 1; | {
'staff_in_meetings': ['staff_id']
} | CREATE TABLE Agencies (
Agencies.agency_id (INTEGER),
Agencies.agency_details (VARCHAR(255)),
)
CREATE TABLE Clients (
Clients.client_id (INTEGER),
Clients.agency_id (INTEGER),
Clients.sic_code (VARCHAR(10)),
Clients.client_details (VARCHAR(255)),
)
CREATE TABLE Invoices (
Invoices.invoice_id (INTEGER),
Invoices.client_id (INTEGER),
Invoices.invoice_status (VARCHAR(10)),
Invoices.invoice_details (VARCHAR(255)),
)
CREATE TABLE Meetings (
Meetings.meeting_id (INTEGER),
Meetings.client_id (INTEGER),
Meetings.meeting_outcome (VARCHAR(10)),
Meetings.meeting_type (VARCHAR(10)),
Meetings.billable_yn (VARCHAR(1)),
Meetings.start_date_time (DATETIME),
Meetings.end_date_time (DATETIME),
Meetings.purpose_of_meeting (VARCHAR(255)),
Meetings.other_details (VARCHAR(255)),
)
CREATE TABLE Payments (
Payments.payment_id (INTEGER),
Payments.invoice_id (INTEGER),
Payments.payment_details (VARCHAR(255)),
)
CREATE TABLE Staff (
Staff.staff_id (INTEGER),
Staff.agency_id (INTEGER),
Staff.staff_details (VARCHAR(255)),
)
CREATE TABLE Staff_in_Meetings (
Staff_in_Meetings.meeting_id (INTEGER),
Staff_in_Meetings.staff_id (INTEGER),
)
Possible JOINs:
Clients.agency_id = Agencies.agency_id
Invoices.client_id = Clients.client_id
Meetings.client_id = Clients.client_id
Payments.invoice_id = Invoices.invoice_id
Staff_in_Meetings.meeting_id = Meetings.meeting_id
Staff_in_Meetings.staff_id = Staff.staff_id
| Table Agencies (
Agencies.agency_id (INTEGER),
Agencies.agency_details (VARCHAR(255)),
)
Table Clients (
Clients.client_id (INTEGER),
Clients.agency_id (INTEGER),
Clients.sic_code (VARCHAR(10)),
Clients.client_details (VARCHAR(255)),
)
Table Invoices (
Invoices.invoice_id (INTEGER),
Invoices.client_id (INTEGER),
Invoices.invoice_status (VARCHAR(10)),
Invoices.invoice_details (VARCHAR(255)),
)
Table Meetings (
Meetings.meeting_id (INTEGER),
Meetings.client_id (INTEGER),
Meetings.meeting_outcome (VARCHAR(10)),
Meetings.meeting_type (VARCHAR(10)),
Meetings.billable_yn (VARCHAR(1)),
Meetings.start_date_time (DATETIME),
Meetings.end_date_time (DATETIME),
Meetings.purpose_of_meeting (VARCHAR(255)),
Meetings.other_details (VARCHAR(255)),
)
Table Payments (
Payments.payment_id (INTEGER),
Payments.invoice_id (INTEGER),
Payments.payment_details (VARCHAR(255)),
)
Table Staff (
Staff.staff_id (INTEGER),
Staff.agency_id (INTEGER),
Staff.staff_details (VARCHAR(255)),
)
Table Staff_in_Meetings (
Staff_in_Meetings.meeting_id (INTEGER),
Staff_in_Meetings.staff_id (INTEGER),
)
Possible JOINs:
Clients.agency_id = Agencies.agency_id
Invoices.client_id = Clients.client_id
Meetings.client_id = Clients.client_id
Payments.invoice_id = Invoices.invoice_id
Staff_in_Meetings.meeting_id = Meetings.meeting_id
Staff_in_Meetings.staff_id = Staff.staff_id
| CREATE TABLE Agencies (
Agencies.agency_id (INTEGER),
Agencies.agency_details (VARCHAR(255)),
)
CREATE TABLE Clients (
Clients.client_id (INTEGER),
Clients.agency_id (INTEGER),
Clients.sic_code (VARCHAR(10)),
Clients.client_details (VARCHAR(255)),
)
CREATE TABLE Invoices (
Invoices.invoice_id (INTEGER),
Invoices.client_id (INTEGER),
Invoices.invoice_status (VARCHAR(10)),
Invoices.invoice_details (VARCHAR(255)),
)
CREATE TABLE Meetings (
Meetings.meeting_id (INTEGER),
Meetings.client_id (INTEGER),
Meetings.meeting_outcome (VARCHAR(10)),
Meetings.meeting_type (VARCHAR(10)),
Meetings.billable_yn (VARCHAR(1)),
Meetings.start_date_time (DATETIME),
Meetings.end_date_time (DATETIME),
Meetings.purpose_of_meeting (VARCHAR(255)),
Meetings.other_details (VARCHAR(255)),
)
CREATE TABLE Payments (
Payments.payment_id (INTEGER),
Payments.invoice_id (INTEGER),
Payments.payment_details (VARCHAR(255)),
)
CREATE TABLE Staff (
Staff.staff_id (INTEGER),
Staff.agency_id (INTEGER),
Staff.staff_details (VARCHAR(255)),
)
CREATE TABLE Staff_in_Meetings (
Staff_in_Meetings.meeting_id (INTEGER),
Staff_in_Meetings.staff_id (INTEGER),
)
Possible JOINs:
Clients.agency_id = Agencies.agency_id
Invoices.client_id = Clients.client_id
Meetings.client_id = Clients.client_id
Payments.invoice_id = Invoices.invoice_id
Staff_in_Meetings.meeting_id = Meetings.meeting_id
Staff_in_Meetings.staff_id = Staff.staff_id
| Table agencies (
agencies.agency_id (INTEGER),
agencies.agency_details (VARCHAR(255)),
)
Table clients (
clients.client_id (INTEGER),
clients.agency_id (INTEGER),
clients.sic_code (VARCHAR(10)),
clients.client_details (VARCHAR(255)),
)
Table invoices (
invoices.invoice_id (INTEGER),
invoices.client_id (INTEGER),
invoices.invoice_status (VARCHAR(10)),
invoices.invoice_details (VARCHAR(255)),
)
Table meetings (
meetings.meeting_id (INTEGER),
meetings.client_id (INTEGER),
meetings.meeting_outcome (VARCHAR(10)),
meetings.meeting_type (VARCHAR(10)),
meetings.billable_yn (VARCHAR(1)),
meetings.start_date_time (DATETIME),
meetings.end_date_time (DATETIME),
meetings.purpose_of_meeting (VARCHAR(255)),
meetings.other_details (VARCHAR(255)),
)
Table payments (
payments.payment_id (INTEGER),
payments.invoice_id (INTEGER),
payments.payment_details (VARCHAR(255)),
)
Table staff (
staff.staff_id (INTEGER),
staff.agency_id (INTEGER),
staff.staff_details (VARCHAR(255)),
)
Table staff_in_meetings (
staff_in_meetings.meeting_id (INTEGER),
staff_in_meetings.staff_id (INTEGER),
)
Possible JOINs:
clients.agency_id = agencies.agency_id
invoices.client_id = clients.client_id
meetings.client_id = clients.client_id
payments.invoice_id = invoices.invoice_id
staff_in_meetings.meeting_id = meetings.meeting_id
staff_in_meetings.staff_id = staff.staff_id
| CREATE TABLE agencies (
agencies.agency_id (INTEGER),
agencies.agency_details (VARCHAR(255)),
)
CREATE TABLE clients (
clients.client_id (INTEGER),
clients.agency_id (INTEGER),
clients.sic_code (VARCHAR(10)),
clients.client_details (VARCHAR(255)),
)
CREATE TABLE invoices (
invoices.invoice_id (INTEGER),
invoices.client_id (INTEGER),
invoices.invoice_status (VARCHAR(10)),
invoices.invoice_details (VARCHAR(255)),
)
CREATE TABLE meetings (
meetings.meeting_id (INTEGER),
meetings.client_id (INTEGER),
meetings.meeting_outcome (VARCHAR(10)),
meetings.meeting_type (VARCHAR(10)),
meetings.billable_yn (VARCHAR(1)),
meetings.start_date_time (DATETIME),
meetings.end_date_time (DATETIME),
meetings.purpose_of_meeting (VARCHAR(255)),
meetings.other_details (VARCHAR(255)),
)
CREATE TABLE payments (
payments.payment_id (INTEGER),
payments.invoice_id (INTEGER),
payments.payment_details (VARCHAR(255)),
)
CREATE TABLE staff (
staff.staff_id (INTEGER),
staff.agency_id (INTEGER),
staff.staff_details (VARCHAR(255)),
)
CREATE TABLE staff_in_meetings (
staff_in_meetings.meeting_id (INTEGER),
staff_in_meetings.staff_id (INTEGER),
)
Possible JOINs:
clients.agency_id = agencies.agency_id
invoices.client_id = clients.client_id
meetings.client_id = clients.client_id
payments.invoice_id = invoices.invoice_id
staff_in_meetings.meeting_id = meetings.meeting_id
staff_in_meetings.staff_id = staff.staff_id
| {
'Agencies': ['agency_id', 'agency_details'],
'Staff': ['staff_id', 'agency_id', 'staff_details'],
'Clients': ['client_id', 'agency_id', 'sic_code', 'client_details'],
'Invoices': ['invoice_id', 'client_id', 'invoice_status', 'invoice_details'],
'Meetings': ['meeting_id', 'client_id', 'meeting_outcome', 'meeting_type', 'billable_yn', 'start_date_time', 'end_date_time', 'purpose_of_meeting', 'other_details'],
'Payments': ['payment_id', 'invoice_id', 'payment_details'],
'Staff_in_Meetings': ['meeting_id', 'staff_id']
} | {
'Staff_in_Meetings': ['staff_id']
} | TABLE Agencies (
Agencies.agency_id (INTEGER),
Agencies.agency_details (VARCHAR(255)),
)
TABLE Clients (
Clients.client_id (INTEGER),
Clients.agency_id (INTEGER),
Clients.sic_code (VARCHAR(10)),
Clients.client_details (VARCHAR(255)),
)
TABLE Invoices (
Invoices.invoice_id (INTEGER),
Invoices.client_id (INTEGER),
Invoices.invoice_status (VARCHAR(10)),
Invoices.invoice_details (VARCHAR(255)),
)
TABLE Meetings (
Meetings.meeting_id (INTEGER),
Meetings.client_id (INTEGER),
Meetings.meeting_outcome (VARCHAR(10)),
Meetings.meeting_type (VARCHAR(10)),
Meetings.billable_yn (VARCHAR(1)),
Meetings.start_date_time (DATETIME),
Meetings.end_date_time (DATETIME),
Meetings.purpose_of_meeting (VARCHAR(255)),
Meetings.other_details (VARCHAR(255)),
)
TABLE Payments (
Payments.payment_id (INTEGER),
Payments.invoice_id (INTEGER),
Payments.payment_details (VARCHAR(255)),
)
TABLE Staff (
Staff.staff_id (INTEGER),
Staff.agency_id (INTEGER),
Staff.staff_details (VARCHAR(255)),
)
TABLE Staff_in_Meetings (
Staff_in_Meetings.meeting_id (INTEGER),
Staff_in_Meetings.staff_id (INTEGER),
)
Possible JOINs:
Clients.agency_id = Agencies.agency_id
Invoices.client_id = Clients.client_id
Meetings.client_id = Clients.client_id
Payments.invoice_id = Invoices.invoice_id
Staff_in_Meetings.meeting_id = Meetings.meeting_id
Staff_in_Meetings.staff_id = Staff.staff_id
| TABLE Agencies (
Agencies.agency_id (INTEGER),
Agencies.agency_details (VARCHAR(255)),
)
TABLE Clients (
Clients.client_id (INTEGER),
Clients.agency_id (INTEGER),
Clients.sic_code (VARCHAR(10)),
Clients.client_details (VARCHAR(255)),
)
TABLE Invoices (
Invoices.invoice_id (INTEGER),
Invoices.client_id (INTEGER),
Invoices.invoice_status (VARCHAR(10)),
Invoices.invoice_details (VARCHAR(255)),
)
TABLE Meetings (
Meetings.meeting_id (INTEGER),
Meetings.client_id (INTEGER),
Meetings.meeting_outcome (VARCHAR(10)),
Meetings.meeting_type (VARCHAR(10)),
Meetings.billable_yn (VARCHAR(1)),
Meetings.start_date_time (DATETIME),
Meetings.end_date_time (DATETIME),
Meetings.purpose_of_meeting (VARCHAR(255)),
Meetings.other_details (VARCHAR(255)),
)
TABLE Payments (
Payments.payment_id (INTEGER),
Payments.invoice_id (INTEGER),
Payments.payment_details (VARCHAR(255)),
)
TABLE Staff (
Staff.staff_id (INTEGER),
Staff.agency_id (INTEGER),
Staff.staff_details (VARCHAR(255)),
)
TABLE Staff_in_Meetings (
Staff_in_Meetings.meeting_id (INTEGER),
Staff_in_Meetings.staff_id (INTEGER),
)
Possible JOINs:
Clients.agency_id = Agencies.agency_id
Invoices.client_id = Clients.client_id
Meetings.client_id = Clients.client_id
Payments.invoice_id = Invoices.invoice_id
Staff_in_Meetings.meeting_id = Meetings.meeting_id
Staff_in_Meetings.staff_id = Staff.staff_id
| TABLE agencies (
agencies.agency_id (INTEGER),
agencies.agency_details (VARCHAR(255)),
)
TABLE clients (
clients.client_id (INTEGER),
clients.agency_id (INTEGER),
clients.sic_code (VARCHAR(10)),
clients.client_details (VARCHAR(255)),
)
TABLE invoices (
invoices.invoice_id (INTEGER),
invoices.client_id (INTEGER),
invoices.invoice_status (VARCHAR(10)),
invoices.invoice_details (VARCHAR(255)),
)
TABLE meetings (
meetings.meeting_id (INTEGER),
meetings.client_id (INTEGER),
meetings.meeting_outcome (VARCHAR(10)),
meetings.meeting_type (VARCHAR(10)),
meetings.billable_yn (VARCHAR(1)),
meetings.start_date_time (DATETIME),
meetings.end_date_time (DATETIME),
meetings.purpose_of_meeting (VARCHAR(255)),
meetings.other_details (VARCHAR(255)),
)
TABLE payments (
payments.payment_id (INTEGER),
payments.invoice_id (INTEGER),
payments.payment_details (VARCHAR(255)),
)
TABLE staff (
staff.staff_id (INTEGER),
staff.agency_id (INTEGER),
staff.staff_details (VARCHAR(255)),
)
TABLE staff_in_meetings (
staff_in_meetings.meeting_id (INTEGER),
staff_in_meetings.staff_id (INTEGER),
)
Possible JOINs:
clients.agency_id = agencies.agency_id
invoices.client_id = clients.client_id
meetings.client_id = clients.client_id
payments.invoice_id = invoices.invoice_id
staff_in_meetings.meeting_id = meetings.meeting_id
staff_in_meetings.staff_id = staff.staff_id
|
address_1 |
CREATE TABLE "City" (
city_code VARCHAR(3),
city_name VARCHAR(25),
state VARCHAR(2),
country VARCHAR(25),
latitude FLOAT,
longitude FLOAT,
PRIMARY KEY (city_code)
)
CREATE TABLE "Direct_distance" (
city1_code VARCHAR(3),
city2_code VARCHAR(3),
distance INTEGER,
FOREIGN KEY(city1_code) REFERENCES "City" (city_code),
FOREIGN KEY(city2_code) REFERENCES "City" (city_code)
)
CREATE TABLE "Student" (
"StuID" INTEGER,
"LName" VARCHAR(12),
"Fname" VARCHAR(12),
"Age" INTEGER,
"Sex" VARCHAR(1),
"Major" INTEGER,
"Advisor" INTEGER,
city_code VARCHAR(3),
PRIMARY KEY ("StuID"),
FOREIGN KEY(city_code) REFERENCES "City" (city_code)
) | What are the city codes corresponding to cities with distances less than 1000? | medium | Table City (
City.city_code (VARCHAR(3)),
City.city_name (VARCHAR(25)),
City.state (VARCHAR(2)),
City.country (VARCHAR(25)),
City.latitude (FLOAT),
City.longitude (FLOAT),
)
Table Direct_distance (
Direct_distance.city1_code (varchar(3)),
Direct_distance.city2_code (varchar(3)),
Direct_distance.distance (INTEGER),
)
Table Student (
Student.StuID (INTEGER),
Student.LName (VARCHAR(12)),
Student.Fname (VARCHAR(12)),
Student.Age (INTEGER),
Student.Sex (VARCHAR(1)),
Student.Major (INTEGER),
Student.Advisor (INTEGER),
Student.city_code (VARCHAR(3)),
)
Possible JOINs:
Direct_distance.city1_code = City.city_code
Direct_distance.city2_code = City.city_code
Student.city_code = City.city_code
| SELECT city1_code , city2_code FROM Direct_distance WHERE distance < 1000 | {
'direct_distance': ['city1_code', 'city2_code', 'distance']
} | CREATE TABLE City (
City.city_code (VARCHAR(3)),
City.city_name (VARCHAR(25)),
City.state (VARCHAR(2)),
City.country (VARCHAR(25)),
City.latitude (FLOAT),
City.longitude (FLOAT),
)
CREATE TABLE Direct_distance (
Direct_distance.city1_code (varchar(3)),
Direct_distance.city2_code (varchar(3)),
Direct_distance.distance (INTEGER),
)
CREATE TABLE Student (
Student.StuID (INTEGER),
Student.LName (VARCHAR(12)),
Student.Fname (VARCHAR(12)),
Student.Age (INTEGER),
Student.Sex (VARCHAR(1)),
Student.Major (INTEGER),
Student.Advisor (INTEGER),
Student.city_code (VARCHAR(3)),
)
Possible JOINs:
Direct_distance.city1_code = City.city_code
Direct_distance.city2_code = City.city_code
Student.city_code = City.city_code
| Table City (
City.city_code (VARCHAR(3)),
City.city_name (VARCHAR(25)),
City.state (VARCHAR(2)),
City.country (VARCHAR(25)),
City.latitude (FLOAT),
City.longitude (FLOAT),
)
Table Direct_distance (
Direct_distance.city1_code (varchar(3)),
Direct_distance.city2_code (varchar(3)),
Direct_distance.distance (INTEGER),
)
Table Student (
Student.stuid (INTEGER),
Student.lname (VARCHAR(12)),
Student.fname (VARCHAR(12)),
Student.age (INTEGER),
Student.sex (VARCHAR(1)),
Student.major (INTEGER),
Student.advisor (INTEGER),
Student.city_code (VARCHAR(3)),
)
Possible JOINs:
Direct_distance.city1_code = City.city_code
Direct_distance.city2_code = City.city_code
Student.city_code = City.city_code
| CREATE TABLE City (
City.city_code (VARCHAR(3)),
City.city_name (VARCHAR(25)),
City.state (VARCHAR(2)),
City.country (VARCHAR(25)),
City.latitude (FLOAT),
City.longitude (FLOAT),
)
CREATE TABLE Direct_distance (
Direct_distance.city1_code (varchar(3)),
Direct_distance.city2_code (varchar(3)),
Direct_distance.distance (INTEGER),
)
CREATE TABLE Student (
Student.stuid (INTEGER),
Student.lname (VARCHAR(12)),
Student.fname (VARCHAR(12)),
Student.age (INTEGER),
Student.sex (VARCHAR(1)),
Student.major (INTEGER),
Student.advisor (INTEGER),
Student.city_code (VARCHAR(3)),
)
Possible JOINs:
Direct_distance.city1_code = City.city_code
Direct_distance.city2_code = City.city_code
Student.city_code = City.city_code
| Table city (
city.city_code (VARCHAR(3)),
city.city_name (VARCHAR(25)),
city.state (VARCHAR(2)),
city.country (VARCHAR(25)),
city.latitude (FLOAT),
city.longitude (FLOAT),
)
Table direct_distance (
direct_distance.city1_code (varchar(3)),
direct_distance.city2_code (varchar(3)),
direct_distance.distance (INTEGER),
)
Table student (
student.stuid (INTEGER),
student.lname (VARCHAR(12)),
student.fname (VARCHAR(12)),
student.age (INTEGER),
student.sex (VARCHAR(1)),
student.major (INTEGER),
student.advisor (INTEGER),
student.city_code (VARCHAR(3)),
)
Possible JOINs:
direct_distance.city1_code = city.city_code
direct_distance.city2_code = city.city_code
student.city_code = city.city_code
| CREATE TABLE city (
city.city_code (VARCHAR(3)),
city.city_name (VARCHAR(25)),
city.state (VARCHAR(2)),
city.country (VARCHAR(25)),
city.latitude (FLOAT),
city.longitude (FLOAT),
)
CREATE TABLE direct_distance (
direct_distance.city1_code (varchar(3)),
direct_distance.city2_code (varchar(3)),
direct_distance.distance (INTEGER),
)
CREATE TABLE student (
student.stuid (INTEGER),
student.lname (VARCHAR(12)),
student.fname (VARCHAR(12)),
student.age (INTEGER),
student.sex (VARCHAR(1)),
student.major (INTEGER),
student.advisor (INTEGER),
student.city_code (VARCHAR(3)),
)
Possible JOINs:
direct_distance.city1_code = city.city_code
direct_distance.city2_code = city.city_code
student.city_code = city.city_code
| {
'Student': ['StuID', 'LName', 'Fname', 'Age', 'Sex', 'Major', 'Advisor', 'city_code'],
'Direct_distance': ['city1_code', 'city2_code', 'distance'],
'City': ['city_code', 'city_name', 'state', 'country', 'latitude', 'longitude']
} | {
'Direct_distance': ['city1_code', 'city2_code', 'distance']
} | TABLE City (
City.city_code (VARCHAR(3)),
City.city_name (VARCHAR(25)),
City.state (VARCHAR(2)),
City.country (VARCHAR(25)),
City.latitude (FLOAT),
City.longitude (FLOAT),
)
TABLE Direct_distance (
Direct_distance.city1_code (varchar(3)),
Direct_distance.city2_code (varchar(3)),
Direct_distance.distance (INTEGER),
)
TABLE Student (
Student.StuID (INTEGER),
Student.LName (VARCHAR(12)),
Student.Fname (VARCHAR(12)),
Student.Age (INTEGER),
Student.Sex (VARCHAR(1)),
Student.Major (INTEGER),
Student.Advisor (INTEGER),
Student.city_code (VARCHAR(3)),
)
Possible JOINs:
Direct_distance.city1_code = City.city_code
Direct_distance.city2_code = City.city_code
Student.city_code = City.city_code
| TABLE City (
City.city_code (VARCHAR(3)),
City.city_name (VARCHAR(25)),
City.state (VARCHAR(2)),
City.country (VARCHAR(25)),
City.latitude (FLOAT),
City.longitude (FLOAT),
)
TABLE Direct_distance (
Direct_distance.city1_code (varchar(3)),
Direct_distance.city2_code (varchar(3)),
Direct_distance.distance (INTEGER),
)
TABLE Student (
Student.stuid (INTEGER),
Student.lname (VARCHAR(12)),
Student.fname (VARCHAR(12)),
Student.age (INTEGER),
Student.sex (VARCHAR(1)),
Student.major (INTEGER),
Student.advisor (INTEGER),
Student.city_code (VARCHAR(3)),
)
Possible JOINs:
Direct_distance.city1_code = City.city_code
Direct_distance.city2_code = City.city_code
Student.city_code = City.city_code
| TABLE city (
city.city_code (VARCHAR(3)),
city.city_name (VARCHAR(25)),
city.state (VARCHAR(2)),
city.country (VARCHAR(25)),
city.latitude (FLOAT),
city.longitude (FLOAT),
)
TABLE direct_distance (
direct_distance.city1_code (varchar(3)),
direct_distance.city2_code (varchar(3)),
direct_distance.distance (INTEGER),
)
TABLE student (
student.stuid (INTEGER),
student.lname (VARCHAR(12)),
student.fname (VARCHAR(12)),
student.age (INTEGER),
student.sex (VARCHAR(1)),
student.major (INTEGER),
student.advisor (INTEGER),
student.city_code (VARCHAR(3)),
)
Possible JOINs:
direct_distance.city1_code = city.city_code
direct_distance.city2_code = city.city_code
student.city_code = city.city_code
|
art_1 |
CREATE TABLE "Artists" (
"artistID" INTEGER,
lname TEXT,
fname TEXT,
"birthYear" INTEGER,
"deathYear" INTEGER,
PRIMARY KEY ("artistID")
)
CREATE TABLE "Paintings" (
"paintingID" INTEGER,
title TEXT,
year INTEGER,
height_mm INTEGER,
width_mm INTEGER,
medium TEXT,
"mediumOn" TEXT,
location TEXT,
"painterID" INTEGER,
PRIMARY KEY ("paintingID"),
FOREIGN KEY("painterID") REFERENCES "Artists" ("artistID")
)
CREATE TABLE "Sculptures" (
"sculptureID" INTEGER,
title TEXT,
year INTEGER,
medium TEXT,
location TEXT,
"sculptorID" INTEGER,
PRIMARY KEY ("sculptureID"),
FOREIGN KEY("sculptorID") REFERENCES "Artists" ("artistID")
) | List the year, location and title of paintings whose height is longer than 1000 ordered by title. | medium | Table Artists (
Artists.artistID (INTEGER),
Artists.lname (TEXT),
Artists.fname (TEXT),
Artists.birthYear (INTEGER),
Artists.deathYear (INTEGER),
)
Table Paintings (
Paintings.paintingID (INTEGER),
Paintings.title (TEXT),
Paintings.year (INTEGER),
Paintings.height_mm (INTEGER),
Paintings.width_mm (INTEGER),
Paintings.medium (TEXT),
Paintings.mediumOn (TEXT),
Paintings.location (TEXT),
Paintings.painterID (INTEGER),
)
Table Sculptures (
Sculptures.sculptureID (INTEGER),
Sculptures.title (TEXT),
Sculptures.year (INTEGER),
Sculptures.medium (TEXT),
Sculptures.location (TEXT),
Sculptures.sculptorID (INTEGER),
)
Possible JOINs:
Paintings.painterID = Artists.artistID
Sculptures.sculptorID = Artists.artistID
| SELECT title , LOCATION , YEAR FROM paintings WHERE height_mm > 1000 ORDER BY title | {
'paintings': ['paintingid', 'title', 'year', 'height_mm', 'location']
} | CREATE TABLE Artists (
Artists.artistID (INTEGER),
Artists.lname (TEXT),
Artists.fname (TEXT),
Artists.birthYear (INTEGER),
Artists.deathYear (INTEGER),
)
CREATE TABLE Paintings (
Paintings.paintingID (INTEGER),
Paintings.title (TEXT),
Paintings.year (INTEGER),
Paintings.height_mm (INTEGER),
Paintings.width_mm (INTEGER),
Paintings.medium (TEXT),
Paintings.mediumOn (TEXT),
Paintings.location (TEXT),
Paintings.painterID (INTEGER),
)
CREATE TABLE Sculptures (
Sculptures.sculptureID (INTEGER),
Sculptures.title (TEXT),
Sculptures.year (INTEGER),
Sculptures.medium (TEXT),
Sculptures.location (TEXT),
Sculptures.sculptorID (INTEGER),
)
Possible JOINs:
Paintings.painterID = Artists.artistID
Sculptures.sculptorID = Artists.artistID
| Table Artists (
Artists.artistid (INTEGER),
Artists.lname (TEXT),
Artists.fname (TEXT),
Artists.birthyear (INTEGER),
Artists.deathyear (INTEGER),
)
Table Paintings (
Paintings.paintingid (INTEGER),
Paintings.title (TEXT),
Paintings.year (INTEGER),
Paintings.height_mm (INTEGER),
Paintings.width_mm (INTEGER),
Paintings.medium (TEXT),
Paintings.mediumon (TEXT),
Paintings.location (TEXT),
Paintings.painterid (INTEGER),
)
Table Sculptures (
Sculptures.sculptureid (INTEGER),
Sculptures.title (TEXT),
Sculptures.year (INTEGER),
Sculptures.medium (TEXT),
Sculptures.location (TEXT),
Sculptures.sculptorid (INTEGER),
)
Possible JOINs:
Paintings.painterid = Artists.artistid
Sculptures.sculptorid = Artists.artistid
| CREATE TABLE Artists (
Artists.artistid (INTEGER),
Artists.lname (TEXT),
Artists.fname (TEXT),
Artists.birthyear (INTEGER),
Artists.deathyear (INTEGER),
)
CREATE TABLE Paintings (
Paintings.paintingid (INTEGER),
Paintings.title (TEXT),
Paintings.year (INTEGER),
Paintings.height_mm (INTEGER),
Paintings.width_mm (INTEGER),
Paintings.medium (TEXT),
Paintings.mediumon (TEXT),
Paintings.location (TEXT),
Paintings.painterid (INTEGER),
)
CREATE TABLE Sculptures (
Sculptures.sculptureid (INTEGER),
Sculptures.title (TEXT),
Sculptures.year (INTEGER),
Sculptures.medium (TEXT),
Sculptures.location (TEXT),
Sculptures.sculptorid (INTEGER),
)
Possible JOINs:
Paintings.painterid = Artists.artistid
Sculptures.sculptorid = Artists.artistid
| Table artists (
artists.artistid (INTEGER),
artists.lname (TEXT),
artists.fname (TEXT),
artists.birthyear (INTEGER),
artists.deathyear (INTEGER),
)
Table paintings (
paintings.paintingid (INTEGER),
paintings.title (TEXT),
paintings.year (INTEGER),
paintings.height_mm (INTEGER),
paintings.width_mm (INTEGER),
paintings.medium (TEXT),
paintings.mediumon (TEXT),
paintings.location (TEXT),
paintings.painterid (INTEGER),
)
Table sculptures (
sculptures.sculptureid (INTEGER),
sculptures.title (TEXT),
sculptures.year (INTEGER),
sculptures.medium (TEXT),
sculptures.location (TEXT),
sculptures.sculptorid (INTEGER),
)
Possible JOINs:
paintings.painterid = artists.artistid
sculptures.sculptorid = artists.artistid
| CREATE TABLE artists (
artists.artistid (INTEGER),
artists.lname (TEXT),
artists.fname (TEXT),
artists.birthyear (INTEGER),
artists.deathyear (INTEGER),
)
CREATE TABLE paintings (
paintings.paintingid (INTEGER),
paintings.title (TEXT),
paintings.year (INTEGER),
paintings.height_mm (INTEGER),
paintings.width_mm (INTEGER),
paintings.medium (TEXT),
paintings.mediumon (TEXT),
paintings.location (TEXT),
paintings.painterid (INTEGER),
)
CREATE TABLE sculptures (
sculptures.sculptureid (INTEGER),
sculptures.title (TEXT),
sculptures.year (INTEGER),
sculptures.medium (TEXT),
sculptures.location (TEXT),
sculptures.sculptorid (INTEGER),
)
Possible JOINs:
paintings.painterid = artists.artistid
sculptures.sculptorid = artists.artistid
| {
'Artists': ['artistID', 'lname', 'fname', 'birthYear', 'deathYear'],
'Paintings': ['paintingID', 'title', 'year', 'height_mm', 'width_mm', 'medium', 'mediumOn', 'location', 'painterID'],
'Sculptures': ['sculptureID', 'title', 'year', 'medium', 'location', 'sculptorID']
} | {
'Paintings': ['paintingID', 'title', 'year', 'height_mm', 'location']
} | TABLE Artists (
Artists.artistID (INTEGER),
Artists.lname (TEXT),
Artists.fname (TEXT),
Artists.birthYear (INTEGER),
Artists.deathYear (INTEGER),
)
TABLE Paintings (
Paintings.paintingID (INTEGER),
Paintings.title (TEXT),
Paintings.year (INTEGER),
Paintings.height_mm (INTEGER),
Paintings.width_mm (INTEGER),
Paintings.medium (TEXT),
Paintings.mediumOn (TEXT),
Paintings.location (TEXT),
Paintings.painterID (INTEGER),
)
TABLE Sculptures (
Sculptures.sculptureID (INTEGER),
Sculptures.title (TEXT),
Sculptures.year (INTEGER),
Sculptures.medium (TEXT),
Sculptures.location (TEXT),
Sculptures.sculptorID (INTEGER),
)
Possible JOINs:
Paintings.painterID = Artists.artistID
Sculptures.sculptorID = Artists.artistID
| TABLE Artists (
Artists.artistid (INTEGER),
Artists.lname (TEXT),
Artists.fname (TEXT),
Artists.birthyear (INTEGER),
Artists.deathyear (INTEGER),
)
TABLE Paintings (
Paintings.paintingid (INTEGER),
Paintings.title (TEXT),
Paintings.year (INTEGER),
Paintings.height_mm (INTEGER),
Paintings.width_mm (INTEGER),
Paintings.medium (TEXT),
Paintings.mediumon (TEXT),
Paintings.location (TEXT),
Paintings.painterid (INTEGER),
)
TABLE Sculptures (
Sculptures.sculptureid (INTEGER),
Sculptures.title (TEXT),
Sculptures.year (INTEGER),
Sculptures.medium (TEXT),
Sculptures.location (TEXT),
Sculptures.sculptorid (INTEGER),
)
Possible JOINs:
Paintings.painterid = Artists.artistid
Sculptures.sculptorid = Artists.artistid
| TABLE artists (
artists.artistid (INTEGER),
artists.lname (TEXT),
artists.fname (TEXT),
artists.birthyear (INTEGER),
artists.deathyear (INTEGER),
)
TABLE paintings (
paintings.paintingid (INTEGER),
paintings.title (TEXT),
paintings.year (INTEGER),
paintings.height_mm (INTEGER),
paintings.width_mm (INTEGER),
paintings.medium (TEXT),
paintings.mediumon (TEXT),
paintings.location (TEXT),
paintings.painterid (INTEGER),
)
TABLE sculptures (
sculptures.sculptureid (INTEGER),
sculptures.title (TEXT),
sculptures.year (INTEGER),
sculptures.medium (TEXT),
sculptures.location (TEXT),
sculptures.sculptorid (INTEGER),
)
Possible JOINs:
paintings.painterid = artists.artistid
sculptures.sculptorid = artists.artistid
|
pilot_1 |
CREATE TABLE "Hangar" (
plane_name CHAR(15) NOT NULL,
location CHAR(15),
PRIMARY KEY (plane_name)
)
CREATE TABLE "PilotSkills" (
pilot_name CHAR(15) NOT NULL,
plane_name CHAR(15) NOT NULL,
age INTEGER,
PRIMARY KEY (pilot_name, plane_name),
FOREIGN KEY(plane_name) REFERENCES "Hangar" (plane_name)
) | Find the max age for each group of pilots with the same name. | medium | Table Hangar (
Hangar.plane_name (CHAR(15)),
Hangar.location (CHAR(15)),
)
Table PilotSkills (
PilotSkills.pilot_name (CHAR(15)),
PilotSkills.plane_name (CHAR(15)),
PilotSkills.age (INTEGER),
)
Possible JOINs:
PilotSkills.plane_name = Hangar.plane_name
| SELECT max(age) , pilot_name FROM pilotskills GROUP BY pilot_name | {
'pilotskills': ['pilot_name', 'age']
} | CREATE TABLE Hangar (
Hangar.plane_name (CHAR(15)),
Hangar.location (CHAR(15)),
)
CREATE TABLE PilotSkills (
PilotSkills.pilot_name (CHAR(15)),
PilotSkills.plane_name (CHAR(15)),
PilotSkills.age (INTEGER),
)
Possible JOINs:
PilotSkills.plane_name = Hangar.plane_name
| Table Hangar (
Hangar.plane_name (CHAR(15)),
Hangar.location (CHAR(15)),
)
Table PilotSkills (
PilotSkills.pilot_name (CHAR(15)),
PilotSkills.plane_name (CHAR(15)),
PilotSkills.age (INTEGER),
)
Possible JOINs:
PilotSkills.plane_name = Hangar.plane_name
| CREATE TABLE Hangar (
Hangar.plane_name (CHAR(15)),
Hangar.location (CHAR(15)),
)
CREATE TABLE PilotSkills (
PilotSkills.pilot_name (CHAR(15)),
PilotSkills.plane_name (CHAR(15)),
PilotSkills.age (INTEGER),
)
Possible JOINs:
PilotSkills.plane_name = Hangar.plane_name
| Table hangar (
hangar.plane_name (CHAR(15)),
hangar.location (CHAR(15)),
)
Table pilotskills (
pilotskills.pilot_name (CHAR(15)),
pilotskills.plane_name (CHAR(15)),
pilotskills.age (INTEGER),
)
Possible JOINs:
pilotskills.plane_name = hangar.plane_name
| CREATE TABLE hangar (
hangar.plane_name (CHAR(15)),
hangar.location (CHAR(15)),
)
CREATE TABLE pilotskills (
pilotskills.pilot_name (CHAR(15)),
pilotskills.plane_name (CHAR(15)),
pilotskills.age (INTEGER),
)
Possible JOINs:
pilotskills.plane_name = hangar.plane_name
| {
'PilotSkills': ['pilot_name', 'plane_name', 'age'],
'Hangar': ['plane_name', 'location']
} | {
'PilotSkills': ['pilot_name', 'age']
} | TABLE Hangar (
Hangar.plane_name (CHAR(15)),
Hangar.location (CHAR(15)),
)
TABLE PilotSkills (
PilotSkills.pilot_name (CHAR(15)),
PilotSkills.plane_name (CHAR(15)),
PilotSkills.age (INTEGER),
)
Possible JOINs:
PilotSkills.plane_name = Hangar.plane_name
| TABLE Hangar (
Hangar.plane_name (CHAR(15)),
Hangar.location (CHAR(15)),
)
TABLE PilotSkills (
PilotSkills.pilot_name (CHAR(15)),
PilotSkills.plane_name (CHAR(15)),
PilotSkills.age (INTEGER),
)
Possible JOINs:
PilotSkills.plane_name = Hangar.plane_name
| TABLE hangar (
hangar.plane_name (CHAR(15)),
hangar.location (CHAR(15)),
)
TABLE pilotskills (
pilotskills.pilot_name (CHAR(15)),
pilotskills.plane_name (CHAR(15)),
pilotskills.age (INTEGER),
)
Possible JOINs:
pilotskills.plane_name = hangar.plane_name
|
pilot_1 |
CREATE TABLE "Hangar" (
plane_name CHAR(15) NOT NULL,
location CHAR(15),
PRIMARY KEY (plane_name)
)
CREATE TABLE "PilotSkills" (
pilot_name CHAR(15) NOT NULL,
plane_name CHAR(15) NOT NULL,
age INTEGER,
PRIMARY KEY (pilot_name, plane_name),
FOREIGN KEY(plane_name) REFERENCES "Hangar" (plane_name)
) | What are the names of planes that the pilot Jones who is 32 has? | medium | Table Hangar (
Hangar.plane_name (CHAR(15)),
Hangar.location (CHAR(15)),
)
Table PilotSkills (
PilotSkills.pilot_name (CHAR(15)),
PilotSkills.plane_name (CHAR(15)),
PilotSkills.age (INTEGER),
)
Possible JOINs:
PilotSkills.plane_name = Hangar.plane_name
| SELECT plane_name FROM pilotskills WHERE pilot_name = 'Jones' AND age = 32 | {
'pilotskills': ['pilot_name', 'plane_name', 'age']
} | CREATE TABLE Hangar (
Hangar.plane_name (CHAR(15)),
Hangar.location (CHAR(15)),
)
CREATE TABLE PilotSkills (
PilotSkills.pilot_name (CHAR(15)),
PilotSkills.plane_name (CHAR(15)),
PilotSkills.age (INTEGER),
)
Possible JOINs:
PilotSkills.plane_name = Hangar.plane_name
| Table Hangar (
Hangar.plane_name (CHAR(15)),
Hangar.location (CHAR(15)),
)
Table PilotSkills (
PilotSkills.pilot_name (CHAR(15)),
PilotSkills.plane_name (CHAR(15)),
PilotSkills.age (INTEGER),
)
Possible JOINs:
PilotSkills.plane_name = Hangar.plane_name
| CREATE TABLE Hangar (
Hangar.plane_name (CHAR(15)),
Hangar.location (CHAR(15)),
)
CREATE TABLE PilotSkills (
PilotSkills.pilot_name (CHAR(15)),
PilotSkills.plane_name (CHAR(15)),
PilotSkills.age (INTEGER),
)
Possible JOINs:
PilotSkills.plane_name = Hangar.plane_name
| Table hangar (
hangar.plane_name (CHAR(15)),
hangar.location (CHAR(15)),
)
Table pilotskills (
pilotskills.pilot_name (CHAR(15)),
pilotskills.plane_name (CHAR(15)),
pilotskills.age (INTEGER),
)
Possible JOINs:
pilotskills.plane_name = hangar.plane_name
| CREATE TABLE hangar (
hangar.plane_name (CHAR(15)),
hangar.location (CHAR(15)),
)
CREATE TABLE pilotskills (
pilotskills.pilot_name (CHAR(15)),
pilotskills.plane_name (CHAR(15)),
pilotskills.age (INTEGER),
)
Possible JOINs:
pilotskills.plane_name = hangar.plane_name
| {
'PilotSkills': ['pilot_name', 'plane_name', 'age'],
'Hangar': ['plane_name', 'location']
} | {
'PilotSkills': ['pilot_name', 'plane_name', 'age']
} | TABLE Hangar (
Hangar.plane_name (CHAR(15)),
Hangar.location (CHAR(15)),
)
TABLE PilotSkills (
PilotSkills.pilot_name (CHAR(15)),
PilotSkills.plane_name (CHAR(15)),
PilotSkills.age (INTEGER),
)
Possible JOINs:
PilotSkills.plane_name = Hangar.plane_name
| TABLE Hangar (
Hangar.plane_name (CHAR(15)),
Hangar.location (CHAR(15)),
)
TABLE PilotSkills (
PilotSkills.pilot_name (CHAR(15)),
PilotSkills.plane_name (CHAR(15)),
PilotSkills.age (INTEGER),
)
Possible JOINs:
PilotSkills.plane_name = Hangar.plane_name
| TABLE hangar (
hangar.plane_name (CHAR(15)),
hangar.location (CHAR(15)),
)
TABLE pilotskills (
pilotskills.pilot_name (CHAR(15)),
pilotskills.plane_name (CHAR(15)),
pilotskills.age (INTEGER),
)
Possible JOINs:
pilotskills.plane_name = hangar.plane_name
|
car_racing |
CREATE TABLE "country" (
"Country_Id" int,
"Country" text,
"Capital" text,
"Official_native_language" text,
"Regoin" text,
PRIMARY KEY ("Country_Id")
)
/*
0 rows from country table:
Country_Id Country Capital Official_native_language Regoin
*/
CREATE TABLE `team` (
"Team_ID" int,
"Team" text,
"Make" text,
"Manager" text,
"Sponsor" text,
"Car_Owner" text,
PRIMARY KEY ("Team_ID")
)
/*
0 rows from team table:
Team_ID Team Make Manager Sponsor Car_Owner
*/
CREATE TABLE `driver` (
"Driver_ID" int,
"Driver" text,
"Country" int,
"Age" int,
"Car_#" real,
"Make" text,
"Points" text,
"Laps" real,
"Winnings" text,
PRIMARY KEY ("Driver_ID"),
FOREIGN KEY (`Country`) REFERENCES `country`(`Country_ID`)
)
/*
0 rows from driver table:
Driver_ID Driver Country Age Car_# Make Points Laps Winnings
*/
CREATE TABLE `team_driver` (
"Team_ID" int,
"Driver_ID" int,
PRIMARY KEY ("Team_ID","Driver_ID"),
FOREIGN KEY (`Team_ID`) REFERENCES `team`(`Team_ID`),
FOREIGN KEY (`Driver_ID`) REFERENCES `driver`(`Driver_ID`)
)
/*
0 rows from team_driver table:
Team_ID Driver_ID
*/
| List all the driver names in ascending order of age. | easy | Table country (
country.Country_Id (INT),
country.Country (TEXT),
country.Capital (TEXT),
country.Official_native_language (TEXT),
country.Regoin (TEXT),
)
Table driver (
driver.Driver_ID (INT),
driver.Driver (TEXT),
driver.Country (INT),
driver.Age (INT),
driver.Car_# (REAL),
driver.Make (TEXT),
driver.Points (TEXT),
driver.Laps (REAL),
driver.Winnings (TEXT),
)
Table team (
team.Team_ID (INT),
team.Team (TEXT),
team.Make (TEXT),
team.Manager (TEXT),
team.Sponsor (TEXT),
team.Car_Owner (TEXT),
)
Table team_driver (
team_driver.Team_ID (INT),
team_driver.Driver_ID (INT),
)
Possible JOINs:
driver.Country = country.Country_ID
team_driver.Team_ID = team.Team_ID
team_driver.Driver_ID = driver.Driver_ID
| SELECT Driver FROM driver ORDER BY Age ASC | {
'driver': ['driver_id', 'driver', 'age']
} | CREATE TABLE country (
country.Country_Id (INT),
country.Country (TEXT),
country.Capital (TEXT),
country.Official_native_language (TEXT),
country.Regoin (TEXT),
)
CREATE TABLE driver (
driver.Driver_ID (INT),
driver.Driver (TEXT),
driver.Country (INT),
driver.Age (INT),
driver.Car_# (REAL),
driver.Make (TEXT),
driver.Points (TEXT),
driver.Laps (REAL),
driver.Winnings (TEXT),
)
CREATE TABLE team (
team.Team_ID (INT),
team.Team (TEXT),
team.Make (TEXT),
team.Manager (TEXT),
team.Sponsor (TEXT),
team.Car_Owner (TEXT),
)
CREATE TABLE team_driver (
team_driver.Team_ID (INT),
team_driver.Driver_ID (INT),
)
Possible JOINs:
driver.Country = country.Country_ID
team_driver.Team_ID = team.Team_ID
team_driver.Driver_ID = driver.Driver_ID
| Table country (
country.country_id (INT),
country.country (TEXT),
country.capital (TEXT),
country.official_native_language (TEXT),
country.regoin (TEXT),
)
Table driver (
driver.driver_id (INT),
driver.driver (TEXT),
driver.country (INT),
driver.age (INT),
driver.car_# (REAL),
driver.make (TEXT),
driver.points (TEXT),
driver.laps (REAL),
driver.winnings (TEXT),
)
Table team (
team.team_id (INT),
team.team (TEXT),
team.make (TEXT),
team.manager (TEXT),
team.sponsor (TEXT),
team.car_owner (TEXT),
)
Table team_driver (
team_driver.team_id (INT),
team_driver.driver_id (INT),
)
Possible JOINs:
driver.country = country.country_id
team_driver.team_id = team.team_id
team_driver.driver_id = driver.driver_id
| CREATE TABLE country (
country.country_id (INT),
country.country (TEXT),
country.capital (TEXT),
country.official_native_language (TEXT),
country.regoin (TEXT),
)
CREATE TABLE driver (
driver.driver_id (INT),
driver.driver (TEXT),
driver.country (INT),
driver.age (INT),
driver.car_# (REAL),
driver.make (TEXT),
driver.points (TEXT),
driver.laps (REAL),
driver.winnings (TEXT),
)
CREATE TABLE team (
team.team_id (INT),
team.team (TEXT),
team.make (TEXT),
team.manager (TEXT),
team.sponsor (TEXT),
team.car_owner (TEXT),
)
CREATE TABLE team_driver (
team_driver.team_id (INT),
team_driver.driver_id (INT),
)
Possible JOINs:
driver.country = country.country_id
team_driver.team_id = team.team_id
team_driver.driver_id = driver.driver_id
| Table country (
country.country_id (INT),
country.country (TEXT),
country.capital (TEXT),
country.official_native_language (TEXT),
country.regoin (TEXT),
)
Table driver (
driver.driver_id (INT),
driver.driver (TEXT),
driver.country (INT),
driver.age (INT),
driver.car_# (REAL),
driver.make (TEXT),
driver.points (TEXT),
driver.laps (REAL),
driver.winnings (TEXT),
)
Table team (
team.team_id (INT),
team.team (TEXT),
team.make (TEXT),
team.manager (TEXT),
team.sponsor (TEXT),
team.car_owner (TEXT),
)
Table team_driver (
team_driver.team_id (INT),
team_driver.driver_id (INT),
)
Possible JOINs:
driver.country = country.country_id
team_driver.team_id = team.team_id
team_driver.driver_id = driver.driver_id
| CREATE TABLE country (
country.country_id (INT),
country.country (TEXT),
country.capital (TEXT),
country.official_native_language (TEXT),
country.regoin (TEXT),
)
CREATE TABLE driver (
driver.driver_id (INT),
driver.driver (TEXT),
driver.country (INT),
driver.age (INT),
driver.car_# (REAL),
driver.make (TEXT),
driver.points (TEXT),
driver.laps (REAL),
driver.winnings (TEXT),
)
CREATE TABLE team (
team.team_id (INT),
team.team (TEXT),
team.make (TEXT),
team.manager (TEXT),
team.sponsor (TEXT),
team.car_owner (TEXT),
)
CREATE TABLE team_driver (
team_driver.team_id (INT),
team_driver.driver_id (INT),
)
Possible JOINs:
driver.country = country.country_id
team_driver.team_id = team.team_id
team_driver.driver_id = driver.driver_id
| {
'country': ['Country_Id', 'Country', 'Capital', 'Official_native_language', 'Regoin'],
'team': ['Team_ID', 'Team', 'Make', 'Manager', 'Sponsor', 'Car_Owner'],
'driver': ['Driver_ID', 'Driver', 'Country', 'Age', 'Car_#', 'Make', 'Points', 'Laps', 'Winnings'],
'team_driver': ['Team_ID', 'Driver_ID']
} | {
'driver': ['Driver_ID', 'Driver', 'Age']
} | TABLE country (
country.Country_Id (INT),
country.Country (TEXT),
country.Capital (TEXT),
country.Official_native_language (TEXT),
country.Regoin (TEXT),
)
TABLE driver (
driver.Driver_ID (INT),
driver.Driver (TEXT),
driver.Country (INT),
driver.Age (INT),
driver.Car_# (REAL),
driver.Make (TEXT),
driver.Points (TEXT),
driver.Laps (REAL),
driver.Winnings (TEXT),
)
TABLE team (
team.Team_ID (INT),
team.Team (TEXT),
team.Make (TEXT),
team.Manager (TEXT),
team.Sponsor (TEXT),
team.Car_Owner (TEXT),
)
TABLE team_driver (
team_driver.Team_ID (INT),
team_driver.Driver_ID (INT),
)
Possible JOINs:
driver.Country = country.Country_ID
team_driver.Team_ID = team.Team_ID
team_driver.Driver_ID = driver.Driver_ID
| TABLE country (
country.country_id (INT),
country.country (TEXT),
country.capital (TEXT),
country.official_native_language (TEXT),
country.regoin (TEXT),
)
TABLE driver (
driver.driver_id (INT),
driver.driver (TEXT),
driver.country (INT),
driver.age (INT),
driver.car_# (REAL),
driver.make (TEXT),
driver.points (TEXT),
driver.laps (REAL),
driver.winnings (TEXT),
)
TABLE team (
team.team_id (INT),
team.team (TEXT),
team.make (TEXT),
team.manager (TEXT),
team.sponsor (TEXT),
team.car_owner (TEXT),
)
TABLE team_driver (
team_driver.team_id (INT),
team_driver.driver_id (INT),
)
Possible JOINs:
driver.country = country.country_id
team_driver.team_id = team.team_id
team_driver.driver_id = driver.driver_id
| TABLE country (
country.country_id (INT),
country.country (TEXT),
country.capital (TEXT),
country.official_native_language (TEXT),
country.regoin (TEXT),
)
TABLE driver (
driver.driver_id (INT),
driver.driver (TEXT),
driver.country (INT),
driver.age (INT),
driver.car_# (REAL),
driver.make (TEXT),
driver.points (TEXT),
driver.laps (REAL),
driver.winnings (TEXT),
)
TABLE team (
team.team_id (INT),
team.team (TEXT),
team.make (TEXT),
team.manager (TEXT),
team.sponsor (TEXT),
team.car_owner (TEXT),
)
TABLE team_driver (
team_driver.team_id (INT),
team_driver.driver_id (INT),
)
Possible JOINs:
driver.country = country.country_id
team_driver.team_id = team.team_id
team_driver.driver_id = driver.driver_id
|
book_1 |
CREATE TABLE Client
(IdClient CHAR(10) PRIMARY KEY,
Name VARCHAR(25) NOT NULL,
Address VARCHAR(60) NOT NULL,
NumCC CHAR(16) NOT NULL)
/*
0 rows from Client table:
IdClient Name Address NumCC
*/
CREATE TABLE Orders
(IdOrder CHAR(10) PRIMARY KEY,
IdClient CHAR(10) NOT NULL REFERENCES Client on delete cascade,
DateOrder DATE,
DateExped DATE)
/*
0 rows from Orders table:
IdOrder IdClient DateOrder DateExped
*/
CREATE TABLE Author
( idAuthor NUMBER PRIMARY KEY,
Name VARCHAR(25))
/*
0 rows from Author table:
idAuthor Name
*/
CREATE TABLE Book
(ISBN CHAR(15) PRIMARY KEY,
Title VARCHAR(60) NOT NULL,
Author CHAR(4) NOT NULL,
PurchasePrice NUMBER(6,2) DEFAULT 0,
SalePrice NUMBER(6,2) DEFAULT 0)
/*
0 rows from Book table:
ISBN Title Author PurchasePrice SalePrice
*/
CREATE TABLE Author_Book
(ISBN CHAR(15),
Author NUMBER,
CONSTRAINT al_PK PRIMARY KEY (ISBN, Author),
CONSTRAINT BookA_FK FOREIGN KEY (ISBN) REFERENCES `Book`(ISBN) on delete cascade,
CONSTRAINT Author_FK FOREIGN KEY (Author) REFERENCES `Author`(idAuthorA))
/*
0 rows from Author_Book table:
ISBN Author
*/
CREATE TABLE Books_Order(
ISBN CHAR(15),
IdOrder CHAR(10),
amount NUMBER(3) CHECK (amount >0),
CONSTRAINT lp_PK PRIMARY KEY (ISBN, idOrder),
CONSTRAINT Book_FK FOREIGN KEY (ISBN) REFERENCES `Book`(ISBN) on delete cascade,
CONSTRAINT pedido_FK FOREIGN KEY (IdOrder) REFERENCES `Orders`(IdOrder) on delete cascade)
/*
0 rows from Books_Order table:
ISBN IdOrder amount
*/
| Give the name of the client who has made the most orders. | extra | Table Author (
Author.idAuthor (NUMBER),
Author.Name (VARCHAR(25)),
)
Table Author_Book (
Author_Book.ISBN (CHAR(15)),
Author_Book.Author (NUMBER),
)
Table Book (
Book.ISBN (CHAR(15)),
Book.Title (VARCHAR(60)),
Book.Author (CHAR(4)),
Book.PurchasePrice (NUMBER(6,2)),
Book.SalePrice (NUMBER(6,2)),
)
Table Books_Order (
Books_Order.ISBN (CHAR(15)),
Books_Order.IdOrder (CHAR(10)),
Books_Order.amount (NUMBER(3)),
)
Table Client (
Client.IdClient (CHAR(10)),
Client.Name (VARCHAR(25)),
Client.Address (VARCHAR(60)),
Client.NumCC (CHAR(16)),
)
Table Orders (
Orders.IdOrder (CHAR(10)),
Orders.IdClient (CHAR(10)),
Orders.DateOrder (DATE),
Orders.DateExped (DATE),
)
Possible JOINs:
Author_Book.ISBN = Book.ISBN
Author_Book.Author = Author.idAuthorA
Books_Order.ISBN = Book.ISBN
Books_Order.IdOrder = Orders.IdOrder
Orders.IdClient = Client.IdClient
| SELECT Client.name FROM Orders JOIN Client ON Orders.idClient = Client.idClient GROUP BY Orders.idClient ORDER BY count(*) DESC LIMIT 1 | {
'orders': ['idorder', 'idclient'],
'client': ['idclient', 'name']
} | CREATE TABLE Author (
Author.idAuthor (NUMBER),
Author.Name (VARCHAR(25)),
)
CREATE TABLE Author_Book (
Author_Book.ISBN (CHAR(15)),
Author_Book.Author (NUMBER),
)
CREATE TABLE Book (
Book.ISBN (CHAR(15)),
Book.Title (VARCHAR(60)),
Book.Author (CHAR(4)),
Book.PurchasePrice (NUMBER(6,2)),
Book.SalePrice (NUMBER(6,2)),
)
CREATE TABLE Books_Order (
Books_Order.ISBN (CHAR(15)),
Books_Order.IdOrder (CHAR(10)),
Books_Order.amount (NUMBER(3)),
)
CREATE TABLE Client (
Client.IdClient (CHAR(10)),
Client.Name (VARCHAR(25)),
Client.Address (VARCHAR(60)),
Client.NumCC (CHAR(16)),
)
CREATE TABLE Orders (
Orders.IdOrder (CHAR(10)),
Orders.IdClient (CHAR(10)),
Orders.DateOrder (DATE),
Orders.DateExped (DATE),
)
Possible JOINs:
Author_Book.ISBN = Book.ISBN
Author_Book.Author = Author.idAuthorA
Books_Order.ISBN = Book.ISBN
Books_Order.IdOrder = Orders.IdOrder
Orders.IdClient = Client.IdClient
| Table Author (
Author.idauthor (NUMBER),
Author.name (VARCHAR(25)),
)
Table Author_Book (
Author_Book.isbn (CHAR(15)),
Author_Book.author (NUMBER),
)
Table Book (
Book.isbn (CHAR(15)),
Book.title (VARCHAR(60)),
Book.author (CHAR(4)),
Book.purchaseprice (NUMBER(6,2)),
Book.saleprice (NUMBER(6,2)),
)
Table Books_Order (
Books_Order.isbn (CHAR(15)),
Books_Order.idorder (CHAR(10)),
Books_Order.amount (NUMBER(3)),
)
Table Client (
Client.idclient (CHAR(10)),
Client.name (VARCHAR(25)),
Client.address (VARCHAR(60)),
Client.numcc (CHAR(16)),
)
Table Orders (
Orders.idorder (CHAR(10)),
Orders.idclient (CHAR(10)),
Orders.dateorder (DATE),
Orders.dateexped (DATE),
)
Possible JOINs:
Author_Book.isbn = Book.isbn
Author_Book.author = Author.idauthora
Books_Order.isbn = Book.isbn
Books_Order.idorder = Orders.idorder
Orders.idclient = Client.idclient
| CREATE TABLE Author (
Author.idauthor (NUMBER),
Author.name (VARCHAR(25)),
)
CREATE TABLE Author_Book (
Author_Book.isbn (CHAR(15)),
Author_Book.author (NUMBER),
)
CREATE TABLE Book (
Book.isbn (CHAR(15)),
Book.title (VARCHAR(60)),
Book.author (CHAR(4)),
Book.purchaseprice (NUMBER(6,2)),
Book.saleprice (NUMBER(6,2)),
)
CREATE TABLE Books_Order (
Books_Order.isbn (CHAR(15)),
Books_Order.idorder (CHAR(10)),
Books_Order.amount (NUMBER(3)),
)
CREATE TABLE Client (
Client.idclient (CHAR(10)),
Client.name (VARCHAR(25)),
Client.address (VARCHAR(60)),
Client.numcc (CHAR(16)),
)
CREATE TABLE Orders (
Orders.idorder (CHAR(10)),
Orders.idclient (CHAR(10)),
Orders.dateorder (DATE),
Orders.dateexped (DATE),
)
Possible JOINs:
Author_Book.isbn = Book.isbn
Author_Book.author = Author.idauthora
Books_Order.isbn = Book.isbn
Books_Order.idorder = Orders.idorder
Orders.idclient = Client.idclient
| Table author (
author.idauthor (NUMBER),
author.name (VARCHAR(25)),
)
Table author_book (
author_book.isbn (CHAR(15)),
author_book.author (NUMBER),
)
Table book (
book.isbn (CHAR(15)),
book.title (VARCHAR(60)),
book.author (CHAR(4)),
book.purchaseprice (NUMBER(6,2)),
book.saleprice (NUMBER(6,2)),
)
Table books_order (
books_order.isbn (CHAR(15)),
books_order.idorder (CHAR(10)),
books_order.amount (NUMBER(3)),
)
Table client (
client.idclient (CHAR(10)),
client.name (VARCHAR(25)),
client.address (VARCHAR(60)),
client.numcc (CHAR(16)),
)
Table orders (
orders.idorder (CHAR(10)),
orders.idclient (CHAR(10)),
orders.dateorder (DATE),
orders.dateexped (DATE),
)
Possible JOINs:
author_book.isbn = book.isbn
author_book.author = author.idauthora
books_order.isbn = book.isbn
books_order.idorder = orders.idorder
orders.idclient = client.idclient
| CREATE TABLE author (
author.idauthor (NUMBER),
author.name (VARCHAR(25)),
)
CREATE TABLE author_book (
author_book.isbn (CHAR(15)),
author_book.author (NUMBER),
)
CREATE TABLE book (
book.isbn (CHAR(15)),
book.title (VARCHAR(60)),
book.author (CHAR(4)),
book.purchaseprice (NUMBER(6,2)),
book.saleprice (NUMBER(6,2)),
)
CREATE TABLE books_order (
books_order.isbn (CHAR(15)),
books_order.idorder (CHAR(10)),
books_order.amount (NUMBER(3)),
)
CREATE TABLE client (
client.idclient (CHAR(10)),
client.name (VARCHAR(25)),
client.address (VARCHAR(60)),
client.numcc (CHAR(16)),
)
CREATE TABLE orders (
orders.idorder (CHAR(10)),
orders.idclient (CHAR(10)),
orders.dateorder (DATE),
orders.dateexped (DATE),
)
Possible JOINs:
author_book.isbn = book.isbn
author_book.author = author.idauthora
books_order.isbn = book.isbn
books_order.idorder = orders.idorder
orders.idclient = client.idclient
| {
'Client': ['IdClient', 'Name', 'Address', 'NumCC'],
'Orders': ['IdOrder', 'IdClient', 'DateOrder', 'DateExped'],
'Author': ['idAuthor', 'Name'],
'Book': ['ISBN', 'Title', 'Author', 'PurchasePrice', 'SalePrice'],
'Author_Book': ['ISBN', 'Author'],
'Books_Order': ['ISBN', 'IdOrder', 'amount']
} | {
'Orders': ['IdOrder', 'IdClient'],
'Client': ['IdClient', 'Name']
} | TABLE Author (
Author.idAuthor (NUMBER),
Author.Name (VARCHAR(25)),
)
TABLE Author_Book (
Author_Book.ISBN (CHAR(15)),
Author_Book.Author (NUMBER),
)
TABLE Book (
Book.ISBN (CHAR(15)),
Book.Title (VARCHAR(60)),
Book.Author (CHAR(4)),
Book.PurchasePrice (NUMBER(6,2)),
Book.SalePrice (NUMBER(6,2)),
)
TABLE Books_Order (
Books_Order.ISBN (CHAR(15)),
Books_Order.IdOrder (CHAR(10)),
Books_Order.amount (NUMBER(3)),
)
TABLE Client (
Client.IdClient (CHAR(10)),
Client.Name (VARCHAR(25)),
Client.Address (VARCHAR(60)),
Client.NumCC (CHAR(16)),
)
TABLE Orders (
Orders.IdOrder (CHAR(10)),
Orders.IdClient (CHAR(10)),
Orders.DateOrder (DATE),
Orders.DateExped (DATE),
)
Possible JOINs:
Author_Book.ISBN = Book.ISBN
Author_Book.Author = Author.idAuthorA
Books_Order.ISBN = Book.ISBN
Books_Order.IdOrder = Orders.IdOrder
Orders.IdClient = Client.IdClient
| TABLE Author (
Author.idauthor (NUMBER),
Author.name (VARCHAR(25)),
)
TABLE Author_Book (
Author_Book.isbn (CHAR(15)),
Author_Book.author (NUMBER),
)
TABLE Book (
Book.isbn (CHAR(15)),
Book.title (VARCHAR(60)),
Book.author (CHAR(4)),
Book.purchaseprice (NUMBER(6,2)),
Book.saleprice (NUMBER(6,2)),
)
TABLE Books_Order (
Books_Order.isbn (CHAR(15)),
Books_Order.idorder (CHAR(10)),
Books_Order.amount (NUMBER(3)),
)
TABLE Client (
Client.idclient (CHAR(10)),
Client.name (VARCHAR(25)),
Client.address (VARCHAR(60)),
Client.numcc (CHAR(16)),
)
TABLE Orders (
Orders.idorder (CHAR(10)),
Orders.idclient (CHAR(10)),
Orders.dateorder (DATE),
Orders.dateexped (DATE),
)
Possible JOINs:
Author_Book.isbn = Book.isbn
Author_Book.author = Author.idauthora
Books_Order.isbn = Book.isbn
Books_Order.idorder = Orders.idorder
Orders.idclient = Client.idclient
| TABLE author (
author.idauthor (NUMBER),
author.name (VARCHAR(25)),
)
TABLE author_book (
author_book.isbn (CHAR(15)),
author_book.author (NUMBER),
)
TABLE book (
book.isbn (CHAR(15)),
book.title (VARCHAR(60)),
book.author (CHAR(4)),
book.purchaseprice (NUMBER(6,2)),
book.saleprice (NUMBER(6,2)),
)
TABLE books_order (
books_order.isbn (CHAR(15)),
books_order.idorder (CHAR(10)),
books_order.amount (NUMBER(3)),
)
TABLE client (
client.idclient (CHAR(10)),
client.name (VARCHAR(25)),
client.address (VARCHAR(60)),
client.numcc (CHAR(16)),
)
TABLE orders (
orders.idorder (CHAR(10)),
orders.idclient (CHAR(10)),
orders.dateorder (DATE),
orders.dateexped (DATE),
)
Possible JOINs:
author_book.isbn = book.isbn
author_book.author = author.idauthora
books_order.isbn = book.isbn
books_order.idorder = orders.idorder
orders.idclient = client.idclient
|
cre_Students_Information_Systems |
CREATE TABLE Students (
`student_id` INTEGER NOT NULL,
`bio_data` VARCHAR(255) NOT NULL,
`student_details` VARCHAR(255) NOT NULL,
PRIMARY KEY (`student_id`)
)
/*
0 rows from Students table:
student_id bio_data student_details
*/
CREATE TABLE Transcripts (
`transcript_id` INTEGER NOT NULL,
`student_id` INTEGER NOT NULL,
`date_of_transcript` DATETIME(3),
`transcript_details` VARCHAR(255) NOT NULL,
PRIMARY KEY (`transcript_id`),
FOREIGN KEY (student_id) REFERENCES Students (student_id)
)
/*
0 rows from Transcripts table:
transcript_id student_id date_of_transcript transcript_details
*/
CREATE TABLE Behaviour_Monitoring (
`behaviour_monitoring_id` INTEGER NOT NULL,
`student_id` INTEGER NOT NULL,
`behaviour_monitoring_details` VARCHAR(255) NOT NULL,
PRIMARY KEY (`behaviour_monitoring_id`),
FOREIGN KEY (student_id) REFERENCES Students (student_id)
)
/*
0 rows from Behaviour_Monitoring table:
behaviour_monitoring_id student_id behaviour_monitoring_details
*/
CREATE TABLE Addresses (
`address_id` INTEGER NOT NULL,
`address_details` VARCHAR(255) NOT NULL,
PRIMARY KEY (`address_id`)
)
/*
0 rows from Addresses table:
address_id address_details
*/
CREATE TABLE Ref_Event_Types (
`event_type_code` CHAR(10) NOT NULL,
`event_type_description` VARCHAR(255) NOT NULL,
PRIMARY KEY (`event_type_code`)
)
/*
0 rows from Ref_Event_Types table:
event_type_code event_type_description
*/
CREATE TABLE Ref_Achievement_Type (
`achievement_type_code` CHAR(15) NOT NULL,
`achievement_type_description` VARCHAR(80),
PRIMARY KEY (`achievement_type_code`)
)
/*
0 rows from Ref_Achievement_Type table:
achievement_type_code achievement_type_description
*/
CREATE TABLE Ref_Address_Types (
`address_type_code` CHAR(10) NOT NULL,
`address_type_description` VARCHAR(255) NOT NULL,
PRIMARY KEY (`address_type_code`)
)
/*
0 rows from Ref_Address_Types table:
address_type_code address_type_description
*/
CREATE TABLE Ref_Detention_Type (
`detention_type_code` CHAR(10) NOT NULL,
`detention_type_description` VARCHAR(80),
PRIMARY KEY (`detention_type_code`)
)
/*
0 rows from Ref_Detention_Type table:
detention_type_code detention_type_description
*/
CREATE TABLE Student_Events (
`event_id` INTEGER NOT NULL,
`event_type_code` CHAR(10) NOT NULL,
`student_id` INTEGER NOT NULL,
`event_date` DATETIME(3),
`other_details` VARCHAR(255) NOT NULL,
PRIMARY KEY (`event_id`),
FOREIGN KEY (student_id) REFERENCES Students (student_id),
FOREIGN KEY (event_type_code) REFERENCES Ref_Event_Types (event_type_code)
)
/*
0 rows from Student_Events table:
event_id event_type_code student_id event_date other_details
*/
CREATE TABLE Teachers (
`teacher_id` INTEGER NOT NULL,
`teacher_details` VARCHAR(255),
PRIMARY KEY (`teacher_id`)
)
/*
0 rows from Teachers table:
teacher_id teacher_details
*/
CREATE TABLE Student_Loans (
`student_loan_id` INTEGER NOT NULL,
`student_id` INTEGER NOT NULL,
`date_of_loan` DATETIME(3),
`amount_of_loan` DECIMAL(15,4),
`other_details` VARCHAR(255),
PRIMARY KEY (`student_loan_id`),
FOREIGN KEY (student_id) REFERENCES Students (student_id)
)
/*
0 rows from Student_Loans table:
student_loan_id student_id date_of_loan amount_of_loan other_details
*/
CREATE TABLE Classes (
`class_id` INTEGER NOT NULL,
`student_id` INTEGER NOT NULL,
`teacher_id` INTEGER NOT NULL,
`class_details` VARCHAR(255) NOT NULL,
PRIMARY KEY (`class_id`),
FOREIGN KEY (student_id) REFERENCES Students (student_id),
FOREIGN KEY (teacher_id) REFERENCES Teachers (teacher_id)
)
/*
0 rows from Classes table:
class_id student_id teacher_id class_details
*/
CREATE TABLE Students_Addresses (
`student_address_id` INTEGER NOT NULL,
`address_id` INTEGER NOT NULL,
`address_type_code` CHAR(10) NOT NULL,
`student_id` INTEGER NOT NULL,
`date_from` DATETIME(3),
`date_to` DATETIME(3),
PRIMARY KEY (`student_address_id`),
FOREIGN KEY (student_id) REFERENCES Students (student_id),
FOREIGN KEY (address_id) REFERENCES Addresses (address_id),
FOREIGN KEY (address_type_code) REFERENCES Ref_Address_Types (address_type_code)
)
/*
0 rows from Students_Addresses table:
student_address_id address_id address_type_code student_id date_from date_to
*/
CREATE TABLE Detention (
`detention_id` INTEGER NOT NULL,
`detention_type_code` CHAR(10) NOT NULL,
`student_id` INTEGER NOT NULL,
`datetime_detention_start` DATETIME(3),
`datetime_detention_end` DATETIME(3),
`detention_summary` VARCHAR(255),
`other_details` VARCHAR(255),
PRIMARY KEY (`detention_id`),
FOREIGN KEY (student_id) REFERENCES Students (student_id),
FOREIGN KEY (detention_type_code) REFERENCES Ref_Detention_Type (detention_type_code)
)
/*
0 rows from Detention table:
detention_id detention_type_code student_id datetime_detention_start datetime_detention_end detention_summary other_details
*/
CREATE TABLE Achievements (
`achievement_id` INTEGER NOT NULL,
`achievement_type_code` CHAR(15) NOT NULL,
`student_id` INTEGER NOT NULL,
`date_achievement` DATETIME(3),
`achievement_details` VARCHAR(255),
`other_details` VARCHAR(255),
PRIMARY KEY (`achievement_id`),
FOREIGN KEY (student_id) REFERENCES Students (student_id),
FOREIGN KEY (achievement_type_code) REFERENCES Ref_Achievement_Type (achievement_type_code)
)
/*
0 rows from Achievements table:
achievement_id achievement_type_code student_id date_achievement achievement_details other_details
*/
| What are the achievement detail and the type description of each achievements? | medium | Table Achievements (
Achievements.achievement_id (INTEGER),
Achievements.achievement_type_code (CHAR(15)),
Achievements.student_id (INTEGER),
Achievements.date_achievement (DATETIME(3)),
Achievements.achievement_details (VARCHAR(255)),
Achievements.other_details (VARCHAR(255)),
)
Table Addresses (
Addresses.address_id (INTEGER),
Addresses.address_details (VARCHAR(255)),
)
Table Behaviour_Monitoring (
Behaviour_Monitoring.behaviour_monitoring_id (INTEGER),
Behaviour_Monitoring.student_id (INTEGER),
Behaviour_Monitoring.behaviour_monitoring_details (VARCHAR(255)),
)
Table Classes (
Classes.class_id (INTEGER),
Classes.student_id (INTEGER),
Classes.teacher_id (INTEGER),
Classes.class_details (VARCHAR(255)),
)
Table Detention (
Detention.detention_id (INTEGER),
Detention.detention_type_code (CHAR(10)),
Detention.student_id (INTEGER),
Detention.datetime_detention_start (DATETIME(3)),
Detention.datetime_detention_end (DATETIME(3)),
Detention.detention_summary (VARCHAR(255)),
Detention.other_details (VARCHAR(255)),
)
Table Ref_Achievement_Type (
Ref_Achievement_Type.achievement_type_code (CHAR(15)),
Ref_Achievement_Type.achievement_type_description (VARCHAR(80)),
)
Table Ref_Address_Types (
Ref_Address_Types.address_type_code (CHAR(10)),
Ref_Address_Types.address_type_description (VARCHAR(255)),
)
Table Ref_Detention_Type (
Ref_Detention_Type.detention_type_code (CHAR(10)),
Ref_Detention_Type.detention_type_description (VARCHAR(80)),
)
Table Ref_Event_Types (
Ref_Event_Types.event_type_code (CHAR(10)),
Ref_Event_Types.event_type_description (VARCHAR(255)),
)
Table Student_Events (
Student_Events.event_id (INTEGER),
Student_Events.event_type_code (CHAR(10)),
Student_Events.student_id (INTEGER),
Student_Events.event_date (DATETIME(3)),
Student_Events.other_details (VARCHAR(255)),
)
Table Student_Loans (
Student_Loans.student_loan_id (INTEGER),
Student_Loans.student_id (INTEGER),
Student_Loans.date_of_loan (DATETIME(3)),
Student_Loans.amount_of_loan (DECIMAL(15,4)),
Student_Loans.other_details (VARCHAR(255)),
)
Table Students (
Students.student_id (INTEGER),
Students.bio_data (VARCHAR(255)),
Students.student_details (VARCHAR(255)),
)
Table Students_Addresses (
Students_Addresses.student_address_id (INTEGER),
Students_Addresses.address_id (INTEGER),
Students_Addresses.address_type_code (CHAR(10)),
Students_Addresses.student_id (INTEGER),
Students_Addresses.date_from (DATETIME(3)),
Students_Addresses.date_to (DATETIME(3)),
)
Table Teachers (
Teachers.teacher_id (INTEGER),
Teachers.teacher_details (VARCHAR(255)),
)
Table Transcripts (
Transcripts.transcript_id (INTEGER),
Transcripts.student_id (INTEGER),
Transcripts.date_of_transcript (DATETIME(3)),
Transcripts.transcript_details (VARCHAR(255)),
)
Possible JOINs:
Achievements.achievement_type_code = Ref_Achievement_Type.achievement_type_code
Achievements.student_id = Students.student_id
Behaviour_Monitoring.student_id = Students.student_id
Classes.student_id = Students.student_id
Classes.teacher_id = Teachers.teacher_id
Detention.detention_type_code = Ref_Detention_Type.detention_type_code
Detention.student_id = Students.student_id
Student_Events.event_type_code = Ref_Event_Types.event_type_code
Student_Events.student_id = Students.student_id
Student_Loans.student_id = Students.student_id
Students_Addresses.address_id = Addresses.address_id
Students_Addresses.address_type_code = Ref_Address_Types.address_type_code
Students_Addresses.student_id = Students.student_id
Transcripts.student_id = Students.student_id
| SELECT Achievements.achievement_details , Ref_Achievement_Type.achievement_type_description FROM Achievements JOIN Ref_Achievement_Type ON Achievements.achievement_type_code = Ref_Achievement_Type.achievement_type_code | {
'achievements': ['achievement_id', 'achievement_type_code', 'achievement_details'],
'ref_achievement_type': ['achievement_type_code', 'achievement_type_description']
} | CREATE TABLE Achievements (
Achievements.achievement_id (INTEGER),
Achievements.achievement_type_code (CHAR(15)),
Achievements.student_id (INTEGER),
Achievements.date_achievement (DATETIME(3)),
Achievements.achievement_details (VARCHAR(255)),
Achievements.other_details (VARCHAR(255)),
)
CREATE TABLE Addresses (
Addresses.address_id (INTEGER),
Addresses.address_details (VARCHAR(255)),
)
CREATE TABLE Behaviour_Monitoring (
Behaviour_Monitoring.behaviour_monitoring_id (INTEGER),
Behaviour_Monitoring.student_id (INTEGER),
Behaviour_Monitoring.behaviour_monitoring_details (VARCHAR(255)),
)
CREATE TABLE Classes (
Classes.class_id (INTEGER),
Classes.student_id (INTEGER),
Classes.teacher_id (INTEGER),
Classes.class_details (VARCHAR(255)),
)
CREATE TABLE Detention (
Detention.detention_id (INTEGER),
Detention.detention_type_code (CHAR(10)),
Detention.student_id (INTEGER),
Detention.datetime_detention_start (DATETIME(3)),
Detention.datetime_detention_end (DATETIME(3)),
Detention.detention_summary (VARCHAR(255)),
Detention.other_details (VARCHAR(255)),
)
CREATE TABLE Ref_Achievement_Type (
Ref_Achievement_Type.achievement_type_code (CHAR(15)),
Ref_Achievement_Type.achievement_type_description (VARCHAR(80)),
)
CREATE TABLE Ref_Address_Types (
Ref_Address_Types.address_type_code (CHAR(10)),
Ref_Address_Types.address_type_description (VARCHAR(255)),
)
CREATE TABLE Ref_Detention_Type (
Ref_Detention_Type.detention_type_code (CHAR(10)),
Ref_Detention_Type.detention_type_description (VARCHAR(80)),
)
CREATE TABLE Ref_Event_Types (
Ref_Event_Types.event_type_code (CHAR(10)),
Ref_Event_Types.event_type_description (VARCHAR(255)),
)
CREATE TABLE Student_Events (
Student_Events.event_id (INTEGER),
Student_Events.event_type_code (CHAR(10)),
Student_Events.student_id (INTEGER),
Student_Events.event_date (DATETIME(3)),
Student_Events.other_details (VARCHAR(255)),
)
CREATE TABLE Student_Loans (
Student_Loans.student_loan_id (INTEGER),
Student_Loans.student_id (INTEGER),
Student_Loans.date_of_loan (DATETIME(3)),
Student_Loans.amount_of_loan (DECIMAL(15,4)),
Student_Loans.other_details (VARCHAR(255)),
)
CREATE TABLE Students (
Students.student_id (INTEGER),
Students.bio_data (VARCHAR(255)),
Students.student_details (VARCHAR(255)),
)
CREATE TABLE Students_Addresses (
Students_Addresses.student_address_id (INTEGER),
Students_Addresses.address_id (INTEGER),
Students_Addresses.address_type_code (CHAR(10)),
Students_Addresses.student_id (INTEGER),
Students_Addresses.date_from (DATETIME(3)),
Students_Addresses.date_to (DATETIME(3)),
)
CREATE TABLE Teachers (
Teachers.teacher_id (INTEGER),
Teachers.teacher_details (VARCHAR(255)),
)
CREATE TABLE Transcripts (
Transcripts.transcript_id (INTEGER),
Transcripts.student_id (INTEGER),
Transcripts.date_of_transcript (DATETIME(3)),
Transcripts.transcript_details (VARCHAR(255)),
)
Possible JOINs:
Achievements.achievement_type_code = Ref_Achievement_Type.achievement_type_code
Achievements.student_id = Students.student_id
Behaviour_Monitoring.student_id = Students.student_id
Classes.student_id = Students.student_id
Classes.teacher_id = Teachers.teacher_id
Detention.detention_type_code = Ref_Detention_Type.detention_type_code
Detention.student_id = Students.student_id
Student_Events.event_type_code = Ref_Event_Types.event_type_code
Student_Events.student_id = Students.student_id
Student_Loans.student_id = Students.student_id
Students_Addresses.address_id = Addresses.address_id
Students_Addresses.address_type_code = Ref_Address_Types.address_type_code
Students_Addresses.student_id = Students.student_id
Transcripts.student_id = Students.student_id
| Table Achievements (
Achievements.achievement_id (INTEGER),
Achievements.achievement_type_code (CHAR(15)),
Achievements.student_id (INTEGER),
Achievements.date_achievement (DATETIME(3)),
Achievements.achievement_details (VARCHAR(255)),
Achievements.other_details (VARCHAR(255)),
)
Table Addresses (
Addresses.address_id (INTEGER),
Addresses.address_details (VARCHAR(255)),
)
Table Behaviour_Monitoring (
Behaviour_Monitoring.behaviour_monitoring_id (INTEGER),
Behaviour_Monitoring.student_id (INTEGER),
Behaviour_Monitoring.behaviour_monitoring_details (VARCHAR(255)),
)
Table Classes (
Classes.class_id (INTEGER),
Classes.student_id (INTEGER),
Classes.teacher_id (INTEGER),
Classes.class_details (VARCHAR(255)),
)
Table Detention (
Detention.detention_id (INTEGER),
Detention.detention_type_code (CHAR(10)),
Detention.student_id (INTEGER),
Detention.datetime_detention_start (DATETIME(3)),
Detention.datetime_detention_end (DATETIME(3)),
Detention.detention_summary (VARCHAR(255)),
Detention.other_details (VARCHAR(255)),
)
Table Ref_Achievement_Type (
Ref_Achievement_Type.achievement_type_code (CHAR(15)),
Ref_Achievement_Type.achievement_type_description (VARCHAR(80)),
)
Table Ref_Address_Types (
Ref_Address_Types.address_type_code (CHAR(10)),
Ref_Address_Types.address_type_description (VARCHAR(255)),
)
Table Ref_Detention_Type (
Ref_Detention_Type.detention_type_code (CHAR(10)),
Ref_Detention_Type.detention_type_description (VARCHAR(80)),
)
Table Ref_Event_Types (
Ref_Event_Types.event_type_code (CHAR(10)),
Ref_Event_Types.event_type_description (VARCHAR(255)),
)
Table Student_Events (
Student_Events.event_id (INTEGER),
Student_Events.event_type_code (CHAR(10)),
Student_Events.student_id (INTEGER),
Student_Events.event_date (DATETIME(3)),
Student_Events.other_details (VARCHAR(255)),
)
Table Student_Loans (
Student_Loans.student_loan_id (INTEGER),
Student_Loans.student_id (INTEGER),
Student_Loans.date_of_loan (DATETIME(3)),
Student_Loans.amount_of_loan (DECIMAL(15,4)),
Student_Loans.other_details (VARCHAR(255)),
)
Table Students (
Students.student_id (INTEGER),
Students.bio_data (VARCHAR(255)),
Students.student_details (VARCHAR(255)),
)
Table Students_Addresses (
Students_Addresses.student_address_id (INTEGER),
Students_Addresses.address_id (INTEGER),
Students_Addresses.address_type_code (CHAR(10)),
Students_Addresses.student_id (INTEGER),
Students_Addresses.date_from (DATETIME(3)),
Students_Addresses.date_to (DATETIME(3)),
)
Table Teachers (
Teachers.teacher_id (INTEGER),
Teachers.teacher_details (VARCHAR(255)),
)
Table Transcripts (
Transcripts.transcript_id (INTEGER),
Transcripts.student_id (INTEGER),
Transcripts.date_of_transcript (DATETIME(3)),
Transcripts.transcript_details (VARCHAR(255)),
)
Possible JOINs:
Achievements.achievement_type_code = Ref_Achievement_Type.achievement_type_code
Achievements.student_id = Students.student_id
Behaviour_Monitoring.student_id = Students.student_id
Classes.student_id = Students.student_id
Classes.teacher_id = Teachers.teacher_id
Detention.detention_type_code = Ref_Detention_Type.detention_type_code
Detention.student_id = Students.student_id
Student_Events.event_type_code = Ref_Event_Types.event_type_code
Student_Events.student_id = Students.student_id
Student_Loans.student_id = Students.student_id
Students_Addresses.address_id = Addresses.address_id
Students_Addresses.address_type_code = Ref_Address_Types.address_type_code
Students_Addresses.student_id = Students.student_id
Transcripts.student_id = Students.student_id
| CREATE TABLE Achievements (
Achievements.achievement_id (INTEGER),
Achievements.achievement_type_code (CHAR(15)),
Achievements.student_id (INTEGER),
Achievements.date_achievement (DATETIME(3)),
Achievements.achievement_details (VARCHAR(255)),
Achievements.other_details (VARCHAR(255)),
)
CREATE TABLE Addresses (
Addresses.address_id (INTEGER),
Addresses.address_details (VARCHAR(255)),
)
CREATE TABLE Behaviour_Monitoring (
Behaviour_Monitoring.behaviour_monitoring_id (INTEGER),
Behaviour_Monitoring.student_id (INTEGER),
Behaviour_Monitoring.behaviour_monitoring_details (VARCHAR(255)),
)
CREATE TABLE Classes (
Classes.class_id (INTEGER),
Classes.student_id (INTEGER),
Classes.teacher_id (INTEGER),
Classes.class_details (VARCHAR(255)),
)
CREATE TABLE Detention (
Detention.detention_id (INTEGER),
Detention.detention_type_code (CHAR(10)),
Detention.student_id (INTEGER),
Detention.datetime_detention_start (DATETIME(3)),
Detention.datetime_detention_end (DATETIME(3)),
Detention.detention_summary (VARCHAR(255)),
Detention.other_details (VARCHAR(255)),
)
CREATE TABLE Ref_Achievement_Type (
Ref_Achievement_Type.achievement_type_code (CHAR(15)),
Ref_Achievement_Type.achievement_type_description (VARCHAR(80)),
)
CREATE TABLE Ref_Address_Types (
Ref_Address_Types.address_type_code (CHAR(10)),
Ref_Address_Types.address_type_description (VARCHAR(255)),
)
CREATE TABLE Ref_Detention_Type (
Ref_Detention_Type.detention_type_code (CHAR(10)),
Ref_Detention_Type.detention_type_description (VARCHAR(80)),
)
CREATE TABLE Ref_Event_Types (
Ref_Event_Types.event_type_code (CHAR(10)),
Ref_Event_Types.event_type_description (VARCHAR(255)),
)
CREATE TABLE Student_Events (
Student_Events.event_id (INTEGER),
Student_Events.event_type_code (CHAR(10)),
Student_Events.student_id (INTEGER),
Student_Events.event_date (DATETIME(3)),
Student_Events.other_details (VARCHAR(255)),
)
CREATE TABLE Student_Loans (
Student_Loans.student_loan_id (INTEGER),
Student_Loans.student_id (INTEGER),
Student_Loans.date_of_loan (DATETIME(3)),
Student_Loans.amount_of_loan (DECIMAL(15,4)),
Student_Loans.other_details (VARCHAR(255)),
)
CREATE TABLE Students (
Students.student_id (INTEGER),
Students.bio_data (VARCHAR(255)),
Students.student_details (VARCHAR(255)),
)
CREATE TABLE Students_Addresses (
Students_Addresses.student_address_id (INTEGER),
Students_Addresses.address_id (INTEGER),
Students_Addresses.address_type_code (CHAR(10)),
Students_Addresses.student_id (INTEGER),
Students_Addresses.date_from (DATETIME(3)),
Students_Addresses.date_to (DATETIME(3)),
)
CREATE TABLE Teachers (
Teachers.teacher_id (INTEGER),
Teachers.teacher_details (VARCHAR(255)),
)
CREATE TABLE Transcripts (
Transcripts.transcript_id (INTEGER),
Transcripts.student_id (INTEGER),
Transcripts.date_of_transcript (DATETIME(3)),
Transcripts.transcript_details (VARCHAR(255)),
)
Possible JOINs:
Achievements.achievement_type_code = Ref_Achievement_Type.achievement_type_code
Achievements.student_id = Students.student_id
Behaviour_Monitoring.student_id = Students.student_id
Classes.student_id = Students.student_id
Classes.teacher_id = Teachers.teacher_id
Detention.detention_type_code = Ref_Detention_Type.detention_type_code
Detention.student_id = Students.student_id
Student_Events.event_type_code = Ref_Event_Types.event_type_code
Student_Events.student_id = Students.student_id
Student_Loans.student_id = Students.student_id
Students_Addresses.address_id = Addresses.address_id
Students_Addresses.address_type_code = Ref_Address_Types.address_type_code
Students_Addresses.student_id = Students.student_id
Transcripts.student_id = Students.student_id
| Table achievements (
achievements.achievement_id (INTEGER),
achievements.achievement_type_code (CHAR(15)),
achievements.student_id (INTEGER),
achievements.date_achievement (DATETIME(3)),
achievements.achievement_details (VARCHAR(255)),
achievements.other_details (VARCHAR(255)),
)
Table addresses (
addresses.address_id (INTEGER),
addresses.address_details (VARCHAR(255)),
)
Table behaviour_monitoring (
behaviour_monitoring.behaviour_monitoring_id (INTEGER),
behaviour_monitoring.student_id (INTEGER),
behaviour_monitoring.behaviour_monitoring_details (VARCHAR(255)),
)
Table classes (
classes.class_id (INTEGER),
classes.student_id (INTEGER),
classes.teacher_id (INTEGER),
classes.class_details (VARCHAR(255)),
)
Table detention (
detention.detention_id (INTEGER),
detention.detention_type_code (CHAR(10)),
detention.student_id (INTEGER),
detention.datetime_detention_start (DATETIME(3)),
detention.datetime_detention_end (DATETIME(3)),
detention.detention_summary (VARCHAR(255)),
detention.other_details (VARCHAR(255)),
)
Table ref_achievement_type (
ref_achievement_type.achievement_type_code (CHAR(15)),
ref_achievement_type.achievement_type_description (VARCHAR(80)),
)
Table ref_address_types (
ref_address_types.address_type_code (CHAR(10)),
ref_address_types.address_type_description (VARCHAR(255)),
)
Table ref_detention_type (
ref_detention_type.detention_type_code (CHAR(10)),
ref_detention_type.detention_type_description (VARCHAR(80)),
)
Table ref_event_types (
ref_event_types.event_type_code (CHAR(10)),
ref_event_types.event_type_description (VARCHAR(255)),
)
Table student_events (
student_events.event_id (INTEGER),
student_events.event_type_code (CHAR(10)),
student_events.student_id (INTEGER),
student_events.event_date (DATETIME(3)),
student_events.other_details (VARCHAR(255)),
)
Table student_loans (
student_loans.student_loan_id (INTEGER),
student_loans.student_id (INTEGER),
student_loans.date_of_loan (DATETIME(3)),
student_loans.amount_of_loan (DECIMAL(15,4)),
student_loans.other_details (VARCHAR(255)),
)
Table students (
students.student_id (INTEGER),
students.bio_data (VARCHAR(255)),
students.student_details (VARCHAR(255)),
)
Table students_addresses (
students_addresses.student_address_id (INTEGER),
students_addresses.address_id (INTEGER),
students_addresses.address_type_code (CHAR(10)),
students_addresses.student_id (INTEGER),
students_addresses.date_from (DATETIME(3)),
students_addresses.date_to (DATETIME(3)),
)
Table teachers (
teachers.teacher_id (INTEGER),
teachers.teacher_details (VARCHAR(255)),
)
Table transcripts (
transcripts.transcript_id (INTEGER),
transcripts.student_id (INTEGER),
transcripts.date_of_transcript (DATETIME(3)),
transcripts.transcript_details (VARCHAR(255)),
)
Possible JOINs:
achievements.achievement_type_code = ref_achievement_type.achievement_type_code
achievements.student_id = students.student_id
behaviour_monitoring.student_id = students.student_id
classes.student_id = students.student_id
classes.teacher_id = teachers.teacher_id
detention.detention_type_code = ref_detention_type.detention_type_code
detention.student_id = students.student_id
student_events.event_type_code = ref_event_types.event_type_code
student_events.student_id = students.student_id
student_loans.student_id = students.student_id
students_addresses.address_id = addresses.address_id
students_addresses.address_type_code = ref_address_types.address_type_code
students_addresses.student_id = students.student_id
transcripts.student_id = students.student_id
| CREATE TABLE achievements (
achievements.achievement_id (INTEGER),
achievements.achievement_type_code (CHAR(15)),
achievements.student_id (INTEGER),
achievements.date_achievement (DATETIME(3)),
achievements.achievement_details (VARCHAR(255)),
achievements.other_details (VARCHAR(255)),
)
CREATE TABLE addresses (
addresses.address_id (INTEGER),
addresses.address_details (VARCHAR(255)),
)
CREATE TABLE behaviour_monitoring (
behaviour_monitoring.behaviour_monitoring_id (INTEGER),
behaviour_monitoring.student_id (INTEGER),
behaviour_monitoring.behaviour_monitoring_details (VARCHAR(255)),
)
CREATE TABLE classes (
classes.class_id (INTEGER),
classes.student_id (INTEGER),
classes.teacher_id (INTEGER),
classes.class_details (VARCHAR(255)),
)
CREATE TABLE detention (
detention.detention_id (INTEGER),
detention.detention_type_code (CHAR(10)),
detention.student_id (INTEGER),
detention.datetime_detention_start (DATETIME(3)),
detention.datetime_detention_end (DATETIME(3)),
detention.detention_summary (VARCHAR(255)),
detention.other_details (VARCHAR(255)),
)
CREATE TABLE ref_achievement_type (
ref_achievement_type.achievement_type_code (CHAR(15)),
ref_achievement_type.achievement_type_description (VARCHAR(80)),
)
CREATE TABLE ref_address_types (
ref_address_types.address_type_code (CHAR(10)),
ref_address_types.address_type_description (VARCHAR(255)),
)
CREATE TABLE ref_detention_type (
ref_detention_type.detention_type_code (CHAR(10)),
ref_detention_type.detention_type_description (VARCHAR(80)),
)
CREATE TABLE ref_event_types (
ref_event_types.event_type_code (CHAR(10)),
ref_event_types.event_type_description (VARCHAR(255)),
)
CREATE TABLE student_events (
student_events.event_id (INTEGER),
student_events.event_type_code (CHAR(10)),
student_events.student_id (INTEGER),
student_events.event_date (DATETIME(3)),
student_events.other_details (VARCHAR(255)),
)
CREATE TABLE student_loans (
student_loans.student_loan_id (INTEGER),
student_loans.student_id (INTEGER),
student_loans.date_of_loan (DATETIME(3)),
student_loans.amount_of_loan (DECIMAL(15,4)),
student_loans.other_details (VARCHAR(255)),
)
CREATE TABLE students (
students.student_id (INTEGER),
students.bio_data (VARCHAR(255)),
students.student_details (VARCHAR(255)),
)
CREATE TABLE students_addresses (
students_addresses.student_address_id (INTEGER),
students_addresses.address_id (INTEGER),
students_addresses.address_type_code (CHAR(10)),
students_addresses.student_id (INTEGER),
students_addresses.date_from (DATETIME(3)),
students_addresses.date_to (DATETIME(3)),
)
CREATE TABLE teachers (
teachers.teacher_id (INTEGER),
teachers.teacher_details (VARCHAR(255)),
)
CREATE TABLE transcripts (
transcripts.transcript_id (INTEGER),
transcripts.student_id (INTEGER),
transcripts.date_of_transcript (DATETIME(3)),
transcripts.transcript_details (VARCHAR(255)),
)
Possible JOINs:
achievements.achievement_type_code = ref_achievement_type.achievement_type_code
achievements.student_id = students.student_id
behaviour_monitoring.student_id = students.student_id
classes.student_id = students.student_id
classes.teacher_id = teachers.teacher_id
detention.detention_type_code = ref_detention_type.detention_type_code
detention.student_id = students.student_id
student_events.event_type_code = ref_event_types.event_type_code
student_events.student_id = students.student_id
student_loans.student_id = students.student_id
students_addresses.address_id = addresses.address_id
students_addresses.address_type_code = ref_address_types.address_type_code
students_addresses.student_id = students.student_id
transcripts.student_id = students.student_id
| {
'Students': ['student_id', 'bio_data', 'student_details'],
'Transcripts': ['transcript_id', 'student_id', 'date_of_transcript', 'transcript_details'],
'Behaviour_Monitoring': ['behaviour_monitoring_id', 'student_id', 'behaviour_monitoring_details'],
'Addresses': ['address_id', 'address_details'],
'Ref_Event_Types': ['event_type_code', 'event_type_description'],
'Ref_Achievement_Type': ['achievement_type_code', 'achievement_type_description'],
'Ref_Address_Types': ['address_type_code', 'address_type_description'],
'Ref_Detention_Type': ['detention_type_code', 'detention_type_description'],
'Student_Events': ['event_id', 'event_type_code', 'student_id', 'event_date', 'other_details'],
'Teachers': ['teacher_id', 'teacher_details'],
'Student_Loans': ['student_loan_id', 'student_id', 'date_of_loan', 'amount_of_loan', 'other_details'],
'Classes': ['class_id', 'student_id', 'teacher_id', 'class_details'],
'Students_Addresses': ['student_address_id', 'address_id', 'address_type_code', 'student_id', 'date_from', 'date_to'],
'Detention': ['detention_id', 'detention_type_code', 'student_id', 'datetime_detention_start', 'datetime_detention_end', 'detention_summary', 'other_details'],
'Achievements': ['achievement_id', 'achievement_type_code', 'student_id', 'date_achievement', 'achievement_details', 'other_details']
} | {
'Achievements': ['achievement_id', 'achievement_type_code', 'achievement_details'],
'Ref_Achievement_Type': ['achievement_type_code', 'achievement_type_description']
} | TABLE Achievements (
Achievements.achievement_id (INTEGER),
Achievements.achievement_type_code (CHAR(15)),
Achievements.student_id (INTEGER),
Achievements.date_achievement (DATETIME(3)),
Achievements.achievement_details (VARCHAR(255)),
Achievements.other_details (VARCHAR(255)),
)
TABLE Addresses (
Addresses.address_id (INTEGER),
Addresses.address_details (VARCHAR(255)),
)
TABLE Behaviour_Monitoring (
Behaviour_Monitoring.behaviour_monitoring_id (INTEGER),
Behaviour_Monitoring.student_id (INTEGER),
Behaviour_Monitoring.behaviour_monitoring_details (VARCHAR(255)),
)
TABLE Classes (
Classes.class_id (INTEGER),
Classes.student_id (INTEGER),
Classes.teacher_id (INTEGER),
Classes.class_details (VARCHAR(255)),
)
TABLE Detention (
Detention.detention_id (INTEGER),
Detention.detention_type_code (CHAR(10)),
Detention.student_id (INTEGER),
Detention.datetime_detention_start (DATETIME(3)),
Detention.datetime_detention_end (DATETIME(3)),
Detention.detention_summary (VARCHAR(255)),
Detention.other_details (VARCHAR(255)),
)
TABLE Ref_Achievement_Type (
Ref_Achievement_Type.achievement_type_code (CHAR(15)),
Ref_Achievement_Type.achievement_type_description (VARCHAR(80)),
)
TABLE Ref_Address_Types (
Ref_Address_Types.address_type_code (CHAR(10)),
Ref_Address_Types.address_type_description (VARCHAR(255)),
)
TABLE Ref_Detention_Type (
Ref_Detention_Type.detention_type_code (CHAR(10)),
Ref_Detention_Type.detention_type_description (VARCHAR(80)),
)
TABLE Ref_Event_Types (
Ref_Event_Types.event_type_code (CHAR(10)),
Ref_Event_Types.event_type_description (VARCHAR(255)),
)
TABLE Student_Events (
Student_Events.event_id (INTEGER),
Student_Events.event_type_code (CHAR(10)),
Student_Events.student_id (INTEGER),
Student_Events.event_date (DATETIME(3)),
Student_Events.other_details (VARCHAR(255)),
)
TABLE Student_Loans (
Student_Loans.student_loan_id (INTEGER),
Student_Loans.student_id (INTEGER),
Student_Loans.date_of_loan (DATETIME(3)),
Student_Loans.amount_of_loan (DECIMAL(15,4)),
Student_Loans.other_details (VARCHAR(255)),
)
TABLE Students (
Students.student_id (INTEGER),
Students.bio_data (VARCHAR(255)),
Students.student_details (VARCHAR(255)),
)
TABLE Students_Addresses (
Students_Addresses.student_address_id (INTEGER),
Students_Addresses.address_id (INTEGER),
Students_Addresses.address_type_code (CHAR(10)),
Students_Addresses.student_id (INTEGER),
Students_Addresses.date_from (DATETIME(3)),
Students_Addresses.date_to (DATETIME(3)),
)
TABLE Teachers (
Teachers.teacher_id (INTEGER),
Teachers.teacher_details (VARCHAR(255)),
)
TABLE Transcripts (
Transcripts.transcript_id (INTEGER),
Transcripts.student_id (INTEGER),
Transcripts.date_of_transcript (DATETIME(3)),
Transcripts.transcript_details (VARCHAR(255)),
)
Possible JOINs:
Achievements.achievement_type_code = Ref_Achievement_Type.achievement_type_code
Achievements.student_id = Students.student_id
Behaviour_Monitoring.student_id = Students.student_id
Classes.student_id = Students.student_id
Classes.teacher_id = Teachers.teacher_id
Detention.detention_type_code = Ref_Detention_Type.detention_type_code
Detention.student_id = Students.student_id
Student_Events.event_type_code = Ref_Event_Types.event_type_code
Student_Events.student_id = Students.student_id
Student_Loans.student_id = Students.student_id
Students_Addresses.address_id = Addresses.address_id
Students_Addresses.address_type_code = Ref_Address_Types.address_type_code
Students_Addresses.student_id = Students.student_id
Transcripts.student_id = Students.student_id
| TABLE Achievements (
Achievements.achievement_id (INTEGER),
Achievements.achievement_type_code (CHAR(15)),
Achievements.student_id (INTEGER),
Achievements.date_achievement (DATETIME(3)),
Achievements.achievement_details (VARCHAR(255)),
Achievements.other_details (VARCHAR(255)),
)
TABLE Addresses (
Addresses.address_id (INTEGER),
Addresses.address_details (VARCHAR(255)),
)
TABLE Behaviour_Monitoring (
Behaviour_Monitoring.behaviour_monitoring_id (INTEGER),
Behaviour_Monitoring.student_id (INTEGER),
Behaviour_Monitoring.behaviour_monitoring_details (VARCHAR(255)),
)
TABLE Classes (
Classes.class_id (INTEGER),
Classes.student_id (INTEGER),
Classes.teacher_id (INTEGER),
Classes.class_details (VARCHAR(255)),
)
TABLE Detention (
Detention.detention_id (INTEGER),
Detention.detention_type_code (CHAR(10)),
Detention.student_id (INTEGER),
Detention.datetime_detention_start (DATETIME(3)),
Detention.datetime_detention_end (DATETIME(3)),
Detention.detention_summary (VARCHAR(255)),
Detention.other_details (VARCHAR(255)),
)
TABLE Ref_Achievement_Type (
Ref_Achievement_Type.achievement_type_code (CHAR(15)),
Ref_Achievement_Type.achievement_type_description (VARCHAR(80)),
)
TABLE Ref_Address_Types (
Ref_Address_Types.address_type_code (CHAR(10)),
Ref_Address_Types.address_type_description (VARCHAR(255)),
)
TABLE Ref_Detention_Type (
Ref_Detention_Type.detention_type_code (CHAR(10)),
Ref_Detention_Type.detention_type_description (VARCHAR(80)),
)
TABLE Ref_Event_Types (
Ref_Event_Types.event_type_code (CHAR(10)),
Ref_Event_Types.event_type_description (VARCHAR(255)),
)
TABLE Student_Events (
Student_Events.event_id (INTEGER),
Student_Events.event_type_code (CHAR(10)),
Student_Events.student_id (INTEGER),
Student_Events.event_date (DATETIME(3)),
Student_Events.other_details (VARCHAR(255)),
)
TABLE Student_Loans (
Student_Loans.student_loan_id (INTEGER),
Student_Loans.student_id (INTEGER),
Student_Loans.date_of_loan (DATETIME(3)),
Student_Loans.amount_of_loan (DECIMAL(15,4)),
Student_Loans.other_details (VARCHAR(255)),
)
TABLE Students (
Students.student_id (INTEGER),
Students.bio_data (VARCHAR(255)),
Students.student_details (VARCHAR(255)),
)
TABLE Students_Addresses (
Students_Addresses.student_address_id (INTEGER),
Students_Addresses.address_id (INTEGER),
Students_Addresses.address_type_code (CHAR(10)),
Students_Addresses.student_id (INTEGER),
Students_Addresses.date_from (DATETIME(3)),
Students_Addresses.date_to (DATETIME(3)),
)
TABLE Teachers (
Teachers.teacher_id (INTEGER),
Teachers.teacher_details (VARCHAR(255)),
)
TABLE Transcripts (
Transcripts.transcript_id (INTEGER),
Transcripts.student_id (INTEGER),
Transcripts.date_of_transcript (DATETIME(3)),
Transcripts.transcript_details (VARCHAR(255)),
)
Possible JOINs:
Achievements.achievement_type_code = Ref_Achievement_Type.achievement_type_code
Achievements.student_id = Students.student_id
Behaviour_Monitoring.student_id = Students.student_id
Classes.student_id = Students.student_id
Classes.teacher_id = Teachers.teacher_id
Detention.detention_type_code = Ref_Detention_Type.detention_type_code
Detention.student_id = Students.student_id
Student_Events.event_type_code = Ref_Event_Types.event_type_code
Student_Events.student_id = Students.student_id
Student_Loans.student_id = Students.student_id
Students_Addresses.address_id = Addresses.address_id
Students_Addresses.address_type_code = Ref_Address_Types.address_type_code
Students_Addresses.student_id = Students.student_id
Transcripts.student_id = Students.student_id
| TABLE achievements (
achievements.achievement_id (INTEGER),
achievements.achievement_type_code (CHAR(15)),
achievements.student_id (INTEGER),
achievements.date_achievement (DATETIME(3)),
achievements.achievement_details (VARCHAR(255)),
achievements.other_details (VARCHAR(255)),
)
TABLE addresses (
addresses.address_id (INTEGER),
addresses.address_details (VARCHAR(255)),
)
TABLE behaviour_monitoring (
behaviour_monitoring.behaviour_monitoring_id (INTEGER),
behaviour_monitoring.student_id (INTEGER),
behaviour_monitoring.behaviour_monitoring_details (VARCHAR(255)),
)
TABLE classes (
classes.class_id (INTEGER),
classes.student_id (INTEGER),
classes.teacher_id (INTEGER),
classes.class_details (VARCHAR(255)),
)
TABLE detention (
detention.detention_id (INTEGER),
detention.detention_type_code (CHAR(10)),
detention.student_id (INTEGER),
detention.datetime_detention_start (DATETIME(3)),
detention.datetime_detention_end (DATETIME(3)),
detention.detention_summary (VARCHAR(255)),
detention.other_details (VARCHAR(255)),
)
TABLE ref_achievement_type (
ref_achievement_type.achievement_type_code (CHAR(15)),
ref_achievement_type.achievement_type_description (VARCHAR(80)),
)
TABLE ref_address_types (
ref_address_types.address_type_code (CHAR(10)),
ref_address_types.address_type_description (VARCHAR(255)),
)
TABLE ref_detention_type (
ref_detention_type.detention_type_code (CHAR(10)),
ref_detention_type.detention_type_description (VARCHAR(80)),
)
TABLE ref_event_types (
ref_event_types.event_type_code (CHAR(10)),
ref_event_types.event_type_description (VARCHAR(255)),
)
TABLE student_events (
student_events.event_id (INTEGER),
student_events.event_type_code (CHAR(10)),
student_events.student_id (INTEGER),
student_events.event_date (DATETIME(3)),
student_events.other_details (VARCHAR(255)),
)
TABLE student_loans (
student_loans.student_loan_id (INTEGER),
student_loans.student_id (INTEGER),
student_loans.date_of_loan (DATETIME(3)),
student_loans.amount_of_loan (DECIMAL(15,4)),
student_loans.other_details (VARCHAR(255)),
)
TABLE students (
students.student_id (INTEGER),
students.bio_data (VARCHAR(255)),
students.student_details (VARCHAR(255)),
)
TABLE students_addresses (
students_addresses.student_address_id (INTEGER),
students_addresses.address_id (INTEGER),
students_addresses.address_type_code (CHAR(10)),
students_addresses.student_id (INTEGER),
students_addresses.date_from (DATETIME(3)),
students_addresses.date_to (DATETIME(3)),
)
TABLE teachers (
teachers.teacher_id (INTEGER),
teachers.teacher_details (VARCHAR(255)),
)
TABLE transcripts (
transcripts.transcript_id (INTEGER),
transcripts.student_id (INTEGER),
transcripts.date_of_transcript (DATETIME(3)),
transcripts.transcript_details (VARCHAR(255)),
)
Possible JOINs:
achievements.achievement_type_code = ref_achievement_type.achievement_type_code
achievements.student_id = students.student_id
behaviour_monitoring.student_id = students.student_id
classes.student_id = students.student_id
classes.teacher_id = teachers.teacher_id
detention.detention_type_code = ref_detention_type.detention_type_code
detention.student_id = students.student_id
student_events.event_type_code = ref_event_types.event_type_code
student_events.student_id = students.student_id
student_loans.student_id = students.student_id
students_addresses.address_id = addresses.address_id
students_addresses.address_type_code = ref_address_types.address_type_code
students_addresses.student_id = students.student_id
transcripts.student_id = students.student_id
|
institution_sports |
CREATE TABLE "Championship" (
"Institution_ID" INTEGER,
"Nickname" TEXT,
"Joined" REAL,
"Number_of_Championships" REAL,
PRIMARY KEY ("Institution_ID"),
FOREIGN KEY("Institution_ID") REFERENCES institution ("Institution_ID")
)
CREATE TABLE institution (
"Institution_ID" INTEGER,
"Name" TEXT,
"Team" TEXT,
"City" TEXT,
"Province" TEXT,
"Founded" REAL,
"Affiliation" TEXT,
"Enrollment" REAL,
"Endowment" TEXT,
"Stadium" TEXT,
"Capacity" REAL,
PRIMARY KEY ("Institution_ID")
) | Return the nickname of the institution with the lowest enrollment. | hard | Table Championship (
Championship.Institution_ID (INT),
Championship.Nickname (TEXT),
Championship.Joined (REAL),
Championship.Number_of_Championships (REAL),
)
Table institution (
institution.Institution_ID (INT),
institution.Name (TEXT),
institution.Team (TEXT),
institution.City (TEXT),
institution.Province (TEXT),
institution.Founded (REAL),
institution.Affiliation (TEXT),
institution.Enrollment (REAL),
institution.Endowment (TEXT),
institution.Stadium (TEXT),
institution.Capacity (REAL),
)
Possible JOINs:
Championship.Institution_ID = institution.Institution_ID
| SELECT championship.Nickname FROM championship JOIN institution ON championship.Institution_ID = institution.Institution_ID ORDER BY institution.Enrollment ASC LIMIT 1 | {
'championship': ['institution_id', 'nickname'],
'institution': ['institution_id', 'enrollment']
} | CREATE TABLE Championship (
Championship.Institution_ID (INT),
Championship.Nickname (TEXT),
Championship.Joined (REAL),
Championship.Number_of_Championships (REAL),
)
CREATE TABLE institution (
institution.Institution_ID (INT),
institution.Name (TEXT),
institution.Team (TEXT),
institution.City (TEXT),
institution.Province (TEXT),
institution.Founded (REAL),
institution.Affiliation (TEXT),
institution.Enrollment (REAL),
institution.Endowment (TEXT),
institution.Stadium (TEXT),
institution.Capacity (REAL),
)
Possible JOINs:
Championship.Institution_ID = institution.Institution_ID
| Table Championship (
Championship.institution_id (INT),
Championship.nickname (TEXT),
Championship.joined (REAL),
Championship.number_of_championships (REAL),
)
Table institution (
institution.institution_id (INT),
institution.name (TEXT),
institution.team (TEXT),
institution.city (TEXT),
institution.province (TEXT),
institution.founded (REAL),
institution.affiliation (TEXT),
institution.enrollment (REAL),
institution.endowment (TEXT),
institution.stadium (TEXT),
institution.capacity (REAL),
)
Possible JOINs:
Championship.institution_id = institution.institution_id
| CREATE TABLE Championship (
Championship.institution_id (INT),
Championship.nickname (TEXT),
Championship.joined (REAL),
Championship.number_of_championships (REAL),
)
CREATE TABLE institution (
institution.institution_id (INT),
institution.name (TEXT),
institution.team (TEXT),
institution.city (TEXT),
institution.province (TEXT),
institution.founded (REAL),
institution.affiliation (TEXT),
institution.enrollment (REAL),
institution.endowment (TEXT),
institution.stadium (TEXT),
institution.capacity (REAL),
)
Possible JOINs:
Championship.institution_id = institution.institution_id
| Table championship (
championship.institution_id (INT),
championship.nickname (TEXT),
championship.joined (REAL),
championship.number_of_championships (REAL),
)
Table institution (
institution.institution_id (INT),
institution.name (TEXT),
institution.team (TEXT),
institution.city (TEXT),
institution.province (TEXT),
institution.founded (REAL),
institution.affiliation (TEXT),
institution.enrollment (REAL),
institution.endowment (TEXT),
institution.stadium (TEXT),
institution.capacity (REAL),
)
Possible JOINs:
championship.institution_id = institution.institution_id
| CREATE TABLE championship (
championship.institution_id (INT),
championship.nickname (TEXT),
championship.joined (REAL),
championship.number_of_championships (REAL),
)
CREATE TABLE institution (
institution.institution_id (INT),
institution.name (TEXT),
institution.team (TEXT),
institution.city (TEXT),
institution.province (TEXT),
institution.founded (REAL),
institution.affiliation (TEXT),
institution.enrollment (REAL),
institution.endowment (TEXT),
institution.stadium (TEXT),
institution.capacity (REAL),
)
Possible JOINs:
championship.institution_id = institution.institution_id
| {
'institution': ['Institution_ID', 'Name', 'Team', 'City', 'Province', 'Founded', 'Affiliation', 'Enrollment', 'Endowment', 'Stadium', 'Capacity'],
'Championship': ['Institution_ID', 'Nickname', 'Joined', 'Number_of_Championships']
} | {
'Championship': ['Institution_ID', 'Nickname'],
'institution': ['Institution_ID', 'Enrollment']
} | TABLE Championship (
Championship.Institution_ID (INT),
Championship.Nickname (TEXT),
Championship.Joined (REAL),
Championship.Number_of_Championships (REAL),
)
TABLE institution (
institution.Institution_ID (INT),
institution.Name (TEXT),
institution.Team (TEXT),
institution.City (TEXT),
institution.Province (TEXT),
institution.Founded (REAL),
institution.Affiliation (TEXT),
institution.Enrollment (REAL),
institution.Endowment (TEXT),
institution.Stadium (TEXT),
institution.Capacity (REAL),
)
Possible JOINs:
Championship.Institution_ID = institution.Institution_ID
| TABLE Championship (
Championship.institution_id (INT),
Championship.nickname (TEXT),
Championship.joined (REAL),
Championship.number_of_championships (REAL),
)
TABLE institution (
institution.institution_id (INT),
institution.name (TEXT),
institution.team (TEXT),
institution.city (TEXT),
institution.province (TEXT),
institution.founded (REAL),
institution.affiliation (TEXT),
institution.enrollment (REAL),
institution.endowment (TEXT),
institution.stadium (TEXT),
institution.capacity (REAL),
)
Possible JOINs:
Championship.institution_id = institution.institution_id
| TABLE championship (
championship.institution_id (INT),
championship.nickname (TEXT),
championship.joined (REAL),
championship.number_of_championships (REAL),
)
TABLE institution (
institution.institution_id (INT),
institution.name (TEXT),
institution.team (TEXT),
institution.city (TEXT),
institution.province (TEXT),
institution.founded (REAL),
institution.affiliation (TEXT),
institution.enrollment (REAL),
institution.endowment (TEXT),
institution.stadium (TEXT),
institution.capacity (REAL),
)
Possible JOINs:
championship.institution_id = institution.institution_id
|
warehouse_1 |
CREATE TABLE "Boxes" (
"Code" CHAR(4) NOT NULL,
"Contents" VARCHAR(255) NOT NULL,
"Value" REAL NOT NULL,
"Warehouse" INTEGER NOT NULL,
PRIMARY KEY ("Code"),
FOREIGN KEY("Warehouse") REFERENCES "Warehouses" ("Code")
)
CREATE TABLE "Warehouses" (
"Code" INTEGER NOT NULL,
"Location" VARCHAR(255) NOT NULL,
"Capacity" INTEGER NOT NULL,
PRIMARY KEY ("Code")
) | What is the content with the greatest value across all boxes? | medium | Table Boxes (
Boxes.Code (CHAR(4)),
Boxes.Contents (VARCHAR(255)),
Boxes.Value (REAL),
Boxes.Warehouse (INTEGER),
)
Table Warehouses (
Warehouses.Code (INTEGER),
Warehouses.Location (VARCHAR(255)),
Warehouses.Capacity (INTEGER),
)
Possible JOINs:
Boxes.Warehouse = Warehouses.Code
| SELECT CONTENTS FROM boxes ORDER BY value DESC LIMIT 1 | {
'boxes': ['code', 'contents', 'value']
} | CREATE TABLE Boxes (
Boxes.Code (CHAR(4)),
Boxes.Contents (VARCHAR(255)),
Boxes.Value (REAL),
Boxes.Warehouse (INTEGER),
)
CREATE TABLE Warehouses (
Warehouses.Code (INTEGER),
Warehouses.Location (VARCHAR(255)),
Warehouses.Capacity (INTEGER),
)
Possible JOINs:
Boxes.Warehouse = Warehouses.Code
| Table Boxes (
Boxes.code (CHAR(4)),
Boxes.contents (VARCHAR(255)),
Boxes.value (REAL),
Boxes.warehouse (INTEGER),
)
Table Warehouses (
Warehouses.code (INTEGER),
Warehouses.location (VARCHAR(255)),
Warehouses.capacity (INTEGER),
)
Possible JOINs:
Boxes.warehouse = Warehouses.code
| CREATE TABLE Boxes (
Boxes.code (CHAR(4)),
Boxes.contents (VARCHAR(255)),
Boxes.value (REAL),
Boxes.warehouse (INTEGER),
)
CREATE TABLE Warehouses (
Warehouses.code (INTEGER),
Warehouses.location (VARCHAR(255)),
Warehouses.capacity (INTEGER),
)
Possible JOINs:
Boxes.warehouse = Warehouses.code
| Table boxes (
boxes.code (CHAR(4)),
boxes.contents (VARCHAR(255)),
boxes.value (REAL),
boxes.warehouse (INTEGER),
)
Table warehouses (
warehouses.code (INTEGER),
warehouses.location (VARCHAR(255)),
warehouses.capacity (INTEGER),
)
Possible JOINs:
boxes.warehouse = warehouses.code
| CREATE TABLE boxes (
boxes.code (CHAR(4)),
boxes.contents (VARCHAR(255)),
boxes.value (REAL),
boxes.warehouse (INTEGER),
)
CREATE TABLE warehouses (
warehouses.code (INTEGER),
warehouses.location (VARCHAR(255)),
warehouses.capacity (INTEGER),
)
Possible JOINs:
boxes.warehouse = warehouses.code
| {
'Warehouses': ['Code', 'Location', 'Capacity'],
'Boxes': ['Code', 'Contents', 'Value', 'Warehouse']
} | {
'Boxes': ['Code', 'Contents', 'Value']
} | TABLE Boxes (
Boxes.Code (CHAR(4)),
Boxes.Contents (VARCHAR(255)),
Boxes.Value (REAL),
Boxes.Warehouse (INTEGER),
)
TABLE Warehouses (
Warehouses.Code (INTEGER),
Warehouses.Location (VARCHAR(255)),
Warehouses.Capacity (INTEGER),
)
Possible JOINs:
Boxes.Warehouse = Warehouses.Code
| TABLE Boxes (
Boxes.code (CHAR(4)),
Boxes.contents (VARCHAR(255)),
Boxes.value (REAL),
Boxes.warehouse (INTEGER),
)
TABLE Warehouses (
Warehouses.code (INTEGER),
Warehouses.location (VARCHAR(255)),
Warehouses.capacity (INTEGER),
)
Possible JOINs:
Boxes.warehouse = Warehouses.code
| TABLE boxes (
boxes.code (CHAR(4)),
boxes.contents (VARCHAR(255)),
boxes.value (REAL),
boxes.warehouse (INTEGER),
)
TABLE warehouses (
warehouses.code (INTEGER),
warehouses.location (VARCHAR(255)),
warehouses.capacity (INTEGER),
)
Possible JOINs:
boxes.warehouse = warehouses.code
|
government_shift |
CREATE TABLE "Analytical_Layer" (
"Analytical_ID" INTEGER NOT NULL,
"Customers_and_Services_ID" VARCHAR(40) NOT NULL,
"Pattern_Recognition" VARCHAR(255) NOT NULL,
"Analytical_Layer_Type_Code" CHAR(15),
PRIMARY KEY ("Analytical_ID"),
FOREIGN KEY("Customers_and_Services_ID") REFERENCES "Customers_and_Services" ("Customers_and_Services_ID")
)
CREATE TABLE "Channels" (
"Channel_ID" INTEGER NOT NULL,
"Channel_Details" VARCHAR(255) NOT NULL,
PRIMARY KEY ("Channel_ID")
)
CREATE TABLE "Customer_Interactions" (
"Customer_Interaction_ID" INTEGER NOT NULL,
"Channel_ID" INTEGER,
"Customer_ID" INTEGER,
"Service_ID" INTEGER,
"Status_Code" CHAR(15),
"Services_and_Channels_Details" VARCHAR(255),
PRIMARY KEY ("Customer_Interaction_ID"),
FOREIGN KEY("Service_ID") REFERENCES "Services" ("Service_ID"),
FOREIGN KEY("Channel_ID") REFERENCES "Channels" ("Channel_ID"),
FOREIGN KEY("Customer_ID") REFERENCES "Customers" ("Customer_ID")
)
CREATE TABLE "Customers" (
"Customer_ID" INTEGER NOT NULL,
"Customer_Details" VARCHAR(255) NOT NULL,
PRIMARY KEY ("Customer_ID")
)
CREATE TABLE "Customers_and_Services" (
"Customers_and_Services_ID" INTEGER NOT NULL,
"Customer_ID" INTEGER,
"Service_ID" INTEGER,
"Customers_and_Services_Details" CHAR(15) NOT NULL,
PRIMARY KEY ("Customers_and_Services_ID"),
FOREIGN KEY("Service_ID") REFERENCES "Services" ("Service_ID"),
FOREIGN KEY("Customer_ID") REFERENCES "Customers" ("Customer_ID")
)
CREATE TABLE "Integration_Platform" (
"Integration_Platform_ID" INTEGER NOT NULL,
"Customer_Interaction_ID" INTEGER NOT NULL,
"Integration_Platform_Details" VARCHAR(255) NOT NULL,
PRIMARY KEY ("Integration_Platform_ID"),
FOREIGN KEY("Customer_Interaction_ID") REFERENCES "Customer_Interactions" ("Customer_Interaction_ID")
)
CREATE TABLE "Services" (
"Service_ID" INTEGER NOT NULL,
"Service_Details" VARCHAR(255),
PRIMARY KEY ("Service_ID")
) | Which service ( s ) has never been used by any customer ? List their details . | hard | Table Analytical_Layer (
Analytical_Layer.Analytical_ID (INTEGER),
Analytical_Layer.Customers_and_Services_ID (VARCHAR(40)),
Analytical_Layer.Pattern_Recognition (VARCHAR(255)),
Analytical_Layer.Analytical_Layer_Type_Code (CHAR(15)),
)
Table Channels (
Channels.Channel_ID (INTEGER),
Channels.Channel_Details (VARCHAR(255)),
)
Table Customer_Interactions (
Customer_Interactions.Customer_Interaction_ID (INTEGER),
Customer_Interactions.Channel_ID (INTEGER),
Customer_Interactions.Customer_ID (INTEGER),
Customer_Interactions.Service_ID (INTEGER),
Customer_Interactions.Status_Code (CHAR(15)),
Customer_Interactions.Services_and_Channels_Details (VARCHAR(255)),
)
Table Customers (
Customers.Customer_ID (INTEGER),
Customers.Customer_Details (VARCHAR(255)),
)
Table Customers_and_Services (
Customers_and_Services.Customers_and_Services_ID (INTEGER),
Customers_and_Services.Customer_ID (INTEGER),
Customers_and_Services.Service_ID (INTEGER),
Customers_and_Services.Customers_and_Services_Details (CHAR(15)),
)
Table Integration_Platform (
Integration_Platform.Integration_Platform_ID (INTEGER),
Integration_Platform.Customer_Interaction_ID (INTEGER),
Integration_Platform.Integration_Platform_Details (VARCHAR(255)),
)
Table Services (
Services.Service_ID (INTEGER),
Services.Service_Details (VARCHAR(255)),
)
Possible JOINs:
Analytical_Layer.Customers_and_Services_ID = Customers_and_Services.Customers_and_Services_ID
Customer_Interactions.Channel_ID = Channels.Channel_ID
Customer_Interactions.Customer_ID = Customers.Customer_ID
Customer_Interactions.Service_ID = Services.Service_ID
Customers_and_Services.Customer_ID = Customers.Customer_ID
Customers_and_Services.Service_ID = Services.Service_ID
Integration_Platform.Customer_Interaction_ID = Customer_Interactions.Customer_Interaction_ID
| SELECT service_details FROM services EXCEPT SELECT services.service_details FROM customers_and_services JOIN services ON customers_and_services.service_id = services.service_id | {
'services': ['service_id', 'service_details'],
'customers_and_services': ['customers_and_services_id', 'service_id']
} | CREATE TABLE Analytical_Layer (
Analytical_Layer.Analytical_ID (INTEGER),
Analytical_Layer.Customers_and_Services_ID (VARCHAR(40)),
Analytical_Layer.Pattern_Recognition (VARCHAR(255)),
Analytical_Layer.Analytical_Layer_Type_Code (CHAR(15)),
)
CREATE TABLE Channels (
Channels.Channel_ID (INTEGER),
Channels.Channel_Details (VARCHAR(255)),
)
CREATE TABLE Customer_Interactions (
Customer_Interactions.Customer_Interaction_ID (INTEGER),
Customer_Interactions.Channel_ID (INTEGER),
Customer_Interactions.Customer_ID (INTEGER),
Customer_Interactions.Service_ID (INTEGER),
Customer_Interactions.Status_Code (CHAR(15)),
Customer_Interactions.Services_and_Channels_Details (VARCHAR(255)),
)
CREATE TABLE Customers (
Customers.Customer_ID (INTEGER),
Customers.Customer_Details (VARCHAR(255)),
)
CREATE TABLE Customers_and_Services (
Customers_and_Services.Customers_and_Services_ID (INTEGER),
Customers_and_Services.Customer_ID (INTEGER),
Customers_and_Services.Service_ID (INTEGER),
Customers_and_Services.Customers_and_Services_Details (CHAR(15)),
)
CREATE TABLE Integration_Platform (
Integration_Platform.Integration_Platform_ID (INTEGER),
Integration_Platform.Customer_Interaction_ID (INTEGER),
Integration_Platform.Integration_Platform_Details (VARCHAR(255)),
)
CREATE TABLE Services (
Services.Service_ID (INTEGER),
Services.Service_Details (VARCHAR(255)),
)
Possible JOINs:
Analytical_Layer.Customers_and_Services_ID = Customers_and_Services.Customers_and_Services_ID
Customer_Interactions.Channel_ID = Channels.Channel_ID
Customer_Interactions.Customer_ID = Customers.Customer_ID
Customer_Interactions.Service_ID = Services.Service_ID
Customers_and_Services.Customer_ID = Customers.Customer_ID
Customers_and_Services.Service_ID = Services.Service_ID
Integration_Platform.Customer_Interaction_ID = Customer_Interactions.Customer_Interaction_ID
| Table Analytical_Layer (
Analytical_Layer.analytical_id (INTEGER),
Analytical_Layer.customers_and_services_id (VARCHAR(40)),
Analytical_Layer.pattern_recognition (VARCHAR(255)),
Analytical_Layer.analytical_layer_type_code (CHAR(15)),
)
Table Channels (
Channels.channel_id (INTEGER),
Channels.channel_details (VARCHAR(255)),
)
Table Customer_Interactions (
Customer_Interactions.customer_interaction_id (INTEGER),
Customer_Interactions.channel_id (INTEGER),
Customer_Interactions.customer_id (INTEGER),
Customer_Interactions.service_id (INTEGER),
Customer_Interactions.status_code (CHAR(15)),
Customer_Interactions.services_and_channels_details (VARCHAR(255)),
)
Table Customers (
Customers.customer_id (INTEGER),
Customers.customer_details (VARCHAR(255)),
)
Table Customers_and_Services (
Customers_and_Services.customers_and_services_id (INTEGER),
Customers_and_Services.customer_id (INTEGER),
Customers_and_Services.service_id (INTEGER),
Customers_and_Services.customers_and_services_details (CHAR(15)),
)
Table Integration_Platform (
Integration_Platform.integration_platform_id (INTEGER),
Integration_Platform.customer_interaction_id (INTEGER),
Integration_Platform.integration_platform_details (VARCHAR(255)),
)
Table Services (
Services.service_id (INTEGER),
Services.service_details (VARCHAR(255)),
)
Possible JOINs:
Analytical_Layer.customers_and_services_id = Customers_and_Services.customers_and_services_id
Customer_Interactions.channel_id = Channels.channel_id
Customer_Interactions.customer_id = Customers.customer_id
Customer_Interactions.service_id = Services.service_id
Customers_and_Services.customer_id = Customers.customer_id
Customers_and_Services.service_id = Services.service_id
Integration_Platform.customer_interaction_id = Customer_Interactions.customer_interaction_id
| CREATE TABLE Analytical_Layer (
Analytical_Layer.analytical_id (INTEGER),
Analytical_Layer.customers_and_services_id (VARCHAR(40)),
Analytical_Layer.pattern_recognition (VARCHAR(255)),
Analytical_Layer.analytical_layer_type_code (CHAR(15)),
)
CREATE TABLE Channels (
Channels.channel_id (INTEGER),
Channels.channel_details (VARCHAR(255)),
)
CREATE TABLE Customer_Interactions (
Customer_Interactions.customer_interaction_id (INTEGER),
Customer_Interactions.channel_id (INTEGER),
Customer_Interactions.customer_id (INTEGER),
Customer_Interactions.service_id (INTEGER),
Customer_Interactions.status_code (CHAR(15)),
Customer_Interactions.services_and_channels_details (VARCHAR(255)),
)
CREATE TABLE Customers (
Customers.customer_id (INTEGER),
Customers.customer_details (VARCHAR(255)),
)
CREATE TABLE Customers_and_Services (
Customers_and_Services.customers_and_services_id (INTEGER),
Customers_and_Services.customer_id (INTEGER),
Customers_and_Services.service_id (INTEGER),
Customers_and_Services.customers_and_services_details (CHAR(15)),
)
CREATE TABLE Integration_Platform (
Integration_Platform.integration_platform_id (INTEGER),
Integration_Platform.customer_interaction_id (INTEGER),
Integration_Platform.integration_platform_details (VARCHAR(255)),
)
CREATE TABLE Services (
Services.service_id (INTEGER),
Services.service_details (VARCHAR(255)),
)
Possible JOINs:
Analytical_Layer.customers_and_services_id = Customers_and_Services.customers_and_services_id
Customer_Interactions.channel_id = Channels.channel_id
Customer_Interactions.customer_id = Customers.customer_id
Customer_Interactions.service_id = Services.service_id
Customers_and_Services.customer_id = Customers.customer_id
Customers_and_Services.service_id = Services.service_id
Integration_Platform.customer_interaction_id = Customer_Interactions.customer_interaction_id
| Table analytical_layer (
analytical_layer.analytical_id (INTEGER),
analytical_layer.customers_and_services_id (VARCHAR(40)),
analytical_layer.pattern_recognition (VARCHAR(255)),
analytical_layer.analytical_layer_type_code (CHAR(15)),
)
Table channels (
channels.channel_id (INTEGER),
channels.channel_details (VARCHAR(255)),
)
Table customer_interactions (
customer_interactions.customer_interaction_id (INTEGER),
customer_interactions.channel_id (INTEGER),
customer_interactions.customer_id (INTEGER),
customer_interactions.service_id (INTEGER),
customer_interactions.status_code (CHAR(15)),
customer_interactions.services_and_channels_details (VARCHAR(255)),
)
Table customers (
customers.customer_id (INTEGER),
customers.customer_details (VARCHAR(255)),
)
Table customers_and_services (
customers_and_services.customers_and_services_id (INTEGER),
customers_and_services.customer_id (INTEGER),
customers_and_services.service_id (INTEGER),
customers_and_services.customers_and_services_details (CHAR(15)),
)
Table integration_platform (
integration_platform.integration_platform_id (INTEGER),
integration_platform.customer_interaction_id (INTEGER),
integration_platform.integration_platform_details (VARCHAR(255)),
)
Table services (
services.service_id (INTEGER),
services.service_details (VARCHAR(255)),
)
Possible JOINs:
analytical_layer.customers_and_services_id = customers_and_services.customers_and_services_id
customer_interactions.channel_id = channels.channel_id
customer_interactions.customer_id = customers.customer_id
customer_interactions.service_id = services.service_id
customers_and_services.customer_id = customers.customer_id
customers_and_services.service_id = services.service_id
integration_platform.customer_interaction_id = customer_interactions.customer_interaction_id
| CREATE TABLE analytical_layer (
analytical_layer.analytical_id (INTEGER),
analytical_layer.customers_and_services_id (VARCHAR(40)),
analytical_layer.pattern_recognition (VARCHAR(255)),
analytical_layer.analytical_layer_type_code (CHAR(15)),
)
CREATE TABLE channels (
channels.channel_id (INTEGER),
channels.channel_details (VARCHAR(255)),
)
CREATE TABLE customer_interactions (
customer_interactions.customer_interaction_id (INTEGER),
customer_interactions.channel_id (INTEGER),
customer_interactions.customer_id (INTEGER),
customer_interactions.service_id (INTEGER),
customer_interactions.status_code (CHAR(15)),
customer_interactions.services_and_channels_details (VARCHAR(255)),
)
CREATE TABLE customers (
customers.customer_id (INTEGER),
customers.customer_details (VARCHAR(255)),
)
CREATE TABLE customers_and_services (
customers_and_services.customers_and_services_id (INTEGER),
customers_and_services.customer_id (INTEGER),
customers_and_services.service_id (INTEGER),
customers_and_services.customers_and_services_details (CHAR(15)),
)
CREATE TABLE integration_platform (
integration_platform.integration_platform_id (INTEGER),
integration_platform.customer_interaction_id (INTEGER),
integration_platform.integration_platform_details (VARCHAR(255)),
)
CREATE TABLE services (
services.service_id (INTEGER),
services.service_details (VARCHAR(255)),
)
Possible JOINs:
analytical_layer.customers_and_services_id = customers_and_services.customers_and_services_id
customer_interactions.channel_id = channels.channel_id
customer_interactions.customer_id = customers.customer_id
customer_interactions.service_id = services.service_id
customers_and_services.customer_id = customers.customer_id
customers_and_services.service_id = services.service_id
integration_platform.customer_interaction_id = customer_interactions.customer_interaction_id
| {
'Services': ['Service_ID', 'Service_Details'],
'Customers': ['Customer_ID', 'Customer_Details'],
'Channels': ['Channel_ID', 'Channel_Details'],
'Customers_and_Services': ['Customers_and_Services_ID', 'Customer_ID', 'Service_ID', 'Customers_and_Services_Details'],
'Customer_Interactions': ['Customer_Interaction_ID', 'Channel_ID', 'Customer_ID', 'Service_ID', 'Status_Code', 'Services_and_Channels_Details'],
'Integration_Platform': ['Integration_Platform_ID', 'Customer_Interaction_ID', 'Integration_Platform_Details'],
'Analytical_Layer': ['Analytical_ID', 'Customers_and_Services_ID', 'Pattern_Recognition', 'Analytical_Layer_Type_Code']
} | {
'Services': ['Service_ID', 'Service_Details'],
'Customers_and_Services': ['Customers_and_Services_ID', 'Service_ID']
} | TABLE Analytical_Layer (
Analytical_Layer.Analytical_ID (INTEGER),
Analytical_Layer.Customers_and_Services_ID (VARCHAR(40)),
Analytical_Layer.Pattern_Recognition (VARCHAR(255)),
Analytical_Layer.Analytical_Layer_Type_Code (CHAR(15)),
)
TABLE Channels (
Channels.Channel_ID (INTEGER),
Channels.Channel_Details (VARCHAR(255)),
)
TABLE Customer_Interactions (
Customer_Interactions.Customer_Interaction_ID (INTEGER),
Customer_Interactions.Channel_ID (INTEGER),
Customer_Interactions.Customer_ID (INTEGER),
Customer_Interactions.Service_ID (INTEGER),
Customer_Interactions.Status_Code (CHAR(15)),
Customer_Interactions.Services_and_Channels_Details (VARCHAR(255)),
)
TABLE Customers (
Customers.Customer_ID (INTEGER),
Customers.Customer_Details (VARCHAR(255)),
)
TABLE Customers_and_Services (
Customers_and_Services.Customers_and_Services_ID (INTEGER),
Customers_and_Services.Customer_ID (INTEGER),
Customers_and_Services.Service_ID (INTEGER),
Customers_and_Services.Customers_and_Services_Details (CHAR(15)),
)
TABLE Integration_Platform (
Integration_Platform.Integration_Platform_ID (INTEGER),
Integration_Platform.Customer_Interaction_ID (INTEGER),
Integration_Platform.Integration_Platform_Details (VARCHAR(255)),
)
TABLE Services (
Services.Service_ID (INTEGER),
Services.Service_Details (VARCHAR(255)),
)
Possible JOINs:
Analytical_Layer.Customers_and_Services_ID = Customers_and_Services.Customers_and_Services_ID
Customer_Interactions.Channel_ID = Channels.Channel_ID
Customer_Interactions.Customer_ID = Customers.Customer_ID
Customer_Interactions.Service_ID = Services.Service_ID
Customers_and_Services.Customer_ID = Customers.Customer_ID
Customers_and_Services.Service_ID = Services.Service_ID
Integration_Platform.Customer_Interaction_ID = Customer_Interactions.Customer_Interaction_ID
| TABLE Analytical_Layer (
Analytical_Layer.analytical_id (INTEGER),
Analytical_Layer.customers_and_services_id (VARCHAR(40)),
Analytical_Layer.pattern_recognition (VARCHAR(255)),
Analytical_Layer.analytical_layer_type_code (CHAR(15)),
)
TABLE Channels (
Channels.channel_id (INTEGER),
Channels.channel_details (VARCHAR(255)),
)
TABLE Customer_Interactions (
Customer_Interactions.customer_interaction_id (INTEGER),
Customer_Interactions.channel_id (INTEGER),
Customer_Interactions.customer_id (INTEGER),
Customer_Interactions.service_id (INTEGER),
Customer_Interactions.status_code (CHAR(15)),
Customer_Interactions.services_and_channels_details (VARCHAR(255)),
)
TABLE Customers (
Customers.customer_id (INTEGER),
Customers.customer_details (VARCHAR(255)),
)
TABLE Customers_and_Services (
Customers_and_Services.customers_and_services_id (INTEGER),
Customers_and_Services.customer_id (INTEGER),
Customers_and_Services.service_id (INTEGER),
Customers_and_Services.customers_and_services_details (CHAR(15)),
)
TABLE Integration_Platform (
Integration_Platform.integration_platform_id (INTEGER),
Integration_Platform.customer_interaction_id (INTEGER),
Integration_Platform.integration_platform_details (VARCHAR(255)),
)
TABLE Services (
Services.service_id (INTEGER),
Services.service_details (VARCHAR(255)),
)
Possible JOINs:
Analytical_Layer.customers_and_services_id = Customers_and_Services.customers_and_services_id
Customer_Interactions.channel_id = Channels.channel_id
Customer_Interactions.customer_id = Customers.customer_id
Customer_Interactions.service_id = Services.service_id
Customers_and_Services.customer_id = Customers.customer_id
Customers_and_Services.service_id = Services.service_id
Integration_Platform.customer_interaction_id = Customer_Interactions.customer_interaction_id
| TABLE analytical_layer (
analytical_layer.analytical_id (INTEGER),
analytical_layer.customers_and_services_id (VARCHAR(40)),
analytical_layer.pattern_recognition (VARCHAR(255)),
analytical_layer.analytical_layer_type_code (CHAR(15)),
)
TABLE channels (
channels.channel_id (INTEGER),
channels.channel_details (VARCHAR(255)),
)
TABLE customer_interactions (
customer_interactions.customer_interaction_id (INTEGER),
customer_interactions.channel_id (INTEGER),
customer_interactions.customer_id (INTEGER),
customer_interactions.service_id (INTEGER),
customer_interactions.status_code (CHAR(15)),
customer_interactions.services_and_channels_details (VARCHAR(255)),
)
TABLE customers (
customers.customer_id (INTEGER),
customers.customer_details (VARCHAR(255)),
)
TABLE customers_and_services (
customers_and_services.customers_and_services_id (INTEGER),
customers_and_services.customer_id (INTEGER),
customers_and_services.service_id (INTEGER),
customers_and_services.customers_and_services_details (CHAR(15)),
)
TABLE integration_platform (
integration_platform.integration_platform_id (INTEGER),
integration_platform.customer_interaction_id (INTEGER),
integration_platform.integration_platform_details (VARCHAR(255)),
)
TABLE services (
services.service_id (INTEGER),
services.service_details (VARCHAR(255)),
)
Possible JOINs:
analytical_layer.customers_and_services_id = customers_and_services.customers_and_services_id
customer_interactions.channel_id = channels.channel_id
customer_interactions.customer_id = customers.customer_id
customer_interactions.service_id = services.service_id
customers_and_services.customer_id = customers.customer_id
customers_and_services.service_id = services.service_id
integration_platform.customer_interaction_id = customer_interactions.customer_interaction_id
|
book_press |
CREATE TABLE author (
"Author_ID" INTEGER,
"Name" TEXT,
"Age" INTEGER,
"Gender" TEXT,
PRIMARY KEY ("Author_ID")
)
CREATE TABLE book (
"Book_ID" INTEGER,
"Title" TEXT,
"Book_Series" TEXT,
"Author_ID" INTEGER,
"Press_ID" INTEGER,
"Sale_Amount" TEXT,
"Release_date" TEXT,
PRIMARY KEY ("Book_ID"),
FOREIGN KEY("Press_ID") REFERENCES press ("Press_ID"),
FOREIGN KEY("Author_ID") REFERENCES author ("Author_ID")
)
CREATE TABLE press (
"Press_ID" INTEGER,
"Name" TEXT,
"Month_Profits_billion" REAL,
"Year_Profits_billion" REAL,
PRIMARY KEY ("Press_ID")
) | list all the names of press in descending order of the profit of the year. | easy | Table author (
author.Author_ID (INT),
author.Name (TEXT),
author.Age (INT),
author.Gender (TEXT),
)
Table book (
book.Book_ID (INT),
book.Title (TEXT),
book.Book_Series (TEXT),
book.Author_ID (INT),
book.Press_ID (INT),
book.Sale_Amount (TEXT),
book.Release_date (TEXT),
)
Table press (
press.Press_ID (INT),
press.Name (TEXT),
press.Month_Profits_billion (REAL),
press.Year_Profits_billion (REAL),
)
Possible JOINs:
book.Author_ID = author.Author_ID
book.Press_ID = press.Press_ID
| SELECT name FROM press ORDER BY Year_Profits_billion DESC | {
'press': ['press_id', 'name', 'year_profits_billion']
} | CREATE TABLE author (
author.Author_ID (INT),
author.Name (TEXT),
author.Age (INT),
author.Gender (TEXT),
)
CREATE TABLE book (
book.Book_ID (INT),
book.Title (TEXT),
book.Book_Series (TEXT),
book.Author_ID (INT),
book.Press_ID (INT),
book.Sale_Amount (TEXT),
book.Release_date (TEXT),
)
CREATE TABLE press (
press.Press_ID (INT),
press.Name (TEXT),
press.Month_Profits_billion (REAL),
press.Year_Profits_billion (REAL),
)
Possible JOINs:
book.Author_ID = author.Author_ID
book.Press_ID = press.Press_ID
| Table author (
author.author_id (INT),
author.name (TEXT),
author.age (INT),
author.gender (TEXT),
)
Table book (
book.book_id (INT),
book.title (TEXT),
book.book_series (TEXT),
book.author_id (INT),
book.press_id (INT),
book.sale_amount (TEXT),
book.release_date (TEXT),
)
Table press (
press.press_id (INT),
press.name (TEXT),
press.month_profits_billion (REAL),
press.year_profits_billion (REAL),
)
Possible JOINs:
book.author_id = author.author_id
book.press_id = press.press_id
| CREATE TABLE author (
author.author_id (INT),
author.name (TEXT),
author.age (INT),
author.gender (TEXT),
)
CREATE TABLE book (
book.book_id (INT),
book.title (TEXT),
book.book_series (TEXT),
book.author_id (INT),
book.press_id (INT),
book.sale_amount (TEXT),
book.release_date (TEXT),
)
CREATE TABLE press (
press.press_id (INT),
press.name (TEXT),
press.month_profits_billion (REAL),
press.year_profits_billion (REAL),
)
Possible JOINs:
book.author_id = author.author_id
book.press_id = press.press_id
| Table author (
author.author_id (INT),
author.name (TEXT),
author.age (INT),
author.gender (TEXT),
)
Table book (
book.book_id (INT),
book.title (TEXT),
book.book_series (TEXT),
book.author_id (INT),
book.press_id (INT),
book.sale_amount (TEXT),
book.release_date (TEXT),
)
Table press (
press.press_id (INT),
press.name (TEXT),
press.month_profits_billion (REAL),
press.year_profits_billion (REAL),
)
Possible JOINs:
book.author_id = author.author_id
book.press_id = press.press_id
| CREATE TABLE author (
author.author_id (INT),
author.name (TEXT),
author.age (INT),
author.gender (TEXT),
)
CREATE TABLE book (
book.book_id (INT),
book.title (TEXT),
book.book_series (TEXT),
book.author_id (INT),
book.press_id (INT),
book.sale_amount (TEXT),
book.release_date (TEXT),
)
CREATE TABLE press (
press.press_id (INT),
press.name (TEXT),
press.month_profits_billion (REAL),
press.year_profits_billion (REAL),
)
Possible JOINs:
book.author_id = author.author_id
book.press_id = press.press_id
| {
'author': ['Author_ID', 'Name', 'Age', 'Gender'],
'press': ['Press_ID', 'Name', 'Month_Profits_billion', 'Year_Profits_billion'],
'book': ['Book_ID', 'Title', 'Book_Series', 'Author_ID', 'Press_ID', 'Sale_Amount', 'Release_date']
} | {
'press': ['Press_ID', 'Name', 'Year_Profits_billion']
} | TABLE author (
author.Author_ID (INT),
author.Name (TEXT),
author.Age (INT),
author.Gender (TEXT),
)
TABLE book (
book.Book_ID (INT),
book.Title (TEXT),
book.Book_Series (TEXT),
book.Author_ID (INT),
book.Press_ID (INT),
book.Sale_Amount (TEXT),
book.Release_date (TEXT),
)
TABLE press (
press.Press_ID (INT),
press.Name (TEXT),
press.Month_Profits_billion (REAL),
press.Year_Profits_billion (REAL),
)
Possible JOINs:
book.Author_ID = author.Author_ID
book.Press_ID = press.Press_ID
| TABLE author (
author.author_id (INT),
author.name (TEXT),
author.age (INT),
author.gender (TEXT),
)
TABLE book (
book.book_id (INT),
book.title (TEXT),
book.book_series (TEXT),
book.author_id (INT),
book.press_id (INT),
book.sale_amount (TEXT),
book.release_date (TEXT),
)
TABLE press (
press.press_id (INT),
press.name (TEXT),
press.month_profits_billion (REAL),
press.year_profits_billion (REAL),
)
Possible JOINs:
book.author_id = author.author_id
book.press_id = press.press_id
| TABLE author (
author.author_id (INT),
author.name (TEXT),
author.age (INT),
author.gender (TEXT),
)
TABLE book (
book.book_id (INT),
book.title (TEXT),
book.book_series (TEXT),
book.author_id (INT),
book.press_id (INT),
book.sale_amount (TEXT),
book.release_date (TEXT),
)
TABLE press (
press.press_id (INT),
press.name (TEXT),
press.month_profits_billion (REAL),
press.year_profits_billion (REAL),
)
Possible JOINs:
book.author_id = author.author_id
book.press_id = press.press_id
|
planet_1 |
CREATE TABLE "Client" (
"AccountNumber" INTEGER,
"Name" VARCHAR(255) NOT NULL,
PRIMARY KEY ("AccountNumber")
)
CREATE TABLE "Employee" (
"EmployeeID" INTEGER,
"Name" VARCHAR(255) NOT NULL,
"Position" VARCHAR(255) NOT NULL,
"Salary" REAL NOT NULL,
"Remarks" VARCHAR(255),
PRIMARY KEY ("EmployeeID")
)
CREATE TABLE "Has_Clearance" (
"Employee" INTEGER NOT NULL,
"Planet" INTEGER NOT NULL,
"Level" INTEGER NOT NULL,
PRIMARY KEY ("Employee", "Planet"),
FOREIGN KEY("Employee") REFERENCES "Employee" ("EmployeeID"),
FOREIGN KEY("Planet") REFERENCES "Planet" ("PlanetID")
)
CREATE TABLE "Package" (
"Shipment" INTEGER NOT NULL,
"PackageNumber" INTEGER NOT NULL,
"Contents" VARCHAR(255) NOT NULL,
"Weight" REAL NOT NULL,
"Sender" INTEGER NOT NULL,
"Recipient" INTEGER NOT NULL,
PRIMARY KEY ("Shipment", "PackageNumber"),
FOREIGN KEY("Shipment") REFERENCES "Shipment" ("ShipmentID"),
FOREIGN KEY("Sender") REFERENCES "Client" ("AccountNumber"),
FOREIGN KEY("Recipient") REFERENCES "Client" ("AccountNumber")
)
CREATE TABLE "Planet" (
"PlanetID" INTEGER,
"Name" VARCHAR(255) NOT NULL,
"Coordinates" REAL NOT NULL,
PRIMARY KEY ("PlanetID")
)
CREATE TABLE "Shipment" (
"ShipmentID" INTEGER,
"Date" DATE,
"Manager" INTEGER NOT NULL,
"Planet" INTEGER NOT NULL,
PRIMARY KEY ("ShipmentID"),
FOREIGN KEY("Manager") REFERENCES "Employee" ("EmployeeID"),
FOREIGN KEY("Planet") REFERENCES "Planet" ("PlanetID")
) | List Package Number of all package sent by Leo Wong? | medium | Table Client (
Client.AccountNumber (INTEGER),
Client.Name (VARCHAR(255)),
)
Table Employee (
Employee.EmployeeID (INTEGER),
Employee.Name (VARCHAR(255)),
Employee.Position (VARCHAR(255)),
Employee.Salary (REAL),
Employee.Remarks (VARCHAR(255)),
)
Table Has_Clearance (
Has_Clearance.Employee (INTEGER),
Has_Clearance.Planet (INTEGER),
Has_Clearance.Level (INTEGER),
)
Table Package (
Package.Shipment (INTEGER),
Package.PackageNumber (INTEGER),
Package.Contents (VARCHAR(255)),
Package.Weight (REAL),
Package.Sender (INTEGER),
Package.Recipient (INTEGER),
)
Table Planet (
Planet.PlanetID (INTEGER),
Planet.Name (VARCHAR(255)),
Planet.Coordinates (REAL),
)
Table Shipment (
Shipment.ShipmentID (INTEGER),
Shipment.Date (DATE),
Shipment.Manager (INTEGER),
Shipment.Planet (INTEGER),
)
Possible JOINs:
Has_Clearance.Employee = Employee.EmployeeID
Has_Clearance.Planet = Planet.PlanetID
Package.Shipment = Shipment.ShipmentID
Package.Sender = Client.AccountNumber
Package.Recipient = Client.AccountNumber
Shipment.Manager = Employee.EmployeeID
Shipment.Planet = Planet.PlanetID
| SELECT T1.PackageNumber FROM PACKAGE AS T1 JOIN Client ON T1.Sender = Client.AccountNumber WHERE Client.Name = "Leo Wong"; | {
'package': ['shipment'],
'client': ['accountnumber', 'name']
} | CREATE TABLE Client (
Client.AccountNumber (INTEGER),
Client.Name (VARCHAR(255)),
)
CREATE TABLE Employee (
Employee.EmployeeID (INTEGER),
Employee.Name (VARCHAR(255)),
Employee.Position (VARCHAR(255)),
Employee.Salary (REAL),
Employee.Remarks (VARCHAR(255)),
)
CREATE TABLE Has_Clearance (
Has_Clearance.Employee (INTEGER),
Has_Clearance.Planet (INTEGER),
Has_Clearance.Level (INTEGER),
)
CREATE TABLE Package (
Package.Shipment (INTEGER),
Package.PackageNumber (INTEGER),
Package.Contents (VARCHAR(255)),
Package.Weight (REAL),
Package.Sender (INTEGER),
Package.Recipient (INTEGER),
)
CREATE TABLE Planet (
Planet.PlanetID (INTEGER),
Planet.Name (VARCHAR(255)),
Planet.Coordinates (REAL),
)
CREATE TABLE Shipment (
Shipment.ShipmentID (INTEGER),
Shipment.Date (DATE),
Shipment.Manager (INTEGER),
Shipment.Planet (INTEGER),
)
Possible JOINs:
Has_Clearance.Employee = Employee.EmployeeID
Has_Clearance.Planet = Planet.PlanetID
Package.Shipment = Shipment.ShipmentID
Package.Sender = Client.AccountNumber
Package.Recipient = Client.AccountNumber
Shipment.Manager = Employee.EmployeeID
Shipment.Planet = Planet.PlanetID
| Table Client (
Client.accountnumber (INTEGER),
Client.name (VARCHAR(255)),
)
Table Employee (
Employee.employeeid (INTEGER),
Employee.name (VARCHAR(255)),
Employee.position (VARCHAR(255)),
Employee.salary (REAL),
Employee.remarks (VARCHAR(255)),
)
Table Has_Clearance (
Has_Clearance.employee (INTEGER),
Has_Clearance.planet (INTEGER),
Has_Clearance.level (INTEGER),
)
Table Package (
Package.shipment (INTEGER),
Package.packagenumber (INTEGER),
Package.contents (VARCHAR(255)),
Package.weight (REAL),
Package.sender (INTEGER),
Package.recipient (INTEGER),
)
Table Planet (
Planet.planetid (INTEGER),
Planet.name (VARCHAR(255)),
Planet.coordinates (REAL),
)
Table Shipment (
Shipment.shipmentid (INTEGER),
Shipment.date (DATE),
Shipment.manager (INTEGER),
Shipment.planet (INTEGER),
)
Possible JOINs:
Has_Clearance.employee = Employee.employeeid
Has_Clearance.planet = Planet.planetid
Package.shipment = Shipment.shipmentid
Package.sender = Client.accountnumber
Package.recipient = Client.accountnumber
Shipment.manager = Employee.employeeid
Shipment.planet = Planet.planetid
| CREATE TABLE Client (
Client.accountnumber (INTEGER),
Client.name (VARCHAR(255)),
)
CREATE TABLE Employee (
Employee.employeeid (INTEGER),
Employee.name (VARCHAR(255)),
Employee.position (VARCHAR(255)),
Employee.salary (REAL),
Employee.remarks (VARCHAR(255)),
)
CREATE TABLE Has_Clearance (
Has_Clearance.employee (INTEGER),
Has_Clearance.planet (INTEGER),
Has_Clearance.level (INTEGER),
)
CREATE TABLE Package (
Package.shipment (INTEGER),
Package.packagenumber (INTEGER),
Package.contents (VARCHAR(255)),
Package.weight (REAL),
Package.sender (INTEGER),
Package.recipient (INTEGER),
)
CREATE TABLE Planet (
Planet.planetid (INTEGER),
Planet.name (VARCHAR(255)),
Planet.coordinates (REAL),
)
CREATE TABLE Shipment (
Shipment.shipmentid (INTEGER),
Shipment.date (DATE),
Shipment.manager (INTEGER),
Shipment.planet (INTEGER),
)
Possible JOINs:
Has_Clearance.employee = Employee.employeeid
Has_Clearance.planet = Planet.planetid
Package.shipment = Shipment.shipmentid
Package.sender = Client.accountnumber
Package.recipient = Client.accountnumber
Shipment.manager = Employee.employeeid
Shipment.planet = Planet.planetid
| Table client (
client.accountnumber (INTEGER),
client.name (VARCHAR(255)),
)
Table employee (
employee.employeeid (INTEGER),
employee.name (VARCHAR(255)),
employee.position (VARCHAR(255)),
employee.salary (REAL),
employee.remarks (VARCHAR(255)),
)
Table has_clearance (
has_clearance.employee (INTEGER),
has_clearance.planet (INTEGER),
has_clearance.level (INTEGER),
)
Table package (
package.shipment (INTEGER),
package.packagenumber (INTEGER),
package.contents (VARCHAR(255)),
package.weight (REAL),
package.sender (INTEGER),
package.recipient (INTEGER),
)
Table planet (
planet.planetid (INTEGER),
planet.name (VARCHAR(255)),
planet.coordinates (REAL),
)
Table shipment (
shipment.shipmentid (INTEGER),
shipment.date (DATE),
shipment.manager (INTEGER),
shipment.planet (INTEGER),
)
Possible JOINs:
has_clearance.employee = employee.employeeid
has_clearance.planet = planet.planetid
package.shipment = shipment.shipmentid
package.sender = client.accountnumber
package.recipient = client.accountnumber
shipment.manager = employee.employeeid
shipment.planet = planet.planetid
| CREATE TABLE client (
client.accountnumber (INTEGER),
client.name (VARCHAR(255)),
)
CREATE TABLE employee (
employee.employeeid (INTEGER),
employee.name (VARCHAR(255)),
employee.position (VARCHAR(255)),
employee.salary (REAL),
employee.remarks (VARCHAR(255)),
)
CREATE TABLE has_clearance (
has_clearance.employee (INTEGER),
has_clearance.planet (INTEGER),
has_clearance.level (INTEGER),
)
CREATE TABLE package (
package.shipment (INTEGER),
package.packagenumber (INTEGER),
package.contents (VARCHAR(255)),
package.weight (REAL),
package.sender (INTEGER),
package.recipient (INTEGER),
)
CREATE TABLE planet (
planet.planetid (INTEGER),
planet.name (VARCHAR(255)),
planet.coordinates (REAL),
)
CREATE TABLE shipment (
shipment.shipmentid (INTEGER),
shipment.date (DATE),
shipment.manager (INTEGER),
shipment.planet (INTEGER),
)
Possible JOINs:
has_clearance.employee = employee.employeeid
has_clearance.planet = planet.planetid
package.shipment = shipment.shipmentid
package.sender = client.accountnumber
package.recipient = client.accountnumber
shipment.manager = employee.employeeid
shipment.planet = planet.planetid
| {
'Employee': ['EmployeeID', 'Name', 'Position', 'Salary', 'Remarks'],
'Planet': ['PlanetID', 'Name', 'Coordinates'],
'Shipment': ['ShipmentID', 'Date', 'Manager', 'Planet'],
'Has_Clearance': ['Employee', 'Planet', 'Level'],
'Client': ['AccountNumber', 'Name'],
'Package': ['Shipment', 'PackageNumber', 'Contents', 'Weight', 'Sender', 'Recipient']
} | {
'Package': ['Shipment'],
'Client': ['AccountNumber', 'Name']
} | TABLE Client (
Client.AccountNumber (INTEGER),
Client.Name (VARCHAR(255)),
)
TABLE Employee (
Employee.EmployeeID (INTEGER),
Employee.Name (VARCHAR(255)),
Employee.Position (VARCHAR(255)),
Employee.Salary (REAL),
Employee.Remarks (VARCHAR(255)),
)
TABLE Has_Clearance (
Has_Clearance.Employee (INTEGER),
Has_Clearance.Planet (INTEGER),
Has_Clearance.Level (INTEGER),
)
TABLE Package (
Package.Shipment (INTEGER),
Package.PackageNumber (INTEGER),
Package.Contents (VARCHAR(255)),
Package.Weight (REAL),
Package.Sender (INTEGER),
Package.Recipient (INTEGER),
)
TABLE Planet (
Planet.PlanetID (INTEGER),
Planet.Name (VARCHAR(255)),
Planet.Coordinates (REAL),
)
TABLE Shipment (
Shipment.ShipmentID (INTEGER),
Shipment.Date (DATE),
Shipment.Manager (INTEGER),
Shipment.Planet (INTEGER),
)
Possible JOINs:
Has_Clearance.Employee = Employee.EmployeeID
Has_Clearance.Planet = Planet.PlanetID
Package.Shipment = Shipment.ShipmentID
Package.Sender = Client.AccountNumber
Package.Recipient = Client.AccountNumber
Shipment.Manager = Employee.EmployeeID
Shipment.Planet = Planet.PlanetID
| TABLE Client (
Client.accountnumber (INTEGER),
Client.name (VARCHAR(255)),
)
TABLE Employee (
Employee.employeeid (INTEGER),
Employee.name (VARCHAR(255)),
Employee.position (VARCHAR(255)),
Employee.salary (REAL),
Employee.remarks (VARCHAR(255)),
)
TABLE Has_Clearance (
Has_Clearance.employee (INTEGER),
Has_Clearance.planet (INTEGER),
Has_Clearance.level (INTEGER),
)
TABLE Package (
Package.shipment (INTEGER),
Package.packagenumber (INTEGER),
Package.contents (VARCHAR(255)),
Package.weight (REAL),
Package.sender (INTEGER),
Package.recipient (INTEGER),
)
TABLE Planet (
Planet.planetid (INTEGER),
Planet.name (VARCHAR(255)),
Planet.coordinates (REAL),
)
TABLE Shipment (
Shipment.shipmentid (INTEGER),
Shipment.date (DATE),
Shipment.manager (INTEGER),
Shipment.planet (INTEGER),
)
Possible JOINs:
Has_Clearance.employee = Employee.employeeid
Has_Clearance.planet = Planet.planetid
Package.shipment = Shipment.shipmentid
Package.sender = Client.accountnumber
Package.recipient = Client.accountnumber
Shipment.manager = Employee.employeeid
Shipment.planet = Planet.planetid
| TABLE client (
client.accountnumber (INTEGER),
client.name (VARCHAR(255)),
)
TABLE employee (
employee.employeeid (INTEGER),
employee.name (VARCHAR(255)),
employee.position (VARCHAR(255)),
employee.salary (REAL),
employee.remarks (VARCHAR(255)),
)
TABLE has_clearance (
has_clearance.employee (INTEGER),
has_clearance.planet (INTEGER),
has_clearance.level (INTEGER),
)
TABLE package (
package.shipment (INTEGER),
package.packagenumber (INTEGER),
package.contents (VARCHAR(255)),
package.weight (REAL),
package.sender (INTEGER),
package.recipient (INTEGER),
)
TABLE planet (
planet.planetid (INTEGER),
planet.name (VARCHAR(255)),
planet.coordinates (REAL),
)
TABLE shipment (
shipment.shipmentid (INTEGER),
shipment.date (DATE),
shipment.manager (INTEGER),
shipment.planet (INTEGER),
)
Possible JOINs:
has_clearance.employee = employee.employeeid
has_clearance.planet = planet.planetid
package.shipment = shipment.shipmentid
package.sender = client.accountnumber
package.recipient = client.accountnumber
shipment.manager = employee.employeeid
shipment.planet = planet.planetid
|
government_shift |
CREATE TABLE "Analytical_Layer" (
"Analytical_ID" INTEGER NOT NULL,
"Customers_and_Services_ID" VARCHAR(40) NOT NULL,
"Pattern_Recognition" VARCHAR(255) NOT NULL,
"Analytical_Layer_Type_Code" CHAR(15),
PRIMARY KEY ("Analytical_ID"),
FOREIGN KEY("Customers_and_Services_ID") REFERENCES "Customers_and_Services" ("Customers_and_Services_ID")
)
CREATE TABLE "Channels" (
"Channel_ID" INTEGER NOT NULL,
"Channel_Details" VARCHAR(255) NOT NULL,
PRIMARY KEY ("Channel_ID")
)
CREATE TABLE "Customer_Interactions" (
"Customer_Interaction_ID" INTEGER NOT NULL,
"Channel_ID" INTEGER,
"Customer_ID" INTEGER,
"Service_ID" INTEGER,
"Status_Code" CHAR(15),
"Services_and_Channels_Details" VARCHAR(255),
PRIMARY KEY ("Customer_Interaction_ID"),
FOREIGN KEY("Service_ID") REFERENCES "Services" ("Service_ID"),
FOREIGN KEY("Channel_ID") REFERENCES "Channels" ("Channel_ID"),
FOREIGN KEY("Customer_ID") REFERENCES "Customers" ("Customer_ID")
)
CREATE TABLE "Customers" (
"Customer_ID" INTEGER NOT NULL,
"Customer_Details" VARCHAR(255) NOT NULL,
PRIMARY KEY ("Customer_ID")
)
CREATE TABLE "Customers_and_Services" (
"Customers_and_Services_ID" INTEGER NOT NULL,
"Customer_ID" INTEGER,
"Service_ID" INTEGER,
"Customers_and_Services_Details" CHAR(15) NOT NULL,
PRIMARY KEY ("Customers_and_Services_ID"),
FOREIGN KEY("Service_ID") REFERENCES "Services" ("Service_ID"),
FOREIGN KEY("Customer_ID") REFERENCES "Customers" ("Customer_ID")
)
CREATE TABLE "Integration_Platform" (
"Integration_Platform_ID" INTEGER NOT NULL,
"Customer_Interaction_ID" INTEGER NOT NULL,
"Integration_Platform_Details" VARCHAR(255) NOT NULL,
PRIMARY KEY ("Integration_Platform_ID"),
FOREIGN KEY("Customer_Interaction_ID") REFERENCES "Customer_Interactions" ("Customer_Interaction_ID")
)
CREATE TABLE "Services" (
"Service_ID" INTEGER NOT NULL,
"Service_Details" VARCHAR(255),
PRIMARY KEY ("Service_ID")
) | For each analytical layer, return the analytical layer type code and the number of times it was used. | medium | Table Analytical_Layer (
Analytical_Layer.Analytical_ID (INTEGER),
Analytical_Layer.Customers_and_Services_ID (VARCHAR(40)),
Analytical_Layer.Pattern_Recognition (VARCHAR(255)),
Analytical_Layer.Analytical_Layer_Type_Code (CHAR(15)),
)
Table Channels (
Channels.Channel_ID (INTEGER),
Channels.Channel_Details (VARCHAR(255)),
)
Table Customer_Interactions (
Customer_Interactions.Customer_Interaction_ID (INTEGER),
Customer_Interactions.Channel_ID (INTEGER),
Customer_Interactions.Customer_ID (INTEGER),
Customer_Interactions.Service_ID (INTEGER),
Customer_Interactions.Status_Code (CHAR(15)),
Customer_Interactions.Services_and_Channels_Details (VARCHAR(255)),
)
Table Customers (
Customers.Customer_ID (INTEGER),
Customers.Customer_Details (VARCHAR(255)),
)
Table Customers_and_Services (
Customers_and_Services.Customers_and_Services_ID (INTEGER),
Customers_and_Services.Customer_ID (INTEGER),
Customers_and_Services.Service_ID (INTEGER),
Customers_and_Services.Customers_and_Services_Details (CHAR(15)),
)
Table Integration_Platform (
Integration_Platform.Integration_Platform_ID (INTEGER),
Integration_Platform.Customer_Interaction_ID (INTEGER),
Integration_Platform.Integration_Platform_Details (VARCHAR(255)),
)
Table Services (
Services.Service_ID (INTEGER),
Services.Service_Details (VARCHAR(255)),
)
Possible JOINs:
Analytical_Layer.Customers_and_Services_ID = Customers_and_Services.Customers_and_Services_ID
Customer_Interactions.Channel_ID = Channels.Channel_ID
Customer_Interactions.Customer_ID = Customers.Customer_ID
Customer_Interactions.Service_ID = Services.Service_ID
Customers_and_Services.Customer_ID = Customers.Customer_ID
Customers_and_Services.Service_ID = Services.Service_ID
Integration_Platform.Customer_Interaction_ID = Customer_Interactions.Customer_Interaction_ID
| SELECT analytical_layer_type_code , count(*) FROM analytical_layer GROUP BY analytical_layer_type_code | {
'analytical_layer': ['analytical_id', 'analytical_layer_type_code']
} | CREATE TABLE Analytical_Layer (
Analytical_Layer.Analytical_ID (INTEGER),
Analytical_Layer.Customers_and_Services_ID (VARCHAR(40)),
Analytical_Layer.Pattern_Recognition (VARCHAR(255)),
Analytical_Layer.Analytical_Layer_Type_Code (CHAR(15)),
)
CREATE TABLE Channels (
Channels.Channel_ID (INTEGER),
Channels.Channel_Details (VARCHAR(255)),
)
CREATE TABLE Customer_Interactions (
Customer_Interactions.Customer_Interaction_ID (INTEGER),
Customer_Interactions.Channel_ID (INTEGER),
Customer_Interactions.Customer_ID (INTEGER),
Customer_Interactions.Service_ID (INTEGER),
Customer_Interactions.Status_Code (CHAR(15)),
Customer_Interactions.Services_and_Channels_Details (VARCHAR(255)),
)
CREATE TABLE Customers (
Customers.Customer_ID (INTEGER),
Customers.Customer_Details (VARCHAR(255)),
)
CREATE TABLE Customers_and_Services (
Customers_and_Services.Customers_and_Services_ID (INTEGER),
Customers_and_Services.Customer_ID (INTEGER),
Customers_and_Services.Service_ID (INTEGER),
Customers_and_Services.Customers_and_Services_Details (CHAR(15)),
)
CREATE TABLE Integration_Platform (
Integration_Platform.Integration_Platform_ID (INTEGER),
Integration_Platform.Customer_Interaction_ID (INTEGER),
Integration_Platform.Integration_Platform_Details (VARCHAR(255)),
)
CREATE TABLE Services (
Services.Service_ID (INTEGER),
Services.Service_Details (VARCHAR(255)),
)
Possible JOINs:
Analytical_Layer.Customers_and_Services_ID = Customers_and_Services.Customers_and_Services_ID
Customer_Interactions.Channel_ID = Channels.Channel_ID
Customer_Interactions.Customer_ID = Customers.Customer_ID
Customer_Interactions.Service_ID = Services.Service_ID
Customers_and_Services.Customer_ID = Customers.Customer_ID
Customers_and_Services.Service_ID = Services.Service_ID
Integration_Platform.Customer_Interaction_ID = Customer_Interactions.Customer_Interaction_ID
| Table Analytical_Layer (
Analytical_Layer.analytical_id (INTEGER),
Analytical_Layer.customers_and_services_id (VARCHAR(40)),
Analytical_Layer.pattern_recognition (VARCHAR(255)),
Analytical_Layer.analytical_layer_type_code (CHAR(15)),
)
Table Channels (
Channels.channel_id (INTEGER),
Channels.channel_details (VARCHAR(255)),
)
Table Customer_Interactions (
Customer_Interactions.customer_interaction_id (INTEGER),
Customer_Interactions.channel_id (INTEGER),
Customer_Interactions.customer_id (INTEGER),
Customer_Interactions.service_id (INTEGER),
Customer_Interactions.status_code (CHAR(15)),
Customer_Interactions.services_and_channels_details (VARCHAR(255)),
)
Table Customers (
Customers.customer_id (INTEGER),
Customers.customer_details (VARCHAR(255)),
)
Table Customers_and_Services (
Customers_and_Services.customers_and_services_id (INTEGER),
Customers_and_Services.customer_id (INTEGER),
Customers_and_Services.service_id (INTEGER),
Customers_and_Services.customers_and_services_details (CHAR(15)),
)
Table Integration_Platform (
Integration_Platform.integration_platform_id (INTEGER),
Integration_Platform.customer_interaction_id (INTEGER),
Integration_Platform.integration_platform_details (VARCHAR(255)),
)
Table Services (
Services.service_id (INTEGER),
Services.service_details (VARCHAR(255)),
)
Possible JOINs:
Analytical_Layer.customers_and_services_id = Customers_and_Services.customers_and_services_id
Customer_Interactions.channel_id = Channels.channel_id
Customer_Interactions.customer_id = Customers.customer_id
Customer_Interactions.service_id = Services.service_id
Customers_and_Services.customer_id = Customers.customer_id
Customers_and_Services.service_id = Services.service_id
Integration_Platform.customer_interaction_id = Customer_Interactions.customer_interaction_id
| CREATE TABLE Analytical_Layer (
Analytical_Layer.analytical_id (INTEGER),
Analytical_Layer.customers_and_services_id (VARCHAR(40)),
Analytical_Layer.pattern_recognition (VARCHAR(255)),
Analytical_Layer.analytical_layer_type_code (CHAR(15)),
)
CREATE TABLE Channels (
Channels.channel_id (INTEGER),
Channels.channel_details (VARCHAR(255)),
)
CREATE TABLE Customer_Interactions (
Customer_Interactions.customer_interaction_id (INTEGER),
Customer_Interactions.channel_id (INTEGER),
Customer_Interactions.customer_id (INTEGER),
Customer_Interactions.service_id (INTEGER),
Customer_Interactions.status_code (CHAR(15)),
Customer_Interactions.services_and_channels_details (VARCHAR(255)),
)
CREATE TABLE Customers (
Customers.customer_id (INTEGER),
Customers.customer_details (VARCHAR(255)),
)
CREATE TABLE Customers_and_Services (
Customers_and_Services.customers_and_services_id (INTEGER),
Customers_and_Services.customer_id (INTEGER),
Customers_and_Services.service_id (INTEGER),
Customers_and_Services.customers_and_services_details (CHAR(15)),
)
CREATE TABLE Integration_Platform (
Integration_Platform.integration_platform_id (INTEGER),
Integration_Platform.customer_interaction_id (INTEGER),
Integration_Platform.integration_platform_details (VARCHAR(255)),
)
CREATE TABLE Services (
Services.service_id (INTEGER),
Services.service_details (VARCHAR(255)),
)
Possible JOINs:
Analytical_Layer.customers_and_services_id = Customers_and_Services.customers_and_services_id
Customer_Interactions.channel_id = Channels.channel_id
Customer_Interactions.customer_id = Customers.customer_id
Customer_Interactions.service_id = Services.service_id
Customers_and_Services.customer_id = Customers.customer_id
Customers_and_Services.service_id = Services.service_id
Integration_Platform.customer_interaction_id = Customer_Interactions.customer_interaction_id
| Table analytical_layer (
analytical_layer.analytical_id (INTEGER),
analytical_layer.customers_and_services_id (VARCHAR(40)),
analytical_layer.pattern_recognition (VARCHAR(255)),
analytical_layer.analytical_layer_type_code (CHAR(15)),
)
Table channels (
channels.channel_id (INTEGER),
channels.channel_details (VARCHAR(255)),
)
Table customer_interactions (
customer_interactions.customer_interaction_id (INTEGER),
customer_interactions.channel_id (INTEGER),
customer_interactions.customer_id (INTEGER),
customer_interactions.service_id (INTEGER),
customer_interactions.status_code (CHAR(15)),
customer_interactions.services_and_channels_details (VARCHAR(255)),
)
Table customers (
customers.customer_id (INTEGER),
customers.customer_details (VARCHAR(255)),
)
Table customers_and_services (
customers_and_services.customers_and_services_id (INTEGER),
customers_and_services.customer_id (INTEGER),
customers_and_services.service_id (INTEGER),
customers_and_services.customers_and_services_details (CHAR(15)),
)
Table integration_platform (
integration_platform.integration_platform_id (INTEGER),
integration_platform.customer_interaction_id (INTEGER),
integration_platform.integration_platform_details (VARCHAR(255)),
)
Table services (
services.service_id (INTEGER),
services.service_details (VARCHAR(255)),
)
Possible JOINs:
analytical_layer.customers_and_services_id = customers_and_services.customers_and_services_id
customer_interactions.channel_id = channels.channel_id
customer_interactions.customer_id = customers.customer_id
customer_interactions.service_id = services.service_id
customers_and_services.customer_id = customers.customer_id
customers_and_services.service_id = services.service_id
integration_platform.customer_interaction_id = customer_interactions.customer_interaction_id
| CREATE TABLE analytical_layer (
analytical_layer.analytical_id (INTEGER),
analytical_layer.customers_and_services_id (VARCHAR(40)),
analytical_layer.pattern_recognition (VARCHAR(255)),
analytical_layer.analytical_layer_type_code (CHAR(15)),
)
CREATE TABLE channels (
channels.channel_id (INTEGER),
channels.channel_details (VARCHAR(255)),
)
CREATE TABLE customer_interactions (
customer_interactions.customer_interaction_id (INTEGER),
customer_interactions.channel_id (INTEGER),
customer_interactions.customer_id (INTEGER),
customer_interactions.service_id (INTEGER),
customer_interactions.status_code (CHAR(15)),
customer_interactions.services_and_channels_details (VARCHAR(255)),
)
CREATE TABLE customers (
customers.customer_id (INTEGER),
customers.customer_details (VARCHAR(255)),
)
CREATE TABLE customers_and_services (
customers_and_services.customers_and_services_id (INTEGER),
customers_and_services.customer_id (INTEGER),
customers_and_services.service_id (INTEGER),
customers_and_services.customers_and_services_details (CHAR(15)),
)
CREATE TABLE integration_platform (
integration_platform.integration_platform_id (INTEGER),
integration_platform.customer_interaction_id (INTEGER),
integration_platform.integration_platform_details (VARCHAR(255)),
)
CREATE TABLE services (
services.service_id (INTEGER),
services.service_details (VARCHAR(255)),
)
Possible JOINs:
analytical_layer.customers_and_services_id = customers_and_services.customers_and_services_id
customer_interactions.channel_id = channels.channel_id
customer_interactions.customer_id = customers.customer_id
customer_interactions.service_id = services.service_id
customers_and_services.customer_id = customers.customer_id
customers_and_services.service_id = services.service_id
integration_platform.customer_interaction_id = customer_interactions.customer_interaction_id
| {
'Services': ['Service_ID', 'Service_Details'],
'Customers': ['Customer_ID', 'Customer_Details'],
'Channels': ['Channel_ID', 'Channel_Details'],
'Customers_and_Services': ['Customers_and_Services_ID', 'Customer_ID', 'Service_ID', 'Customers_and_Services_Details'],
'Customer_Interactions': ['Customer_Interaction_ID', 'Channel_ID', 'Customer_ID', 'Service_ID', 'Status_Code', 'Services_and_Channels_Details'],
'Integration_Platform': ['Integration_Platform_ID', 'Customer_Interaction_ID', 'Integration_Platform_Details'],
'Analytical_Layer': ['Analytical_ID', 'Customers_and_Services_ID', 'Pattern_Recognition', 'Analytical_Layer_Type_Code']
} | {
'Analytical_Layer': ['Analytical_ID', 'Analytical_Layer_Type_Code']
} | TABLE Analytical_Layer (
Analytical_Layer.Analytical_ID (INTEGER),
Analytical_Layer.Customers_and_Services_ID (VARCHAR(40)),
Analytical_Layer.Pattern_Recognition (VARCHAR(255)),
Analytical_Layer.Analytical_Layer_Type_Code (CHAR(15)),
)
TABLE Channels (
Channels.Channel_ID (INTEGER),
Channels.Channel_Details (VARCHAR(255)),
)
TABLE Customer_Interactions (
Customer_Interactions.Customer_Interaction_ID (INTEGER),
Customer_Interactions.Channel_ID (INTEGER),
Customer_Interactions.Customer_ID (INTEGER),
Customer_Interactions.Service_ID (INTEGER),
Customer_Interactions.Status_Code (CHAR(15)),
Customer_Interactions.Services_and_Channels_Details (VARCHAR(255)),
)
TABLE Customers (
Customers.Customer_ID (INTEGER),
Customers.Customer_Details (VARCHAR(255)),
)
TABLE Customers_and_Services (
Customers_and_Services.Customers_and_Services_ID (INTEGER),
Customers_and_Services.Customer_ID (INTEGER),
Customers_and_Services.Service_ID (INTEGER),
Customers_and_Services.Customers_and_Services_Details (CHAR(15)),
)
TABLE Integration_Platform (
Integration_Platform.Integration_Platform_ID (INTEGER),
Integration_Platform.Customer_Interaction_ID (INTEGER),
Integration_Platform.Integration_Platform_Details (VARCHAR(255)),
)
TABLE Services (
Services.Service_ID (INTEGER),
Services.Service_Details (VARCHAR(255)),
)
Possible JOINs:
Analytical_Layer.Customers_and_Services_ID = Customers_and_Services.Customers_and_Services_ID
Customer_Interactions.Channel_ID = Channels.Channel_ID
Customer_Interactions.Customer_ID = Customers.Customer_ID
Customer_Interactions.Service_ID = Services.Service_ID
Customers_and_Services.Customer_ID = Customers.Customer_ID
Customers_and_Services.Service_ID = Services.Service_ID
Integration_Platform.Customer_Interaction_ID = Customer_Interactions.Customer_Interaction_ID
| TABLE Analytical_Layer (
Analytical_Layer.analytical_id (INTEGER),
Analytical_Layer.customers_and_services_id (VARCHAR(40)),
Analytical_Layer.pattern_recognition (VARCHAR(255)),
Analytical_Layer.analytical_layer_type_code (CHAR(15)),
)
TABLE Channels (
Channels.channel_id (INTEGER),
Channels.channel_details (VARCHAR(255)),
)
TABLE Customer_Interactions (
Customer_Interactions.customer_interaction_id (INTEGER),
Customer_Interactions.channel_id (INTEGER),
Customer_Interactions.customer_id (INTEGER),
Customer_Interactions.service_id (INTEGER),
Customer_Interactions.status_code (CHAR(15)),
Customer_Interactions.services_and_channels_details (VARCHAR(255)),
)
TABLE Customers (
Customers.customer_id (INTEGER),
Customers.customer_details (VARCHAR(255)),
)
TABLE Customers_and_Services (
Customers_and_Services.customers_and_services_id (INTEGER),
Customers_and_Services.customer_id (INTEGER),
Customers_and_Services.service_id (INTEGER),
Customers_and_Services.customers_and_services_details (CHAR(15)),
)
TABLE Integration_Platform (
Integration_Platform.integration_platform_id (INTEGER),
Integration_Platform.customer_interaction_id (INTEGER),
Integration_Platform.integration_platform_details (VARCHAR(255)),
)
TABLE Services (
Services.service_id (INTEGER),
Services.service_details (VARCHAR(255)),
)
Possible JOINs:
Analytical_Layer.customers_and_services_id = Customers_and_Services.customers_and_services_id
Customer_Interactions.channel_id = Channels.channel_id
Customer_Interactions.customer_id = Customers.customer_id
Customer_Interactions.service_id = Services.service_id
Customers_and_Services.customer_id = Customers.customer_id
Customers_and_Services.service_id = Services.service_id
Integration_Platform.customer_interaction_id = Customer_Interactions.customer_interaction_id
| TABLE analytical_layer (
analytical_layer.analytical_id (INTEGER),
analytical_layer.customers_and_services_id (VARCHAR(40)),
analytical_layer.pattern_recognition (VARCHAR(255)),
analytical_layer.analytical_layer_type_code (CHAR(15)),
)
TABLE channels (
channels.channel_id (INTEGER),
channels.channel_details (VARCHAR(255)),
)
TABLE customer_interactions (
customer_interactions.customer_interaction_id (INTEGER),
customer_interactions.channel_id (INTEGER),
customer_interactions.customer_id (INTEGER),
customer_interactions.service_id (INTEGER),
customer_interactions.status_code (CHAR(15)),
customer_interactions.services_and_channels_details (VARCHAR(255)),
)
TABLE customers (
customers.customer_id (INTEGER),
customers.customer_details (VARCHAR(255)),
)
TABLE customers_and_services (
customers_and_services.customers_and_services_id (INTEGER),
customers_and_services.customer_id (INTEGER),
customers_and_services.service_id (INTEGER),
customers_and_services.customers_and_services_details (CHAR(15)),
)
TABLE integration_platform (
integration_platform.integration_platform_id (INTEGER),
integration_platform.customer_interaction_id (INTEGER),
integration_platform.integration_platform_details (VARCHAR(255)),
)
TABLE services (
services.service_id (INTEGER),
services.service_details (VARCHAR(255)),
)
Possible JOINs:
analytical_layer.customers_and_services_id = customers_and_services.customers_and_services_id
customer_interactions.channel_id = channels.channel_id
customer_interactions.customer_id = customers.customer_id
customer_interactions.service_id = services.service_id
customers_and_services.customer_id = customers.customer_id
customers_and_services.service_id = services.service_id
integration_platform.customer_interaction_id = customer_interactions.customer_interaction_id
|
country_language |
CREATE TABLE countries (
id INTEGER,
name TEXT,
overall_score REAL,
justice_score REAL,
health_score REAL,
education_score REAL,
economics_score REAL,
politics_score REAL,
PRIMARY KEY (id)
)
CREATE TABLE languages (
id INTEGER,
name TEXT,
PRIMARY KEY (id)
)
CREATE TABLE official_languages (
language_id INTEGER,
country_id INTEGER,
PRIMARY KEY (language_id, country_id),
FOREIGN KEY(language_id) REFERENCES languages (id),
FOREIGN KEY(country_id) REFERENCES countries (id)
) | Show the official languages and the number of countries speaking each language. | medium | Table countries (
countries.id (INTEGER),
countries.name (TEXT),
countries.overall_score (REAL),
countries.justice_score (REAL),
countries.health_score (REAL),
countries.education_score (REAL),
countries.economics_score (REAL),
countries.politics_score (REAL),
)
Table languages (
languages.id (INTEGER),
languages.name (TEXT),
)
Table official_languages (
official_languages.language_id (INTEGER),
official_languages.country_id (INTEGER),
)
Possible JOINs:
official_languages.language_id = languages.id
official_languages.country_id = countries.id
| SELECT languages.name , COUNT(*) FROM official_languages JOIN languages ON official_languages.language_id = languages.id GROUP BY languages.name | {
'official_languages': ['language_id'],
'languages': ['id', 'name']
} | CREATE TABLE countries (
countries.id (INTEGER),
countries.name (TEXT),
countries.overall_score (REAL),
countries.justice_score (REAL),
countries.health_score (REAL),
countries.education_score (REAL),
countries.economics_score (REAL),
countries.politics_score (REAL),
)
CREATE TABLE languages (
languages.id (INTEGER),
languages.name (TEXT),
)
CREATE TABLE official_languages (
official_languages.language_id (INTEGER),
official_languages.country_id (INTEGER),
)
Possible JOINs:
official_languages.language_id = languages.id
official_languages.country_id = countries.id
| Table countries (
countries.id (INTEGER),
countries.name (TEXT),
countries.overall_score (REAL),
countries.justice_score (REAL),
countries.health_score (REAL),
countries.education_score (REAL),
countries.economics_score (REAL),
countries.politics_score (REAL),
)
Table languages (
languages.id (INTEGER),
languages.name (TEXT),
)
Table official_languages (
official_languages.language_id (INTEGER),
official_languages.country_id (INTEGER),
)
Possible JOINs:
official_languages.language_id = languages.id
official_languages.country_id = countries.id
| CREATE TABLE countries (
countries.id (INTEGER),
countries.name (TEXT),
countries.overall_score (REAL),
countries.justice_score (REAL),
countries.health_score (REAL),
countries.education_score (REAL),
countries.economics_score (REAL),
countries.politics_score (REAL),
)
CREATE TABLE languages (
languages.id (INTEGER),
languages.name (TEXT),
)
CREATE TABLE official_languages (
official_languages.language_id (INTEGER),
official_languages.country_id (INTEGER),
)
Possible JOINs:
official_languages.language_id = languages.id
official_languages.country_id = countries.id
| Table countries (
countries.id (INTEGER),
countries.name (TEXT),
countries.overall_score (REAL),
countries.justice_score (REAL),
countries.health_score (REAL),
countries.education_score (REAL),
countries.economics_score (REAL),
countries.politics_score (REAL),
)
Table languages (
languages.id (INTEGER),
languages.name (TEXT),
)
Table official_languages (
official_languages.language_id (INTEGER),
official_languages.country_id (INTEGER),
)
Possible JOINs:
official_languages.language_id = languages.id
official_languages.country_id = countries.id
| CREATE TABLE countries (
countries.id (INTEGER),
countries.name (TEXT),
countries.overall_score (REAL),
countries.justice_score (REAL),
countries.health_score (REAL),
countries.education_score (REAL),
countries.economics_score (REAL),
countries.politics_score (REAL),
)
CREATE TABLE languages (
languages.id (INTEGER),
languages.name (TEXT),
)
CREATE TABLE official_languages (
official_languages.language_id (INTEGER),
official_languages.country_id (INTEGER),
)
Possible JOINs:
official_languages.language_id = languages.id
official_languages.country_id = countries.id
| {
'languages': ['id', 'name'],
'countries': ['id', 'name', 'overall_score', 'justice_score', 'health_score', 'education_score', 'economics_score', 'politics_score'],
'official_languages': ['language_id', 'country_id']
} | {
'official_languages': ['language_id'],
'languages': ['id', 'name']
} | TABLE countries (
countries.id (INTEGER),
countries.name (TEXT),
countries.overall_score (REAL),
countries.justice_score (REAL),
countries.health_score (REAL),
countries.education_score (REAL),
countries.economics_score (REAL),
countries.politics_score (REAL),
)
TABLE languages (
languages.id (INTEGER),
languages.name (TEXT),
)
TABLE official_languages (
official_languages.language_id (INTEGER),
official_languages.country_id (INTEGER),
)
Possible JOINs:
official_languages.language_id = languages.id
official_languages.country_id = countries.id
| TABLE countries (
countries.id (INTEGER),
countries.name (TEXT),
countries.overall_score (REAL),
countries.justice_score (REAL),
countries.health_score (REAL),
countries.education_score (REAL),
countries.economics_score (REAL),
countries.politics_score (REAL),
)
TABLE languages (
languages.id (INTEGER),
languages.name (TEXT),
)
TABLE official_languages (
official_languages.language_id (INTEGER),
official_languages.country_id (INTEGER),
)
Possible JOINs:
official_languages.language_id = languages.id
official_languages.country_id = countries.id
| TABLE countries (
countries.id (INTEGER),
countries.name (TEXT),
countries.overall_score (REAL),
countries.justice_score (REAL),
countries.health_score (REAL),
countries.education_score (REAL),
countries.economics_score (REAL),
countries.politics_score (REAL),
)
TABLE languages (
languages.id (INTEGER),
languages.name (TEXT),
)
TABLE official_languages (
official_languages.language_id (INTEGER),
official_languages.country_id (INTEGER),
)
Possible JOINs:
official_languages.language_id = languages.id
official_languages.country_id = countries.id
|
boat_1 |
CREATE TABLE "Boats" (
bid INTEGER,
name TEXT,
color TEXT,
PRIMARY KEY (bid)
)
CREATE TABLE "Reserves" (
sid INTEGER,
bid INTEGER,
day TEXT,
FOREIGN KEY(sid) REFERENCES "Sailors" (sid),
FOREIGN KEY(bid) REFERENCES "Boats" (bid)
)
CREATE TABLE "Sailors" (
sid INTEGER,
name TEXT,
rating INTEGER,
age INTEGER,
PRIMARY KEY (sid)
) | Find the number of reservations for each boat. | medium | Table Boats (
Boats.bid (INTEGER),
Boats.name (TEXT),
Boats.color (TEXT),
)
Table Reserves (
Reserves.sid (INTEGER),
Reserves.bid (INTEGER),
Reserves.day (TEXT),
)
Table Sailors (
Sailors.sid (INTEGER),
Sailors.name (TEXT),
Sailors.rating (INTEGER),
Sailors.age (INTEGER),
)
Possible JOINs:
Reserves.sid = Sailors.sid
Reserves.bid = Boats.bid
| SELECT bid , count(*) FROM Reserves GROUP BY bid | {
'reserves': ['bid']
} | CREATE TABLE Boats (
Boats.bid (INTEGER),
Boats.name (TEXT),
Boats.color (TEXT),
)
CREATE TABLE Reserves (
Reserves.sid (INTEGER),
Reserves.bid (INTEGER),
Reserves.day (TEXT),
)
CREATE TABLE Sailors (
Sailors.sid (INTEGER),
Sailors.name (TEXT),
Sailors.rating (INTEGER),
Sailors.age (INTEGER),
)
Possible JOINs:
Reserves.sid = Sailors.sid
Reserves.bid = Boats.bid
| Table Boats (
Boats.bid (INTEGER),
Boats.name (TEXT),
Boats.color (TEXT),
)
Table Reserves (
Reserves.sid (INTEGER),
Reserves.bid (INTEGER),
Reserves.day (TEXT),
)
Table Sailors (
Sailors.sid (INTEGER),
Sailors.name (TEXT),
Sailors.rating (INTEGER),
Sailors.age (INTEGER),
)
Possible JOINs:
Reserves.sid = Sailors.sid
Reserves.bid = Boats.bid
| CREATE TABLE Boats (
Boats.bid (INTEGER),
Boats.name (TEXT),
Boats.color (TEXT),
)
CREATE TABLE Reserves (
Reserves.sid (INTEGER),
Reserves.bid (INTEGER),
Reserves.day (TEXT),
)
CREATE TABLE Sailors (
Sailors.sid (INTEGER),
Sailors.name (TEXT),
Sailors.rating (INTEGER),
Sailors.age (INTEGER),
)
Possible JOINs:
Reserves.sid = Sailors.sid
Reserves.bid = Boats.bid
| Table boats (
boats.bid (INTEGER),
boats.name (TEXT),
boats.color (TEXT),
)
Table reserves (
reserves.sid (INTEGER),
reserves.bid (INTEGER),
reserves.day (TEXT),
)
Table sailors (
sailors.sid (INTEGER),
sailors.name (TEXT),
sailors.rating (INTEGER),
sailors.age (INTEGER),
)
Possible JOINs:
reserves.sid = sailors.sid
reserves.bid = boats.bid
| CREATE TABLE boats (
boats.bid (INTEGER),
boats.name (TEXT),
boats.color (TEXT),
)
CREATE TABLE reserves (
reserves.sid (INTEGER),
reserves.bid (INTEGER),
reserves.day (TEXT),
)
CREATE TABLE sailors (
sailors.sid (INTEGER),
sailors.name (TEXT),
sailors.rating (INTEGER),
sailors.age (INTEGER),
)
Possible JOINs:
reserves.sid = sailors.sid
reserves.bid = boats.bid
| {
'Sailors': ['sid', 'name', 'rating', 'age'],
'Boats': ['bid', 'name', 'color'],
'Reserves': ['sid', 'bid', 'day']
} | {
'Reserves': ['bid']
} | TABLE Boats (
Boats.bid (INTEGER),
Boats.name (TEXT),
Boats.color (TEXT),
)
TABLE Reserves (
Reserves.sid (INTEGER),
Reserves.bid (INTEGER),
Reserves.day (TEXT),
)
TABLE Sailors (
Sailors.sid (INTEGER),
Sailors.name (TEXT),
Sailors.rating (INTEGER),
Sailors.age (INTEGER),
)
Possible JOINs:
Reserves.sid = Sailors.sid
Reserves.bid = Boats.bid
| TABLE Boats (
Boats.bid (INTEGER),
Boats.name (TEXT),
Boats.color (TEXT),
)
TABLE Reserves (
Reserves.sid (INTEGER),
Reserves.bid (INTEGER),
Reserves.day (TEXT),
)
TABLE Sailors (
Sailors.sid (INTEGER),
Sailors.name (TEXT),
Sailors.rating (INTEGER),
Sailors.age (INTEGER),
)
Possible JOINs:
Reserves.sid = Sailors.sid
Reserves.bid = Boats.bid
| TABLE boats (
boats.bid (INTEGER),
boats.name (TEXT),
boats.color (TEXT),
)
TABLE reserves (
reserves.sid (INTEGER),
reserves.bid (INTEGER),
reserves.day (TEXT),
)
TABLE sailors (
sailors.sid (INTEGER),
sailors.name (TEXT),
sailors.rating (INTEGER),
sailors.age (INTEGER),
)
Possible JOINs:
reserves.sid = sailors.sid
reserves.bid = boats.bid
|
art_1 |
CREATE TABLE "Artists" (
"artistID" INTEGER,
lname TEXT,
fname TEXT,
"birthYear" INTEGER,
"deathYear" INTEGER,
PRIMARY KEY ("artistID")
)
CREATE TABLE "Paintings" (
"paintingID" INTEGER,
title TEXT,
year INTEGER,
height_mm INTEGER,
width_mm INTEGER,
medium TEXT,
"mediumOn" TEXT,
location TEXT,
"painterID" INTEGER,
PRIMARY KEY ("paintingID"),
FOREIGN KEY("painterID") REFERENCES "Artists" ("artistID")
)
CREATE TABLE "Sculptures" (
"sculptureID" INTEGER,
title TEXT,
year INTEGER,
medium TEXT,
location TEXT,
"sculptorID" INTEGER,
PRIMARY KEY ("sculptureID"),
FOREIGN KEY("sculptorID") REFERENCES "Artists" ("artistID")
) | Find the distinct titles of all the paintings that have a longer height than some painting on canvas? | hard | Table Artists (
Artists.artistID (INTEGER),
Artists.lname (TEXT),
Artists.fname (TEXT),
Artists.birthYear (INTEGER),
Artists.deathYear (INTEGER),
)
Table Paintings (
Paintings.paintingID (INTEGER),
Paintings.title (TEXT),
Paintings.year (INTEGER),
Paintings.height_mm (INTEGER),
Paintings.width_mm (INTEGER),
Paintings.medium (TEXT),
Paintings.mediumOn (TEXT),
Paintings.location (TEXT),
Paintings.painterID (INTEGER),
)
Table Sculptures (
Sculptures.sculptureID (INTEGER),
Sculptures.title (TEXT),
Sculptures.year (INTEGER),
Sculptures.medium (TEXT),
Sculptures.location (TEXT),
Sculptures.sculptorID (INTEGER),
)
Possible JOINs:
Paintings.painterID = Artists.artistID
Sculptures.sculptorID = Artists.artistID
| SELECT DISTINCT title FROM paintings WHERE height_mm > (SELECT min(height_mm) FROM paintings WHERE mediumOn = "canvas") | {
'paintings': ['paintingid', 'title', 'height_mm', 'mediumon']
} | CREATE TABLE Artists (
Artists.artistID (INTEGER),
Artists.lname (TEXT),
Artists.fname (TEXT),
Artists.birthYear (INTEGER),
Artists.deathYear (INTEGER),
)
CREATE TABLE Paintings (
Paintings.paintingID (INTEGER),
Paintings.title (TEXT),
Paintings.year (INTEGER),
Paintings.height_mm (INTEGER),
Paintings.width_mm (INTEGER),
Paintings.medium (TEXT),
Paintings.mediumOn (TEXT),
Paintings.location (TEXT),
Paintings.painterID (INTEGER),
)
CREATE TABLE Sculptures (
Sculptures.sculptureID (INTEGER),
Sculptures.title (TEXT),
Sculptures.year (INTEGER),
Sculptures.medium (TEXT),
Sculptures.location (TEXT),
Sculptures.sculptorID (INTEGER),
)
Possible JOINs:
Paintings.painterID = Artists.artistID
Sculptures.sculptorID = Artists.artistID
| Table Artists (
Artists.artistid (INTEGER),
Artists.lname (TEXT),
Artists.fname (TEXT),
Artists.birthyear (INTEGER),
Artists.deathyear (INTEGER),
)
Table Paintings (
Paintings.paintingid (INTEGER),
Paintings.title (TEXT),
Paintings.year (INTEGER),
Paintings.height_mm (INTEGER),
Paintings.width_mm (INTEGER),
Paintings.medium (TEXT),
Paintings.mediumon (TEXT),
Paintings.location (TEXT),
Paintings.painterid (INTEGER),
)
Table Sculptures (
Sculptures.sculptureid (INTEGER),
Sculptures.title (TEXT),
Sculptures.year (INTEGER),
Sculptures.medium (TEXT),
Sculptures.location (TEXT),
Sculptures.sculptorid (INTEGER),
)
Possible JOINs:
Paintings.painterid = Artists.artistid
Sculptures.sculptorid = Artists.artistid
| CREATE TABLE Artists (
Artists.artistid (INTEGER),
Artists.lname (TEXT),
Artists.fname (TEXT),
Artists.birthyear (INTEGER),
Artists.deathyear (INTEGER),
)
CREATE TABLE Paintings (
Paintings.paintingid (INTEGER),
Paintings.title (TEXT),
Paintings.year (INTEGER),
Paintings.height_mm (INTEGER),
Paintings.width_mm (INTEGER),
Paintings.medium (TEXT),
Paintings.mediumon (TEXT),
Paintings.location (TEXT),
Paintings.painterid (INTEGER),
)
CREATE TABLE Sculptures (
Sculptures.sculptureid (INTEGER),
Sculptures.title (TEXT),
Sculptures.year (INTEGER),
Sculptures.medium (TEXT),
Sculptures.location (TEXT),
Sculptures.sculptorid (INTEGER),
)
Possible JOINs:
Paintings.painterid = Artists.artistid
Sculptures.sculptorid = Artists.artistid
| Table artists (
artists.artistid (INTEGER),
artists.lname (TEXT),
artists.fname (TEXT),
artists.birthyear (INTEGER),
artists.deathyear (INTEGER),
)
Table paintings (
paintings.paintingid (INTEGER),
paintings.title (TEXT),
paintings.year (INTEGER),
paintings.height_mm (INTEGER),
paintings.width_mm (INTEGER),
paintings.medium (TEXT),
paintings.mediumon (TEXT),
paintings.location (TEXT),
paintings.painterid (INTEGER),
)
Table sculptures (
sculptures.sculptureid (INTEGER),
sculptures.title (TEXT),
sculptures.year (INTEGER),
sculptures.medium (TEXT),
sculptures.location (TEXT),
sculptures.sculptorid (INTEGER),
)
Possible JOINs:
paintings.painterid = artists.artistid
sculptures.sculptorid = artists.artistid
| CREATE TABLE artists (
artists.artistid (INTEGER),
artists.lname (TEXT),
artists.fname (TEXT),
artists.birthyear (INTEGER),
artists.deathyear (INTEGER),
)
CREATE TABLE paintings (
paintings.paintingid (INTEGER),
paintings.title (TEXT),
paintings.year (INTEGER),
paintings.height_mm (INTEGER),
paintings.width_mm (INTEGER),
paintings.medium (TEXT),
paintings.mediumon (TEXT),
paintings.location (TEXT),
paintings.painterid (INTEGER),
)
CREATE TABLE sculptures (
sculptures.sculptureid (INTEGER),
sculptures.title (TEXT),
sculptures.year (INTEGER),
sculptures.medium (TEXT),
sculptures.location (TEXT),
sculptures.sculptorid (INTEGER),
)
Possible JOINs:
paintings.painterid = artists.artistid
sculptures.sculptorid = artists.artistid
| {
'Artists': ['artistID', 'lname', 'fname', 'birthYear', 'deathYear'],
'Paintings': ['paintingID', 'title', 'year', 'height_mm', 'width_mm', 'medium', 'mediumOn', 'location', 'painterID'],
'Sculptures': ['sculptureID', 'title', 'year', 'medium', 'location', 'sculptorID']
} | {
'Paintings': ['paintingID', 'title', 'height_mm', 'mediumOn']
} | TABLE Artists (
Artists.artistID (INTEGER),
Artists.lname (TEXT),
Artists.fname (TEXT),
Artists.birthYear (INTEGER),
Artists.deathYear (INTEGER),
)
TABLE Paintings (
Paintings.paintingID (INTEGER),
Paintings.title (TEXT),
Paintings.year (INTEGER),
Paintings.height_mm (INTEGER),
Paintings.width_mm (INTEGER),
Paintings.medium (TEXT),
Paintings.mediumOn (TEXT),
Paintings.location (TEXT),
Paintings.painterID (INTEGER),
)
TABLE Sculptures (
Sculptures.sculptureID (INTEGER),
Sculptures.title (TEXT),
Sculptures.year (INTEGER),
Sculptures.medium (TEXT),
Sculptures.location (TEXT),
Sculptures.sculptorID (INTEGER),
)
Possible JOINs:
Paintings.painterID = Artists.artistID
Sculptures.sculptorID = Artists.artistID
| TABLE Artists (
Artists.artistid (INTEGER),
Artists.lname (TEXT),
Artists.fname (TEXT),
Artists.birthyear (INTEGER),
Artists.deathyear (INTEGER),
)
TABLE Paintings (
Paintings.paintingid (INTEGER),
Paintings.title (TEXT),
Paintings.year (INTEGER),
Paintings.height_mm (INTEGER),
Paintings.width_mm (INTEGER),
Paintings.medium (TEXT),
Paintings.mediumon (TEXT),
Paintings.location (TEXT),
Paintings.painterid (INTEGER),
)
TABLE Sculptures (
Sculptures.sculptureid (INTEGER),
Sculptures.title (TEXT),
Sculptures.year (INTEGER),
Sculptures.medium (TEXT),
Sculptures.location (TEXT),
Sculptures.sculptorid (INTEGER),
)
Possible JOINs:
Paintings.painterid = Artists.artistid
Sculptures.sculptorid = Artists.artistid
| TABLE artists (
artists.artistid (INTEGER),
artists.lname (TEXT),
artists.fname (TEXT),
artists.birthyear (INTEGER),
artists.deathyear (INTEGER),
)
TABLE paintings (
paintings.paintingid (INTEGER),
paintings.title (TEXT),
paintings.year (INTEGER),
paintings.height_mm (INTEGER),
paintings.width_mm (INTEGER),
paintings.medium (TEXT),
paintings.mediumon (TEXT),
paintings.location (TEXT),
paintings.painterid (INTEGER),
)
TABLE sculptures (
sculptures.sculptureid (INTEGER),
sculptures.title (TEXT),
sculptures.year (INTEGER),
sculptures.medium (TEXT),
sculptures.location (TEXT),
sculptures.sculptorid (INTEGER),
)
Possible JOINs:
paintings.painterid = artists.artistid
sculptures.sculptorid = artists.artistid
|
aan_1 |
CREATE TABLE "Affiliation" (
affiliation_id INTEGER NOT NULL,
name VARCHAR(255) DEFAULT NULL,
address VARCHAR(255) DEFAULT NULL,
PRIMARY KEY (affiliation_id)
)
CREATE TABLE "Author" (
author_id INTEGER NOT NULL,
name VARCHAR(255) DEFAULT NULL,
email VARCHAR(255) DEFAULT NULL,
PRIMARY KEY (author_id)
)
CREATE TABLE "Author_list" (
paper_id VARCHAR(25) NOT NULL,
author_id INTEGER NOT NULL,
affiliation_id INTEGER DEFAULT NULL,
PRIMARY KEY (paper_id, author_id),
FOREIGN KEY(affiliation_id) REFERENCES "Affiliation" (affiliation_id),
FOREIGN KEY(author_id) REFERENCES "Author" (author_id),
FOREIGN KEY(paper_id) REFERENCES "Paper" (paper_id)
)
CREATE TABLE "Citation" (
paper_id VARCHAR(25) NOT NULL,
cited_paper_id VARCHAR(25) NOT NULL,
PRIMARY KEY (paper_id, cited_paper_id),
FOREIGN KEY(cited_paper_id) REFERENCES "Paper" (paper_id),
FOREIGN KEY(paper_id) REFERENCES "Paper" (paper_id)
)
CREATE TABLE "Paper" (
paper_id VARCHAR(25) NOT NULL,
title VARCHAR(255) DEFAULT NULL,
venue VARCHAR(255) DEFAULT NULL,
year INTEGER DEFAULT NULL,
PRIMARY KEY (paper_id)
) | What are the ids for papers with titles containing 'translation'? | medium | Table Affiliation (
Affiliation.affiliation_id (INTEGER),
Affiliation.name (varchar(255)),
Affiliation.address (varchar(255)),
)
Table Author (
Author.author_id (INTEGER),
Author.name (varchar(255)),
Author.email (varchar(255)),
)
Table Author_list (
Author_list.paper_id (varchar(25)),
Author_list.author_id (INTEGER),
Author_list.affiliation_id (INTEGER),
)
Table Citation (
Citation.paper_id (varchar(25)),
Citation.cited_paper_id (varchar(25)),
)
Table Paper (
Paper.paper_id (varchar(25)),
Paper.title (varchar(255)),
Paper.venue (varchar(255)),
Paper.year (INTEGER),
)
Possible JOINs:
Author_list.paper_id = Paper.paper_id
Author_list.author_id = Author.author_id
Author_list.affiliation_id = Affiliation.affiliation_id
Citation.paper_id = Paper.paper_id
Citation.cited_paper_id = Paper.paper_id
| SELECT paper_id FROM Paper WHERE title LIKE "%translation%" | {
'paper': ['paper_id', 'title']
} | CREATE TABLE Affiliation (
Affiliation.affiliation_id (INTEGER),
Affiliation.name (varchar(255)),
Affiliation.address (varchar(255)),
)
CREATE TABLE Author (
Author.author_id (INTEGER),
Author.name (varchar(255)),
Author.email (varchar(255)),
)
CREATE TABLE Author_list (
Author_list.paper_id (varchar(25)),
Author_list.author_id (INTEGER),
Author_list.affiliation_id (INTEGER),
)
CREATE TABLE Citation (
Citation.paper_id (varchar(25)),
Citation.cited_paper_id (varchar(25)),
)
CREATE TABLE Paper (
Paper.paper_id (varchar(25)),
Paper.title (varchar(255)),
Paper.venue (varchar(255)),
Paper.year (INTEGER),
)
Possible JOINs:
Author_list.paper_id = Paper.paper_id
Author_list.author_id = Author.author_id
Author_list.affiliation_id = Affiliation.affiliation_id
Citation.paper_id = Paper.paper_id
Citation.cited_paper_id = Paper.paper_id
| Table Affiliation (
Affiliation.affiliation_id (INTEGER),
Affiliation.name (varchar(255)),
Affiliation.address (varchar(255)),
)
Table Author (
Author.author_id (INTEGER),
Author.name (varchar(255)),
Author.email (varchar(255)),
)
Table Author_list (
Author_list.paper_id (varchar(25)),
Author_list.author_id (INTEGER),
Author_list.affiliation_id (INTEGER),
)
Table Citation (
Citation.paper_id (varchar(25)),
Citation.cited_paper_id (varchar(25)),
)
Table Paper (
Paper.paper_id (varchar(25)),
Paper.title (varchar(255)),
Paper.venue (varchar(255)),
Paper.year (INTEGER),
)
Possible JOINs:
Author_list.paper_id = Paper.paper_id
Author_list.author_id = Author.author_id
Author_list.affiliation_id = Affiliation.affiliation_id
Citation.paper_id = Paper.paper_id
Citation.cited_paper_id = Paper.paper_id
| CREATE TABLE Affiliation (
Affiliation.affiliation_id (INTEGER),
Affiliation.name (varchar(255)),
Affiliation.address (varchar(255)),
)
CREATE TABLE Author (
Author.author_id (INTEGER),
Author.name (varchar(255)),
Author.email (varchar(255)),
)
CREATE TABLE Author_list (
Author_list.paper_id (varchar(25)),
Author_list.author_id (INTEGER),
Author_list.affiliation_id (INTEGER),
)
CREATE TABLE Citation (
Citation.paper_id (varchar(25)),
Citation.cited_paper_id (varchar(25)),
)
CREATE TABLE Paper (
Paper.paper_id (varchar(25)),
Paper.title (varchar(255)),
Paper.venue (varchar(255)),
Paper.year (INTEGER),
)
Possible JOINs:
Author_list.paper_id = Paper.paper_id
Author_list.author_id = Author.author_id
Author_list.affiliation_id = Affiliation.affiliation_id
Citation.paper_id = Paper.paper_id
Citation.cited_paper_id = Paper.paper_id
| Table affiliation (
affiliation.affiliation_id (INTEGER),
affiliation.name (varchar(255)),
affiliation.address (varchar(255)),
)
Table author (
author.author_id (INTEGER),
author.name (varchar(255)),
author.email (varchar(255)),
)
Table author_list (
author_list.paper_id (varchar(25)),
author_list.author_id (INTEGER),
author_list.affiliation_id (INTEGER),
)
Table citation (
citation.paper_id (varchar(25)),
citation.cited_paper_id (varchar(25)),
)
Table paper (
paper.paper_id (varchar(25)),
paper.title (varchar(255)),
paper.venue (varchar(255)),
paper.year (INTEGER),
)
Possible JOINs:
author_list.paper_id = paper.paper_id
author_list.author_id = author.author_id
author_list.affiliation_id = affiliation.affiliation_id
citation.paper_id = paper.paper_id
citation.cited_paper_id = paper.paper_id
| CREATE TABLE affiliation (
affiliation.affiliation_id (INTEGER),
affiliation.name (varchar(255)),
affiliation.address (varchar(255)),
)
CREATE TABLE author (
author.author_id (INTEGER),
author.name (varchar(255)),
author.email (varchar(255)),
)
CREATE TABLE author_list (
author_list.paper_id (varchar(25)),
author_list.author_id (INTEGER),
author_list.affiliation_id (INTEGER),
)
CREATE TABLE citation (
citation.paper_id (varchar(25)),
citation.cited_paper_id (varchar(25)),
)
CREATE TABLE paper (
paper.paper_id (varchar(25)),
paper.title (varchar(255)),
paper.venue (varchar(255)),
paper.year (INTEGER),
)
Possible JOINs:
author_list.paper_id = paper.paper_id
author_list.author_id = author.author_id
author_list.affiliation_id = affiliation.affiliation_id
citation.paper_id = paper.paper_id
citation.cited_paper_id = paper.paper_id
| {
'Affiliation': ['affiliation_id', 'name', 'address'],
'Author': ['author_id', 'name', 'email'],
'Author_list': ['paper_id', 'author_id', 'affiliation_id'],
'Citation': ['paper_id', 'cited_paper_id'],
'Paper': ['paper_id', 'title', 'venue', 'year']
} | {
'Paper': ['paper_id', 'title']
} | TABLE Affiliation (
Affiliation.affiliation_id (INTEGER),
Affiliation.name (varchar(255)),
Affiliation.address (varchar(255)),
)
TABLE Author (
Author.author_id (INTEGER),
Author.name (varchar(255)),
Author.email (varchar(255)),
)
TABLE Author_list (
Author_list.paper_id (varchar(25)),
Author_list.author_id (INTEGER),
Author_list.affiliation_id (INTEGER),
)
TABLE Citation (
Citation.paper_id (varchar(25)),
Citation.cited_paper_id (varchar(25)),
)
TABLE Paper (
Paper.paper_id (varchar(25)),
Paper.title (varchar(255)),
Paper.venue (varchar(255)),
Paper.year (INTEGER),
)
Possible JOINs:
Author_list.paper_id = Paper.paper_id
Author_list.author_id = Author.author_id
Author_list.affiliation_id = Affiliation.affiliation_id
Citation.paper_id = Paper.paper_id
Citation.cited_paper_id = Paper.paper_id
| TABLE Affiliation (
Affiliation.affiliation_id (INTEGER),
Affiliation.name (varchar(255)),
Affiliation.address (varchar(255)),
)
TABLE Author (
Author.author_id (INTEGER),
Author.name (varchar(255)),
Author.email (varchar(255)),
)
TABLE Author_list (
Author_list.paper_id (varchar(25)),
Author_list.author_id (INTEGER),
Author_list.affiliation_id (INTEGER),
)
TABLE Citation (
Citation.paper_id (varchar(25)),
Citation.cited_paper_id (varchar(25)),
)
TABLE Paper (
Paper.paper_id (varchar(25)),
Paper.title (varchar(255)),
Paper.venue (varchar(255)),
Paper.year (INTEGER),
)
Possible JOINs:
Author_list.paper_id = Paper.paper_id
Author_list.author_id = Author.author_id
Author_list.affiliation_id = Affiliation.affiliation_id
Citation.paper_id = Paper.paper_id
Citation.cited_paper_id = Paper.paper_id
| TABLE affiliation (
affiliation.affiliation_id (INTEGER),
affiliation.name (varchar(255)),
affiliation.address (varchar(255)),
)
TABLE author (
author.author_id (INTEGER),
author.name (varchar(255)),
author.email (varchar(255)),
)
TABLE author_list (
author_list.paper_id (varchar(25)),
author_list.author_id (INTEGER),
author_list.affiliation_id (INTEGER),
)
TABLE citation (
citation.paper_id (varchar(25)),
citation.cited_paper_id (varchar(25)),
)
TABLE paper (
paper.paper_id (varchar(25)),
paper.title (varchar(255)),
paper.venue (varchar(255)),
paper.year (INTEGER),
)
Possible JOINs:
author_list.paper_id = paper.paper_id
author_list.author_id = author.author_id
author_list.affiliation_id = affiliation.affiliation_id
citation.paper_id = paper.paper_id
citation.cited_paper_id = paper.paper_id
|
bike_racing |
CREATE TABLE bike (
id INTEGER,
product_name TEXT,
weight INTEGER,
price REAL,
material TEXT,
PRIMARY KEY (id)
)
CREATE TABLE cyclist (
id INTEGER,
heat INTEGER,
name TEXT,
nation TEXT,
result REAL,
PRIMARY KEY (id)
)
CREATE TABLE cyclists_own_bikes (
cyclist_id INTEGER,
bike_id INTEGER,
purchase_year INTEGER,
PRIMARY KEY (cyclist_id, bike_id),
FOREIGN KEY(bike_id) REFERENCES bike (id),
FOREIGN KEY(cyclist_id) REFERENCES cyclist (id)
) | What are the id and name of the cyclist who owns the most bikes? | extra | Table bike (
bike.id (INT),
bike.product_name (TEXT),
bike.weight (INT),
bike.price (REAL),
bike.material (TEXT),
)
Table cyclist (
cyclist.id (INT),
cyclist.heat (INT),
cyclist.name (TEXT),
cyclist.nation (TEXT),
cyclist.result (REAL),
)
Table cyclists_own_bikes (
cyclists_own_bikes.cyclist_id (INT),
cyclists_own_bikes.bike_id (INT),
cyclists_own_bikes.purchase_year (INT),
)
Possible JOINs:
cyclists_own_bikes.cyclist_id = cyclist.id
cyclists_own_bikes.bike_id = bike.id
| SELECT cyclist.id , cyclist.name FROM cyclist JOIN cyclists_own_bikes ON cyclist.id = cyclists_own_bikes.cyclist_id GROUP BY cyclist.id ORDER BY count(*) DESC LIMIT 1 | {
'cyclist': ['id', 'name'],
'cyclists_own_bikes': ['cyclist_id']
} | CREATE TABLE bike (
bike.id (INT),
bike.product_name (TEXT),
bike.weight (INT),
bike.price (REAL),
bike.material (TEXT),
)
CREATE TABLE cyclist (
cyclist.id (INT),
cyclist.heat (INT),
cyclist.name (TEXT),
cyclist.nation (TEXT),
cyclist.result (REAL),
)
CREATE TABLE cyclists_own_bikes (
cyclists_own_bikes.cyclist_id (INT),
cyclists_own_bikes.bike_id (INT),
cyclists_own_bikes.purchase_year (INT),
)
Possible JOINs:
cyclists_own_bikes.cyclist_id = cyclist.id
cyclists_own_bikes.bike_id = bike.id
| Table bike (
bike.id (INT),
bike.product_name (TEXT),
bike.weight (INT),
bike.price (REAL),
bike.material (TEXT),
)
Table cyclist (
cyclist.id (INT),
cyclist.heat (INT),
cyclist.name (TEXT),
cyclist.nation (TEXT),
cyclist.result (REAL),
)
Table cyclists_own_bikes (
cyclists_own_bikes.cyclist_id (INT),
cyclists_own_bikes.bike_id (INT),
cyclists_own_bikes.purchase_year (INT),
)
Possible JOINs:
cyclists_own_bikes.cyclist_id = cyclist.id
cyclists_own_bikes.bike_id = bike.id
| CREATE TABLE bike (
bike.id (INT),
bike.product_name (TEXT),
bike.weight (INT),
bike.price (REAL),
bike.material (TEXT),
)
CREATE TABLE cyclist (
cyclist.id (INT),
cyclist.heat (INT),
cyclist.name (TEXT),
cyclist.nation (TEXT),
cyclist.result (REAL),
)
CREATE TABLE cyclists_own_bikes (
cyclists_own_bikes.cyclist_id (INT),
cyclists_own_bikes.bike_id (INT),
cyclists_own_bikes.purchase_year (INT),
)
Possible JOINs:
cyclists_own_bikes.cyclist_id = cyclist.id
cyclists_own_bikes.bike_id = bike.id
| Table bike (
bike.id (INT),
bike.product_name (TEXT),
bike.weight (INT),
bike.price (REAL),
bike.material (TEXT),
)
Table cyclist (
cyclist.id (INT),
cyclist.heat (INT),
cyclist.name (TEXT),
cyclist.nation (TEXT),
cyclist.result (REAL),
)
Table cyclists_own_bikes (
cyclists_own_bikes.cyclist_id (INT),
cyclists_own_bikes.bike_id (INT),
cyclists_own_bikes.purchase_year (INT),
)
Possible JOINs:
cyclists_own_bikes.cyclist_id = cyclist.id
cyclists_own_bikes.bike_id = bike.id
| CREATE TABLE bike (
bike.id (INT),
bike.product_name (TEXT),
bike.weight (INT),
bike.price (REAL),
bike.material (TEXT),
)
CREATE TABLE cyclist (
cyclist.id (INT),
cyclist.heat (INT),
cyclist.name (TEXT),
cyclist.nation (TEXT),
cyclist.result (REAL),
)
CREATE TABLE cyclists_own_bikes (
cyclists_own_bikes.cyclist_id (INT),
cyclists_own_bikes.bike_id (INT),
cyclists_own_bikes.purchase_year (INT),
)
Possible JOINs:
cyclists_own_bikes.cyclist_id = cyclist.id
cyclists_own_bikes.bike_id = bike.id
| {
'bike': ['id', 'product_name', 'weight', 'price', 'material'],
'cyclist': ['id', 'heat', 'name', 'nation', 'result'],
'cyclists_own_bikes': ['cyclist_id', 'bike_id', 'purchase_year']
} | {
'cyclist': ['id', 'name'],
'cyclists_own_bikes': ['cyclist_id']
} | TABLE bike (
bike.id (INT),
bike.product_name (TEXT),
bike.weight (INT),
bike.price (REAL),
bike.material (TEXT),
)
TABLE cyclist (
cyclist.id (INT),
cyclist.heat (INT),
cyclist.name (TEXT),
cyclist.nation (TEXT),
cyclist.result (REAL),
)
TABLE cyclists_own_bikes (
cyclists_own_bikes.cyclist_id (INT),
cyclists_own_bikes.bike_id (INT),
cyclists_own_bikes.purchase_year (INT),
)
Possible JOINs:
cyclists_own_bikes.cyclist_id = cyclist.id
cyclists_own_bikes.bike_id = bike.id
| TABLE bike (
bike.id (INT),
bike.product_name (TEXT),
bike.weight (INT),
bike.price (REAL),
bike.material (TEXT),
)
TABLE cyclist (
cyclist.id (INT),
cyclist.heat (INT),
cyclist.name (TEXT),
cyclist.nation (TEXT),
cyclist.result (REAL),
)
TABLE cyclists_own_bikes (
cyclists_own_bikes.cyclist_id (INT),
cyclists_own_bikes.bike_id (INT),
cyclists_own_bikes.purchase_year (INT),
)
Possible JOINs:
cyclists_own_bikes.cyclist_id = cyclist.id
cyclists_own_bikes.bike_id = bike.id
| TABLE bike (
bike.id (INT),
bike.product_name (TEXT),
bike.weight (INT),
bike.price (REAL),
bike.material (TEXT),
)
TABLE cyclist (
cyclist.id (INT),
cyclist.heat (INT),
cyclist.name (TEXT),
cyclist.nation (TEXT),
cyclist.result (REAL),
)
TABLE cyclists_own_bikes (
cyclists_own_bikes.cyclist_id (INT),
cyclists_own_bikes.bike_id (INT),
cyclists_own_bikes.purchase_year (INT),
)
Possible JOINs:
cyclists_own_bikes.cyclist_id = cyclist.id
cyclists_own_bikes.bike_id = bike.id
|
car_road_race |
CREATE TABLE driver (
"Driver_ID" INTEGER,
"Driver_Name" TEXT,
"Entrant" TEXT,
"Constructor" TEXT,
"Chassis" TEXT,
"Engine" TEXT,
"Age" INTEGER,
PRIMARY KEY ("Driver_ID")
)
CREATE TABLE race (
"Road" INTEGER,
"Driver_ID" INTEGER,
"Race_Name" TEXT,
"Pole_Position" TEXT,
"Fastest_Lap" TEXT,
"Winning_driver" TEXT,
"Winning_team" TEXT,
"Report" TEXT,
PRIMARY KEY ("Road"),
FOREIGN KEY("Driver_ID") REFERENCES driver ("Driver_ID")
) | Return the different constructors of drivers, ordered by age ascending. | easy | Table driver (
driver.Driver_ID (INT),
driver.Driver_Name (TEXT),
driver.Entrant (TEXT),
driver.Constructor (TEXT),
driver.Chassis (TEXT),
driver.Engine (TEXT),
driver.Age (INT),
)
Table race (
race.Road (INT),
race.Driver_ID (INT),
race.Race_Name (TEXT),
race.Pole_Position (TEXT),
race.Fastest_Lap (TEXT),
race.Winning_driver (TEXT),
race.Winning_team (TEXT),
race.Report (TEXT),
)
Possible JOINs:
race.Driver_ID = driver.Driver_ID
| SELECT DISTINCT CONSTRUCTOR FROM driver ORDER BY Age ASC | {
'driver': ['driver_id', 'constructor', 'age']
} | CREATE TABLE driver (
driver.Driver_ID (INT),
driver.Driver_Name (TEXT),
driver.Entrant (TEXT),
driver.Constructor (TEXT),
driver.Chassis (TEXT),
driver.Engine (TEXT),
driver.Age (INT),
)
CREATE TABLE race (
race.Road (INT),
race.Driver_ID (INT),
race.Race_Name (TEXT),
race.Pole_Position (TEXT),
race.Fastest_Lap (TEXT),
race.Winning_driver (TEXT),
race.Winning_team (TEXT),
race.Report (TEXT),
)
Possible JOINs:
race.Driver_ID = driver.Driver_ID
| Table driver (
driver.driver_id (INT),
driver.driver_name (TEXT),
driver.entrant (TEXT),
driver.constructor (TEXT),
driver.chassis (TEXT),
driver.engine (TEXT),
driver.age (INT),
)
Table race (
race.road (INT),
race.driver_id (INT),
race.race_name (TEXT),
race.pole_position (TEXT),
race.fastest_lap (TEXT),
race.winning_driver (TEXT),
race.winning_team (TEXT),
race.report (TEXT),
)
Possible JOINs:
race.driver_id = driver.driver_id
| CREATE TABLE driver (
driver.driver_id (INT),
driver.driver_name (TEXT),
driver.entrant (TEXT),
driver.constructor (TEXT),
driver.chassis (TEXT),
driver.engine (TEXT),
driver.age (INT),
)
CREATE TABLE race (
race.road (INT),
race.driver_id (INT),
race.race_name (TEXT),
race.pole_position (TEXT),
race.fastest_lap (TEXT),
race.winning_driver (TEXT),
race.winning_team (TEXT),
race.report (TEXT),
)
Possible JOINs:
race.driver_id = driver.driver_id
| Table driver (
driver.driver_id (INT),
driver.driver_name (TEXT),
driver.entrant (TEXT),
driver.constructor (TEXT),
driver.chassis (TEXT),
driver.engine (TEXT),
driver.age (INT),
)
Table race (
race.road (INT),
race.driver_id (INT),
race.race_name (TEXT),
race.pole_position (TEXT),
race.fastest_lap (TEXT),
race.winning_driver (TEXT),
race.winning_team (TEXT),
race.report (TEXT),
)
Possible JOINs:
race.driver_id = driver.driver_id
| CREATE TABLE driver (
driver.driver_id (INT),
driver.driver_name (TEXT),
driver.entrant (TEXT),
driver.constructor (TEXT),
driver.chassis (TEXT),
driver.engine (TEXT),
driver.age (INT),
)
CREATE TABLE race (
race.road (INT),
race.driver_id (INT),
race.race_name (TEXT),
race.pole_position (TEXT),
race.fastest_lap (TEXT),
race.winning_driver (TEXT),
race.winning_team (TEXT),
race.report (TEXT),
)
Possible JOINs:
race.driver_id = driver.driver_id
| {
'driver': ['Driver_ID', 'Driver_Name', 'Entrant', 'Constructor', 'Chassis', 'Engine', 'Age'],
'race': ['Road', 'Driver_ID', 'Race_Name', 'Pole_Position', 'Fastest_Lap', 'Winning_driver', 'Winning_team', 'Report']
} | {
'driver': ['Driver_ID', 'Constructor', 'Age']
} | TABLE driver (
driver.Driver_ID (INT),
driver.Driver_Name (TEXT),
driver.Entrant (TEXT),
driver.Constructor (TEXT),
driver.Chassis (TEXT),
driver.Engine (TEXT),
driver.Age (INT),
)
TABLE race (
race.Road (INT),
race.Driver_ID (INT),
race.Race_Name (TEXT),
race.Pole_Position (TEXT),
race.Fastest_Lap (TEXT),
race.Winning_driver (TEXT),
race.Winning_team (TEXT),
race.Report (TEXT),
)
Possible JOINs:
race.Driver_ID = driver.Driver_ID
| TABLE driver (
driver.driver_id (INT),
driver.driver_name (TEXT),
driver.entrant (TEXT),
driver.constructor (TEXT),
driver.chassis (TEXT),
driver.engine (TEXT),
driver.age (INT),
)
TABLE race (
race.road (INT),
race.driver_id (INT),
race.race_name (TEXT),
race.pole_position (TEXT),
race.fastest_lap (TEXT),
race.winning_driver (TEXT),
race.winning_team (TEXT),
race.report (TEXT),
)
Possible JOINs:
race.driver_id = driver.driver_id
| TABLE driver (
driver.driver_id (INT),
driver.driver_name (TEXT),
driver.entrant (TEXT),
driver.constructor (TEXT),
driver.chassis (TEXT),
driver.engine (TEXT),
driver.age (INT),
)
TABLE race (
race.road (INT),
race.driver_id (INT),
race.race_name (TEXT),
race.pole_position (TEXT),
race.fastest_lap (TEXT),
race.winning_driver (TEXT),
race.winning_team (TEXT),
race.report (TEXT),
)
Possible JOINs:
race.driver_id = driver.driver_id
|
cre_Doc_and_collections |
CREATE TABLE "Collection_Subset_Members" (
"Collection_ID" INTEGER NOT NULL,
"Related_Collection_ID" INTEGER NOT NULL,
"Collection_Subset_ID" INTEGER NOT NULL,
PRIMARY KEY ("Collection_ID", "Related_Collection_ID"),
FOREIGN KEY("Collection_ID") REFERENCES "Collections" ("Collection_ID"),
FOREIGN KEY("Related_Collection_ID") REFERENCES "Collections" ("Collection_ID"),
FOREIGN KEY("Collection_Subset_ID") REFERENCES "Collection_Subsets" ("Collection_Subset_ID")
)
CREATE TABLE "Collection_Subsets" (
"Collection_Subset_ID" INTEGER NOT NULL,
"Collection_Subset_Name" VARCHAR(255) NOT NULL,
"Collecrtion_Subset_Details" VARCHAR(255) NOT NULL,
PRIMARY KEY ("Collection_Subset_ID")
)
CREATE TABLE "Collections" (
"Collection_ID" INTEGER NOT NULL,
"Parent_Collection_ID" INTEGER,
"Collection_Name" VARCHAR(255),
"Collection_Description" VARCHAR(255),
PRIMARY KEY ("Collection_ID")
)
CREATE TABLE "Document_Objects" (
"Document_Object_ID" INTEGER NOT NULL,
"Parent_Document_Object_ID" INTEGER,
"Owner" VARCHAR(255),
"Description" VARCHAR(255),
"Other_Details" VARCHAR(255),
PRIMARY KEY ("Document_Object_ID")
)
CREATE TABLE "Document_Subset_Members" (
"Document_Object_ID" INTEGER NOT NULL,
"Related_Document_Object_ID" INTEGER NOT NULL,
"Document_Subset_ID" INTEGER NOT NULL,
PRIMARY KEY ("Document_Object_ID", "Related_Document_Object_ID"),
FOREIGN KEY("Document_Object_ID") REFERENCES "Document_Objects" ("Document_Object_ID"),
FOREIGN KEY("Document_Subset_ID") REFERENCES "Document_Subsets" ("Document_Subset_ID"),
FOREIGN KEY("Related_Document_Object_ID") REFERENCES "Document_Objects" ("Document_Object_ID")
)
CREATE TABLE "Document_Subsets" (
"Document_Subset_ID" INTEGER NOT NULL,
"Document_Subset_Name" VARCHAR(255) NOT NULL,
"Document_Subset_Details" VARCHAR(255) NOT NULL,
PRIMARY KEY ("Document_Subset_ID")
)
CREATE TABLE "Documents_in_Collections" (
"Document_Object_ID" INTEGER NOT NULL,
"Collection_ID" INTEGER NOT NULL,
PRIMARY KEY ("Document_Object_ID", "Collection_ID"),
FOREIGN KEY("Document_Object_ID") REFERENCES "Document_Objects" ("Document_Object_ID"),
FOREIGN KEY("Collection_ID") REFERENCES "Collections" ("Collection_ID")
) | List subset id, name and number of different documents in each subset. | medium | Table Collection_Subset_Members (
Collection_Subset_Members.Collection_ID (INTEGER),
Collection_Subset_Members.Related_Collection_ID (INTEGER),
Collection_Subset_Members.Collection_Subset_ID (INTEGER),
)
Table Collection_Subsets (
Collection_Subsets.Collection_Subset_ID (INTEGER),
Collection_Subsets.Collection_Subset_Name (VARCHAR(255)),
Collection_Subsets.Collecrtion_Subset_Details (VARCHAR(255)),
)
Table Collections (
Collections.Collection_ID (INTEGER),
Collections.Parent_Collection_ID (INTEGER),
Collections.Collection_Name (VARCHAR(255)),
Collections.Collection_Description (VARCHAR(255)),
)
Table Document_Objects (
Document_Objects.Document_Object_ID (INTEGER),
Document_Objects.Parent_Document_Object_ID (INTEGER),
Document_Objects.Owner (VARCHAR(255)),
Document_Objects.Description (VARCHAR(255)),
Document_Objects.Other_Details (VARCHAR(255)),
)
Table Document_Subset_Members (
Document_Subset_Members.Document_Object_ID (INTEGER),
Document_Subset_Members.Related_Document_Object_ID (INTEGER),
Document_Subset_Members.Document_Subset_ID (INTEGER),
)
Table Document_Subsets (
Document_Subsets.Document_Subset_ID (INTEGER),
Document_Subsets.Document_Subset_Name (VARCHAR(255)),
Document_Subsets.Document_Subset_Details (VARCHAR(255)),
)
Table Documents_in_Collections (
Documents_in_Collections.Document_Object_ID (INTEGER),
Documents_in_Collections.Collection_ID (INTEGER),
)
Possible JOINs:
Collection_Subset_Members.Collection_ID = Collections.Collection_ID
Collection_Subset_Members.Related_Collection_ID = Collections.Collection_ID
Collection_Subset_Members.Collection_Subset_ID = Collection_Subsets.Collection_Subset_ID
Document_Subset_Members.Document_Object_ID = Document_Objects.Document_Object_ID
Document_Subset_Members.Related_Document_Object_ID = Document_Objects.Document_Object_ID
Document_Subset_Members.Document_Subset_ID = Document_Subsets.Document_Subset_ID
Documents_in_Collections.Document_Object_ID = Document_Objects.Document_Object_ID
Documents_in_Collections.Collection_ID = Collections.Collection_ID
| SELECT Document_Subset_Members.Document_Subset_ID , Document_Subsets.Document_Subset_Name , count(DISTINCT Document_Subset_Members.Document_Object_ID) FROM Document_Subset_Members JOIN Document_Subsets ON Document_Subset_Members.Document_Subset_ID = Document_Subsets.Document_Subset_ID GROUP BY Document_Subset_Members.Document_Subset_ID; | {
'document_subset_members': ['document_object_id', 'document_subset_id'],
'document_subsets': ['document_subset_id', 'document_subset_name']
} | CREATE TABLE Collection_Subset_Members (
Collection_Subset_Members.Collection_ID (INTEGER),
Collection_Subset_Members.Related_Collection_ID (INTEGER),
Collection_Subset_Members.Collection_Subset_ID (INTEGER),
)
CREATE TABLE Collection_Subsets (
Collection_Subsets.Collection_Subset_ID (INTEGER),
Collection_Subsets.Collection_Subset_Name (VARCHAR(255)),
Collection_Subsets.Collecrtion_Subset_Details (VARCHAR(255)),
)
CREATE TABLE Collections (
Collections.Collection_ID (INTEGER),
Collections.Parent_Collection_ID (INTEGER),
Collections.Collection_Name (VARCHAR(255)),
Collections.Collection_Description (VARCHAR(255)),
)
CREATE TABLE Document_Objects (
Document_Objects.Document_Object_ID (INTEGER),
Document_Objects.Parent_Document_Object_ID (INTEGER),
Document_Objects.Owner (VARCHAR(255)),
Document_Objects.Description (VARCHAR(255)),
Document_Objects.Other_Details (VARCHAR(255)),
)
CREATE TABLE Document_Subset_Members (
Document_Subset_Members.Document_Object_ID (INTEGER),
Document_Subset_Members.Related_Document_Object_ID (INTEGER),
Document_Subset_Members.Document_Subset_ID (INTEGER),
)
CREATE TABLE Document_Subsets (
Document_Subsets.Document_Subset_ID (INTEGER),
Document_Subsets.Document_Subset_Name (VARCHAR(255)),
Document_Subsets.Document_Subset_Details (VARCHAR(255)),
)
CREATE TABLE Documents_in_Collections (
Documents_in_Collections.Document_Object_ID (INTEGER),
Documents_in_Collections.Collection_ID (INTEGER),
)
Possible JOINs:
Collection_Subset_Members.Collection_ID = Collections.Collection_ID
Collection_Subset_Members.Related_Collection_ID = Collections.Collection_ID
Collection_Subset_Members.Collection_Subset_ID = Collection_Subsets.Collection_Subset_ID
Document_Subset_Members.Document_Object_ID = Document_Objects.Document_Object_ID
Document_Subset_Members.Related_Document_Object_ID = Document_Objects.Document_Object_ID
Document_Subset_Members.Document_Subset_ID = Document_Subsets.Document_Subset_ID
Documents_in_Collections.Document_Object_ID = Document_Objects.Document_Object_ID
Documents_in_Collections.Collection_ID = Collections.Collection_ID
| Table Collection_Subset_Members (
Collection_Subset_Members.collection_id (INTEGER),
Collection_Subset_Members.related_collection_id (INTEGER),
Collection_Subset_Members.collection_subset_id (INTEGER),
)
Table Collection_Subsets (
Collection_Subsets.collection_subset_id (INTEGER),
Collection_Subsets.collection_subset_name (VARCHAR(255)),
Collection_Subsets.collecrtion_subset_details (VARCHAR(255)),
)
Table Collections (
Collections.collection_id (INTEGER),
Collections.parent_collection_id (INTEGER),
Collections.collection_name (VARCHAR(255)),
Collections.collection_description (VARCHAR(255)),
)
Table Document_Objects (
Document_Objects.document_object_id (INTEGER),
Document_Objects.parent_document_object_id (INTEGER),
Document_Objects.owner (VARCHAR(255)),
Document_Objects.description (VARCHAR(255)),
Document_Objects.other_details (VARCHAR(255)),
)
Table Document_Subset_Members (
Document_Subset_Members.document_object_id (INTEGER),
Document_Subset_Members.related_document_object_id (INTEGER),
Document_Subset_Members.document_subset_id (INTEGER),
)
Table Document_Subsets (
Document_Subsets.document_subset_id (INTEGER),
Document_Subsets.document_subset_name (VARCHAR(255)),
Document_Subsets.document_subset_details (VARCHAR(255)),
)
Table Documents_in_Collections (
Documents_in_Collections.document_object_id (INTEGER),
Documents_in_Collections.collection_id (INTEGER),
)
Possible JOINs:
Collection_Subset_Members.collection_id = Collections.collection_id
Collection_Subset_Members.related_collection_id = Collections.collection_id
Collection_Subset_Members.collection_subset_id = Collection_Subsets.collection_subset_id
Document_Subset_Members.document_object_id = Document_Objects.document_object_id
Document_Subset_Members.related_document_object_id = Document_Objects.document_object_id
Document_Subset_Members.document_subset_id = Document_Subsets.document_subset_id
Documents_in_Collections.document_object_id = Document_Objects.document_object_id
Documents_in_Collections.collection_id = Collections.collection_id
| CREATE TABLE Collection_Subset_Members (
Collection_Subset_Members.collection_id (INTEGER),
Collection_Subset_Members.related_collection_id (INTEGER),
Collection_Subset_Members.collection_subset_id (INTEGER),
)
CREATE TABLE Collection_Subsets (
Collection_Subsets.collection_subset_id (INTEGER),
Collection_Subsets.collection_subset_name (VARCHAR(255)),
Collection_Subsets.collecrtion_subset_details (VARCHAR(255)),
)
CREATE TABLE Collections (
Collections.collection_id (INTEGER),
Collections.parent_collection_id (INTEGER),
Collections.collection_name (VARCHAR(255)),
Collections.collection_description (VARCHAR(255)),
)
CREATE TABLE Document_Objects (
Document_Objects.document_object_id (INTEGER),
Document_Objects.parent_document_object_id (INTEGER),
Document_Objects.owner (VARCHAR(255)),
Document_Objects.description (VARCHAR(255)),
Document_Objects.other_details (VARCHAR(255)),
)
CREATE TABLE Document_Subset_Members (
Document_Subset_Members.document_object_id (INTEGER),
Document_Subset_Members.related_document_object_id (INTEGER),
Document_Subset_Members.document_subset_id (INTEGER),
)
CREATE TABLE Document_Subsets (
Document_Subsets.document_subset_id (INTEGER),
Document_Subsets.document_subset_name (VARCHAR(255)),
Document_Subsets.document_subset_details (VARCHAR(255)),
)
CREATE TABLE Documents_in_Collections (
Documents_in_Collections.document_object_id (INTEGER),
Documents_in_Collections.collection_id (INTEGER),
)
Possible JOINs:
Collection_Subset_Members.collection_id = Collections.collection_id
Collection_Subset_Members.related_collection_id = Collections.collection_id
Collection_Subset_Members.collection_subset_id = Collection_Subsets.collection_subset_id
Document_Subset_Members.document_object_id = Document_Objects.document_object_id
Document_Subset_Members.related_document_object_id = Document_Objects.document_object_id
Document_Subset_Members.document_subset_id = Document_Subsets.document_subset_id
Documents_in_Collections.document_object_id = Document_Objects.document_object_id
Documents_in_Collections.collection_id = Collections.collection_id
| Table collection_subset_members (
collection_subset_members.collection_id (INTEGER),
collection_subset_members.related_collection_id (INTEGER),
collection_subset_members.collection_subset_id (INTEGER),
)
Table collection_subsets (
collection_subsets.collection_subset_id (INTEGER),
collection_subsets.collection_subset_name (VARCHAR(255)),
collection_subsets.collecrtion_subset_details (VARCHAR(255)),
)
Table collections (
collections.collection_id (INTEGER),
collections.parent_collection_id (INTEGER),
collections.collection_name (VARCHAR(255)),
collections.collection_description (VARCHAR(255)),
)
Table document_objects (
document_objects.document_object_id (INTEGER),
document_objects.parent_document_object_id (INTEGER),
document_objects.owner (VARCHAR(255)),
document_objects.description (VARCHAR(255)),
document_objects.other_details (VARCHAR(255)),
)
Table document_subset_members (
document_subset_members.document_object_id (INTEGER),
document_subset_members.related_document_object_id (INTEGER),
document_subset_members.document_subset_id (INTEGER),
)
Table document_subsets (
document_subsets.document_subset_id (INTEGER),
document_subsets.document_subset_name (VARCHAR(255)),
document_subsets.document_subset_details (VARCHAR(255)),
)
Table documents_in_collections (
documents_in_collections.document_object_id (INTEGER),
documents_in_collections.collection_id (INTEGER),
)
Possible JOINs:
collection_subset_members.collection_id = collections.collection_id
collection_subset_members.related_collection_id = collections.collection_id
collection_subset_members.collection_subset_id = collection_subsets.collection_subset_id
document_subset_members.document_object_id = document_objects.document_object_id
document_subset_members.related_document_object_id = document_objects.document_object_id
document_subset_members.document_subset_id = document_subsets.document_subset_id
documents_in_collections.document_object_id = document_objects.document_object_id
documents_in_collections.collection_id = collections.collection_id
| CREATE TABLE collection_subset_members (
collection_subset_members.collection_id (INTEGER),
collection_subset_members.related_collection_id (INTEGER),
collection_subset_members.collection_subset_id (INTEGER),
)
CREATE TABLE collection_subsets (
collection_subsets.collection_subset_id (INTEGER),
collection_subsets.collection_subset_name (VARCHAR(255)),
collection_subsets.collecrtion_subset_details (VARCHAR(255)),
)
CREATE TABLE collections (
collections.collection_id (INTEGER),
collections.parent_collection_id (INTEGER),
collections.collection_name (VARCHAR(255)),
collections.collection_description (VARCHAR(255)),
)
CREATE TABLE document_objects (
document_objects.document_object_id (INTEGER),
document_objects.parent_document_object_id (INTEGER),
document_objects.owner (VARCHAR(255)),
document_objects.description (VARCHAR(255)),
document_objects.other_details (VARCHAR(255)),
)
CREATE TABLE document_subset_members (
document_subset_members.document_object_id (INTEGER),
document_subset_members.related_document_object_id (INTEGER),
document_subset_members.document_subset_id (INTEGER),
)
CREATE TABLE document_subsets (
document_subsets.document_subset_id (INTEGER),
document_subsets.document_subset_name (VARCHAR(255)),
document_subsets.document_subset_details (VARCHAR(255)),
)
CREATE TABLE documents_in_collections (
documents_in_collections.document_object_id (INTEGER),
documents_in_collections.collection_id (INTEGER),
)
Possible JOINs:
collection_subset_members.collection_id = collections.collection_id
collection_subset_members.related_collection_id = collections.collection_id
collection_subset_members.collection_subset_id = collection_subsets.collection_subset_id
document_subset_members.document_object_id = document_objects.document_object_id
document_subset_members.related_document_object_id = document_objects.document_object_id
document_subset_members.document_subset_id = document_subsets.document_subset_id
documents_in_collections.document_object_id = document_objects.document_object_id
documents_in_collections.collection_id = collections.collection_id
| {
'Document_Subsets': ['Document_Subset_ID', 'Document_Subset_Name', 'Document_Subset_Details'],
'Collection_Subsets': ['Collection_Subset_ID', 'Collection_Subset_Name', 'Collecrtion_Subset_Details'],
'Document_Objects': ['Document_Object_ID', 'Parent_Document_Object_ID', 'Owner', 'Description', 'Other_Details'],
'Collections': ['Collection_ID', 'Parent_Collection_ID', 'Collection_Name', 'Collection_Description'],
'Documents_in_Collections': ['Document_Object_ID', 'Collection_ID'],
'Document_Subset_Members': ['Document_Object_ID', 'Related_Document_Object_ID', 'Document_Subset_ID'],
'Collection_Subset_Members': ['Collection_ID', 'Related_Collection_ID', 'Collection_Subset_ID']
} | {
'Document_Subset_Members': ['Document_Object_ID', 'Document_Subset_ID'],
'Document_Subsets': ['Document_Subset_ID', 'Document_Subset_Name']
} | TABLE Collection_Subset_Members (
Collection_Subset_Members.Collection_ID (INTEGER),
Collection_Subset_Members.Related_Collection_ID (INTEGER),
Collection_Subset_Members.Collection_Subset_ID (INTEGER),
)
TABLE Collection_Subsets (
Collection_Subsets.Collection_Subset_ID (INTEGER),
Collection_Subsets.Collection_Subset_Name (VARCHAR(255)),
Collection_Subsets.Collecrtion_Subset_Details (VARCHAR(255)),
)
TABLE Collections (
Collections.Collection_ID (INTEGER),
Collections.Parent_Collection_ID (INTEGER),
Collections.Collection_Name (VARCHAR(255)),
Collections.Collection_Description (VARCHAR(255)),
)
TABLE Document_Objects (
Document_Objects.Document_Object_ID (INTEGER),
Document_Objects.Parent_Document_Object_ID (INTEGER),
Document_Objects.Owner (VARCHAR(255)),
Document_Objects.Description (VARCHAR(255)),
Document_Objects.Other_Details (VARCHAR(255)),
)
TABLE Document_Subset_Members (
Document_Subset_Members.Document_Object_ID (INTEGER),
Document_Subset_Members.Related_Document_Object_ID (INTEGER),
Document_Subset_Members.Document_Subset_ID (INTEGER),
)
TABLE Document_Subsets (
Document_Subsets.Document_Subset_ID (INTEGER),
Document_Subsets.Document_Subset_Name (VARCHAR(255)),
Document_Subsets.Document_Subset_Details (VARCHAR(255)),
)
TABLE Documents_in_Collections (
Documents_in_Collections.Document_Object_ID (INTEGER),
Documents_in_Collections.Collection_ID (INTEGER),
)
Possible JOINs:
Collection_Subset_Members.Collection_ID = Collections.Collection_ID
Collection_Subset_Members.Related_Collection_ID = Collections.Collection_ID
Collection_Subset_Members.Collection_Subset_ID = Collection_Subsets.Collection_Subset_ID
Document_Subset_Members.Document_Object_ID = Document_Objects.Document_Object_ID
Document_Subset_Members.Related_Document_Object_ID = Document_Objects.Document_Object_ID
Document_Subset_Members.Document_Subset_ID = Document_Subsets.Document_Subset_ID
Documents_in_Collections.Document_Object_ID = Document_Objects.Document_Object_ID
Documents_in_Collections.Collection_ID = Collections.Collection_ID
| TABLE Collection_Subset_Members (
Collection_Subset_Members.collection_id (INTEGER),
Collection_Subset_Members.related_collection_id (INTEGER),
Collection_Subset_Members.collection_subset_id (INTEGER),
)
TABLE Collection_Subsets (
Collection_Subsets.collection_subset_id (INTEGER),
Collection_Subsets.collection_subset_name (VARCHAR(255)),
Collection_Subsets.collecrtion_subset_details (VARCHAR(255)),
)
TABLE Collections (
Collections.collection_id (INTEGER),
Collections.parent_collection_id (INTEGER),
Collections.collection_name (VARCHAR(255)),
Collections.collection_description (VARCHAR(255)),
)
TABLE Document_Objects (
Document_Objects.document_object_id (INTEGER),
Document_Objects.parent_document_object_id (INTEGER),
Document_Objects.owner (VARCHAR(255)),
Document_Objects.description (VARCHAR(255)),
Document_Objects.other_details (VARCHAR(255)),
)
TABLE Document_Subset_Members (
Document_Subset_Members.document_object_id (INTEGER),
Document_Subset_Members.related_document_object_id (INTEGER),
Document_Subset_Members.document_subset_id (INTEGER),
)
TABLE Document_Subsets (
Document_Subsets.document_subset_id (INTEGER),
Document_Subsets.document_subset_name (VARCHAR(255)),
Document_Subsets.document_subset_details (VARCHAR(255)),
)
TABLE Documents_in_Collections (
Documents_in_Collections.document_object_id (INTEGER),
Documents_in_Collections.collection_id (INTEGER),
)
Possible JOINs:
Collection_Subset_Members.collection_id = Collections.collection_id
Collection_Subset_Members.related_collection_id = Collections.collection_id
Collection_Subset_Members.collection_subset_id = Collection_Subsets.collection_subset_id
Document_Subset_Members.document_object_id = Document_Objects.document_object_id
Document_Subset_Members.related_document_object_id = Document_Objects.document_object_id
Document_Subset_Members.document_subset_id = Document_Subsets.document_subset_id
Documents_in_Collections.document_object_id = Document_Objects.document_object_id
Documents_in_Collections.collection_id = Collections.collection_id
| TABLE collection_subset_members (
collection_subset_members.collection_id (INTEGER),
collection_subset_members.related_collection_id (INTEGER),
collection_subset_members.collection_subset_id (INTEGER),
)
TABLE collection_subsets (
collection_subsets.collection_subset_id (INTEGER),
collection_subsets.collection_subset_name (VARCHAR(255)),
collection_subsets.collecrtion_subset_details (VARCHAR(255)),
)
TABLE collections (
collections.collection_id (INTEGER),
collections.parent_collection_id (INTEGER),
collections.collection_name (VARCHAR(255)),
collections.collection_description (VARCHAR(255)),
)
TABLE document_objects (
document_objects.document_object_id (INTEGER),
document_objects.parent_document_object_id (INTEGER),
document_objects.owner (VARCHAR(255)),
document_objects.description (VARCHAR(255)),
document_objects.other_details (VARCHAR(255)),
)
TABLE document_subset_members (
document_subset_members.document_object_id (INTEGER),
document_subset_members.related_document_object_id (INTEGER),
document_subset_members.document_subset_id (INTEGER),
)
TABLE document_subsets (
document_subsets.document_subset_id (INTEGER),
document_subsets.document_subset_name (VARCHAR(255)),
document_subsets.document_subset_details (VARCHAR(255)),
)
TABLE documents_in_collections (
documents_in_collections.document_object_id (INTEGER),
documents_in_collections.collection_id (INTEGER),
)
Possible JOINs:
collection_subset_members.collection_id = collections.collection_id
collection_subset_members.related_collection_id = collections.collection_id
collection_subset_members.collection_subset_id = collection_subsets.collection_subset_id
document_subset_members.document_object_id = document_objects.document_object_id
document_subset_members.related_document_object_id = document_objects.document_object_id
document_subset_members.document_subset_id = document_subsets.document_subset_id
documents_in_collections.document_object_id = document_objects.document_object_id
documents_in_collections.collection_id = collections.collection_id
|
pilot_1 |
CREATE TABLE "Hangar" (
plane_name CHAR(15) NOT NULL,
location CHAR(15),
PRIMARY KEY (plane_name)
)
CREATE TABLE "PilotSkills" (
pilot_name CHAR(15) NOT NULL,
plane_name CHAR(15) NOT NULL,
age INTEGER,
PRIMARY KEY (pilot_name, plane_name),
FOREIGN KEY(plane_name) REFERENCES "Hangar" (plane_name)
) | How many pilots are older than the youngest pilot who has Piper Cub? | hard | Table Hangar (
Hangar.plane_name (CHAR(15)),
Hangar.location (CHAR(15)),
)
Table PilotSkills (
PilotSkills.pilot_name (CHAR(15)),
PilotSkills.plane_name (CHAR(15)),
PilotSkills.age (INTEGER),
)
Possible JOINs:
PilotSkills.plane_name = Hangar.plane_name
| SELECT count(pilot_name) FROM pilotskills WHERE age > (SELECT min(age) FROM pilotskills WHERE plane_name = 'Piper Cub') | {
'pilotskills': ['pilot_name', 'plane_name', 'age']
} | CREATE TABLE Hangar (
Hangar.plane_name (CHAR(15)),
Hangar.location (CHAR(15)),
)
CREATE TABLE PilotSkills (
PilotSkills.pilot_name (CHAR(15)),
PilotSkills.plane_name (CHAR(15)),
PilotSkills.age (INTEGER),
)
Possible JOINs:
PilotSkills.plane_name = Hangar.plane_name
| Table Hangar (
Hangar.plane_name (CHAR(15)),
Hangar.location (CHAR(15)),
)
Table PilotSkills (
PilotSkills.pilot_name (CHAR(15)),
PilotSkills.plane_name (CHAR(15)),
PilotSkills.age (INTEGER),
)
Possible JOINs:
PilotSkills.plane_name = Hangar.plane_name
| CREATE TABLE Hangar (
Hangar.plane_name (CHAR(15)),
Hangar.location (CHAR(15)),
)
CREATE TABLE PilotSkills (
PilotSkills.pilot_name (CHAR(15)),
PilotSkills.plane_name (CHAR(15)),
PilotSkills.age (INTEGER),
)
Possible JOINs:
PilotSkills.plane_name = Hangar.plane_name
| Table hangar (
hangar.plane_name (CHAR(15)),
hangar.location (CHAR(15)),
)
Table pilotskills (
pilotskills.pilot_name (CHAR(15)),
pilotskills.plane_name (CHAR(15)),
pilotskills.age (INTEGER),
)
Possible JOINs:
pilotskills.plane_name = hangar.plane_name
| CREATE TABLE hangar (
hangar.plane_name (CHAR(15)),
hangar.location (CHAR(15)),
)
CREATE TABLE pilotskills (
pilotskills.pilot_name (CHAR(15)),
pilotskills.plane_name (CHAR(15)),
pilotskills.age (INTEGER),
)
Possible JOINs:
pilotskills.plane_name = hangar.plane_name
| {
'PilotSkills': ['pilot_name', 'plane_name', 'age'],
'Hangar': ['plane_name', 'location']
} | {
'PilotSkills': ['pilot_name', 'plane_name', 'age']
} | TABLE Hangar (
Hangar.plane_name (CHAR(15)),
Hangar.location (CHAR(15)),
)
TABLE PilotSkills (
PilotSkills.pilot_name (CHAR(15)),
PilotSkills.plane_name (CHAR(15)),
PilotSkills.age (INTEGER),
)
Possible JOINs:
PilotSkills.plane_name = Hangar.plane_name
| TABLE Hangar (
Hangar.plane_name (CHAR(15)),
Hangar.location (CHAR(15)),
)
TABLE PilotSkills (
PilotSkills.pilot_name (CHAR(15)),
PilotSkills.plane_name (CHAR(15)),
PilotSkills.age (INTEGER),
)
Possible JOINs:
PilotSkills.plane_name = Hangar.plane_name
| TABLE hangar (
hangar.plane_name (CHAR(15)),
hangar.location (CHAR(15)),
)
TABLE pilotskills (
pilotskills.pilot_name (CHAR(15)),
pilotskills.plane_name (CHAR(15)),
pilotskills.age (INTEGER),
)
Possible JOINs:
pilotskills.plane_name = hangar.plane_name
|
boat_1 |
CREATE TABLE "Boats" (
bid INTEGER,
name TEXT,
color TEXT,
PRIMARY KEY (bid)
)
CREATE TABLE "Reserves" (
sid INTEGER,
bid INTEGER,
day TEXT,
FOREIGN KEY(sid) REFERENCES "Sailors" (sid),
FOREIGN KEY(bid) REFERENCES "Boats" (bid)
)
CREATE TABLE "Sailors" (
sid INTEGER,
name TEXT,
rating INTEGER,
age INTEGER,
PRIMARY KEY (sid)
) | Find the average rating and largest age for the sailors | medium | Table Boats (
Boats.bid (INTEGER),
Boats.name (TEXT),
Boats.color (TEXT),
)
Table Reserves (
Reserves.sid (INTEGER),
Reserves.bid (INTEGER),
Reserves.day (TEXT),
)
Table Sailors (
Sailors.sid (INTEGER),
Sailors.name (TEXT),
Sailors.rating (INTEGER),
Sailors.age (INTEGER),
)
Possible JOINs:
Reserves.sid = Sailors.sid
Reserves.bid = Boats.bid
| SELECT AVG(rating) , MAX(age) FROM Sailors | {
'sailors': ['sid', 'rating', 'age']
} | CREATE TABLE Boats (
Boats.bid (INTEGER),
Boats.name (TEXT),
Boats.color (TEXT),
)
CREATE TABLE Reserves (
Reserves.sid (INTEGER),
Reserves.bid (INTEGER),
Reserves.day (TEXT),
)
CREATE TABLE Sailors (
Sailors.sid (INTEGER),
Sailors.name (TEXT),
Sailors.rating (INTEGER),
Sailors.age (INTEGER),
)
Possible JOINs:
Reserves.sid = Sailors.sid
Reserves.bid = Boats.bid
| Table Boats (
Boats.bid (INTEGER),
Boats.name (TEXT),
Boats.color (TEXT),
)
Table Reserves (
Reserves.sid (INTEGER),
Reserves.bid (INTEGER),
Reserves.day (TEXT),
)
Table Sailors (
Sailors.sid (INTEGER),
Sailors.name (TEXT),
Sailors.rating (INTEGER),
Sailors.age (INTEGER),
)
Possible JOINs:
Reserves.sid = Sailors.sid
Reserves.bid = Boats.bid
| CREATE TABLE Boats (
Boats.bid (INTEGER),
Boats.name (TEXT),
Boats.color (TEXT),
)
CREATE TABLE Reserves (
Reserves.sid (INTEGER),
Reserves.bid (INTEGER),
Reserves.day (TEXT),
)
CREATE TABLE Sailors (
Sailors.sid (INTEGER),
Sailors.name (TEXT),
Sailors.rating (INTEGER),
Sailors.age (INTEGER),
)
Possible JOINs:
Reserves.sid = Sailors.sid
Reserves.bid = Boats.bid
| Table boats (
boats.bid (INTEGER),
boats.name (TEXT),
boats.color (TEXT),
)
Table reserves (
reserves.sid (INTEGER),
reserves.bid (INTEGER),
reserves.day (TEXT),
)
Table sailors (
sailors.sid (INTEGER),
sailors.name (TEXT),
sailors.rating (INTEGER),
sailors.age (INTEGER),
)
Possible JOINs:
reserves.sid = sailors.sid
reserves.bid = boats.bid
| CREATE TABLE boats (
boats.bid (INTEGER),
boats.name (TEXT),
boats.color (TEXT),
)
CREATE TABLE reserves (
reserves.sid (INTEGER),
reserves.bid (INTEGER),
reserves.day (TEXT),
)
CREATE TABLE sailors (
sailors.sid (INTEGER),
sailors.name (TEXT),
sailors.rating (INTEGER),
sailors.age (INTEGER),
)
Possible JOINs:
reserves.sid = sailors.sid
reserves.bid = boats.bid
| {
'Sailors': ['sid', 'name', 'rating', 'age'],
'Boats': ['bid', 'name', 'color'],
'Reserves': ['sid', 'bid', 'day']
} | {
'Sailors': ['sid', 'rating', 'age']
} | TABLE Boats (
Boats.bid (INTEGER),
Boats.name (TEXT),
Boats.color (TEXT),
)
TABLE Reserves (
Reserves.sid (INTEGER),
Reserves.bid (INTEGER),
Reserves.day (TEXT),
)
TABLE Sailors (
Sailors.sid (INTEGER),
Sailors.name (TEXT),
Sailors.rating (INTEGER),
Sailors.age (INTEGER),
)
Possible JOINs:
Reserves.sid = Sailors.sid
Reserves.bid = Boats.bid
| TABLE Boats (
Boats.bid (INTEGER),
Boats.name (TEXT),
Boats.color (TEXT),
)
TABLE Reserves (
Reserves.sid (INTEGER),
Reserves.bid (INTEGER),
Reserves.day (TEXT),
)
TABLE Sailors (
Sailors.sid (INTEGER),
Sailors.name (TEXT),
Sailors.rating (INTEGER),
Sailors.age (INTEGER),
)
Possible JOINs:
Reserves.sid = Sailors.sid
Reserves.bid = Boats.bid
| TABLE boats (
boats.bid (INTEGER),
boats.name (TEXT),
boats.color (TEXT),
)
TABLE reserves (
reserves.sid (INTEGER),
reserves.bid (INTEGER),
reserves.day (TEXT),
)
TABLE sailors (
sailors.sid (INTEGER),
sailors.name (TEXT),
sailors.rating (INTEGER),
sailors.age (INTEGER),
)
Possible JOINs:
reserves.sid = sailors.sid
reserves.bid = boats.bid
|
aan_1 |
CREATE TABLE "Affiliation" (
affiliation_id INTEGER NOT NULL,
name VARCHAR(255) DEFAULT NULL,
address VARCHAR(255) DEFAULT NULL,
PRIMARY KEY (affiliation_id)
)
CREATE TABLE "Author" (
author_id INTEGER NOT NULL,
name VARCHAR(255) DEFAULT NULL,
email VARCHAR(255) DEFAULT NULL,
PRIMARY KEY (author_id)
)
CREATE TABLE "Author_list" (
paper_id VARCHAR(25) NOT NULL,
author_id INTEGER NOT NULL,
affiliation_id INTEGER DEFAULT NULL,
PRIMARY KEY (paper_id, author_id),
FOREIGN KEY(affiliation_id) REFERENCES "Affiliation" (affiliation_id),
FOREIGN KEY(author_id) REFERENCES "Author" (author_id),
FOREIGN KEY(paper_id) REFERENCES "Paper" (paper_id)
)
CREATE TABLE "Citation" (
paper_id VARCHAR(25) NOT NULL,
cited_paper_id VARCHAR(25) NOT NULL,
PRIMARY KEY (paper_id, cited_paper_id),
FOREIGN KEY(cited_paper_id) REFERENCES "Paper" (paper_id),
FOREIGN KEY(paper_id) REFERENCES "Paper" (paper_id)
)
CREATE TABLE "Paper" (
paper_id VARCHAR(25) NOT NULL,
title VARCHAR(255) DEFAULT NULL,
venue VARCHAR(255) DEFAULT NULL,
year INTEGER DEFAULT NULL,
PRIMARY KEY (paper_id)
) | How many papers has each affiliation published? | medium | Table Affiliation (
Affiliation.affiliation_id (INTEGER),
Affiliation.name (varchar(255)),
Affiliation.address (varchar(255)),
)
Table Author (
Author.author_id (INTEGER),
Author.name (varchar(255)),
Author.email (varchar(255)),
)
Table Author_list (
Author_list.paper_id (varchar(25)),
Author_list.author_id (INTEGER),
Author_list.affiliation_id (INTEGER),
)
Table Citation (
Citation.paper_id (varchar(25)),
Citation.cited_paper_id (varchar(25)),
)
Table Paper (
Paper.paper_id (varchar(25)),
Paper.title (varchar(255)),
Paper.venue (varchar(255)),
Paper.year (INTEGER),
)
Possible JOINs:
Author_list.paper_id = Paper.paper_id
Author_list.author_id = Author.author_id
Author_list.affiliation_id = Affiliation.affiliation_id
Citation.paper_id = Paper.paper_id
Citation.cited_paper_id = Paper.paper_id
| SELECT count(DISTINCT Author_list.paper_id) , Affiliation.name FROM Affiliation JOIN Author_list ON Affiliation.affiliation_id = Author_list.affiliation_id GROUP BY Affiliation.affiliation_id | {
'affiliation': ['affiliation_id', 'name'],
'author_list': ['paper_id', 'affiliation_id']
} | CREATE TABLE Affiliation (
Affiliation.affiliation_id (INTEGER),
Affiliation.name (varchar(255)),
Affiliation.address (varchar(255)),
)
CREATE TABLE Author (
Author.author_id (INTEGER),
Author.name (varchar(255)),
Author.email (varchar(255)),
)
CREATE TABLE Author_list (
Author_list.paper_id (varchar(25)),
Author_list.author_id (INTEGER),
Author_list.affiliation_id (INTEGER),
)
CREATE TABLE Citation (
Citation.paper_id (varchar(25)),
Citation.cited_paper_id (varchar(25)),
)
CREATE TABLE Paper (
Paper.paper_id (varchar(25)),
Paper.title (varchar(255)),
Paper.venue (varchar(255)),
Paper.year (INTEGER),
)
Possible JOINs:
Author_list.paper_id = Paper.paper_id
Author_list.author_id = Author.author_id
Author_list.affiliation_id = Affiliation.affiliation_id
Citation.paper_id = Paper.paper_id
Citation.cited_paper_id = Paper.paper_id
| Table Affiliation (
Affiliation.affiliation_id (INTEGER),
Affiliation.name (varchar(255)),
Affiliation.address (varchar(255)),
)
Table Author (
Author.author_id (INTEGER),
Author.name (varchar(255)),
Author.email (varchar(255)),
)
Table Author_list (
Author_list.paper_id (varchar(25)),
Author_list.author_id (INTEGER),
Author_list.affiliation_id (INTEGER),
)
Table Citation (
Citation.paper_id (varchar(25)),
Citation.cited_paper_id (varchar(25)),
)
Table Paper (
Paper.paper_id (varchar(25)),
Paper.title (varchar(255)),
Paper.venue (varchar(255)),
Paper.year (INTEGER),
)
Possible JOINs:
Author_list.paper_id = Paper.paper_id
Author_list.author_id = Author.author_id
Author_list.affiliation_id = Affiliation.affiliation_id
Citation.paper_id = Paper.paper_id
Citation.cited_paper_id = Paper.paper_id
| CREATE TABLE Affiliation (
Affiliation.affiliation_id (INTEGER),
Affiliation.name (varchar(255)),
Affiliation.address (varchar(255)),
)
CREATE TABLE Author (
Author.author_id (INTEGER),
Author.name (varchar(255)),
Author.email (varchar(255)),
)
CREATE TABLE Author_list (
Author_list.paper_id (varchar(25)),
Author_list.author_id (INTEGER),
Author_list.affiliation_id (INTEGER),
)
CREATE TABLE Citation (
Citation.paper_id (varchar(25)),
Citation.cited_paper_id (varchar(25)),
)
CREATE TABLE Paper (
Paper.paper_id (varchar(25)),
Paper.title (varchar(255)),
Paper.venue (varchar(255)),
Paper.year (INTEGER),
)
Possible JOINs:
Author_list.paper_id = Paper.paper_id
Author_list.author_id = Author.author_id
Author_list.affiliation_id = Affiliation.affiliation_id
Citation.paper_id = Paper.paper_id
Citation.cited_paper_id = Paper.paper_id
| Table affiliation (
affiliation.affiliation_id (INTEGER),
affiliation.name (varchar(255)),
affiliation.address (varchar(255)),
)
Table author (
author.author_id (INTEGER),
author.name (varchar(255)),
author.email (varchar(255)),
)
Table author_list (
author_list.paper_id (varchar(25)),
author_list.author_id (INTEGER),
author_list.affiliation_id (INTEGER),
)
Table citation (
citation.paper_id (varchar(25)),
citation.cited_paper_id (varchar(25)),
)
Table paper (
paper.paper_id (varchar(25)),
paper.title (varchar(255)),
paper.venue (varchar(255)),
paper.year (INTEGER),
)
Possible JOINs:
author_list.paper_id = paper.paper_id
author_list.author_id = author.author_id
author_list.affiliation_id = affiliation.affiliation_id
citation.paper_id = paper.paper_id
citation.cited_paper_id = paper.paper_id
| CREATE TABLE affiliation (
affiliation.affiliation_id (INTEGER),
affiliation.name (varchar(255)),
affiliation.address (varchar(255)),
)
CREATE TABLE author (
author.author_id (INTEGER),
author.name (varchar(255)),
author.email (varchar(255)),
)
CREATE TABLE author_list (
author_list.paper_id (varchar(25)),
author_list.author_id (INTEGER),
author_list.affiliation_id (INTEGER),
)
CREATE TABLE citation (
citation.paper_id (varchar(25)),
citation.cited_paper_id (varchar(25)),
)
CREATE TABLE paper (
paper.paper_id (varchar(25)),
paper.title (varchar(255)),
paper.venue (varchar(255)),
paper.year (INTEGER),
)
Possible JOINs:
author_list.paper_id = paper.paper_id
author_list.author_id = author.author_id
author_list.affiliation_id = affiliation.affiliation_id
citation.paper_id = paper.paper_id
citation.cited_paper_id = paper.paper_id
| {
'Affiliation': ['affiliation_id', 'name', 'address'],
'Author': ['author_id', 'name', 'email'],
'Author_list': ['paper_id', 'author_id', 'affiliation_id'],
'Citation': ['paper_id', 'cited_paper_id'],
'Paper': ['paper_id', 'title', 'venue', 'year']
} | {
'Affiliation': ['affiliation_id', 'name'],
'Author_list': ['paper_id', 'affiliation_id']
} | TABLE Affiliation (
Affiliation.affiliation_id (INTEGER),
Affiliation.name (varchar(255)),
Affiliation.address (varchar(255)),
)
TABLE Author (
Author.author_id (INTEGER),
Author.name (varchar(255)),
Author.email (varchar(255)),
)
TABLE Author_list (
Author_list.paper_id (varchar(25)),
Author_list.author_id (INTEGER),
Author_list.affiliation_id (INTEGER),
)
TABLE Citation (
Citation.paper_id (varchar(25)),
Citation.cited_paper_id (varchar(25)),
)
TABLE Paper (
Paper.paper_id (varchar(25)),
Paper.title (varchar(255)),
Paper.venue (varchar(255)),
Paper.year (INTEGER),
)
Possible JOINs:
Author_list.paper_id = Paper.paper_id
Author_list.author_id = Author.author_id
Author_list.affiliation_id = Affiliation.affiliation_id
Citation.paper_id = Paper.paper_id
Citation.cited_paper_id = Paper.paper_id
| TABLE Affiliation (
Affiliation.affiliation_id (INTEGER),
Affiliation.name (varchar(255)),
Affiliation.address (varchar(255)),
)
TABLE Author (
Author.author_id (INTEGER),
Author.name (varchar(255)),
Author.email (varchar(255)),
)
TABLE Author_list (
Author_list.paper_id (varchar(25)),
Author_list.author_id (INTEGER),
Author_list.affiliation_id (INTEGER),
)
TABLE Citation (
Citation.paper_id (varchar(25)),
Citation.cited_paper_id (varchar(25)),
)
TABLE Paper (
Paper.paper_id (varchar(25)),
Paper.title (varchar(255)),
Paper.venue (varchar(255)),
Paper.year (INTEGER),
)
Possible JOINs:
Author_list.paper_id = Paper.paper_id
Author_list.author_id = Author.author_id
Author_list.affiliation_id = Affiliation.affiliation_id
Citation.paper_id = Paper.paper_id
Citation.cited_paper_id = Paper.paper_id
| TABLE affiliation (
affiliation.affiliation_id (INTEGER),
affiliation.name (varchar(255)),
affiliation.address (varchar(255)),
)
TABLE author (
author.author_id (INTEGER),
author.name (varchar(255)),
author.email (varchar(255)),
)
TABLE author_list (
author_list.paper_id (varchar(25)),
author_list.author_id (INTEGER),
author_list.affiliation_id (INTEGER),
)
TABLE citation (
citation.paper_id (varchar(25)),
citation.cited_paper_id (varchar(25)),
)
TABLE paper (
paper.paper_id (varchar(25)),
paper.title (varchar(255)),
paper.venue (varchar(255)),
paper.year (INTEGER),
)
Possible JOINs:
author_list.paper_id = paper.paper_id
author_list.author_id = author.author_id
author_list.affiliation_id = affiliation.affiliation_id
citation.paper_id = paper.paper_id
citation.cited_paper_id = paper.paper_id
|
book_1 |
CREATE TABLE Client
(IdClient CHAR(10) PRIMARY KEY,
Name VARCHAR(25) NOT NULL,
Address VARCHAR(60) NOT NULL,
NumCC CHAR(16) NOT NULL)
/*
0 rows from Client table:
IdClient Name Address NumCC
*/
CREATE TABLE Orders
(IdOrder CHAR(10) PRIMARY KEY,
IdClient CHAR(10) NOT NULL REFERENCES Client on delete cascade,
DateOrder DATE,
DateExped DATE)
/*
0 rows from Orders table:
IdOrder IdClient DateOrder DateExped
*/
CREATE TABLE Author
( idAuthor NUMBER PRIMARY KEY,
Name VARCHAR(25))
/*
0 rows from Author table:
idAuthor Name
*/
CREATE TABLE Book
(ISBN CHAR(15) PRIMARY KEY,
Title VARCHAR(60) NOT NULL,
Author CHAR(4) NOT NULL,
PurchasePrice NUMBER(6,2) DEFAULT 0,
SalePrice NUMBER(6,2) DEFAULT 0)
/*
0 rows from Book table:
ISBN Title Author PurchasePrice SalePrice
*/
CREATE TABLE Author_Book
(ISBN CHAR(15),
Author NUMBER,
CONSTRAINT al_PK PRIMARY KEY (ISBN, Author),
CONSTRAINT BookA_FK FOREIGN KEY (ISBN) REFERENCES `Book`(ISBN) on delete cascade,
CONSTRAINT Author_FK FOREIGN KEY (Author) REFERENCES `Author`(idAuthorA))
/*
0 rows from Author_Book table:
ISBN Author
*/
CREATE TABLE Books_Order(
ISBN CHAR(15),
IdOrder CHAR(10),
amount NUMBER(3) CHECK (amount >0),
CONSTRAINT lp_PK PRIMARY KEY (ISBN, idOrder),
CONSTRAINT Book_FK FOREIGN KEY (ISBN) REFERENCES `Book`(ISBN) on delete cascade,
CONSTRAINT pedido_FK FOREIGN KEY (IdOrder) REFERENCES `Orders`(IdOrder) on delete cascade)
/*
0 rows from Books_Order table:
ISBN IdOrder amount
*/
| List names and addresses of all clients in alphabetical order by their names. | medium | Table Author (
Author.idAuthor (NUMBER),
Author.Name (VARCHAR(25)),
)
Table Author_Book (
Author_Book.ISBN (CHAR(15)),
Author_Book.Author (NUMBER),
)
Table Book (
Book.ISBN (CHAR(15)),
Book.Title (VARCHAR(60)),
Book.Author (CHAR(4)),
Book.PurchasePrice (NUMBER(6,2)),
Book.SalePrice (NUMBER(6,2)),
)
Table Books_Order (
Books_Order.ISBN (CHAR(15)),
Books_Order.IdOrder (CHAR(10)),
Books_Order.amount (NUMBER(3)),
)
Table Client (
Client.IdClient (CHAR(10)),
Client.Name (VARCHAR(25)),
Client.Address (VARCHAR(60)),
Client.NumCC (CHAR(16)),
)
Table Orders (
Orders.IdOrder (CHAR(10)),
Orders.IdClient (CHAR(10)),
Orders.DateOrder (DATE),
Orders.DateExped (DATE),
)
Possible JOINs:
Author_Book.ISBN = Book.ISBN
Author_Book.Author = Author.idAuthorA
Books_Order.ISBN = Book.ISBN
Books_Order.IdOrder = Orders.IdOrder
Orders.IdClient = Client.IdClient
| SELECT name , address FROM Client ORDER BY name | {
'client': ['idclient', 'name', 'address']
} | CREATE TABLE Author (
Author.idAuthor (NUMBER),
Author.Name (VARCHAR(25)),
)
CREATE TABLE Author_Book (
Author_Book.ISBN (CHAR(15)),
Author_Book.Author (NUMBER),
)
CREATE TABLE Book (
Book.ISBN (CHAR(15)),
Book.Title (VARCHAR(60)),
Book.Author (CHAR(4)),
Book.PurchasePrice (NUMBER(6,2)),
Book.SalePrice (NUMBER(6,2)),
)
CREATE TABLE Books_Order (
Books_Order.ISBN (CHAR(15)),
Books_Order.IdOrder (CHAR(10)),
Books_Order.amount (NUMBER(3)),
)
CREATE TABLE Client (
Client.IdClient (CHAR(10)),
Client.Name (VARCHAR(25)),
Client.Address (VARCHAR(60)),
Client.NumCC (CHAR(16)),
)
CREATE TABLE Orders (
Orders.IdOrder (CHAR(10)),
Orders.IdClient (CHAR(10)),
Orders.DateOrder (DATE),
Orders.DateExped (DATE),
)
Possible JOINs:
Author_Book.ISBN = Book.ISBN
Author_Book.Author = Author.idAuthorA
Books_Order.ISBN = Book.ISBN
Books_Order.IdOrder = Orders.IdOrder
Orders.IdClient = Client.IdClient
| Table Author (
Author.idauthor (NUMBER),
Author.name (VARCHAR(25)),
)
Table Author_Book (
Author_Book.isbn (CHAR(15)),
Author_Book.author (NUMBER),
)
Table Book (
Book.isbn (CHAR(15)),
Book.title (VARCHAR(60)),
Book.author (CHAR(4)),
Book.purchaseprice (NUMBER(6,2)),
Book.saleprice (NUMBER(6,2)),
)
Table Books_Order (
Books_Order.isbn (CHAR(15)),
Books_Order.idorder (CHAR(10)),
Books_Order.amount (NUMBER(3)),
)
Table Client (
Client.idclient (CHAR(10)),
Client.name (VARCHAR(25)),
Client.address (VARCHAR(60)),
Client.numcc (CHAR(16)),
)
Table Orders (
Orders.idorder (CHAR(10)),
Orders.idclient (CHAR(10)),
Orders.dateorder (DATE),
Orders.dateexped (DATE),
)
Possible JOINs:
Author_Book.isbn = Book.isbn
Author_Book.author = Author.idauthora
Books_Order.isbn = Book.isbn
Books_Order.idorder = Orders.idorder
Orders.idclient = Client.idclient
| CREATE TABLE Author (
Author.idauthor (NUMBER),
Author.name (VARCHAR(25)),
)
CREATE TABLE Author_Book (
Author_Book.isbn (CHAR(15)),
Author_Book.author (NUMBER),
)
CREATE TABLE Book (
Book.isbn (CHAR(15)),
Book.title (VARCHAR(60)),
Book.author (CHAR(4)),
Book.purchaseprice (NUMBER(6,2)),
Book.saleprice (NUMBER(6,2)),
)
CREATE TABLE Books_Order (
Books_Order.isbn (CHAR(15)),
Books_Order.idorder (CHAR(10)),
Books_Order.amount (NUMBER(3)),
)
CREATE TABLE Client (
Client.idclient (CHAR(10)),
Client.name (VARCHAR(25)),
Client.address (VARCHAR(60)),
Client.numcc (CHAR(16)),
)
CREATE TABLE Orders (
Orders.idorder (CHAR(10)),
Orders.idclient (CHAR(10)),
Orders.dateorder (DATE),
Orders.dateexped (DATE),
)
Possible JOINs:
Author_Book.isbn = Book.isbn
Author_Book.author = Author.idauthora
Books_Order.isbn = Book.isbn
Books_Order.idorder = Orders.idorder
Orders.idclient = Client.idclient
| Table author (
author.idauthor (NUMBER),
author.name (VARCHAR(25)),
)
Table author_book (
author_book.isbn (CHAR(15)),
author_book.author (NUMBER),
)
Table book (
book.isbn (CHAR(15)),
book.title (VARCHAR(60)),
book.author (CHAR(4)),
book.purchaseprice (NUMBER(6,2)),
book.saleprice (NUMBER(6,2)),
)
Table books_order (
books_order.isbn (CHAR(15)),
books_order.idorder (CHAR(10)),
books_order.amount (NUMBER(3)),
)
Table client (
client.idclient (CHAR(10)),
client.name (VARCHAR(25)),
client.address (VARCHAR(60)),
client.numcc (CHAR(16)),
)
Table orders (
orders.idorder (CHAR(10)),
orders.idclient (CHAR(10)),
orders.dateorder (DATE),
orders.dateexped (DATE),
)
Possible JOINs:
author_book.isbn = book.isbn
author_book.author = author.idauthora
books_order.isbn = book.isbn
books_order.idorder = orders.idorder
orders.idclient = client.idclient
| CREATE TABLE author (
author.idauthor (NUMBER),
author.name (VARCHAR(25)),
)
CREATE TABLE author_book (
author_book.isbn (CHAR(15)),
author_book.author (NUMBER),
)
CREATE TABLE book (
book.isbn (CHAR(15)),
book.title (VARCHAR(60)),
book.author (CHAR(4)),
book.purchaseprice (NUMBER(6,2)),
book.saleprice (NUMBER(6,2)),
)
CREATE TABLE books_order (
books_order.isbn (CHAR(15)),
books_order.idorder (CHAR(10)),
books_order.amount (NUMBER(3)),
)
CREATE TABLE client (
client.idclient (CHAR(10)),
client.name (VARCHAR(25)),
client.address (VARCHAR(60)),
client.numcc (CHAR(16)),
)
CREATE TABLE orders (
orders.idorder (CHAR(10)),
orders.idclient (CHAR(10)),
orders.dateorder (DATE),
orders.dateexped (DATE),
)
Possible JOINs:
author_book.isbn = book.isbn
author_book.author = author.idauthora
books_order.isbn = book.isbn
books_order.idorder = orders.idorder
orders.idclient = client.idclient
| {
'Client': ['IdClient', 'Name', 'Address', 'NumCC'],
'Orders': ['IdOrder', 'IdClient', 'DateOrder', 'DateExped'],
'Author': ['idAuthor', 'Name'],
'Book': ['ISBN', 'Title', 'Author', 'PurchasePrice', 'SalePrice'],
'Author_Book': ['ISBN', 'Author'],
'Books_Order': ['ISBN', 'IdOrder', 'amount']
} | {
'Client': ['IdClient', 'Name', 'Address']
} | TABLE Author (
Author.idAuthor (NUMBER),
Author.Name (VARCHAR(25)),
)
TABLE Author_Book (
Author_Book.ISBN (CHAR(15)),
Author_Book.Author (NUMBER),
)
TABLE Book (
Book.ISBN (CHAR(15)),
Book.Title (VARCHAR(60)),
Book.Author (CHAR(4)),
Book.PurchasePrice (NUMBER(6,2)),
Book.SalePrice (NUMBER(6,2)),
)
TABLE Books_Order (
Books_Order.ISBN (CHAR(15)),
Books_Order.IdOrder (CHAR(10)),
Books_Order.amount (NUMBER(3)),
)
TABLE Client (
Client.IdClient (CHAR(10)),
Client.Name (VARCHAR(25)),
Client.Address (VARCHAR(60)),
Client.NumCC (CHAR(16)),
)
TABLE Orders (
Orders.IdOrder (CHAR(10)),
Orders.IdClient (CHAR(10)),
Orders.DateOrder (DATE),
Orders.DateExped (DATE),
)
Possible JOINs:
Author_Book.ISBN = Book.ISBN
Author_Book.Author = Author.idAuthorA
Books_Order.ISBN = Book.ISBN
Books_Order.IdOrder = Orders.IdOrder
Orders.IdClient = Client.IdClient
| TABLE Author (
Author.idauthor (NUMBER),
Author.name (VARCHAR(25)),
)
TABLE Author_Book (
Author_Book.isbn (CHAR(15)),
Author_Book.author (NUMBER),
)
TABLE Book (
Book.isbn (CHAR(15)),
Book.title (VARCHAR(60)),
Book.author (CHAR(4)),
Book.purchaseprice (NUMBER(6,2)),
Book.saleprice (NUMBER(6,2)),
)
TABLE Books_Order (
Books_Order.isbn (CHAR(15)),
Books_Order.idorder (CHAR(10)),
Books_Order.amount (NUMBER(3)),
)
TABLE Client (
Client.idclient (CHAR(10)),
Client.name (VARCHAR(25)),
Client.address (VARCHAR(60)),
Client.numcc (CHAR(16)),
)
TABLE Orders (
Orders.idorder (CHAR(10)),
Orders.idclient (CHAR(10)),
Orders.dateorder (DATE),
Orders.dateexped (DATE),
)
Possible JOINs:
Author_Book.isbn = Book.isbn
Author_Book.author = Author.idauthora
Books_Order.isbn = Book.isbn
Books_Order.idorder = Orders.idorder
Orders.idclient = Client.idclient
| TABLE author (
author.idauthor (NUMBER),
author.name (VARCHAR(25)),
)
TABLE author_book (
author_book.isbn (CHAR(15)),
author_book.author (NUMBER),
)
TABLE book (
book.isbn (CHAR(15)),
book.title (VARCHAR(60)),
book.author (CHAR(4)),
book.purchaseprice (NUMBER(6,2)),
book.saleprice (NUMBER(6,2)),
)
TABLE books_order (
books_order.isbn (CHAR(15)),
books_order.idorder (CHAR(10)),
books_order.amount (NUMBER(3)),
)
TABLE client (
client.idclient (CHAR(10)),
client.name (VARCHAR(25)),
client.address (VARCHAR(60)),
client.numcc (CHAR(16)),
)
TABLE orders (
orders.idorder (CHAR(10)),
orders.idclient (CHAR(10)),
orders.dateorder (DATE),
orders.dateexped (DATE),
)
Possible JOINs:
author_book.isbn = book.isbn
author_book.author = author.idauthora
books_order.isbn = book.isbn
books_order.idorder = orders.idorder
orders.idclient = client.idclient
|
vehicle_rent |
CREATE TABLE "Customers" (
id INTEGER,
name TEXT,
age INTEGER,
membership_credit INTEGER,
PRIMARY KEY (id)
)
CREATE TABLE "Discount" (
id INTEGER,
name TEXT,
membership_credit INTEGER,
PRIMARY KEY (id)
)
CREATE TABLE "Renting_history" (
id INTEGER,
customer_id INTEGER,
discount_id INTEGER,
vehicles_id INTEGER,
total_hours INTEGER,
PRIMARY KEY (id),
FOREIGN KEY(customer_id) REFERENCES "Customers" (id),
FOREIGN KEY(vehicles_id) REFERENCES "Vehicles" (id),
FOREIGN KEY(discount_id) REFERENCES "Discount" (id)
)
CREATE TABLE "Vehicles" (
id INTEGER,
name TEXT,
"Model_year" INTEGER,
"Type_of_powertrain" TEXT,
"Combined_fuel_economy_rate" INTEGER,
"City_fuel_economy_rate" INTEGER,
"Highway_fuel_economy_rate" INTEGER,
"Cost_per_25_miles" REAL,
"Annual_fuel_cost" REAL,
"Notes" TEXT,
PRIMARY KEY (id)
) | Show name and model year for vehicles with city fuel economy rate less than or equal to highway fuel economy rate. | medium | Table Customers (
Customers.id (INT),
Customers.name (TEXT),
Customers.age (INT),
Customers.membership_credit (INT),
)
Table Discount (
Discount.id (INT),
Discount.name (TEXT),
Discount.membership_credit (INT),
)
Table Renting_history (
Renting_history.id (INT),
Renting_history.customer_id (INT),
Renting_history.discount_id (INT),
Renting_history.vehicles_id (INT),
Renting_history.total_hours (INT),
)
Table Vehicles (
Vehicles.id (INT),
Vehicles.name (TEXT),
Vehicles.Model_year (INT),
Vehicles.Type_of_powertrain (TEXT),
Vehicles.Combined_fuel_economy_rate (INT),
Vehicles.City_fuel_economy_rate (INT),
Vehicles.Highway_fuel_economy_rate (INT),
Vehicles.Cost_per_25_miles (REAL),
Vehicles.Annual_fuel_cost (REAL),
Vehicles.Notes (TEXT),
)
Possible JOINs:
Renting_history.customer_id = Customers.id
Renting_history.discount_id = Discount.id
Renting_history.vehicles_id = Vehicles.id
| SELECT name , model_year FROM vehicles WHERE city_fuel_economy_rate <= highway_fuel_economy_rate | {
'vehicles': ['id', 'name', 'model_year', 'city_fuel_economy_rate', 'highway_fuel_economy_rate']
} | CREATE TABLE Customers (
Customers.id (INT),
Customers.name (TEXT),
Customers.age (INT),
Customers.membership_credit (INT),
)
CREATE TABLE Discount (
Discount.id (INT),
Discount.name (TEXT),
Discount.membership_credit (INT),
)
CREATE TABLE Renting_history (
Renting_history.id (INT),
Renting_history.customer_id (INT),
Renting_history.discount_id (INT),
Renting_history.vehicles_id (INT),
Renting_history.total_hours (INT),
)
CREATE TABLE Vehicles (
Vehicles.id (INT),
Vehicles.name (TEXT),
Vehicles.Model_year (INT),
Vehicles.Type_of_powertrain (TEXT),
Vehicles.Combined_fuel_economy_rate (INT),
Vehicles.City_fuel_economy_rate (INT),
Vehicles.Highway_fuel_economy_rate (INT),
Vehicles.Cost_per_25_miles (REAL),
Vehicles.Annual_fuel_cost (REAL),
Vehicles.Notes (TEXT),
)
Possible JOINs:
Renting_history.customer_id = Customers.id
Renting_history.discount_id = Discount.id
Renting_history.vehicles_id = Vehicles.id
| Table Customers (
Customers.id (INT),
Customers.name (TEXT),
Customers.age (INT),
Customers.membership_credit (INT),
)
Table Discount (
Discount.id (INT),
Discount.name (TEXT),
Discount.membership_credit (INT),
)
Table Renting_history (
Renting_history.id (INT),
Renting_history.customer_id (INT),
Renting_history.discount_id (INT),
Renting_history.vehicles_id (INT),
Renting_history.total_hours (INT),
)
Table Vehicles (
Vehicles.id (INT),
Vehicles.name (TEXT),
Vehicles.model_year (INT),
Vehicles.type_of_powertrain (TEXT),
Vehicles.combined_fuel_economy_rate (INT),
Vehicles.city_fuel_economy_rate (INT),
Vehicles.highway_fuel_economy_rate (INT),
Vehicles.cost_per_25_miles (REAL),
Vehicles.annual_fuel_cost (REAL),
Vehicles.notes (TEXT),
)
Possible JOINs:
Renting_history.customer_id = Customers.id
Renting_history.discount_id = Discount.id
Renting_history.vehicles_id = Vehicles.id
| CREATE TABLE Customers (
Customers.id (INT),
Customers.name (TEXT),
Customers.age (INT),
Customers.membership_credit (INT),
)
CREATE TABLE Discount (
Discount.id (INT),
Discount.name (TEXT),
Discount.membership_credit (INT),
)
CREATE TABLE Renting_history (
Renting_history.id (INT),
Renting_history.customer_id (INT),
Renting_history.discount_id (INT),
Renting_history.vehicles_id (INT),
Renting_history.total_hours (INT),
)
CREATE TABLE Vehicles (
Vehicles.id (INT),
Vehicles.name (TEXT),
Vehicles.model_year (INT),
Vehicles.type_of_powertrain (TEXT),
Vehicles.combined_fuel_economy_rate (INT),
Vehicles.city_fuel_economy_rate (INT),
Vehicles.highway_fuel_economy_rate (INT),
Vehicles.cost_per_25_miles (REAL),
Vehicles.annual_fuel_cost (REAL),
Vehicles.notes (TEXT),
)
Possible JOINs:
Renting_history.customer_id = Customers.id
Renting_history.discount_id = Discount.id
Renting_history.vehicles_id = Vehicles.id
| Table customers (
customers.id (INT),
customers.name (TEXT),
customers.age (INT),
customers.membership_credit (INT),
)
Table discount (
discount.id (INT),
discount.name (TEXT),
discount.membership_credit (INT),
)
Table renting_history (
renting_history.id (INT),
renting_history.customer_id (INT),
renting_history.discount_id (INT),
renting_history.vehicles_id (INT),
renting_history.total_hours (INT),
)
Table vehicles (
vehicles.id (INT),
vehicles.name (TEXT),
vehicles.model_year (INT),
vehicles.type_of_powertrain (TEXT),
vehicles.combined_fuel_economy_rate (INT),
vehicles.city_fuel_economy_rate (INT),
vehicles.highway_fuel_economy_rate (INT),
vehicles.cost_per_25_miles (REAL),
vehicles.annual_fuel_cost (REAL),
vehicles.notes (TEXT),
)
Possible JOINs:
renting_history.customer_id = customers.id
renting_history.discount_id = discount.id
renting_history.vehicles_id = vehicles.id
| CREATE TABLE customers (
customers.id (INT),
customers.name (TEXT),
customers.age (INT),
customers.membership_credit (INT),
)
CREATE TABLE discount (
discount.id (INT),
discount.name (TEXT),
discount.membership_credit (INT),
)
CREATE TABLE renting_history (
renting_history.id (INT),
renting_history.customer_id (INT),
renting_history.discount_id (INT),
renting_history.vehicles_id (INT),
renting_history.total_hours (INT),
)
CREATE TABLE vehicles (
vehicles.id (INT),
vehicles.name (TEXT),
vehicles.model_year (INT),
vehicles.type_of_powertrain (TEXT),
vehicles.combined_fuel_economy_rate (INT),
vehicles.city_fuel_economy_rate (INT),
vehicles.highway_fuel_economy_rate (INT),
vehicles.cost_per_25_miles (REAL),
vehicles.annual_fuel_cost (REAL),
vehicles.notes (TEXT),
)
Possible JOINs:
renting_history.customer_id = customers.id
renting_history.discount_id = discount.id
renting_history.vehicles_id = vehicles.id
| {
'Customers': ['id', 'name', 'age', 'membership_credit'],
'Discount': ['id', 'name', 'membership_credit'],
'Vehicles': ['id', 'name', 'Model_year', 'Type_of_powertrain', 'Combined_fuel_economy_rate', 'City_fuel_economy_rate', 'Highway_fuel_economy_rate', 'Cost_per_25_miles', 'Annual_fuel_cost', 'Notes'],
'Renting_history': ['id', 'customer_id', 'discount_id', 'vehicles_id', 'total_hours']
} | {
'Vehicles': ['id', 'name', 'Model_year', 'City_fuel_economy_rate', 'Highway_fuel_economy_rate']
} | TABLE Customers (
Customers.id (INT),
Customers.name (TEXT),
Customers.age (INT),
Customers.membership_credit (INT),
)
TABLE Discount (
Discount.id (INT),
Discount.name (TEXT),
Discount.membership_credit (INT),
)
TABLE Renting_history (
Renting_history.id (INT),
Renting_history.customer_id (INT),
Renting_history.discount_id (INT),
Renting_history.vehicles_id (INT),
Renting_history.total_hours (INT),
)
TABLE Vehicles (
Vehicles.id (INT),
Vehicles.name (TEXT),
Vehicles.Model_year (INT),
Vehicles.Type_of_powertrain (TEXT),
Vehicles.Combined_fuel_economy_rate (INT),
Vehicles.City_fuel_economy_rate (INT),
Vehicles.Highway_fuel_economy_rate (INT),
Vehicles.Cost_per_25_miles (REAL),
Vehicles.Annual_fuel_cost (REAL),
Vehicles.Notes (TEXT),
)
Possible JOINs:
Renting_history.customer_id = Customers.id
Renting_history.discount_id = Discount.id
Renting_history.vehicles_id = Vehicles.id
| TABLE Customers (
Customers.id (INT),
Customers.name (TEXT),
Customers.age (INT),
Customers.membership_credit (INT),
)
TABLE Discount (
Discount.id (INT),
Discount.name (TEXT),
Discount.membership_credit (INT),
)
TABLE Renting_history (
Renting_history.id (INT),
Renting_history.customer_id (INT),
Renting_history.discount_id (INT),
Renting_history.vehicles_id (INT),
Renting_history.total_hours (INT),
)
TABLE Vehicles (
Vehicles.id (INT),
Vehicles.name (TEXT),
Vehicles.model_year (INT),
Vehicles.type_of_powertrain (TEXT),
Vehicles.combined_fuel_economy_rate (INT),
Vehicles.city_fuel_economy_rate (INT),
Vehicles.highway_fuel_economy_rate (INT),
Vehicles.cost_per_25_miles (REAL),
Vehicles.annual_fuel_cost (REAL),
Vehicles.notes (TEXT),
)
Possible JOINs:
Renting_history.customer_id = Customers.id
Renting_history.discount_id = Discount.id
Renting_history.vehicles_id = Vehicles.id
| TABLE customers (
customers.id (INT),
customers.name (TEXT),
customers.age (INT),
customers.membership_credit (INT),
)
TABLE discount (
discount.id (INT),
discount.name (TEXT),
discount.membership_credit (INT),
)
TABLE renting_history (
renting_history.id (INT),
renting_history.customer_id (INT),
renting_history.discount_id (INT),
renting_history.vehicles_id (INT),
renting_history.total_hours (INT),
)
TABLE vehicles (
vehicles.id (INT),
vehicles.name (TEXT),
vehicles.model_year (INT),
vehicles.type_of_powertrain (TEXT),
vehicles.combined_fuel_economy_rate (INT),
vehicles.city_fuel_economy_rate (INT),
vehicles.highway_fuel_economy_rate (INT),
vehicles.cost_per_25_miles (REAL),
vehicles.annual_fuel_cost (REAL),
vehicles.notes (TEXT),
)
Possible JOINs:
renting_history.customer_id = customers.id
renting_history.discount_id = discount.id
renting_history.vehicles_id = vehicles.id
|
district_spokesman |
CREATE TABLE district (
"District_ID" INTEGER,
"Name" TEXT,
"Area_km" REAL,
"Population" REAL,
"Density_km" REAL,
"Government_website" TEXT,
PRIMARY KEY ("District_ID")
)
CREATE TABLE spokesman (
"Spokesman_ID" INTEGER,
"Name" TEXT,
"Age" INTEGER,
"Speach_title" TEXT,
"Rank_position" REAL,
"Points" REAL,
PRIMARY KEY ("Spokesman_ID")
)
CREATE TABLE spokesman_district (
"Spokesman_ID" INTEGER,
"District_ID" INTEGER,
"Start_year" TEXT,
PRIMARY KEY ("Spokesman_ID"),
FOREIGN KEY("Spokesman_ID") REFERENCES spokesman ("Spokesman_ID"),
FOREIGN KEY("District_ID") REFERENCES district ("District_ID")
) | What are the names and points of spokesmen who are younger than 40? | medium | Table district (
district.District_ID (INT),
district.Name (TEXT),
district.Area_km (REAL),
district.Population (REAL),
district.Density_km (REAL),
district.Government_website (TEXT),
)
Table spokesman (
spokesman.Spokesman_ID (INT),
spokesman.Name (TEXT),
spokesman.Age (INT),
spokesman.Speach_title (TEXT),
spokesman.Rank_position (REAL),
spokesman.Points (REAL),
)
Table spokesman_district (
spokesman_district.Spokesman_ID (INT),
spokesman_district.District_ID (INT),
spokesman_district.Start_year (TEXT),
)
Possible JOINs:
spokesman_district.Spokesman_ID = spokesman.Spokesman_ID
spokesman_district.District_ID = district.District_ID
| SELECT name , points FROM spokesman WHERE age < 40 | {
'spokesman': ['spokesman_id', 'name', 'age', 'points']
} | CREATE TABLE district (
district.District_ID (INT),
district.Name (TEXT),
district.Area_km (REAL),
district.Population (REAL),
district.Density_km (REAL),
district.Government_website (TEXT),
)
CREATE TABLE spokesman (
spokesman.Spokesman_ID (INT),
spokesman.Name (TEXT),
spokesman.Age (INT),
spokesman.Speach_title (TEXT),
spokesman.Rank_position (REAL),
spokesman.Points (REAL),
)
CREATE TABLE spokesman_district (
spokesman_district.Spokesman_ID (INT),
spokesman_district.District_ID (INT),
spokesman_district.Start_year (TEXT),
)
Possible JOINs:
spokesman_district.Spokesman_ID = spokesman.Spokesman_ID
spokesman_district.District_ID = district.District_ID
| Table district (
district.district_id (INT),
district.name (TEXT),
district.area_km (REAL),
district.population (REAL),
district.density_km (REAL),
district.government_website (TEXT),
)
Table spokesman (
spokesman.spokesman_id (INT),
spokesman.name (TEXT),
spokesman.age (INT),
spokesman.speach_title (TEXT),
spokesman.rank_position (REAL),
spokesman.points (REAL),
)
Table spokesman_district (
spokesman_district.spokesman_id (INT),
spokesman_district.district_id (INT),
spokesman_district.start_year (TEXT),
)
Possible JOINs:
spokesman_district.spokesman_id = spokesman.spokesman_id
spokesman_district.district_id = district.district_id
| CREATE TABLE district (
district.district_id (INT),
district.name (TEXT),
district.area_km (REAL),
district.population (REAL),
district.density_km (REAL),
district.government_website (TEXT),
)
CREATE TABLE spokesman (
spokesman.spokesman_id (INT),
spokesman.name (TEXT),
spokesman.age (INT),
spokesman.speach_title (TEXT),
spokesman.rank_position (REAL),
spokesman.points (REAL),
)
CREATE TABLE spokesman_district (
spokesman_district.spokesman_id (INT),
spokesman_district.district_id (INT),
spokesman_district.start_year (TEXT),
)
Possible JOINs:
spokesman_district.spokesman_id = spokesman.spokesman_id
spokesman_district.district_id = district.district_id
| Table district (
district.district_id (INT),
district.name (TEXT),
district.area_km (REAL),
district.population (REAL),
district.density_km (REAL),
district.government_website (TEXT),
)
Table spokesman (
spokesman.spokesman_id (INT),
spokesman.name (TEXT),
spokesman.age (INT),
spokesman.speach_title (TEXT),
spokesman.rank_position (REAL),
spokesman.points (REAL),
)
Table spokesman_district (
spokesman_district.spokesman_id (INT),
spokesman_district.district_id (INT),
spokesman_district.start_year (TEXT),
)
Possible JOINs:
spokesman_district.spokesman_id = spokesman.spokesman_id
spokesman_district.district_id = district.district_id
| CREATE TABLE district (
district.district_id (INT),
district.name (TEXT),
district.area_km (REAL),
district.population (REAL),
district.density_km (REAL),
district.government_website (TEXT),
)
CREATE TABLE spokesman (
spokesman.spokesman_id (INT),
spokesman.name (TEXT),
spokesman.age (INT),
spokesman.speach_title (TEXT),
spokesman.rank_position (REAL),
spokesman.points (REAL),
)
CREATE TABLE spokesman_district (
spokesman_district.spokesman_id (INT),
spokesman_district.district_id (INT),
spokesman_district.start_year (TEXT),
)
Possible JOINs:
spokesman_district.spokesman_id = spokesman.spokesman_id
spokesman_district.district_id = district.district_id
| {
'district': ['District_ID', 'Name', 'Area_km', 'Population', 'Density_km', 'Government_website'],
'spokesman': ['Spokesman_ID', 'Name', 'Age', 'Speach_title', 'Rank_position', 'Points'],
'spokesman_district': ['Spokesman_ID', 'District_ID', 'Start_year']
} | {
'spokesman': ['Spokesman_ID', 'Name', 'Age', 'Points']
} | TABLE district (
district.District_ID (INT),
district.Name (TEXT),
district.Area_km (REAL),
district.Population (REAL),
district.Density_km (REAL),
district.Government_website (TEXT),
)
TABLE spokesman (
spokesman.Spokesman_ID (INT),
spokesman.Name (TEXT),
spokesman.Age (INT),
spokesman.Speach_title (TEXT),
spokesman.Rank_position (REAL),
spokesman.Points (REAL),
)
TABLE spokesman_district (
spokesman_district.Spokesman_ID (INT),
spokesman_district.District_ID (INT),
spokesman_district.Start_year (TEXT),
)
Possible JOINs:
spokesman_district.Spokesman_ID = spokesman.Spokesman_ID
spokesman_district.District_ID = district.District_ID
| TABLE district (
district.district_id (INT),
district.name (TEXT),
district.area_km (REAL),
district.population (REAL),
district.density_km (REAL),
district.government_website (TEXT),
)
TABLE spokesman (
spokesman.spokesman_id (INT),
spokesman.name (TEXT),
spokesman.age (INT),
spokesman.speach_title (TEXT),
spokesman.rank_position (REAL),
spokesman.points (REAL),
)
TABLE spokesman_district (
spokesman_district.spokesman_id (INT),
spokesman_district.district_id (INT),
spokesman_district.start_year (TEXT),
)
Possible JOINs:
spokesman_district.spokesman_id = spokesman.spokesman_id
spokesman_district.district_id = district.district_id
| TABLE district (
district.district_id (INT),
district.name (TEXT),
district.area_km (REAL),
district.population (REAL),
district.density_km (REAL),
district.government_website (TEXT),
)
TABLE spokesman (
spokesman.spokesman_id (INT),
spokesman.name (TEXT),
spokesman.age (INT),
spokesman.speach_title (TEXT),
spokesman.rank_position (REAL),
spokesman.points (REAL),
)
TABLE spokesman_district (
spokesman_district.spokesman_id (INT),
spokesman_district.district_id (INT),
spokesman_district.start_year (TEXT),
)
Possible JOINs:
spokesman_district.spokesman_id = spokesman.spokesman_id
spokesman_district.district_id = district.district_id
|
book_1 |
CREATE TABLE Client
(IdClient CHAR(10) PRIMARY KEY,
Name VARCHAR(25) NOT NULL,
Address VARCHAR(60) NOT NULL,
NumCC CHAR(16) NOT NULL)
/*
0 rows from Client table:
IdClient Name Address NumCC
*/
CREATE TABLE Orders
(IdOrder CHAR(10) PRIMARY KEY,
IdClient CHAR(10) NOT NULL REFERENCES Client on delete cascade,
DateOrder DATE,
DateExped DATE)
/*
0 rows from Orders table:
IdOrder IdClient DateOrder DateExped
*/
CREATE TABLE Author
( idAuthor NUMBER PRIMARY KEY,
Name VARCHAR(25))
/*
0 rows from Author table:
idAuthor Name
*/
CREATE TABLE Book
(ISBN CHAR(15) PRIMARY KEY,
Title VARCHAR(60) NOT NULL,
Author CHAR(4) NOT NULL,
PurchasePrice NUMBER(6,2) DEFAULT 0,
SalePrice NUMBER(6,2) DEFAULT 0)
/*
0 rows from Book table:
ISBN Title Author PurchasePrice SalePrice
*/
CREATE TABLE Author_Book
(ISBN CHAR(15),
Author NUMBER,
CONSTRAINT al_PK PRIMARY KEY (ISBN, Author),
CONSTRAINT BookA_FK FOREIGN KEY (ISBN) REFERENCES `Book`(ISBN) on delete cascade,
CONSTRAINT Author_FK FOREIGN KEY (Author) REFERENCES `Author`(idAuthorA))
/*
0 rows from Author_Book table:
ISBN Author
*/
CREATE TABLE Books_Order(
ISBN CHAR(15),
IdOrder CHAR(10),
amount NUMBER(3) CHECK (amount >0),
CONSTRAINT lp_PK PRIMARY KEY (ISBN, idOrder),
CONSTRAINT Book_FK FOREIGN KEY (ISBN) REFERENCES `Book`(ISBN) on delete cascade,
CONSTRAINT pedido_FK FOREIGN KEY (IdOrder) REFERENCES `Orders`(IdOrder) on delete cascade)
/*
0 rows from Books_Order table:
ISBN IdOrder amount
*/
| Count the number of authors. | easy | Table Author (
Author.idAuthor (NUMBER),
Author.Name (VARCHAR(25)),
)
Table Author_Book (
Author_Book.ISBN (CHAR(15)),
Author_Book.Author (NUMBER),
)
Table Book (
Book.ISBN (CHAR(15)),
Book.Title (VARCHAR(60)),
Book.Author (CHAR(4)),
Book.PurchasePrice (NUMBER(6,2)),
Book.SalePrice (NUMBER(6,2)),
)
Table Books_Order (
Books_Order.ISBN (CHAR(15)),
Books_Order.IdOrder (CHAR(10)),
Books_Order.amount (NUMBER(3)),
)
Table Client (
Client.IdClient (CHAR(10)),
Client.Name (VARCHAR(25)),
Client.Address (VARCHAR(60)),
Client.NumCC (CHAR(16)),
)
Table Orders (
Orders.IdOrder (CHAR(10)),
Orders.IdClient (CHAR(10)),
Orders.DateOrder (DATE),
Orders.DateExped (DATE),
)
Possible JOINs:
Author_Book.ISBN = Book.ISBN
Author_Book.Author = Author.idAuthorA
Books_Order.ISBN = Book.ISBN
Books_Order.IdOrder = Orders.IdOrder
Orders.IdClient = Client.IdClient
| SELECT count(*) FROM Author | {
'author': ['idauthor']
} | CREATE TABLE Author (
Author.idAuthor (NUMBER),
Author.Name (VARCHAR(25)),
)
CREATE TABLE Author_Book (
Author_Book.ISBN (CHAR(15)),
Author_Book.Author (NUMBER),
)
CREATE TABLE Book (
Book.ISBN (CHAR(15)),
Book.Title (VARCHAR(60)),
Book.Author (CHAR(4)),
Book.PurchasePrice (NUMBER(6,2)),
Book.SalePrice (NUMBER(6,2)),
)
CREATE TABLE Books_Order (
Books_Order.ISBN (CHAR(15)),
Books_Order.IdOrder (CHAR(10)),
Books_Order.amount (NUMBER(3)),
)
CREATE TABLE Client (
Client.IdClient (CHAR(10)),
Client.Name (VARCHAR(25)),
Client.Address (VARCHAR(60)),
Client.NumCC (CHAR(16)),
)
CREATE TABLE Orders (
Orders.IdOrder (CHAR(10)),
Orders.IdClient (CHAR(10)),
Orders.DateOrder (DATE),
Orders.DateExped (DATE),
)
Possible JOINs:
Author_Book.ISBN = Book.ISBN
Author_Book.Author = Author.idAuthorA
Books_Order.ISBN = Book.ISBN
Books_Order.IdOrder = Orders.IdOrder
Orders.IdClient = Client.IdClient
| Table Author (
Author.idauthor (NUMBER),
Author.name (VARCHAR(25)),
)
Table Author_Book (
Author_Book.isbn (CHAR(15)),
Author_Book.author (NUMBER),
)
Table Book (
Book.isbn (CHAR(15)),
Book.title (VARCHAR(60)),
Book.author (CHAR(4)),
Book.purchaseprice (NUMBER(6,2)),
Book.saleprice (NUMBER(6,2)),
)
Table Books_Order (
Books_Order.isbn (CHAR(15)),
Books_Order.idorder (CHAR(10)),
Books_Order.amount (NUMBER(3)),
)
Table Client (
Client.idclient (CHAR(10)),
Client.name (VARCHAR(25)),
Client.address (VARCHAR(60)),
Client.numcc (CHAR(16)),
)
Table Orders (
Orders.idorder (CHAR(10)),
Orders.idclient (CHAR(10)),
Orders.dateorder (DATE),
Orders.dateexped (DATE),
)
Possible JOINs:
Author_Book.isbn = Book.isbn
Author_Book.author = Author.idauthora
Books_Order.isbn = Book.isbn
Books_Order.idorder = Orders.idorder
Orders.idclient = Client.idclient
| CREATE TABLE Author (
Author.idauthor (NUMBER),
Author.name (VARCHAR(25)),
)
CREATE TABLE Author_Book (
Author_Book.isbn (CHAR(15)),
Author_Book.author (NUMBER),
)
CREATE TABLE Book (
Book.isbn (CHAR(15)),
Book.title (VARCHAR(60)),
Book.author (CHAR(4)),
Book.purchaseprice (NUMBER(6,2)),
Book.saleprice (NUMBER(6,2)),
)
CREATE TABLE Books_Order (
Books_Order.isbn (CHAR(15)),
Books_Order.idorder (CHAR(10)),
Books_Order.amount (NUMBER(3)),
)
CREATE TABLE Client (
Client.idclient (CHAR(10)),
Client.name (VARCHAR(25)),
Client.address (VARCHAR(60)),
Client.numcc (CHAR(16)),
)
CREATE TABLE Orders (
Orders.idorder (CHAR(10)),
Orders.idclient (CHAR(10)),
Orders.dateorder (DATE),
Orders.dateexped (DATE),
)
Possible JOINs:
Author_Book.isbn = Book.isbn
Author_Book.author = Author.idauthora
Books_Order.isbn = Book.isbn
Books_Order.idorder = Orders.idorder
Orders.idclient = Client.idclient
| Table author (
author.idauthor (NUMBER),
author.name (VARCHAR(25)),
)
Table author_book (
author_book.isbn (CHAR(15)),
author_book.author (NUMBER),
)
Table book (
book.isbn (CHAR(15)),
book.title (VARCHAR(60)),
book.author (CHAR(4)),
book.purchaseprice (NUMBER(6,2)),
book.saleprice (NUMBER(6,2)),
)
Table books_order (
books_order.isbn (CHAR(15)),
books_order.idorder (CHAR(10)),
books_order.amount (NUMBER(3)),
)
Table client (
client.idclient (CHAR(10)),
client.name (VARCHAR(25)),
client.address (VARCHAR(60)),
client.numcc (CHAR(16)),
)
Table orders (
orders.idorder (CHAR(10)),
orders.idclient (CHAR(10)),
orders.dateorder (DATE),
orders.dateexped (DATE),
)
Possible JOINs:
author_book.isbn = book.isbn
author_book.author = author.idauthora
books_order.isbn = book.isbn
books_order.idorder = orders.idorder
orders.idclient = client.idclient
| CREATE TABLE author (
author.idauthor (NUMBER),
author.name (VARCHAR(25)),
)
CREATE TABLE author_book (
author_book.isbn (CHAR(15)),
author_book.author (NUMBER),
)
CREATE TABLE book (
book.isbn (CHAR(15)),
book.title (VARCHAR(60)),
book.author (CHAR(4)),
book.purchaseprice (NUMBER(6,2)),
book.saleprice (NUMBER(6,2)),
)
CREATE TABLE books_order (
books_order.isbn (CHAR(15)),
books_order.idorder (CHAR(10)),
books_order.amount (NUMBER(3)),
)
CREATE TABLE client (
client.idclient (CHAR(10)),
client.name (VARCHAR(25)),
client.address (VARCHAR(60)),
client.numcc (CHAR(16)),
)
CREATE TABLE orders (
orders.idorder (CHAR(10)),
orders.idclient (CHAR(10)),
orders.dateorder (DATE),
orders.dateexped (DATE),
)
Possible JOINs:
author_book.isbn = book.isbn
author_book.author = author.idauthora
books_order.isbn = book.isbn
books_order.idorder = orders.idorder
orders.idclient = client.idclient
| {
'Client': ['IdClient', 'Name', 'Address', 'NumCC'],
'Orders': ['IdOrder', 'IdClient', 'DateOrder', 'DateExped'],
'Author': ['idAuthor', 'Name'],
'Book': ['ISBN', 'Title', 'Author', 'PurchasePrice', 'SalePrice'],
'Author_Book': ['ISBN', 'Author'],
'Books_Order': ['ISBN', 'IdOrder', 'amount']
} | {
'Author': ['idAuthor']
} | TABLE Author (
Author.idAuthor (NUMBER),
Author.Name (VARCHAR(25)),
)
TABLE Author_Book (
Author_Book.ISBN (CHAR(15)),
Author_Book.Author (NUMBER),
)
TABLE Book (
Book.ISBN (CHAR(15)),
Book.Title (VARCHAR(60)),
Book.Author (CHAR(4)),
Book.PurchasePrice (NUMBER(6,2)),
Book.SalePrice (NUMBER(6,2)),
)
TABLE Books_Order (
Books_Order.ISBN (CHAR(15)),
Books_Order.IdOrder (CHAR(10)),
Books_Order.amount (NUMBER(3)),
)
TABLE Client (
Client.IdClient (CHAR(10)),
Client.Name (VARCHAR(25)),
Client.Address (VARCHAR(60)),
Client.NumCC (CHAR(16)),
)
TABLE Orders (
Orders.IdOrder (CHAR(10)),
Orders.IdClient (CHAR(10)),
Orders.DateOrder (DATE),
Orders.DateExped (DATE),
)
Possible JOINs:
Author_Book.ISBN = Book.ISBN
Author_Book.Author = Author.idAuthorA
Books_Order.ISBN = Book.ISBN
Books_Order.IdOrder = Orders.IdOrder
Orders.IdClient = Client.IdClient
| TABLE Author (
Author.idauthor (NUMBER),
Author.name (VARCHAR(25)),
)
TABLE Author_Book (
Author_Book.isbn (CHAR(15)),
Author_Book.author (NUMBER),
)
TABLE Book (
Book.isbn (CHAR(15)),
Book.title (VARCHAR(60)),
Book.author (CHAR(4)),
Book.purchaseprice (NUMBER(6,2)),
Book.saleprice (NUMBER(6,2)),
)
TABLE Books_Order (
Books_Order.isbn (CHAR(15)),
Books_Order.idorder (CHAR(10)),
Books_Order.amount (NUMBER(3)),
)
TABLE Client (
Client.idclient (CHAR(10)),
Client.name (VARCHAR(25)),
Client.address (VARCHAR(60)),
Client.numcc (CHAR(16)),
)
TABLE Orders (
Orders.idorder (CHAR(10)),
Orders.idclient (CHAR(10)),
Orders.dateorder (DATE),
Orders.dateexped (DATE),
)
Possible JOINs:
Author_Book.isbn = Book.isbn
Author_Book.author = Author.idauthora
Books_Order.isbn = Book.isbn
Books_Order.idorder = Orders.idorder
Orders.idclient = Client.idclient
| TABLE author (
author.idauthor (NUMBER),
author.name (VARCHAR(25)),
)
TABLE author_book (
author_book.isbn (CHAR(15)),
author_book.author (NUMBER),
)
TABLE book (
book.isbn (CHAR(15)),
book.title (VARCHAR(60)),
book.author (CHAR(4)),
book.purchaseprice (NUMBER(6,2)),
book.saleprice (NUMBER(6,2)),
)
TABLE books_order (
books_order.isbn (CHAR(15)),
books_order.idorder (CHAR(10)),
books_order.amount (NUMBER(3)),
)
TABLE client (
client.idclient (CHAR(10)),
client.name (VARCHAR(25)),
client.address (VARCHAR(60)),
client.numcc (CHAR(16)),
)
TABLE orders (
orders.idorder (CHAR(10)),
orders.idclient (CHAR(10)),
orders.dateorder (DATE),
orders.dateexped (DATE),
)
Possible JOINs:
author_book.isbn = book.isbn
author_book.author = author.idauthora
books_order.isbn = book.isbn
books_order.idorder = orders.idorder
orders.idclient = client.idclient
|
book_1 |
CREATE TABLE Client
(IdClient CHAR(10) PRIMARY KEY,
Name VARCHAR(25) NOT NULL,
Address VARCHAR(60) NOT NULL,
NumCC CHAR(16) NOT NULL)
/*
0 rows from Client table:
IdClient Name Address NumCC
*/
CREATE TABLE Orders
(IdOrder CHAR(10) PRIMARY KEY,
IdClient CHAR(10) NOT NULL REFERENCES Client on delete cascade,
DateOrder DATE,
DateExped DATE)
/*
0 rows from Orders table:
IdOrder IdClient DateOrder DateExped
*/
CREATE TABLE Author
( idAuthor NUMBER PRIMARY KEY,
Name VARCHAR(25))
/*
0 rows from Author table:
idAuthor Name
*/
CREATE TABLE Book
(ISBN CHAR(15) PRIMARY KEY,
Title VARCHAR(60) NOT NULL,
Author CHAR(4) NOT NULL,
PurchasePrice NUMBER(6,2) DEFAULT 0,
SalePrice NUMBER(6,2) DEFAULT 0)
/*
0 rows from Book table:
ISBN Title Author PurchasePrice SalePrice
*/
CREATE TABLE Author_Book
(ISBN CHAR(15),
Author NUMBER,
CONSTRAINT al_PK PRIMARY KEY (ISBN, Author),
CONSTRAINT BookA_FK FOREIGN KEY (ISBN) REFERENCES `Book`(ISBN) on delete cascade,
CONSTRAINT Author_FK FOREIGN KEY (Author) REFERENCES `Author`(idAuthorA))
/*
0 rows from Author_Book table:
ISBN Author
*/
CREATE TABLE Books_Order(
ISBN CHAR(15),
IdOrder CHAR(10),
amount NUMBER(3) CHECK (amount >0),
CONSTRAINT lp_PK PRIMARY KEY (ISBN, idOrder),
CONSTRAINT Book_FK FOREIGN KEY (ISBN) REFERENCES `Book`(ISBN) on delete cascade,
CONSTRAINT pedido_FK FOREIGN KEY (IdOrder) REFERENCES `Orders`(IdOrder) on delete cascade)
/*
0 rows from Books_Order table:
ISBN IdOrder amount
*/
| Show the client name who has the most total amount of books ordered. | extra | Table Author (
Author.idAuthor (NUMBER),
Author.Name (VARCHAR(25)),
)
Table Author_Book (
Author_Book.ISBN (CHAR(15)),
Author_Book.Author (NUMBER),
)
Table Book (
Book.ISBN (CHAR(15)),
Book.Title (VARCHAR(60)),
Book.Author (CHAR(4)),
Book.PurchasePrice (NUMBER(6,2)),
Book.SalePrice (NUMBER(6,2)),
)
Table Books_Order (
Books_Order.ISBN (CHAR(15)),
Books_Order.IdOrder (CHAR(10)),
Books_Order.amount (NUMBER(3)),
)
Table Client (
Client.IdClient (CHAR(10)),
Client.Name (VARCHAR(25)),
Client.Address (VARCHAR(60)),
Client.NumCC (CHAR(16)),
)
Table Orders (
Orders.IdOrder (CHAR(10)),
Orders.IdClient (CHAR(10)),
Orders.DateOrder (DATE),
Orders.DateExped (DATE),
)
Possible JOINs:
Author_Book.ISBN = Book.ISBN
Author_Book.Author = Author.idAuthorA
Books_Order.ISBN = Book.ISBN
Books_Order.IdOrder = Orders.IdOrder
Orders.IdClient = Client.IdClient
| SELECT Client.name FROM Orders JOIN Client ON Orders.idClient = Client.idClient JOIN Books_Order ON Books_Order.idOrder = Orders.idOrder GROUP BY Orders.idClient ORDER BY sum(Books_Order.amount) DESC LIMIT 1 | {
'orders': ['idorder', 'idclient'],
'client': ['idclient', 'name'],
'books_order': ['isbn', 'idorder', 'amount']
} | CREATE TABLE Author (
Author.idAuthor (NUMBER),
Author.Name (VARCHAR(25)),
)
CREATE TABLE Author_Book (
Author_Book.ISBN (CHAR(15)),
Author_Book.Author (NUMBER),
)
CREATE TABLE Book (
Book.ISBN (CHAR(15)),
Book.Title (VARCHAR(60)),
Book.Author (CHAR(4)),
Book.PurchasePrice (NUMBER(6,2)),
Book.SalePrice (NUMBER(6,2)),
)
CREATE TABLE Books_Order (
Books_Order.ISBN (CHAR(15)),
Books_Order.IdOrder (CHAR(10)),
Books_Order.amount (NUMBER(3)),
)
CREATE TABLE Client (
Client.IdClient (CHAR(10)),
Client.Name (VARCHAR(25)),
Client.Address (VARCHAR(60)),
Client.NumCC (CHAR(16)),
)
CREATE TABLE Orders (
Orders.IdOrder (CHAR(10)),
Orders.IdClient (CHAR(10)),
Orders.DateOrder (DATE),
Orders.DateExped (DATE),
)
Possible JOINs:
Author_Book.ISBN = Book.ISBN
Author_Book.Author = Author.idAuthorA
Books_Order.ISBN = Book.ISBN
Books_Order.IdOrder = Orders.IdOrder
Orders.IdClient = Client.IdClient
| Table Author (
Author.idauthor (NUMBER),
Author.name (VARCHAR(25)),
)
Table Author_Book (
Author_Book.isbn (CHAR(15)),
Author_Book.author (NUMBER),
)
Table Book (
Book.isbn (CHAR(15)),
Book.title (VARCHAR(60)),
Book.author (CHAR(4)),
Book.purchaseprice (NUMBER(6,2)),
Book.saleprice (NUMBER(6,2)),
)
Table Books_Order (
Books_Order.isbn (CHAR(15)),
Books_Order.idorder (CHAR(10)),
Books_Order.amount (NUMBER(3)),
)
Table Client (
Client.idclient (CHAR(10)),
Client.name (VARCHAR(25)),
Client.address (VARCHAR(60)),
Client.numcc (CHAR(16)),
)
Table Orders (
Orders.idorder (CHAR(10)),
Orders.idclient (CHAR(10)),
Orders.dateorder (DATE),
Orders.dateexped (DATE),
)
Possible JOINs:
Author_Book.isbn = Book.isbn
Author_Book.author = Author.idauthora
Books_Order.isbn = Book.isbn
Books_Order.idorder = Orders.idorder
Orders.idclient = Client.idclient
| CREATE TABLE Author (
Author.idauthor (NUMBER),
Author.name (VARCHAR(25)),
)
CREATE TABLE Author_Book (
Author_Book.isbn (CHAR(15)),
Author_Book.author (NUMBER),
)
CREATE TABLE Book (
Book.isbn (CHAR(15)),
Book.title (VARCHAR(60)),
Book.author (CHAR(4)),
Book.purchaseprice (NUMBER(6,2)),
Book.saleprice (NUMBER(6,2)),
)
CREATE TABLE Books_Order (
Books_Order.isbn (CHAR(15)),
Books_Order.idorder (CHAR(10)),
Books_Order.amount (NUMBER(3)),
)
CREATE TABLE Client (
Client.idclient (CHAR(10)),
Client.name (VARCHAR(25)),
Client.address (VARCHAR(60)),
Client.numcc (CHAR(16)),
)
CREATE TABLE Orders (
Orders.idorder (CHAR(10)),
Orders.idclient (CHAR(10)),
Orders.dateorder (DATE),
Orders.dateexped (DATE),
)
Possible JOINs:
Author_Book.isbn = Book.isbn
Author_Book.author = Author.idauthora
Books_Order.isbn = Book.isbn
Books_Order.idorder = Orders.idorder
Orders.idclient = Client.idclient
| Table author (
author.idauthor (NUMBER),
author.name (VARCHAR(25)),
)
Table author_book (
author_book.isbn (CHAR(15)),
author_book.author (NUMBER),
)
Table book (
book.isbn (CHAR(15)),
book.title (VARCHAR(60)),
book.author (CHAR(4)),
book.purchaseprice (NUMBER(6,2)),
book.saleprice (NUMBER(6,2)),
)
Table books_order (
books_order.isbn (CHAR(15)),
books_order.idorder (CHAR(10)),
books_order.amount (NUMBER(3)),
)
Table client (
client.idclient (CHAR(10)),
client.name (VARCHAR(25)),
client.address (VARCHAR(60)),
client.numcc (CHAR(16)),
)
Table orders (
orders.idorder (CHAR(10)),
orders.idclient (CHAR(10)),
orders.dateorder (DATE),
orders.dateexped (DATE),
)
Possible JOINs:
author_book.isbn = book.isbn
author_book.author = author.idauthora
books_order.isbn = book.isbn
books_order.idorder = orders.idorder
orders.idclient = client.idclient
| CREATE TABLE author (
author.idauthor (NUMBER),
author.name (VARCHAR(25)),
)
CREATE TABLE author_book (
author_book.isbn (CHAR(15)),
author_book.author (NUMBER),
)
CREATE TABLE book (
book.isbn (CHAR(15)),
book.title (VARCHAR(60)),
book.author (CHAR(4)),
book.purchaseprice (NUMBER(6,2)),
book.saleprice (NUMBER(6,2)),
)
CREATE TABLE books_order (
books_order.isbn (CHAR(15)),
books_order.idorder (CHAR(10)),
books_order.amount (NUMBER(3)),
)
CREATE TABLE client (
client.idclient (CHAR(10)),
client.name (VARCHAR(25)),
client.address (VARCHAR(60)),
client.numcc (CHAR(16)),
)
CREATE TABLE orders (
orders.idorder (CHAR(10)),
orders.idclient (CHAR(10)),
orders.dateorder (DATE),
orders.dateexped (DATE),
)
Possible JOINs:
author_book.isbn = book.isbn
author_book.author = author.idauthora
books_order.isbn = book.isbn
books_order.idorder = orders.idorder
orders.idclient = client.idclient
| {
'Client': ['IdClient', 'Name', 'Address', 'NumCC'],
'Orders': ['IdOrder', 'IdClient', 'DateOrder', 'DateExped'],
'Author': ['idAuthor', 'Name'],
'Book': ['ISBN', 'Title', 'Author', 'PurchasePrice', 'SalePrice'],
'Author_Book': ['ISBN', 'Author'],
'Books_Order': ['ISBN', 'IdOrder', 'amount']
} | {
'Orders': ['IdOrder', 'IdClient'],
'Client': ['IdClient', 'Name'],
'Books_Order': ['ISBN', 'IdOrder', 'amount']
} | TABLE Author (
Author.idAuthor (NUMBER),
Author.Name (VARCHAR(25)),
)
TABLE Author_Book (
Author_Book.ISBN (CHAR(15)),
Author_Book.Author (NUMBER),
)
TABLE Book (
Book.ISBN (CHAR(15)),
Book.Title (VARCHAR(60)),
Book.Author (CHAR(4)),
Book.PurchasePrice (NUMBER(6,2)),
Book.SalePrice (NUMBER(6,2)),
)
TABLE Books_Order (
Books_Order.ISBN (CHAR(15)),
Books_Order.IdOrder (CHAR(10)),
Books_Order.amount (NUMBER(3)),
)
TABLE Client (
Client.IdClient (CHAR(10)),
Client.Name (VARCHAR(25)),
Client.Address (VARCHAR(60)),
Client.NumCC (CHAR(16)),
)
TABLE Orders (
Orders.IdOrder (CHAR(10)),
Orders.IdClient (CHAR(10)),
Orders.DateOrder (DATE),
Orders.DateExped (DATE),
)
Possible JOINs:
Author_Book.ISBN = Book.ISBN
Author_Book.Author = Author.idAuthorA
Books_Order.ISBN = Book.ISBN
Books_Order.IdOrder = Orders.IdOrder
Orders.IdClient = Client.IdClient
| TABLE Author (
Author.idauthor (NUMBER),
Author.name (VARCHAR(25)),
)
TABLE Author_Book (
Author_Book.isbn (CHAR(15)),
Author_Book.author (NUMBER),
)
TABLE Book (
Book.isbn (CHAR(15)),
Book.title (VARCHAR(60)),
Book.author (CHAR(4)),
Book.purchaseprice (NUMBER(6,2)),
Book.saleprice (NUMBER(6,2)),
)
TABLE Books_Order (
Books_Order.isbn (CHAR(15)),
Books_Order.idorder (CHAR(10)),
Books_Order.amount (NUMBER(3)),
)
TABLE Client (
Client.idclient (CHAR(10)),
Client.name (VARCHAR(25)),
Client.address (VARCHAR(60)),
Client.numcc (CHAR(16)),
)
TABLE Orders (
Orders.idorder (CHAR(10)),
Orders.idclient (CHAR(10)),
Orders.dateorder (DATE),
Orders.dateexped (DATE),
)
Possible JOINs:
Author_Book.isbn = Book.isbn
Author_Book.author = Author.idauthora
Books_Order.isbn = Book.isbn
Books_Order.idorder = Orders.idorder
Orders.idclient = Client.idclient
| TABLE author (
author.idauthor (NUMBER),
author.name (VARCHAR(25)),
)
TABLE author_book (
author_book.isbn (CHAR(15)),
author_book.author (NUMBER),
)
TABLE book (
book.isbn (CHAR(15)),
book.title (VARCHAR(60)),
book.author (CHAR(4)),
book.purchaseprice (NUMBER(6,2)),
book.saleprice (NUMBER(6,2)),
)
TABLE books_order (
books_order.isbn (CHAR(15)),
books_order.idorder (CHAR(10)),
books_order.amount (NUMBER(3)),
)
TABLE client (
client.idclient (CHAR(10)),
client.name (VARCHAR(25)),
client.address (VARCHAR(60)),
client.numcc (CHAR(16)),
)
TABLE orders (
orders.idorder (CHAR(10)),
orders.idclient (CHAR(10)),
orders.dateorder (DATE),
orders.dateexped (DATE),
)
Possible JOINs:
author_book.isbn = book.isbn
author_book.author = author.idauthora
books_order.isbn = book.isbn
books_order.idorder = orders.idorder
orders.idclient = client.idclient
|
car_racing |
CREATE TABLE "country" (
"Country_Id" int,
"Country" text,
"Capital" text,
"Official_native_language" text,
"Regoin" text,
PRIMARY KEY ("Country_Id")
)
/*
0 rows from country table:
Country_Id Country Capital Official_native_language Regoin
*/
CREATE TABLE `team` (
"Team_ID" int,
"Team" text,
"Make" text,
"Manager" text,
"Sponsor" text,
"Car_Owner" text,
PRIMARY KEY ("Team_ID")
)
/*
0 rows from team table:
Team_ID Team Make Manager Sponsor Car_Owner
*/
CREATE TABLE `driver` (
"Driver_ID" int,
"Driver" text,
"Country" int,
"Age" int,
"Car_#" real,
"Make" text,
"Points" text,
"Laps" real,
"Winnings" text,
PRIMARY KEY ("Driver_ID"),
FOREIGN KEY (`Country`) REFERENCES `country`(`Country_ID`)
)
/*
0 rows from driver table:
Driver_ID Driver Country Age Car_# Make Points Laps Winnings
*/
CREATE TABLE `team_driver` (
"Team_ID" int,
"Driver_ID" int,
PRIMARY KEY ("Team_ID","Driver_ID"),
FOREIGN KEY (`Team_ID`) REFERENCES `team`(`Team_ID`),
FOREIGN KEY (`Driver_ID`) REFERENCES `driver`(`Driver_ID`)
)
/*
0 rows from team_driver table:
Team_ID Driver_ID
*/
| What is the maximum points of the drivers from a country whose capital is "Dublin"? | medium | Table country (
country.Country_Id (INT),
country.Country (TEXT),
country.Capital (TEXT),
country.Official_native_language (TEXT),
country.Regoin (TEXT),
)
Table driver (
driver.Driver_ID (INT),
driver.Driver (TEXT),
driver.Country (INT),
driver.Age (INT),
driver.Car_# (REAL),
driver.Make (TEXT),
driver.Points (TEXT),
driver.Laps (REAL),
driver.Winnings (TEXT),
)
Table team (
team.Team_ID (INT),
team.Team (TEXT),
team.Make (TEXT),
team.Manager (TEXT),
team.Sponsor (TEXT),
team.Car_Owner (TEXT),
)
Table team_driver (
team_driver.Team_ID (INT),
team_driver.Driver_ID (INT),
)
Possible JOINs:
driver.Country = country.Country_ID
team_driver.Team_ID = team.Team_ID
team_driver.Driver_ID = driver.Driver_ID
| SELECT max(driver.Points) FROM country JOIN driver ON country.Country_ID = driver.Country WHERE country.Capital = "Dublin" | {
'country': ['country_id', 'country', 'capital'],
'driver': ['driver_id', 'driver', 'country', 'points']
} | CREATE TABLE country (
country.Country_Id (INT),
country.Country (TEXT),
country.Capital (TEXT),
country.Official_native_language (TEXT),
country.Regoin (TEXT),
)
CREATE TABLE driver (
driver.Driver_ID (INT),
driver.Driver (TEXT),
driver.Country (INT),
driver.Age (INT),
driver.Car_# (REAL),
driver.Make (TEXT),
driver.Points (TEXT),
driver.Laps (REAL),
driver.Winnings (TEXT),
)
CREATE TABLE team (
team.Team_ID (INT),
team.Team (TEXT),
team.Make (TEXT),
team.Manager (TEXT),
team.Sponsor (TEXT),
team.Car_Owner (TEXT),
)
CREATE TABLE team_driver (
team_driver.Team_ID (INT),
team_driver.Driver_ID (INT),
)
Possible JOINs:
driver.Country = country.Country_ID
team_driver.Team_ID = team.Team_ID
team_driver.Driver_ID = driver.Driver_ID
| Table country (
country.country_id (INT),
country.country (TEXT),
country.capital (TEXT),
country.official_native_language (TEXT),
country.regoin (TEXT),
)
Table driver (
driver.driver_id (INT),
driver.driver (TEXT),
driver.country (INT),
driver.age (INT),
driver.car_# (REAL),
driver.make (TEXT),
driver.points (TEXT),
driver.laps (REAL),
driver.winnings (TEXT),
)
Table team (
team.team_id (INT),
team.team (TEXT),
team.make (TEXT),
team.manager (TEXT),
team.sponsor (TEXT),
team.car_owner (TEXT),
)
Table team_driver (
team_driver.team_id (INT),
team_driver.driver_id (INT),
)
Possible JOINs:
driver.country = country.country_id
team_driver.team_id = team.team_id
team_driver.driver_id = driver.driver_id
| CREATE TABLE country (
country.country_id (INT),
country.country (TEXT),
country.capital (TEXT),
country.official_native_language (TEXT),
country.regoin (TEXT),
)
CREATE TABLE driver (
driver.driver_id (INT),
driver.driver (TEXT),
driver.country (INT),
driver.age (INT),
driver.car_# (REAL),
driver.make (TEXT),
driver.points (TEXT),
driver.laps (REAL),
driver.winnings (TEXT),
)
CREATE TABLE team (
team.team_id (INT),
team.team (TEXT),
team.make (TEXT),
team.manager (TEXT),
team.sponsor (TEXT),
team.car_owner (TEXT),
)
CREATE TABLE team_driver (
team_driver.team_id (INT),
team_driver.driver_id (INT),
)
Possible JOINs:
driver.country = country.country_id
team_driver.team_id = team.team_id
team_driver.driver_id = driver.driver_id
| Table country (
country.country_id (INT),
country.country (TEXT),
country.capital (TEXT),
country.official_native_language (TEXT),
country.regoin (TEXT),
)
Table driver (
driver.driver_id (INT),
driver.driver (TEXT),
driver.country (INT),
driver.age (INT),
driver.car_# (REAL),
driver.make (TEXT),
driver.points (TEXT),
driver.laps (REAL),
driver.winnings (TEXT),
)
Table team (
team.team_id (INT),
team.team (TEXT),
team.make (TEXT),
team.manager (TEXT),
team.sponsor (TEXT),
team.car_owner (TEXT),
)
Table team_driver (
team_driver.team_id (INT),
team_driver.driver_id (INT),
)
Possible JOINs:
driver.country = country.country_id
team_driver.team_id = team.team_id
team_driver.driver_id = driver.driver_id
| CREATE TABLE country (
country.country_id (INT),
country.country (TEXT),
country.capital (TEXT),
country.official_native_language (TEXT),
country.regoin (TEXT),
)
CREATE TABLE driver (
driver.driver_id (INT),
driver.driver (TEXT),
driver.country (INT),
driver.age (INT),
driver.car_# (REAL),
driver.make (TEXT),
driver.points (TEXT),
driver.laps (REAL),
driver.winnings (TEXT),
)
CREATE TABLE team (
team.team_id (INT),
team.team (TEXT),
team.make (TEXT),
team.manager (TEXT),
team.sponsor (TEXT),
team.car_owner (TEXT),
)
CREATE TABLE team_driver (
team_driver.team_id (INT),
team_driver.driver_id (INT),
)
Possible JOINs:
driver.country = country.country_id
team_driver.team_id = team.team_id
team_driver.driver_id = driver.driver_id
| {
'country': ['Country_Id', 'Country', 'Capital', 'Official_native_language', 'Regoin'],
'team': ['Team_ID', 'Team', 'Make', 'Manager', 'Sponsor', 'Car_Owner'],
'driver': ['Driver_ID', 'Driver', 'Country', 'Age', 'Car_#', 'Make', 'Points', 'Laps', 'Winnings'],
'team_driver': ['Team_ID', 'Driver_ID']
} | {
'country': ['Country_Id', 'Country', 'Capital'],
'driver': ['Driver_ID', 'Driver', 'Country', 'Points']
} | TABLE country (
country.Country_Id (INT),
country.Country (TEXT),
country.Capital (TEXT),
country.Official_native_language (TEXT),
country.Regoin (TEXT),
)
TABLE driver (
driver.Driver_ID (INT),
driver.Driver (TEXT),
driver.Country (INT),
driver.Age (INT),
driver.Car_# (REAL),
driver.Make (TEXT),
driver.Points (TEXT),
driver.Laps (REAL),
driver.Winnings (TEXT),
)
TABLE team (
team.Team_ID (INT),
team.Team (TEXT),
team.Make (TEXT),
team.Manager (TEXT),
team.Sponsor (TEXT),
team.Car_Owner (TEXT),
)
TABLE team_driver (
team_driver.Team_ID (INT),
team_driver.Driver_ID (INT),
)
Possible JOINs:
driver.Country = country.Country_ID
team_driver.Team_ID = team.Team_ID
team_driver.Driver_ID = driver.Driver_ID
| TABLE country (
country.country_id (INT),
country.country (TEXT),
country.capital (TEXT),
country.official_native_language (TEXT),
country.regoin (TEXT),
)
TABLE driver (
driver.driver_id (INT),
driver.driver (TEXT),
driver.country (INT),
driver.age (INT),
driver.car_# (REAL),
driver.make (TEXT),
driver.points (TEXT),
driver.laps (REAL),
driver.winnings (TEXT),
)
TABLE team (
team.team_id (INT),
team.team (TEXT),
team.make (TEXT),
team.manager (TEXT),
team.sponsor (TEXT),
team.car_owner (TEXT),
)
TABLE team_driver (
team_driver.team_id (INT),
team_driver.driver_id (INT),
)
Possible JOINs:
driver.country = country.country_id
team_driver.team_id = team.team_id
team_driver.driver_id = driver.driver_id
| TABLE country (
country.country_id (INT),
country.country (TEXT),
country.capital (TEXT),
country.official_native_language (TEXT),
country.regoin (TEXT),
)
TABLE driver (
driver.driver_id (INT),
driver.driver (TEXT),
driver.country (INT),
driver.age (INT),
driver.car_# (REAL),
driver.make (TEXT),
driver.points (TEXT),
driver.laps (REAL),
driver.winnings (TEXT),
)
TABLE team (
team.team_id (INT),
team.team (TEXT),
team.make (TEXT),
team.manager (TEXT),
team.sponsor (TEXT),
team.car_owner (TEXT),
)
TABLE team_driver (
team_driver.team_id (INT),
team_driver.driver_id (INT),
)
Possible JOINs:
driver.country = country.country_id
team_driver.team_id = team.team_id
team_driver.driver_id = driver.driver_id
|
video_game |
CREATE TABLE game (
"Game_ID" INTEGER,
"Title" TEXT,
"Release_Date" TEXT,
"Franchise" TEXT,
"Developers" TEXT,
"Platform_ID" INTEGER,
"Units_sold_Millions" INTEGER,
PRIMARY KEY ("Game_ID"),
FOREIGN KEY("Platform_ID") REFERENCES platform ("Platform_ID")
)
CREATE TABLE game_player (
"Player_ID" INTEGER,
"Game_ID" INTEGER,
"If_active" BOOLEAN,
PRIMARY KEY ("Player_ID", "Game_ID"),
FOREIGN KEY("Player_ID") REFERENCES player ("Player_ID"),
FOREIGN KEY("Game_ID") REFERENCES game ("Game_ID")
)
CREATE TABLE platform (
"Platform_ID" INTEGER,
"Platform_name" TEXT,
"Market_district" TEXT,
"Download_rank" INTEGER,
PRIMARY KEY ("Platform_ID")
)
CREATE TABLE player (
"Player_ID" INTEGER,
"Rank_of_the_year" INTEGER,
"Player_name" TEXT,
"Position" TEXT,
"College" TEXT,
PRIMARY KEY ("Player_ID")
) | List all player names in ascending alphabetical order. | easy | Table game (
game.Game_ID (INT),
game.Title (TEXT),
game.Release_Date (TEXT),
game.Franchise (TEXT),
game.Developers (TEXT),
game.Platform_ID (INT),
game.Units_sold_Millions (INT),
)
Table game_player (
game_player.Player_ID (INT),
game_player.Game_ID (INT),
game_player.If_active (bool),
)
Table platform (
platform.Platform_ID (INT),
platform.Platform_name (TEXT),
platform.Market_district (TEXT),
platform.Download_rank (INT),
)
Table player (
player.Player_ID (INT),
player.Rank_of_the_year (INT),
player.Player_name (TEXT),
player.Position (TEXT),
player.College (TEXT),
)
Possible JOINs:
game.Platform_ID = platform.Platform_ID
game_player.Player_ID = player.Player_ID
game_player.Game_ID = game.Game_ID
| SELECT Player_name FROM player ORDER BY Player_name ASC | {
'player': ['player_id', 'player_name']
} | CREATE TABLE game (
game.Game_ID (INT),
game.Title (TEXT),
game.Release_Date (TEXT),
game.Franchise (TEXT),
game.Developers (TEXT),
game.Platform_ID (INT),
game.Units_sold_Millions (INT),
)
CREATE TABLE game_player (
game_player.Player_ID (INT),
game_player.Game_ID (INT),
game_player.If_active (bool),
)
CREATE TABLE platform (
platform.Platform_ID (INT),
platform.Platform_name (TEXT),
platform.Market_district (TEXT),
platform.Download_rank (INT),
)
CREATE TABLE player (
player.Player_ID (INT),
player.Rank_of_the_year (INT),
player.Player_name (TEXT),
player.Position (TEXT),
player.College (TEXT),
)
Possible JOINs:
game.Platform_ID = platform.Platform_ID
game_player.Player_ID = player.Player_ID
game_player.Game_ID = game.Game_ID
| Table game (
game.game_id (INT),
game.title (TEXT),
game.release_date (TEXT),
game.franchise (TEXT),
game.developers (TEXT),
game.platform_id (INT),
game.units_sold_millions (INT),
)
Table game_player (
game_player.player_id (INT),
game_player.game_id (INT),
game_player.if_active (bool),
)
Table platform (
platform.platform_id (INT),
platform.platform_name (TEXT),
platform.market_district (TEXT),
platform.download_rank (INT),
)
Table player (
player.player_id (INT),
player.rank_of_the_year (INT),
player.player_name (TEXT),
player.position (TEXT),
player.college (TEXT),
)
Possible JOINs:
game.platform_id = platform.platform_id
game_player.player_id = player.player_id
game_player.game_id = game.game_id
| CREATE TABLE game (
game.game_id (INT),
game.title (TEXT),
game.release_date (TEXT),
game.franchise (TEXT),
game.developers (TEXT),
game.platform_id (INT),
game.units_sold_millions (INT),
)
CREATE TABLE game_player (
game_player.player_id (INT),
game_player.game_id (INT),
game_player.if_active (bool),
)
CREATE TABLE platform (
platform.platform_id (INT),
platform.platform_name (TEXT),
platform.market_district (TEXT),
platform.download_rank (INT),
)
CREATE TABLE player (
player.player_id (INT),
player.rank_of_the_year (INT),
player.player_name (TEXT),
player.position (TEXT),
player.college (TEXT),
)
Possible JOINs:
game.platform_id = platform.platform_id
game_player.player_id = player.player_id
game_player.game_id = game.game_id
| Table game (
game.game_id (INT),
game.title (TEXT),
game.release_date (TEXT),
game.franchise (TEXT),
game.developers (TEXT),
game.platform_id (INT),
game.units_sold_millions (INT),
)
Table game_player (
game_player.player_id (INT),
game_player.game_id (INT),
game_player.if_active (bool),
)
Table platform (
platform.platform_id (INT),
platform.platform_name (TEXT),
platform.market_district (TEXT),
platform.download_rank (INT),
)
Table player (
player.player_id (INT),
player.rank_of_the_year (INT),
player.player_name (TEXT),
player.position (TEXT),
player.college (TEXT),
)
Possible JOINs:
game.platform_id = platform.platform_id
game_player.player_id = player.player_id
game_player.game_id = game.game_id
| CREATE TABLE game (
game.game_id (INT),
game.title (TEXT),
game.release_date (TEXT),
game.franchise (TEXT),
game.developers (TEXT),
game.platform_id (INT),
game.units_sold_millions (INT),
)
CREATE TABLE game_player (
game_player.player_id (INT),
game_player.game_id (INT),
game_player.if_active (bool),
)
CREATE TABLE platform (
platform.platform_id (INT),
platform.platform_name (TEXT),
platform.market_district (TEXT),
platform.download_rank (INT),
)
CREATE TABLE player (
player.player_id (INT),
player.rank_of_the_year (INT),
player.player_name (TEXT),
player.position (TEXT),
player.college (TEXT),
)
Possible JOINs:
game.platform_id = platform.platform_id
game_player.player_id = player.player_id
game_player.game_id = game.game_id
| {
'platform': ['Platform_ID', 'Platform_name', 'Market_district', 'Download_rank'],
'game': ['Game_ID', 'Title', 'Release_Date', 'Franchise', 'Developers', 'Platform_ID', 'Units_sold_Millions'],
'player': ['Player_ID', 'Rank_of_the_year', 'Player_name', 'Position', 'College'],
'game_player': ['Player_ID', 'Game_ID', 'If_active']
} | {
'player': ['Player_ID', 'Player_name']
} | TABLE game (
game.Game_ID (INT),
game.Title (TEXT),
game.Release_Date (TEXT),
game.Franchise (TEXT),
game.Developers (TEXT),
game.Platform_ID (INT),
game.Units_sold_Millions (INT),
)
TABLE game_player (
game_player.Player_ID (INT),
game_player.Game_ID (INT),
game_player.If_active (bool),
)
TABLE platform (
platform.Platform_ID (INT),
platform.Platform_name (TEXT),
platform.Market_district (TEXT),
platform.Download_rank (INT),
)
TABLE player (
player.Player_ID (INT),
player.Rank_of_the_year (INT),
player.Player_name (TEXT),
player.Position (TEXT),
player.College (TEXT),
)
Possible JOINs:
game.Platform_ID = platform.Platform_ID
game_player.Player_ID = player.Player_ID
game_player.Game_ID = game.Game_ID
| TABLE game (
game.game_id (INT),
game.title (TEXT),
game.release_date (TEXT),
game.franchise (TEXT),
game.developers (TEXT),
game.platform_id (INT),
game.units_sold_millions (INT),
)
TABLE game_player (
game_player.player_id (INT),
game_player.game_id (INT),
game_player.if_active (bool),
)
TABLE platform (
platform.platform_id (INT),
platform.platform_name (TEXT),
platform.market_district (TEXT),
platform.download_rank (INT),
)
TABLE player (
player.player_id (INT),
player.rank_of_the_year (INT),
player.player_name (TEXT),
player.position (TEXT),
player.college (TEXT),
)
Possible JOINs:
game.platform_id = platform.platform_id
game_player.player_id = player.player_id
game_player.game_id = game.game_id
| TABLE game (
game.game_id (INT),
game.title (TEXT),
game.release_date (TEXT),
game.franchise (TEXT),
game.developers (TEXT),
game.platform_id (INT),
game.units_sold_millions (INT),
)
TABLE game_player (
game_player.player_id (INT),
game_player.game_id (INT),
game_player.if_active (bool),
)
TABLE platform (
platform.platform_id (INT),
platform.platform_name (TEXT),
platform.market_district (TEXT),
platform.download_rank (INT),
)
TABLE player (
player.player_id (INT),
player.rank_of_the_year (INT),
player.player_name (TEXT),
player.position (TEXT),
player.college (TEXT),
)
Possible JOINs:
game.platform_id = platform.platform_id
game_player.player_id = player.player_id
game_player.game_id = game.game_id
|
bakery_1 |
CREATE TABLE customers (
"Id" INTEGER,
"LastName" TEXT,
"FirstName" TEXT,
PRIMARY KEY ("Id")
)
CREATE TABLE goods (
"Id" TEXT,
"Flavor" TEXT,
"Food" TEXT,
"Price" REAL,
PRIMARY KEY ("Id")
)
CREATE TABLE items (
"Receipt" INTEGER,
"Ordinal" INTEGER,
"Item" TEXT,
PRIMARY KEY ("Receipt", "Ordinal"),
FOREIGN KEY("Item") REFERENCES goods ("Id")
)
CREATE TABLE receipts (
"ReceiptNumber" INTEGER,
"Date" TEXT,
"CustomerId" INTEGER,
PRIMARY KEY ("ReceiptNumber"),
FOREIGN KEY("CustomerId") REFERENCES customers ("Id")
) | What are the minimum and maximum prices of food goods, ordered by food? | extra | Table customers (
customers.Id (INTEGER),
customers.LastName (TEXT),
customers.FirstName (TEXT),
)
Table goods (
goods.Id (TEXT),
goods.Flavor (TEXT),
goods.Food (TEXT),
goods.Price (REAL),
)
Table items (
items.Receipt (INTEGER),
items.Ordinal (INTEGER),
items.Item (TEXT),
)
Table receipts (
receipts.ReceiptNumber (INTEGER),
receipts.Date (TEXT),
receipts.CustomerId (INTEGER),
)
Possible JOINs:
items.Item = goods.Id
receipts.CustomerId = customers.Id
| SELECT min(price) , max(price) , food FROM goods GROUP BY food ORDER BY food | {
'goods': ['id', 'food', 'price']
} | CREATE TABLE customers (
customers.Id (INTEGER),
customers.LastName (TEXT),
customers.FirstName (TEXT),
)
CREATE TABLE goods (
goods.Id (TEXT),
goods.Flavor (TEXT),
goods.Food (TEXT),
goods.Price (REAL),
)
CREATE TABLE items (
items.Receipt (INTEGER),
items.Ordinal (INTEGER),
items.Item (TEXT),
)
CREATE TABLE receipts (
receipts.ReceiptNumber (INTEGER),
receipts.Date (TEXT),
receipts.CustomerId (INTEGER),
)
Possible JOINs:
items.Item = goods.Id
receipts.CustomerId = customers.Id
| Table customers (
customers.id (INTEGER),
customers.lastname (TEXT),
customers.firstname (TEXT),
)
Table goods (
goods.id (TEXT),
goods.flavor (TEXT),
goods.food (TEXT),
goods.price (REAL),
)
Table items (
items.receipt (INTEGER),
items.ordinal (INTEGER),
items.item (TEXT),
)
Table receipts (
receipts.receiptnumber (INTEGER),
receipts.date (TEXT),
receipts.customerid (INTEGER),
)
Possible JOINs:
items.item = goods.id
receipts.customerid = customers.id
| CREATE TABLE customers (
customers.id (INTEGER),
customers.lastname (TEXT),
customers.firstname (TEXT),
)
CREATE TABLE goods (
goods.id (TEXT),
goods.flavor (TEXT),
goods.food (TEXT),
goods.price (REAL),
)
CREATE TABLE items (
items.receipt (INTEGER),
items.ordinal (INTEGER),
items.item (TEXT),
)
CREATE TABLE receipts (
receipts.receiptnumber (INTEGER),
receipts.date (TEXT),
receipts.customerid (INTEGER),
)
Possible JOINs:
items.item = goods.id
receipts.customerid = customers.id
| Table customers (
customers.id (INTEGER),
customers.lastname (TEXT),
customers.firstname (TEXT),
)
Table goods (
goods.id (TEXT),
goods.flavor (TEXT),
goods.food (TEXT),
goods.price (REAL),
)
Table items (
items.receipt (INTEGER),
items.ordinal (INTEGER),
items.item (TEXT),
)
Table receipts (
receipts.receiptnumber (INTEGER),
receipts.date (TEXT),
receipts.customerid (INTEGER),
)
Possible JOINs:
items.item = goods.id
receipts.customerid = customers.id
| CREATE TABLE customers (
customers.id (INTEGER),
customers.lastname (TEXT),
customers.firstname (TEXT),
)
CREATE TABLE goods (
goods.id (TEXT),
goods.flavor (TEXT),
goods.food (TEXT),
goods.price (REAL),
)
CREATE TABLE items (
items.receipt (INTEGER),
items.ordinal (INTEGER),
items.item (TEXT),
)
CREATE TABLE receipts (
receipts.receiptnumber (INTEGER),
receipts.date (TEXT),
receipts.customerid (INTEGER),
)
Possible JOINs:
items.item = goods.id
receipts.customerid = customers.id
| {
'customers': ['Id', 'LastName', 'FirstName'],
'goods': ['Id', 'Flavor', 'Food', 'Price'],
'items': ['Receipt', 'Ordinal', 'Item'],
'receipts': ['ReceiptNumber', 'Date', 'CustomerId']
} | {
'goods': ['Id', 'Food', 'Price']
} | TABLE customers (
customers.Id (INTEGER),
customers.LastName (TEXT),
customers.FirstName (TEXT),
)
TABLE goods (
goods.Id (TEXT),
goods.Flavor (TEXT),
goods.Food (TEXT),
goods.Price (REAL),
)
TABLE items (
items.Receipt (INTEGER),
items.Ordinal (INTEGER),
items.Item (TEXT),
)
TABLE receipts (
receipts.ReceiptNumber (INTEGER),
receipts.Date (TEXT),
receipts.CustomerId (INTEGER),
)
Possible JOINs:
items.Item = goods.Id
receipts.CustomerId = customers.Id
| TABLE customers (
customers.id (INTEGER),
customers.lastname (TEXT),
customers.firstname (TEXT),
)
TABLE goods (
goods.id (TEXT),
goods.flavor (TEXT),
goods.food (TEXT),
goods.price (REAL),
)
TABLE items (
items.receipt (INTEGER),
items.ordinal (INTEGER),
items.item (TEXT),
)
TABLE receipts (
receipts.receiptnumber (INTEGER),
receipts.date (TEXT),
receipts.customerid (INTEGER),
)
Possible JOINs:
items.item = goods.id
receipts.customerid = customers.id
| TABLE customers (
customers.id (INTEGER),
customers.lastname (TEXT),
customers.firstname (TEXT),
)
TABLE goods (
goods.id (TEXT),
goods.flavor (TEXT),
goods.food (TEXT),
goods.price (REAL),
)
TABLE items (
items.receipt (INTEGER),
items.ordinal (INTEGER),
items.item (TEXT),
)
TABLE receipts (
receipts.receiptnumber (INTEGER),
receipts.date (TEXT),
receipts.customerid (INTEGER),
)
Possible JOINs:
items.item = goods.id
receipts.customerid = customers.id
|
tv_shows |
CREATE TABLE city_channel (
"ID" INTEGER,
"City" TEXT,
"Station_name" TEXT,
"Owned_Since" REAL,
"Affiliation" TEXT,
PRIMARY KEY ("ID")
)
CREATE TABLE city_channel_radio (
"City_channel_ID" INTEGER,
"Radio_ID" INTEGER,
"Is_online" BOOLEAN,
PRIMARY KEY ("City_channel_ID", "Radio_ID"),
FOREIGN KEY("Radio_ID") REFERENCES radio ("Radio_ID"),
FOREIGN KEY("City_channel_ID") REFERENCES city_channel ("ID")
)
CREATE TABLE city_channel_tv_show (
"City_channel_ID" INTEGER,
"tv_show_ID" INTEGER,
"Is_online" BOOLEAN,
"Is_free" BOOLEAN,
PRIMARY KEY ("City_channel_ID", "tv_show_ID"),
FOREIGN KEY("tv_show_ID") REFERENCES tv_show ("tv_show_ID"),
FOREIGN KEY("City_channel_ID") REFERENCES city_channel ("ID")
)
CREATE TABLE radio (
"Radio_ID" INTEGER,
"Transmitter" TEXT,
"Radio_MHz" TEXT,
"2FM_MHz" TEXT,
"RnaG_MHz" TEXT,
"Lyric_FM_MHz" TEXT,
"ERP_kW" TEXT,
PRIMARY KEY ("Radio_ID")
)
CREATE TABLE tv_show (
"tv_show_ID" INTEGER,
tv_show_name TEXT,
"Sub_tittle" TEXT,
"Next_show_name" TEXT,
"Original_Airdate" TEXT,
PRIMARY KEY ("tv_show_ID")
) | Show the cities and station names of city channels in ascending alphabetical order of station name. | medium | Table city_channel (
city_channel.ID (INT),
city_channel.City (TEXT),
city_channel.Station_name (TEXT),
city_channel.Owned_Since (REAL),
city_channel.Affiliation (TEXT),
)
Table city_channel_radio (
city_channel_radio.City_channel_ID (INT),
city_channel_radio.Radio_ID (INT),
city_channel_radio.Is_online (bool),
)
Table city_channel_tv_show (
city_channel_tv_show.City_channel_ID (INT),
city_channel_tv_show.tv_show_ID (INT),
city_channel_tv_show.Is_online (bool),
city_channel_tv_show.Is_free (bool),
)
Table radio (
radio.Radio_ID (INT),
radio.Transmitter (TEXT),
radio.Radio_MHz (TEXT),
radio.2FM_MHz (TEXT),
radio.RnaG_MHz (TEXT),
radio.Lyric_FM_MHz (TEXT),
radio.ERP_kW (TEXT),
)
Table tv_show (
tv_show.tv_show_ID (INT),
tv_show.tv_show_name (TEXT),
tv_show.Sub_tittle (TEXT),
tv_show.Next_show_name (TEXT),
tv_show.Original_Airdate (TEXT),
)
Possible JOINs:
city_channel_radio.City_channel_ID = city_channel.ID
city_channel_radio.Radio_ID = radio.Radio_ID
city_channel_tv_show.City_channel_ID = city_channel.ID
city_channel_tv_show.tv_show_ID = tv_show.tv_show_ID
| SELECT City , Station_name FROM city_channel ORDER BY Station_name ASC | {
'city_channel': ['id', 'city', 'station_name']
} | CREATE TABLE city_channel (
city_channel.ID (INT),
city_channel.City (TEXT),
city_channel.Station_name (TEXT),
city_channel.Owned_Since (REAL),
city_channel.Affiliation (TEXT),
)
CREATE TABLE city_channel_radio (
city_channel_radio.City_channel_ID (INT),
city_channel_radio.Radio_ID (INT),
city_channel_radio.Is_online (bool),
)
CREATE TABLE city_channel_tv_show (
city_channel_tv_show.City_channel_ID (INT),
city_channel_tv_show.tv_show_ID (INT),
city_channel_tv_show.Is_online (bool),
city_channel_tv_show.Is_free (bool),
)
CREATE TABLE radio (
radio.Radio_ID (INT),
radio.Transmitter (TEXT),
radio.Radio_MHz (TEXT),
radio.2FM_MHz (TEXT),
radio.RnaG_MHz (TEXT),
radio.Lyric_FM_MHz (TEXT),
radio.ERP_kW (TEXT),
)
CREATE TABLE tv_show (
tv_show.tv_show_ID (INT),
tv_show.tv_show_name (TEXT),
tv_show.Sub_tittle (TEXT),
tv_show.Next_show_name (TEXT),
tv_show.Original_Airdate (TEXT),
)
Possible JOINs:
city_channel_radio.City_channel_ID = city_channel.ID
city_channel_radio.Radio_ID = radio.Radio_ID
city_channel_tv_show.City_channel_ID = city_channel.ID
city_channel_tv_show.tv_show_ID = tv_show.tv_show_ID
| Table city_channel (
city_channel.id (INT),
city_channel.city (TEXT),
city_channel.station_name (TEXT),
city_channel.owned_since (REAL),
city_channel.affiliation (TEXT),
)
Table city_channel_radio (
city_channel_radio.city_channel_id (INT),
city_channel_radio.radio_id (INT),
city_channel_radio.is_online (bool),
)
Table city_channel_tv_show (
city_channel_tv_show.city_channel_id (INT),
city_channel_tv_show.tv_show_id (INT),
city_channel_tv_show.is_online (bool),
city_channel_tv_show.is_free (bool),
)
Table radio (
radio.radio_id (INT),
radio.transmitter (TEXT),
radio.radio_mhz (TEXT),
radio.2fm_mhz (TEXT),
radio.rnag_mhz (TEXT),
radio.lyric_fm_mhz (TEXT),
radio.erp_kw (TEXT),
)
Table tv_show (
tv_show.tv_show_id (INT),
tv_show.tv_show_name (TEXT),
tv_show.sub_tittle (TEXT),
tv_show.next_show_name (TEXT),
tv_show.original_airdate (TEXT),
)
Possible JOINs:
city_channel_radio.city_channel_id = city_channel.id
city_channel_radio.radio_id = radio.radio_id
city_channel_tv_show.city_channel_id = city_channel.id
city_channel_tv_show.tv_show_id = tv_show.tv_show_id
| CREATE TABLE city_channel (
city_channel.id (INT),
city_channel.city (TEXT),
city_channel.station_name (TEXT),
city_channel.owned_since (REAL),
city_channel.affiliation (TEXT),
)
CREATE TABLE city_channel_radio (
city_channel_radio.city_channel_id (INT),
city_channel_radio.radio_id (INT),
city_channel_radio.is_online (bool),
)
CREATE TABLE city_channel_tv_show (
city_channel_tv_show.city_channel_id (INT),
city_channel_tv_show.tv_show_id (INT),
city_channel_tv_show.is_online (bool),
city_channel_tv_show.is_free (bool),
)
CREATE TABLE radio (
radio.radio_id (INT),
radio.transmitter (TEXT),
radio.radio_mhz (TEXT),
radio.2fm_mhz (TEXT),
radio.rnag_mhz (TEXT),
radio.lyric_fm_mhz (TEXT),
radio.erp_kw (TEXT),
)
CREATE TABLE tv_show (
tv_show.tv_show_id (INT),
tv_show.tv_show_name (TEXT),
tv_show.sub_tittle (TEXT),
tv_show.next_show_name (TEXT),
tv_show.original_airdate (TEXT),
)
Possible JOINs:
city_channel_radio.city_channel_id = city_channel.id
city_channel_radio.radio_id = radio.radio_id
city_channel_tv_show.city_channel_id = city_channel.id
city_channel_tv_show.tv_show_id = tv_show.tv_show_id
| Table city_channel (
city_channel.id (INT),
city_channel.city (TEXT),
city_channel.station_name (TEXT),
city_channel.owned_since (REAL),
city_channel.affiliation (TEXT),
)
Table city_channel_radio (
city_channel_radio.city_channel_id (INT),
city_channel_radio.radio_id (INT),
city_channel_radio.is_online (bool),
)
Table city_channel_tv_show (
city_channel_tv_show.city_channel_id (INT),
city_channel_tv_show.tv_show_id (INT),
city_channel_tv_show.is_online (bool),
city_channel_tv_show.is_free (bool),
)
Table radio (
radio.radio_id (INT),
radio.transmitter (TEXT),
radio.radio_mhz (TEXT),
radio.2fm_mhz (TEXT),
radio.rnag_mhz (TEXT),
radio.lyric_fm_mhz (TEXT),
radio.erp_kw (TEXT),
)
Table tv_show (
tv_show.tv_show_id (INT),
tv_show.tv_show_name (TEXT),
tv_show.sub_tittle (TEXT),
tv_show.next_show_name (TEXT),
tv_show.original_airdate (TEXT),
)
Possible JOINs:
city_channel_radio.city_channel_id = city_channel.id
city_channel_radio.radio_id = radio.radio_id
city_channel_tv_show.city_channel_id = city_channel.id
city_channel_tv_show.tv_show_id = tv_show.tv_show_id
| CREATE TABLE city_channel (
city_channel.id (INT),
city_channel.city (TEXT),
city_channel.station_name (TEXT),
city_channel.owned_since (REAL),
city_channel.affiliation (TEXT),
)
CREATE TABLE city_channel_radio (
city_channel_radio.city_channel_id (INT),
city_channel_radio.radio_id (INT),
city_channel_radio.is_online (bool),
)
CREATE TABLE city_channel_tv_show (
city_channel_tv_show.city_channel_id (INT),
city_channel_tv_show.tv_show_id (INT),
city_channel_tv_show.is_online (bool),
city_channel_tv_show.is_free (bool),
)
CREATE TABLE radio (
radio.radio_id (INT),
radio.transmitter (TEXT),
radio.radio_mhz (TEXT),
radio.2fm_mhz (TEXT),
radio.rnag_mhz (TEXT),
radio.lyric_fm_mhz (TEXT),
radio.erp_kw (TEXT),
)
CREATE TABLE tv_show (
tv_show.tv_show_id (INT),
tv_show.tv_show_name (TEXT),
tv_show.sub_tittle (TEXT),
tv_show.next_show_name (TEXT),
tv_show.original_airdate (TEXT),
)
Possible JOINs:
city_channel_radio.city_channel_id = city_channel.id
city_channel_radio.radio_id = radio.radio_id
city_channel_tv_show.city_channel_id = city_channel.id
city_channel_tv_show.tv_show_id = tv_show.tv_show_id
| {
'city_channel': ['ID', 'City', 'Station_name', 'Owned_Since', 'Affiliation'],
'radio': ['Radio_ID', 'Transmitter', 'Radio_MHz', '2FM_MHz', 'RnaG_MHz', 'Lyric_FM_MHz', 'ERP_kW'],
'tv_show': ['tv_show_ID', 'tv_show_name', 'Sub_tittle', 'Next_show_name', 'Original_Airdate'],
'city_channel_radio': ['City_channel_ID', 'Radio_ID', 'Is_online'],
'city_channel_tv_show': ['City_channel_ID', 'tv_show_ID', 'Is_online', 'Is_free']
} | {
'city_channel': ['ID', 'City', 'Station_name']
} | TABLE city_channel (
city_channel.ID (INT),
city_channel.City (TEXT),
city_channel.Station_name (TEXT),
city_channel.Owned_Since (REAL),
city_channel.Affiliation (TEXT),
)
TABLE city_channel_radio (
city_channel_radio.City_channel_ID (INT),
city_channel_radio.Radio_ID (INT),
city_channel_radio.Is_online (bool),
)
TABLE city_channel_tv_show (
city_channel_tv_show.City_channel_ID (INT),
city_channel_tv_show.tv_show_ID (INT),
city_channel_tv_show.Is_online (bool),
city_channel_tv_show.Is_free (bool),
)
TABLE radio (
radio.Radio_ID (INT),
radio.Transmitter (TEXT),
radio.Radio_MHz (TEXT),
radio.2FM_MHz (TEXT),
radio.RnaG_MHz (TEXT),
radio.Lyric_FM_MHz (TEXT),
radio.ERP_kW (TEXT),
)
TABLE tv_show (
tv_show.tv_show_ID (INT),
tv_show.tv_show_name (TEXT),
tv_show.Sub_tittle (TEXT),
tv_show.Next_show_name (TEXT),
tv_show.Original_Airdate (TEXT),
)
Possible JOINs:
city_channel_radio.City_channel_ID = city_channel.ID
city_channel_radio.Radio_ID = radio.Radio_ID
city_channel_tv_show.City_channel_ID = city_channel.ID
city_channel_tv_show.tv_show_ID = tv_show.tv_show_ID
| TABLE city_channel (
city_channel.id (INT),
city_channel.city (TEXT),
city_channel.station_name (TEXT),
city_channel.owned_since (REAL),
city_channel.affiliation (TEXT),
)
TABLE city_channel_radio (
city_channel_radio.city_channel_id (INT),
city_channel_radio.radio_id (INT),
city_channel_radio.is_online (bool),
)
TABLE city_channel_tv_show (
city_channel_tv_show.city_channel_id (INT),
city_channel_tv_show.tv_show_id (INT),
city_channel_tv_show.is_online (bool),
city_channel_tv_show.is_free (bool),
)
TABLE radio (
radio.radio_id (INT),
radio.transmitter (TEXT),
radio.radio_mhz (TEXT),
radio.2fm_mhz (TEXT),
radio.rnag_mhz (TEXT),
radio.lyric_fm_mhz (TEXT),
radio.erp_kw (TEXT),
)
TABLE tv_show (
tv_show.tv_show_id (INT),
tv_show.tv_show_name (TEXT),
tv_show.sub_tittle (TEXT),
tv_show.next_show_name (TEXT),
tv_show.original_airdate (TEXT),
)
Possible JOINs:
city_channel_radio.city_channel_id = city_channel.id
city_channel_radio.radio_id = radio.radio_id
city_channel_tv_show.city_channel_id = city_channel.id
city_channel_tv_show.tv_show_id = tv_show.tv_show_id
| TABLE city_channel (
city_channel.id (INT),
city_channel.city (TEXT),
city_channel.station_name (TEXT),
city_channel.owned_since (REAL),
city_channel.affiliation (TEXT),
)
TABLE city_channel_radio (
city_channel_radio.city_channel_id (INT),
city_channel_radio.radio_id (INT),
city_channel_radio.is_online (bool),
)
TABLE city_channel_tv_show (
city_channel_tv_show.city_channel_id (INT),
city_channel_tv_show.tv_show_id (INT),
city_channel_tv_show.is_online (bool),
city_channel_tv_show.is_free (bool),
)
TABLE radio (
radio.radio_id (INT),
radio.transmitter (TEXT),
radio.radio_mhz (TEXT),
radio.2fm_mhz (TEXT),
radio.rnag_mhz (TEXT),
radio.lyric_fm_mhz (TEXT),
radio.erp_kw (TEXT),
)
TABLE tv_show (
tv_show.tv_show_id (INT),
tv_show.tv_show_name (TEXT),
tv_show.sub_tittle (TEXT),
tv_show.next_show_name (TEXT),
tv_show.original_airdate (TEXT),
)
Possible JOINs:
city_channel_radio.city_channel_id = city_channel.id
city_channel_radio.radio_id = radio.radio_id
city_channel_tv_show.city_channel_id = city_channel.id
city_channel_tv_show.tv_show_id = tv_show.tv_show_id
|
bakery_1 |
CREATE TABLE customers (
"Id" INTEGER,
"LastName" TEXT,
"FirstName" TEXT,
PRIMARY KEY ("Id")
)
CREATE TABLE goods (
"Id" TEXT,
"Flavor" TEXT,
"Food" TEXT,
"Price" REAL,
PRIMARY KEY ("Id")
)
CREATE TABLE items (
"Receipt" INTEGER,
"Ordinal" INTEGER,
"Item" TEXT,
PRIMARY KEY ("Receipt", "Ordinal"),
FOREIGN KEY("Item") REFERENCES goods ("Id")
)
CREATE TABLE receipts (
"ReceiptNumber" INTEGER,
"Date" TEXT,
"CustomerId" INTEGER,
PRIMARY KEY ("ReceiptNumber"),
FOREIGN KEY("CustomerId") REFERENCES customers ("Id")
) | How many cusomters visited on each date? | medium | Table customers (
customers.Id (INTEGER),
customers.LastName (TEXT),
customers.FirstName (TEXT),
)
Table goods (
goods.Id (TEXT),
goods.Flavor (TEXT),
goods.Food (TEXT),
goods.Price (REAL),
)
Table items (
items.Receipt (INTEGER),
items.Ordinal (INTEGER),
items.Item (TEXT),
)
Table receipts (
receipts.ReceiptNumber (INTEGER),
receipts.Date (TEXT),
receipts.CustomerId (INTEGER),
)
Possible JOINs:
items.Item = goods.Id
receipts.CustomerId = customers.Id
| SELECT date , COUNT (DISTINCT CustomerId) FROM receipts GROUP BY date | {
'receipts': ['receiptnumber', 'date', 'customerid']
} | CREATE TABLE customers (
customers.Id (INTEGER),
customers.LastName (TEXT),
customers.FirstName (TEXT),
)
CREATE TABLE goods (
goods.Id (TEXT),
goods.Flavor (TEXT),
goods.Food (TEXT),
goods.Price (REAL),
)
CREATE TABLE items (
items.Receipt (INTEGER),
items.Ordinal (INTEGER),
items.Item (TEXT),
)
CREATE TABLE receipts (
receipts.ReceiptNumber (INTEGER),
receipts.Date (TEXT),
receipts.CustomerId (INTEGER),
)
Possible JOINs:
items.Item = goods.Id
receipts.CustomerId = customers.Id
| Table customers (
customers.id (INTEGER),
customers.lastname (TEXT),
customers.firstname (TEXT),
)
Table goods (
goods.id (TEXT),
goods.flavor (TEXT),
goods.food (TEXT),
goods.price (REAL),
)
Table items (
items.receipt (INTEGER),
items.ordinal (INTEGER),
items.item (TEXT),
)
Table receipts (
receipts.receiptnumber (INTEGER),
receipts.date (TEXT),
receipts.customerid (INTEGER),
)
Possible JOINs:
items.item = goods.id
receipts.customerid = customers.id
| CREATE TABLE customers (
customers.id (INTEGER),
customers.lastname (TEXT),
customers.firstname (TEXT),
)
CREATE TABLE goods (
goods.id (TEXT),
goods.flavor (TEXT),
goods.food (TEXT),
goods.price (REAL),
)
CREATE TABLE items (
items.receipt (INTEGER),
items.ordinal (INTEGER),
items.item (TEXT),
)
CREATE TABLE receipts (
receipts.receiptnumber (INTEGER),
receipts.date (TEXT),
receipts.customerid (INTEGER),
)
Possible JOINs:
items.item = goods.id
receipts.customerid = customers.id
| Table customers (
customers.id (INTEGER),
customers.lastname (TEXT),
customers.firstname (TEXT),
)
Table goods (
goods.id (TEXT),
goods.flavor (TEXT),
goods.food (TEXT),
goods.price (REAL),
)
Table items (
items.receipt (INTEGER),
items.ordinal (INTEGER),
items.item (TEXT),
)
Table receipts (
receipts.receiptnumber (INTEGER),
receipts.date (TEXT),
receipts.customerid (INTEGER),
)
Possible JOINs:
items.item = goods.id
receipts.customerid = customers.id
| CREATE TABLE customers (
customers.id (INTEGER),
customers.lastname (TEXT),
customers.firstname (TEXT),
)
CREATE TABLE goods (
goods.id (TEXT),
goods.flavor (TEXT),
goods.food (TEXT),
goods.price (REAL),
)
CREATE TABLE items (
items.receipt (INTEGER),
items.ordinal (INTEGER),
items.item (TEXT),
)
CREATE TABLE receipts (
receipts.receiptnumber (INTEGER),
receipts.date (TEXT),
receipts.customerid (INTEGER),
)
Possible JOINs:
items.item = goods.id
receipts.customerid = customers.id
| {
'customers': ['Id', 'LastName', 'FirstName'],
'goods': ['Id', 'Flavor', 'Food', 'Price'],
'items': ['Receipt', 'Ordinal', 'Item'],
'receipts': ['ReceiptNumber', 'Date', 'CustomerId']
} | {
'receipts': ['ReceiptNumber', 'Date', 'CustomerId']
} | TABLE customers (
customers.Id (INTEGER),
customers.LastName (TEXT),
customers.FirstName (TEXT),
)
TABLE goods (
goods.Id (TEXT),
goods.Flavor (TEXT),
goods.Food (TEXT),
goods.Price (REAL),
)
TABLE items (
items.Receipt (INTEGER),
items.Ordinal (INTEGER),
items.Item (TEXT),
)
TABLE receipts (
receipts.ReceiptNumber (INTEGER),
receipts.Date (TEXT),
receipts.CustomerId (INTEGER),
)
Possible JOINs:
items.Item = goods.Id
receipts.CustomerId = customers.Id
| TABLE customers (
customers.id (INTEGER),
customers.lastname (TEXT),
customers.firstname (TEXT),
)
TABLE goods (
goods.id (TEXT),
goods.flavor (TEXT),
goods.food (TEXT),
goods.price (REAL),
)
TABLE items (
items.receipt (INTEGER),
items.ordinal (INTEGER),
items.item (TEXT),
)
TABLE receipts (
receipts.receiptnumber (INTEGER),
receipts.date (TEXT),
receipts.customerid (INTEGER),
)
Possible JOINs:
items.item = goods.id
receipts.customerid = customers.id
| TABLE customers (
customers.id (INTEGER),
customers.lastname (TEXT),
customers.firstname (TEXT),
)
TABLE goods (
goods.id (TEXT),
goods.flavor (TEXT),
goods.food (TEXT),
goods.price (REAL),
)
TABLE items (
items.receipt (INTEGER),
items.ordinal (INTEGER),
items.item (TEXT),
)
TABLE receipts (
receipts.receiptnumber (INTEGER),
receipts.date (TEXT),
receipts.customerid (INTEGER),
)
Possible JOINs:
items.item = goods.id
receipts.customerid = customers.id
|
art_1 |
CREATE TABLE "Artists" (
"artistID" INTEGER,
lname TEXT,
fname TEXT,
"birthYear" INTEGER,
"deathYear" INTEGER,
PRIMARY KEY ("artistID")
)
CREATE TABLE "Paintings" (
"paintingID" INTEGER,
title TEXT,
year INTEGER,
height_mm INTEGER,
width_mm INTEGER,
medium TEXT,
"mediumOn" TEXT,
location TEXT,
"painterID" INTEGER,
PRIMARY KEY ("paintingID"),
FOREIGN KEY("painterID") REFERENCES "Artists" ("artistID")
)
CREATE TABLE "Sculptures" (
"sculptureID" INTEGER,
title TEXT,
year INTEGER,
medium TEXT,
location TEXT,
"sculptorID" INTEGER,
PRIMARY KEY ("sculptureID"),
FOREIGN KEY("sculptorID") REFERENCES "Artists" ("artistID")
) | List the title and location of all paintings. | medium | Table Artists (
Artists.artistID (INTEGER),
Artists.lname (TEXT),
Artists.fname (TEXT),
Artists.birthYear (INTEGER),
Artists.deathYear (INTEGER),
)
Table Paintings (
Paintings.paintingID (INTEGER),
Paintings.title (TEXT),
Paintings.year (INTEGER),
Paintings.height_mm (INTEGER),
Paintings.width_mm (INTEGER),
Paintings.medium (TEXT),
Paintings.mediumOn (TEXT),
Paintings.location (TEXT),
Paintings.painterID (INTEGER),
)
Table Sculptures (
Sculptures.sculptureID (INTEGER),
Sculptures.title (TEXT),
Sculptures.year (INTEGER),
Sculptures.medium (TEXT),
Sculptures.location (TEXT),
Sculptures.sculptorID (INTEGER),
)
Possible JOINs:
Paintings.painterID = Artists.artistID
Sculptures.sculptorID = Artists.artistID
| SELECT title , LOCATION FROM paintings | {
'paintings': ['paintingid', 'title', 'location']
} | CREATE TABLE Artists (
Artists.artistID (INTEGER),
Artists.lname (TEXT),
Artists.fname (TEXT),
Artists.birthYear (INTEGER),
Artists.deathYear (INTEGER),
)
CREATE TABLE Paintings (
Paintings.paintingID (INTEGER),
Paintings.title (TEXT),
Paintings.year (INTEGER),
Paintings.height_mm (INTEGER),
Paintings.width_mm (INTEGER),
Paintings.medium (TEXT),
Paintings.mediumOn (TEXT),
Paintings.location (TEXT),
Paintings.painterID (INTEGER),
)
CREATE TABLE Sculptures (
Sculptures.sculptureID (INTEGER),
Sculptures.title (TEXT),
Sculptures.year (INTEGER),
Sculptures.medium (TEXT),
Sculptures.location (TEXT),
Sculptures.sculptorID (INTEGER),
)
Possible JOINs:
Paintings.painterID = Artists.artistID
Sculptures.sculptorID = Artists.artistID
| Table Artists (
Artists.artistid (INTEGER),
Artists.lname (TEXT),
Artists.fname (TEXT),
Artists.birthyear (INTEGER),
Artists.deathyear (INTEGER),
)
Table Paintings (
Paintings.paintingid (INTEGER),
Paintings.title (TEXT),
Paintings.year (INTEGER),
Paintings.height_mm (INTEGER),
Paintings.width_mm (INTEGER),
Paintings.medium (TEXT),
Paintings.mediumon (TEXT),
Paintings.location (TEXT),
Paintings.painterid (INTEGER),
)
Table Sculptures (
Sculptures.sculptureid (INTEGER),
Sculptures.title (TEXT),
Sculptures.year (INTEGER),
Sculptures.medium (TEXT),
Sculptures.location (TEXT),
Sculptures.sculptorid (INTEGER),
)
Possible JOINs:
Paintings.painterid = Artists.artistid
Sculptures.sculptorid = Artists.artistid
| CREATE TABLE Artists (
Artists.artistid (INTEGER),
Artists.lname (TEXT),
Artists.fname (TEXT),
Artists.birthyear (INTEGER),
Artists.deathyear (INTEGER),
)
CREATE TABLE Paintings (
Paintings.paintingid (INTEGER),
Paintings.title (TEXT),
Paintings.year (INTEGER),
Paintings.height_mm (INTEGER),
Paintings.width_mm (INTEGER),
Paintings.medium (TEXT),
Paintings.mediumon (TEXT),
Paintings.location (TEXT),
Paintings.painterid (INTEGER),
)
CREATE TABLE Sculptures (
Sculptures.sculptureid (INTEGER),
Sculptures.title (TEXT),
Sculptures.year (INTEGER),
Sculptures.medium (TEXT),
Sculptures.location (TEXT),
Sculptures.sculptorid (INTEGER),
)
Possible JOINs:
Paintings.painterid = Artists.artistid
Sculptures.sculptorid = Artists.artistid
| Table artists (
artists.artistid (INTEGER),
artists.lname (TEXT),
artists.fname (TEXT),
artists.birthyear (INTEGER),
artists.deathyear (INTEGER),
)
Table paintings (
paintings.paintingid (INTEGER),
paintings.title (TEXT),
paintings.year (INTEGER),
paintings.height_mm (INTEGER),
paintings.width_mm (INTEGER),
paintings.medium (TEXT),
paintings.mediumon (TEXT),
paintings.location (TEXT),
paintings.painterid (INTEGER),
)
Table sculptures (
sculptures.sculptureid (INTEGER),
sculptures.title (TEXT),
sculptures.year (INTEGER),
sculptures.medium (TEXT),
sculptures.location (TEXT),
sculptures.sculptorid (INTEGER),
)
Possible JOINs:
paintings.painterid = artists.artistid
sculptures.sculptorid = artists.artistid
| CREATE TABLE artists (
artists.artistid (INTEGER),
artists.lname (TEXT),
artists.fname (TEXT),
artists.birthyear (INTEGER),
artists.deathyear (INTEGER),
)
CREATE TABLE paintings (
paintings.paintingid (INTEGER),
paintings.title (TEXT),
paintings.year (INTEGER),
paintings.height_mm (INTEGER),
paintings.width_mm (INTEGER),
paintings.medium (TEXT),
paintings.mediumon (TEXT),
paintings.location (TEXT),
paintings.painterid (INTEGER),
)
CREATE TABLE sculptures (
sculptures.sculptureid (INTEGER),
sculptures.title (TEXT),
sculptures.year (INTEGER),
sculptures.medium (TEXT),
sculptures.location (TEXT),
sculptures.sculptorid (INTEGER),
)
Possible JOINs:
paintings.painterid = artists.artistid
sculptures.sculptorid = artists.artistid
| {
'Artists': ['artistID', 'lname', 'fname', 'birthYear', 'deathYear'],
'Paintings': ['paintingID', 'title', 'year', 'height_mm', 'width_mm', 'medium', 'mediumOn', 'location', 'painterID'],
'Sculptures': ['sculptureID', 'title', 'year', 'medium', 'location', 'sculptorID']
} | {
'Paintings': ['paintingID', 'title', 'location']
} | TABLE Artists (
Artists.artistID (INTEGER),
Artists.lname (TEXT),
Artists.fname (TEXT),
Artists.birthYear (INTEGER),
Artists.deathYear (INTEGER),
)
TABLE Paintings (
Paintings.paintingID (INTEGER),
Paintings.title (TEXT),
Paintings.year (INTEGER),
Paintings.height_mm (INTEGER),
Paintings.width_mm (INTEGER),
Paintings.medium (TEXT),
Paintings.mediumOn (TEXT),
Paintings.location (TEXT),
Paintings.painterID (INTEGER),
)
TABLE Sculptures (
Sculptures.sculptureID (INTEGER),
Sculptures.title (TEXT),
Sculptures.year (INTEGER),
Sculptures.medium (TEXT),
Sculptures.location (TEXT),
Sculptures.sculptorID (INTEGER),
)
Possible JOINs:
Paintings.painterID = Artists.artistID
Sculptures.sculptorID = Artists.artistID
| TABLE Artists (
Artists.artistid (INTEGER),
Artists.lname (TEXT),
Artists.fname (TEXT),
Artists.birthyear (INTEGER),
Artists.deathyear (INTEGER),
)
TABLE Paintings (
Paintings.paintingid (INTEGER),
Paintings.title (TEXT),
Paintings.year (INTEGER),
Paintings.height_mm (INTEGER),
Paintings.width_mm (INTEGER),
Paintings.medium (TEXT),
Paintings.mediumon (TEXT),
Paintings.location (TEXT),
Paintings.painterid (INTEGER),
)
TABLE Sculptures (
Sculptures.sculptureid (INTEGER),
Sculptures.title (TEXT),
Sculptures.year (INTEGER),
Sculptures.medium (TEXT),
Sculptures.location (TEXT),
Sculptures.sculptorid (INTEGER),
)
Possible JOINs:
Paintings.painterid = Artists.artistid
Sculptures.sculptorid = Artists.artistid
| TABLE artists (
artists.artistid (INTEGER),
artists.lname (TEXT),
artists.fname (TEXT),
artists.birthyear (INTEGER),
artists.deathyear (INTEGER),
)
TABLE paintings (
paintings.paintingid (INTEGER),
paintings.title (TEXT),
paintings.year (INTEGER),
paintings.height_mm (INTEGER),
paintings.width_mm (INTEGER),
paintings.medium (TEXT),
paintings.mediumon (TEXT),
paintings.location (TEXT),
paintings.painterid (INTEGER),
)
TABLE sculptures (
sculptures.sculptureid (INTEGER),
sculptures.title (TEXT),
sculptures.year (INTEGER),
sculptures.medium (TEXT),
sculptures.location (TEXT),
sculptures.sculptorid (INTEGER),
)
Possible JOINs:
paintings.painterid = artists.artistid
sculptures.sculptorid = artists.artistid
|
cre_Students_Information_Systems |
CREATE TABLE Students (
`student_id` INTEGER NOT NULL,
`bio_data` VARCHAR(255) NOT NULL,
`student_details` VARCHAR(255) NOT NULL,
PRIMARY KEY (`student_id`)
)
/*
0 rows from Students table:
student_id bio_data student_details
*/
CREATE TABLE Transcripts (
`transcript_id` INTEGER NOT NULL,
`student_id` INTEGER NOT NULL,
`date_of_transcript` DATETIME(3),
`transcript_details` VARCHAR(255) NOT NULL,
PRIMARY KEY (`transcript_id`),
FOREIGN KEY (student_id) REFERENCES Students (student_id)
)
/*
0 rows from Transcripts table:
transcript_id student_id date_of_transcript transcript_details
*/
CREATE TABLE Behaviour_Monitoring (
`behaviour_monitoring_id` INTEGER NOT NULL,
`student_id` INTEGER NOT NULL,
`behaviour_monitoring_details` VARCHAR(255) NOT NULL,
PRIMARY KEY (`behaviour_monitoring_id`),
FOREIGN KEY (student_id) REFERENCES Students (student_id)
)
/*
0 rows from Behaviour_Monitoring table:
behaviour_monitoring_id student_id behaviour_monitoring_details
*/
CREATE TABLE Addresses (
`address_id` INTEGER NOT NULL,
`address_details` VARCHAR(255) NOT NULL,
PRIMARY KEY (`address_id`)
)
/*
0 rows from Addresses table:
address_id address_details
*/
CREATE TABLE Ref_Event_Types (
`event_type_code` CHAR(10) NOT NULL,
`event_type_description` VARCHAR(255) NOT NULL,
PRIMARY KEY (`event_type_code`)
)
/*
0 rows from Ref_Event_Types table:
event_type_code event_type_description
*/
CREATE TABLE Ref_Achievement_Type (
`achievement_type_code` CHAR(15) NOT NULL,
`achievement_type_description` VARCHAR(80),
PRIMARY KEY (`achievement_type_code`)
)
/*
0 rows from Ref_Achievement_Type table:
achievement_type_code achievement_type_description
*/
CREATE TABLE Ref_Address_Types (
`address_type_code` CHAR(10) NOT NULL,
`address_type_description` VARCHAR(255) NOT NULL,
PRIMARY KEY (`address_type_code`)
)
/*
0 rows from Ref_Address_Types table:
address_type_code address_type_description
*/
CREATE TABLE Ref_Detention_Type (
`detention_type_code` CHAR(10) NOT NULL,
`detention_type_description` VARCHAR(80),
PRIMARY KEY (`detention_type_code`)
)
/*
0 rows from Ref_Detention_Type table:
detention_type_code detention_type_description
*/
CREATE TABLE Student_Events (
`event_id` INTEGER NOT NULL,
`event_type_code` CHAR(10) NOT NULL,
`student_id` INTEGER NOT NULL,
`event_date` DATETIME(3),
`other_details` VARCHAR(255) NOT NULL,
PRIMARY KEY (`event_id`),
FOREIGN KEY (student_id) REFERENCES Students (student_id),
FOREIGN KEY (event_type_code) REFERENCES Ref_Event_Types (event_type_code)
)
/*
0 rows from Student_Events table:
event_id event_type_code student_id event_date other_details
*/
CREATE TABLE Teachers (
`teacher_id` INTEGER NOT NULL,
`teacher_details` VARCHAR(255),
PRIMARY KEY (`teacher_id`)
)
/*
0 rows from Teachers table:
teacher_id teacher_details
*/
CREATE TABLE Student_Loans (
`student_loan_id` INTEGER NOT NULL,
`student_id` INTEGER NOT NULL,
`date_of_loan` DATETIME(3),
`amount_of_loan` DECIMAL(15,4),
`other_details` VARCHAR(255),
PRIMARY KEY (`student_loan_id`),
FOREIGN KEY (student_id) REFERENCES Students (student_id)
)
/*
0 rows from Student_Loans table:
student_loan_id student_id date_of_loan amount_of_loan other_details
*/
CREATE TABLE Classes (
`class_id` INTEGER NOT NULL,
`student_id` INTEGER NOT NULL,
`teacher_id` INTEGER NOT NULL,
`class_details` VARCHAR(255) NOT NULL,
PRIMARY KEY (`class_id`),
FOREIGN KEY (student_id) REFERENCES Students (student_id),
FOREIGN KEY (teacher_id) REFERENCES Teachers (teacher_id)
)
/*
0 rows from Classes table:
class_id student_id teacher_id class_details
*/
CREATE TABLE Students_Addresses (
`student_address_id` INTEGER NOT NULL,
`address_id` INTEGER NOT NULL,
`address_type_code` CHAR(10) NOT NULL,
`student_id` INTEGER NOT NULL,
`date_from` DATETIME(3),
`date_to` DATETIME(3),
PRIMARY KEY (`student_address_id`),
FOREIGN KEY (student_id) REFERENCES Students (student_id),
FOREIGN KEY (address_id) REFERENCES Addresses (address_id),
FOREIGN KEY (address_type_code) REFERENCES Ref_Address_Types (address_type_code)
)
/*
0 rows from Students_Addresses table:
student_address_id address_id address_type_code student_id date_from date_to
*/
CREATE TABLE Detention (
`detention_id` INTEGER NOT NULL,
`detention_type_code` CHAR(10) NOT NULL,
`student_id` INTEGER NOT NULL,
`datetime_detention_start` DATETIME(3),
`datetime_detention_end` DATETIME(3),
`detention_summary` VARCHAR(255),
`other_details` VARCHAR(255),
PRIMARY KEY (`detention_id`),
FOREIGN KEY (student_id) REFERENCES Students (student_id),
FOREIGN KEY (detention_type_code) REFERENCES Ref_Detention_Type (detention_type_code)
)
/*
0 rows from Detention table:
detention_id detention_type_code student_id datetime_detention_start datetime_detention_end detention_summary other_details
*/
CREATE TABLE Achievements (
`achievement_id` INTEGER NOT NULL,
`achievement_type_code` CHAR(15) NOT NULL,
`student_id` INTEGER NOT NULL,
`date_achievement` DATETIME(3),
`achievement_details` VARCHAR(255),
`other_details` VARCHAR(255),
PRIMARY KEY (`achievement_id`),
FOREIGN KEY (student_id) REFERENCES Students (student_id),
FOREIGN KEY (achievement_type_code) REFERENCES Ref_Achievement_Type (achievement_type_code)
)
/*
0 rows from Achievements table:
achievement_id achievement_type_code student_id date_achievement achievement_details other_details
*/
| What is the transcript issuance date for the student with the largest amount of loan? | hard | Table Achievements (
Achievements.achievement_id (INTEGER),
Achievements.achievement_type_code (CHAR(15)),
Achievements.student_id (INTEGER),
Achievements.date_achievement (DATETIME(3)),
Achievements.achievement_details (VARCHAR(255)),
Achievements.other_details (VARCHAR(255)),
)
Table Addresses (
Addresses.address_id (INTEGER),
Addresses.address_details (VARCHAR(255)),
)
Table Behaviour_Monitoring (
Behaviour_Monitoring.behaviour_monitoring_id (INTEGER),
Behaviour_Monitoring.student_id (INTEGER),
Behaviour_Monitoring.behaviour_monitoring_details (VARCHAR(255)),
)
Table Classes (
Classes.class_id (INTEGER),
Classes.student_id (INTEGER),
Classes.teacher_id (INTEGER),
Classes.class_details (VARCHAR(255)),
)
Table Detention (
Detention.detention_id (INTEGER),
Detention.detention_type_code (CHAR(10)),
Detention.student_id (INTEGER),
Detention.datetime_detention_start (DATETIME(3)),
Detention.datetime_detention_end (DATETIME(3)),
Detention.detention_summary (VARCHAR(255)),
Detention.other_details (VARCHAR(255)),
)
Table Ref_Achievement_Type (
Ref_Achievement_Type.achievement_type_code (CHAR(15)),
Ref_Achievement_Type.achievement_type_description (VARCHAR(80)),
)
Table Ref_Address_Types (
Ref_Address_Types.address_type_code (CHAR(10)),
Ref_Address_Types.address_type_description (VARCHAR(255)),
)
Table Ref_Detention_Type (
Ref_Detention_Type.detention_type_code (CHAR(10)),
Ref_Detention_Type.detention_type_description (VARCHAR(80)),
)
Table Ref_Event_Types (
Ref_Event_Types.event_type_code (CHAR(10)),
Ref_Event_Types.event_type_description (VARCHAR(255)),
)
Table Student_Events (
Student_Events.event_id (INTEGER),
Student_Events.event_type_code (CHAR(10)),
Student_Events.student_id (INTEGER),
Student_Events.event_date (DATETIME(3)),
Student_Events.other_details (VARCHAR(255)),
)
Table Student_Loans (
Student_Loans.student_loan_id (INTEGER),
Student_Loans.student_id (INTEGER),
Student_Loans.date_of_loan (DATETIME(3)),
Student_Loans.amount_of_loan (DECIMAL(15,4)),
Student_Loans.other_details (VARCHAR(255)),
)
Table Students (
Students.student_id (INTEGER),
Students.bio_data (VARCHAR(255)),
Students.student_details (VARCHAR(255)),
)
Table Students_Addresses (
Students_Addresses.student_address_id (INTEGER),
Students_Addresses.address_id (INTEGER),
Students_Addresses.address_type_code (CHAR(10)),
Students_Addresses.student_id (INTEGER),
Students_Addresses.date_from (DATETIME(3)),
Students_Addresses.date_to (DATETIME(3)),
)
Table Teachers (
Teachers.teacher_id (INTEGER),
Teachers.teacher_details (VARCHAR(255)),
)
Table Transcripts (
Transcripts.transcript_id (INTEGER),
Transcripts.student_id (INTEGER),
Transcripts.date_of_transcript (DATETIME(3)),
Transcripts.transcript_details (VARCHAR(255)),
)
Possible JOINs:
Achievements.achievement_type_code = Ref_Achievement_Type.achievement_type_code
Achievements.student_id = Students.student_id
Behaviour_Monitoring.student_id = Students.student_id
Classes.student_id = Students.student_id
Classes.teacher_id = Teachers.teacher_id
Detention.detention_type_code = Ref_Detention_Type.detention_type_code
Detention.student_id = Students.student_id
Student_Events.event_type_code = Ref_Event_Types.event_type_code
Student_Events.student_id = Students.student_id
Student_Loans.student_id = Students.student_id
Students_Addresses.address_id = Addresses.address_id
Students_Addresses.address_type_code = Ref_Address_Types.address_type_code
Students_Addresses.student_id = Students.student_id
Transcripts.student_id = Students.student_id
| SELECT Transcripts.date_of_transcript FROM Transcripts JOIN Student_Loans ON Transcripts.student_id = Student_Loans.student_id ORDER BY Student_Loans.amount_of_loan DESC LIMIT 1 | {
'transcripts': ['transcript_id', 'student_id', 'date_of_transcript'],
'student_loans': ['student_loan_id', 'student_id', 'amount_of_loan']
} | CREATE TABLE Achievements (
Achievements.achievement_id (INTEGER),
Achievements.achievement_type_code (CHAR(15)),
Achievements.student_id (INTEGER),
Achievements.date_achievement (DATETIME(3)),
Achievements.achievement_details (VARCHAR(255)),
Achievements.other_details (VARCHAR(255)),
)
CREATE TABLE Addresses (
Addresses.address_id (INTEGER),
Addresses.address_details (VARCHAR(255)),
)
CREATE TABLE Behaviour_Monitoring (
Behaviour_Monitoring.behaviour_monitoring_id (INTEGER),
Behaviour_Monitoring.student_id (INTEGER),
Behaviour_Monitoring.behaviour_monitoring_details (VARCHAR(255)),
)
CREATE TABLE Classes (
Classes.class_id (INTEGER),
Classes.student_id (INTEGER),
Classes.teacher_id (INTEGER),
Classes.class_details (VARCHAR(255)),
)
CREATE TABLE Detention (
Detention.detention_id (INTEGER),
Detention.detention_type_code (CHAR(10)),
Detention.student_id (INTEGER),
Detention.datetime_detention_start (DATETIME(3)),
Detention.datetime_detention_end (DATETIME(3)),
Detention.detention_summary (VARCHAR(255)),
Detention.other_details (VARCHAR(255)),
)
CREATE TABLE Ref_Achievement_Type (
Ref_Achievement_Type.achievement_type_code (CHAR(15)),
Ref_Achievement_Type.achievement_type_description (VARCHAR(80)),
)
CREATE TABLE Ref_Address_Types (
Ref_Address_Types.address_type_code (CHAR(10)),
Ref_Address_Types.address_type_description (VARCHAR(255)),
)
CREATE TABLE Ref_Detention_Type (
Ref_Detention_Type.detention_type_code (CHAR(10)),
Ref_Detention_Type.detention_type_description (VARCHAR(80)),
)
CREATE TABLE Ref_Event_Types (
Ref_Event_Types.event_type_code (CHAR(10)),
Ref_Event_Types.event_type_description (VARCHAR(255)),
)
CREATE TABLE Student_Events (
Student_Events.event_id (INTEGER),
Student_Events.event_type_code (CHAR(10)),
Student_Events.student_id (INTEGER),
Student_Events.event_date (DATETIME(3)),
Student_Events.other_details (VARCHAR(255)),
)
CREATE TABLE Student_Loans (
Student_Loans.student_loan_id (INTEGER),
Student_Loans.student_id (INTEGER),
Student_Loans.date_of_loan (DATETIME(3)),
Student_Loans.amount_of_loan (DECIMAL(15,4)),
Student_Loans.other_details (VARCHAR(255)),
)
CREATE TABLE Students (
Students.student_id (INTEGER),
Students.bio_data (VARCHAR(255)),
Students.student_details (VARCHAR(255)),
)
CREATE TABLE Students_Addresses (
Students_Addresses.student_address_id (INTEGER),
Students_Addresses.address_id (INTEGER),
Students_Addresses.address_type_code (CHAR(10)),
Students_Addresses.student_id (INTEGER),
Students_Addresses.date_from (DATETIME(3)),
Students_Addresses.date_to (DATETIME(3)),
)
CREATE TABLE Teachers (
Teachers.teacher_id (INTEGER),
Teachers.teacher_details (VARCHAR(255)),
)
CREATE TABLE Transcripts (
Transcripts.transcript_id (INTEGER),
Transcripts.student_id (INTEGER),
Transcripts.date_of_transcript (DATETIME(3)),
Transcripts.transcript_details (VARCHAR(255)),
)
Possible JOINs:
Achievements.achievement_type_code = Ref_Achievement_Type.achievement_type_code
Achievements.student_id = Students.student_id
Behaviour_Monitoring.student_id = Students.student_id
Classes.student_id = Students.student_id
Classes.teacher_id = Teachers.teacher_id
Detention.detention_type_code = Ref_Detention_Type.detention_type_code
Detention.student_id = Students.student_id
Student_Events.event_type_code = Ref_Event_Types.event_type_code
Student_Events.student_id = Students.student_id
Student_Loans.student_id = Students.student_id
Students_Addresses.address_id = Addresses.address_id
Students_Addresses.address_type_code = Ref_Address_Types.address_type_code
Students_Addresses.student_id = Students.student_id
Transcripts.student_id = Students.student_id
| Table Achievements (
Achievements.achievement_id (INTEGER),
Achievements.achievement_type_code (CHAR(15)),
Achievements.student_id (INTEGER),
Achievements.date_achievement (DATETIME(3)),
Achievements.achievement_details (VARCHAR(255)),
Achievements.other_details (VARCHAR(255)),
)
Table Addresses (
Addresses.address_id (INTEGER),
Addresses.address_details (VARCHAR(255)),
)
Table Behaviour_Monitoring (
Behaviour_Monitoring.behaviour_monitoring_id (INTEGER),
Behaviour_Monitoring.student_id (INTEGER),
Behaviour_Monitoring.behaviour_monitoring_details (VARCHAR(255)),
)
Table Classes (
Classes.class_id (INTEGER),
Classes.student_id (INTEGER),
Classes.teacher_id (INTEGER),
Classes.class_details (VARCHAR(255)),
)
Table Detention (
Detention.detention_id (INTEGER),
Detention.detention_type_code (CHAR(10)),
Detention.student_id (INTEGER),
Detention.datetime_detention_start (DATETIME(3)),
Detention.datetime_detention_end (DATETIME(3)),
Detention.detention_summary (VARCHAR(255)),
Detention.other_details (VARCHAR(255)),
)
Table Ref_Achievement_Type (
Ref_Achievement_Type.achievement_type_code (CHAR(15)),
Ref_Achievement_Type.achievement_type_description (VARCHAR(80)),
)
Table Ref_Address_Types (
Ref_Address_Types.address_type_code (CHAR(10)),
Ref_Address_Types.address_type_description (VARCHAR(255)),
)
Table Ref_Detention_Type (
Ref_Detention_Type.detention_type_code (CHAR(10)),
Ref_Detention_Type.detention_type_description (VARCHAR(80)),
)
Table Ref_Event_Types (
Ref_Event_Types.event_type_code (CHAR(10)),
Ref_Event_Types.event_type_description (VARCHAR(255)),
)
Table Student_Events (
Student_Events.event_id (INTEGER),
Student_Events.event_type_code (CHAR(10)),
Student_Events.student_id (INTEGER),
Student_Events.event_date (DATETIME(3)),
Student_Events.other_details (VARCHAR(255)),
)
Table Student_Loans (
Student_Loans.student_loan_id (INTEGER),
Student_Loans.student_id (INTEGER),
Student_Loans.date_of_loan (DATETIME(3)),
Student_Loans.amount_of_loan (DECIMAL(15,4)),
Student_Loans.other_details (VARCHAR(255)),
)
Table Students (
Students.student_id (INTEGER),
Students.bio_data (VARCHAR(255)),
Students.student_details (VARCHAR(255)),
)
Table Students_Addresses (
Students_Addresses.student_address_id (INTEGER),
Students_Addresses.address_id (INTEGER),
Students_Addresses.address_type_code (CHAR(10)),
Students_Addresses.student_id (INTEGER),
Students_Addresses.date_from (DATETIME(3)),
Students_Addresses.date_to (DATETIME(3)),
)
Table Teachers (
Teachers.teacher_id (INTEGER),
Teachers.teacher_details (VARCHAR(255)),
)
Table Transcripts (
Transcripts.transcript_id (INTEGER),
Transcripts.student_id (INTEGER),
Transcripts.date_of_transcript (DATETIME(3)),
Transcripts.transcript_details (VARCHAR(255)),
)
Possible JOINs:
Achievements.achievement_type_code = Ref_Achievement_Type.achievement_type_code
Achievements.student_id = Students.student_id
Behaviour_Monitoring.student_id = Students.student_id
Classes.student_id = Students.student_id
Classes.teacher_id = Teachers.teacher_id
Detention.detention_type_code = Ref_Detention_Type.detention_type_code
Detention.student_id = Students.student_id
Student_Events.event_type_code = Ref_Event_Types.event_type_code
Student_Events.student_id = Students.student_id
Student_Loans.student_id = Students.student_id
Students_Addresses.address_id = Addresses.address_id
Students_Addresses.address_type_code = Ref_Address_Types.address_type_code
Students_Addresses.student_id = Students.student_id
Transcripts.student_id = Students.student_id
| CREATE TABLE Achievements (
Achievements.achievement_id (INTEGER),
Achievements.achievement_type_code (CHAR(15)),
Achievements.student_id (INTEGER),
Achievements.date_achievement (DATETIME(3)),
Achievements.achievement_details (VARCHAR(255)),
Achievements.other_details (VARCHAR(255)),
)
CREATE TABLE Addresses (
Addresses.address_id (INTEGER),
Addresses.address_details (VARCHAR(255)),
)
CREATE TABLE Behaviour_Monitoring (
Behaviour_Monitoring.behaviour_monitoring_id (INTEGER),
Behaviour_Monitoring.student_id (INTEGER),
Behaviour_Monitoring.behaviour_monitoring_details (VARCHAR(255)),
)
CREATE TABLE Classes (
Classes.class_id (INTEGER),
Classes.student_id (INTEGER),
Classes.teacher_id (INTEGER),
Classes.class_details (VARCHAR(255)),
)
CREATE TABLE Detention (
Detention.detention_id (INTEGER),
Detention.detention_type_code (CHAR(10)),
Detention.student_id (INTEGER),
Detention.datetime_detention_start (DATETIME(3)),
Detention.datetime_detention_end (DATETIME(3)),
Detention.detention_summary (VARCHAR(255)),
Detention.other_details (VARCHAR(255)),
)
CREATE TABLE Ref_Achievement_Type (
Ref_Achievement_Type.achievement_type_code (CHAR(15)),
Ref_Achievement_Type.achievement_type_description (VARCHAR(80)),
)
CREATE TABLE Ref_Address_Types (
Ref_Address_Types.address_type_code (CHAR(10)),
Ref_Address_Types.address_type_description (VARCHAR(255)),
)
CREATE TABLE Ref_Detention_Type (
Ref_Detention_Type.detention_type_code (CHAR(10)),
Ref_Detention_Type.detention_type_description (VARCHAR(80)),
)
CREATE TABLE Ref_Event_Types (
Ref_Event_Types.event_type_code (CHAR(10)),
Ref_Event_Types.event_type_description (VARCHAR(255)),
)
CREATE TABLE Student_Events (
Student_Events.event_id (INTEGER),
Student_Events.event_type_code (CHAR(10)),
Student_Events.student_id (INTEGER),
Student_Events.event_date (DATETIME(3)),
Student_Events.other_details (VARCHAR(255)),
)
CREATE TABLE Student_Loans (
Student_Loans.student_loan_id (INTEGER),
Student_Loans.student_id (INTEGER),
Student_Loans.date_of_loan (DATETIME(3)),
Student_Loans.amount_of_loan (DECIMAL(15,4)),
Student_Loans.other_details (VARCHAR(255)),
)
CREATE TABLE Students (
Students.student_id (INTEGER),
Students.bio_data (VARCHAR(255)),
Students.student_details (VARCHAR(255)),
)
CREATE TABLE Students_Addresses (
Students_Addresses.student_address_id (INTEGER),
Students_Addresses.address_id (INTEGER),
Students_Addresses.address_type_code (CHAR(10)),
Students_Addresses.student_id (INTEGER),
Students_Addresses.date_from (DATETIME(3)),
Students_Addresses.date_to (DATETIME(3)),
)
CREATE TABLE Teachers (
Teachers.teacher_id (INTEGER),
Teachers.teacher_details (VARCHAR(255)),
)
CREATE TABLE Transcripts (
Transcripts.transcript_id (INTEGER),
Transcripts.student_id (INTEGER),
Transcripts.date_of_transcript (DATETIME(3)),
Transcripts.transcript_details (VARCHAR(255)),
)
Possible JOINs:
Achievements.achievement_type_code = Ref_Achievement_Type.achievement_type_code
Achievements.student_id = Students.student_id
Behaviour_Monitoring.student_id = Students.student_id
Classes.student_id = Students.student_id
Classes.teacher_id = Teachers.teacher_id
Detention.detention_type_code = Ref_Detention_Type.detention_type_code
Detention.student_id = Students.student_id
Student_Events.event_type_code = Ref_Event_Types.event_type_code
Student_Events.student_id = Students.student_id
Student_Loans.student_id = Students.student_id
Students_Addresses.address_id = Addresses.address_id
Students_Addresses.address_type_code = Ref_Address_Types.address_type_code
Students_Addresses.student_id = Students.student_id
Transcripts.student_id = Students.student_id
| Table achievements (
achievements.achievement_id (INTEGER),
achievements.achievement_type_code (CHAR(15)),
achievements.student_id (INTEGER),
achievements.date_achievement (DATETIME(3)),
achievements.achievement_details (VARCHAR(255)),
achievements.other_details (VARCHAR(255)),
)
Table addresses (
addresses.address_id (INTEGER),
addresses.address_details (VARCHAR(255)),
)
Table behaviour_monitoring (
behaviour_monitoring.behaviour_monitoring_id (INTEGER),
behaviour_monitoring.student_id (INTEGER),
behaviour_monitoring.behaviour_monitoring_details (VARCHAR(255)),
)
Table classes (
classes.class_id (INTEGER),
classes.student_id (INTEGER),
classes.teacher_id (INTEGER),
classes.class_details (VARCHAR(255)),
)
Table detention (
detention.detention_id (INTEGER),
detention.detention_type_code (CHAR(10)),
detention.student_id (INTEGER),
detention.datetime_detention_start (DATETIME(3)),
detention.datetime_detention_end (DATETIME(3)),
detention.detention_summary (VARCHAR(255)),
detention.other_details (VARCHAR(255)),
)
Table ref_achievement_type (
ref_achievement_type.achievement_type_code (CHAR(15)),
ref_achievement_type.achievement_type_description (VARCHAR(80)),
)
Table ref_address_types (
ref_address_types.address_type_code (CHAR(10)),
ref_address_types.address_type_description (VARCHAR(255)),
)
Table ref_detention_type (
ref_detention_type.detention_type_code (CHAR(10)),
ref_detention_type.detention_type_description (VARCHAR(80)),
)
Table ref_event_types (
ref_event_types.event_type_code (CHAR(10)),
ref_event_types.event_type_description (VARCHAR(255)),
)
Table student_events (
student_events.event_id (INTEGER),
student_events.event_type_code (CHAR(10)),
student_events.student_id (INTEGER),
student_events.event_date (DATETIME(3)),
student_events.other_details (VARCHAR(255)),
)
Table student_loans (
student_loans.student_loan_id (INTEGER),
student_loans.student_id (INTEGER),
student_loans.date_of_loan (DATETIME(3)),
student_loans.amount_of_loan (DECIMAL(15,4)),
student_loans.other_details (VARCHAR(255)),
)
Table students (
students.student_id (INTEGER),
students.bio_data (VARCHAR(255)),
students.student_details (VARCHAR(255)),
)
Table students_addresses (
students_addresses.student_address_id (INTEGER),
students_addresses.address_id (INTEGER),
students_addresses.address_type_code (CHAR(10)),
students_addresses.student_id (INTEGER),
students_addresses.date_from (DATETIME(3)),
students_addresses.date_to (DATETIME(3)),
)
Table teachers (
teachers.teacher_id (INTEGER),
teachers.teacher_details (VARCHAR(255)),
)
Table transcripts (
transcripts.transcript_id (INTEGER),
transcripts.student_id (INTEGER),
transcripts.date_of_transcript (DATETIME(3)),
transcripts.transcript_details (VARCHAR(255)),
)
Possible JOINs:
achievements.achievement_type_code = ref_achievement_type.achievement_type_code
achievements.student_id = students.student_id
behaviour_monitoring.student_id = students.student_id
classes.student_id = students.student_id
classes.teacher_id = teachers.teacher_id
detention.detention_type_code = ref_detention_type.detention_type_code
detention.student_id = students.student_id
student_events.event_type_code = ref_event_types.event_type_code
student_events.student_id = students.student_id
student_loans.student_id = students.student_id
students_addresses.address_id = addresses.address_id
students_addresses.address_type_code = ref_address_types.address_type_code
students_addresses.student_id = students.student_id
transcripts.student_id = students.student_id
| CREATE TABLE achievements (
achievements.achievement_id (INTEGER),
achievements.achievement_type_code (CHAR(15)),
achievements.student_id (INTEGER),
achievements.date_achievement (DATETIME(3)),
achievements.achievement_details (VARCHAR(255)),
achievements.other_details (VARCHAR(255)),
)
CREATE TABLE addresses (
addresses.address_id (INTEGER),
addresses.address_details (VARCHAR(255)),
)
CREATE TABLE behaviour_monitoring (
behaviour_monitoring.behaviour_monitoring_id (INTEGER),
behaviour_monitoring.student_id (INTEGER),
behaviour_monitoring.behaviour_monitoring_details (VARCHAR(255)),
)
CREATE TABLE classes (
classes.class_id (INTEGER),
classes.student_id (INTEGER),
classes.teacher_id (INTEGER),
classes.class_details (VARCHAR(255)),
)
CREATE TABLE detention (
detention.detention_id (INTEGER),
detention.detention_type_code (CHAR(10)),
detention.student_id (INTEGER),
detention.datetime_detention_start (DATETIME(3)),
detention.datetime_detention_end (DATETIME(3)),
detention.detention_summary (VARCHAR(255)),
detention.other_details (VARCHAR(255)),
)
CREATE TABLE ref_achievement_type (
ref_achievement_type.achievement_type_code (CHAR(15)),
ref_achievement_type.achievement_type_description (VARCHAR(80)),
)
CREATE TABLE ref_address_types (
ref_address_types.address_type_code (CHAR(10)),
ref_address_types.address_type_description (VARCHAR(255)),
)
CREATE TABLE ref_detention_type (
ref_detention_type.detention_type_code (CHAR(10)),
ref_detention_type.detention_type_description (VARCHAR(80)),
)
CREATE TABLE ref_event_types (
ref_event_types.event_type_code (CHAR(10)),
ref_event_types.event_type_description (VARCHAR(255)),
)
CREATE TABLE student_events (
student_events.event_id (INTEGER),
student_events.event_type_code (CHAR(10)),
student_events.student_id (INTEGER),
student_events.event_date (DATETIME(3)),
student_events.other_details (VARCHAR(255)),
)
CREATE TABLE student_loans (
student_loans.student_loan_id (INTEGER),
student_loans.student_id (INTEGER),
student_loans.date_of_loan (DATETIME(3)),
student_loans.amount_of_loan (DECIMAL(15,4)),
student_loans.other_details (VARCHAR(255)),
)
CREATE TABLE students (
students.student_id (INTEGER),
students.bio_data (VARCHAR(255)),
students.student_details (VARCHAR(255)),
)
CREATE TABLE students_addresses (
students_addresses.student_address_id (INTEGER),
students_addresses.address_id (INTEGER),
students_addresses.address_type_code (CHAR(10)),
students_addresses.student_id (INTEGER),
students_addresses.date_from (DATETIME(3)),
students_addresses.date_to (DATETIME(3)),
)
CREATE TABLE teachers (
teachers.teacher_id (INTEGER),
teachers.teacher_details (VARCHAR(255)),
)
CREATE TABLE transcripts (
transcripts.transcript_id (INTEGER),
transcripts.student_id (INTEGER),
transcripts.date_of_transcript (DATETIME(3)),
transcripts.transcript_details (VARCHAR(255)),
)
Possible JOINs:
achievements.achievement_type_code = ref_achievement_type.achievement_type_code
achievements.student_id = students.student_id
behaviour_monitoring.student_id = students.student_id
classes.student_id = students.student_id
classes.teacher_id = teachers.teacher_id
detention.detention_type_code = ref_detention_type.detention_type_code
detention.student_id = students.student_id
student_events.event_type_code = ref_event_types.event_type_code
student_events.student_id = students.student_id
student_loans.student_id = students.student_id
students_addresses.address_id = addresses.address_id
students_addresses.address_type_code = ref_address_types.address_type_code
students_addresses.student_id = students.student_id
transcripts.student_id = students.student_id
| {
'Students': ['student_id', 'bio_data', 'student_details'],
'Transcripts': ['transcript_id', 'student_id', 'date_of_transcript', 'transcript_details'],
'Behaviour_Monitoring': ['behaviour_monitoring_id', 'student_id', 'behaviour_monitoring_details'],
'Addresses': ['address_id', 'address_details'],
'Ref_Event_Types': ['event_type_code', 'event_type_description'],
'Ref_Achievement_Type': ['achievement_type_code', 'achievement_type_description'],
'Ref_Address_Types': ['address_type_code', 'address_type_description'],
'Ref_Detention_Type': ['detention_type_code', 'detention_type_description'],
'Student_Events': ['event_id', 'event_type_code', 'student_id', 'event_date', 'other_details'],
'Teachers': ['teacher_id', 'teacher_details'],
'Student_Loans': ['student_loan_id', 'student_id', 'date_of_loan', 'amount_of_loan', 'other_details'],
'Classes': ['class_id', 'student_id', 'teacher_id', 'class_details'],
'Students_Addresses': ['student_address_id', 'address_id', 'address_type_code', 'student_id', 'date_from', 'date_to'],
'Detention': ['detention_id', 'detention_type_code', 'student_id', 'datetime_detention_start', 'datetime_detention_end', 'detention_summary', 'other_details'],
'Achievements': ['achievement_id', 'achievement_type_code', 'student_id', 'date_achievement', 'achievement_details', 'other_details']
} | {
'Transcripts': ['transcript_id', 'student_id', 'date_of_transcript'],
'Student_Loans': ['student_loan_id', 'student_id', 'amount_of_loan']
} | TABLE Achievements (
Achievements.achievement_id (INTEGER),
Achievements.achievement_type_code (CHAR(15)),
Achievements.student_id (INTEGER),
Achievements.date_achievement (DATETIME(3)),
Achievements.achievement_details (VARCHAR(255)),
Achievements.other_details (VARCHAR(255)),
)
TABLE Addresses (
Addresses.address_id (INTEGER),
Addresses.address_details (VARCHAR(255)),
)
TABLE Behaviour_Monitoring (
Behaviour_Monitoring.behaviour_monitoring_id (INTEGER),
Behaviour_Monitoring.student_id (INTEGER),
Behaviour_Monitoring.behaviour_monitoring_details (VARCHAR(255)),
)
TABLE Classes (
Classes.class_id (INTEGER),
Classes.student_id (INTEGER),
Classes.teacher_id (INTEGER),
Classes.class_details (VARCHAR(255)),
)
TABLE Detention (
Detention.detention_id (INTEGER),
Detention.detention_type_code (CHAR(10)),
Detention.student_id (INTEGER),
Detention.datetime_detention_start (DATETIME(3)),
Detention.datetime_detention_end (DATETIME(3)),
Detention.detention_summary (VARCHAR(255)),
Detention.other_details (VARCHAR(255)),
)
TABLE Ref_Achievement_Type (
Ref_Achievement_Type.achievement_type_code (CHAR(15)),
Ref_Achievement_Type.achievement_type_description (VARCHAR(80)),
)
TABLE Ref_Address_Types (
Ref_Address_Types.address_type_code (CHAR(10)),
Ref_Address_Types.address_type_description (VARCHAR(255)),
)
TABLE Ref_Detention_Type (
Ref_Detention_Type.detention_type_code (CHAR(10)),
Ref_Detention_Type.detention_type_description (VARCHAR(80)),
)
TABLE Ref_Event_Types (
Ref_Event_Types.event_type_code (CHAR(10)),
Ref_Event_Types.event_type_description (VARCHAR(255)),
)
TABLE Student_Events (
Student_Events.event_id (INTEGER),
Student_Events.event_type_code (CHAR(10)),
Student_Events.student_id (INTEGER),
Student_Events.event_date (DATETIME(3)),
Student_Events.other_details (VARCHAR(255)),
)
TABLE Student_Loans (
Student_Loans.student_loan_id (INTEGER),
Student_Loans.student_id (INTEGER),
Student_Loans.date_of_loan (DATETIME(3)),
Student_Loans.amount_of_loan (DECIMAL(15,4)),
Student_Loans.other_details (VARCHAR(255)),
)
TABLE Students (
Students.student_id (INTEGER),
Students.bio_data (VARCHAR(255)),
Students.student_details (VARCHAR(255)),
)
TABLE Students_Addresses (
Students_Addresses.student_address_id (INTEGER),
Students_Addresses.address_id (INTEGER),
Students_Addresses.address_type_code (CHAR(10)),
Students_Addresses.student_id (INTEGER),
Students_Addresses.date_from (DATETIME(3)),
Students_Addresses.date_to (DATETIME(3)),
)
TABLE Teachers (
Teachers.teacher_id (INTEGER),
Teachers.teacher_details (VARCHAR(255)),
)
TABLE Transcripts (
Transcripts.transcript_id (INTEGER),
Transcripts.student_id (INTEGER),
Transcripts.date_of_transcript (DATETIME(3)),
Transcripts.transcript_details (VARCHAR(255)),
)
Possible JOINs:
Achievements.achievement_type_code = Ref_Achievement_Type.achievement_type_code
Achievements.student_id = Students.student_id
Behaviour_Monitoring.student_id = Students.student_id
Classes.student_id = Students.student_id
Classes.teacher_id = Teachers.teacher_id
Detention.detention_type_code = Ref_Detention_Type.detention_type_code
Detention.student_id = Students.student_id
Student_Events.event_type_code = Ref_Event_Types.event_type_code
Student_Events.student_id = Students.student_id
Student_Loans.student_id = Students.student_id
Students_Addresses.address_id = Addresses.address_id
Students_Addresses.address_type_code = Ref_Address_Types.address_type_code
Students_Addresses.student_id = Students.student_id
Transcripts.student_id = Students.student_id
| TABLE Achievements (
Achievements.achievement_id (INTEGER),
Achievements.achievement_type_code (CHAR(15)),
Achievements.student_id (INTEGER),
Achievements.date_achievement (DATETIME(3)),
Achievements.achievement_details (VARCHAR(255)),
Achievements.other_details (VARCHAR(255)),
)
TABLE Addresses (
Addresses.address_id (INTEGER),
Addresses.address_details (VARCHAR(255)),
)
TABLE Behaviour_Monitoring (
Behaviour_Monitoring.behaviour_monitoring_id (INTEGER),
Behaviour_Monitoring.student_id (INTEGER),
Behaviour_Monitoring.behaviour_monitoring_details (VARCHAR(255)),
)
TABLE Classes (
Classes.class_id (INTEGER),
Classes.student_id (INTEGER),
Classes.teacher_id (INTEGER),
Classes.class_details (VARCHAR(255)),
)
TABLE Detention (
Detention.detention_id (INTEGER),
Detention.detention_type_code (CHAR(10)),
Detention.student_id (INTEGER),
Detention.datetime_detention_start (DATETIME(3)),
Detention.datetime_detention_end (DATETIME(3)),
Detention.detention_summary (VARCHAR(255)),
Detention.other_details (VARCHAR(255)),
)
TABLE Ref_Achievement_Type (
Ref_Achievement_Type.achievement_type_code (CHAR(15)),
Ref_Achievement_Type.achievement_type_description (VARCHAR(80)),
)
TABLE Ref_Address_Types (
Ref_Address_Types.address_type_code (CHAR(10)),
Ref_Address_Types.address_type_description (VARCHAR(255)),
)
TABLE Ref_Detention_Type (
Ref_Detention_Type.detention_type_code (CHAR(10)),
Ref_Detention_Type.detention_type_description (VARCHAR(80)),
)
TABLE Ref_Event_Types (
Ref_Event_Types.event_type_code (CHAR(10)),
Ref_Event_Types.event_type_description (VARCHAR(255)),
)
TABLE Student_Events (
Student_Events.event_id (INTEGER),
Student_Events.event_type_code (CHAR(10)),
Student_Events.student_id (INTEGER),
Student_Events.event_date (DATETIME(3)),
Student_Events.other_details (VARCHAR(255)),
)
TABLE Student_Loans (
Student_Loans.student_loan_id (INTEGER),
Student_Loans.student_id (INTEGER),
Student_Loans.date_of_loan (DATETIME(3)),
Student_Loans.amount_of_loan (DECIMAL(15,4)),
Student_Loans.other_details (VARCHAR(255)),
)
TABLE Students (
Students.student_id (INTEGER),
Students.bio_data (VARCHAR(255)),
Students.student_details (VARCHAR(255)),
)
TABLE Students_Addresses (
Students_Addresses.student_address_id (INTEGER),
Students_Addresses.address_id (INTEGER),
Students_Addresses.address_type_code (CHAR(10)),
Students_Addresses.student_id (INTEGER),
Students_Addresses.date_from (DATETIME(3)),
Students_Addresses.date_to (DATETIME(3)),
)
TABLE Teachers (
Teachers.teacher_id (INTEGER),
Teachers.teacher_details (VARCHAR(255)),
)
TABLE Transcripts (
Transcripts.transcript_id (INTEGER),
Transcripts.student_id (INTEGER),
Transcripts.date_of_transcript (DATETIME(3)),
Transcripts.transcript_details (VARCHAR(255)),
)
Possible JOINs:
Achievements.achievement_type_code = Ref_Achievement_Type.achievement_type_code
Achievements.student_id = Students.student_id
Behaviour_Monitoring.student_id = Students.student_id
Classes.student_id = Students.student_id
Classes.teacher_id = Teachers.teacher_id
Detention.detention_type_code = Ref_Detention_Type.detention_type_code
Detention.student_id = Students.student_id
Student_Events.event_type_code = Ref_Event_Types.event_type_code
Student_Events.student_id = Students.student_id
Student_Loans.student_id = Students.student_id
Students_Addresses.address_id = Addresses.address_id
Students_Addresses.address_type_code = Ref_Address_Types.address_type_code
Students_Addresses.student_id = Students.student_id
Transcripts.student_id = Students.student_id
| TABLE achievements (
achievements.achievement_id (INTEGER),
achievements.achievement_type_code (CHAR(15)),
achievements.student_id (INTEGER),
achievements.date_achievement (DATETIME(3)),
achievements.achievement_details (VARCHAR(255)),
achievements.other_details (VARCHAR(255)),
)
TABLE addresses (
addresses.address_id (INTEGER),
addresses.address_details (VARCHAR(255)),
)
TABLE behaviour_monitoring (
behaviour_monitoring.behaviour_monitoring_id (INTEGER),
behaviour_monitoring.student_id (INTEGER),
behaviour_monitoring.behaviour_monitoring_details (VARCHAR(255)),
)
TABLE classes (
classes.class_id (INTEGER),
classes.student_id (INTEGER),
classes.teacher_id (INTEGER),
classes.class_details (VARCHAR(255)),
)
TABLE detention (
detention.detention_id (INTEGER),
detention.detention_type_code (CHAR(10)),
detention.student_id (INTEGER),
detention.datetime_detention_start (DATETIME(3)),
detention.datetime_detention_end (DATETIME(3)),
detention.detention_summary (VARCHAR(255)),
detention.other_details (VARCHAR(255)),
)
TABLE ref_achievement_type (
ref_achievement_type.achievement_type_code (CHAR(15)),
ref_achievement_type.achievement_type_description (VARCHAR(80)),
)
TABLE ref_address_types (
ref_address_types.address_type_code (CHAR(10)),
ref_address_types.address_type_description (VARCHAR(255)),
)
TABLE ref_detention_type (
ref_detention_type.detention_type_code (CHAR(10)),
ref_detention_type.detention_type_description (VARCHAR(80)),
)
TABLE ref_event_types (
ref_event_types.event_type_code (CHAR(10)),
ref_event_types.event_type_description (VARCHAR(255)),
)
TABLE student_events (
student_events.event_id (INTEGER),
student_events.event_type_code (CHAR(10)),
student_events.student_id (INTEGER),
student_events.event_date (DATETIME(3)),
student_events.other_details (VARCHAR(255)),
)
TABLE student_loans (
student_loans.student_loan_id (INTEGER),
student_loans.student_id (INTEGER),
student_loans.date_of_loan (DATETIME(3)),
student_loans.amount_of_loan (DECIMAL(15,4)),
student_loans.other_details (VARCHAR(255)),
)
TABLE students (
students.student_id (INTEGER),
students.bio_data (VARCHAR(255)),
students.student_details (VARCHAR(255)),
)
TABLE students_addresses (
students_addresses.student_address_id (INTEGER),
students_addresses.address_id (INTEGER),
students_addresses.address_type_code (CHAR(10)),
students_addresses.student_id (INTEGER),
students_addresses.date_from (DATETIME(3)),
students_addresses.date_to (DATETIME(3)),
)
TABLE teachers (
teachers.teacher_id (INTEGER),
teachers.teacher_details (VARCHAR(255)),
)
TABLE transcripts (
transcripts.transcript_id (INTEGER),
transcripts.student_id (INTEGER),
transcripts.date_of_transcript (DATETIME(3)),
transcripts.transcript_details (VARCHAR(255)),
)
Possible JOINs:
achievements.achievement_type_code = ref_achievement_type.achievement_type_code
achievements.student_id = students.student_id
behaviour_monitoring.student_id = students.student_id
classes.student_id = students.student_id
classes.teacher_id = teachers.teacher_id
detention.detention_type_code = ref_detention_type.detention_type_code
detention.student_id = students.student_id
student_events.event_type_code = ref_event_types.event_type_code
student_events.student_id = students.student_id
student_loans.student_id = students.student_id
students_addresses.address_id = addresses.address_id
students_addresses.address_type_code = ref_address_types.address_type_code
students_addresses.student_id = students.student_id
transcripts.student_id = students.student_id
|
real_estate_rentals |
CREATE TABLE "Addresses" (
address_id INTEGER,
line_1_number_building VARCHAR(80),
line_2_number_street VARCHAR(80),
line_3_area_locality VARCHAR(80),
town_city VARCHAR(80),
zip_postcode VARCHAR(20),
county_state_province VARCHAR(80),
country VARCHAR(50),
other_address_details VARCHAR(255),
PRIMARY KEY (address_id)
)
CREATE TABLE "Features" (
feature_id INTEGER,
feature_name VARCHAR(80),
feature_description VARCHAR(80),
PRIMARY KEY (feature_id)
)
CREATE TABLE "Properties" (
property_id INTEGER,
property_address_id INTEGER NOT NULL,
owner_user_id INTEGER NOT NULL,
property_type_code VARCHAR(15) NOT NULL,
date_on_market DATETIME,
date_off_market DATETIME,
property_name VARCHAR(80),
property_description VARCHAR(255),
garage_yn VARCHAR(1),
parking_lots VARCHAR(1),
room_count VARCHAR(10),
vendor_requested_price DOUBLE,
price_min DOUBLE,
price_max DOUBLE,
other_property_details VARCHAR(255),
PRIMARY KEY (property_id),
FOREIGN KEY(property_type_code) REFERENCES "Ref_Property_Types" (property_type_code),
FOREIGN KEY(property_address_id) REFERENCES "Addresses" (address_id),
FOREIGN KEY(owner_user_id) REFERENCES "Users" (user_id)
)
CREATE TABLE "Property_Features" (
property_id INTEGER NOT NULL,
feature_id INTEGER NOT NULL,
feature_value VARCHAR(80),
property_feature_description VARCHAR(80),
FOREIGN KEY(property_id) REFERENCES "Properties" (property_id),
FOREIGN KEY(feature_id) REFERENCES "Features" (feature_id)
)
CREATE TABLE "Property_Photos" (
property_id INTEGER NOT NULL,
photo_seq INTEGER NOT NULL,
photo_title VARCHAR(30),
photo_description VARCHAR(255),
photo_filename VARCHAR(255),
FOREIGN KEY(property_id) REFERENCES "Properties" (property_id)
)
CREATE TABLE "Ref_Age_Categories" (
age_category_code VARCHAR(15),
age_category_description VARCHAR(80),
PRIMARY KEY (age_category_code)
)
CREATE TABLE "Ref_Property_Types" (
property_type_code VARCHAR(15),
property_type_description VARCHAR(80),
PRIMARY KEY (property_type_code)
)
CREATE TABLE "Ref_Room_Types" (
room_type_code VARCHAR(15),
room_type_description VARCHAR(80),
PRIMARY KEY (room_type_code)
)
CREATE TABLE "Ref_User_Categories" (
user_category_code VARCHAR(15),
user_category_description VARCHAR(80),
PRIMARY KEY (user_category_code)
)
CREATE TABLE "Rooms" (
property_id INTEGER NOT NULL,
room_number VARCHAR(10) NOT NULL,
room_type_code VARCHAR(15) NOT NULL,
room_size VARCHAR(20),
other_room_details VARCHAR(255),
FOREIGN KEY(room_type_code) REFERENCES "Ref_Room_Types" (room_type_code),
FOREIGN KEY(property_id) REFERENCES "Properties" (property_id)
)
CREATE TABLE "User_Property_History" (
user_id INTEGER NOT NULL,
property_id INTEGER NOT NULL,
datestamp DATETIME NOT NULL,
FOREIGN KEY(property_id) REFERENCES "Properties" (property_id),
FOREIGN KEY(user_id) REFERENCES "Users" (user_id)
)
CREATE TABLE "User_Searches" (
user_id INTEGER NOT NULL,
search_seq INTEGER NOT NULL,
search_datetime DATETIME,
search_string VARCHAR(80),
FOREIGN KEY(user_id) REFERENCES "Users" (user_id)
)
CREATE TABLE "Users" (
user_id INTEGER,
age_category_code VARCHAR(15),
user_category_code VARCHAR(15),
user_address_id INTEGER NOT NULL,
is_buyer VARCHAR(1),
is_seller VARCHAR(1),
login_name VARCHAR(25),
password VARCHAR(8),
date_registered DATETIME,
first_name VARCHAR(80),
middle_name VARCHAR(80),
last_name VARCHAR(80),
other_user_details VARCHAR(255),
PRIMARY KEY (user_id)
) | List the first name, middle name and last name, and log in name of all the seller users, whose seller value is 1. | medium | Table Addresses (
Addresses.address_id (INTEGER),
Addresses.line_1_number_building (VARCHAR(80)),
Addresses.line_2_number_street (VARCHAR(80)),
Addresses.line_3_area_locality (VARCHAR(80)),
Addresses.town_city (VARCHAR(80)),
Addresses.zip_postcode (VARCHAR(20)),
Addresses.county_state_province (VARCHAR(80)),
Addresses.country (VARCHAR(50)),
Addresses.other_address_details (VARCHAR(255)),
)
Table Features (
Features.feature_id (INTEGER),
Features.feature_name (VARCHAR(80)),
Features.feature_description (VARCHAR(80)),
)
Table Properties (
Properties.property_id (INTEGER),
Properties.property_address_id (INTEGER),
Properties.owner_user_id (INTEGER),
Properties.property_type_code (VARCHAR(15)),
Properties.date_on_market (DATETIME),
Properties.date_off_market (DATETIME),
Properties.property_name (VARCHAR(80)),
Properties.property_description (VARCHAR(255)),
Properties.garage_yn (VARCHAR(1)),
Properties.parking_lots (VARCHAR(1)),
Properties.room_count (VARCHAR(10)),
Properties.vendor_requested_price (DOUBLE),
Properties.price_min (DOUBLE),
Properties.price_max (DOUBLE),
Properties.other_property_details (VARCHAR(255)),
)
Table Property_Features (
Property_Features.property_id (INTEGER),
Property_Features.feature_id (INTEGER),
Property_Features.feature_value (VARCHAR(80)),
Property_Features.property_feature_description (VARCHAR(80)),
)
Table Property_Photos (
Property_Photos.property_id (INTEGER),
Property_Photos.photo_seq (INTEGER),
Property_Photos.photo_title (VARCHAR(30)),
Property_Photos.photo_description (VARCHAR(255)),
Property_Photos.photo_filename (VARCHAR(255)),
)
Table Ref_Age_Categories (
Ref_Age_Categories.age_category_code (VARCHAR(15)),
Ref_Age_Categories.age_category_description (VARCHAR(80)),
)
Table Ref_Property_Types (
Ref_Property_Types.property_type_code (VARCHAR(15)),
Ref_Property_Types.property_type_description (VARCHAR(80)),
)
Table Ref_Room_Types (
Ref_Room_Types.room_type_code (VARCHAR(15)),
Ref_Room_Types.room_type_description (VARCHAR(80)),
)
Table Ref_User_Categories (
Ref_User_Categories.user_category_code (VARCHAR(15)),
Ref_User_Categories.user_category_description (VARCHAR(80)),
)
Table Rooms (
Rooms.property_id (INTEGER),
Rooms.room_number (VARCHAR(10)),
Rooms.room_type_code (VARCHAR(15)),
Rooms.room_size (VARCHAR(20)),
Rooms.other_room_details (VARCHAR(255)),
)
Table User_Property_History (
User_Property_History.user_id (INTEGER),
User_Property_History.property_id (INTEGER),
User_Property_History.datestamp (DATETIME),
)
Table User_Searches (
User_Searches.user_id (INTEGER),
User_Searches.search_seq (INTEGER),
User_Searches.search_datetime (DATETIME),
User_Searches.search_string (VARCHAR(80)),
)
Table Users (
Users.user_id (INTEGER),
Users.age_category_code (VARCHAR(15)),
Users.user_category_code (VARCHAR(15)),
Users.user_address_id (INTEGER),
Users.is_buyer (VARCHAR(1)),
Users.is_seller (VARCHAR(1)),
Users.login_name (VARCHAR(25)),
Users.password (VARCHAR(8)),
Users.date_registered (DATETIME),
Users.first_name (VARCHAR(80)),
Users.middle_name (VARCHAR(80)),
Users.last_name (VARCHAR(80)),
Users.other_user_details (VARCHAR(255)),
)
Possible JOINs:
Properties.property_address_id = Addresses.address_id
Properties.owner_user_id = Users.user_id
Properties.property_type_code = Ref_Property_Types.property_type_code
Property_Features.property_id = Properties.property_id
Property_Features.feature_id = Features.feature_id
Property_Photos.property_id = Properties.property_id
Rooms.property_id = Properties.property_id
Rooms.room_type_code = Ref_Room_Types.room_type_code
User_Property_History.user_id = Users.user_id
User_Property_History.property_id = Properties.property_id
User_Searches.user_id = Users.user_id
| SELECT first_name , middle_name , last_name , login_name FROM Users WHERE is_seller = 1; | {
'users': ['user_id', 'is_seller', 'login_name', 'first_name', 'middle_name', 'last_name']
} | CREATE TABLE Addresses (
Addresses.address_id (INTEGER),
Addresses.line_1_number_building (VARCHAR(80)),
Addresses.line_2_number_street (VARCHAR(80)),
Addresses.line_3_area_locality (VARCHAR(80)),
Addresses.town_city (VARCHAR(80)),
Addresses.zip_postcode (VARCHAR(20)),
Addresses.county_state_province (VARCHAR(80)),
Addresses.country (VARCHAR(50)),
Addresses.other_address_details (VARCHAR(255)),
)
CREATE TABLE Features (
Features.feature_id (INTEGER),
Features.feature_name (VARCHAR(80)),
Features.feature_description (VARCHAR(80)),
)
CREATE TABLE Properties (
Properties.property_id (INTEGER),
Properties.property_address_id (INTEGER),
Properties.owner_user_id (INTEGER),
Properties.property_type_code (VARCHAR(15)),
Properties.date_on_market (DATETIME),
Properties.date_off_market (DATETIME),
Properties.property_name (VARCHAR(80)),
Properties.property_description (VARCHAR(255)),
Properties.garage_yn (VARCHAR(1)),
Properties.parking_lots (VARCHAR(1)),
Properties.room_count (VARCHAR(10)),
Properties.vendor_requested_price (DOUBLE),
Properties.price_min (DOUBLE),
Properties.price_max (DOUBLE),
Properties.other_property_details (VARCHAR(255)),
)
CREATE TABLE Property_Features (
Property_Features.property_id (INTEGER),
Property_Features.feature_id (INTEGER),
Property_Features.feature_value (VARCHAR(80)),
Property_Features.property_feature_description (VARCHAR(80)),
)
CREATE TABLE Property_Photos (
Property_Photos.property_id (INTEGER),
Property_Photos.photo_seq (INTEGER),
Property_Photos.photo_title (VARCHAR(30)),
Property_Photos.photo_description (VARCHAR(255)),
Property_Photos.photo_filename (VARCHAR(255)),
)
CREATE TABLE Ref_Age_Categories (
Ref_Age_Categories.age_category_code (VARCHAR(15)),
Ref_Age_Categories.age_category_description (VARCHAR(80)),
)
CREATE TABLE Ref_Property_Types (
Ref_Property_Types.property_type_code (VARCHAR(15)),
Ref_Property_Types.property_type_description (VARCHAR(80)),
)
CREATE TABLE Ref_Room_Types (
Ref_Room_Types.room_type_code (VARCHAR(15)),
Ref_Room_Types.room_type_description (VARCHAR(80)),
)
CREATE TABLE Ref_User_Categories (
Ref_User_Categories.user_category_code (VARCHAR(15)),
Ref_User_Categories.user_category_description (VARCHAR(80)),
)
CREATE TABLE Rooms (
Rooms.property_id (INTEGER),
Rooms.room_number (VARCHAR(10)),
Rooms.room_type_code (VARCHAR(15)),
Rooms.room_size (VARCHAR(20)),
Rooms.other_room_details (VARCHAR(255)),
)
CREATE TABLE User_Property_History (
User_Property_History.user_id (INTEGER),
User_Property_History.property_id (INTEGER),
User_Property_History.datestamp (DATETIME),
)
CREATE TABLE User_Searches (
User_Searches.user_id (INTEGER),
User_Searches.search_seq (INTEGER),
User_Searches.search_datetime (DATETIME),
User_Searches.search_string (VARCHAR(80)),
)
CREATE TABLE Users (
Users.user_id (INTEGER),
Users.age_category_code (VARCHAR(15)),
Users.user_category_code (VARCHAR(15)),
Users.user_address_id (INTEGER),
Users.is_buyer (VARCHAR(1)),
Users.is_seller (VARCHAR(1)),
Users.login_name (VARCHAR(25)),
Users.password (VARCHAR(8)),
Users.date_registered (DATETIME),
Users.first_name (VARCHAR(80)),
Users.middle_name (VARCHAR(80)),
Users.last_name (VARCHAR(80)),
Users.other_user_details (VARCHAR(255)),
)
Possible JOINs:
Properties.property_address_id = Addresses.address_id
Properties.owner_user_id = Users.user_id
Properties.property_type_code = Ref_Property_Types.property_type_code
Property_Features.property_id = Properties.property_id
Property_Features.feature_id = Features.feature_id
Property_Photos.property_id = Properties.property_id
Rooms.property_id = Properties.property_id
Rooms.room_type_code = Ref_Room_Types.room_type_code
User_Property_History.user_id = Users.user_id
User_Property_History.property_id = Properties.property_id
User_Searches.user_id = Users.user_id
| Table Addresses (
Addresses.address_id (INTEGER),
Addresses.line_1_number_building (VARCHAR(80)),
Addresses.line_2_number_street (VARCHAR(80)),
Addresses.line_3_area_locality (VARCHAR(80)),
Addresses.town_city (VARCHAR(80)),
Addresses.zip_postcode (VARCHAR(20)),
Addresses.county_state_province (VARCHAR(80)),
Addresses.country (VARCHAR(50)),
Addresses.other_address_details (VARCHAR(255)),
)
Table Features (
Features.feature_id (INTEGER),
Features.feature_name (VARCHAR(80)),
Features.feature_description (VARCHAR(80)),
)
Table Properties (
Properties.property_id (INTEGER),
Properties.property_address_id (INTEGER),
Properties.owner_user_id (INTEGER),
Properties.property_type_code (VARCHAR(15)),
Properties.date_on_market (DATETIME),
Properties.date_off_market (DATETIME),
Properties.property_name (VARCHAR(80)),
Properties.property_description (VARCHAR(255)),
Properties.garage_yn (VARCHAR(1)),
Properties.parking_lots (VARCHAR(1)),
Properties.room_count (VARCHAR(10)),
Properties.vendor_requested_price (DOUBLE),
Properties.price_min (DOUBLE),
Properties.price_max (DOUBLE),
Properties.other_property_details (VARCHAR(255)),
)
Table Property_Features (
Property_Features.property_id (INTEGER),
Property_Features.feature_id (INTEGER),
Property_Features.feature_value (VARCHAR(80)),
Property_Features.property_feature_description (VARCHAR(80)),
)
Table Property_Photos (
Property_Photos.property_id (INTEGER),
Property_Photos.photo_seq (INTEGER),
Property_Photos.photo_title (VARCHAR(30)),
Property_Photos.photo_description (VARCHAR(255)),
Property_Photos.photo_filename (VARCHAR(255)),
)
Table Ref_Age_Categories (
Ref_Age_Categories.age_category_code (VARCHAR(15)),
Ref_Age_Categories.age_category_description (VARCHAR(80)),
)
Table Ref_Property_Types (
Ref_Property_Types.property_type_code (VARCHAR(15)),
Ref_Property_Types.property_type_description (VARCHAR(80)),
)
Table Ref_Room_Types (
Ref_Room_Types.room_type_code (VARCHAR(15)),
Ref_Room_Types.room_type_description (VARCHAR(80)),
)
Table Ref_User_Categories (
Ref_User_Categories.user_category_code (VARCHAR(15)),
Ref_User_Categories.user_category_description (VARCHAR(80)),
)
Table Rooms (
Rooms.property_id (INTEGER),
Rooms.room_number (VARCHAR(10)),
Rooms.room_type_code (VARCHAR(15)),
Rooms.room_size (VARCHAR(20)),
Rooms.other_room_details (VARCHAR(255)),
)
Table User_Property_History (
User_Property_History.user_id (INTEGER),
User_Property_History.property_id (INTEGER),
User_Property_History.datestamp (DATETIME),
)
Table User_Searches (
User_Searches.user_id (INTEGER),
User_Searches.search_seq (INTEGER),
User_Searches.search_datetime (DATETIME),
User_Searches.search_string (VARCHAR(80)),
)
Table Users (
Users.user_id (INTEGER),
Users.age_category_code (VARCHAR(15)),
Users.user_category_code (VARCHAR(15)),
Users.user_address_id (INTEGER),
Users.is_buyer (VARCHAR(1)),
Users.is_seller (VARCHAR(1)),
Users.login_name (VARCHAR(25)),
Users.password (VARCHAR(8)),
Users.date_registered (DATETIME),
Users.first_name (VARCHAR(80)),
Users.middle_name (VARCHAR(80)),
Users.last_name (VARCHAR(80)),
Users.other_user_details (VARCHAR(255)),
)
Possible JOINs:
Properties.property_address_id = Addresses.address_id
Properties.owner_user_id = Users.user_id
Properties.property_type_code = Ref_Property_Types.property_type_code
Property_Features.property_id = Properties.property_id
Property_Features.feature_id = Features.feature_id
Property_Photos.property_id = Properties.property_id
Rooms.property_id = Properties.property_id
Rooms.room_type_code = Ref_Room_Types.room_type_code
User_Property_History.user_id = Users.user_id
User_Property_History.property_id = Properties.property_id
User_Searches.user_id = Users.user_id
| CREATE TABLE Addresses (
Addresses.address_id (INTEGER),
Addresses.line_1_number_building (VARCHAR(80)),
Addresses.line_2_number_street (VARCHAR(80)),
Addresses.line_3_area_locality (VARCHAR(80)),
Addresses.town_city (VARCHAR(80)),
Addresses.zip_postcode (VARCHAR(20)),
Addresses.county_state_province (VARCHAR(80)),
Addresses.country (VARCHAR(50)),
Addresses.other_address_details (VARCHAR(255)),
)
CREATE TABLE Features (
Features.feature_id (INTEGER),
Features.feature_name (VARCHAR(80)),
Features.feature_description (VARCHAR(80)),
)
CREATE TABLE Properties (
Properties.property_id (INTEGER),
Properties.property_address_id (INTEGER),
Properties.owner_user_id (INTEGER),
Properties.property_type_code (VARCHAR(15)),
Properties.date_on_market (DATETIME),
Properties.date_off_market (DATETIME),
Properties.property_name (VARCHAR(80)),
Properties.property_description (VARCHAR(255)),
Properties.garage_yn (VARCHAR(1)),
Properties.parking_lots (VARCHAR(1)),
Properties.room_count (VARCHAR(10)),
Properties.vendor_requested_price (DOUBLE),
Properties.price_min (DOUBLE),
Properties.price_max (DOUBLE),
Properties.other_property_details (VARCHAR(255)),
)
CREATE TABLE Property_Features (
Property_Features.property_id (INTEGER),
Property_Features.feature_id (INTEGER),
Property_Features.feature_value (VARCHAR(80)),
Property_Features.property_feature_description (VARCHAR(80)),
)
CREATE TABLE Property_Photos (
Property_Photos.property_id (INTEGER),
Property_Photos.photo_seq (INTEGER),
Property_Photos.photo_title (VARCHAR(30)),
Property_Photos.photo_description (VARCHAR(255)),
Property_Photos.photo_filename (VARCHAR(255)),
)
CREATE TABLE Ref_Age_Categories (
Ref_Age_Categories.age_category_code (VARCHAR(15)),
Ref_Age_Categories.age_category_description (VARCHAR(80)),
)
CREATE TABLE Ref_Property_Types (
Ref_Property_Types.property_type_code (VARCHAR(15)),
Ref_Property_Types.property_type_description (VARCHAR(80)),
)
CREATE TABLE Ref_Room_Types (
Ref_Room_Types.room_type_code (VARCHAR(15)),
Ref_Room_Types.room_type_description (VARCHAR(80)),
)
CREATE TABLE Ref_User_Categories (
Ref_User_Categories.user_category_code (VARCHAR(15)),
Ref_User_Categories.user_category_description (VARCHAR(80)),
)
CREATE TABLE Rooms (
Rooms.property_id (INTEGER),
Rooms.room_number (VARCHAR(10)),
Rooms.room_type_code (VARCHAR(15)),
Rooms.room_size (VARCHAR(20)),
Rooms.other_room_details (VARCHAR(255)),
)
CREATE TABLE User_Property_History (
User_Property_History.user_id (INTEGER),
User_Property_History.property_id (INTEGER),
User_Property_History.datestamp (DATETIME),
)
CREATE TABLE User_Searches (
User_Searches.user_id (INTEGER),
User_Searches.search_seq (INTEGER),
User_Searches.search_datetime (DATETIME),
User_Searches.search_string (VARCHAR(80)),
)
CREATE TABLE Users (
Users.user_id (INTEGER),
Users.age_category_code (VARCHAR(15)),
Users.user_category_code (VARCHAR(15)),
Users.user_address_id (INTEGER),
Users.is_buyer (VARCHAR(1)),
Users.is_seller (VARCHAR(1)),
Users.login_name (VARCHAR(25)),
Users.password (VARCHAR(8)),
Users.date_registered (DATETIME),
Users.first_name (VARCHAR(80)),
Users.middle_name (VARCHAR(80)),
Users.last_name (VARCHAR(80)),
Users.other_user_details (VARCHAR(255)),
)
Possible JOINs:
Properties.property_address_id = Addresses.address_id
Properties.owner_user_id = Users.user_id
Properties.property_type_code = Ref_Property_Types.property_type_code
Property_Features.property_id = Properties.property_id
Property_Features.feature_id = Features.feature_id
Property_Photos.property_id = Properties.property_id
Rooms.property_id = Properties.property_id
Rooms.room_type_code = Ref_Room_Types.room_type_code
User_Property_History.user_id = Users.user_id
User_Property_History.property_id = Properties.property_id
User_Searches.user_id = Users.user_id
| Table addresses (
addresses.address_id (INTEGER),
addresses.line_1_number_building (VARCHAR(80)),
addresses.line_2_number_street (VARCHAR(80)),
addresses.line_3_area_locality (VARCHAR(80)),
addresses.town_city (VARCHAR(80)),
addresses.zip_postcode (VARCHAR(20)),
addresses.county_state_province (VARCHAR(80)),
addresses.country (VARCHAR(50)),
addresses.other_address_details (VARCHAR(255)),
)
Table features (
features.feature_id (INTEGER),
features.feature_name (VARCHAR(80)),
features.feature_description (VARCHAR(80)),
)
Table properties (
properties.property_id (INTEGER),
properties.property_address_id (INTEGER),
properties.owner_user_id (INTEGER),
properties.property_type_code (VARCHAR(15)),
properties.date_on_market (DATETIME),
properties.date_off_market (DATETIME),
properties.property_name (VARCHAR(80)),
properties.property_description (VARCHAR(255)),
properties.garage_yn (VARCHAR(1)),
properties.parking_lots (VARCHAR(1)),
properties.room_count (VARCHAR(10)),
properties.vendor_requested_price (DOUBLE),
properties.price_min (DOUBLE),
properties.price_max (DOUBLE),
properties.other_property_details (VARCHAR(255)),
)
Table property_features (
property_features.property_id (INTEGER),
property_features.feature_id (INTEGER),
property_features.feature_value (VARCHAR(80)),
property_features.property_feature_description (VARCHAR(80)),
)
Table property_photos (
property_photos.property_id (INTEGER),
property_photos.photo_seq (INTEGER),
property_photos.photo_title (VARCHAR(30)),
property_photos.photo_description (VARCHAR(255)),
property_photos.photo_filename (VARCHAR(255)),
)
Table ref_age_categories (
ref_age_categories.age_category_code (VARCHAR(15)),
ref_age_categories.age_category_description (VARCHAR(80)),
)
Table ref_property_types (
ref_property_types.property_type_code (VARCHAR(15)),
ref_property_types.property_type_description (VARCHAR(80)),
)
Table ref_room_types (
ref_room_types.room_type_code (VARCHAR(15)),
ref_room_types.room_type_description (VARCHAR(80)),
)
Table ref_user_categories (
ref_user_categories.user_category_code (VARCHAR(15)),
ref_user_categories.user_category_description (VARCHAR(80)),
)
Table rooms (
rooms.property_id (INTEGER),
rooms.room_number (VARCHAR(10)),
rooms.room_type_code (VARCHAR(15)),
rooms.room_size (VARCHAR(20)),
rooms.other_room_details (VARCHAR(255)),
)
Table user_property_history (
user_property_history.user_id (INTEGER),
user_property_history.property_id (INTEGER),
user_property_history.datestamp (DATETIME),
)
Table user_searches (
user_searches.user_id (INTEGER),
user_searches.search_seq (INTEGER),
user_searches.search_datetime (DATETIME),
user_searches.search_string (VARCHAR(80)),
)
Table users (
users.user_id (INTEGER),
users.age_category_code (VARCHAR(15)),
users.user_category_code (VARCHAR(15)),
users.user_address_id (INTEGER),
users.is_buyer (VARCHAR(1)),
users.is_seller (VARCHAR(1)),
users.login_name (VARCHAR(25)),
users.password (VARCHAR(8)),
users.date_registered (DATETIME),
users.first_name (VARCHAR(80)),
users.middle_name (VARCHAR(80)),
users.last_name (VARCHAR(80)),
users.other_user_details (VARCHAR(255)),
)
Possible JOINs:
properties.property_address_id = addresses.address_id
properties.owner_user_id = users.user_id
properties.property_type_code = ref_property_types.property_type_code
property_features.property_id = properties.property_id
property_features.feature_id = features.feature_id
property_photos.property_id = properties.property_id
rooms.property_id = properties.property_id
rooms.room_type_code = ref_room_types.room_type_code
user_property_history.user_id = users.user_id
user_property_history.property_id = properties.property_id
user_searches.user_id = users.user_id
| CREATE TABLE addresses (
addresses.address_id (INTEGER),
addresses.line_1_number_building (VARCHAR(80)),
addresses.line_2_number_street (VARCHAR(80)),
addresses.line_3_area_locality (VARCHAR(80)),
addresses.town_city (VARCHAR(80)),
addresses.zip_postcode (VARCHAR(20)),
addresses.county_state_province (VARCHAR(80)),
addresses.country (VARCHAR(50)),
addresses.other_address_details (VARCHAR(255)),
)
CREATE TABLE features (
features.feature_id (INTEGER),
features.feature_name (VARCHAR(80)),
features.feature_description (VARCHAR(80)),
)
CREATE TABLE properties (
properties.property_id (INTEGER),
properties.property_address_id (INTEGER),
properties.owner_user_id (INTEGER),
properties.property_type_code (VARCHAR(15)),
properties.date_on_market (DATETIME),
properties.date_off_market (DATETIME),
properties.property_name (VARCHAR(80)),
properties.property_description (VARCHAR(255)),
properties.garage_yn (VARCHAR(1)),
properties.parking_lots (VARCHAR(1)),
properties.room_count (VARCHAR(10)),
properties.vendor_requested_price (DOUBLE),
properties.price_min (DOUBLE),
properties.price_max (DOUBLE),
properties.other_property_details (VARCHAR(255)),
)
CREATE TABLE property_features (
property_features.property_id (INTEGER),
property_features.feature_id (INTEGER),
property_features.feature_value (VARCHAR(80)),
property_features.property_feature_description (VARCHAR(80)),
)
CREATE TABLE property_photos (
property_photos.property_id (INTEGER),
property_photos.photo_seq (INTEGER),
property_photos.photo_title (VARCHAR(30)),
property_photos.photo_description (VARCHAR(255)),
property_photos.photo_filename (VARCHAR(255)),
)
CREATE TABLE ref_age_categories (
ref_age_categories.age_category_code (VARCHAR(15)),
ref_age_categories.age_category_description (VARCHAR(80)),
)
CREATE TABLE ref_property_types (
ref_property_types.property_type_code (VARCHAR(15)),
ref_property_types.property_type_description (VARCHAR(80)),
)
CREATE TABLE ref_room_types (
ref_room_types.room_type_code (VARCHAR(15)),
ref_room_types.room_type_description (VARCHAR(80)),
)
CREATE TABLE ref_user_categories (
ref_user_categories.user_category_code (VARCHAR(15)),
ref_user_categories.user_category_description (VARCHAR(80)),
)
CREATE TABLE rooms (
rooms.property_id (INTEGER),
rooms.room_number (VARCHAR(10)),
rooms.room_type_code (VARCHAR(15)),
rooms.room_size (VARCHAR(20)),
rooms.other_room_details (VARCHAR(255)),
)
CREATE TABLE user_property_history (
user_property_history.user_id (INTEGER),
user_property_history.property_id (INTEGER),
user_property_history.datestamp (DATETIME),
)
CREATE TABLE user_searches (
user_searches.user_id (INTEGER),
user_searches.search_seq (INTEGER),
user_searches.search_datetime (DATETIME),
user_searches.search_string (VARCHAR(80)),
)
CREATE TABLE users (
users.user_id (INTEGER),
users.age_category_code (VARCHAR(15)),
users.user_category_code (VARCHAR(15)),
users.user_address_id (INTEGER),
users.is_buyer (VARCHAR(1)),
users.is_seller (VARCHAR(1)),
users.login_name (VARCHAR(25)),
users.password (VARCHAR(8)),
users.date_registered (DATETIME),
users.first_name (VARCHAR(80)),
users.middle_name (VARCHAR(80)),
users.last_name (VARCHAR(80)),
users.other_user_details (VARCHAR(255)),
)
Possible JOINs:
properties.property_address_id = addresses.address_id
properties.owner_user_id = users.user_id
properties.property_type_code = ref_property_types.property_type_code
property_features.property_id = properties.property_id
property_features.feature_id = features.feature_id
property_photos.property_id = properties.property_id
rooms.property_id = properties.property_id
rooms.room_type_code = ref_room_types.room_type_code
user_property_history.user_id = users.user_id
user_property_history.property_id = properties.property_id
user_searches.user_id = users.user_id
| {
'Ref_Age_Categories': ['age_category_code', 'age_category_description'],
'Ref_Property_Types': ['property_type_code', 'property_type_description'],
'Ref_Room_Types': ['room_type_code', 'room_type_description'],
'Ref_User_Categories': ['user_category_code', 'user_category_description'],
'Addresses': ['address_id', 'line_1_number_building', 'line_2_number_street', 'line_3_area_locality', 'town_city', 'zip_postcode', 'county_state_province', 'country', 'other_address_details'],
'Features': ['feature_id', 'feature_name', 'feature_description'],
'Users': ['user_id', 'age_category_code', 'user_category_code', 'user_address_id', 'is_buyer', 'is_seller', 'login_name', 'password', 'date_registered', 'first_name', 'middle_name', 'last_name', 'other_user_details'],
'Properties': ['property_id', 'property_address_id', 'owner_user_id', 'property_type_code', 'date_on_market', 'date_off_market', 'property_name', 'property_description', 'garage_yn', 'parking_lots', 'room_count', 'vendor_requested_price', 'price_min', 'price_max', 'other_property_details'],
'Property_Features': ['property_id', 'feature_id', 'feature_value', 'property_feature_description'],
'Property_Photos': ['property_id', 'photo_seq', 'photo_title', 'photo_description', 'photo_filename'],
'Rooms': ['property_id', 'room_number', 'room_type_code', 'room_size', 'other_room_details'],
'User_Property_History': ['user_id', 'property_id', 'datestamp'],
'User_Searches': ['user_id', 'search_seq', 'search_datetime', 'search_string']
} | {
'Users': ['user_id', 'is_seller', 'login_name', 'first_name', 'middle_name', 'last_name']
} | TABLE Addresses (
Addresses.address_id (INTEGER),
Addresses.line_1_number_building (VARCHAR(80)),
Addresses.line_2_number_street (VARCHAR(80)),
Addresses.line_3_area_locality (VARCHAR(80)),
Addresses.town_city (VARCHAR(80)),
Addresses.zip_postcode (VARCHAR(20)),
Addresses.county_state_province (VARCHAR(80)),
Addresses.country (VARCHAR(50)),
Addresses.other_address_details (VARCHAR(255)),
)
TABLE Features (
Features.feature_id (INTEGER),
Features.feature_name (VARCHAR(80)),
Features.feature_description (VARCHAR(80)),
)
TABLE Properties (
Properties.property_id (INTEGER),
Properties.property_address_id (INTEGER),
Properties.owner_user_id (INTEGER),
Properties.property_type_code (VARCHAR(15)),
Properties.date_on_market (DATETIME),
Properties.date_off_market (DATETIME),
Properties.property_name (VARCHAR(80)),
Properties.property_description (VARCHAR(255)),
Properties.garage_yn (VARCHAR(1)),
Properties.parking_lots (VARCHAR(1)),
Properties.room_count (VARCHAR(10)),
Properties.vendor_requested_price (DOUBLE),
Properties.price_min (DOUBLE),
Properties.price_max (DOUBLE),
Properties.other_property_details (VARCHAR(255)),
)
TABLE Property_Features (
Property_Features.property_id (INTEGER),
Property_Features.feature_id (INTEGER),
Property_Features.feature_value (VARCHAR(80)),
Property_Features.property_feature_description (VARCHAR(80)),
)
TABLE Property_Photos (
Property_Photos.property_id (INTEGER),
Property_Photos.photo_seq (INTEGER),
Property_Photos.photo_title (VARCHAR(30)),
Property_Photos.photo_description (VARCHAR(255)),
Property_Photos.photo_filename (VARCHAR(255)),
)
TABLE Ref_Age_Categories (
Ref_Age_Categories.age_category_code (VARCHAR(15)),
Ref_Age_Categories.age_category_description (VARCHAR(80)),
)
TABLE Ref_Property_Types (
Ref_Property_Types.property_type_code (VARCHAR(15)),
Ref_Property_Types.property_type_description (VARCHAR(80)),
)
TABLE Ref_Room_Types (
Ref_Room_Types.room_type_code (VARCHAR(15)),
Ref_Room_Types.room_type_description (VARCHAR(80)),
)
TABLE Ref_User_Categories (
Ref_User_Categories.user_category_code (VARCHAR(15)),
Ref_User_Categories.user_category_description (VARCHAR(80)),
)
TABLE Rooms (
Rooms.property_id (INTEGER),
Rooms.room_number (VARCHAR(10)),
Rooms.room_type_code (VARCHAR(15)),
Rooms.room_size (VARCHAR(20)),
Rooms.other_room_details (VARCHAR(255)),
)
TABLE User_Property_History (
User_Property_History.user_id (INTEGER),
User_Property_History.property_id (INTEGER),
User_Property_History.datestamp (DATETIME),
)
TABLE User_Searches (
User_Searches.user_id (INTEGER),
User_Searches.search_seq (INTEGER),
User_Searches.search_datetime (DATETIME),
User_Searches.search_string (VARCHAR(80)),
)
TABLE Users (
Users.user_id (INTEGER),
Users.age_category_code (VARCHAR(15)),
Users.user_category_code (VARCHAR(15)),
Users.user_address_id (INTEGER),
Users.is_buyer (VARCHAR(1)),
Users.is_seller (VARCHAR(1)),
Users.login_name (VARCHAR(25)),
Users.password (VARCHAR(8)),
Users.date_registered (DATETIME),
Users.first_name (VARCHAR(80)),
Users.middle_name (VARCHAR(80)),
Users.last_name (VARCHAR(80)),
Users.other_user_details (VARCHAR(255)),
)
Possible JOINs:
Properties.property_address_id = Addresses.address_id
Properties.owner_user_id = Users.user_id
Properties.property_type_code = Ref_Property_Types.property_type_code
Property_Features.property_id = Properties.property_id
Property_Features.feature_id = Features.feature_id
Property_Photos.property_id = Properties.property_id
Rooms.property_id = Properties.property_id
Rooms.room_type_code = Ref_Room_Types.room_type_code
User_Property_History.user_id = Users.user_id
User_Property_History.property_id = Properties.property_id
User_Searches.user_id = Users.user_id
| TABLE Addresses (
Addresses.address_id (INTEGER),
Addresses.line_1_number_building (VARCHAR(80)),
Addresses.line_2_number_street (VARCHAR(80)),
Addresses.line_3_area_locality (VARCHAR(80)),
Addresses.town_city (VARCHAR(80)),
Addresses.zip_postcode (VARCHAR(20)),
Addresses.county_state_province (VARCHAR(80)),
Addresses.country (VARCHAR(50)),
Addresses.other_address_details (VARCHAR(255)),
)
TABLE Features (
Features.feature_id (INTEGER),
Features.feature_name (VARCHAR(80)),
Features.feature_description (VARCHAR(80)),
)
TABLE Properties (
Properties.property_id (INTEGER),
Properties.property_address_id (INTEGER),
Properties.owner_user_id (INTEGER),
Properties.property_type_code (VARCHAR(15)),
Properties.date_on_market (DATETIME),
Properties.date_off_market (DATETIME),
Properties.property_name (VARCHAR(80)),
Properties.property_description (VARCHAR(255)),
Properties.garage_yn (VARCHAR(1)),
Properties.parking_lots (VARCHAR(1)),
Properties.room_count (VARCHAR(10)),
Properties.vendor_requested_price (DOUBLE),
Properties.price_min (DOUBLE),
Properties.price_max (DOUBLE),
Properties.other_property_details (VARCHAR(255)),
)
TABLE Property_Features (
Property_Features.property_id (INTEGER),
Property_Features.feature_id (INTEGER),
Property_Features.feature_value (VARCHAR(80)),
Property_Features.property_feature_description (VARCHAR(80)),
)
TABLE Property_Photos (
Property_Photos.property_id (INTEGER),
Property_Photos.photo_seq (INTEGER),
Property_Photos.photo_title (VARCHAR(30)),
Property_Photos.photo_description (VARCHAR(255)),
Property_Photos.photo_filename (VARCHAR(255)),
)
TABLE Ref_Age_Categories (
Ref_Age_Categories.age_category_code (VARCHAR(15)),
Ref_Age_Categories.age_category_description (VARCHAR(80)),
)
TABLE Ref_Property_Types (
Ref_Property_Types.property_type_code (VARCHAR(15)),
Ref_Property_Types.property_type_description (VARCHAR(80)),
)
TABLE Ref_Room_Types (
Ref_Room_Types.room_type_code (VARCHAR(15)),
Ref_Room_Types.room_type_description (VARCHAR(80)),
)
TABLE Ref_User_Categories (
Ref_User_Categories.user_category_code (VARCHAR(15)),
Ref_User_Categories.user_category_description (VARCHAR(80)),
)
TABLE Rooms (
Rooms.property_id (INTEGER),
Rooms.room_number (VARCHAR(10)),
Rooms.room_type_code (VARCHAR(15)),
Rooms.room_size (VARCHAR(20)),
Rooms.other_room_details (VARCHAR(255)),
)
TABLE User_Property_History (
User_Property_History.user_id (INTEGER),
User_Property_History.property_id (INTEGER),
User_Property_History.datestamp (DATETIME),
)
TABLE User_Searches (
User_Searches.user_id (INTEGER),
User_Searches.search_seq (INTEGER),
User_Searches.search_datetime (DATETIME),
User_Searches.search_string (VARCHAR(80)),
)
TABLE Users (
Users.user_id (INTEGER),
Users.age_category_code (VARCHAR(15)),
Users.user_category_code (VARCHAR(15)),
Users.user_address_id (INTEGER),
Users.is_buyer (VARCHAR(1)),
Users.is_seller (VARCHAR(1)),
Users.login_name (VARCHAR(25)),
Users.password (VARCHAR(8)),
Users.date_registered (DATETIME),
Users.first_name (VARCHAR(80)),
Users.middle_name (VARCHAR(80)),
Users.last_name (VARCHAR(80)),
Users.other_user_details (VARCHAR(255)),
)
Possible JOINs:
Properties.property_address_id = Addresses.address_id
Properties.owner_user_id = Users.user_id
Properties.property_type_code = Ref_Property_Types.property_type_code
Property_Features.property_id = Properties.property_id
Property_Features.feature_id = Features.feature_id
Property_Photos.property_id = Properties.property_id
Rooms.property_id = Properties.property_id
Rooms.room_type_code = Ref_Room_Types.room_type_code
User_Property_History.user_id = Users.user_id
User_Property_History.property_id = Properties.property_id
User_Searches.user_id = Users.user_id
| TABLE addresses (
addresses.address_id (INTEGER),
addresses.line_1_number_building (VARCHAR(80)),
addresses.line_2_number_street (VARCHAR(80)),
addresses.line_3_area_locality (VARCHAR(80)),
addresses.town_city (VARCHAR(80)),
addresses.zip_postcode (VARCHAR(20)),
addresses.county_state_province (VARCHAR(80)),
addresses.country (VARCHAR(50)),
addresses.other_address_details (VARCHAR(255)),
)
TABLE features (
features.feature_id (INTEGER),
features.feature_name (VARCHAR(80)),
features.feature_description (VARCHAR(80)),
)
TABLE properties (
properties.property_id (INTEGER),
properties.property_address_id (INTEGER),
properties.owner_user_id (INTEGER),
properties.property_type_code (VARCHAR(15)),
properties.date_on_market (DATETIME),
properties.date_off_market (DATETIME),
properties.property_name (VARCHAR(80)),
properties.property_description (VARCHAR(255)),
properties.garage_yn (VARCHAR(1)),
properties.parking_lots (VARCHAR(1)),
properties.room_count (VARCHAR(10)),
properties.vendor_requested_price (DOUBLE),
properties.price_min (DOUBLE),
properties.price_max (DOUBLE),
properties.other_property_details (VARCHAR(255)),
)
TABLE property_features (
property_features.property_id (INTEGER),
property_features.feature_id (INTEGER),
property_features.feature_value (VARCHAR(80)),
property_features.property_feature_description (VARCHAR(80)),
)
TABLE property_photos (
property_photos.property_id (INTEGER),
property_photos.photo_seq (INTEGER),
property_photos.photo_title (VARCHAR(30)),
property_photos.photo_description (VARCHAR(255)),
property_photos.photo_filename (VARCHAR(255)),
)
TABLE ref_age_categories (
ref_age_categories.age_category_code (VARCHAR(15)),
ref_age_categories.age_category_description (VARCHAR(80)),
)
TABLE ref_property_types (
ref_property_types.property_type_code (VARCHAR(15)),
ref_property_types.property_type_description (VARCHAR(80)),
)
TABLE ref_room_types (
ref_room_types.room_type_code (VARCHAR(15)),
ref_room_types.room_type_description (VARCHAR(80)),
)
TABLE ref_user_categories (
ref_user_categories.user_category_code (VARCHAR(15)),
ref_user_categories.user_category_description (VARCHAR(80)),
)
TABLE rooms (
rooms.property_id (INTEGER),
rooms.room_number (VARCHAR(10)),
rooms.room_type_code (VARCHAR(15)),
rooms.room_size (VARCHAR(20)),
rooms.other_room_details (VARCHAR(255)),
)
TABLE user_property_history (
user_property_history.user_id (INTEGER),
user_property_history.property_id (INTEGER),
user_property_history.datestamp (DATETIME),
)
TABLE user_searches (
user_searches.user_id (INTEGER),
user_searches.search_seq (INTEGER),
user_searches.search_datetime (DATETIME),
user_searches.search_string (VARCHAR(80)),
)
TABLE users (
users.user_id (INTEGER),
users.age_category_code (VARCHAR(15)),
users.user_category_code (VARCHAR(15)),
users.user_address_id (INTEGER),
users.is_buyer (VARCHAR(1)),
users.is_seller (VARCHAR(1)),
users.login_name (VARCHAR(25)),
users.password (VARCHAR(8)),
users.date_registered (DATETIME),
users.first_name (VARCHAR(80)),
users.middle_name (VARCHAR(80)),
users.last_name (VARCHAR(80)),
users.other_user_details (VARCHAR(255)),
)
Possible JOINs:
properties.property_address_id = addresses.address_id
properties.owner_user_id = users.user_id
properties.property_type_code = ref_property_types.property_type_code
property_features.property_id = properties.property_id
property_features.feature_id = features.feature_id
property_photos.property_id = properties.property_id
rooms.property_id = properties.property_id
rooms.room_type_code = ref_room_types.room_type_code
user_property_history.user_id = users.user_id
user_property_history.property_id = properties.property_id
user_searches.user_id = users.user_id
|
aan_1 |
CREATE TABLE "Affiliation" (
affiliation_id INTEGER NOT NULL,
name VARCHAR(255) DEFAULT NULL,
address VARCHAR(255) DEFAULT NULL,
PRIMARY KEY (affiliation_id)
)
CREATE TABLE "Author" (
author_id INTEGER NOT NULL,
name VARCHAR(255) DEFAULT NULL,
email VARCHAR(255) DEFAULT NULL,
PRIMARY KEY (author_id)
)
CREATE TABLE "Author_list" (
paper_id VARCHAR(25) NOT NULL,
author_id INTEGER NOT NULL,
affiliation_id INTEGER DEFAULT NULL,
PRIMARY KEY (paper_id, author_id),
FOREIGN KEY(affiliation_id) REFERENCES "Affiliation" (affiliation_id),
FOREIGN KEY(author_id) REFERENCES "Author" (author_id),
FOREIGN KEY(paper_id) REFERENCES "Paper" (paper_id)
)
CREATE TABLE "Citation" (
paper_id VARCHAR(25) NOT NULL,
cited_paper_id VARCHAR(25) NOT NULL,
PRIMARY KEY (paper_id, cited_paper_id),
FOREIGN KEY(cited_paper_id) REFERENCES "Paper" (paper_id),
FOREIGN KEY(paper_id) REFERENCES "Paper" (paper_id)
)
CREATE TABLE "Paper" (
paper_id VARCHAR(25) NOT NULL,
title VARCHAR(255) DEFAULT NULL,
venue VARCHAR(255) DEFAULT NULL,
year INTEGER DEFAULT NULL,
PRIMARY KEY (paper_id)
) | What are the names of the top 3 affiliations that have the most papers in year 2009? | extra | Table Affiliation (
Affiliation.affiliation_id (INTEGER),
Affiliation.name (varchar(255)),
Affiliation.address (varchar(255)),
)
Table Author (
Author.author_id (INTEGER),
Author.name (varchar(255)),
Author.email (varchar(255)),
)
Table Author_list (
Author_list.paper_id (varchar(25)),
Author_list.author_id (INTEGER),
Author_list.affiliation_id (INTEGER),
)
Table Citation (
Citation.paper_id (varchar(25)),
Citation.cited_paper_id (varchar(25)),
)
Table Paper (
Paper.paper_id (varchar(25)),
Paper.title (varchar(255)),
Paper.venue (varchar(255)),
Paper.year (INTEGER),
)
Possible JOINs:
Author_list.paper_id = Paper.paper_id
Author_list.author_id = Author.author_id
Author_list.affiliation_id = Affiliation.affiliation_id
Citation.paper_id = Paper.paper_id
Citation.cited_paper_id = Paper.paper_id
| SELECT Affiliation.name FROM Paper JOIN Author_list ON Paper.paper_id = Author_list.paper_id JOIN Affiliation ON Author_list.affiliation_id = Affiliation.affiliation_id WHERE Paper.year = 2009 GROUP BY Author_list.affiliation_id ORDER BY count(*) DESC LIMIT 3 | {
'paper': ['paper_id', 'year'],
'author_list': ['paper_id', 'affiliation_id'],
'affiliation': ['affiliation_id', 'name']
} | CREATE TABLE Affiliation (
Affiliation.affiliation_id (INTEGER),
Affiliation.name (varchar(255)),
Affiliation.address (varchar(255)),
)
CREATE TABLE Author (
Author.author_id (INTEGER),
Author.name (varchar(255)),
Author.email (varchar(255)),
)
CREATE TABLE Author_list (
Author_list.paper_id (varchar(25)),
Author_list.author_id (INTEGER),
Author_list.affiliation_id (INTEGER),
)
CREATE TABLE Citation (
Citation.paper_id (varchar(25)),
Citation.cited_paper_id (varchar(25)),
)
CREATE TABLE Paper (
Paper.paper_id (varchar(25)),
Paper.title (varchar(255)),
Paper.venue (varchar(255)),
Paper.year (INTEGER),
)
Possible JOINs:
Author_list.paper_id = Paper.paper_id
Author_list.author_id = Author.author_id
Author_list.affiliation_id = Affiliation.affiliation_id
Citation.paper_id = Paper.paper_id
Citation.cited_paper_id = Paper.paper_id
| Table Affiliation (
Affiliation.affiliation_id (INTEGER),
Affiliation.name (varchar(255)),
Affiliation.address (varchar(255)),
)
Table Author (
Author.author_id (INTEGER),
Author.name (varchar(255)),
Author.email (varchar(255)),
)
Table Author_list (
Author_list.paper_id (varchar(25)),
Author_list.author_id (INTEGER),
Author_list.affiliation_id (INTEGER),
)
Table Citation (
Citation.paper_id (varchar(25)),
Citation.cited_paper_id (varchar(25)),
)
Table Paper (
Paper.paper_id (varchar(25)),
Paper.title (varchar(255)),
Paper.venue (varchar(255)),
Paper.year (INTEGER),
)
Possible JOINs:
Author_list.paper_id = Paper.paper_id
Author_list.author_id = Author.author_id
Author_list.affiliation_id = Affiliation.affiliation_id
Citation.paper_id = Paper.paper_id
Citation.cited_paper_id = Paper.paper_id
| CREATE TABLE Affiliation (
Affiliation.affiliation_id (INTEGER),
Affiliation.name (varchar(255)),
Affiliation.address (varchar(255)),
)
CREATE TABLE Author (
Author.author_id (INTEGER),
Author.name (varchar(255)),
Author.email (varchar(255)),
)
CREATE TABLE Author_list (
Author_list.paper_id (varchar(25)),
Author_list.author_id (INTEGER),
Author_list.affiliation_id (INTEGER),
)
CREATE TABLE Citation (
Citation.paper_id (varchar(25)),
Citation.cited_paper_id (varchar(25)),
)
CREATE TABLE Paper (
Paper.paper_id (varchar(25)),
Paper.title (varchar(255)),
Paper.venue (varchar(255)),
Paper.year (INTEGER),
)
Possible JOINs:
Author_list.paper_id = Paper.paper_id
Author_list.author_id = Author.author_id
Author_list.affiliation_id = Affiliation.affiliation_id
Citation.paper_id = Paper.paper_id
Citation.cited_paper_id = Paper.paper_id
| Table affiliation (
affiliation.affiliation_id (INTEGER),
affiliation.name (varchar(255)),
affiliation.address (varchar(255)),
)
Table author (
author.author_id (INTEGER),
author.name (varchar(255)),
author.email (varchar(255)),
)
Table author_list (
author_list.paper_id (varchar(25)),
author_list.author_id (INTEGER),
author_list.affiliation_id (INTEGER),
)
Table citation (
citation.paper_id (varchar(25)),
citation.cited_paper_id (varchar(25)),
)
Table paper (
paper.paper_id (varchar(25)),
paper.title (varchar(255)),
paper.venue (varchar(255)),
paper.year (INTEGER),
)
Possible JOINs:
author_list.paper_id = paper.paper_id
author_list.author_id = author.author_id
author_list.affiliation_id = affiliation.affiliation_id
citation.paper_id = paper.paper_id
citation.cited_paper_id = paper.paper_id
| CREATE TABLE affiliation (
affiliation.affiliation_id (INTEGER),
affiliation.name (varchar(255)),
affiliation.address (varchar(255)),
)
CREATE TABLE author (
author.author_id (INTEGER),
author.name (varchar(255)),
author.email (varchar(255)),
)
CREATE TABLE author_list (
author_list.paper_id (varchar(25)),
author_list.author_id (INTEGER),
author_list.affiliation_id (INTEGER),
)
CREATE TABLE citation (
citation.paper_id (varchar(25)),
citation.cited_paper_id (varchar(25)),
)
CREATE TABLE paper (
paper.paper_id (varchar(25)),
paper.title (varchar(255)),
paper.venue (varchar(255)),
paper.year (INTEGER),
)
Possible JOINs:
author_list.paper_id = paper.paper_id
author_list.author_id = author.author_id
author_list.affiliation_id = affiliation.affiliation_id
citation.paper_id = paper.paper_id
citation.cited_paper_id = paper.paper_id
| {
'Affiliation': ['affiliation_id', 'name', 'address'],
'Author': ['author_id', 'name', 'email'],
'Author_list': ['paper_id', 'author_id', 'affiliation_id'],
'Citation': ['paper_id', 'cited_paper_id'],
'Paper': ['paper_id', 'title', 'venue', 'year']
} | {
'Paper': ['paper_id', 'year'],
'Author_list': ['paper_id', 'affiliation_id'],
'Affiliation': ['affiliation_id', 'name']
} | TABLE Affiliation (
Affiliation.affiliation_id (INTEGER),
Affiliation.name (varchar(255)),
Affiliation.address (varchar(255)),
)
TABLE Author (
Author.author_id (INTEGER),
Author.name (varchar(255)),
Author.email (varchar(255)),
)
TABLE Author_list (
Author_list.paper_id (varchar(25)),
Author_list.author_id (INTEGER),
Author_list.affiliation_id (INTEGER),
)
TABLE Citation (
Citation.paper_id (varchar(25)),
Citation.cited_paper_id (varchar(25)),
)
TABLE Paper (
Paper.paper_id (varchar(25)),
Paper.title (varchar(255)),
Paper.venue (varchar(255)),
Paper.year (INTEGER),
)
Possible JOINs:
Author_list.paper_id = Paper.paper_id
Author_list.author_id = Author.author_id
Author_list.affiliation_id = Affiliation.affiliation_id
Citation.paper_id = Paper.paper_id
Citation.cited_paper_id = Paper.paper_id
| TABLE Affiliation (
Affiliation.affiliation_id (INTEGER),
Affiliation.name (varchar(255)),
Affiliation.address (varchar(255)),
)
TABLE Author (
Author.author_id (INTEGER),
Author.name (varchar(255)),
Author.email (varchar(255)),
)
TABLE Author_list (
Author_list.paper_id (varchar(25)),
Author_list.author_id (INTEGER),
Author_list.affiliation_id (INTEGER),
)
TABLE Citation (
Citation.paper_id (varchar(25)),
Citation.cited_paper_id (varchar(25)),
)
TABLE Paper (
Paper.paper_id (varchar(25)),
Paper.title (varchar(255)),
Paper.venue (varchar(255)),
Paper.year (INTEGER),
)
Possible JOINs:
Author_list.paper_id = Paper.paper_id
Author_list.author_id = Author.author_id
Author_list.affiliation_id = Affiliation.affiliation_id
Citation.paper_id = Paper.paper_id
Citation.cited_paper_id = Paper.paper_id
| TABLE affiliation (
affiliation.affiliation_id (INTEGER),
affiliation.name (varchar(255)),
affiliation.address (varchar(255)),
)
TABLE author (
author.author_id (INTEGER),
author.name (varchar(255)),
author.email (varchar(255)),
)
TABLE author_list (
author_list.paper_id (varchar(25)),
author_list.author_id (INTEGER),
author_list.affiliation_id (INTEGER),
)
TABLE citation (
citation.paper_id (varchar(25)),
citation.cited_paper_id (varchar(25)),
)
TABLE paper (
paper.paper_id (varchar(25)),
paper.title (varchar(255)),
paper.venue (varchar(255)),
paper.year (INTEGER),
)
Possible JOINs:
author_list.paper_id = paper.paper_id
author_list.author_id = author.author_id
author_list.affiliation_id = affiliation.affiliation_id
citation.paper_id = paper.paper_id
citation.cited_paper_id = paper.paper_id
|
warehouse_1 |
CREATE TABLE "Boxes" (
"Code" CHAR(4) NOT NULL,
"Contents" VARCHAR(255) NOT NULL,
"Value" REAL NOT NULL,
"Warehouse" INTEGER NOT NULL,
PRIMARY KEY ("Code"),
FOREIGN KEY("Warehouse") REFERENCES "Warehouses" ("Code")
)
CREATE TABLE "Warehouses" (
"Code" INTEGER NOT NULL,
"Location" VARCHAR(255) NOT NULL,
"Capacity" INTEGER NOT NULL,
PRIMARY KEY ("Code")
) | Find the code of all boxes whose value is higher than the value of any boxes with Rocks as content. | hard | Table Boxes (
Boxes.Code (CHAR(4)),
Boxes.Contents (VARCHAR(255)),
Boxes.Value (REAL),
Boxes.Warehouse (INTEGER),
)
Table Warehouses (
Warehouses.Code (INTEGER),
Warehouses.Location (VARCHAR(255)),
Warehouses.Capacity (INTEGER),
)
Possible JOINs:
Boxes.Warehouse = Warehouses.Code
| SELECT code FROM boxes WHERE value > (SELECT min(value) FROM boxes WHERE CONTENTS = 'Rocks') | {
'boxes': ['code', 'contents', 'value']
} | CREATE TABLE Boxes (
Boxes.Code (CHAR(4)),
Boxes.Contents (VARCHAR(255)),
Boxes.Value (REAL),
Boxes.Warehouse (INTEGER),
)
CREATE TABLE Warehouses (
Warehouses.Code (INTEGER),
Warehouses.Location (VARCHAR(255)),
Warehouses.Capacity (INTEGER),
)
Possible JOINs:
Boxes.Warehouse = Warehouses.Code
| Table Boxes (
Boxes.code (CHAR(4)),
Boxes.contents (VARCHAR(255)),
Boxes.value (REAL),
Boxes.warehouse (INTEGER),
)
Table Warehouses (
Warehouses.code (INTEGER),
Warehouses.location (VARCHAR(255)),
Warehouses.capacity (INTEGER),
)
Possible JOINs:
Boxes.warehouse = Warehouses.code
| CREATE TABLE Boxes (
Boxes.code (CHAR(4)),
Boxes.contents (VARCHAR(255)),
Boxes.value (REAL),
Boxes.warehouse (INTEGER),
)
CREATE TABLE Warehouses (
Warehouses.code (INTEGER),
Warehouses.location (VARCHAR(255)),
Warehouses.capacity (INTEGER),
)
Possible JOINs:
Boxes.warehouse = Warehouses.code
| Table boxes (
boxes.code (CHAR(4)),
boxes.contents (VARCHAR(255)),
boxes.value (REAL),
boxes.warehouse (INTEGER),
)
Table warehouses (
warehouses.code (INTEGER),
warehouses.location (VARCHAR(255)),
warehouses.capacity (INTEGER),
)
Possible JOINs:
boxes.warehouse = warehouses.code
| CREATE TABLE boxes (
boxes.code (CHAR(4)),
boxes.contents (VARCHAR(255)),
boxes.value (REAL),
boxes.warehouse (INTEGER),
)
CREATE TABLE warehouses (
warehouses.code (INTEGER),
warehouses.location (VARCHAR(255)),
warehouses.capacity (INTEGER),
)
Possible JOINs:
boxes.warehouse = warehouses.code
| {
'Warehouses': ['Code', 'Location', 'Capacity'],
'Boxes': ['Code', 'Contents', 'Value', 'Warehouse']
} | {
'Boxes': ['Code', 'Contents', 'Value']
} | TABLE Boxes (
Boxes.Code (CHAR(4)),
Boxes.Contents (VARCHAR(255)),
Boxes.Value (REAL),
Boxes.Warehouse (INTEGER),
)
TABLE Warehouses (
Warehouses.Code (INTEGER),
Warehouses.Location (VARCHAR(255)),
Warehouses.Capacity (INTEGER),
)
Possible JOINs:
Boxes.Warehouse = Warehouses.Code
| TABLE Boxes (
Boxes.code (CHAR(4)),
Boxes.contents (VARCHAR(255)),
Boxes.value (REAL),
Boxes.warehouse (INTEGER),
)
TABLE Warehouses (
Warehouses.code (INTEGER),
Warehouses.location (VARCHAR(255)),
Warehouses.capacity (INTEGER),
)
Possible JOINs:
Boxes.warehouse = Warehouses.code
| TABLE boxes (
boxes.code (CHAR(4)),
boxes.contents (VARCHAR(255)),
boxes.value (REAL),
boxes.warehouse (INTEGER),
)
TABLE warehouses (
warehouses.code (INTEGER),
warehouses.location (VARCHAR(255)),
warehouses.capacity (INTEGER),
)
Possible JOINs:
boxes.warehouse = warehouses.code
|
boat_1 |
CREATE TABLE "Boats" (
bid INTEGER,
name TEXT,
color TEXT,
PRIMARY KEY (bid)
)
CREATE TABLE "Reserves" (
sid INTEGER,
bid INTEGER,
day TEXT,
FOREIGN KEY(sid) REFERENCES "Sailors" (sid),
FOREIGN KEY(bid) REFERENCES "Boats" (bid)
)
CREATE TABLE "Sailors" (
sid INTEGER,
name TEXT,
rating INTEGER,
age INTEGER,
PRIMARY KEY (sid)
) | What are the rating and average age for sailors who reserved red boats for each rating? | extra | Table Boats (
Boats.bid (INTEGER),
Boats.name (TEXT),
Boats.color (TEXT),
)
Table Reserves (
Reserves.sid (INTEGER),
Reserves.bid (INTEGER),
Reserves.day (TEXT),
)
Table Sailors (
Sailors.sid (INTEGER),
Sailors.name (TEXT),
Sailors.rating (INTEGER),
Sailors.age (INTEGER),
)
Possible JOINs:
Reserves.sid = Sailors.sid
Reserves.bid = Boats.bid
| SELECT Sailors.rating , avg(Sailors.age) FROM Sailors JOIN Reserves ON Sailors.sid = Reserves.sid JOIN Boats ON Boats.bid = Reserves.bid WHERE Boats.color = 'red' GROUP BY Sailors.rating | {
'sailors': ['sid', 'rating', 'age'],
'reserves': ['sid', 'bid'],
'boats': ['bid', 'color']
} | CREATE TABLE Boats (
Boats.bid (INTEGER),
Boats.name (TEXT),
Boats.color (TEXT),
)
CREATE TABLE Reserves (
Reserves.sid (INTEGER),
Reserves.bid (INTEGER),
Reserves.day (TEXT),
)
CREATE TABLE Sailors (
Sailors.sid (INTEGER),
Sailors.name (TEXT),
Sailors.rating (INTEGER),
Sailors.age (INTEGER),
)
Possible JOINs:
Reserves.sid = Sailors.sid
Reserves.bid = Boats.bid
| Table Boats (
Boats.bid (INTEGER),
Boats.name (TEXT),
Boats.color (TEXT),
)
Table Reserves (
Reserves.sid (INTEGER),
Reserves.bid (INTEGER),
Reserves.day (TEXT),
)
Table Sailors (
Sailors.sid (INTEGER),
Sailors.name (TEXT),
Sailors.rating (INTEGER),
Sailors.age (INTEGER),
)
Possible JOINs:
Reserves.sid = Sailors.sid
Reserves.bid = Boats.bid
| CREATE TABLE Boats (
Boats.bid (INTEGER),
Boats.name (TEXT),
Boats.color (TEXT),
)
CREATE TABLE Reserves (
Reserves.sid (INTEGER),
Reserves.bid (INTEGER),
Reserves.day (TEXT),
)
CREATE TABLE Sailors (
Sailors.sid (INTEGER),
Sailors.name (TEXT),
Sailors.rating (INTEGER),
Sailors.age (INTEGER),
)
Possible JOINs:
Reserves.sid = Sailors.sid
Reserves.bid = Boats.bid
| Table boats (
boats.bid (INTEGER),
boats.name (TEXT),
boats.color (TEXT),
)
Table reserves (
reserves.sid (INTEGER),
reserves.bid (INTEGER),
reserves.day (TEXT),
)
Table sailors (
sailors.sid (INTEGER),
sailors.name (TEXT),
sailors.rating (INTEGER),
sailors.age (INTEGER),
)
Possible JOINs:
reserves.sid = sailors.sid
reserves.bid = boats.bid
| CREATE TABLE boats (
boats.bid (INTEGER),
boats.name (TEXT),
boats.color (TEXT),
)
CREATE TABLE reserves (
reserves.sid (INTEGER),
reserves.bid (INTEGER),
reserves.day (TEXT),
)
CREATE TABLE sailors (
sailors.sid (INTEGER),
sailors.name (TEXT),
sailors.rating (INTEGER),
sailors.age (INTEGER),
)
Possible JOINs:
reserves.sid = sailors.sid
reserves.bid = boats.bid
| {
'Sailors': ['sid', 'name', 'rating', 'age'],
'Boats': ['bid', 'name', 'color'],
'Reserves': ['sid', 'bid', 'day']
} | {
'Sailors': ['sid', 'rating', 'age'],
'Reserves': ['sid', 'bid'],
'Boats': ['bid', 'color']
} | TABLE Boats (
Boats.bid (INTEGER),
Boats.name (TEXT),
Boats.color (TEXT),
)
TABLE Reserves (
Reserves.sid (INTEGER),
Reserves.bid (INTEGER),
Reserves.day (TEXT),
)
TABLE Sailors (
Sailors.sid (INTEGER),
Sailors.name (TEXT),
Sailors.rating (INTEGER),
Sailors.age (INTEGER),
)
Possible JOINs:
Reserves.sid = Sailors.sid
Reserves.bid = Boats.bid
| TABLE Boats (
Boats.bid (INTEGER),
Boats.name (TEXT),
Boats.color (TEXT),
)
TABLE Reserves (
Reserves.sid (INTEGER),
Reserves.bid (INTEGER),
Reserves.day (TEXT),
)
TABLE Sailors (
Sailors.sid (INTEGER),
Sailors.name (TEXT),
Sailors.rating (INTEGER),
Sailors.age (INTEGER),
)
Possible JOINs:
Reserves.sid = Sailors.sid
Reserves.bid = Boats.bid
| TABLE boats (
boats.bid (INTEGER),
boats.name (TEXT),
boats.color (TEXT),
)
TABLE reserves (
reserves.sid (INTEGER),
reserves.bid (INTEGER),
reserves.day (TEXT),
)
TABLE sailors (
sailors.sid (INTEGER),
sailors.name (TEXT),
sailors.rating (INTEGER),
sailors.age (INTEGER),
)
Possible JOINs:
reserves.sid = sailors.sid
reserves.bid = boats.bid
|
real_estate_rentals |
CREATE TABLE "Addresses" (
address_id INTEGER,
line_1_number_building VARCHAR(80),
line_2_number_street VARCHAR(80),
line_3_area_locality VARCHAR(80),
town_city VARCHAR(80),
zip_postcode VARCHAR(20),
county_state_province VARCHAR(80),
country VARCHAR(50),
other_address_details VARCHAR(255),
PRIMARY KEY (address_id)
)
CREATE TABLE "Features" (
feature_id INTEGER,
feature_name VARCHAR(80),
feature_description VARCHAR(80),
PRIMARY KEY (feature_id)
)
CREATE TABLE "Properties" (
property_id INTEGER,
property_address_id INTEGER NOT NULL,
owner_user_id INTEGER NOT NULL,
property_type_code VARCHAR(15) NOT NULL,
date_on_market DATETIME,
date_off_market DATETIME,
property_name VARCHAR(80),
property_description VARCHAR(255),
garage_yn VARCHAR(1),
parking_lots VARCHAR(1),
room_count VARCHAR(10),
vendor_requested_price DOUBLE,
price_min DOUBLE,
price_max DOUBLE,
other_property_details VARCHAR(255),
PRIMARY KEY (property_id),
FOREIGN KEY(property_type_code) REFERENCES "Ref_Property_Types" (property_type_code),
FOREIGN KEY(property_address_id) REFERENCES "Addresses" (address_id),
FOREIGN KEY(owner_user_id) REFERENCES "Users" (user_id)
)
CREATE TABLE "Property_Features" (
property_id INTEGER NOT NULL,
feature_id INTEGER NOT NULL,
feature_value VARCHAR(80),
property_feature_description VARCHAR(80),
FOREIGN KEY(property_id) REFERENCES "Properties" (property_id),
FOREIGN KEY(feature_id) REFERENCES "Features" (feature_id)
)
CREATE TABLE "Property_Photos" (
property_id INTEGER NOT NULL,
photo_seq INTEGER NOT NULL,
photo_title VARCHAR(30),
photo_description VARCHAR(255),
photo_filename VARCHAR(255),
FOREIGN KEY(property_id) REFERENCES "Properties" (property_id)
)
CREATE TABLE "Ref_Age_Categories" (
age_category_code VARCHAR(15),
age_category_description VARCHAR(80),
PRIMARY KEY (age_category_code)
)
CREATE TABLE "Ref_Property_Types" (
property_type_code VARCHAR(15),
property_type_description VARCHAR(80),
PRIMARY KEY (property_type_code)
)
CREATE TABLE "Ref_Room_Types" (
room_type_code VARCHAR(15),
room_type_description VARCHAR(80),
PRIMARY KEY (room_type_code)
)
CREATE TABLE "Ref_User_Categories" (
user_category_code VARCHAR(15),
user_category_description VARCHAR(80),
PRIMARY KEY (user_category_code)
)
CREATE TABLE "Rooms" (
property_id INTEGER NOT NULL,
room_number VARCHAR(10) NOT NULL,
room_type_code VARCHAR(15) NOT NULL,
room_size VARCHAR(20),
other_room_details VARCHAR(255),
FOREIGN KEY(room_type_code) REFERENCES "Ref_Room_Types" (room_type_code),
FOREIGN KEY(property_id) REFERENCES "Properties" (property_id)
)
CREATE TABLE "User_Property_History" (
user_id INTEGER NOT NULL,
property_id INTEGER NOT NULL,
datestamp DATETIME NOT NULL,
FOREIGN KEY(property_id) REFERENCES "Properties" (property_id),
FOREIGN KEY(user_id) REFERENCES "Users" (user_id)
)
CREATE TABLE "User_Searches" (
user_id INTEGER NOT NULL,
search_seq INTEGER NOT NULL,
search_datetime DATETIME,
search_string VARCHAR(80),
FOREIGN KEY(user_id) REFERENCES "Users" (user_id)
)
CREATE TABLE "Users" (
user_id INTEGER,
age_category_code VARCHAR(15),
user_category_code VARCHAR(15),
user_address_id INTEGER NOT NULL,
is_buyer VARCHAR(1),
is_seller VARCHAR(1),
login_name VARCHAR(25),
password VARCHAR(8),
date_registered DATETIME,
first_name VARCHAR(80),
middle_name VARCHAR(80),
last_name VARCHAR(80),
other_user_details VARCHAR(255),
PRIMARY KEY (user_id)
) | How many kinds of room sizes are listed? | easy | Table Addresses (
Addresses.address_id (INTEGER),
Addresses.line_1_number_building (VARCHAR(80)),
Addresses.line_2_number_street (VARCHAR(80)),
Addresses.line_3_area_locality (VARCHAR(80)),
Addresses.town_city (VARCHAR(80)),
Addresses.zip_postcode (VARCHAR(20)),
Addresses.county_state_province (VARCHAR(80)),
Addresses.country (VARCHAR(50)),
Addresses.other_address_details (VARCHAR(255)),
)
Table Features (
Features.feature_id (INTEGER),
Features.feature_name (VARCHAR(80)),
Features.feature_description (VARCHAR(80)),
)
Table Properties (
Properties.property_id (INTEGER),
Properties.property_address_id (INTEGER),
Properties.owner_user_id (INTEGER),
Properties.property_type_code (VARCHAR(15)),
Properties.date_on_market (DATETIME),
Properties.date_off_market (DATETIME),
Properties.property_name (VARCHAR(80)),
Properties.property_description (VARCHAR(255)),
Properties.garage_yn (VARCHAR(1)),
Properties.parking_lots (VARCHAR(1)),
Properties.room_count (VARCHAR(10)),
Properties.vendor_requested_price (DOUBLE),
Properties.price_min (DOUBLE),
Properties.price_max (DOUBLE),
Properties.other_property_details (VARCHAR(255)),
)
Table Property_Features (
Property_Features.property_id (INTEGER),
Property_Features.feature_id (INTEGER),
Property_Features.feature_value (VARCHAR(80)),
Property_Features.property_feature_description (VARCHAR(80)),
)
Table Property_Photos (
Property_Photos.property_id (INTEGER),
Property_Photos.photo_seq (INTEGER),
Property_Photos.photo_title (VARCHAR(30)),
Property_Photos.photo_description (VARCHAR(255)),
Property_Photos.photo_filename (VARCHAR(255)),
)
Table Ref_Age_Categories (
Ref_Age_Categories.age_category_code (VARCHAR(15)),
Ref_Age_Categories.age_category_description (VARCHAR(80)),
)
Table Ref_Property_Types (
Ref_Property_Types.property_type_code (VARCHAR(15)),
Ref_Property_Types.property_type_description (VARCHAR(80)),
)
Table Ref_Room_Types (
Ref_Room_Types.room_type_code (VARCHAR(15)),
Ref_Room_Types.room_type_description (VARCHAR(80)),
)
Table Ref_User_Categories (
Ref_User_Categories.user_category_code (VARCHAR(15)),
Ref_User_Categories.user_category_description (VARCHAR(80)),
)
Table Rooms (
Rooms.property_id (INTEGER),
Rooms.room_number (VARCHAR(10)),
Rooms.room_type_code (VARCHAR(15)),
Rooms.room_size (VARCHAR(20)),
Rooms.other_room_details (VARCHAR(255)),
)
Table User_Property_History (
User_Property_History.user_id (INTEGER),
User_Property_History.property_id (INTEGER),
User_Property_History.datestamp (DATETIME),
)
Table User_Searches (
User_Searches.user_id (INTEGER),
User_Searches.search_seq (INTEGER),
User_Searches.search_datetime (DATETIME),
User_Searches.search_string (VARCHAR(80)),
)
Table Users (
Users.user_id (INTEGER),
Users.age_category_code (VARCHAR(15)),
Users.user_category_code (VARCHAR(15)),
Users.user_address_id (INTEGER),
Users.is_buyer (VARCHAR(1)),
Users.is_seller (VARCHAR(1)),
Users.login_name (VARCHAR(25)),
Users.password (VARCHAR(8)),
Users.date_registered (DATETIME),
Users.first_name (VARCHAR(80)),
Users.middle_name (VARCHAR(80)),
Users.last_name (VARCHAR(80)),
Users.other_user_details (VARCHAR(255)),
)
Possible JOINs:
Properties.property_address_id = Addresses.address_id
Properties.owner_user_id = Users.user_id
Properties.property_type_code = Ref_Property_Types.property_type_code
Property_Features.property_id = Properties.property_id
Property_Features.feature_id = Features.feature_id
Property_Photos.property_id = Properties.property_id
Rooms.property_id = Properties.property_id
Rooms.room_type_code = Ref_Room_Types.room_type_code
User_Property_History.user_id = Users.user_id
User_Property_History.property_id = Properties.property_id
User_Searches.user_id = Users.user_id
| SELECT count(DISTINCT room_size) FROM Rooms; | {
'rooms': ['room_size']
} | CREATE TABLE Addresses (
Addresses.address_id (INTEGER),
Addresses.line_1_number_building (VARCHAR(80)),
Addresses.line_2_number_street (VARCHAR(80)),
Addresses.line_3_area_locality (VARCHAR(80)),
Addresses.town_city (VARCHAR(80)),
Addresses.zip_postcode (VARCHAR(20)),
Addresses.county_state_province (VARCHAR(80)),
Addresses.country (VARCHAR(50)),
Addresses.other_address_details (VARCHAR(255)),
)
CREATE TABLE Features (
Features.feature_id (INTEGER),
Features.feature_name (VARCHAR(80)),
Features.feature_description (VARCHAR(80)),
)
CREATE TABLE Properties (
Properties.property_id (INTEGER),
Properties.property_address_id (INTEGER),
Properties.owner_user_id (INTEGER),
Properties.property_type_code (VARCHAR(15)),
Properties.date_on_market (DATETIME),
Properties.date_off_market (DATETIME),
Properties.property_name (VARCHAR(80)),
Properties.property_description (VARCHAR(255)),
Properties.garage_yn (VARCHAR(1)),
Properties.parking_lots (VARCHAR(1)),
Properties.room_count (VARCHAR(10)),
Properties.vendor_requested_price (DOUBLE),
Properties.price_min (DOUBLE),
Properties.price_max (DOUBLE),
Properties.other_property_details (VARCHAR(255)),
)
CREATE TABLE Property_Features (
Property_Features.property_id (INTEGER),
Property_Features.feature_id (INTEGER),
Property_Features.feature_value (VARCHAR(80)),
Property_Features.property_feature_description (VARCHAR(80)),
)
CREATE TABLE Property_Photos (
Property_Photos.property_id (INTEGER),
Property_Photos.photo_seq (INTEGER),
Property_Photos.photo_title (VARCHAR(30)),
Property_Photos.photo_description (VARCHAR(255)),
Property_Photos.photo_filename (VARCHAR(255)),
)
CREATE TABLE Ref_Age_Categories (
Ref_Age_Categories.age_category_code (VARCHAR(15)),
Ref_Age_Categories.age_category_description (VARCHAR(80)),
)
CREATE TABLE Ref_Property_Types (
Ref_Property_Types.property_type_code (VARCHAR(15)),
Ref_Property_Types.property_type_description (VARCHAR(80)),
)
CREATE TABLE Ref_Room_Types (
Ref_Room_Types.room_type_code (VARCHAR(15)),
Ref_Room_Types.room_type_description (VARCHAR(80)),
)
CREATE TABLE Ref_User_Categories (
Ref_User_Categories.user_category_code (VARCHAR(15)),
Ref_User_Categories.user_category_description (VARCHAR(80)),
)
CREATE TABLE Rooms (
Rooms.property_id (INTEGER),
Rooms.room_number (VARCHAR(10)),
Rooms.room_type_code (VARCHAR(15)),
Rooms.room_size (VARCHAR(20)),
Rooms.other_room_details (VARCHAR(255)),
)
CREATE TABLE User_Property_History (
User_Property_History.user_id (INTEGER),
User_Property_History.property_id (INTEGER),
User_Property_History.datestamp (DATETIME),
)
CREATE TABLE User_Searches (
User_Searches.user_id (INTEGER),
User_Searches.search_seq (INTEGER),
User_Searches.search_datetime (DATETIME),
User_Searches.search_string (VARCHAR(80)),
)
CREATE TABLE Users (
Users.user_id (INTEGER),
Users.age_category_code (VARCHAR(15)),
Users.user_category_code (VARCHAR(15)),
Users.user_address_id (INTEGER),
Users.is_buyer (VARCHAR(1)),
Users.is_seller (VARCHAR(1)),
Users.login_name (VARCHAR(25)),
Users.password (VARCHAR(8)),
Users.date_registered (DATETIME),
Users.first_name (VARCHAR(80)),
Users.middle_name (VARCHAR(80)),
Users.last_name (VARCHAR(80)),
Users.other_user_details (VARCHAR(255)),
)
Possible JOINs:
Properties.property_address_id = Addresses.address_id
Properties.owner_user_id = Users.user_id
Properties.property_type_code = Ref_Property_Types.property_type_code
Property_Features.property_id = Properties.property_id
Property_Features.feature_id = Features.feature_id
Property_Photos.property_id = Properties.property_id
Rooms.property_id = Properties.property_id
Rooms.room_type_code = Ref_Room_Types.room_type_code
User_Property_History.user_id = Users.user_id
User_Property_History.property_id = Properties.property_id
User_Searches.user_id = Users.user_id
| Table Addresses (
Addresses.address_id (INTEGER),
Addresses.line_1_number_building (VARCHAR(80)),
Addresses.line_2_number_street (VARCHAR(80)),
Addresses.line_3_area_locality (VARCHAR(80)),
Addresses.town_city (VARCHAR(80)),
Addresses.zip_postcode (VARCHAR(20)),
Addresses.county_state_province (VARCHAR(80)),
Addresses.country (VARCHAR(50)),
Addresses.other_address_details (VARCHAR(255)),
)
Table Features (
Features.feature_id (INTEGER),
Features.feature_name (VARCHAR(80)),
Features.feature_description (VARCHAR(80)),
)
Table Properties (
Properties.property_id (INTEGER),
Properties.property_address_id (INTEGER),
Properties.owner_user_id (INTEGER),
Properties.property_type_code (VARCHAR(15)),
Properties.date_on_market (DATETIME),
Properties.date_off_market (DATETIME),
Properties.property_name (VARCHAR(80)),
Properties.property_description (VARCHAR(255)),
Properties.garage_yn (VARCHAR(1)),
Properties.parking_lots (VARCHAR(1)),
Properties.room_count (VARCHAR(10)),
Properties.vendor_requested_price (DOUBLE),
Properties.price_min (DOUBLE),
Properties.price_max (DOUBLE),
Properties.other_property_details (VARCHAR(255)),
)
Table Property_Features (
Property_Features.property_id (INTEGER),
Property_Features.feature_id (INTEGER),
Property_Features.feature_value (VARCHAR(80)),
Property_Features.property_feature_description (VARCHAR(80)),
)
Table Property_Photos (
Property_Photos.property_id (INTEGER),
Property_Photos.photo_seq (INTEGER),
Property_Photos.photo_title (VARCHAR(30)),
Property_Photos.photo_description (VARCHAR(255)),
Property_Photos.photo_filename (VARCHAR(255)),
)
Table Ref_Age_Categories (
Ref_Age_Categories.age_category_code (VARCHAR(15)),
Ref_Age_Categories.age_category_description (VARCHAR(80)),
)
Table Ref_Property_Types (
Ref_Property_Types.property_type_code (VARCHAR(15)),
Ref_Property_Types.property_type_description (VARCHAR(80)),
)
Table Ref_Room_Types (
Ref_Room_Types.room_type_code (VARCHAR(15)),
Ref_Room_Types.room_type_description (VARCHAR(80)),
)
Table Ref_User_Categories (
Ref_User_Categories.user_category_code (VARCHAR(15)),
Ref_User_Categories.user_category_description (VARCHAR(80)),
)
Table Rooms (
Rooms.property_id (INTEGER),
Rooms.room_number (VARCHAR(10)),
Rooms.room_type_code (VARCHAR(15)),
Rooms.room_size (VARCHAR(20)),
Rooms.other_room_details (VARCHAR(255)),
)
Table User_Property_History (
User_Property_History.user_id (INTEGER),
User_Property_History.property_id (INTEGER),
User_Property_History.datestamp (DATETIME),
)
Table User_Searches (
User_Searches.user_id (INTEGER),
User_Searches.search_seq (INTEGER),
User_Searches.search_datetime (DATETIME),
User_Searches.search_string (VARCHAR(80)),
)
Table Users (
Users.user_id (INTEGER),
Users.age_category_code (VARCHAR(15)),
Users.user_category_code (VARCHAR(15)),
Users.user_address_id (INTEGER),
Users.is_buyer (VARCHAR(1)),
Users.is_seller (VARCHAR(1)),
Users.login_name (VARCHAR(25)),
Users.password (VARCHAR(8)),
Users.date_registered (DATETIME),
Users.first_name (VARCHAR(80)),
Users.middle_name (VARCHAR(80)),
Users.last_name (VARCHAR(80)),
Users.other_user_details (VARCHAR(255)),
)
Possible JOINs:
Properties.property_address_id = Addresses.address_id
Properties.owner_user_id = Users.user_id
Properties.property_type_code = Ref_Property_Types.property_type_code
Property_Features.property_id = Properties.property_id
Property_Features.feature_id = Features.feature_id
Property_Photos.property_id = Properties.property_id
Rooms.property_id = Properties.property_id
Rooms.room_type_code = Ref_Room_Types.room_type_code
User_Property_History.user_id = Users.user_id
User_Property_History.property_id = Properties.property_id
User_Searches.user_id = Users.user_id
| CREATE TABLE Addresses (
Addresses.address_id (INTEGER),
Addresses.line_1_number_building (VARCHAR(80)),
Addresses.line_2_number_street (VARCHAR(80)),
Addresses.line_3_area_locality (VARCHAR(80)),
Addresses.town_city (VARCHAR(80)),
Addresses.zip_postcode (VARCHAR(20)),
Addresses.county_state_province (VARCHAR(80)),
Addresses.country (VARCHAR(50)),
Addresses.other_address_details (VARCHAR(255)),
)
CREATE TABLE Features (
Features.feature_id (INTEGER),
Features.feature_name (VARCHAR(80)),
Features.feature_description (VARCHAR(80)),
)
CREATE TABLE Properties (
Properties.property_id (INTEGER),
Properties.property_address_id (INTEGER),
Properties.owner_user_id (INTEGER),
Properties.property_type_code (VARCHAR(15)),
Properties.date_on_market (DATETIME),
Properties.date_off_market (DATETIME),
Properties.property_name (VARCHAR(80)),
Properties.property_description (VARCHAR(255)),
Properties.garage_yn (VARCHAR(1)),
Properties.parking_lots (VARCHAR(1)),
Properties.room_count (VARCHAR(10)),
Properties.vendor_requested_price (DOUBLE),
Properties.price_min (DOUBLE),
Properties.price_max (DOUBLE),
Properties.other_property_details (VARCHAR(255)),
)
CREATE TABLE Property_Features (
Property_Features.property_id (INTEGER),
Property_Features.feature_id (INTEGER),
Property_Features.feature_value (VARCHAR(80)),
Property_Features.property_feature_description (VARCHAR(80)),
)
CREATE TABLE Property_Photos (
Property_Photos.property_id (INTEGER),
Property_Photos.photo_seq (INTEGER),
Property_Photos.photo_title (VARCHAR(30)),
Property_Photos.photo_description (VARCHAR(255)),
Property_Photos.photo_filename (VARCHAR(255)),
)
CREATE TABLE Ref_Age_Categories (
Ref_Age_Categories.age_category_code (VARCHAR(15)),
Ref_Age_Categories.age_category_description (VARCHAR(80)),
)
CREATE TABLE Ref_Property_Types (
Ref_Property_Types.property_type_code (VARCHAR(15)),
Ref_Property_Types.property_type_description (VARCHAR(80)),
)
CREATE TABLE Ref_Room_Types (
Ref_Room_Types.room_type_code (VARCHAR(15)),
Ref_Room_Types.room_type_description (VARCHAR(80)),
)
CREATE TABLE Ref_User_Categories (
Ref_User_Categories.user_category_code (VARCHAR(15)),
Ref_User_Categories.user_category_description (VARCHAR(80)),
)
CREATE TABLE Rooms (
Rooms.property_id (INTEGER),
Rooms.room_number (VARCHAR(10)),
Rooms.room_type_code (VARCHAR(15)),
Rooms.room_size (VARCHAR(20)),
Rooms.other_room_details (VARCHAR(255)),
)
CREATE TABLE User_Property_History (
User_Property_History.user_id (INTEGER),
User_Property_History.property_id (INTEGER),
User_Property_History.datestamp (DATETIME),
)
CREATE TABLE User_Searches (
User_Searches.user_id (INTEGER),
User_Searches.search_seq (INTEGER),
User_Searches.search_datetime (DATETIME),
User_Searches.search_string (VARCHAR(80)),
)
CREATE TABLE Users (
Users.user_id (INTEGER),
Users.age_category_code (VARCHAR(15)),
Users.user_category_code (VARCHAR(15)),
Users.user_address_id (INTEGER),
Users.is_buyer (VARCHAR(1)),
Users.is_seller (VARCHAR(1)),
Users.login_name (VARCHAR(25)),
Users.password (VARCHAR(8)),
Users.date_registered (DATETIME),
Users.first_name (VARCHAR(80)),
Users.middle_name (VARCHAR(80)),
Users.last_name (VARCHAR(80)),
Users.other_user_details (VARCHAR(255)),
)
Possible JOINs:
Properties.property_address_id = Addresses.address_id
Properties.owner_user_id = Users.user_id
Properties.property_type_code = Ref_Property_Types.property_type_code
Property_Features.property_id = Properties.property_id
Property_Features.feature_id = Features.feature_id
Property_Photos.property_id = Properties.property_id
Rooms.property_id = Properties.property_id
Rooms.room_type_code = Ref_Room_Types.room_type_code
User_Property_History.user_id = Users.user_id
User_Property_History.property_id = Properties.property_id
User_Searches.user_id = Users.user_id
| Table addresses (
addresses.address_id (INTEGER),
addresses.line_1_number_building (VARCHAR(80)),
addresses.line_2_number_street (VARCHAR(80)),
addresses.line_3_area_locality (VARCHAR(80)),
addresses.town_city (VARCHAR(80)),
addresses.zip_postcode (VARCHAR(20)),
addresses.county_state_province (VARCHAR(80)),
addresses.country (VARCHAR(50)),
addresses.other_address_details (VARCHAR(255)),
)
Table features (
features.feature_id (INTEGER),
features.feature_name (VARCHAR(80)),
features.feature_description (VARCHAR(80)),
)
Table properties (
properties.property_id (INTEGER),
properties.property_address_id (INTEGER),
properties.owner_user_id (INTEGER),
properties.property_type_code (VARCHAR(15)),
properties.date_on_market (DATETIME),
properties.date_off_market (DATETIME),
properties.property_name (VARCHAR(80)),
properties.property_description (VARCHAR(255)),
properties.garage_yn (VARCHAR(1)),
properties.parking_lots (VARCHAR(1)),
properties.room_count (VARCHAR(10)),
properties.vendor_requested_price (DOUBLE),
properties.price_min (DOUBLE),
properties.price_max (DOUBLE),
properties.other_property_details (VARCHAR(255)),
)
Table property_features (
property_features.property_id (INTEGER),
property_features.feature_id (INTEGER),
property_features.feature_value (VARCHAR(80)),
property_features.property_feature_description (VARCHAR(80)),
)
Table property_photos (
property_photos.property_id (INTEGER),
property_photos.photo_seq (INTEGER),
property_photos.photo_title (VARCHAR(30)),
property_photos.photo_description (VARCHAR(255)),
property_photos.photo_filename (VARCHAR(255)),
)
Table ref_age_categories (
ref_age_categories.age_category_code (VARCHAR(15)),
ref_age_categories.age_category_description (VARCHAR(80)),
)
Table ref_property_types (
ref_property_types.property_type_code (VARCHAR(15)),
ref_property_types.property_type_description (VARCHAR(80)),
)
Table ref_room_types (
ref_room_types.room_type_code (VARCHAR(15)),
ref_room_types.room_type_description (VARCHAR(80)),
)
Table ref_user_categories (
ref_user_categories.user_category_code (VARCHAR(15)),
ref_user_categories.user_category_description (VARCHAR(80)),
)
Table rooms (
rooms.property_id (INTEGER),
rooms.room_number (VARCHAR(10)),
rooms.room_type_code (VARCHAR(15)),
rooms.room_size (VARCHAR(20)),
rooms.other_room_details (VARCHAR(255)),
)
Table user_property_history (
user_property_history.user_id (INTEGER),
user_property_history.property_id (INTEGER),
user_property_history.datestamp (DATETIME),
)
Table user_searches (
user_searches.user_id (INTEGER),
user_searches.search_seq (INTEGER),
user_searches.search_datetime (DATETIME),
user_searches.search_string (VARCHAR(80)),
)
Table users (
users.user_id (INTEGER),
users.age_category_code (VARCHAR(15)),
users.user_category_code (VARCHAR(15)),
users.user_address_id (INTEGER),
users.is_buyer (VARCHAR(1)),
users.is_seller (VARCHAR(1)),
users.login_name (VARCHAR(25)),
users.password (VARCHAR(8)),
users.date_registered (DATETIME),
users.first_name (VARCHAR(80)),
users.middle_name (VARCHAR(80)),
users.last_name (VARCHAR(80)),
users.other_user_details (VARCHAR(255)),
)
Possible JOINs:
properties.property_address_id = addresses.address_id
properties.owner_user_id = users.user_id
properties.property_type_code = ref_property_types.property_type_code
property_features.property_id = properties.property_id
property_features.feature_id = features.feature_id
property_photos.property_id = properties.property_id
rooms.property_id = properties.property_id
rooms.room_type_code = ref_room_types.room_type_code
user_property_history.user_id = users.user_id
user_property_history.property_id = properties.property_id
user_searches.user_id = users.user_id
| CREATE TABLE addresses (
addresses.address_id (INTEGER),
addresses.line_1_number_building (VARCHAR(80)),
addresses.line_2_number_street (VARCHAR(80)),
addresses.line_3_area_locality (VARCHAR(80)),
addresses.town_city (VARCHAR(80)),
addresses.zip_postcode (VARCHAR(20)),
addresses.county_state_province (VARCHAR(80)),
addresses.country (VARCHAR(50)),
addresses.other_address_details (VARCHAR(255)),
)
CREATE TABLE features (
features.feature_id (INTEGER),
features.feature_name (VARCHAR(80)),
features.feature_description (VARCHAR(80)),
)
CREATE TABLE properties (
properties.property_id (INTEGER),
properties.property_address_id (INTEGER),
properties.owner_user_id (INTEGER),
properties.property_type_code (VARCHAR(15)),
properties.date_on_market (DATETIME),
properties.date_off_market (DATETIME),
properties.property_name (VARCHAR(80)),
properties.property_description (VARCHAR(255)),
properties.garage_yn (VARCHAR(1)),
properties.parking_lots (VARCHAR(1)),
properties.room_count (VARCHAR(10)),
properties.vendor_requested_price (DOUBLE),
properties.price_min (DOUBLE),
properties.price_max (DOUBLE),
properties.other_property_details (VARCHAR(255)),
)
CREATE TABLE property_features (
property_features.property_id (INTEGER),
property_features.feature_id (INTEGER),
property_features.feature_value (VARCHAR(80)),
property_features.property_feature_description (VARCHAR(80)),
)
CREATE TABLE property_photos (
property_photos.property_id (INTEGER),
property_photos.photo_seq (INTEGER),
property_photos.photo_title (VARCHAR(30)),
property_photos.photo_description (VARCHAR(255)),
property_photos.photo_filename (VARCHAR(255)),
)
CREATE TABLE ref_age_categories (
ref_age_categories.age_category_code (VARCHAR(15)),
ref_age_categories.age_category_description (VARCHAR(80)),
)
CREATE TABLE ref_property_types (
ref_property_types.property_type_code (VARCHAR(15)),
ref_property_types.property_type_description (VARCHAR(80)),
)
CREATE TABLE ref_room_types (
ref_room_types.room_type_code (VARCHAR(15)),
ref_room_types.room_type_description (VARCHAR(80)),
)
CREATE TABLE ref_user_categories (
ref_user_categories.user_category_code (VARCHAR(15)),
ref_user_categories.user_category_description (VARCHAR(80)),
)
CREATE TABLE rooms (
rooms.property_id (INTEGER),
rooms.room_number (VARCHAR(10)),
rooms.room_type_code (VARCHAR(15)),
rooms.room_size (VARCHAR(20)),
rooms.other_room_details (VARCHAR(255)),
)
CREATE TABLE user_property_history (
user_property_history.user_id (INTEGER),
user_property_history.property_id (INTEGER),
user_property_history.datestamp (DATETIME),
)
CREATE TABLE user_searches (
user_searches.user_id (INTEGER),
user_searches.search_seq (INTEGER),
user_searches.search_datetime (DATETIME),
user_searches.search_string (VARCHAR(80)),
)
CREATE TABLE users (
users.user_id (INTEGER),
users.age_category_code (VARCHAR(15)),
users.user_category_code (VARCHAR(15)),
users.user_address_id (INTEGER),
users.is_buyer (VARCHAR(1)),
users.is_seller (VARCHAR(1)),
users.login_name (VARCHAR(25)),
users.password (VARCHAR(8)),
users.date_registered (DATETIME),
users.first_name (VARCHAR(80)),
users.middle_name (VARCHAR(80)),
users.last_name (VARCHAR(80)),
users.other_user_details (VARCHAR(255)),
)
Possible JOINs:
properties.property_address_id = addresses.address_id
properties.owner_user_id = users.user_id
properties.property_type_code = ref_property_types.property_type_code
property_features.property_id = properties.property_id
property_features.feature_id = features.feature_id
property_photos.property_id = properties.property_id
rooms.property_id = properties.property_id
rooms.room_type_code = ref_room_types.room_type_code
user_property_history.user_id = users.user_id
user_property_history.property_id = properties.property_id
user_searches.user_id = users.user_id
| {
'Ref_Age_Categories': ['age_category_code', 'age_category_description'],
'Ref_Property_Types': ['property_type_code', 'property_type_description'],
'Ref_Room_Types': ['room_type_code', 'room_type_description'],
'Ref_User_Categories': ['user_category_code', 'user_category_description'],
'Addresses': ['address_id', 'line_1_number_building', 'line_2_number_street', 'line_3_area_locality', 'town_city', 'zip_postcode', 'county_state_province', 'country', 'other_address_details'],
'Features': ['feature_id', 'feature_name', 'feature_description'],
'Users': ['user_id', 'age_category_code', 'user_category_code', 'user_address_id', 'is_buyer', 'is_seller', 'login_name', 'password', 'date_registered', 'first_name', 'middle_name', 'last_name', 'other_user_details'],
'Properties': ['property_id', 'property_address_id', 'owner_user_id', 'property_type_code', 'date_on_market', 'date_off_market', 'property_name', 'property_description', 'garage_yn', 'parking_lots', 'room_count', 'vendor_requested_price', 'price_min', 'price_max', 'other_property_details'],
'Property_Features': ['property_id', 'feature_id', 'feature_value', 'property_feature_description'],
'Property_Photos': ['property_id', 'photo_seq', 'photo_title', 'photo_description', 'photo_filename'],
'Rooms': ['property_id', 'room_number', 'room_type_code', 'room_size', 'other_room_details'],
'User_Property_History': ['user_id', 'property_id', 'datestamp'],
'User_Searches': ['user_id', 'search_seq', 'search_datetime', 'search_string']
} | {
'Rooms': ['room_size']
} | TABLE Addresses (
Addresses.address_id (INTEGER),
Addresses.line_1_number_building (VARCHAR(80)),
Addresses.line_2_number_street (VARCHAR(80)),
Addresses.line_3_area_locality (VARCHAR(80)),
Addresses.town_city (VARCHAR(80)),
Addresses.zip_postcode (VARCHAR(20)),
Addresses.county_state_province (VARCHAR(80)),
Addresses.country (VARCHAR(50)),
Addresses.other_address_details (VARCHAR(255)),
)
TABLE Features (
Features.feature_id (INTEGER),
Features.feature_name (VARCHAR(80)),
Features.feature_description (VARCHAR(80)),
)
TABLE Properties (
Properties.property_id (INTEGER),
Properties.property_address_id (INTEGER),
Properties.owner_user_id (INTEGER),
Properties.property_type_code (VARCHAR(15)),
Properties.date_on_market (DATETIME),
Properties.date_off_market (DATETIME),
Properties.property_name (VARCHAR(80)),
Properties.property_description (VARCHAR(255)),
Properties.garage_yn (VARCHAR(1)),
Properties.parking_lots (VARCHAR(1)),
Properties.room_count (VARCHAR(10)),
Properties.vendor_requested_price (DOUBLE),
Properties.price_min (DOUBLE),
Properties.price_max (DOUBLE),
Properties.other_property_details (VARCHAR(255)),
)
TABLE Property_Features (
Property_Features.property_id (INTEGER),
Property_Features.feature_id (INTEGER),
Property_Features.feature_value (VARCHAR(80)),
Property_Features.property_feature_description (VARCHAR(80)),
)
TABLE Property_Photos (
Property_Photos.property_id (INTEGER),
Property_Photos.photo_seq (INTEGER),
Property_Photos.photo_title (VARCHAR(30)),
Property_Photos.photo_description (VARCHAR(255)),
Property_Photos.photo_filename (VARCHAR(255)),
)
TABLE Ref_Age_Categories (
Ref_Age_Categories.age_category_code (VARCHAR(15)),
Ref_Age_Categories.age_category_description (VARCHAR(80)),
)
TABLE Ref_Property_Types (
Ref_Property_Types.property_type_code (VARCHAR(15)),
Ref_Property_Types.property_type_description (VARCHAR(80)),
)
TABLE Ref_Room_Types (
Ref_Room_Types.room_type_code (VARCHAR(15)),
Ref_Room_Types.room_type_description (VARCHAR(80)),
)
TABLE Ref_User_Categories (
Ref_User_Categories.user_category_code (VARCHAR(15)),
Ref_User_Categories.user_category_description (VARCHAR(80)),
)
TABLE Rooms (
Rooms.property_id (INTEGER),
Rooms.room_number (VARCHAR(10)),
Rooms.room_type_code (VARCHAR(15)),
Rooms.room_size (VARCHAR(20)),
Rooms.other_room_details (VARCHAR(255)),
)
TABLE User_Property_History (
User_Property_History.user_id (INTEGER),
User_Property_History.property_id (INTEGER),
User_Property_History.datestamp (DATETIME),
)
TABLE User_Searches (
User_Searches.user_id (INTEGER),
User_Searches.search_seq (INTEGER),
User_Searches.search_datetime (DATETIME),
User_Searches.search_string (VARCHAR(80)),
)
TABLE Users (
Users.user_id (INTEGER),
Users.age_category_code (VARCHAR(15)),
Users.user_category_code (VARCHAR(15)),
Users.user_address_id (INTEGER),
Users.is_buyer (VARCHAR(1)),
Users.is_seller (VARCHAR(1)),
Users.login_name (VARCHAR(25)),
Users.password (VARCHAR(8)),
Users.date_registered (DATETIME),
Users.first_name (VARCHAR(80)),
Users.middle_name (VARCHAR(80)),
Users.last_name (VARCHAR(80)),
Users.other_user_details (VARCHAR(255)),
)
Possible JOINs:
Properties.property_address_id = Addresses.address_id
Properties.owner_user_id = Users.user_id
Properties.property_type_code = Ref_Property_Types.property_type_code
Property_Features.property_id = Properties.property_id
Property_Features.feature_id = Features.feature_id
Property_Photos.property_id = Properties.property_id
Rooms.property_id = Properties.property_id
Rooms.room_type_code = Ref_Room_Types.room_type_code
User_Property_History.user_id = Users.user_id
User_Property_History.property_id = Properties.property_id
User_Searches.user_id = Users.user_id
| TABLE Addresses (
Addresses.address_id (INTEGER),
Addresses.line_1_number_building (VARCHAR(80)),
Addresses.line_2_number_street (VARCHAR(80)),
Addresses.line_3_area_locality (VARCHAR(80)),
Addresses.town_city (VARCHAR(80)),
Addresses.zip_postcode (VARCHAR(20)),
Addresses.county_state_province (VARCHAR(80)),
Addresses.country (VARCHAR(50)),
Addresses.other_address_details (VARCHAR(255)),
)
TABLE Features (
Features.feature_id (INTEGER),
Features.feature_name (VARCHAR(80)),
Features.feature_description (VARCHAR(80)),
)
TABLE Properties (
Properties.property_id (INTEGER),
Properties.property_address_id (INTEGER),
Properties.owner_user_id (INTEGER),
Properties.property_type_code (VARCHAR(15)),
Properties.date_on_market (DATETIME),
Properties.date_off_market (DATETIME),
Properties.property_name (VARCHAR(80)),
Properties.property_description (VARCHAR(255)),
Properties.garage_yn (VARCHAR(1)),
Properties.parking_lots (VARCHAR(1)),
Properties.room_count (VARCHAR(10)),
Properties.vendor_requested_price (DOUBLE),
Properties.price_min (DOUBLE),
Properties.price_max (DOUBLE),
Properties.other_property_details (VARCHAR(255)),
)
TABLE Property_Features (
Property_Features.property_id (INTEGER),
Property_Features.feature_id (INTEGER),
Property_Features.feature_value (VARCHAR(80)),
Property_Features.property_feature_description (VARCHAR(80)),
)
TABLE Property_Photos (
Property_Photos.property_id (INTEGER),
Property_Photos.photo_seq (INTEGER),
Property_Photos.photo_title (VARCHAR(30)),
Property_Photos.photo_description (VARCHAR(255)),
Property_Photos.photo_filename (VARCHAR(255)),
)
TABLE Ref_Age_Categories (
Ref_Age_Categories.age_category_code (VARCHAR(15)),
Ref_Age_Categories.age_category_description (VARCHAR(80)),
)
TABLE Ref_Property_Types (
Ref_Property_Types.property_type_code (VARCHAR(15)),
Ref_Property_Types.property_type_description (VARCHAR(80)),
)
TABLE Ref_Room_Types (
Ref_Room_Types.room_type_code (VARCHAR(15)),
Ref_Room_Types.room_type_description (VARCHAR(80)),
)
TABLE Ref_User_Categories (
Ref_User_Categories.user_category_code (VARCHAR(15)),
Ref_User_Categories.user_category_description (VARCHAR(80)),
)
TABLE Rooms (
Rooms.property_id (INTEGER),
Rooms.room_number (VARCHAR(10)),
Rooms.room_type_code (VARCHAR(15)),
Rooms.room_size (VARCHAR(20)),
Rooms.other_room_details (VARCHAR(255)),
)
TABLE User_Property_History (
User_Property_History.user_id (INTEGER),
User_Property_History.property_id (INTEGER),
User_Property_History.datestamp (DATETIME),
)
TABLE User_Searches (
User_Searches.user_id (INTEGER),
User_Searches.search_seq (INTEGER),
User_Searches.search_datetime (DATETIME),
User_Searches.search_string (VARCHAR(80)),
)
TABLE Users (
Users.user_id (INTEGER),
Users.age_category_code (VARCHAR(15)),
Users.user_category_code (VARCHAR(15)),
Users.user_address_id (INTEGER),
Users.is_buyer (VARCHAR(1)),
Users.is_seller (VARCHAR(1)),
Users.login_name (VARCHAR(25)),
Users.password (VARCHAR(8)),
Users.date_registered (DATETIME),
Users.first_name (VARCHAR(80)),
Users.middle_name (VARCHAR(80)),
Users.last_name (VARCHAR(80)),
Users.other_user_details (VARCHAR(255)),
)
Possible JOINs:
Properties.property_address_id = Addresses.address_id
Properties.owner_user_id = Users.user_id
Properties.property_type_code = Ref_Property_Types.property_type_code
Property_Features.property_id = Properties.property_id
Property_Features.feature_id = Features.feature_id
Property_Photos.property_id = Properties.property_id
Rooms.property_id = Properties.property_id
Rooms.room_type_code = Ref_Room_Types.room_type_code
User_Property_History.user_id = Users.user_id
User_Property_History.property_id = Properties.property_id
User_Searches.user_id = Users.user_id
| TABLE addresses (
addresses.address_id (INTEGER),
addresses.line_1_number_building (VARCHAR(80)),
addresses.line_2_number_street (VARCHAR(80)),
addresses.line_3_area_locality (VARCHAR(80)),
addresses.town_city (VARCHAR(80)),
addresses.zip_postcode (VARCHAR(20)),
addresses.county_state_province (VARCHAR(80)),
addresses.country (VARCHAR(50)),
addresses.other_address_details (VARCHAR(255)),
)
TABLE features (
features.feature_id (INTEGER),
features.feature_name (VARCHAR(80)),
features.feature_description (VARCHAR(80)),
)
TABLE properties (
properties.property_id (INTEGER),
properties.property_address_id (INTEGER),
properties.owner_user_id (INTEGER),
properties.property_type_code (VARCHAR(15)),
properties.date_on_market (DATETIME),
properties.date_off_market (DATETIME),
properties.property_name (VARCHAR(80)),
properties.property_description (VARCHAR(255)),
properties.garage_yn (VARCHAR(1)),
properties.parking_lots (VARCHAR(1)),
properties.room_count (VARCHAR(10)),
properties.vendor_requested_price (DOUBLE),
properties.price_min (DOUBLE),
properties.price_max (DOUBLE),
properties.other_property_details (VARCHAR(255)),
)
TABLE property_features (
property_features.property_id (INTEGER),
property_features.feature_id (INTEGER),
property_features.feature_value (VARCHAR(80)),
property_features.property_feature_description (VARCHAR(80)),
)
TABLE property_photos (
property_photos.property_id (INTEGER),
property_photos.photo_seq (INTEGER),
property_photos.photo_title (VARCHAR(30)),
property_photos.photo_description (VARCHAR(255)),
property_photos.photo_filename (VARCHAR(255)),
)
TABLE ref_age_categories (
ref_age_categories.age_category_code (VARCHAR(15)),
ref_age_categories.age_category_description (VARCHAR(80)),
)
TABLE ref_property_types (
ref_property_types.property_type_code (VARCHAR(15)),
ref_property_types.property_type_description (VARCHAR(80)),
)
TABLE ref_room_types (
ref_room_types.room_type_code (VARCHAR(15)),
ref_room_types.room_type_description (VARCHAR(80)),
)
TABLE ref_user_categories (
ref_user_categories.user_category_code (VARCHAR(15)),
ref_user_categories.user_category_description (VARCHAR(80)),
)
TABLE rooms (
rooms.property_id (INTEGER),
rooms.room_number (VARCHAR(10)),
rooms.room_type_code (VARCHAR(15)),
rooms.room_size (VARCHAR(20)),
rooms.other_room_details (VARCHAR(255)),
)
TABLE user_property_history (
user_property_history.user_id (INTEGER),
user_property_history.property_id (INTEGER),
user_property_history.datestamp (DATETIME),
)
TABLE user_searches (
user_searches.user_id (INTEGER),
user_searches.search_seq (INTEGER),
user_searches.search_datetime (DATETIME),
user_searches.search_string (VARCHAR(80)),
)
TABLE users (
users.user_id (INTEGER),
users.age_category_code (VARCHAR(15)),
users.user_category_code (VARCHAR(15)),
users.user_address_id (INTEGER),
users.is_buyer (VARCHAR(1)),
users.is_seller (VARCHAR(1)),
users.login_name (VARCHAR(25)),
users.password (VARCHAR(8)),
users.date_registered (DATETIME),
users.first_name (VARCHAR(80)),
users.middle_name (VARCHAR(80)),
users.last_name (VARCHAR(80)),
users.other_user_details (VARCHAR(255)),
)
Possible JOINs:
properties.property_address_id = addresses.address_id
properties.owner_user_id = users.user_id
properties.property_type_code = ref_property_types.property_type_code
property_features.property_id = properties.property_id
property_features.feature_id = features.feature_id
property_photos.property_id = properties.property_id
rooms.property_id = properties.property_id
rooms.room_type_code = ref_room_types.room_type_code
user_property_history.user_id = users.user_id
user_property_history.property_id = properties.property_id
user_searches.user_id = users.user_id
|
pilot_1 |
CREATE TABLE "Hangar" (
plane_name CHAR(15) NOT NULL,
location CHAR(15),
PRIMARY KEY (plane_name)
)
CREATE TABLE "PilotSkills" (
pilot_name CHAR(15) NOT NULL,
plane_name CHAR(15) NOT NULL,
age INTEGER,
PRIMARY KEY (pilot_name, plane_name),
FOREIGN KEY(plane_name) REFERENCES "Hangar" (plane_name)
) | How many plane B-52 Bomber owned by the pilot who is under 35? | medium | Table Hangar (
Hangar.plane_name (CHAR(15)),
Hangar.location (CHAR(15)),
)
Table PilotSkills (
PilotSkills.pilot_name (CHAR(15)),
PilotSkills.plane_name (CHAR(15)),
PilotSkills.age (INTEGER),
)
Possible JOINs:
PilotSkills.plane_name = Hangar.plane_name
| SELECT count(*) FROM pilotskills WHERE age < 35 AND plane_name = 'B-52 Bomber' | {
'pilotskills': ['pilot_name', 'plane_name', 'age']
} | CREATE TABLE Hangar (
Hangar.plane_name (CHAR(15)),
Hangar.location (CHAR(15)),
)
CREATE TABLE PilotSkills (
PilotSkills.pilot_name (CHAR(15)),
PilotSkills.plane_name (CHAR(15)),
PilotSkills.age (INTEGER),
)
Possible JOINs:
PilotSkills.plane_name = Hangar.plane_name
| Table Hangar (
Hangar.plane_name (CHAR(15)),
Hangar.location (CHAR(15)),
)
Table PilotSkills (
PilotSkills.pilot_name (CHAR(15)),
PilotSkills.plane_name (CHAR(15)),
PilotSkills.age (INTEGER),
)
Possible JOINs:
PilotSkills.plane_name = Hangar.plane_name
| CREATE TABLE Hangar (
Hangar.plane_name (CHAR(15)),
Hangar.location (CHAR(15)),
)
CREATE TABLE PilotSkills (
PilotSkills.pilot_name (CHAR(15)),
PilotSkills.plane_name (CHAR(15)),
PilotSkills.age (INTEGER),
)
Possible JOINs:
PilotSkills.plane_name = Hangar.plane_name
| Table hangar (
hangar.plane_name (CHAR(15)),
hangar.location (CHAR(15)),
)
Table pilotskills (
pilotskills.pilot_name (CHAR(15)),
pilotskills.plane_name (CHAR(15)),
pilotskills.age (INTEGER),
)
Possible JOINs:
pilotskills.plane_name = hangar.plane_name
| CREATE TABLE hangar (
hangar.plane_name (CHAR(15)),
hangar.location (CHAR(15)),
)
CREATE TABLE pilotskills (
pilotskills.pilot_name (CHAR(15)),
pilotskills.plane_name (CHAR(15)),
pilotskills.age (INTEGER),
)
Possible JOINs:
pilotskills.plane_name = hangar.plane_name
| {
'PilotSkills': ['pilot_name', 'plane_name', 'age'],
'Hangar': ['plane_name', 'location']
} | {
'PilotSkills': ['pilot_name', 'plane_name', 'age']
} | TABLE Hangar (
Hangar.plane_name (CHAR(15)),
Hangar.location (CHAR(15)),
)
TABLE PilotSkills (
PilotSkills.pilot_name (CHAR(15)),
PilotSkills.plane_name (CHAR(15)),
PilotSkills.age (INTEGER),
)
Possible JOINs:
PilotSkills.plane_name = Hangar.plane_name
| TABLE Hangar (
Hangar.plane_name (CHAR(15)),
Hangar.location (CHAR(15)),
)
TABLE PilotSkills (
PilotSkills.pilot_name (CHAR(15)),
PilotSkills.plane_name (CHAR(15)),
PilotSkills.age (INTEGER),
)
Possible JOINs:
PilotSkills.plane_name = Hangar.plane_name
| TABLE hangar (
hangar.plane_name (CHAR(15)),
hangar.location (CHAR(15)),
)
TABLE pilotskills (
pilotskills.pilot_name (CHAR(15)),
pilotskills.plane_name (CHAR(15)),
pilotskills.age (INTEGER),
)
Possible JOINs:
pilotskills.plane_name = hangar.plane_name
|
cre_Students_Information_Systems |
CREATE TABLE Students (
`student_id` INTEGER NOT NULL,
`bio_data` VARCHAR(255) NOT NULL,
`student_details` VARCHAR(255) NOT NULL,
PRIMARY KEY (`student_id`)
)
/*
0 rows from Students table:
student_id bio_data student_details
*/
CREATE TABLE Transcripts (
`transcript_id` INTEGER NOT NULL,
`student_id` INTEGER NOT NULL,
`date_of_transcript` DATETIME(3),
`transcript_details` VARCHAR(255) NOT NULL,
PRIMARY KEY (`transcript_id`),
FOREIGN KEY (student_id) REFERENCES Students (student_id)
)
/*
0 rows from Transcripts table:
transcript_id student_id date_of_transcript transcript_details
*/
CREATE TABLE Behaviour_Monitoring (
`behaviour_monitoring_id` INTEGER NOT NULL,
`student_id` INTEGER NOT NULL,
`behaviour_monitoring_details` VARCHAR(255) NOT NULL,
PRIMARY KEY (`behaviour_monitoring_id`),
FOREIGN KEY (student_id) REFERENCES Students (student_id)
)
/*
0 rows from Behaviour_Monitoring table:
behaviour_monitoring_id student_id behaviour_monitoring_details
*/
CREATE TABLE Addresses (
`address_id` INTEGER NOT NULL,
`address_details` VARCHAR(255) NOT NULL,
PRIMARY KEY (`address_id`)
)
/*
0 rows from Addresses table:
address_id address_details
*/
CREATE TABLE Ref_Event_Types (
`event_type_code` CHAR(10) NOT NULL,
`event_type_description` VARCHAR(255) NOT NULL,
PRIMARY KEY (`event_type_code`)
)
/*
0 rows from Ref_Event_Types table:
event_type_code event_type_description
*/
CREATE TABLE Ref_Achievement_Type (
`achievement_type_code` CHAR(15) NOT NULL,
`achievement_type_description` VARCHAR(80),
PRIMARY KEY (`achievement_type_code`)
)
/*
0 rows from Ref_Achievement_Type table:
achievement_type_code achievement_type_description
*/
CREATE TABLE Ref_Address_Types (
`address_type_code` CHAR(10) NOT NULL,
`address_type_description` VARCHAR(255) NOT NULL,
PRIMARY KEY (`address_type_code`)
)
/*
0 rows from Ref_Address_Types table:
address_type_code address_type_description
*/
CREATE TABLE Ref_Detention_Type (
`detention_type_code` CHAR(10) NOT NULL,
`detention_type_description` VARCHAR(80),
PRIMARY KEY (`detention_type_code`)
)
/*
0 rows from Ref_Detention_Type table:
detention_type_code detention_type_description
*/
CREATE TABLE Student_Events (
`event_id` INTEGER NOT NULL,
`event_type_code` CHAR(10) NOT NULL,
`student_id` INTEGER NOT NULL,
`event_date` DATETIME(3),
`other_details` VARCHAR(255) NOT NULL,
PRIMARY KEY (`event_id`),
FOREIGN KEY (student_id) REFERENCES Students (student_id),
FOREIGN KEY (event_type_code) REFERENCES Ref_Event_Types (event_type_code)
)
/*
0 rows from Student_Events table:
event_id event_type_code student_id event_date other_details
*/
CREATE TABLE Teachers (
`teacher_id` INTEGER NOT NULL,
`teacher_details` VARCHAR(255),
PRIMARY KEY (`teacher_id`)
)
/*
0 rows from Teachers table:
teacher_id teacher_details
*/
CREATE TABLE Student_Loans (
`student_loan_id` INTEGER NOT NULL,
`student_id` INTEGER NOT NULL,
`date_of_loan` DATETIME(3),
`amount_of_loan` DECIMAL(15,4),
`other_details` VARCHAR(255),
PRIMARY KEY (`student_loan_id`),
FOREIGN KEY (student_id) REFERENCES Students (student_id)
)
/*
0 rows from Student_Loans table:
student_loan_id student_id date_of_loan amount_of_loan other_details
*/
CREATE TABLE Classes (
`class_id` INTEGER NOT NULL,
`student_id` INTEGER NOT NULL,
`teacher_id` INTEGER NOT NULL,
`class_details` VARCHAR(255) NOT NULL,
PRIMARY KEY (`class_id`),
FOREIGN KEY (student_id) REFERENCES Students (student_id),
FOREIGN KEY (teacher_id) REFERENCES Teachers (teacher_id)
)
/*
0 rows from Classes table:
class_id student_id teacher_id class_details
*/
CREATE TABLE Students_Addresses (
`student_address_id` INTEGER NOT NULL,
`address_id` INTEGER NOT NULL,
`address_type_code` CHAR(10) NOT NULL,
`student_id` INTEGER NOT NULL,
`date_from` DATETIME(3),
`date_to` DATETIME(3),
PRIMARY KEY (`student_address_id`),
FOREIGN KEY (student_id) REFERENCES Students (student_id),
FOREIGN KEY (address_id) REFERENCES Addresses (address_id),
FOREIGN KEY (address_type_code) REFERENCES Ref_Address_Types (address_type_code)
)
/*
0 rows from Students_Addresses table:
student_address_id address_id address_type_code student_id date_from date_to
*/
CREATE TABLE Detention (
`detention_id` INTEGER NOT NULL,
`detention_type_code` CHAR(10) NOT NULL,
`student_id` INTEGER NOT NULL,
`datetime_detention_start` DATETIME(3),
`datetime_detention_end` DATETIME(3),
`detention_summary` VARCHAR(255),
`other_details` VARCHAR(255),
PRIMARY KEY (`detention_id`),
FOREIGN KEY (student_id) REFERENCES Students (student_id),
FOREIGN KEY (detention_type_code) REFERENCES Ref_Detention_Type (detention_type_code)
)
/*
0 rows from Detention table:
detention_id detention_type_code student_id datetime_detention_start datetime_detention_end detention_summary other_details
*/
CREATE TABLE Achievements (
`achievement_id` INTEGER NOT NULL,
`achievement_type_code` CHAR(15) NOT NULL,
`student_id` INTEGER NOT NULL,
`date_achievement` DATETIME(3),
`achievement_details` VARCHAR(255),
`other_details` VARCHAR(255),
PRIMARY KEY (`achievement_id`),
FOREIGN KEY (student_id) REFERENCES Students (student_id),
FOREIGN KEY (achievement_type_code) REFERENCES Ref_Achievement_Type (achievement_type_code)
)
/*
0 rows from Achievements table:
achievement_id achievement_type_code student_id date_achievement achievement_details other_details
*/
| List the details of the teachers who teach some class whose detail has the substring 'data' but do not teach a class whose detail contains the prefix 'net' | extra | Table Achievements (
Achievements.achievement_id (INTEGER),
Achievements.achievement_type_code (CHAR(15)),
Achievements.student_id (INTEGER),
Achievements.date_achievement (DATETIME(3)),
Achievements.achievement_details (VARCHAR(255)),
Achievements.other_details (VARCHAR(255)),
)
Table Addresses (
Addresses.address_id (INTEGER),
Addresses.address_details (VARCHAR(255)),
)
Table Behaviour_Monitoring (
Behaviour_Monitoring.behaviour_monitoring_id (INTEGER),
Behaviour_Monitoring.student_id (INTEGER),
Behaviour_Monitoring.behaviour_monitoring_details (VARCHAR(255)),
)
Table Classes (
Classes.class_id (INTEGER),
Classes.student_id (INTEGER),
Classes.teacher_id (INTEGER),
Classes.class_details (VARCHAR(255)),
)
Table Detention (
Detention.detention_id (INTEGER),
Detention.detention_type_code (CHAR(10)),
Detention.student_id (INTEGER),
Detention.datetime_detention_start (DATETIME(3)),
Detention.datetime_detention_end (DATETIME(3)),
Detention.detention_summary (VARCHAR(255)),
Detention.other_details (VARCHAR(255)),
)
Table Ref_Achievement_Type (
Ref_Achievement_Type.achievement_type_code (CHAR(15)),
Ref_Achievement_Type.achievement_type_description (VARCHAR(80)),
)
Table Ref_Address_Types (
Ref_Address_Types.address_type_code (CHAR(10)),
Ref_Address_Types.address_type_description (VARCHAR(255)),
)
Table Ref_Detention_Type (
Ref_Detention_Type.detention_type_code (CHAR(10)),
Ref_Detention_Type.detention_type_description (VARCHAR(80)),
)
Table Ref_Event_Types (
Ref_Event_Types.event_type_code (CHAR(10)),
Ref_Event_Types.event_type_description (VARCHAR(255)),
)
Table Student_Events (
Student_Events.event_id (INTEGER),
Student_Events.event_type_code (CHAR(10)),
Student_Events.student_id (INTEGER),
Student_Events.event_date (DATETIME(3)),
Student_Events.other_details (VARCHAR(255)),
)
Table Student_Loans (
Student_Loans.student_loan_id (INTEGER),
Student_Loans.student_id (INTEGER),
Student_Loans.date_of_loan (DATETIME(3)),
Student_Loans.amount_of_loan (DECIMAL(15,4)),
Student_Loans.other_details (VARCHAR(255)),
)
Table Students (
Students.student_id (INTEGER),
Students.bio_data (VARCHAR(255)),
Students.student_details (VARCHAR(255)),
)
Table Students_Addresses (
Students_Addresses.student_address_id (INTEGER),
Students_Addresses.address_id (INTEGER),
Students_Addresses.address_type_code (CHAR(10)),
Students_Addresses.student_id (INTEGER),
Students_Addresses.date_from (DATETIME(3)),
Students_Addresses.date_to (DATETIME(3)),
)
Table Teachers (
Teachers.teacher_id (INTEGER),
Teachers.teacher_details (VARCHAR(255)),
)
Table Transcripts (
Transcripts.transcript_id (INTEGER),
Transcripts.student_id (INTEGER),
Transcripts.date_of_transcript (DATETIME(3)),
Transcripts.transcript_details (VARCHAR(255)),
)
Possible JOINs:
Achievements.achievement_type_code = Ref_Achievement_Type.achievement_type_code
Achievements.student_id = Students.student_id
Behaviour_Monitoring.student_id = Students.student_id
Classes.student_id = Students.student_id
Classes.teacher_id = Teachers.teacher_id
Detention.detention_type_code = Ref_Detention_Type.detention_type_code
Detention.student_id = Students.student_id
Student_Events.event_type_code = Ref_Event_Types.event_type_code
Student_Events.student_id = Students.student_id
Student_Loans.student_id = Students.student_id
Students_Addresses.address_id = Addresses.address_id
Students_Addresses.address_type_code = Ref_Address_Types.address_type_code
Students_Addresses.student_id = Students.student_id
Transcripts.student_id = Students.student_id
| SELECT Teachers.teacher_details FROM Teachers JOIN Classes ON Teachers.teacher_id = Classes.teacher_id WHERE Classes.class_details LIKE '%data%' EXCEPT SELECT Teachers.teacher_details FROM Teachers JOIN Classes ON Teachers.teacher_id = Classes.teacher_id WHERE Classes.class_details LIKE 'net%' | {
'teachers': ['teacher_id', 'teacher_details'],
'classes': ['class_id', 'teacher_id', 'class_details']
} | CREATE TABLE Achievements (
Achievements.achievement_id (INTEGER),
Achievements.achievement_type_code (CHAR(15)),
Achievements.student_id (INTEGER),
Achievements.date_achievement (DATETIME(3)),
Achievements.achievement_details (VARCHAR(255)),
Achievements.other_details (VARCHAR(255)),
)
CREATE TABLE Addresses (
Addresses.address_id (INTEGER),
Addresses.address_details (VARCHAR(255)),
)
CREATE TABLE Behaviour_Monitoring (
Behaviour_Monitoring.behaviour_monitoring_id (INTEGER),
Behaviour_Monitoring.student_id (INTEGER),
Behaviour_Monitoring.behaviour_monitoring_details (VARCHAR(255)),
)
CREATE TABLE Classes (
Classes.class_id (INTEGER),
Classes.student_id (INTEGER),
Classes.teacher_id (INTEGER),
Classes.class_details (VARCHAR(255)),
)
CREATE TABLE Detention (
Detention.detention_id (INTEGER),
Detention.detention_type_code (CHAR(10)),
Detention.student_id (INTEGER),
Detention.datetime_detention_start (DATETIME(3)),
Detention.datetime_detention_end (DATETIME(3)),
Detention.detention_summary (VARCHAR(255)),
Detention.other_details (VARCHAR(255)),
)
CREATE TABLE Ref_Achievement_Type (
Ref_Achievement_Type.achievement_type_code (CHAR(15)),
Ref_Achievement_Type.achievement_type_description (VARCHAR(80)),
)
CREATE TABLE Ref_Address_Types (
Ref_Address_Types.address_type_code (CHAR(10)),
Ref_Address_Types.address_type_description (VARCHAR(255)),
)
CREATE TABLE Ref_Detention_Type (
Ref_Detention_Type.detention_type_code (CHAR(10)),
Ref_Detention_Type.detention_type_description (VARCHAR(80)),
)
CREATE TABLE Ref_Event_Types (
Ref_Event_Types.event_type_code (CHAR(10)),
Ref_Event_Types.event_type_description (VARCHAR(255)),
)
CREATE TABLE Student_Events (
Student_Events.event_id (INTEGER),
Student_Events.event_type_code (CHAR(10)),
Student_Events.student_id (INTEGER),
Student_Events.event_date (DATETIME(3)),
Student_Events.other_details (VARCHAR(255)),
)
CREATE TABLE Student_Loans (
Student_Loans.student_loan_id (INTEGER),
Student_Loans.student_id (INTEGER),
Student_Loans.date_of_loan (DATETIME(3)),
Student_Loans.amount_of_loan (DECIMAL(15,4)),
Student_Loans.other_details (VARCHAR(255)),
)
CREATE TABLE Students (
Students.student_id (INTEGER),
Students.bio_data (VARCHAR(255)),
Students.student_details (VARCHAR(255)),
)
CREATE TABLE Students_Addresses (
Students_Addresses.student_address_id (INTEGER),
Students_Addresses.address_id (INTEGER),
Students_Addresses.address_type_code (CHAR(10)),
Students_Addresses.student_id (INTEGER),
Students_Addresses.date_from (DATETIME(3)),
Students_Addresses.date_to (DATETIME(3)),
)
CREATE TABLE Teachers (
Teachers.teacher_id (INTEGER),
Teachers.teacher_details (VARCHAR(255)),
)
CREATE TABLE Transcripts (
Transcripts.transcript_id (INTEGER),
Transcripts.student_id (INTEGER),
Transcripts.date_of_transcript (DATETIME(3)),
Transcripts.transcript_details (VARCHAR(255)),
)
Possible JOINs:
Achievements.achievement_type_code = Ref_Achievement_Type.achievement_type_code
Achievements.student_id = Students.student_id
Behaviour_Monitoring.student_id = Students.student_id
Classes.student_id = Students.student_id
Classes.teacher_id = Teachers.teacher_id
Detention.detention_type_code = Ref_Detention_Type.detention_type_code
Detention.student_id = Students.student_id
Student_Events.event_type_code = Ref_Event_Types.event_type_code
Student_Events.student_id = Students.student_id
Student_Loans.student_id = Students.student_id
Students_Addresses.address_id = Addresses.address_id
Students_Addresses.address_type_code = Ref_Address_Types.address_type_code
Students_Addresses.student_id = Students.student_id
Transcripts.student_id = Students.student_id
| Table Achievements (
Achievements.achievement_id (INTEGER),
Achievements.achievement_type_code (CHAR(15)),
Achievements.student_id (INTEGER),
Achievements.date_achievement (DATETIME(3)),
Achievements.achievement_details (VARCHAR(255)),
Achievements.other_details (VARCHAR(255)),
)
Table Addresses (
Addresses.address_id (INTEGER),
Addresses.address_details (VARCHAR(255)),
)
Table Behaviour_Monitoring (
Behaviour_Monitoring.behaviour_monitoring_id (INTEGER),
Behaviour_Monitoring.student_id (INTEGER),
Behaviour_Monitoring.behaviour_monitoring_details (VARCHAR(255)),
)
Table Classes (
Classes.class_id (INTEGER),
Classes.student_id (INTEGER),
Classes.teacher_id (INTEGER),
Classes.class_details (VARCHAR(255)),
)
Table Detention (
Detention.detention_id (INTEGER),
Detention.detention_type_code (CHAR(10)),
Detention.student_id (INTEGER),
Detention.datetime_detention_start (DATETIME(3)),
Detention.datetime_detention_end (DATETIME(3)),
Detention.detention_summary (VARCHAR(255)),
Detention.other_details (VARCHAR(255)),
)
Table Ref_Achievement_Type (
Ref_Achievement_Type.achievement_type_code (CHAR(15)),
Ref_Achievement_Type.achievement_type_description (VARCHAR(80)),
)
Table Ref_Address_Types (
Ref_Address_Types.address_type_code (CHAR(10)),
Ref_Address_Types.address_type_description (VARCHAR(255)),
)
Table Ref_Detention_Type (
Ref_Detention_Type.detention_type_code (CHAR(10)),
Ref_Detention_Type.detention_type_description (VARCHAR(80)),
)
Table Ref_Event_Types (
Ref_Event_Types.event_type_code (CHAR(10)),
Ref_Event_Types.event_type_description (VARCHAR(255)),
)
Table Student_Events (
Student_Events.event_id (INTEGER),
Student_Events.event_type_code (CHAR(10)),
Student_Events.student_id (INTEGER),
Student_Events.event_date (DATETIME(3)),
Student_Events.other_details (VARCHAR(255)),
)
Table Student_Loans (
Student_Loans.student_loan_id (INTEGER),
Student_Loans.student_id (INTEGER),
Student_Loans.date_of_loan (DATETIME(3)),
Student_Loans.amount_of_loan (DECIMAL(15,4)),
Student_Loans.other_details (VARCHAR(255)),
)
Table Students (
Students.student_id (INTEGER),
Students.bio_data (VARCHAR(255)),
Students.student_details (VARCHAR(255)),
)
Table Students_Addresses (
Students_Addresses.student_address_id (INTEGER),
Students_Addresses.address_id (INTEGER),
Students_Addresses.address_type_code (CHAR(10)),
Students_Addresses.student_id (INTEGER),
Students_Addresses.date_from (DATETIME(3)),
Students_Addresses.date_to (DATETIME(3)),
)
Table Teachers (
Teachers.teacher_id (INTEGER),
Teachers.teacher_details (VARCHAR(255)),
)
Table Transcripts (
Transcripts.transcript_id (INTEGER),
Transcripts.student_id (INTEGER),
Transcripts.date_of_transcript (DATETIME(3)),
Transcripts.transcript_details (VARCHAR(255)),
)
Possible JOINs:
Achievements.achievement_type_code = Ref_Achievement_Type.achievement_type_code
Achievements.student_id = Students.student_id
Behaviour_Monitoring.student_id = Students.student_id
Classes.student_id = Students.student_id
Classes.teacher_id = Teachers.teacher_id
Detention.detention_type_code = Ref_Detention_Type.detention_type_code
Detention.student_id = Students.student_id
Student_Events.event_type_code = Ref_Event_Types.event_type_code
Student_Events.student_id = Students.student_id
Student_Loans.student_id = Students.student_id
Students_Addresses.address_id = Addresses.address_id
Students_Addresses.address_type_code = Ref_Address_Types.address_type_code
Students_Addresses.student_id = Students.student_id
Transcripts.student_id = Students.student_id
| CREATE TABLE Achievements (
Achievements.achievement_id (INTEGER),
Achievements.achievement_type_code (CHAR(15)),
Achievements.student_id (INTEGER),
Achievements.date_achievement (DATETIME(3)),
Achievements.achievement_details (VARCHAR(255)),
Achievements.other_details (VARCHAR(255)),
)
CREATE TABLE Addresses (
Addresses.address_id (INTEGER),
Addresses.address_details (VARCHAR(255)),
)
CREATE TABLE Behaviour_Monitoring (
Behaviour_Monitoring.behaviour_monitoring_id (INTEGER),
Behaviour_Monitoring.student_id (INTEGER),
Behaviour_Monitoring.behaviour_monitoring_details (VARCHAR(255)),
)
CREATE TABLE Classes (
Classes.class_id (INTEGER),
Classes.student_id (INTEGER),
Classes.teacher_id (INTEGER),
Classes.class_details (VARCHAR(255)),
)
CREATE TABLE Detention (
Detention.detention_id (INTEGER),
Detention.detention_type_code (CHAR(10)),
Detention.student_id (INTEGER),
Detention.datetime_detention_start (DATETIME(3)),
Detention.datetime_detention_end (DATETIME(3)),
Detention.detention_summary (VARCHAR(255)),
Detention.other_details (VARCHAR(255)),
)
CREATE TABLE Ref_Achievement_Type (
Ref_Achievement_Type.achievement_type_code (CHAR(15)),
Ref_Achievement_Type.achievement_type_description (VARCHAR(80)),
)
CREATE TABLE Ref_Address_Types (
Ref_Address_Types.address_type_code (CHAR(10)),
Ref_Address_Types.address_type_description (VARCHAR(255)),
)
CREATE TABLE Ref_Detention_Type (
Ref_Detention_Type.detention_type_code (CHAR(10)),
Ref_Detention_Type.detention_type_description (VARCHAR(80)),
)
CREATE TABLE Ref_Event_Types (
Ref_Event_Types.event_type_code (CHAR(10)),
Ref_Event_Types.event_type_description (VARCHAR(255)),
)
CREATE TABLE Student_Events (
Student_Events.event_id (INTEGER),
Student_Events.event_type_code (CHAR(10)),
Student_Events.student_id (INTEGER),
Student_Events.event_date (DATETIME(3)),
Student_Events.other_details (VARCHAR(255)),
)
CREATE TABLE Student_Loans (
Student_Loans.student_loan_id (INTEGER),
Student_Loans.student_id (INTEGER),
Student_Loans.date_of_loan (DATETIME(3)),
Student_Loans.amount_of_loan (DECIMAL(15,4)),
Student_Loans.other_details (VARCHAR(255)),
)
CREATE TABLE Students (
Students.student_id (INTEGER),
Students.bio_data (VARCHAR(255)),
Students.student_details (VARCHAR(255)),
)
CREATE TABLE Students_Addresses (
Students_Addresses.student_address_id (INTEGER),
Students_Addresses.address_id (INTEGER),
Students_Addresses.address_type_code (CHAR(10)),
Students_Addresses.student_id (INTEGER),
Students_Addresses.date_from (DATETIME(3)),
Students_Addresses.date_to (DATETIME(3)),
)
CREATE TABLE Teachers (
Teachers.teacher_id (INTEGER),
Teachers.teacher_details (VARCHAR(255)),
)
CREATE TABLE Transcripts (
Transcripts.transcript_id (INTEGER),
Transcripts.student_id (INTEGER),
Transcripts.date_of_transcript (DATETIME(3)),
Transcripts.transcript_details (VARCHAR(255)),
)
Possible JOINs:
Achievements.achievement_type_code = Ref_Achievement_Type.achievement_type_code
Achievements.student_id = Students.student_id
Behaviour_Monitoring.student_id = Students.student_id
Classes.student_id = Students.student_id
Classes.teacher_id = Teachers.teacher_id
Detention.detention_type_code = Ref_Detention_Type.detention_type_code
Detention.student_id = Students.student_id
Student_Events.event_type_code = Ref_Event_Types.event_type_code
Student_Events.student_id = Students.student_id
Student_Loans.student_id = Students.student_id
Students_Addresses.address_id = Addresses.address_id
Students_Addresses.address_type_code = Ref_Address_Types.address_type_code
Students_Addresses.student_id = Students.student_id
Transcripts.student_id = Students.student_id
| Table achievements (
achievements.achievement_id (INTEGER),
achievements.achievement_type_code (CHAR(15)),
achievements.student_id (INTEGER),
achievements.date_achievement (DATETIME(3)),
achievements.achievement_details (VARCHAR(255)),
achievements.other_details (VARCHAR(255)),
)
Table addresses (
addresses.address_id (INTEGER),
addresses.address_details (VARCHAR(255)),
)
Table behaviour_monitoring (
behaviour_monitoring.behaviour_monitoring_id (INTEGER),
behaviour_monitoring.student_id (INTEGER),
behaviour_monitoring.behaviour_monitoring_details (VARCHAR(255)),
)
Table classes (
classes.class_id (INTEGER),
classes.student_id (INTEGER),
classes.teacher_id (INTEGER),
classes.class_details (VARCHAR(255)),
)
Table detention (
detention.detention_id (INTEGER),
detention.detention_type_code (CHAR(10)),
detention.student_id (INTEGER),
detention.datetime_detention_start (DATETIME(3)),
detention.datetime_detention_end (DATETIME(3)),
detention.detention_summary (VARCHAR(255)),
detention.other_details (VARCHAR(255)),
)
Table ref_achievement_type (
ref_achievement_type.achievement_type_code (CHAR(15)),
ref_achievement_type.achievement_type_description (VARCHAR(80)),
)
Table ref_address_types (
ref_address_types.address_type_code (CHAR(10)),
ref_address_types.address_type_description (VARCHAR(255)),
)
Table ref_detention_type (
ref_detention_type.detention_type_code (CHAR(10)),
ref_detention_type.detention_type_description (VARCHAR(80)),
)
Table ref_event_types (
ref_event_types.event_type_code (CHAR(10)),
ref_event_types.event_type_description (VARCHAR(255)),
)
Table student_events (
student_events.event_id (INTEGER),
student_events.event_type_code (CHAR(10)),
student_events.student_id (INTEGER),
student_events.event_date (DATETIME(3)),
student_events.other_details (VARCHAR(255)),
)
Table student_loans (
student_loans.student_loan_id (INTEGER),
student_loans.student_id (INTEGER),
student_loans.date_of_loan (DATETIME(3)),
student_loans.amount_of_loan (DECIMAL(15,4)),
student_loans.other_details (VARCHAR(255)),
)
Table students (
students.student_id (INTEGER),
students.bio_data (VARCHAR(255)),
students.student_details (VARCHAR(255)),
)
Table students_addresses (
students_addresses.student_address_id (INTEGER),
students_addresses.address_id (INTEGER),
students_addresses.address_type_code (CHAR(10)),
students_addresses.student_id (INTEGER),
students_addresses.date_from (DATETIME(3)),
students_addresses.date_to (DATETIME(3)),
)
Table teachers (
teachers.teacher_id (INTEGER),
teachers.teacher_details (VARCHAR(255)),
)
Table transcripts (
transcripts.transcript_id (INTEGER),
transcripts.student_id (INTEGER),
transcripts.date_of_transcript (DATETIME(3)),
transcripts.transcript_details (VARCHAR(255)),
)
Possible JOINs:
achievements.achievement_type_code = ref_achievement_type.achievement_type_code
achievements.student_id = students.student_id
behaviour_monitoring.student_id = students.student_id
classes.student_id = students.student_id
classes.teacher_id = teachers.teacher_id
detention.detention_type_code = ref_detention_type.detention_type_code
detention.student_id = students.student_id
student_events.event_type_code = ref_event_types.event_type_code
student_events.student_id = students.student_id
student_loans.student_id = students.student_id
students_addresses.address_id = addresses.address_id
students_addresses.address_type_code = ref_address_types.address_type_code
students_addresses.student_id = students.student_id
transcripts.student_id = students.student_id
| CREATE TABLE achievements (
achievements.achievement_id (INTEGER),
achievements.achievement_type_code (CHAR(15)),
achievements.student_id (INTEGER),
achievements.date_achievement (DATETIME(3)),
achievements.achievement_details (VARCHAR(255)),
achievements.other_details (VARCHAR(255)),
)
CREATE TABLE addresses (
addresses.address_id (INTEGER),
addresses.address_details (VARCHAR(255)),
)
CREATE TABLE behaviour_monitoring (
behaviour_monitoring.behaviour_monitoring_id (INTEGER),
behaviour_monitoring.student_id (INTEGER),
behaviour_monitoring.behaviour_monitoring_details (VARCHAR(255)),
)
CREATE TABLE classes (
classes.class_id (INTEGER),
classes.student_id (INTEGER),
classes.teacher_id (INTEGER),
classes.class_details (VARCHAR(255)),
)
CREATE TABLE detention (
detention.detention_id (INTEGER),
detention.detention_type_code (CHAR(10)),
detention.student_id (INTEGER),
detention.datetime_detention_start (DATETIME(3)),
detention.datetime_detention_end (DATETIME(3)),
detention.detention_summary (VARCHAR(255)),
detention.other_details (VARCHAR(255)),
)
CREATE TABLE ref_achievement_type (
ref_achievement_type.achievement_type_code (CHAR(15)),
ref_achievement_type.achievement_type_description (VARCHAR(80)),
)
CREATE TABLE ref_address_types (
ref_address_types.address_type_code (CHAR(10)),
ref_address_types.address_type_description (VARCHAR(255)),
)
CREATE TABLE ref_detention_type (
ref_detention_type.detention_type_code (CHAR(10)),
ref_detention_type.detention_type_description (VARCHAR(80)),
)
CREATE TABLE ref_event_types (
ref_event_types.event_type_code (CHAR(10)),
ref_event_types.event_type_description (VARCHAR(255)),
)
CREATE TABLE student_events (
student_events.event_id (INTEGER),
student_events.event_type_code (CHAR(10)),
student_events.student_id (INTEGER),
student_events.event_date (DATETIME(3)),
student_events.other_details (VARCHAR(255)),
)
CREATE TABLE student_loans (
student_loans.student_loan_id (INTEGER),
student_loans.student_id (INTEGER),
student_loans.date_of_loan (DATETIME(3)),
student_loans.amount_of_loan (DECIMAL(15,4)),
student_loans.other_details (VARCHAR(255)),
)
CREATE TABLE students (
students.student_id (INTEGER),
students.bio_data (VARCHAR(255)),
students.student_details (VARCHAR(255)),
)
CREATE TABLE students_addresses (
students_addresses.student_address_id (INTEGER),
students_addresses.address_id (INTEGER),
students_addresses.address_type_code (CHAR(10)),
students_addresses.student_id (INTEGER),
students_addresses.date_from (DATETIME(3)),
students_addresses.date_to (DATETIME(3)),
)
CREATE TABLE teachers (
teachers.teacher_id (INTEGER),
teachers.teacher_details (VARCHAR(255)),
)
CREATE TABLE transcripts (
transcripts.transcript_id (INTEGER),
transcripts.student_id (INTEGER),
transcripts.date_of_transcript (DATETIME(3)),
transcripts.transcript_details (VARCHAR(255)),
)
Possible JOINs:
achievements.achievement_type_code = ref_achievement_type.achievement_type_code
achievements.student_id = students.student_id
behaviour_monitoring.student_id = students.student_id
classes.student_id = students.student_id
classes.teacher_id = teachers.teacher_id
detention.detention_type_code = ref_detention_type.detention_type_code
detention.student_id = students.student_id
student_events.event_type_code = ref_event_types.event_type_code
student_events.student_id = students.student_id
student_loans.student_id = students.student_id
students_addresses.address_id = addresses.address_id
students_addresses.address_type_code = ref_address_types.address_type_code
students_addresses.student_id = students.student_id
transcripts.student_id = students.student_id
| {
'Students': ['student_id', 'bio_data', 'student_details'],
'Transcripts': ['transcript_id', 'student_id', 'date_of_transcript', 'transcript_details'],
'Behaviour_Monitoring': ['behaviour_monitoring_id', 'student_id', 'behaviour_monitoring_details'],
'Addresses': ['address_id', 'address_details'],
'Ref_Event_Types': ['event_type_code', 'event_type_description'],
'Ref_Achievement_Type': ['achievement_type_code', 'achievement_type_description'],
'Ref_Address_Types': ['address_type_code', 'address_type_description'],
'Ref_Detention_Type': ['detention_type_code', 'detention_type_description'],
'Student_Events': ['event_id', 'event_type_code', 'student_id', 'event_date', 'other_details'],
'Teachers': ['teacher_id', 'teacher_details'],
'Student_Loans': ['student_loan_id', 'student_id', 'date_of_loan', 'amount_of_loan', 'other_details'],
'Classes': ['class_id', 'student_id', 'teacher_id', 'class_details'],
'Students_Addresses': ['student_address_id', 'address_id', 'address_type_code', 'student_id', 'date_from', 'date_to'],
'Detention': ['detention_id', 'detention_type_code', 'student_id', 'datetime_detention_start', 'datetime_detention_end', 'detention_summary', 'other_details'],
'Achievements': ['achievement_id', 'achievement_type_code', 'student_id', 'date_achievement', 'achievement_details', 'other_details']
} | {
'Teachers': ['teacher_id', 'teacher_details'],
'Classes': ['class_id', 'teacher_id', 'class_details']
} | TABLE Achievements (
Achievements.achievement_id (INTEGER),
Achievements.achievement_type_code (CHAR(15)),
Achievements.student_id (INTEGER),
Achievements.date_achievement (DATETIME(3)),
Achievements.achievement_details (VARCHAR(255)),
Achievements.other_details (VARCHAR(255)),
)
TABLE Addresses (
Addresses.address_id (INTEGER),
Addresses.address_details (VARCHAR(255)),
)
TABLE Behaviour_Monitoring (
Behaviour_Monitoring.behaviour_monitoring_id (INTEGER),
Behaviour_Monitoring.student_id (INTEGER),
Behaviour_Monitoring.behaviour_monitoring_details (VARCHAR(255)),
)
TABLE Classes (
Classes.class_id (INTEGER),
Classes.student_id (INTEGER),
Classes.teacher_id (INTEGER),
Classes.class_details (VARCHAR(255)),
)
TABLE Detention (
Detention.detention_id (INTEGER),
Detention.detention_type_code (CHAR(10)),
Detention.student_id (INTEGER),
Detention.datetime_detention_start (DATETIME(3)),
Detention.datetime_detention_end (DATETIME(3)),
Detention.detention_summary (VARCHAR(255)),
Detention.other_details (VARCHAR(255)),
)
TABLE Ref_Achievement_Type (
Ref_Achievement_Type.achievement_type_code (CHAR(15)),
Ref_Achievement_Type.achievement_type_description (VARCHAR(80)),
)
TABLE Ref_Address_Types (
Ref_Address_Types.address_type_code (CHAR(10)),
Ref_Address_Types.address_type_description (VARCHAR(255)),
)
TABLE Ref_Detention_Type (
Ref_Detention_Type.detention_type_code (CHAR(10)),
Ref_Detention_Type.detention_type_description (VARCHAR(80)),
)
TABLE Ref_Event_Types (
Ref_Event_Types.event_type_code (CHAR(10)),
Ref_Event_Types.event_type_description (VARCHAR(255)),
)
TABLE Student_Events (
Student_Events.event_id (INTEGER),
Student_Events.event_type_code (CHAR(10)),
Student_Events.student_id (INTEGER),
Student_Events.event_date (DATETIME(3)),
Student_Events.other_details (VARCHAR(255)),
)
TABLE Student_Loans (
Student_Loans.student_loan_id (INTEGER),
Student_Loans.student_id (INTEGER),
Student_Loans.date_of_loan (DATETIME(3)),
Student_Loans.amount_of_loan (DECIMAL(15,4)),
Student_Loans.other_details (VARCHAR(255)),
)
TABLE Students (
Students.student_id (INTEGER),
Students.bio_data (VARCHAR(255)),
Students.student_details (VARCHAR(255)),
)
TABLE Students_Addresses (
Students_Addresses.student_address_id (INTEGER),
Students_Addresses.address_id (INTEGER),
Students_Addresses.address_type_code (CHAR(10)),
Students_Addresses.student_id (INTEGER),
Students_Addresses.date_from (DATETIME(3)),
Students_Addresses.date_to (DATETIME(3)),
)
TABLE Teachers (
Teachers.teacher_id (INTEGER),
Teachers.teacher_details (VARCHAR(255)),
)
TABLE Transcripts (
Transcripts.transcript_id (INTEGER),
Transcripts.student_id (INTEGER),
Transcripts.date_of_transcript (DATETIME(3)),
Transcripts.transcript_details (VARCHAR(255)),
)
Possible JOINs:
Achievements.achievement_type_code = Ref_Achievement_Type.achievement_type_code
Achievements.student_id = Students.student_id
Behaviour_Monitoring.student_id = Students.student_id
Classes.student_id = Students.student_id
Classes.teacher_id = Teachers.teacher_id
Detention.detention_type_code = Ref_Detention_Type.detention_type_code
Detention.student_id = Students.student_id
Student_Events.event_type_code = Ref_Event_Types.event_type_code
Student_Events.student_id = Students.student_id
Student_Loans.student_id = Students.student_id
Students_Addresses.address_id = Addresses.address_id
Students_Addresses.address_type_code = Ref_Address_Types.address_type_code
Students_Addresses.student_id = Students.student_id
Transcripts.student_id = Students.student_id
| TABLE Achievements (
Achievements.achievement_id (INTEGER),
Achievements.achievement_type_code (CHAR(15)),
Achievements.student_id (INTEGER),
Achievements.date_achievement (DATETIME(3)),
Achievements.achievement_details (VARCHAR(255)),
Achievements.other_details (VARCHAR(255)),
)
TABLE Addresses (
Addresses.address_id (INTEGER),
Addresses.address_details (VARCHAR(255)),
)
TABLE Behaviour_Monitoring (
Behaviour_Monitoring.behaviour_monitoring_id (INTEGER),
Behaviour_Monitoring.student_id (INTEGER),
Behaviour_Monitoring.behaviour_monitoring_details (VARCHAR(255)),
)
TABLE Classes (
Classes.class_id (INTEGER),
Classes.student_id (INTEGER),
Classes.teacher_id (INTEGER),
Classes.class_details (VARCHAR(255)),
)
TABLE Detention (
Detention.detention_id (INTEGER),
Detention.detention_type_code (CHAR(10)),
Detention.student_id (INTEGER),
Detention.datetime_detention_start (DATETIME(3)),
Detention.datetime_detention_end (DATETIME(3)),
Detention.detention_summary (VARCHAR(255)),
Detention.other_details (VARCHAR(255)),
)
TABLE Ref_Achievement_Type (
Ref_Achievement_Type.achievement_type_code (CHAR(15)),
Ref_Achievement_Type.achievement_type_description (VARCHAR(80)),
)
TABLE Ref_Address_Types (
Ref_Address_Types.address_type_code (CHAR(10)),
Ref_Address_Types.address_type_description (VARCHAR(255)),
)
TABLE Ref_Detention_Type (
Ref_Detention_Type.detention_type_code (CHAR(10)),
Ref_Detention_Type.detention_type_description (VARCHAR(80)),
)
TABLE Ref_Event_Types (
Ref_Event_Types.event_type_code (CHAR(10)),
Ref_Event_Types.event_type_description (VARCHAR(255)),
)
TABLE Student_Events (
Student_Events.event_id (INTEGER),
Student_Events.event_type_code (CHAR(10)),
Student_Events.student_id (INTEGER),
Student_Events.event_date (DATETIME(3)),
Student_Events.other_details (VARCHAR(255)),
)
TABLE Student_Loans (
Student_Loans.student_loan_id (INTEGER),
Student_Loans.student_id (INTEGER),
Student_Loans.date_of_loan (DATETIME(3)),
Student_Loans.amount_of_loan (DECIMAL(15,4)),
Student_Loans.other_details (VARCHAR(255)),
)
TABLE Students (
Students.student_id (INTEGER),
Students.bio_data (VARCHAR(255)),
Students.student_details (VARCHAR(255)),
)
TABLE Students_Addresses (
Students_Addresses.student_address_id (INTEGER),
Students_Addresses.address_id (INTEGER),
Students_Addresses.address_type_code (CHAR(10)),
Students_Addresses.student_id (INTEGER),
Students_Addresses.date_from (DATETIME(3)),
Students_Addresses.date_to (DATETIME(3)),
)
TABLE Teachers (
Teachers.teacher_id (INTEGER),
Teachers.teacher_details (VARCHAR(255)),
)
TABLE Transcripts (
Transcripts.transcript_id (INTEGER),
Transcripts.student_id (INTEGER),
Transcripts.date_of_transcript (DATETIME(3)),
Transcripts.transcript_details (VARCHAR(255)),
)
Possible JOINs:
Achievements.achievement_type_code = Ref_Achievement_Type.achievement_type_code
Achievements.student_id = Students.student_id
Behaviour_Monitoring.student_id = Students.student_id
Classes.student_id = Students.student_id
Classes.teacher_id = Teachers.teacher_id
Detention.detention_type_code = Ref_Detention_Type.detention_type_code
Detention.student_id = Students.student_id
Student_Events.event_type_code = Ref_Event_Types.event_type_code
Student_Events.student_id = Students.student_id
Student_Loans.student_id = Students.student_id
Students_Addresses.address_id = Addresses.address_id
Students_Addresses.address_type_code = Ref_Address_Types.address_type_code
Students_Addresses.student_id = Students.student_id
Transcripts.student_id = Students.student_id
| TABLE achievements (
achievements.achievement_id (INTEGER),
achievements.achievement_type_code (CHAR(15)),
achievements.student_id (INTEGER),
achievements.date_achievement (DATETIME(3)),
achievements.achievement_details (VARCHAR(255)),
achievements.other_details (VARCHAR(255)),
)
TABLE addresses (
addresses.address_id (INTEGER),
addresses.address_details (VARCHAR(255)),
)
TABLE behaviour_monitoring (
behaviour_monitoring.behaviour_monitoring_id (INTEGER),
behaviour_monitoring.student_id (INTEGER),
behaviour_monitoring.behaviour_monitoring_details (VARCHAR(255)),
)
TABLE classes (
classes.class_id (INTEGER),
classes.student_id (INTEGER),
classes.teacher_id (INTEGER),
classes.class_details (VARCHAR(255)),
)
TABLE detention (
detention.detention_id (INTEGER),
detention.detention_type_code (CHAR(10)),
detention.student_id (INTEGER),
detention.datetime_detention_start (DATETIME(3)),
detention.datetime_detention_end (DATETIME(3)),
detention.detention_summary (VARCHAR(255)),
detention.other_details (VARCHAR(255)),
)
TABLE ref_achievement_type (
ref_achievement_type.achievement_type_code (CHAR(15)),
ref_achievement_type.achievement_type_description (VARCHAR(80)),
)
TABLE ref_address_types (
ref_address_types.address_type_code (CHAR(10)),
ref_address_types.address_type_description (VARCHAR(255)),
)
TABLE ref_detention_type (
ref_detention_type.detention_type_code (CHAR(10)),
ref_detention_type.detention_type_description (VARCHAR(80)),
)
TABLE ref_event_types (
ref_event_types.event_type_code (CHAR(10)),
ref_event_types.event_type_description (VARCHAR(255)),
)
TABLE student_events (
student_events.event_id (INTEGER),
student_events.event_type_code (CHAR(10)),
student_events.student_id (INTEGER),
student_events.event_date (DATETIME(3)),
student_events.other_details (VARCHAR(255)),
)
TABLE student_loans (
student_loans.student_loan_id (INTEGER),
student_loans.student_id (INTEGER),
student_loans.date_of_loan (DATETIME(3)),
student_loans.amount_of_loan (DECIMAL(15,4)),
student_loans.other_details (VARCHAR(255)),
)
TABLE students (
students.student_id (INTEGER),
students.bio_data (VARCHAR(255)),
students.student_details (VARCHAR(255)),
)
TABLE students_addresses (
students_addresses.student_address_id (INTEGER),
students_addresses.address_id (INTEGER),
students_addresses.address_type_code (CHAR(10)),
students_addresses.student_id (INTEGER),
students_addresses.date_from (DATETIME(3)),
students_addresses.date_to (DATETIME(3)),
)
TABLE teachers (
teachers.teacher_id (INTEGER),
teachers.teacher_details (VARCHAR(255)),
)
TABLE transcripts (
transcripts.transcript_id (INTEGER),
transcripts.student_id (INTEGER),
transcripts.date_of_transcript (DATETIME(3)),
transcripts.transcript_details (VARCHAR(255)),
)
Possible JOINs:
achievements.achievement_type_code = ref_achievement_type.achievement_type_code
achievements.student_id = students.student_id
behaviour_monitoring.student_id = students.student_id
classes.student_id = students.student_id
classes.teacher_id = teachers.teacher_id
detention.detention_type_code = ref_detention_type.detention_type_code
detention.student_id = students.student_id
student_events.event_type_code = ref_event_types.event_type_code
student_events.student_id = students.student_id
student_loans.student_id = students.student_id
students_addresses.address_id = addresses.address_id
students_addresses.address_type_code = ref_address_types.address_type_code
students_addresses.student_id = students.student_id
transcripts.student_id = students.student_id
|
address_1 |
CREATE TABLE "City" (
city_code VARCHAR(3),
city_name VARCHAR(25),
state VARCHAR(2),
country VARCHAR(25),
latitude FLOAT,
longitude FLOAT,
PRIMARY KEY (city_code)
)
CREATE TABLE "Direct_distance" (
city1_code VARCHAR(3),
city2_code VARCHAR(3),
distance INTEGER,
FOREIGN KEY(city1_code) REFERENCES "City" (city_code),
FOREIGN KEY(city2_code) REFERENCES "City" (city_code)
)
CREATE TABLE "Student" (
"StuID" INTEGER,
"LName" VARCHAR(12),
"Fname" VARCHAR(12),
"Age" INTEGER,
"Sex" VARCHAR(1),
"Major" INTEGER,
"Advisor" INTEGER,
city_code VARCHAR(3),
PRIMARY KEY ("StuID"),
FOREIGN KEY(city_code) REFERENCES "City" (city_code)
) | Count the number of coutries. | easy | Table City (
City.city_code (VARCHAR(3)),
City.city_name (VARCHAR(25)),
City.state (VARCHAR(2)),
City.country (VARCHAR(25)),
City.latitude (FLOAT),
City.longitude (FLOAT),
)
Table Direct_distance (
Direct_distance.city1_code (varchar(3)),
Direct_distance.city2_code (varchar(3)),
Direct_distance.distance (INTEGER),
)
Table Student (
Student.StuID (INTEGER),
Student.LName (VARCHAR(12)),
Student.Fname (VARCHAR(12)),
Student.Age (INTEGER),
Student.Sex (VARCHAR(1)),
Student.Major (INTEGER),
Student.Advisor (INTEGER),
Student.city_code (VARCHAR(3)),
)
Possible JOINs:
Direct_distance.city1_code = City.city_code
Direct_distance.city2_code = City.city_code
Student.city_code = City.city_code
| SELECT count(DISTINCT country) FROM City | {
'city': ['city_code', 'country']
} | CREATE TABLE City (
City.city_code (VARCHAR(3)),
City.city_name (VARCHAR(25)),
City.state (VARCHAR(2)),
City.country (VARCHAR(25)),
City.latitude (FLOAT),
City.longitude (FLOAT),
)
CREATE TABLE Direct_distance (
Direct_distance.city1_code (varchar(3)),
Direct_distance.city2_code (varchar(3)),
Direct_distance.distance (INTEGER),
)
CREATE TABLE Student (
Student.StuID (INTEGER),
Student.LName (VARCHAR(12)),
Student.Fname (VARCHAR(12)),
Student.Age (INTEGER),
Student.Sex (VARCHAR(1)),
Student.Major (INTEGER),
Student.Advisor (INTEGER),
Student.city_code (VARCHAR(3)),
)
Possible JOINs:
Direct_distance.city1_code = City.city_code
Direct_distance.city2_code = City.city_code
Student.city_code = City.city_code
| Table City (
City.city_code (VARCHAR(3)),
City.city_name (VARCHAR(25)),
City.state (VARCHAR(2)),
City.country (VARCHAR(25)),
City.latitude (FLOAT),
City.longitude (FLOAT),
)
Table Direct_distance (
Direct_distance.city1_code (varchar(3)),
Direct_distance.city2_code (varchar(3)),
Direct_distance.distance (INTEGER),
)
Table Student (
Student.stuid (INTEGER),
Student.lname (VARCHAR(12)),
Student.fname (VARCHAR(12)),
Student.age (INTEGER),
Student.sex (VARCHAR(1)),
Student.major (INTEGER),
Student.advisor (INTEGER),
Student.city_code (VARCHAR(3)),
)
Possible JOINs:
Direct_distance.city1_code = City.city_code
Direct_distance.city2_code = City.city_code
Student.city_code = City.city_code
| CREATE TABLE City (
City.city_code (VARCHAR(3)),
City.city_name (VARCHAR(25)),
City.state (VARCHAR(2)),
City.country (VARCHAR(25)),
City.latitude (FLOAT),
City.longitude (FLOAT),
)
CREATE TABLE Direct_distance (
Direct_distance.city1_code (varchar(3)),
Direct_distance.city2_code (varchar(3)),
Direct_distance.distance (INTEGER),
)
CREATE TABLE Student (
Student.stuid (INTEGER),
Student.lname (VARCHAR(12)),
Student.fname (VARCHAR(12)),
Student.age (INTEGER),
Student.sex (VARCHAR(1)),
Student.major (INTEGER),
Student.advisor (INTEGER),
Student.city_code (VARCHAR(3)),
)
Possible JOINs:
Direct_distance.city1_code = City.city_code
Direct_distance.city2_code = City.city_code
Student.city_code = City.city_code
| Table city (
city.city_code (VARCHAR(3)),
city.city_name (VARCHAR(25)),
city.state (VARCHAR(2)),
city.country (VARCHAR(25)),
city.latitude (FLOAT),
city.longitude (FLOAT),
)
Table direct_distance (
direct_distance.city1_code (varchar(3)),
direct_distance.city2_code (varchar(3)),
direct_distance.distance (INTEGER),
)
Table student (
student.stuid (INTEGER),
student.lname (VARCHAR(12)),
student.fname (VARCHAR(12)),
student.age (INTEGER),
student.sex (VARCHAR(1)),
student.major (INTEGER),
student.advisor (INTEGER),
student.city_code (VARCHAR(3)),
)
Possible JOINs:
direct_distance.city1_code = city.city_code
direct_distance.city2_code = city.city_code
student.city_code = city.city_code
| CREATE TABLE city (
city.city_code (VARCHAR(3)),
city.city_name (VARCHAR(25)),
city.state (VARCHAR(2)),
city.country (VARCHAR(25)),
city.latitude (FLOAT),
city.longitude (FLOAT),
)
CREATE TABLE direct_distance (
direct_distance.city1_code (varchar(3)),
direct_distance.city2_code (varchar(3)),
direct_distance.distance (INTEGER),
)
CREATE TABLE student (
student.stuid (INTEGER),
student.lname (VARCHAR(12)),
student.fname (VARCHAR(12)),
student.age (INTEGER),
student.sex (VARCHAR(1)),
student.major (INTEGER),
student.advisor (INTEGER),
student.city_code (VARCHAR(3)),
)
Possible JOINs:
direct_distance.city1_code = city.city_code
direct_distance.city2_code = city.city_code
student.city_code = city.city_code
| {
'Student': ['StuID', 'LName', 'Fname', 'Age', 'Sex', 'Major', 'Advisor', 'city_code'],
'Direct_distance': ['city1_code', 'city2_code', 'distance'],
'City': ['city_code', 'city_name', 'state', 'country', 'latitude', 'longitude']
} | {
'City': ['city_code', 'country']
} | TABLE City (
City.city_code (VARCHAR(3)),
City.city_name (VARCHAR(25)),
City.state (VARCHAR(2)),
City.country (VARCHAR(25)),
City.latitude (FLOAT),
City.longitude (FLOAT),
)
TABLE Direct_distance (
Direct_distance.city1_code (varchar(3)),
Direct_distance.city2_code (varchar(3)),
Direct_distance.distance (INTEGER),
)
TABLE Student (
Student.StuID (INTEGER),
Student.LName (VARCHAR(12)),
Student.Fname (VARCHAR(12)),
Student.Age (INTEGER),
Student.Sex (VARCHAR(1)),
Student.Major (INTEGER),
Student.Advisor (INTEGER),
Student.city_code (VARCHAR(3)),
)
Possible JOINs:
Direct_distance.city1_code = City.city_code
Direct_distance.city2_code = City.city_code
Student.city_code = City.city_code
| TABLE City (
City.city_code (VARCHAR(3)),
City.city_name (VARCHAR(25)),
City.state (VARCHAR(2)),
City.country (VARCHAR(25)),
City.latitude (FLOAT),
City.longitude (FLOAT),
)
TABLE Direct_distance (
Direct_distance.city1_code (varchar(3)),
Direct_distance.city2_code (varchar(3)),
Direct_distance.distance (INTEGER),
)
TABLE Student (
Student.stuid (INTEGER),
Student.lname (VARCHAR(12)),
Student.fname (VARCHAR(12)),
Student.age (INTEGER),
Student.sex (VARCHAR(1)),
Student.major (INTEGER),
Student.advisor (INTEGER),
Student.city_code (VARCHAR(3)),
)
Possible JOINs:
Direct_distance.city1_code = City.city_code
Direct_distance.city2_code = City.city_code
Student.city_code = City.city_code
| TABLE city (
city.city_code (VARCHAR(3)),
city.city_name (VARCHAR(25)),
city.state (VARCHAR(2)),
city.country (VARCHAR(25)),
city.latitude (FLOAT),
city.longitude (FLOAT),
)
TABLE direct_distance (
direct_distance.city1_code (varchar(3)),
direct_distance.city2_code (varchar(3)),
direct_distance.distance (INTEGER),
)
TABLE student (
student.stuid (INTEGER),
student.lname (VARCHAR(12)),
student.fname (VARCHAR(12)),
student.age (INTEGER),
student.sex (VARCHAR(1)),
student.major (INTEGER),
student.advisor (INTEGER),
student.city_code (VARCHAR(3)),
)
Possible JOINs:
direct_distance.city1_code = city.city_code
direct_distance.city2_code = city.city_code
student.city_code = city.city_code
|
art_1 |
CREATE TABLE "Artists" (
"artistID" INTEGER,
lname TEXT,
fname TEXT,
"birthYear" INTEGER,
"deathYear" INTEGER,
PRIMARY KEY ("artistID")
)
CREATE TABLE "Paintings" (
"paintingID" INTEGER,
title TEXT,
year INTEGER,
height_mm INTEGER,
width_mm INTEGER,
medium TEXT,
"mediumOn" TEXT,
location TEXT,
"painterID" INTEGER,
PRIMARY KEY ("paintingID"),
FOREIGN KEY("painterID") REFERENCES "Artists" ("artistID")
)
CREATE TABLE "Sculptures" (
"sculptureID" INTEGER,
title TEXT,
year INTEGER,
medium TEXT,
location TEXT,
"sculptorID" INTEGER,
PRIMARY KEY ("sculptureID"),
FOREIGN KEY("sculptorID") REFERENCES "Artists" ("artistID")
) | Find the unique id of the painters who had medium oil paintings exhibited at gallery 240? | medium | Table Artists (
Artists.artistID (INTEGER),
Artists.lname (TEXT),
Artists.fname (TEXT),
Artists.birthYear (INTEGER),
Artists.deathYear (INTEGER),
)
Table Paintings (
Paintings.paintingID (INTEGER),
Paintings.title (TEXT),
Paintings.year (INTEGER),
Paintings.height_mm (INTEGER),
Paintings.width_mm (INTEGER),
Paintings.medium (TEXT),
Paintings.mediumOn (TEXT),
Paintings.location (TEXT),
Paintings.painterID (INTEGER),
)
Table Sculptures (
Sculptures.sculptureID (INTEGER),
Sculptures.title (TEXT),
Sculptures.year (INTEGER),
Sculptures.medium (TEXT),
Sculptures.location (TEXT),
Sculptures.sculptorID (INTEGER),
)
Possible JOINs:
Paintings.painterID = Artists.artistID
Sculptures.sculptorID = Artists.artistID
| SELECT DISTINCT painterID FROM paintings WHERE medium = "oil" AND LOCATION = "Gallery 240" | {
'paintings': ['paintingid', 'medium', 'location', 'painterid']
} | CREATE TABLE Artists (
Artists.artistID (INTEGER),
Artists.lname (TEXT),
Artists.fname (TEXT),
Artists.birthYear (INTEGER),
Artists.deathYear (INTEGER),
)
CREATE TABLE Paintings (
Paintings.paintingID (INTEGER),
Paintings.title (TEXT),
Paintings.year (INTEGER),
Paintings.height_mm (INTEGER),
Paintings.width_mm (INTEGER),
Paintings.medium (TEXT),
Paintings.mediumOn (TEXT),
Paintings.location (TEXT),
Paintings.painterID (INTEGER),
)
CREATE TABLE Sculptures (
Sculptures.sculptureID (INTEGER),
Sculptures.title (TEXT),
Sculptures.year (INTEGER),
Sculptures.medium (TEXT),
Sculptures.location (TEXT),
Sculptures.sculptorID (INTEGER),
)
Possible JOINs:
Paintings.painterID = Artists.artistID
Sculptures.sculptorID = Artists.artistID
| Table Artists (
Artists.artistid (INTEGER),
Artists.lname (TEXT),
Artists.fname (TEXT),
Artists.birthyear (INTEGER),
Artists.deathyear (INTEGER),
)
Table Paintings (
Paintings.paintingid (INTEGER),
Paintings.title (TEXT),
Paintings.year (INTEGER),
Paintings.height_mm (INTEGER),
Paintings.width_mm (INTEGER),
Paintings.medium (TEXT),
Paintings.mediumon (TEXT),
Paintings.location (TEXT),
Paintings.painterid (INTEGER),
)
Table Sculptures (
Sculptures.sculptureid (INTEGER),
Sculptures.title (TEXT),
Sculptures.year (INTEGER),
Sculptures.medium (TEXT),
Sculptures.location (TEXT),
Sculptures.sculptorid (INTEGER),
)
Possible JOINs:
Paintings.painterid = Artists.artistid
Sculptures.sculptorid = Artists.artistid
| CREATE TABLE Artists (
Artists.artistid (INTEGER),
Artists.lname (TEXT),
Artists.fname (TEXT),
Artists.birthyear (INTEGER),
Artists.deathyear (INTEGER),
)
CREATE TABLE Paintings (
Paintings.paintingid (INTEGER),
Paintings.title (TEXT),
Paintings.year (INTEGER),
Paintings.height_mm (INTEGER),
Paintings.width_mm (INTEGER),
Paintings.medium (TEXT),
Paintings.mediumon (TEXT),
Paintings.location (TEXT),
Paintings.painterid (INTEGER),
)
CREATE TABLE Sculptures (
Sculptures.sculptureid (INTEGER),
Sculptures.title (TEXT),
Sculptures.year (INTEGER),
Sculptures.medium (TEXT),
Sculptures.location (TEXT),
Sculptures.sculptorid (INTEGER),
)
Possible JOINs:
Paintings.painterid = Artists.artistid
Sculptures.sculptorid = Artists.artistid
| Table artists (
artists.artistid (INTEGER),
artists.lname (TEXT),
artists.fname (TEXT),
artists.birthyear (INTEGER),
artists.deathyear (INTEGER),
)
Table paintings (
paintings.paintingid (INTEGER),
paintings.title (TEXT),
paintings.year (INTEGER),
paintings.height_mm (INTEGER),
paintings.width_mm (INTEGER),
paintings.medium (TEXT),
paintings.mediumon (TEXT),
paintings.location (TEXT),
paintings.painterid (INTEGER),
)
Table sculptures (
sculptures.sculptureid (INTEGER),
sculptures.title (TEXT),
sculptures.year (INTEGER),
sculptures.medium (TEXT),
sculptures.location (TEXT),
sculptures.sculptorid (INTEGER),
)
Possible JOINs:
paintings.painterid = artists.artistid
sculptures.sculptorid = artists.artistid
| CREATE TABLE artists (
artists.artistid (INTEGER),
artists.lname (TEXT),
artists.fname (TEXT),
artists.birthyear (INTEGER),
artists.deathyear (INTEGER),
)
CREATE TABLE paintings (
paintings.paintingid (INTEGER),
paintings.title (TEXT),
paintings.year (INTEGER),
paintings.height_mm (INTEGER),
paintings.width_mm (INTEGER),
paintings.medium (TEXT),
paintings.mediumon (TEXT),
paintings.location (TEXT),
paintings.painterid (INTEGER),
)
CREATE TABLE sculptures (
sculptures.sculptureid (INTEGER),
sculptures.title (TEXT),
sculptures.year (INTEGER),
sculptures.medium (TEXT),
sculptures.location (TEXT),
sculptures.sculptorid (INTEGER),
)
Possible JOINs:
paintings.painterid = artists.artistid
sculptures.sculptorid = artists.artistid
| {
'Artists': ['artistID', 'lname', 'fname', 'birthYear', 'deathYear'],
'Paintings': ['paintingID', 'title', 'year', 'height_mm', 'width_mm', 'medium', 'mediumOn', 'location', 'painterID'],
'Sculptures': ['sculptureID', 'title', 'year', 'medium', 'location', 'sculptorID']
} | {
'Paintings': ['paintingID', 'medium', 'location', 'painterID']
} | TABLE Artists (
Artists.artistID (INTEGER),
Artists.lname (TEXT),
Artists.fname (TEXT),
Artists.birthYear (INTEGER),
Artists.deathYear (INTEGER),
)
TABLE Paintings (
Paintings.paintingID (INTEGER),
Paintings.title (TEXT),
Paintings.year (INTEGER),
Paintings.height_mm (INTEGER),
Paintings.width_mm (INTEGER),
Paintings.medium (TEXT),
Paintings.mediumOn (TEXT),
Paintings.location (TEXT),
Paintings.painterID (INTEGER),
)
TABLE Sculptures (
Sculptures.sculptureID (INTEGER),
Sculptures.title (TEXT),
Sculptures.year (INTEGER),
Sculptures.medium (TEXT),
Sculptures.location (TEXT),
Sculptures.sculptorID (INTEGER),
)
Possible JOINs:
Paintings.painterID = Artists.artistID
Sculptures.sculptorID = Artists.artistID
| TABLE Artists (
Artists.artistid (INTEGER),
Artists.lname (TEXT),
Artists.fname (TEXT),
Artists.birthyear (INTEGER),
Artists.deathyear (INTEGER),
)
TABLE Paintings (
Paintings.paintingid (INTEGER),
Paintings.title (TEXT),
Paintings.year (INTEGER),
Paintings.height_mm (INTEGER),
Paintings.width_mm (INTEGER),
Paintings.medium (TEXT),
Paintings.mediumon (TEXT),
Paintings.location (TEXT),
Paintings.painterid (INTEGER),
)
TABLE Sculptures (
Sculptures.sculptureid (INTEGER),
Sculptures.title (TEXT),
Sculptures.year (INTEGER),
Sculptures.medium (TEXT),
Sculptures.location (TEXT),
Sculptures.sculptorid (INTEGER),
)
Possible JOINs:
Paintings.painterid = Artists.artistid
Sculptures.sculptorid = Artists.artistid
| TABLE artists (
artists.artistid (INTEGER),
artists.lname (TEXT),
artists.fname (TEXT),
artists.birthyear (INTEGER),
artists.deathyear (INTEGER),
)
TABLE paintings (
paintings.paintingid (INTEGER),
paintings.title (TEXT),
paintings.year (INTEGER),
paintings.height_mm (INTEGER),
paintings.width_mm (INTEGER),
paintings.medium (TEXT),
paintings.mediumon (TEXT),
paintings.location (TEXT),
paintings.painterid (INTEGER),
)
TABLE sculptures (
sculptures.sculptureid (INTEGER),
sculptures.title (TEXT),
sculptures.year (INTEGER),
sculptures.medium (TEXT),
sculptures.location (TEXT),
sculptures.sculptorid (INTEGER),
)
Possible JOINs:
paintings.painterid = artists.artistid
sculptures.sculptorid = artists.artistid
|
conference |
CREATE TABLE conference (
"Conference_ID" INTEGER,
"Conference_Name" TEXT,
"Year" INTEGER,
"Location" TEXT,
PRIMARY KEY ("Conference_ID")
)
CREATE TABLE conference_participation (
"Conference_ID" INTEGER,
"staff_ID" INTEGER,
role TEXT,
PRIMARY KEY ("staff_ID", "Conference_ID"),
FOREIGN KEY("Conference_ID") REFERENCES conference ("Conference_ID"),
FOREIGN KEY("staff_ID") REFERENCES staff ("staff_ID")
)
CREATE TABLE institution (
"Institution_ID" INTEGER,
"Institution_Name" TEXT,
"Location" TEXT,
"Founded" INTEGER,
PRIMARY KEY ("Institution_ID")
)
CREATE TABLE staff (
"staff_ID" INTEGER,
name TEXT,
"Age" INTEGER,
"Nationality" TEXT,
"Institution_ID" INTEGER,
PRIMARY KEY ("staff_ID"),
FOREIGN KEY("Institution_ID") REFERENCES institution ("Institution_ID")
) | What are the names, locations, and founding years for all institutions? | medium | Table conference (
conference.Conference_ID (INT),
conference.Conference_Name (TEXT),
conference.Year (INT),
conference.Location (TEXT),
)
Table conference_participation (
conference_participation.Conference_ID (INT),
conference_participation.staff_ID (INT),
conference_participation.role (TEXT),
)
Table institution (
institution.Institution_ID (INT),
institution.Institution_Name (TEXT),
institution.Location (TEXT),
institution.Founded (INT),
)
Table staff (
staff.staff_ID (INT),
staff.name (TEXT),
staff.Age (INT),
staff.Nationality (TEXT),
staff.Institution_ID (INT),
)
Possible JOINs:
conference_participation.Conference_ID = conference.Conference_ID
conference_participation.staff_ID = staff.staff_ID
staff.Institution_ID = institution.Institution_ID
| SELECT institution_name , LOCATION , founded FROM institution | {
'institution': ['institution_id', 'institution_name', 'location', 'founded']
} | CREATE TABLE conference (
conference.Conference_ID (INT),
conference.Conference_Name (TEXT),
conference.Year (INT),
conference.Location (TEXT),
)
CREATE TABLE conference_participation (
conference_participation.Conference_ID (INT),
conference_participation.staff_ID (INT),
conference_participation.role (TEXT),
)
CREATE TABLE institution (
institution.Institution_ID (INT),
institution.Institution_Name (TEXT),
institution.Location (TEXT),
institution.Founded (INT),
)
CREATE TABLE staff (
staff.staff_ID (INT),
staff.name (TEXT),
staff.Age (INT),
staff.Nationality (TEXT),
staff.Institution_ID (INT),
)
Possible JOINs:
conference_participation.Conference_ID = conference.Conference_ID
conference_participation.staff_ID = staff.staff_ID
staff.Institution_ID = institution.Institution_ID
| Table conference (
conference.conference_id (INT),
conference.conference_name (TEXT),
conference.year (INT),
conference.location (TEXT),
)
Table conference_participation (
conference_participation.conference_id (INT),
conference_participation.staff_id (INT),
conference_participation.role (TEXT),
)
Table institution (
institution.institution_id (INT),
institution.institution_name (TEXT),
institution.location (TEXT),
institution.founded (INT),
)
Table staff (
staff.staff_id (INT),
staff.name (TEXT),
staff.age (INT),
staff.nationality (TEXT),
staff.institution_id (INT),
)
Possible JOINs:
conference_participation.conference_id = conference.conference_id
conference_participation.staff_id = staff.staff_id
staff.institution_id = institution.institution_id
| CREATE TABLE conference (
conference.conference_id (INT),
conference.conference_name (TEXT),
conference.year (INT),
conference.location (TEXT),
)
CREATE TABLE conference_participation (
conference_participation.conference_id (INT),
conference_participation.staff_id (INT),
conference_participation.role (TEXT),
)
CREATE TABLE institution (
institution.institution_id (INT),
institution.institution_name (TEXT),
institution.location (TEXT),
institution.founded (INT),
)
CREATE TABLE staff (
staff.staff_id (INT),
staff.name (TEXT),
staff.age (INT),
staff.nationality (TEXT),
staff.institution_id (INT),
)
Possible JOINs:
conference_participation.conference_id = conference.conference_id
conference_participation.staff_id = staff.staff_id
staff.institution_id = institution.institution_id
| Table conference (
conference.conference_id (INT),
conference.conference_name (TEXT),
conference.year (INT),
conference.location (TEXT),
)
Table conference_participation (
conference_participation.conference_id (INT),
conference_participation.staff_id (INT),
conference_participation.role (TEXT),
)
Table institution (
institution.institution_id (INT),
institution.institution_name (TEXT),
institution.location (TEXT),
institution.founded (INT),
)
Table staff (
staff.staff_id (INT),
staff.name (TEXT),
staff.age (INT),
staff.nationality (TEXT),
staff.institution_id (INT),
)
Possible JOINs:
conference_participation.conference_id = conference.conference_id
conference_participation.staff_id = staff.staff_id
staff.institution_id = institution.institution_id
| CREATE TABLE conference (
conference.conference_id (INT),
conference.conference_name (TEXT),
conference.year (INT),
conference.location (TEXT),
)
CREATE TABLE conference_participation (
conference_participation.conference_id (INT),
conference_participation.staff_id (INT),
conference_participation.role (TEXT),
)
CREATE TABLE institution (
institution.institution_id (INT),
institution.institution_name (TEXT),
institution.location (TEXT),
institution.founded (INT),
)
CREATE TABLE staff (
staff.staff_id (INT),
staff.name (TEXT),
staff.age (INT),
staff.nationality (TEXT),
staff.institution_id (INT),
)
Possible JOINs:
conference_participation.conference_id = conference.conference_id
conference_participation.staff_id = staff.staff_id
staff.institution_id = institution.institution_id
| {
'conference': ['Conference_ID', 'Conference_Name', 'Year', 'Location'],
'institution': ['Institution_ID', 'Institution_Name', 'Location', 'Founded'],
'staff': ['staff_ID', 'name', 'Age', 'Nationality', 'Institution_ID'],
'conference_participation': ['Conference_ID', 'staff_ID', 'role']
} | {
'institution': ['Institution_ID', 'Institution_Name', 'Location', 'Founded']
} | TABLE conference (
conference.Conference_ID (INT),
conference.Conference_Name (TEXT),
conference.Year (INT),
conference.Location (TEXT),
)
TABLE conference_participation (
conference_participation.Conference_ID (INT),
conference_participation.staff_ID (INT),
conference_participation.role (TEXT),
)
TABLE institution (
institution.Institution_ID (INT),
institution.Institution_Name (TEXT),
institution.Location (TEXT),
institution.Founded (INT),
)
TABLE staff (
staff.staff_ID (INT),
staff.name (TEXT),
staff.Age (INT),
staff.Nationality (TEXT),
staff.Institution_ID (INT),
)
Possible JOINs:
conference_participation.Conference_ID = conference.Conference_ID
conference_participation.staff_ID = staff.staff_ID
staff.Institution_ID = institution.Institution_ID
| TABLE conference (
conference.conference_id (INT),
conference.conference_name (TEXT),
conference.year (INT),
conference.location (TEXT),
)
TABLE conference_participation (
conference_participation.conference_id (INT),
conference_participation.staff_id (INT),
conference_participation.role (TEXT),
)
TABLE institution (
institution.institution_id (INT),
institution.institution_name (TEXT),
institution.location (TEXT),
institution.founded (INT),
)
TABLE staff (
staff.staff_id (INT),
staff.name (TEXT),
staff.age (INT),
staff.nationality (TEXT),
staff.institution_id (INT),
)
Possible JOINs:
conference_participation.conference_id = conference.conference_id
conference_participation.staff_id = staff.staff_id
staff.institution_id = institution.institution_id
| TABLE conference (
conference.conference_id (INT),
conference.conference_name (TEXT),
conference.year (INT),
conference.location (TEXT),
)
TABLE conference_participation (
conference_participation.conference_id (INT),
conference_participation.staff_id (INT),
conference_participation.role (TEXT),
)
TABLE institution (
institution.institution_id (INT),
institution.institution_name (TEXT),
institution.location (TEXT),
institution.founded (INT),
)
TABLE staff (
staff.staff_id (INT),
staff.name (TEXT),
staff.age (INT),
staff.nationality (TEXT),
staff.institution_id (INT),
)
Possible JOINs:
conference_participation.conference_id = conference.conference_id
conference_participation.staff_id = staff.staff_id
staff.institution_id = institution.institution_id
|
aan_1 |
CREATE TABLE "Affiliation" (
affiliation_id INTEGER NOT NULL,
name VARCHAR(255) DEFAULT NULL,
address VARCHAR(255) DEFAULT NULL,
PRIMARY KEY (affiliation_id)
)
CREATE TABLE "Author" (
author_id INTEGER NOT NULL,
name VARCHAR(255) DEFAULT NULL,
email VARCHAR(255) DEFAULT NULL,
PRIMARY KEY (author_id)
)
CREATE TABLE "Author_list" (
paper_id VARCHAR(25) NOT NULL,
author_id INTEGER NOT NULL,
affiliation_id INTEGER DEFAULT NULL,
PRIMARY KEY (paper_id, author_id),
FOREIGN KEY(affiliation_id) REFERENCES "Affiliation" (affiliation_id),
FOREIGN KEY(author_id) REFERENCES "Author" (author_id),
FOREIGN KEY(paper_id) REFERENCES "Paper" (paper_id)
)
CREATE TABLE "Citation" (
paper_id VARCHAR(25) NOT NULL,
cited_paper_id VARCHAR(25) NOT NULL,
PRIMARY KEY (paper_id, cited_paper_id),
FOREIGN KEY(cited_paper_id) REFERENCES "Paper" (paper_id),
FOREIGN KEY(paper_id) REFERENCES "Paper" (paper_id)
)
CREATE TABLE "Paper" (
paper_id VARCHAR(25) NOT NULL,
title VARCHAR(255) DEFAULT NULL,
venue VARCHAR(255) DEFAULT NULL,
year INTEGER DEFAULT NULL,
PRIMARY KEY (paper_id)
) | What are the titles and paper ids co-authored by Mckeown, Kathleen and Rambow, Owen? | extra | Table Affiliation (
Affiliation.affiliation_id (INTEGER),
Affiliation.name (varchar(255)),
Affiliation.address (varchar(255)),
)
Table Author (
Author.author_id (INTEGER),
Author.name (varchar(255)),
Author.email (varchar(255)),
)
Table Author_list (
Author_list.paper_id (varchar(25)),
Author_list.author_id (INTEGER),
Author_list.affiliation_id (INTEGER),
)
Table Citation (
Citation.paper_id (varchar(25)),
Citation.cited_paper_id (varchar(25)),
)
Table Paper (
Paper.paper_id (varchar(25)),
Paper.title (varchar(255)),
Paper.venue (varchar(255)),
Paper.year (INTEGER),
)
Possible JOINs:
Author_list.paper_id = Paper.paper_id
Author_list.author_id = Author.author_id
Author_list.affiliation_id = Affiliation.affiliation_id
Citation.paper_id = Paper.paper_id
Citation.cited_paper_id = Paper.paper_id
| SELECT Paper.title , Paper.paper_id FROM Paper JOIN Author_list ON Paper.paper_id = Author_list.paper_id JOIN Author ON Author_list.author_id = Author.author_id WHERE Author.name LIKE "%Mckeown , Kathleen%" INTERSECT SELECT Paper.title , Paper.paper_id FROM Paper JOIN Author_list ON Paper.paper_id = Author_list.paper_id JOIN Author ON Author_list.author_id = Author.author_id WHERE Author.name LIKE "%Rambow , Owen%" | {
'paper': ['paper_id', 'title'],
'author_list': ['paper_id', 'author_id'],
'author': ['author_id', 'name']
} | CREATE TABLE Affiliation (
Affiliation.affiliation_id (INTEGER),
Affiliation.name (varchar(255)),
Affiliation.address (varchar(255)),
)
CREATE TABLE Author (
Author.author_id (INTEGER),
Author.name (varchar(255)),
Author.email (varchar(255)),
)
CREATE TABLE Author_list (
Author_list.paper_id (varchar(25)),
Author_list.author_id (INTEGER),
Author_list.affiliation_id (INTEGER),
)
CREATE TABLE Citation (
Citation.paper_id (varchar(25)),
Citation.cited_paper_id (varchar(25)),
)
CREATE TABLE Paper (
Paper.paper_id (varchar(25)),
Paper.title (varchar(255)),
Paper.venue (varchar(255)),
Paper.year (INTEGER),
)
Possible JOINs:
Author_list.paper_id = Paper.paper_id
Author_list.author_id = Author.author_id
Author_list.affiliation_id = Affiliation.affiliation_id
Citation.paper_id = Paper.paper_id
Citation.cited_paper_id = Paper.paper_id
| Table Affiliation (
Affiliation.affiliation_id (INTEGER),
Affiliation.name (varchar(255)),
Affiliation.address (varchar(255)),
)
Table Author (
Author.author_id (INTEGER),
Author.name (varchar(255)),
Author.email (varchar(255)),
)
Table Author_list (
Author_list.paper_id (varchar(25)),
Author_list.author_id (INTEGER),
Author_list.affiliation_id (INTEGER),
)
Table Citation (
Citation.paper_id (varchar(25)),
Citation.cited_paper_id (varchar(25)),
)
Table Paper (
Paper.paper_id (varchar(25)),
Paper.title (varchar(255)),
Paper.venue (varchar(255)),
Paper.year (INTEGER),
)
Possible JOINs:
Author_list.paper_id = Paper.paper_id
Author_list.author_id = Author.author_id
Author_list.affiliation_id = Affiliation.affiliation_id
Citation.paper_id = Paper.paper_id
Citation.cited_paper_id = Paper.paper_id
| CREATE TABLE Affiliation (
Affiliation.affiliation_id (INTEGER),
Affiliation.name (varchar(255)),
Affiliation.address (varchar(255)),
)
CREATE TABLE Author (
Author.author_id (INTEGER),
Author.name (varchar(255)),
Author.email (varchar(255)),
)
CREATE TABLE Author_list (
Author_list.paper_id (varchar(25)),
Author_list.author_id (INTEGER),
Author_list.affiliation_id (INTEGER),
)
CREATE TABLE Citation (
Citation.paper_id (varchar(25)),
Citation.cited_paper_id (varchar(25)),
)
CREATE TABLE Paper (
Paper.paper_id (varchar(25)),
Paper.title (varchar(255)),
Paper.venue (varchar(255)),
Paper.year (INTEGER),
)
Possible JOINs:
Author_list.paper_id = Paper.paper_id
Author_list.author_id = Author.author_id
Author_list.affiliation_id = Affiliation.affiliation_id
Citation.paper_id = Paper.paper_id
Citation.cited_paper_id = Paper.paper_id
| Table affiliation (
affiliation.affiliation_id (INTEGER),
affiliation.name (varchar(255)),
affiliation.address (varchar(255)),
)
Table author (
author.author_id (INTEGER),
author.name (varchar(255)),
author.email (varchar(255)),
)
Table author_list (
author_list.paper_id (varchar(25)),
author_list.author_id (INTEGER),
author_list.affiliation_id (INTEGER),
)
Table citation (
citation.paper_id (varchar(25)),
citation.cited_paper_id (varchar(25)),
)
Table paper (
paper.paper_id (varchar(25)),
paper.title (varchar(255)),
paper.venue (varchar(255)),
paper.year (INTEGER),
)
Possible JOINs:
author_list.paper_id = paper.paper_id
author_list.author_id = author.author_id
author_list.affiliation_id = affiliation.affiliation_id
citation.paper_id = paper.paper_id
citation.cited_paper_id = paper.paper_id
| CREATE TABLE affiliation (
affiliation.affiliation_id (INTEGER),
affiliation.name (varchar(255)),
affiliation.address (varchar(255)),
)
CREATE TABLE author (
author.author_id (INTEGER),
author.name (varchar(255)),
author.email (varchar(255)),
)
CREATE TABLE author_list (
author_list.paper_id (varchar(25)),
author_list.author_id (INTEGER),
author_list.affiliation_id (INTEGER),
)
CREATE TABLE citation (
citation.paper_id (varchar(25)),
citation.cited_paper_id (varchar(25)),
)
CREATE TABLE paper (
paper.paper_id (varchar(25)),
paper.title (varchar(255)),
paper.venue (varchar(255)),
paper.year (INTEGER),
)
Possible JOINs:
author_list.paper_id = paper.paper_id
author_list.author_id = author.author_id
author_list.affiliation_id = affiliation.affiliation_id
citation.paper_id = paper.paper_id
citation.cited_paper_id = paper.paper_id
| {
'Affiliation': ['affiliation_id', 'name', 'address'],
'Author': ['author_id', 'name', 'email'],
'Author_list': ['paper_id', 'author_id', 'affiliation_id'],
'Citation': ['paper_id', 'cited_paper_id'],
'Paper': ['paper_id', 'title', 'venue', 'year']
} | {
'Paper': ['paper_id', 'title'],
'Author_list': ['paper_id', 'author_id'],
'Author': ['author_id', 'name']
} | TABLE Affiliation (
Affiliation.affiliation_id (INTEGER),
Affiliation.name (varchar(255)),
Affiliation.address (varchar(255)),
)
TABLE Author (
Author.author_id (INTEGER),
Author.name (varchar(255)),
Author.email (varchar(255)),
)
TABLE Author_list (
Author_list.paper_id (varchar(25)),
Author_list.author_id (INTEGER),
Author_list.affiliation_id (INTEGER),
)
TABLE Citation (
Citation.paper_id (varchar(25)),
Citation.cited_paper_id (varchar(25)),
)
TABLE Paper (
Paper.paper_id (varchar(25)),
Paper.title (varchar(255)),
Paper.venue (varchar(255)),
Paper.year (INTEGER),
)
Possible JOINs:
Author_list.paper_id = Paper.paper_id
Author_list.author_id = Author.author_id
Author_list.affiliation_id = Affiliation.affiliation_id
Citation.paper_id = Paper.paper_id
Citation.cited_paper_id = Paper.paper_id
| TABLE Affiliation (
Affiliation.affiliation_id (INTEGER),
Affiliation.name (varchar(255)),
Affiliation.address (varchar(255)),
)
TABLE Author (
Author.author_id (INTEGER),
Author.name (varchar(255)),
Author.email (varchar(255)),
)
TABLE Author_list (
Author_list.paper_id (varchar(25)),
Author_list.author_id (INTEGER),
Author_list.affiliation_id (INTEGER),
)
TABLE Citation (
Citation.paper_id (varchar(25)),
Citation.cited_paper_id (varchar(25)),
)
TABLE Paper (
Paper.paper_id (varchar(25)),
Paper.title (varchar(255)),
Paper.venue (varchar(255)),
Paper.year (INTEGER),
)
Possible JOINs:
Author_list.paper_id = Paper.paper_id
Author_list.author_id = Author.author_id
Author_list.affiliation_id = Affiliation.affiliation_id
Citation.paper_id = Paper.paper_id
Citation.cited_paper_id = Paper.paper_id
| TABLE affiliation (
affiliation.affiliation_id (INTEGER),
affiliation.name (varchar(255)),
affiliation.address (varchar(255)),
)
TABLE author (
author.author_id (INTEGER),
author.name (varchar(255)),
author.email (varchar(255)),
)
TABLE author_list (
author_list.paper_id (varchar(25)),
author_list.author_id (INTEGER),
author_list.affiliation_id (INTEGER),
)
TABLE citation (
citation.paper_id (varchar(25)),
citation.cited_paper_id (varchar(25)),
)
TABLE paper (
paper.paper_id (varchar(25)),
paper.title (varchar(255)),
paper.venue (varchar(255)),
paper.year (INTEGER),
)
Possible JOINs:
author_list.paper_id = paper.paper_id
author_list.author_id = author.author_id
author_list.affiliation_id = affiliation.affiliation_id
citation.paper_id = paper.paper_id
citation.cited_paper_id = paper.paper_id
|
customers_and_orders |
CREATE TABLE "Addresses" (
address_id INTEGER,
address_details VARCHAR(255),
PRIMARY KEY (address_id)
)
CREATE TABLE "Customer_Orders" (
order_id INTEGER,
customer_id INTEGER NOT NULL,
order_date DATETIME NOT NULL,
order_status_code VARCHAR(15),
PRIMARY KEY (order_id),
FOREIGN KEY(customer_id) REFERENCES "Customers" (customer_id)
)
CREATE TABLE "Customers" (
customer_id INTEGER,
address_id INTEGER NOT NULL,
payment_method_code VARCHAR(15),
customer_number VARCHAR(20),
customer_name VARCHAR(80),
customer_address VARCHAR(255),
customer_phone VARCHAR(80),
customer_email VARCHAR(80),
PRIMARY KEY (customer_id)
)
CREATE TABLE "Order_Items" (
order_item_id INTEGER NOT NULL,
order_id INTEGER NOT NULL,
product_id INTEGER NOT NULL,
order_quantity VARCHAR(80),
FOREIGN KEY(product_id) REFERENCES "Products" (product_id),
FOREIGN KEY(order_id) REFERENCES "Customer_Orders" (order_id)
)
CREATE TABLE "Products" (
product_id INTEGER,
product_type_code VARCHAR(15),
product_name VARCHAR(80),
product_price DOUBLE,
PRIMARY KEY (product_id)
) | Count the number of customers who have not made an order. | extra | Table Addresses (
Addresses.address_id (INTEGER),
Addresses.address_details (VARCHAR(255)),
)
Table Customer_Orders (
Customer_Orders.order_id (INTEGER),
Customer_Orders.customer_id (INTEGER),
Customer_Orders.order_date (DATETIME),
Customer_Orders.order_status_code (VARCHAR(15)),
)
Table Customers (
Customers.customer_id (INTEGER),
Customers.address_id (INTEGER),
Customers.payment_method_code (VARCHAR(15)),
Customers.customer_number (VARCHAR(20)),
Customers.customer_name (VARCHAR(80)),
Customers.customer_address (VARCHAR(255)),
Customers.customer_phone (VARCHAR(80)),
Customers.customer_email (VARCHAR(80)),
)
Table Order_Items (
Order_Items.order_item_id (INTEGER),
Order_Items.order_id (INTEGER),
Order_Items.product_id (INTEGER),
Order_Items.order_quantity (VARCHAR(80)),
)
Table Products (
Products.product_id (INTEGER),
Products.product_type_code (VARCHAR(15)),
Products.product_name (VARCHAR(80)),
Products.product_price (DOUBLE),
)
Possible JOINs:
Customer_Orders.customer_id = Customers.customer_id
Order_Items.order_id = Customer_Orders.order_id
Order_Items.product_id = Products.product_id
| SELECT count(*) FROM Customers WHERE customer_id NOT IN ( SELECT customer_id FROM Customer_orders) | {
'customers': ['customer_id'],
'customer_orders': ['order_id', 'customer_id']
} | CREATE TABLE Addresses (
Addresses.address_id (INTEGER),
Addresses.address_details (VARCHAR(255)),
)
CREATE TABLE Customer_Orders (
Customer_Orders.order_id (INTEGER),
Customer_Orders.customer_id (INTEGER),
Customer_Orders.order_date (DATETIME),
Customer_Orders.order_status_code (VARCHAR(15)),
)
CREATE TABLE Customers (
Customers.customer_id (INTEGER),
Customers.address_id (INTEGER),
Customers.payment_method_code (VARCHAR(15)),
Customers.customer_number (VARCHAR(20)),
Customers.customer_name (VARCHAR(80)),
Customers.customer_address (VARCHAR(255)),
Customers.customer_phone (VARCHAR(80)),
Customers.customer_email (VARCHAR(80)),
)
CREATE TABLE Order_Items (
Order_Items.order_item_id (INTEGER),
Order_Items.order_id (INTEGER),
Order_Items.product_id (INTEGER),
Order_Items.order_quantity (VARCHAR(80)),
)
CREATE TABLE Products (
Products.product_id (INTEGER),
Products.product_type_code (VARCHAR(15)),
Products.product_name (VARCHAR(80)),
Products.product_price (DOUBLE),
)
Possible JOINs:
Customer_Orders.customer_id = Customers.customer_id
Order_Items.order_id = Customer_Orders.order_id
Order_Items.product_id = Products.product_id
| Table Addresses (
Addresses.address_id (INTEGER),
Addresses.address_details (VARCHAR(255)),
)
Table Customer_Orders (
Customer_Orders.order_id (INTEGER),
Customer_Orders.customer_id (INTEGER),
Customer_Orders.order_date (DATETIME),
Customer_Orders.order_status_code (VARCHAR(15)),
)
Table Customers (
Customers.customer_id (INTEGER),
Customers.address_id (INTEGER),
Customers.payment_method_code (VARCHAR(15)),
Customers.customer_number (VARCHAR(20)),
Customers.customer_name (VARCHAR(80)),
Customers.customer_address (VARCHAR(255)),
Customers.customer_phone (VARCHAR(80)),
Customers.customer_email (VARCHAR(80)),
)
Table Order_Items (
Order_Items.order_item_id (INTEGER),
Order_Items.order_id (INTEGER),
Order_Items.product_id (INTEGER),
Order_Items.order_quantity (VARCHAR(80)),
)
Table Products (
Products.product_id (INTEGER),
Products.product_type_code (VARCHAR(15)),
Products.product_name (VARCHAR(80)),
Products.product_price (DOUBLE),
)
Possible JOINs:
Customer_Orders.customer_id = Customers.customer_id
Order_Items.order_id = Customer_Orders.order_id
Order_Items.product_id = Products.product_id
| CREATE TABLE Addresses (
Addresses.address_id (INTEGER),
Addresses.address_details (VARCHAR(255)),
)
CREATE TABLE Customer_Orders (
Customer_Orders.order_id (INTEGER),
Customer_Orders.customer_id (INTEGER),
Customer_Orders.order_date (DATETIME),
Customer_Orders.order_status_code (VARCHAR(15)),
)
CREATE TABLE Customers (
Customers.customer_id (INTEGER),
Customers.address_id (INTEGER),
Customers.payment_method_code (VARCHAR(15)),
Customers.customer_number (VARCHAR(20)),
Customers.customer_name (VARCHAR(80)),
Customers.customer_address (VARCHAR(255)),
Customers.customer_phone (VARCHAR(80)),
Customers.customer_email (VARCHAR(80)),
)
CREATE TABLE Order_Items (
Order_Items.order_item_id (INTEGER),
Order_Items.order_id (INTEGER),
Order_Items.product_id (INTEGER),
Order_Items.order_quantity (VARCHAR(80)),
)
CREATE TABLE Products (
Products.product_id (INTEGER),
Products.product_type_code (VARCHAR(15)),
Products.product_name (VARCHAR(80)),
Products.product_price (DOUBLE),
)
Possible JOINs:
Customer_Orders.customer_id = Customers.customer_id
Order_Items.order_id = Customer_Orders.order_id
Order_Items.product_id = Products.product_id
| Table addresses (
addresses.address_id (INTEGER),
addresses.address_details (VARCHAR(255)),
)
Table customer_orders (
customer_orders.order_id (INTEGER),
customer_orders.customer_id (INTEGER),
customer_orders.order_date (DATETIME),
customer_orders.order_status_code (VARCHAR(15)),
)
Table customers (
customers.customer_id (INTEGER),
customers.address_id (INTEGER),
customers.payment_method_code (VARCHAR(15)),
customers.customer_number (VARCHAR(20)),
customers.customer_name (VARCHAR(80)),
customers.customer_address (VARCHAR(255)),
customers.customer_phone (VARCHAR(80)),
customers.customer_email (VARCHAR(80)),
)
Table order_items (
order_items.order_item_id (INTEGER),
order_items.order_id (INTEGER),
order_items.product_id (INTEGER),
order_items.order_quantity (VARCHAR(80)),
)
Table products (
products.product_id (INTEGER),
products.product_type_code (VARCHAR(15)),
products.product_name (VARCHAR(80)),
products.product_price (DOUBLE),
)
Possible JOINs:
customer_orders.customer_id = customers.customer_id
order_items.order_id = customer_orders.order_id
order_items.product_id = products.product_id
| CREATE TABLE addresses (
addresses.address_id (INTEGER),
addresses.address_details (VARCHAR(255)),
)
CREATE TABLE customer_orders (
customer_orders.order_id (INTEGER),
customer_orders.customer_id (INTEGER),
customer_orders.order_date (DATETIME),
customer_orders.order_status_code (VARCHAR(15)),
)
CREATE TABLE customers (
customers.customer_id (INTEGER),
customers.address_id (INTEGER),
customers.payment_method_code (VARCHAR(15)),
customers.customer_number (VARCHAR(20)),
customers.customer_name (VARCHAR(80)),
customers.customer_address (VARCHAR(255)),
customers.customer_phone (VARCHAR(80)),
customers.customer_email (VARCHAR(80)),
)
CREATE TABLE order_items (
order_items.order_item_id (INTEGER),
order_items.order_id (INTEGER),
order_items.product_id (INTEGER),
order_items.order_quantity (VARCHAR(80)),
)
CREATE TABLE products (
products.product_id (INTEGER),
products.product_type_code (VARCHAR(15)),
products.product_name (VARCHAR(80)),
products.product_price (DOUBLE),
)
Possible JOINs:
customer_orders.customer_id = customers.customer_id
order_items.order_id = customer_orders.order_id
order_items.product_id = products.product_id
| {
'Products': ['product_id', 'product_type_code', 'product_name', 'product_price'],
'Addresses': ['address_id', 'address_details'],
'Customers': ['customer_id', 'address_id', 'payment_method_code', 'customer_number', 'customer_name', 'customer_address', 'customer_phone', 'customer_email'],
'Customer_Orders': ['order_id', 'customer_id', 'order_date', 'order_status_code'],
'Order_Items': ['order_item_id', 'order_id', 'product_id', 'order_quantity']
} | {
'Customers': ['customer_id'],
'Customer_Orders': ['order_id', 'customer_id']
} | TABLE Addresses (
Addresses.address_id (INTEGER),
Addresses.address_details (VARCHAR(255)),
)
TABLE Customer_Orders (
Customer_Orders.order_id (INTEGER),
Customer_Orders.customer_id (INTEGER),
Customer_Orders.order_date (DATETIME),
Customer_Orders.order_status_code (VARCHAR(15)),
)
TABLE Customers (
Customers.customer_id (INTEGER),
Customers.address_id (INTEGER),
Customers.payment_method_code (VARCHAR(15)),
Customers.customer_number (VARCHAR(20)),
Customers.customer_name (VARCHAR(80)),
Customers.customer_address (VARCHAR(255)),
Customers.customer_phone (VARCHAR(80)),
Customers.customer_email (VARCHAR(80)),
)
TABLE Order_Items (
Order_Items.order_item_id (INTEGER),
Order_Items.order_id (INTEGER),
Order_Items.product_id (INTEGER),
Order_Items.order_quantity (VARCHAR(80)),
)
TABLE Products (
Products.product_id (INTEGER),
Products.product_type_code (VARCHAR(15)),
Products.product_name (VARCHAR(80)),
Products.product_price (DOUBLE),
)
Possible JOINs:
Customer_Orders.customer_id = Customers.customer_id
Order_Items.order_id = Customer_Orders.order_id
Order_Items.product_id = Products.product_id
| TABLE Addresses (
Addresses.address_id (INTEGER),
Addresses.address_details (VARCHAR(255)),
)
TABLE Customer_Orders (
Customer_Orders.order_id (INTEGER),
Customer_Orders.customer_id (INTEGER),
Customer_Orders.order_date (DATETIME),
Customer_Orders.order_status_code (VARCHAR(15)),
)
TABLE Customers (
Customers.customer_id (INTEGER),
Customers.address_id (INTEGER),
Customers.payment_method_code (VARCHAR(15)),
Customers.customer_number (VARCHAR(20)),
Customers.customer_name (VARCHAR(80)),
Customers.customer_address (VARCHAR(255)),
Customers.customer_phone (VARCHAR(80)),
Customers.customer_email (VARCHAR(80)),
)
TABLE Order_Items (
Order_Items.order_item_id (INTEGER),
Order_Items.order_id (INTEGER),
Order_Items.product_id (INTEGER),
Order_Items.order_quantity (VARCHAR(80)),
)
TABLE Products (
Products.product_id (INTEGER),
Products.product_type_code (VARCHAR(15)),
Products.product_name (VARCHAR(80)),
Products.product_price (DOUBLE),
)
Possible JOINs:
Customer_Orders.customer_id = Customers.customer_id
Order_Items.order_id = Customer_Orders.order_id
Order_Items.product_id = Products.product_id
| TABLE addresses (
addresses.address_id (INTEGER),
addresses.address_details (VARCHAR(255)),
)
TABLE customer_orders (
customer_orders.order_id (INTEGER),
customer_orders.customer_id (INTEGER),
customer_orders.order_date (DATETIME),
customer_orders.order_status_code (VARCHAR(15)),
)
TABLE customers (
customers.customer_id (INTEGER),
customers.address_id (INTEGER),
customers.payment_method_code (VARCHAR(15)),
customers.customer_number (VARCHAR(20)),
customers.customer_name (VARCHAR(80)),
customers.customer_address (VARCHAR(255)),
customers.customer_phone (VARCHAR(80)),
customers.customer_email (VARCHAR(80)),
)
TABLE order_items (
order_items.order_item_id (INTEGER),
order_items.order_id (INTEGER),
order_items.product_id (INTEGER),
order_items.order_quantity (VARCHAR(80)),
)
TABLE products (
products.product_id (INTEGER),
products.product_type_code (VARCHAR(15)),
products.product_name (VARCHAR(80)),
products.product_price (DOUBLE),
)
Possible JOINs:
customer_orders.customer_id = customers.customer_id
order_items.order_id = customer_orders.order_id
order_items.product_id = products.product_id
|
warehouse_1 |
CREATE TABLE "Boxes" (
"Code" CHAR(4) NOT NULL,
"Contents" VARCHAR(255) NOT NULL,
"Value" REAL NOT NULL,
"Warehouse" INTEGER NOT NULL,
PRIMARY KEY ("Code"),
FOREIGN KEY("Warehouse") REFERENCES "Warehouses" ("Code")
)
CREATE TABLE "Warehouses" (
"Code" INTEGER NOT NULL,
"Location" VARCHAR(255) NOT NULL,
"Capacity" INTEGER NOT NULL,
PRIMARY KEY ("Code")
) | Find the average and maximum value for each different content. | medium | Table Boxes (
Boxes.Code (CHAR(4)),
Boxes.Contents (VARCHAR(255)),
Boxes.Value (REAL),
Boxes.Warehouse (INTEGER),
)
Table Warehouses (
Warehouses.Code (INTEGER),
Warehouses.Location (VARCHAR(255)),
Warehouses.Capacity (INTEGER),
)
Possible JOINs:
Boxes.Warehouse = Warehouses.Code
| SELECT avg(value) , max(value) , CONTENTS FROM boxes GROUP BY CONTENTS | {
'boxes': ['code', 'contents', 'value']
} | CREATE TABLE Boxes (
Boxes.Code (CHAR(4)),
Boxes.Contents (VARCHAR(255)),
Boxes.Value (REAL),
Boxes.Warehouse (INTEGER),
)
CREATE TABLE Warehouses (
Warehouses.Code (INTEGER),
Warehouses.Location (VARCHAR(255)),
Warehouses.Capacity (INTEGER),
)
Possible JOINs:
Boxes.Warehouse = Warehouses.Code
| Table Boxes (
Boxes.code (CHAR(4)),
Boxes.contents (VARCHAR(255)),
Boxes.value (REAL),
Boxes.warehouse (INTEGER),
)
Table Warehouses (
Warehouses.code (INTEGER),
Warehouses.location (VARCHAR(255)),
Warehouses.capacity (INTEGER),
)
Possible JOINs:
Boxes.warehouse = Warehouses.code
| CREATE TABLE Boxes (
Boxes.code (CHAR(4)),
Boxes.contents (VARCHAR(255)),
Boxes.value (REAL),
Boxes.warehouse (INTEGER),
)
CREATE TABLE Warehouses (
Warehouses.code (INTEGER),
Warehouses.location (VARCHAR(255)),
Warehouses.capacity (INTEGER),
)
Possible JOINs:
Boxes.warehouse = Warehouses.code
| Table boxes (
boxes.code (CHAR(4)),
boxes.contents (VARCHAR(255)),
boxes.value (REAL),
boxes.warehouse (INTEGER),
)
Table warehouses (
warehouses.code (INTEGER),
warehouses.location (VARCHAR(255)),
warehouses.capacity (INTEGER),
)
Possible JOINs:
boxes.warehouse = warehouses.code
| CREATE TABLE boxes (
boxes.code (CHAR(4)),
boxes.contents (VARCHAR(255)),
boxes.value (REAL),
boxes.warehouse (INTEGER),
)
CREATE TABLE warehouses (
warehouses.code (INTEGER),
warehouses.location (VARCHAR(255)),
warehouses.capacity (INTEGER),
)
Possible JOINs:
boxes.warehouse = warehouses.code
| {
'Warehouses': ['Code', 'Location', 'Capacity'],
'Boxes': ['Code', 'Contents', 'Value', 'Warehouse']
} | {
'Boxes': ['Code', 'Contents', 'Value']
} | TABLE Boxes (
Boxes.Code (CHAR(4)),
Boxes.Contents (VARCHAR(255)),
Boxes.Value (REAL),
Boxes.Warehouse (INTEGER),
)
TABLE Warehouses (
Warehouses.Code (INTEGER),
Warehouses.Location (VARCHAR(255)),
Warehouses.Capacity (INTEGER),
)
Possible JOINs:
Boxes.Warehouse = Warehouses.Code
| TABLE Boxes (
Boxes.code (CHAR(4)),
Boxes.contents (VARCHAR(255)),
Boxes.value (REAL),
Boxes.warehouse (INTEGER),
)
TABLE Warehouses (
Warehouses.code (INTEGER),
Warehouses.location (VARCHAR(255)),
Warehouses.capacity (INTEGER),
)
Possible JOINs:
Boxes.warehouse = Warehouses.code
| TABLE boxes (
boxes.code (CHAR(4)),
boxes.contents (VARCHAR(255)),
boxes.value (REAL),
boxes.warehouse (INTEGER),
)
TABLE warehouses (
warehouses.code (INTEGER),
warehouses.location (VARCHAR(255)),
warehouses.capacity (INTEGER),
)
Possible JOINs:
boxes.warehouse = warehouses.code
|
institution_sports |
CREATE TABLE "Championship" (
"Institution_ID" INTEGER,
"Nickname" TEXT,
"Joined" REAL,
"Number_of_Championships" REAL,
PRIMARY KEY ("Institution_ID"),
FOREIGN KEY("Institution_ID") REFERENCES institution ("Institution_ID")
)
CREATE TABLE institution (
"Institution_ID" INTEGER,
"Name" TEXT,
"Team" TEXT,
"City" TEXT,
"Province" TEXT,
"Founded" REAL,
"Affiliation" TEXT,
"Enrollment" REAL,
"Endowment" TEXT,
"Stadium" TEXT,
"Capacity" REAL,
PRIMARY KEY ("Institution_ID")
) | Return the stadiums of institutions, ordered by capacity descending. | easy | Table Championship (
Championship.Institution_ID (INT),
Championship.Nickname (TEXT),
Championship.Joined (REAL),
Championship.Number_of_Championships (REAL),
)
Table institution (
institution.Institution_ID (INT),
institution.Name (TEXT),
institution.Team (TEXT),
institution.City (TEXT),
institution.Province (TEXT),
institution.Founded (REAL),
institution.Affiliation (TEXT),
institution.Enrollment (REAL),
institution.Endowment (TEXT),
institution.Stadium (TEXT),
institution.Capacity (REAL),
)
Possible JOINs:
Championship.Institution_ID = institution.Institution_ID
| SELECT Stadium FROM institution ORDER BY Capacity DESC | {
'institution': ['institution_id', 'stadium', 'capacity']
} | CREATE TABLE Championship (
Championship.Institution_ID (INT),
Championship.Nickname (TEXT),
Championship.Joined (REAL),
Championship.Number_of_Championships (REAL),
)
CREATE TABLE institution (
institution.Institution_ID (INT),
institution.Name (TEXT),
institution.Team (TEXT),
institution.City (TEXT),
institution.Province (TEXT),
institution.Founded (REAL),
institution.Affiliation (TEXT),
institution.Enrollment (REAL),
institution.Endowment (TEXT),
institution.Stadium (TEXT),
institution.Capacity (REAL),
)
Possible JOINs:
Championship.Institution_ID = institution.Institution_ID
| Table Championship (
Championship.institution_id (INT),
Championship.nickname (TEXT),
Championship.joined (REAL),
Championship.number_of_championships (REAL),
)
Table institution (
institution.institution_id (INT),
institution.name (TEXT),
institution.team (TEXT),
institution.city (TEXT),
institution.province (TEXT),
institution.founded (REAL),
institution.affiliation (TEXT),
institution.enrollment (REAL),
institution.endowment (TEXT),
institution.stadium (TEXT),
institution.capacity (REAL),
)
Possible JOINs:
Championship.institution_id = institution.institution_id
| CREATE TABLE Championship (
Championship.institution_id (INT),
Championship.nickname (TEXT),
Championship.joined (REAL),
Championship.number_of_championships (REAL),
)
CREATE TABLE institution (
institution.institution_id (INT),
institution.name (TEXT),
institution.team (TEXT),
institution.city (TEXT),
institution.province (TEXT),
institution.founded (REAL),
institution.affiliation (TEXT),
institution.enrollment (REAL),
institution.endowment (TEXT),
institution.stadium (TEXT),
institution.capacity (REAL),
)
Possible JOINs:
Championship.institution_id = institution.institution_id
| Table championship (
championship.institution_id (INT),
championship.nickname (TEXT),
championship.joined (REAL),
championship.number_of_championships (REAL),
)
Table institution (
institution.institution_id (INT),
institution.name (TEXT),
institution.team (TEXT),
institution.city (TEXT),
institution.province (TEXT),
institution.founded (REAL),
institution.affiliation (TEXT),
institution.enrollment (REAL),
institution.endowment (TEXT),
institution.stadium (TEXT),
institution.capacity (REAL),
)
Possible JOINs:
championship.institution_id = institution.institution_id
| CREATE TABLE championship (
championship.institution_id (INT),
championship.nickname (TEXT),
championship.joined (REAL),
championship.number_of_championships (REAL),
)
CREATE TABLE institution (
institution.institution_id (INT),
institution.name (TEXT),
institution.team (TEXT),
institution.city (TEXT),
institution.province (TEXT),
institution.founded (REAL),
institution.affiliation (TEXT),
institution.enrollment (REAL),
institution.endowment (TEXT),
institution.stadium (TEXT),
institution.capacity (REAL),
)
Possible JOINs:
championship.institution_id = institution.institution_id
| {
'institution': ['Institution_ID', 'Name', 'Team', 'City', 'Province', 'Founded', 'Affiliation', 'Enrollment', 'Endowment', 'Stadium', 'Capacity'],
'Championship': ['Institution_ID', 'Nickname', 'Joined', 'Number_of_Championships']
} | {
'institution': ['Institution_ID', 'Stadium', 'Capacity']
} | TABLE Championship (
Championship.Institution_ID (INT),
Championship.Nickname (TEXT),
Championship.Joined (REAL),
Championship.Number_of_Championships (REAL),
)
TABLE institution (
institution.Institution_ID (INT),
institution.Name (TEXT),
institution.Team (TEXT),
institution.City (TEXT),
institution.Province (TEXT),
institution.Founded (REAL),
institution.Affiliation (TEXT),
institution.Enrollment (REAL),
institution.Endowment (TEXT),
institution.Stadium (TEXT),
institution.Capacity (REAL),
)
Possible JOINs:
Championship.Institution_ID = institution.Institution_ID
| TABLE Championship (
Championship.institution_id (INT),
Championship.nickname (TEXT),
Championship.joined (REAL),
Championship.number_of_championships (REAL),
)
TABLE institution (
institution.institution_id (INT),
institution.name (TEXT),
institution.team (TEXT),
institution.city (TEXT),
institution.province (TEXT),
institution.founded (REAL),
institution.affiliation (TEXT),
institution.enrollment (REAL),
institution.endowment (TEXT),
institution.stadium (TEXT),
institution.capacity (REAL),
)
Possible JOINs:
Championship.institution_id = institution.institution_id
| TABLE championship (
championship.institution_id (INT),
championship.nickname (TEXT),
championship.joined (REAL),
championship.number_of_championships (REAL),
)
TABLE institution (
institution.institution_id (INT),
institution.name (TEXT),
institution.team (TEXT),
institution.city (TEXT),
institution.province (TEXT),
institution.founded (REAL),
institution.affiliation (TEXT),
institution.enrollment (REAL),
institution.endowment (TEXT),
institution.stadium (TEXT),
institution.capacity (REAL),
)
Possible JOINs:
championship.institution_id = institution.institution_id
|
car_racing |
CREATE TABLE "country" (
"Country_Id" int,
"Country" text,
"Capital" text,
"Official_native_language" text,
"Regoin" text,
PRIMARY KEY ("Country_Id")
)
/*
0 rows from country table:
Country_Id Country Capital Official_native_language Regoin
*/
CREATE TABLE `team` (
"Team_ID" int,
"Team" text,
"Make" text,
"Manager" text,
"Sponsor" text,
"Car_Owner" text,
PRIMARY KEY ("Team_ID")
)
/*
0 rows from team table:
Team_ID Team Make Manager Sponsor Car_Owner
*/
CREATE TABLE `driver` (
"Driver_ID" int,
"Driver" text,
"Country" int,
"Age" int,
"Car_#" real,
"Make" text,
"Points" text,
"Laps" real,
"Winnings" text,
PRIMARY KEY ("Driver_ID"),
FOREIGN KEY (`Country`) REFERENCES `country`(`Country_ID`)
)
/*
0 rows from driver table:
Driver_ID Driver Country Age Car_# Make Points Laps Winnings
*/
CREATE TABLE `team_driver` (
"Team_ID" int,
"Driver_ID" int,
PRIMARY KEY ("Team_ID","Driver_ID"),
FOREIGN KEY (`Team_ID`) REFERENCES `team`(`Team_ID`),
FOREIGN KEY (`Driver_ID`) REFERENCES `driver`(`Driver_ID`)
)
/*
0 rows from team_driver table:
Team_ID Driver_ID
*/
| List all the driver names in descending order of points. | easy | Table country (
country.Country_Id (INT),
country.Country (TEXT),
country.Capital (TEXT),
country.Official_native_language (TEXT),
country.Regoin (TEXT),
)
Table driver (
driver.Driver_ID (INT),
driver.Driver (TEXT),
driver.Country (INT),
driver.Age (INT),
driver.Car_# (REAL),
driver.Make (TEXT),
driver.Points (TEXT),
driver.Laps (REAL),
driver.Winnings (TEXT),
)
Table team (
team.Team_ID (INT),
team.Team (TEXT),
team.Make (TEXT),
team.Manager (TEXT),
team.Sponsor (TEXT),
team.Car_Owner (TEXT),
)
Table team_driver (
team_driver.Team_ID (INT),
team_driver.Driver_ID (INT),
)
Possible JOINs:
driver.Country = country.Country_ID
team_driver.Team_ID = team.Team_ID
team_driver.Driver_ID = driver.Driver_ID
| SELECT Driver FROM driver ORDER BY Points DESC | {
'driver': ['driver_id', 'driver', 'points']
} | CREATE TABLE country (
country.Country_Id (INT),
country.Country (TEXT),
country.Capital (TEXT),
country.Official_native_language (TEXT),
country.Regoin (TEXT),
)
CREATE TABLE driver (
driver.Driver_ID (INT),
driver.Driver (TEXT),
driver.Country (INT),
driver.Age (INT),
driver.Car_# (REAL),
driver.Make (TEXT),
driver.Points (TEXT),
driver.Laps (REAL),
driver.Winnings (TEXT),
)
CREATE TABLE team (
team.Team_ID (INT),
team.Team (TEXT),
team.Make (TEXT),
team.Manager (TEXT),
team.Sponsor (TEXT),
team.Car_Owner (TEXT),
)
CREATE TABLE team_driver (
team_driver.Team_ID (INT),
team_driver.Driver_ID (INT),
)
Possible JOINs:
driver.Country = country.Country_ID
team_driver.Team_ID = team.Team_ID
team_driver.Driver_ID = driver.Driver_ID
| Table country (
country.country_id (INT),
country.country (TEXT),
country.capital (TEXT),
country.official_native_language (TEXT),
country.regoin (TEXT),
)
Table driver (
driver.driver_id (INT),
driver.driver (TEXT),
driver.country (INT),
driver.age (INT),
driver.car_# (REAL),
driver.make (TEXT),
driver.points (TEXT),
driver.laps (REAL),
driver.winnings (TEXT),
)
Table team (
team.team_id (INT),
team.team (TEXT),
team.make (TEXT),
team.manager (TEXT),
team.sponsor (TEXT),
team.car_owner (TEXT),
)
Table team_driver (
team_driver.team_id (INT),
team_driver.driver_id (INT),
)
Possible JOINs:
driver.country = country.country_id
team_driver.team_id = team.team_id
team_driver.driver_id = driver.driver_id
| CREATE TABLE country (
country.country_id (INT),
country.country (TEXT),
country.capital (TEXT),
country.official_native_language (TEXT),
country.regoin (TEXT),
)
CREATE TABLE driver (
driver.driver_id (INT),
driver.driver (TEXT),
driver.country (INT),
driver.age (INT),
driver.car_# (REAL),
driver.make (TEXT),
driver.points (TEXT),
driver.laps (REAL),
driver.winnings (TEXT),
)
CREATE TABLE team (
team.team_id (INT),
team.team (TEXT),
team.make (TEXT),
team.manager (TEXT),
team.sponsor (TEXT),
team.car_owner (TEXT),
)
CREATE TABLE team_driver (
team_driver.team_id (INT),
team_driver.driver_id (INT),
)
Possible JOINs:
driver.country = country.country_id
team_driver.team_id = team.team_id
team_driver.driver_id = driver.driver_id
| Table country (
country.country_id (INT),
country.country (TEXT),
country.capital (TEXT),
country.official_native_language (TEXT),
country.regoin (TEXT),
)
Table driver (
driver.driver_id (INT),
driver.driver (TEXT),
driver.country (INT),
driver.age (INT),
driver.car_# (REAL),
driver.make (TEXT),
driver.points (TEXT),
driver.laps (REAL),
driver.winnings (TEXT),
)
Table team (
team.team_id (INT),
team.team (TEXT),
team.make (TEXT),
team.manager (TEXT),
team.sponsor (TEXT),
team.car_owner (TEXT),
)
Table team_driver (
team_driver.team_id (INT),
team_driver.driver_id (INT),
)
Possible JOINs:
driver.country = country.country_id
team_driver.team_id = team.team_id
team_driver.driver_id = driver.driver_id
| CREATE TABLE country (
country.country_id (INT),
country.country (TEXT),
country.capital (TEXT),
country.official_native_language (TEXT),
country.regoin (TEXT),
)
CREATE TABLE driver (
driver.driver_id (INT),
driver.driver (TEXT),
driver.country (INT),
driver.age (INT),
driver.car_# (REAL),
driver.make (TEXT),
driver.points (TEXT),
driver.laps (REAL),
driver.winnings (TEXT),
)
CREATE TABLE team (
team.team_id (INT),
team.team (TEXT),
team.make (TEXT),
team.manager (TEXT),
team.sponsor (TEXT),
team.car_owner (TEXT),
)
CREATE TABLE team_driver (
team_driver.team_id (INT),
team_driver.driver_id (INT),
)
Possible JOINs:
driver.country = country.country_id
team_driver.team_id = team.team_id
team_driver.driver_id = driver.driver_id
| {
'country': ['Country_Id', 'Country', 'Capital', 'Official_native_language', 'Regoin'],
'team': ['Team_ID', 'Team', 'Make', 'Manager', 'Sponsor', 'Car_Owner'],
'driver': ['Driver_ID', 'Driver', 'Country', 'Age', 'Car_#', 'Make', 'Points', 'Laps', 'Winnings'],
'team_driver': ['Team_ID', 'Driver_ID']
} | {
'driver': ['Driver_ID', 'Driver', 'Points']
} | TABLE country (
country.Country_Id (INT),
country.Country (TEXT),
country.Capital (TEXT),
country.Official_native_language (TEXT),
country.Regoin (TEXT),
)
TABLE driver (
driver.Driver_ID (INT),
driver.Driver (TEXT),
driver.Country (INT),
driver.Age (INT),
driver.Car_# (REAL),
driver.Make (TEXT),
driver.Points (TEXT),
driver.Laps (REAL),
driver.Winnings (TEXT),
)
TABLE team (
team.Team_ID (INT),
team.Team (TEXT),
team.Make (TEXT),
team.Manager (TEXT),
team.Sponsor (TEXT),
team.Car_Owner (TEXT),
)
TABLE team_driver (
team_driver.Team_ID (INT),
team_driver.Driver_ID (INT),
)
Possible JOINs:
driver.Country = country.Country_ID
team_driver.Team_ID = team.Team_ID
team_driver.Driver_ID = driver.Driver_ID
| TABLE country (
country.country_id (INT),
country.country (TEXT),
country.capital (TEXT),
country.official_native_language (TEXT),
country.regoin (TEXT),
)
TABLE driver (
driver.driver_id (INT),
driver.driver (TEXT),
driver.country (INT),
driver.age (INT),
driver.car_# (REAL),
driver.make (TEXT),
driver.points (TEXT),
driver.laps (REAL),
driver.winnings (TEXT),
)
TABLE team (
team.team_id (INT),
team.team (TEXT),
team.make (TEXT),
team.manager (TEXT),
team.sponsor (TEXT),
team.car_owner (TEXT),
)
TABLE team_driver (
team_driver.team_id (INT),
team_driver.driver_id (INT),
)
Possible JOINs:
driver.country = country.country_id
team_driver.team_id = team.team_id
team_driver.driver_id = driver.driver_id
| TABLE country (
country.country_id (INT),
country.country (TEXT),
country.capital (TEXT),
country.official_native_language (TEXT),
country.regoin (TEXT),
)
TABLE driver (
driver.driver_id (INT),
driver.driver (TEXT),
driver.country (INT),
driver.age (INT),
driver.car_# (REAL),
driver.make (TEXT),
driver.points (TEXT),
driver.laps (REAL),
driver.winnings (TEXT),
)
TABLE team (
team.team_id (INT),
team.team (TEXT),
team.make (TEXT),
team.manager (TEXT),
team.sponsor (TEXT),
team.car_owner (TEXT),
)
TABLE team_driver (
team_driver.team_id (INT),
team_driver.driver_id (INT),
)
Possible JOINs:
driver.country = country.country_id
team_driver.team_id = team.team_id
team_driver.driver_id = driver.driver_id
|
pilot_1 |
CREATE TABLE "Hangar" (
plane_name CHAR(15) NOT NULL,
location CHAR(15),
PRIMARY KEY (plane_name)
)
CREATE TABLE "PilotSkills" (
pilot_name CHAR(15) NOT NULL,
plane_name CHAR(15) NOT NULL,
age INTEGER,
PRIMARY KEY (pilot_name, plane_name),
FOREIGN KEY(plane_name) REFERENCES "Hangar" (plane_name)
) | Which plane does the pilot Jones with age 32 has? | medium | Table Hangar (
Hangar.plane_name (CHAR(15)),
Hangar.location (CHAR(15)),
)
Table PilotSkills (
PilotSkills.pilot_name (CHAR(15)),
PilotSkills.plane_name (CHAR(15)),
PilotSkills.age (INTEGER),
)
Possible JOINs:
PilotSkills.plane_name = Hangar.plane_name
| SELECT plane_name FROM pilotskills WHERE pilot_name = 'Jones' AND age = 32 | {
'pilotskills': ['pilot_name', 'plane_name', 'age']
} | CREATE TABLE Hangar (
Hangar.plane_name (CHAR(15)),
Hangar.location (CHAR(15)),
)
CREATE TABLE PilotSkills (
PilotSkills.pilot_name (CHAR(15)),
PilotSkills.plane_name (CHAR(15)),
PilotSkills.age (INTEGER),
)
Possible JOINs:
PilotSkills.plane_name = Hangar.plane_name
| Table Hangar (
Hangar.plane_name (CHAR(15)),
Hangar.location (CHAR(15)),
)
Table PilotSkills (
PilotSkills.pilot_name (CHAR(15)),
PilotSkills.plane_name (CHAR(15)),
PilotSkills.age (INTEGER),
)
Possible JOINs:
PilotSkills.plane_name = Hangar.plane_name
| CREATE TABLE Hangar (
Hangar.plane_name (CHAR(15)),
Hangar.location (CHAR(15)),
)
CREATE TABLE PilotSkills (
PilotSkills.pilot_name (CHAR(15)),
PilotSkills.plane_name (CHAR(15)),
PilotSkills.age (INTEGER),
)
Possible JOINs:
PilotSkills.plane_name = Hangar.plane_name
| Table hangar (
hangar.plane_name (CHAR(15)),
hangar.location (CHAR(15)),
)
Table pilotskills (
pilotskills.pilot_name (CHAR(15)),
pilotskills.plane_name (CHAR(15)),
pilotskills.age (INTEGER),
)
Possible JOINs:
pilotskills.plane_name = hangar.plane_name
| CREATE TABLE hangar (
hangar.plane_name (CHAR(15)),
hangar.location (CHAR(15)),
)
CREATE TABLE pilotskills (
pilotskills.pilot_name (CHAR(15)),
pilotskills.plane_name (CHAR(15)),
pilotskills.age (INTEGER),
)
Possible JOINs:
pilotskills.plane_name = hangar.plane_name
| {
'PilotSkills': ['pilot_name', 'plane_name', 'age'],
'Hangar': ['plane_name', 'location']
} | {
'PilotSkills': ['pilot_name', 'plane_name', 'age']
} | TABLE Hangar (
Hangar.plane_name (CHAR(15)),
Hangar.location (CHAR(15)),
)
TABLE PilotSkills (
PilotSkills.pilot_name (CHAR(15)),
PilotSkills.plane_name (CHAR(15)),
PilotSkills.age (INTEGER),
)
Possible JOINs:
PilotSkills.plane_name = Hangar.plane_name
| TABLE Hangar (
Hangar.plane_name (CHAR(15)),
Hangar.location (CHAR(15)),
)
TABLE PilotSkills (
PilotSkills.pilot_name (CHAR(15)),
PilotSkills.plane_name (CHAR(15)),
PilotSkills.age (INTEGER),
)
Possible JOINs:
PilotSkills.plane_name = Hangar.plane_name
| TABLE hangar (
hangar.plane_name (CHAR(15)),
hangar.location (CHAR(15)),
)
TABLE pilotskills (
pilotskills.pilot_name (CHAR(15)),
pilotskills.plane_name (CHAR(15)),
pilotskills.age (INTEGER),
)
Possible JOINs:
pilotskills.plane_name = hangar.plane_name
|
art_1 |
CREATE TABLE "Artists" (
"artistID" INTEGER,
lname TEXT,
fname TEXT,
"birthYear" INTEGER,
"deathYear" INTEGER,
PRIMARY KEY ("artistID")
)
CREATE TABLE "Paintings" (
"paintingID" INTEGER,
title TEXT,
year INTEGER,
height_mm INTEGER,
width_mm INTEGER,
medium TEXT,
"mediumOn" TEXT,
location TEXT,
"painterID" INTEGER,
PRIMARY KEY ("paintingID"),
FOREIGN KEY("painterID") REFERENCES "Artists" ("artistID")
)
CREATE TABLE "Sculptures" (
"sculptureID" INTEGER,
title TEXT,
year INTEGER,
medium TEXT,
location TEXT,
"sculptorID" INTEGER,
PRIMARY KEY ("sculptureID"),
FOREIGN KEY("sculptorID") REFERENCES "Artists" ("artistID")
) | Give me a list of names and years of paintings that were created by the artist whose first name is Mary. | medium | Table Artists (
Artists.artistID (INTEGER),
Artists.lname (TEXT),
Artists.fname (TEXT),
Artists.birthYear (INTEGER),
Artists.deathYear (INTEGER),
)
Table Paintings (
Paintings.paintingID (INTEGER),
Paintings.title (TEXT),
Paintings.year (INTEGER),
Paintings.height_mm (INTEGER),
Paintings.width_mm (INTEGER),
Paintings.medium (TEXT),
Paintings.mediumOn (TEXT),
Paintings.location (TEXT),
Paintings.painterID (INTEGER),
)
Table Sculptures (
Sculptures.sculptureID (INTEGER),
Sculptures.title (TEXT),
Sculptures.year (INTEGER),
Sculptures.medium (TEXT),
Sculptures.location (TEXT),
Sculptures.sculptorID (INTEGER),
)
Possible JOINs:
Paintings.painterID = Artists.artistID
Sculptures.sculptorID = Artists.artistID
| SELECT paintings.title , paintings.year FROM artists JOIN paintings ON artists.artistID = paintings.painterID WHERE artists.fname = "Mary" | {
'artists': ['artistid', 'fname'],
'paintings': ['paintingid', 'title', 'year', 'painterid']
} | CREATE TABLE Artists (
Artists.artistID (INTEGER),
Artists.lname (TEXT),
Artists.fname (TEXT),
Artists.birthYear (INTEGER),
Artists.deathYear (INTEGER),
)
CREATE TABLE Paintings (
Paintings.paintingID (INTEGER),
Paintings.title (TEXT),
Paintings.year (INTEGER),
Paintings.height_mm (INTEGER),
Paintings.width_mm (INTEGER),
Paintings.medium (TEXT),
Paintings.mediumOn (TEXT),
Paintings.location (TEXT),
Paintings.painterID (INTEGER),
)
CREATE TABLE Sculptures (
Sculptures.sculptureID (INTEGER),
Sculptures.title (TEXT),
Sculptures.year (INTEGER),
Sculptures.medium (TEXT),
Sculptures.location (TEXT),
Sculptures.sculptorID (INTEGER),
)
Possible JOINs:
Paintings.painterID = Artists.artistID
Sculptures.sculptorID = Artists.artistID
| Table Artists (
Artists.artistid (INTEGER),
Artists.lname (TEXT),
Artists.fname (TEXT),
Artists.birthyear (INTEGER),
Artists.deathyear (INTEGER),
)
Table Paintings (
Paintings.paintingid (INTEGER),
Paintings.title (TEXT),
Paintings.year (INTEGER),
Paintings.height_mm (INTEGER),
Paintings.width_mm (INTEGER),
Paintings.medium (TEXT),
Paintings.mediumon (TEXT),
Paintings.location (TEXT),
Paintings.painterid (INTEGER),
)
Table Sculptures (
Sculptures.sculptureid (INTEGER),
Sculptures.title (TEXT),
Sculptures.year (INTEGER),
Sculptures.medium (TEXT),
Sculptures.location (TEXT),
Sculptures.sculptorid (INTEGER),
)
Possible JOINs:
Paintings.painterid = Artists.artistid
Sculptures.sculptorid = Artists.artistid
| CREATE TABLE Artists (
Artists.artistid (INTEGER),
Artists.lname (TEXT),
Artists.fname (TEXT),
Artists.birthyear (INTEGER),
Artists.deathyear (INTEGER),
)
CREATE TABLE Paintings (
Paintings.paintingid (INTEGER),
Paintings.title (TEXT),
Paintings.year (INTEGER),
Paintings.height_mm (INTEGER),
Paintings.width_mm (INTEGER),
Paintings.medium (TEXT),
Paintings.mediumon (TEXT),
Paintings.location (TEXT),
Paintings.painterid (INTEGER),
)
CREATE TABLE Sculptures (
Sculptures.sculptureid (INTEGER),
Sculptures.title (TEXT),
Sculptures.year (INTEGER),
Sculptures.medium (TEXT),
Sculptures.location (TEXT),
Sculptures.sculptorid (INTEGER),
)
Possible JOINs:
Paintings.painterid = Artists.artistid
Sculptures.sculptorid = Artists.artistid
| Table artists (
artists.artistid (INTEGER),
artists.lname (TEXT),
artists.fname (TEXT),
artists.birthyear (INTEGER),
artists.deathyear (INTEGER),
)
Table paintings (
paintings.paintingid (INTEGER),
paintings.title (TEXT),
paintings.year (INTEGER),
paintings.height_mm (INTEGER),
paintings.width_mm (INTEGER),
paintings.medium (TEXT),
paintings.mediumon (TEXT),
paintings.location (TEXT),
paintings.painterid (INTEGER),
)
Table sculptures (
sculptures.sculptureid (INTEGER),
sculptures.title (TEXT),
sculptures.year (INTEGER),
sculptures.medium (TEXT),
sculptures.location (TEXT),
sculptures.sculptorid (INTEGER),
)
Possible JOINs:
paintings.painterid = artists.artistid
sculptures.sculptorid = artists.artistid
| CREATE TABLE artists (
artists.artistid (INTEGER),
artists.lname (TEXT),
artists.fname (TEXT),
artists.birthyear (INTEGER),
artists.deathyear (INTEGER),
)
CREATE TABLE paintings (
paintings.paintingid (INTEGER),
paintings.title (TEXT),
paintings.year (INTEGER),
paintings.height_mm (INTEGER),
paintings.width_mm (INTEGER),
paintings.medium (TEXT),
paintings.mediumon (TEXT),
paintings.location (TEXT),
paintings.painterid (INTEGER),
)
CREATE TABLE sculptures (
sculptures.sculptureid (INTEGER),
sculptures.title (TEXT),
sculptures.year (INTEGER),
sculptures.medium (TEXT),
sculptures.location (TEXT),
sculptures.sculptorid (INTEGER),
)
Possible JOINs:
paintings.painterid = artists.artistid
sculptures.sculptorid = artists.artistid
| {
'Artists': ['artistID', 'lname', 'fname', 'birthYear', 'deathYear'],
'Paintings': ['paintingID', 'title', 'year', 'height_mm', 'width_mm', 'medium', 'mediumOn', 'location', 'painterID'],
'Sculptures': ['sculptureID', 'title', 'year', 'medium', 'location', 'sculptorID']
} | {
'Artists': ['artistID', 'fname'],
'Paintings': ['paintingID', 'title', 'year', 'painterID']
} | TABLE Artists (
Artists.artistID (INTEGER),
Artists.lname (TEXT),
Artists.fname (TEXT),
Artists.birthYear (INTEGER),
Artists.deathYear (INTEGER),
)
TABLE Paintings (
Paintings.paintingID (INTEGER),
Paintings.title (TEXT),
Paintings.year (INTEGER),
Paintings.height_mm (INTEGER),
Paintings.width_mm (INTEGER),
Paintings.medium (TEXT),
Paintings.mediumOn (TEXT),
Paintings.location (TEXT),
Paintings.painterID (INTEGER),
)
TABLE Sculptures (
Sculptures.sculptureID (INTEGER),
Sculptures.title (TEXT),
Sculptures.year (INTEGER),
Sculptures.medium (TEXT),
Sculptures.location (TEXT),
Sculptures.sculptorID (INTEGER),
)
Possible JOINs:
Paintings.painterID = Artists.artistID
Sculptures.sculptorID = Artists.artistID
| TABLE Artists (
Artists.artistid (INTEGER),
Artists.lname (TEXT),
Artists.fname (TEXT),
Artists.birthyear (INTEGER),
Artists.deathyear (INTEGER),
)
TABLE Paintings (
Paintings.paintingid (INTEGER),
Paintings.title (TEXT),
Paintings.year (INTEGER),
Paintings.height_mm (INTEGER),
Paintings.width_mm (INTEGER),
Paintings.medium (TEXT),
Paintings.mediumon (TEXT),
Paintings.location (TEXT),
Paintings.painterid (INTEGER),
)
TABLE Sculptures (
Sculptures.sculptureid (INTEGER),
Sculptures.title (TEXT),
Sculptures.year (INTEGER),
Sculptures.medium (TEXT),
Sculptures.location (TEXT),
Sculptures.sculptorid (INTEGER),
)
Possible JOINs:
Paintings.painterid = Artists.artistid
Sculptures.sculptorid = Artists.artistid
| TABLE artists (
artists.artistid (INTEGER),
artists.lname (TEXT),
artists.fname (TEXT),
artists.birthyear (INTEGER),
artists.deathyear (INTEGER),
)
TABLE paintings (
paintings.paintingid (INTEGER),
paintings.title (TEXT),
paintings.year (INTEGER),
paintings.height_mm (INTEGER),
paintings.width_mm (INTEGER),
paintings.medium (TEXT),
paintings.mediumon (TEXT),
paintings.location (TEXT),
paintings.painterid (INTEGER),
)
TABLE sculptures (
sculptures.sculptureid (INTEGER),
sculptures.title (TEXT),
sculptures.year (INTEGER),
sculptures.medium (TEXT),
sculptures.location (TEXT),
sculptures.sculptorid (INTEGER),
)
Possible JOINs:
paintings.painterid = artists.artistid
sculptures.sculptorid = artists.artistid
|
warehouse_1 |
CREATE TABLE "Boxes" (
"Code" CHAR(4) NOT NULL,
"Contents" VARCHAR(255) NOT NULL,
"Value" REAL NOT NULL,
"Warehouse" INTEGER NOT NULL,
PRIMARY KEY ("Code"),
FOREIGN KEY("Warehouse") REFERENCES "Warehouses" ("Code")
)
CREATE TABLE "Warehouses" (
"Code" INTEGER NOT NULL,
"Location" VARCHAR(255) NOT NULL,
"Capacity" INTEGER NOT NULL,
PRIMARY KEY ("Code")
) | What is the code and contents for the box that has the smallest value? | medium | Table Boxes (
Boxes.Code (CHAR(4)),
Boxes.Contents (VARCHAR(255)),
Boxes.Value (REAL),
Boxes.Warehouse (INTEGER),
)
Table Warehouses (
Warehouses.Code (INTEGER),
Warehouses.Location (VARCHAR(255)),
Warehouses.Capacity (INTEGER),
)
Possible JOINs:
Boxes.Warehouse = Warehouses.Code
| SELECT code , CONTENTS FROM boxes ORDER BY value LIMIT 1 | {
'boxes': ['code', 'contents', 'value']
} | CREATE TABLE Boxes (
Boxes.Code (CHAR(4)),
Boxes.Contents (VARCHAR(255)),
Boxes.Value (REAL),
Boxes.Warehouse (INTEGER),
)
CREATE TABLE Warehouses (
Warehouses.Code (INTEGER),
Warehouses.Location (VARCHAR(255)),
Warehouses.Capacity (INTEGER),
)
Possible JOINs:
Boxes.Warehouse = Warehouses.Code
| Table Boxes (
Boxes.code (CHAR(4)),
Boxes.contents (VARCHAR(255)),
Boxes.value (REAL),
Boxes.warehouse (INTEGER),
)
Table Warehouses (
Warehouses.code (INTEGER),
Warehouses.location (VARCHAR(255)),
Warehouses.capacity (INTEGER),
)
Possible JOINs:
Boxes.warehouse = Warehouses.code
| CREATE TABLE Boxes (
Boxes.code (CHAR(4)),
Boxes.contents (VARCHAR(255)),
Boxes.value (REAL),
Boxes.warehouse (INTEGER),
)
CREATE TABLE Warehouses (
Warehouses.code (INTEGER),
Warehouses.location (VARCHAR(255)),
Warehouses.capacity (INTEGER),
)
Possible JOINs:
Boxes.warehouse = Warehouses.code
| Table boxes (
boxes.code (CHAR(4)),
boxes.contents (VARCHAR(255)),
boxes.value (REAL),
boxes.warehouse (INTEGER),
)
Table warehouses (
warehouses.code (INTEGER),
warehouses.location (VARCHAR(255)),
warehouses.capacity (INTEGER),
)
Possible JOINs:
boxes.warehouse = warehouses.code
| CREATE TABLE boxes (
boxes.code (CHAR(4)),
boxes.contents (VARCHAR(255)),
boxes.value (REAL),
boxes.warehouse (INTEGER),
)
CREATE TABLE warehouses (
warehouses.code (INTEGER),
warehouses.location (VARCHAR(255)),
warehouses.capacity (INTEGER),
)
Possible JOINs:
boxes.warehouse = warehouses.code
| {
'Warehouses': ['Code', 'Location', 'Capacity'],
'Boxes': ['Code', 'Contents', 'Value', 'Warehouse']
} | {
'Boxes': ['Code', 'Contents', 'Value']
} | TABLE Boxes (
Boxes.Code (CHAR(4)),
Boxes.Contents (VARCHAR(255)),
Boxes.Value (REAL),
Boxes.Warehouse (INTEGER),
)
TABLE Warehouses (
Warehouses.Code (INTEGER),
Warehouses.Location (VARCHAR(255)),
Warehouses.Capacity (INTEGER),
)
Possible JOINs:
Boxes.Warehouse = Warehouses.Code
| TABLE Boxes (
Boxes.code (CHAR(4)),
Boxes.contents (VARCHAR(255)),
Boxes.value (REAL),
Boxes.warehouse (INTEGER),
)
TABLE Warehouses (
Warehouses.code (INTEGER),
Warehouses.location (VARCHAR(255)),
Warehouses.capacity (INTEGER),
)
Possible JOINs:
Boxes.warehouse = Warehouses.code
| TABLE boxes (
boxes.code (CHAR(4)),
boxes.contents (VARCHAR(255)),
boxes.value (REAL),
boxes.warehouse (INTEGER),
)
TABLE warehouses (
warehouses.code (INTEGER),
warehouses.location (VARCHAR(255)),
warehouses.capacity (INTEGER),
)
Possible JOINs:
boxes.warehouse = warehouses.code
|
government_shift |
CREATE TABLE "Analytical_Layer" (
"Analytical_ID" INTEGER NOT NULL,
"Customers_and_Services_ID" VARCHAR(40) NOT NULL,
"Pattern_Recognition" VARCHAR(255) NOT NULL,
"Analytical_Layer_Type_Code" CHAR(15),
PRIMARY KEY ("Analytical_ID"),
FOREIGN KEY("Customers_and_Services_ID") REFERENCES "Customers_and_Services" ("Customers_and_Services_ID")
)
CREATE TABLE "Channels" (
"Channel_ID" INTEGER NOT NULL,
"Channel_Details" VARCHAR(255) NOT NULL,
PRIMARY KEY ("Channel_ID")
)
CREATE TABLE "Customer_Interactions" (
"Customer_Interaction_ID" INTEGER NOT NULL,
"Channel_ID" INTEGER,
"Customer_ID" INTEGER,
"Service_ID" INTEGER,
"Status_Code" CHAR(15),
"Services_and_Channels_Details" VARCHAR(255),
PRIMARY KEY ("Customer_Interaction_ID"),
FOREIGN KEY("Service_ID") REFERENCES "Services" ("Service_ID"),
FOREIGN KEY("Channel_ID") REFERENCES "Channels" ("Channel_ID"),
FOREIGN KEY("Customer_ID") REFERENCES "Customers" ("Customer_ID")
)
CREATE TABLE "Customers" (
"Customer_ID" INTEGER NOT NULL,
"Customer_Details" VARCHAR(255) NOT NULL,
PRIMARY KEY ("Customer_ID")
)
CREATE TABLE "Customers_and_Services" (
"Customers_and_Services_ID" INTEGER NOT NULL,
"Customer_ID" INTEGER,
"Service_ID" INTEGER,
"Customers_and_Services_Details" CHAR(15) NOT NULL,
PRIMARY KEY ("Customers_and_Services_ID"),
FOREIGN KEY("Service_ID") REFERENCES "Services" ("Service_ID"),
FOREIGN KEY("Customer_ID") REFERENCES "Customers" ("Customer_ID")
)
CREATE TABLE "Integration_Platform" (
"Integration_Platform_ID" INTEGER NOT NULL,
"Customer_Interaction_ID" INTEGER NOT NULL,
"Integration_Platform_Details" VARCHAR(255) NOT NULL,
PRIMARY KEY ("Integration_Platform_ID"),
FOREIGN KEY("Customer_Interaction_ID") REFERENCES "Customer_Interactions" ("Customer_Interaction_ID")
)
CREATE TABLE "Services" (
"Service_ID" INTEGER NOT NULL,
"Service_Details" VARCHAR(255),
PRIMARY KEY ("Service_ID")
) | How many integration platforms are successful? | easy | Table Analytical_Layer (
Analytical_Layer.Analytical_ID (INTEGER),
Analytical_Layer.Customers_and_Services_ID (VARCHAR(40)),
Analytical_Layer.Pattern_Recognition (VARCHAR(255)),
Analytical_Layer.Analytical_Layer_Type_Code (CHAR(15)),
)
Table Channels (
Channels.Channel_ID (INTEGER),
Channels.Channel_Details (VARCHAR(255)),
)
Table Customer_Interactions (
Customer_Interactions.Customer_Interaction_ID (INTEGER),
Customer_Interactions.Channel_ID (INTEGER),
Customer_Interactions.Customer_ID (INTEGER),
Customer_Interactions.Service_ID (INTEGER),
Customer_Interactions.Status_Code (CHAR(15)),
Customer_Interactions.Services_and_Channels_Details (VARCHAR(255)),
)
Table Customers (
Customers.Customer_ID (INTEGER),
Customers.Customer_Details (VARCHAR(255)),
)
Table Customers_and_Services (
Customers_and_Services.Customers_and_Services_ID (INTEGER),
Customers_and_Services.Customer_ID (INTEGER),
Customers_and_Services.Service_ID (INTEGER),
Customers_and_Services.Customers_and_Services_Details (CHAR(15)),
)
Table Integration_Platform (
Integration_Platform.Integration_Platform_ID (INTEGER),
Integration_Platform.Customer_Interaction_ID (INTEGER),
Integration_Platform.Integration_Platform_Details (VARCHAR(255)),
)
Table Services (
Services.Service_ID (INTEGER),
Services.Service_Details (VARCHAR(255)),
)
Possible JOINs:
Analytical_Layer.Customers_and_Services_ID = Customers_and_Services.Customers_and_Services_ID
Customer_Interactions.Channel_ID = Channels.Channel_ID
Customer_Interactions.Customer_ID = Customers.Customer_ID
Customer_Interactions.Service_ID = Services.Service_ID
Customers_and_Services.Customer_ID = Customers.Customer_ID
Customers_and_Services.Service_ID = Services.Service_ID
Integration_Platform.Customer_Interaction_ID = Customer_Interactions.Customer_Interaction_ID
| SELECT count(*) FROM integration_platform WHERE integration_platform_details = "Success" | {
'integration_platform': ['integration_platform_id', 'integration_platform_details']
} | CREATE TABLE Analytical_Layer (
Analytical_Layer.Analytical_ID (INTEGER),
Analytical_Layer.Customers_and_Services_ID (VARCHAR(40)),
Analytical_Layer.Pattern_Recognition (VARCHAR(255)),
Analytical_Layer.Analytical_Layer_Type_Code (CHAR(15)),
)
CREATE TABLE Channels (
Channels.Channel_ID (INTEGER),
Channels.Channel_Details (VARCHAR(255)),
)
CREATE TABLE Customer_Interactions (
Customer_Interactions.Customer_Interaction_ID (INTEGER),
Customer_Interactions.Channel_ID (INTEGER),
Customer_Interactions.Customer_ID (INTEGER),
Customer_Interactions.Service_ID (INTEGER),
Customer_Interactions.Status_Code (CHAR(15)),
Customer_Interactions.Services_and_Channels_Details (VARCHAR(255)),
)
CREATE TABLE Customers (
Customers.Customer_ID (INTEGER),
Customers.Customer_Details (VARCHAR(255)),
)
CREATE TABLE Customers_and_Services (
Customers_and_Services.Customers_and_Services_ID (INTEGER),
Customers_and_Services.Customer_ID (INTEGER),
Customers_and_Services.Service_ID (INTEGER),
Customers_and_Services.Customers_and_Services_Details (CHAR(15)),
)
CREATE TABLE Integration_Platform (
Integration_Platform.Integration_Platform_ID (INTEGER),
Integration_Platform.Customer_Interaction_ID (INTEGER),
Integration_Platform.Integration_Platform_Details (VARCHAR(255)),
)
CREATE TABLE Services (
Services.Service_ID (INTEGER),
Services.Service_Details (VARCHAR(255)),
)
Possible JOINs:
Analytical_Layer.Customers_and_Services_ID = Customers_and_Services.Customers_and_Services_ID
Customer_Interactions.Channel_ID = Channels.Channel_ID
Customer_Interactions.Customer_ID = Customers.Customer_ID
Customer_Interactions.Service_ID = Services.Service_ID
Customers_and_Services.Customer_ID = Customers.Customer_ID
Customers_and_Services.Service_ID = Services.Service_ID
Integration_Platform.Customer_Interaction_ID = Customer_Interactions.Customer_Interaction_ID
| Table Analytical_Layer (
Analytical_Layer.analytical_id (INTEGER),
Analytical_Layer.customers_and_services_id (VARCHAR(40)),
Analytical_Layer.pattern_recognition (VARCHAR(255)),
Analytical_Layer.analytical_layer_type_code (CHAR(15)),
)
Table Channels (
Channels.channel_id (INTEGER),
Channels.channel_details (VARCHAR(255)),
)
Table Customer_Interactions (
Customer_Interactions.customer_interaction_id (INTEGER),
Customer_Interactions.channel_id (INTEGER),
Customer_Interactions.customer_id (INTEGER),
Customer_Interactions.service_id (INTEGER),
Customer_Interactions.status_code (CHAR(15)),
Customer_Interactions.services_and_channels_details (VARCHAR(255)),
)
Table Customers (
Customers.customer_id (INTEGER),
Customers.customer_details (VARCHAR(255)),
)
Table Customers_and_Services (
Customers_and_Services.customers_and_services_id (INTEGER),
Customers_and_Services.customer_id (INTEGER),
Customers_and_Services.service_id (INTEGER),
Customers_and_Services.customers_and_services_details (CHAR(15)),
)
Table Integration_Platform (
Integration_Platform.integration_platform_id (INTEGER),
Integration_Platform.customer_interaction_id (INTEGER),
Integration_Platform.integration_platform_details (VARCHAR(255)),
)
Table Services (
Services.service_id (INTEGER),
Services.service_details (VARCHAR(255)),
)
Possible JOINs:
Analytical_Layer.customers_and_services_id = Customers_and_Services.customers_and_services_id
Customer_Interactions.channel_id = Channels.channel_id
Customer_Interactions.customer_id = Customers.customer_id
Customer_Interactions.service_id = Services.service_id
Customers_and_Services.customer_id = Customers.customer_id
Customers_and_Services.service_id = Services.service_id
Integration_Platform.customer_interaction_id = Customer_Interactions.customer_interaction_id
| CREATE TABLE Analytical_Layer (
Analytical_Layer.analytical_id (INTEGER),
Analytical_Layer.customers_and_services_id (VARCHAR(40)),
Analytical_Layer.pattern_recognition (VARCHAR(255)),
Analytical_Layer.analytical_layer_type_code (CHAR(15)),
)
CREATE TABLE Channels (
Channels.channel_id (INTEGER),
Channels.channel_details (VARCHAR(255)),
)
CREATE TABLE Customer_Interactions (
Customer_Interactions.customer_interaction_id (INTEGER),
Customer_Interactions.channel_id (INTEGER),
Customer_Interactions.customer_id (INTEGER),
Customer_Interactions.service_id (INTEGER),
Customer_Interactions.status_code (CHAR(15)),
Customer_Interactions.services_and_channels_details (VARCHAR(255)),
)
CREATE TABLE Customers (
Customers.customer_id (INTEGER),
Customers.customer_details (VARCHAR(255)),
)
CREATE TABLE Customers_and_Services (
Customers_and_Services.customers_and_services_id (INTEGER),
Customers_and_Services.customer_id (INTEGER),
Customers_and_Services.service_id (INTEGER),
Customers_and_Services.customers_and_services_details (CHAR(15)),
)
CREATE TABLE Integration_Platform (
Integration_Platform.integration_platform_id (INTEGER),
Integration_Platform.customer_interaction_id (INTEGER),
Integration_Platform.integration_platform_details (VARCHAR(255)),
)
CREATE TABLE Services (
Services.service_id (INTEGER),
Services.service_details (VARCHAR(255)),
)
Possible JOINs:
Analytical_Layer.customers_and_services_id = Customers_and_Services.customers_and_services_id
Customer_Interactions.channel_id = Channels.channel_id
Customer_Interactions.customer_id = Customers.customer_id
Customer_Interactions.service_id = Services.service_id
Customers_and_Services.customer_id = Customers.customer_id
Customers_and_Services.service_id = Services.service_id
Integration_Platform.customer_interaction_id = Customer_Interactions.customer_interaction_id
| Table analytical_layer (
analytical_layer.analytical_id (INTEGER),
analytical_layer.customers_and_services_id (VARCHAR(40)),
analytical_layer.pattern_recognition (VARCHAR(255)),
analytical_layer.analytical_layer_type_code (CHAR(15)),
)
Table channels (
channels.channel_id (INTEGER),
channels.channel_details (VARCHAR(255)),
)
Table customer_interactions (
customer_interactions.customer_interaction_id (INTEGER),
customer_interactions.channel_id (INTEGER),
customer_interactions.customer_id (INTEGER),
customer_interactions.service_id (INTEGER),
customer_interactions.status_code (CHAR(15)),
customer_interactions.services_and_channels_details (VARCHAR(255)),
)
Table customers (
customers.customer_id (INTEGER),
customers.customer_details (VARCHAR(255)),
)
Table customers_and_services (
customers_and_services.customers_and_services_id (INTEGER),
customers_and_services.customer_id (INTEGER),
customers_and_services.service_id (INTEGER),
customers_and_services.customers_and_services_details (CHAR(15)),
)
Table integration_platform (
integration_platform.integration_platform_id (INTEGER),
integration_platform.customer_interaction_id (INTEGER),
integration_platform.integration_platform_details (VARCHAR(255)),
)
Table services (
services.service_id (INTEGER),
services.service_details (VARCHAR(255)),
)
Possible JOINs:
analytical_layer.customers_and_services_id = customers_and_services.customers_and_services_id
customer_interactions.channel_id = channels.channel_id
customer_interactions.customer_id = customers.customer_id
customer_interactions.service_id = services.service_id
customers_and_services.customer_id = customers.customer_id
customers_and_services.service_id = services.service_id
integration_platform.customer_interaction_id = customer_interactions.customer_interaction_id
| CREATE TABLE analytical_layer (
analytical_layer.analytical_id (INTEGER),
analytical_layer.customers_and_services_id (VARCHAR(40)),
analytical_layer.pattern_recognition (VARCHAR(255)),
analytical_layer.analytical_layer_type_code (CHAR(15)),
)
CREATE TABLE channels (
channels.channel_id (INTEGER),
channels.channel_details (VARCHAR(255)),
)
CREATE TABLE customer_interactions (
customer_interactions.customer_interaction_id (INTEGER),
customer_interactions.channel_id (INTEGER),
customer_interactions.customer_id (INTEGER),
customer_interactions.service_id (INTEGER),
customer_interactions.status_code (CHAR(15)),
customer_interactions.services_and_channels_details (VARCHAR(255)),
)
CREATE TABLE customers (
customers.customer_id (INTEGER),
customers.customer_details (VARCHAR(255)),
)
CREATE TABLE customers_and_services (
customers_and_services.customers_and_services_id (INTEGER),
customers_and_services.customer_id (INTEGER),
customers_and_services.service_id (INTEGER),
customers_and_services.customers_and_services_details (CHAR(15)),
)
CREATE TABLE integration_platform (
integration_platform.integration_platform_id (INTEGER),
integration_platform.customer_interaction_id (INTEGER),
integration_platform.integration_platform_details (VARCHAR(255)),
)
CREATE TABLE services (
services.service_id (INTEGER),
services.service_details (VARCHAR(255)),
)
Possible JOINs:
analytical_layer.customers_and_services_id = customers_and_services.customers_and_services_id
customer_interactions.channel_id = channels.channel_id
customer_interactions.customer_id = customers.customer_id
customer_interactions.service_id = services.service_id
customers_and_services.customer_id = customers.customer_id
customers_and_services.service_id = services.service_id
integration_platform.customer_interaction_id = customer_interactions.customer_interaction_id
| {
'Services': ['Service_ID', 'Service_Details'],
'Customers': ['Customer_ID', 'Customer_Details'],
'Channels': ['Channel_ID', 'Channel_Details'],
'Customers_and_Services': ['Customers_and_Services_ID', 'Customer_ID', 'Service_ID', 'Customers_and_Services_Details'],
'Customer_Interactions': ['Customer_Interaction_ID', 'Channel_ID', 'Customer_ID', 'Service_ID', 'Status_Code', 'Services_and_Channels_Details'],
'Integration_Platform': ['Integration_Platform_ID', 'Customer_Interaction_ID', 'Integration_Platform_Details'],
'Analytical_Layer': ['Analytical_ID', 'Customers_and_Services_ID', 'Pattern_Recognition', 'Analytical_Layer_Type_Code']
} | {
'Integration_Platform': ['Integration_Platform_ID', 'Integration_Platform_Details']
} | TABLE Analytical_Layer (
Analytical_Layer.Analytical_ID (INTEGER),
Analytical_Layer.Customers_and_Services_ID (VARCHAR(40)),
Analytical_Layer.Pattern_Recognition (VARCHAR(255)),
Analytical_Layer.Analytical_Layer_Type_Code (CHAR(15)),
)
TABLE Channels (
Channels.Channel_ID (INTEGER),
Channels.Channel_Details (VARCHAR(255)),
)
TABLE Customer_Interactions (
Customer_Interactions.Customer_Interaction_ID (INTEGER),
Customer_Interactions.Channel_ID (INTEGER),
Customer_Interactions.Customer_ID (INTEGER),
Customer_Interactions.Service_ID (INTEGER),
Customer_Interactions.Status_Code (CHAR(15)),
Customer_Interactions.Services_and_Channels_Details (VARCHAR(255)),
)
TABLE Customers (
Customers.Customer_ID (INTEGER),
Customers.Customer_Details (VARCHAR(255)),
)
TABLE Customers_and_Services (
Customers_and_Services.Customers_and_Services_ID (INTEGER),
Customers_and_Services.Customer_ID (INTEGER),
Customers_and_Services.Service_ID (INTEGER),
Customers_and_Services.Customers_and_Services_Details (CHAR(15)),
)
TABLE Integration_Platform (
Integration_Platform.Integration_Platform_ID (INTEGER),
Integration_Platform.Customer_Interaction_ID (INTEGER),
Integration_Platform.Integration_Platform_Details (VARCHAR(255)),
)
TABLE Services (
Services.Service_ID (INTEGER),
Services.Service_Details (VARCHAR(255)),
)
Possible JOINs:
Analytical_Layer.Customers_and_Services_ID = Customers_and_Services.Customers_and_Services_ID
Customer_Interactions.Channel_ID = Channels.Channel_ID
Customer_Interactions.Customer_ID = Customers.Customer_ID
Customer_Interactions.Service_ID = Services.Service_ID
Customers_and_Services.Customer_ID = Customers.Customer_ID
Customers_and_Services.Service_ID = Services.Service_ID
Integration_Platform.Customer_Interaction_ID = Customer_Interactions.Customer_Interaction_ID
| TABLE Analytical_Layer (
Analytical_Layer.analytical_id (INTEGER),
Analytical_Layer.customers_and_services_id (VARCHAR(40)),
Analytical_Layer.pattern_recognition (VARCHAR(255)),
Analytical_Layer.analytical_layer_type_code (CHAR(15)),
)
TABLE Channels (
Channels.channel_id (INTEGER),
Channels.channel_details (VARCHAR(255)),
)
TABLE Customer_Interactions (
Customer_Interactions.customer_interaction_id (INTEGER),
Customer_Interactions.channel_id (INTEGER),
Customer_Interactions.customer_id (INTEGER),
Customer_Interactions.service_id (INTEGER),
Customer_Interactions.status_code (CHAR(15)),
Customer_Interactions.services_and_channels_details (VARCHAR(255)),
)
TABLE Customers (
Customers.customer_id (INTEGER),
Customers.customer_details (VARCHAR(255)),
)
TABLE Customers_and_Services (
Customers_and_Services.customers_and_services_id (INTEGER),
Customers_and_Services.customer_id (INTEGER),
Customers_and_Services.service_id (INTEGER),
Customers_and_Services.customers_and_services_details (CHAR(15)),
)
TABLE Integration_Platform (
Integration_Platform.integration_platform_id (INTEGER),
Integration_Platform.customer_interaction_id (INTEGER),
Integration_Platform.integration_platform_details (VARCHAR(255)),
)
TABLE Services (
Services.service_id (INTEGER),
Services.service_details (VARCHAR(255)),
)
Possible JOINs:
Analytical_Layer.customers_and_services_id = Customers_and_Services.customers_and_services_id
Customer_Interactions.channel_id = Channels.channel_id
Customer_Interactions.customer_id = Customers.customer_id
Customer_Interactions.service_id = Services.service_id
Customers_and_Services.customer_id = Customers.customer_id
Customers_and_Services.service_id = Services.service_id
Integration_Platform.customer_interaction_id = Customer_Interactions.customer_interaction_id
| TABLE analytical_layer (
analytical_layer.analytical_id (INTEGER),
analytical_layer.customers_and_services_id (VARCHAR(40)),
analytical_layer.pattern_recognition (VARCHAR(255)),
analytical_layer.analytical_layer_type_code (CHAR(15)),
)
TABLE channels (
channels.channel_id (INTEGER),
channels.channel_details (VARCHAR(255)),
)
TABLE customer_interactions (
customer_interactions.customer_interaction_id (INTEGER),
customer_interactions.channel_id (INTEGER),
customer_interactions.customer_id (INTEGER),
customer_interactions.service_id (INTEGER),
customer_interactions.status_code (CHAR(15)),
customer_interactions.services_and_channels_details (VARCHAR(255)),
)
TABLE customers (
customers.customer_id (INTEGER),
customers.customer_details (VARCHAR(255)),
)
TABLE customers_and_services (
customers_and_services.customers_and_services_id (INTEGER),
customers_and_services.customer_id (INTEGER),
customers_and_services.service_id (INTEGER),
customers_and_services.customers_and_services_details (CHAR(15)),
)
TABLE integration_platform (
integration_platform.integration_platform_id (INTEGER),
integration_platform.customer_interaction_id (INTEGER),
integration_platform.integration_platform_details (VARCHAR(255)),
)
TABLE services (
services.service_id (INTEGER),
services.service_details (VARCHAR(255)),
)
Possible JOINs:
analytical_layer.customers_and_services_id = customers_and_services.customers_and_services_id
customer_interactions.channel_id = channels.channel_id
customer_interactions.customer_id = customers.customer_id
customer_interactions.service_id = services.service_id
customers_and_services.customer_id = customers.customer_id
customers_and_services.service_id = services.service_id
integration_platform.customer_interaction_id = customer_interactions.customer_interaction_id
|
cre_Doc_and_collections |
CREATE TABLE "Collection_Subset_Members" (
"Collection_ID" INTEGER NOT NULL,
"Related_Collection_ID" INTEGER NOT NULL,
"Collection_Subset_ID" INTEGER NOT NULL,
PRIMARY KEY ("Collection_ID", "Related_Collection_ID"),
FOREIGN KEY("Collection_ID") REFERENCES "Collections" ("Collection_ID"),
FOREIGN KEY("Related_Collection_ID") REFERENCES "Collections" ("Collection_ID"),
FOREIGN KEY("Collection_Subset_ID") REFERENCES "Collection_Subsets" ("Collection_Subset_ID")
)
CREATE TABLE "Collection_Subsets" (
"Collection_Subset_ID" INTEGER NOT NULL,
"Collection_Subset_Name" VARCHAR(255) NOT NULL,
"Collecrtion_Subset_Details" VARCHAR(255) NOT NULL,
PRIMARY KEY ("Collection_Subset_ID")
)
CREATE TABLE "Collections" (
"Collection_ID" INTEGER NOT NULL,
"Parent_Collection_ID" INTEGER,
"Collection_Name" VARCHAR(255),
"Collection_Description" VARCHAR(255),
PRIMARY KEY ("Collection_ID")
)
CREATE TABLE "Document_Objects" (
"Document_Object_ID" INTEGER NOT NULL,
"Parent_Document_Object_ID" INTEGER,
"Owner" VARCHAR(255),
"Description" VARCHAR(255),
"Other_Details" VARCHAR(255),
PRIMARY KEY ("Document_Object_ID")
)
CREATE TABLE "Document_Subset_Members" (
"Document_Object_ID" INTEGER NOT NULL,
"Related_Document_Object_ID" INTEGER NOT NULL,
"Document_Subset_ID" INTEGER NOT NULL,
PRIMARY KEY ("Document_Object_ID", "Related_Document_Object_ID"),
FOREIGN KEY("Document_Object_ID") REFERENCES "Document_Objects" ("Document_Object_ID"),
FOREIGN KEY("Document_Subset_ID") REFERENCES "Document_Subsets" ("Document_Subset_ID"),
FOREIGN KEY("Related_Document_Object_ID") REFERENCES "Document_Objects" ("Document_Object_ID")
)
CREATE TABLE "Document_Subsets" (
"Document_Subset_ID" INTEGER NOT NULL,
"Document_Subset_Name" VARCHAR(255) NOT NULL,
"Document_Subset_Details" VARCHAR(255) NOT NULL,
PRIMARY KEY ("Document_Subset_ID")
)
CREATE TABLE "Documents_in_Collections" (
"Document_Object_ID" INTEGER NOT NULL,
"Collection_ID" INTEGER NOT NULL,
PRIMARY KEY ("Document_Object_ID", "Collection_ID"),
FOREIGN KEY("Document_Object_ID") REFERENCES "Document_Objects" ("Document_Object_ID"),
FOREIGN KEY("Collection_ID") REFERENCES "Collections" ("Collection_ID")
) | For document subset named 'Best for 2000', List all document id that in this subset. | medium | Table Collection_Subset_Members (
Collection_Subset_Members.Collection_ID (INTEGER),
Collection_Subset_Members.Related_Collection_ID (INTEGER),
Collection_Subset_Members.Collection_Subset_ID (INTEGER),
)
Table Collection_Subsets (
Collection_Subsets.Collection_Subset_ID (INTEGER),
Collection_Subsets.Collection_Subset_Name (VARCHAR(255)),
Collection_Subsets.Collecrtion_Subset_Details (VARCHAR(255)),
)
Table Collections (
Collections.Collection_ID (INTEGER),
Collections.Parent_Collection_ID (INTEGER),
Collections.Collection_Name (VARCHAR(255)),
Collections.Collection_Description (VARCHAR(255)),
)
Table Document_Objects (
Document_Objects.Document_Object_ID (INTEGER),
Document_Objects.Parent_Document_Object_ID (INTEGER),
Document_Objects.Owner (VARCHAR(255)),
Document_Objects.Description (VARCHAR(255)),
Document_Objects.Other_Details (VARCHAR(255)),
)
Table Document_Subset_Members (
Document_Subset_Members.Document_Object_ID (INTEGER),
Document_Subset_Members.Related_Document_Object_ID (INTEGER),
Document_Subset_Members.Document_Subset_ID (INTEGER),
)
Table Document_Subsets (
Document_Subsets.Document_Subset_ID (INTEGER),
Document_Subsets.Document_Subset_Name (VARCHAR(255)),
Document_Subsets.Document_Subset_Details (VARCHAR(255)),
)
Table Documents_in_Collections (
Documents_in_Collections.Document_Object_ID (INTEGER),
Documents_in_Collections.Collection_ID (INTEGER),
)
Possible JOINs:
Collection_Subset_Members.Collection_ID = Collections.Collection_ID
Collection_Subset_Members.Related_Collection_ID = Collections.Collection_ID
Collection_Subset_Members.Collection_Subset_ID = Collection_Subsets.Collection_Subset_ID
Document_Subset_Members.Document_Object_ID = Document_Objects.Document_Object_ID
Document_Subset_Members.Related_Document_Object_ID = Document_Objects.Document_Object_ID
Document_Subset_Members.Document_Subset_ID = Document_Subsets.Document_Subset_ID
Documents_in_Collections.Document_Object_ID = Document_Objects.Document_Object_ID
Documents_in_Collections.Collection_ID = Collections.Collection_ID
| SELECT DISTINCT Document_Subset_Members.Document_Object_ID FROM Document_Subset_Members JOIN Document_Subsets ON Document_Subset_Members.Document_Subset_ID = Document_Subsets.Document_Subset_ID WHERE Document_Subsets.Document_Subset_Name = "Best for 2000"; | {
'document_subset_members': ['document_object_id', 'document_subset_id'],
'document_subsets': ['document_subset_id', 'document_subset_name']
} | CREATE TABLE Collection_Subset_Members (
Collection_Subset_Members.Collection_ID (INTEGER),
Collection_Subset_Members.Related_Collection_ID (INTEGER),
Collection_Subset_Members.Collection_Subset_ID (INTEGER),
)
CREATE TABLE Collection_Subsets (
Collection_Subsets.Collection_Subset_ID (INTEGER),
Collection_Subsets.Collection_Subset_Name (VARCHAR(255)),
Collection_Subsets.Collecrtion_Subset_Details (VARCHAR(255)),
)
CREATE TABLE Collections (
Collections.Collection_ID (INTEGER),
Collections.Parent_Collection_ID (INTEGER),
Collections.Collection_Name (VARCHAR(255)),
Collections.Collection_Description (VARCHAR(255)),
)
CREATE TABLE Document_Objects (
Document_Objects.Document_Object_ID (INTEGER),
Document_Objects.Parent_Document_Object_ID (INTEGER),
Document_Objects.Owner (VARCHAR(255)),
Document_Objects.Description (VARCHAR(255)),
Document_Objects.Other_Details (VARCHAR(255)),
)
CREATE TABLE Document_Subset_Members (
Document_Subset_Members.Document_Object_ID (INTEGER),
Document_Subset_Members.Related_Document_Object_ID (INTEGER),
Document_Subset_Members.Document_Subset_ID (INTEGER),
)
CREATE TABLE Document_Subsets (
Document_Subsets.Document_Subset_ID (INTEGER),
Document_Subsets.Document_Subset_Name (VARCHAR(255)),
Document_Subsets.Document_Subset_Details (VARCHAR(255)),
)
CREATE TABLE Documents_in_Collections (
Documents_in_Collections.Document_Object_ID (INTEGER),
Documents_in_Collections.Collection_ID (INTEGER),
)
Possible JOINs:
Collection_Subset_Members.Collection_ID = Collections.Collection_ID
Collection_Subset_Members.Related_Collection_ID = Collections.Collection_ID
Collection_Subset_Members.Collection_Subset_ID = Collection_Subsets.Collection_Subset_ID
Document_Subset_Members.Document_Object_ID = Document_Objects.Document_Object_ID
Document_Subset_Members.Related_Document_Object_ID = Document_Objects.Document_Object_ID
Document_Subset_Members.Document_Subset_ID = Document_Subsets.Document_Subset_ID
Documents_in_Collections.Document_Object_ID = Document_Objects.Document_Object_ID
Documents_in_Collections.Collection_ID = Collections.Collection_ID
| Table Collection_Subset_Members (
Collection_Subset_Members.collection_id (INTEGER),
Collection_Subset_Members.related_collection_id (INTEGER),
Collection_Subset_Members.collection_subset_id (INTEGER),
)
Table Collection_Subsets (
Collection_Subsets.collection_subset_id (INTEGER),
Collection_Subsets.collection_subset_name (VARCHAR(255)),
Collection_Subsets.collecrtion_subset_details (VARCHAR(255)),
)
Table Collections (
Collections.collection_id (INTEGER),
Collections.parent_collection_id (INTEGER),
Collections.collection_name (VARCHAR(255)),
Collections.collection_description (VARCHAR(255)),
)
Table Document_Objects (
Document_Objects.document_object_id (INTEGER),
Document_Objects.parent_document_object_id (INTEGER),
Document_Objects.owner (VARCHAR(255)),
Document_Objects.description (VARCHAR(255)),
Document_Objects.other_details (VARCHAR(255)),
)
Table Document_Subset_Members (
Document_Subset_Members.document_object_id (INTEGER),
Document_Subset_Members.related_document_object_id (INTEGER),
Document_Subset_Members.document_subset_id (INTEGER),
)
Table Document_Subsets (
Document_Subsets.document_subset_id (INTEGER),
Document_Subsets.document_subset_name (VARCHAR(255)),
Document_Subsets.document_subset_details (VARCHAR(255)),
)
Table Documents_in_Collections (
Documents_in_Collections.document_object_id (INTEGER),
Documents_in_Collections.collection_id (INTEGER),
)
Possible JOINs:
Collection_Subset_Members.collection_id = Collections.collection_id
Collection_Subset_Members.related_collection_id = Collections.collection_id
Collection_Subset_Members.collection_subset_id = Collection_Subsets.collection_subset_id
Document_Subset_Members.document_object_id = Document_Objects.document_object_id
Document_Subset_Members.related_document_object_id = Document_Objects.document_object_id
Document_Subset_Members.document_subset_id = Document_Subsets.document_subset_id
Documents_in_Collections.document_object_id = Document_Objects.document_object_id
Documents_in_Collections.collection_id = Collections.collection_id
| CREATE TABLE Collection_Subset_Members (
Collection_Subset_Members.collection_id (INTEGER),
Collection_Subset_Members.related_collection_id (INTEGER),
Collection_Subset_Members.collection_subset_id (INTEGER),
)
CREATE TABLE Collection_Subsets (
Collection_Subsets.collection_subset_id (INTEGER),
Collection_Subsets.collection_subset_name (VARCHAR(255)),
Collection_Subsets.collecrtion_subset_details (VARCHAR(255)),
)
CREATE TABLE Collections (
Collections.collection_id (INTEGER),
Collections.parent_collection_id (INTEGER),
Collections.collection_name (VARCHAR(255)),
Collections.collection_description (VARCHAR(255)),
)
CREATE TABLE Document_Objects (
Document_Objects.document_object_id (INTEGER),
Document_Objects.parent_document_object_id (INTEGER),
Document_Objects.owner (VARCHAR(255)),
Document_Objects.description (VARCHAR(255)),
Document_Objects.other_details (VARCHAR(255)),
)
CREATE TABLE Document_Subset_Members (
Document_Subset_Members.document_object_id (INTEGER),
Document_Subset_Members.related_document_object_id (INTEGER),
Document_Subset_Members.document_subset_id (INTEGER),
)
CREATE TABLE Document_Subsets (
Document_Subsets.document_subset_id (INTEGER),
Document_Subsets.document_subset_name (VARCHAR(255)),
Document_Subsets.document_subset_details (VARCHAR(255)),
)
CREATE TABLE Documents_in_Collections (
Documents_in_Collections.document_object_id (INTEGER),
Documents_in_Collections.collection_id (INTEGER),
)
Possible JOINs:
Collection_Subset_Members.collection_id = Collections.collection_id
Collection_Subset_Members.related_collection_id = Collections.collection_id
Collection_Subset_Members.collection_subset_id = Collection_Subsets.collection_subset_id
Document_Subset_Members.document_object_id = Document_Objects.document_object_id
Document_Subset_Members.related_document_object_id = Document_Objects.document_object_id
Document_Subset_Members.document_subset_id = Document_Subsets.document_subset_id
Documents_in_Collections.document_object_id = Document_Objects.document_object_id
Documents_in_Collections.collection_id = Collections.collection_id
| Table collection_subset_members (
collection_subset_members.collection_id (INTEGER),
collection_subset_members.related_collection_id (INTEGER),
collection_subset_members.collection_subset_id (INTEGER),
)
Table collection_subsets (
collection_subsets.collection_subset_id (INTEGER),
collection_subsets.collection_subset_name (VARCHAR(255)),
collection_subsets.collecrtion_subset_details (VARCHAR(255)),
)
Table collections (
collections.collection_id (INTEGER),
collections.parent_collection_id (INTEGER),
collections.collection_name (VARCHAR(255)),
collections.collection_description (VARCHAR(255)),
)
Table document_objects (
document_objects.document_object_id (INTEGER),
document_objects.parent_document_object_id (INTEGER),
document_objects.owner (VARCHAR(255)),
document_objects.description (VARCHAR(255)),
document_objects.other_details (VARCHAR(255)),
)
Table document_subset_members (
document_subset_members.document_object_id (INTEGER),
document_subset_members.related_document_object_id (INTEGER),
document_subset_members.document_subset_id (INTEGER),
)
Table document_subsets (
document_subsets.document_subset_id (INTEGER),
document_subsets.document_subset_name (VARCHAR(255)),
document_subsets.document_subset_details (VARCHAR(255)),
)
Table documents_in_collections (
documents_in_collections.document_object_id (INTEGER),
documents_in_collections.collection_id (INTEGER),
)
Possible JOINs:
collection_subset_members.collection_id = collections.collection_id
collection_subset_members.related_collection_id = collections.collection_id
collection_subset_members.collection_subset_id = collection_subsets.collection_subset_id
document_subset_members.document_object_id = document_objects.document_object_id
document_subset_members.related_document_object_id = document_objects.document_object_id
document_subset_members.document_subset_id = document_subsets.document_subset_id
documents_in_collections.document_object_id = document_objects.document_object_id
documents_in_collections.collection_id = collections.collection_id
| CREATE TABLE collection_subset_members (
collection_subset_members.collection_id (INTEGER),
collection_subset_members.related_collection_id (INTEGER),
collection_subset_members.collection_subset_id (INTEGER),
)
CREATE TABLE collection_subsets (
collection_subsets.collection_subset_id (INTEGER),
collection_subsets.collection_subset_name (VARCHAR(255)),
collection_subsets.collecrtion_subset_details (VARCHAR(255)),
)
CREATE TABLE collections (
collections.collection_id (INTEGER),
collections.parent_collection_id (INTEGER),
collections.collection_name (VARCHAR(255)),
collections.collection_description (VARCHAR(255)),
)
CREATE TABLE document_objects (
document_objects.document_object_id (INTEGER),
document_objects.parent_document_object_id (INTEGER),
document_objects.owner (VARCHAR(255)),
document_objects.description (VARCHAR(255)),
document_objects.other_details (VARCHAR(255)),
)
CREATE TABLE document_subset_members (
document_subset_members.document_object_id (INTEGER),
document_subset_members.related_document_object_id (INTEGER),
document_subset_members.document_subset_id (INTEGER),
)
CREATE TABLE document_subsets (
document_subsets.document_subset_id (INTEGER),
document_subsets.document_subset_name (VARCHAR(255)),
document_subsets.document_subset_details (VARCHAR(255)),
)
CREATE TABLE documents_in_collections (
documents_in_collections.document_object_id (INTEGER),
documents_in_collections.collection_id (INTEGER),
)
Possible JOINs:
collection_subset_members.collection_id = collections.collection_id
collection_subset_members.related_collection_id = collections.collection_id
collection_subset_members.collection_subset_id = collection_subsets.collection_subset_id
document_subset_members.document_object_id = document_objects.document_object_id
document_subset_members.related_document_object_id = document_objects.document_object_id
document_subset_members.document_subset_id = document_subsets.document_subset_id
documents_in_collections.document_object_id = document_objects.document_object_id
documents_in_collections.collection_id = collections.collection_id
| {
'Document_Subsets': ['Document_Subset_ID', 'Document_Subset_Name', 'Document_Subset_Details'],
'Collection_Subsets': ['Collection_Subset_ID', 'Collection_Subset_Name', 'Collecrtion_Subset_Details'],
'Document_Objects': ['Document_Object_ID', 'Parent_Document_Object_ID', 'Owner', 'Description', 'Other_Details'],
'Collections': ['Collection_ID', 'Parent_Collection_ID', 'Collection_Name', 'Collection_Description'],
'Documents_in_Collections': ['Document_Object_ID', 'Collection_ID'],
'Document_Subset_Members': ['Document_Object_ID', 'Related_Document_Object_ID', 'Document_Subset_ID'],
'Collection_Subset_Members': ['Collection_ID', 'Related_Collection_ID', 'Collection_Subset_ID']
} | {
'Document_Subset_Members': ['Document_Object_ID', 'Document_Subset_ID'],
'Document_Subsets': ['Document_Subset_ID', 'Document_Subset_Name']
} | TABLE Collection_Subset_Members (
Collection_Subset_Members.Collection_ID (INTEGER),
Collection_Subset_Members.Related_Collection_ID (INTEGER),
Collection_Subset_Members.Collection_Subset_ID (INTEGER),
)
TABLE Collection_Subsets (
Collection_Subsets.Collection_Subset_ID (INTEGER),
Collection_Subsets.Collection_Subset_Name (VARCHAR(255)),
Collection_Subsets.Collecrtion_Subset_Details (VARCHAR(255)),
)
TABLE Collections (
Collections.Collection_ID (INTEGER),
Collections.Parent_Collection_ID (INTEGER),
Collections.Collection_Name (VARCHAR(255)),
Collections.Collection_Description (VARCHAR(255)),
)
TABLE Document_Objects (
Document_Objects.Document_Object_ID (INTEGER),
Document_Objects.Parent_Document_Object_ID (INTEGER),
Document_Objects.Owner (VARCHAR(255)),
Document_Objects.Description (VARCHAR(255)),
Document_Objects.Other_Details (VARCHAR(255)),
)
TABLE Document_Subset_Members (
Document_Subset_Members.Document_Object_ID (INTEGER),
Document_Subset_Members.Related_Document_Object_ID (INTEGER),
Document_Subset_Members.Document_Subset_ID (INTEGER),
)
TABLE Document_Subsets (
Document_Subsets.Document_Subset_ID (INTEGER),
Document_Subsets.Document_Subset_Name (VARCHAR(255)),
Document_Subsets.Document_Subset_Details (VARCHAR(255)),
)
TABLE Documents_in_Collections (
Documents_in_Collections.Document_Object_ID (INTEGER),
Documents_in_Collections.Collection_ID (INTEGER),
)
Possible JOINs:
Collection_Subset_Members.Collection_ID = Collections.Collection_ID
Collection_Subset_Members.Related_Collection_ID = Collections.Collection_ID
Collection_Subset_Members.Collection_Subset_ID = Collection_Subsets.Collection_Subset_ID
Document_Subset_Members.Document_Object_ID = Document_Objects.Document_Object_ID
Document_Subset_Members.Related_Document_Object_ID = Document_Objects.Document_Object_ID
Document_Subset_Members.Document_Subset_ID = Document_Subsets.Document_Subset_ID
Documents_in_Collections.Document_Object_ID = Document_Objects.Document_Object_ID
Documents_in_Collections.Collection_ID = Collections.Collection_ID
| TABLE Collection_Subset_Members (
Collection_Subset_Members.collection_id (INTEGER),
Collection_Subset_Members.related_collection_id (INTEGER),
Collection_Subset_Members.collection_subset_id (INTEGER),
)
TABLE Collection_Subsets (
Collection_Subsets.collection_subset_id (INTEGER),
Collection_Subsets.collection_subset_name (VARCHAR(255)),
Collection_Subsets.collecrtion_subset_details (VARCHAR(255)),
)
TABLE Collections (
Collections.collection_id (INTEGER),
Collections.parent_collection_id (INTEGER),
Collections.collection_name (VARCHAR(255)),
Collections.collection_description (VARCHAR(255)),
)
TABLE Document_Objects (
Document_Objects.document_object_id (INTEGER),
Document_Objects.parent_document_object_id (INTEGER),
Document_Objects.owner (VARCHAR(255)),
Document_Objects.description (VARCHAR(255)),
Document_Objects.other_details (VARCHAR(255)),
)
TABLE Document_Subset_Members (
Document_Subset_Members.document_object_id (INTEGER),
Document_Subset_Members.related_document_object_id (INTEGER),
Document_Subset_Members.document_subset_id (INTEGER),
)
TABLE Document_Subsets (
Document_Subsets.document_subset_id (INTEGER),
Document_Subsets.document_subset_name (VARCHAR(255)),
Document_Subsets.document_subset_details (VARCHAR(255)),
)
TABLE Documents_in_Collections (
Documents_in_Collections.document_object_id (INTEGER),
Documents_in_Collections.collection_id (INTEGER),
)
Possible JOINs:
Collection_Subset_Members.collection_id = Collections.collection_id
Collection_Subset_Members.related_collection_id = Collections.collection_id
Collection_Subset_Members.collection_subset_id = Collection_Subsets.collection_subset_id
Document_Subset_Members.document_object_id = Document_Objects.document_object_id
Document_Subset_Members.related_document_object_id = Document_Objects.document_object_id
Document_Subset_Members.document_subset_id = Document_Subsets.document_subset_id
Documents_in_Collections.document_object_id = Document_Objects.document_object_id
Documents_in_Collections.collection_id = Collections.collection_id
| TABLE collection_subset_members (
collection_subset_members.collection_id (INTEGER),
collection_subset_members.related_collection_id (INTEGER),
collection_subset_members.collection_subset_id (INTEGER),
)
TABLE collection_subsets (
collection_subsets.collection_subset_id (INTEGER),
collection_subsets.collection_subset_name (VARCHAR(255)),
collection_subsets.collecrtion_subset_details (VARCHAR(255)),
)
TABLE collections (
collections.collection_id (INTEGER),
collections.parent_collection_id (INTEGER),
collections.collection_name (VARCHAR(255)),
collections.collection_description (VARCHAR(255)),
)
TABLE document_objects (
document_objects.document_object_id (INTEGER),
document_objects.parent_document_object_id (INTEGER),
document_objects.owner (VARCHAR(255)),
document_objects.description (VARCHAR(255)),
document_objects.other_details (VARCHAR(255)),
)
TABLE document_subset_members (
document_subset_members.document_object_id (INTEGER),
document_subset_members.related_document_object_id (INTEGER),
document_subset_members.document_subset_id (INTEGER),
)
TABLE document_subsets (
document_subsets.document_subset_id (INTEGER),
document_subsets.document_subset_name (VARCHAR(255)),
document_subsets.document_subset_details (VARCHAR(255)),
)
TABLE documents_in_collections (
documents_in_collections.document_object_id (INTEGER),
documents_in_collections.collection_id (INTEGER),
)
Possible JOINs:
collection_subset_members.collection_id = collections.collection_id
collection_subset_members.related_collection_id = collections.collection_id
collection_subset_members.collection_subset_id = collection_subsets.collection_subset_id
document_subset_members.document_object_id = document_objects.document_object_id
document_subset_members.related_document_object_id = document_objects.document_object_id
document_subset_members.document_subset_id = document_subsets.document_subset_id
documents_in_collections.document_object_id = document_objects.document_object_id
documents_in_collections.collection_id = collections.collection_id
|
boat_1 |
CREATE TABLE "Boats" (
bid INTEGER,
name TEXT,
color TEXT,
PRIMARY KEY (bid)
)
CREATE TABLE "Reserves" (
sid INTEGER,
bid INTEGER,
day TEXT,
FOREIGN KEY(sid) REFERENCES "Sailors" (sid),
FOREIGN KEY(bid) REFERENCES "Boats" (bid)
)
CREATE TABLE "Sailors" (
sid INTEGER,
name TEXT,
rating INTEGER,
age INTEGER,
PRIMARY KEY (sid)
) | What are the names of the boats booked by people between age 20 and 30? | hard | Table Boats (
Boats.bid (INTEGER),
Boats.name (TEXT),
Boats.color (TEXT),
)
Table Reserves (
Reserves.sid (INTEGER),
Reserves.bid (INTEGER),
Reserves.day (TEXT),
)
Table Sailors (
Sailors.sid (INTEGER),
Sailors.name (TEXT),
Sailors.rating (INTEGER),
Sailors.age (INTEGER),
)
Possible JOINs:
Reserves.sid = Sailors.sid
Reserves.bid = Boats.bid
| SELECT Boats.name FROM Sailors JOIN Reserves ON Sailors.sid = Reserves.sid JOIN Boats ON Boats.bid = Reserves.bid WHERE Sailors.age BETWEEN 20 AND 30 | {
'sailors': ['sid', 'age'],
'reserves': ['sid', 'bid'],
'boats': ['bid', 'name']
} | CREATE TABLE Boats (
Boats.bid (INTEGER),
Boats.name (TEXT),
Boats.color (TEXT),
)
CREATE TABLE Reserves (
Reserves.sid (INTEGER),
Reserves.bid (INTEGER),
Reserves.day (TEXT),
)
CREATE TABLE Sailors (
Sailors.sid (INTEGER),
Sailors.name (TEXT),
Sailors.rating (INTEGER),
Sailors.age (INTEGER),
)
Possible JOINs:
Reserves.sid = Sailors.sid
Reserves.bid = Boats.bid
| Table Boats (
Boats.bid (INTEGER),
Boats.name (TEXT),
Boats.color (TEXT),
)
Table Reserves (
Reserves.sid (INTEGER),
Reserves.bid (INTEGER),
Reserves.day (TEXT),
)
Table Sailors (
Sailors.sid (INTEGER),
Sailors.name (TEXT),
Sailors.rating (INTEGER),
Sailors.age (INTEGER),
)
Possible JOINs:
Reserves.sid = Sailors.sid
Reserves.bid = Boats.bid
| CREATE TABLE Boats (
Boats.bid (INTEGER),
Boats.name (TEXT),
Boats.color (TEXT),
)
CREATE TABLE Reserves (
Reserves.sid (INTEGER),
Reserves.bid (INTEGER),
Reserves.day (TEXT),
)
CREATE TABLE Sailors (
Sailors.sid (INTEGER),
Sailors.name (TEXT),
Sailors.rating (INTEGER),
Sailors.age (INTEGER),
)
Possible JOINs:
Reserves.sid = Sailors.sid
Reserves.bid = Boats.bid
| Table boats (
boats.bid (INTEGER),
boats.name (TEXT),
boats.color (TEXT),
)
Table reserves (
reserves.sid (INTEGER),
reserves.bid (INTEGER),
reserves.day (TEXT),
)
Table sailors (
sailors.sid (INTEGER),
sailors.name (TEXT),
sailors.rating (INTEGER),
sailors.age (INTEGER),
)
Possible JOINs:
reserves.sid = sailors.sid
reserves.bid = boats.bid
| CREATE TABLE boats (
boats.bid (INTEGER),
boats.name (TEXT),
boats.color (TEXT),
)
CREATE TABLE reserves (
reserves.sid (INTEGER),
reserves.bid (INTEGER),
reserves.day (TEXT),
)
CREATE TABLE sailors (
sailors.sid (INTEGER),
sailors.name (TEXT),
sailors.rating (INTEGER),
sailors.age (INTEGER),
)
Possible JOINs:
reserves.sid = sailors.sid
reserves.bid = boats.bid
| {
'Sailors': ['sid', 'name', 'rating', 'age'],
'Boats': ['bid', 'name', 'color'],
'Reserves': ['sid', 'bid', 'day']
} | {
'Sailors': ['sid', 'age'],
'Reserves': ['sid', 'bid'],
'Boats': ['bid', 'name']
} | TABLE Boats (
Boats.bid (INTEGER),
Boats.name (TEXT),
Boats.color (TEXT),
)
TABLE Reserves (
Reserves.sid (INTEGER),
Reserves.bid (INTEGER),
Reserves.day (TEXT),
)
TABLE Sailors (
Sailors.sid (INTEGER),
Sailors.name (TEXT),
Sailors.rating (INTEGER),
Sailors.age (INTEGER),
)
Possible JOINs:
Reserves.sid = Sailors.sid
Reserves.bid = Boats.bid
| TABLE Boats (
Boats.bid (INTEGER),
Boats.name (TEXT),
Boats.color (TEXT),
)
TABLE Reserves (
Reserves.sid (INTEGER),
Reserves.bid (INTEGER),
Reserves.day (TEXT),
)
TABLE Sailors (
Sailors.sid (INTEGER),
Sailors.name (TEXT),
Sailors.rating (INTEGER),
Sailors.age (INTEGER),
)
Possible JOINs:
Reserves.sid = Sailors.sid
Reserves.bid = Boats.bid
| TABLE boats (
boats.bid (INTEGER),
boats.name (TEXT),
boats.color (TEXT),
)
TABLE reserves (
reserves.sid (INTEGER),
reserves.bid (INTEGER),
reserves.day (TEXT),
)
TABLE sailors (
sailors.sid (INTEGER),
sailors.name (TEXT),
sailors.rating (INTEGER),
sailors.age (INTEGER),
)
Possible JOINs:
reserves.sid = sailors.sid
reserves.bid = boats.bid
|
cre_Students_Information_Systems |
CREATE TABLE Students (
`student_id` INTEGER NOT NULL,
`bio_data` VARCHAR(255) NOT NULL,
`student_details` VARCHAR(255) NOT NULL,
PRIMARY KEY (`student_id`)
)
/*
0 rows from Students table:
student_id bio_data student_details
*/
CREATE TABLE Transcripts (
`transcript_id` INTEGER NOT NULL,
`student_id` INTEGER NOT NULL,
`date_of_transcript` DATETIME(3),
`transcript_details` VARCHAR(255) NOT NULL,
PRIMARY KEY (`transcript_id`),
FOREIGN KEY (student_id) REFERENCES Students (student_id)
)
/*
0 rows from Transcripts table:
transcript_id student_id date_of_transcript transcript_details
*/
CREATE TABLE Behaviour_Monitoring (
`behaviour_monitoring_id` INTEGER NOT NULL,
`student_id` INTEGER NOT NULL,
`behaviour_monitoring_details` VARCHAR(255) NOT NULL,
PRIMARY KEY (`behaviour_monitoring_id`),
FOREIGN KEY (student_id) REFERENCES Students (student_id)
)
/*
0 rows from Behaviour_Monitoring table:
behaviour_monitoring_id student_id behaviour_monitoring_details
*/
CREATE TABLE Addresses (
`address_id` INTEGER NOT NULL,
`address_details` VARCHAR(255) NOT NULL,
PRIMARY KEY (`address_id`)
)
/*
0 rows from Addresses table:
address_id address_details
*/
CREATE TABLE Ref_Event_Types (
`event_type_code` CHAR(10) NOT NULL,
`event_type_description` VARCHAR(255) NOT NULL,
PRIMARY KEY (`event_type_code`)
)
/*
0 rows from Ref_Event_Types table:
event_type_code event_type_description
*/
CREATE TABLE Ref_Achievement_Type (
`achievement_type_code` CHAR(15) NOT NULL,
`achievement_type_description` VARCHAR(80),
PRIMARY KEY (`achievement_type_code`)
)
/*
0 rows from Ref_Achievement_Type table:
achievement_type_code achievement_type_description
*/
CREATE TABLE Ref_Address_Types (
`address_type_code` CHAR(10) NOT NULL,
`address_type_description` VARCHAR(255) NOT NULL,
PRIMARY KEY (`address_type_code`)
)
/*
0 rows from Ref_Address_Types table:
address_type_code address_type_description
*/
CREATE TABLE Ref_Detention_Type (
`detention_type_code` CHAR(10) NOT NULL,
`detention_type_description` VARCHAR(80),
PRIMARY KEY (`detention_type_code`)
)
/*
0 rows from Ref_Detention_Type table:
detention_type_code detention_type_description
*/
CREATE TABLE Student_Events (
`event_id` INTEGER NOT NULL,
`event_type_code` CHAR(10) NOT NULL,
`student_id` INTEGER NOT NULL,
`event_date` DATETIME(3),
`other_details` VARCHAR(255) NOT NULL,
PRIMARY KEY (`event_id`),
FOREIGN KEY (student_id) REFERENCES Students (student_id),
FOREIGN KEY (event_type_code) REFERENCES Ref_Event_Types (event_type_code)
)
/*
0 rows from Student_Events table:
event_id event_type_code student_id event_date other_details
*/
CREATE TABLE Teachers (
`teacher_id` INTEGER NOT NULL,
`teacher_details` VARCHAR(255),
PRIMARY KEY (`teacher_id`)
)
/*
0 rows from Teachers table:
teacher_id teacher_details
*/
CREATE TABLE Student_Loans (
`student_loan_id` INTEGER NOT NULL,
`student_id` INTEGER NOT NULL,
`date_of_loan` DATETIME(3),
`amount_of_loan` DECIMAL(15,4),
`other_details` VARCHAR(255),
PRIMARY KEY (`student_loan_id`),
FOREIGN KEY (student_id) REFERENCES Students (student_id)
)
/*
0 rows from Student_Loans table:
student_loan_id student_id date_of_loan amount_of_loan other_details
*/
CREATE TABLE Classes (
`class_id` INTEGER NOT NULL,
`student_id` INTEGER NOT NULL,
`teacher_id` INTEGER NOT NULL,
`class_details` VARCHAR(255) NOT NULL,
PRIMARY KEY (`class_id`),
FOREIGN KEY (student_id) REFERENCES Students (student_id),
FOREIGN KEY (teacher_id) REFERENCES Teachers (teacher_id)
)
/*
0 rows from Classes table:
class_id student_id teacher_id class_details
*/
CREATE TABLE Students_Addresses (
`student_address_id` INTEGER NOT NULL,
`address_id` INTEGER NOT NULL,
`address_type_code` CHAR(10) NOT NULL,
`student_id` INTEGER NOT NULL,
`date_from` DATETIME(3),
`date_to` DATETIME(3),
PRIMARY KEY (`student_address_id`),
FOREIGN KEY (student_id) REFERENCES Students (student_id),
FOREIGN KEY (address_id) REFERENCES Addresses (address_id),
FOREIGN KEY (address_type_code) REFERENCES Ref_Address_Types (address_type_code)
)
/*
0 rows from Students_Addresses table:
student_address_id address_id address_type_code student_id date_from date_to
*/
CREATE TABLE Detention (
`detention_id` INTEGER NOT NULL,
`detention_type_code` CHAR(10) NOT NULL,
`student_id` INTEGER NOT NULL,
`datetime_detention_start` DATETIME(3),
`datetime_detention_end` DATETIME(3),
`detention_summary` VARCHAR(255),
`other_details` VARCHAR(255),
PRIMARY KEY (`detention_id`),
FOREIGN KEY (student_id) REFERENCES Students (student_id),
FOREIGN KEY (detention_type_code) REFERENCES Ref_Detention_Type (detention_type_code)
)
/*
0 rows from Detention table:
detention_id detention_type_code student_id datetime_detention_start datetime_detention_end detention_summary other_details
*/
CREATE TABLE Achievements (
`achievement_id` INTEGER NOT NULL,
`achievement_type_code` CHAR(15) NOT NULL,
`student_id` INTEGER NOT NULL,
`date_achievement` DATETIME(3),
`achievement_details` VARCHAR(255),
`other_details` VARCHAR(255),
PRIMARY KEY (`achievement_id`),
FOREIGN KEY (student_id) REFERENCES Students (student_id),
FOREIGN KEY (achievement_type_code) REFERENCES Ref_Achievement_Type (achievement_type_code)
)
/*
0 rows from Achievements table:
achievement_id achievement_type_code student_id date_achievement achievement_details other_details
*/
| What are the type code, details, and date of each achievement? | medium | Table Achievements (
Achievements.achievement_id (INTEGER),
Achievements.achievement_type_code (CHAR(15)),
Achievements.student_id (INTEGER),
Achievements.date_achievement (DATETIME(3)),
Achievements.achievement_details (VARCHAR(255)),
Achievements.other_details (VARCHAR(255)),
)
Table Addresses (
Addresses.address_id (INTEGER),
Addresses.address_details (VARCHAR(255)),
)
Table Behaviour_Monitoring (
Behaviour_Monitoring.behaviour_monitoring_id (INTEGER),
Behaviour_Monitoring.student_id (INTEGER),
Behaviour_Monitoring.behaviour_monitoring_details (VARCHAR(255)),
)
Table Classes (
Classes.class_id (INTEGER),
Classes.student_id (INTEGER),
Classes.teacher_id (INTEGER),
Classes.class_details (VARCHAR(255)),
)
Table Detention (
Detention.detention_id (INTEGER),
Detention.detention_type_code (CHAR(10)),
Detention.student_id (INTEGER),
Detention.datetime_detention_start (DATETIME(3)),
Detention.datetime_detention_end (DATETIME(3)),
Detention.detention_summary (VARCHAR(255)),
Detention.other_details (VARCHAR(255)),
)
Table Ref_Achievement_Type (
Ref_Achievement_Type.achievement_type_code (CHAR(15)),
Ref_Achievement_Type.achievement_type_description (VARCHAR(80)),
)
Table Ref_Address_Types (
Ref_Address_Types.address_type_code (CHAR(10)),
Ref_Address_Types.address_type_description (VARCHAR(255)),
)
Table Ref_Detention_Type (
Ref_Detention_Type.detention_type_code (CHAR(10)),
Ref_Detention_Type.detention_type_description (VARCHAR(80)),
)
Table Ref_Event_Types (
Ref_Event_Types.event_type_code (CHAR(10)),
Ref_Event_Types.event_type_description (VARCHAR(255)),
)
Table Student_Events (
Student_Events.event_id (INTEGER),
Student_Events.event_type_code (CHAR(10)),
Student_Events.student_id (INTEGER),
Student_Events.event_date (DATETIME(3)),
Student_Events.other_details (VARCHAR(255)),
)
Table Student_Loans (
Student_Loans.student_loan_id (INTEGER),
Student_Loans.student_id (INTEGER),
Student_Loans.date_of_loan (DATETIME(3)),
Student_Loans.amount_of_loan (DECIMAL(15,4)),
Student_Loans.other_details (VARCHAR(255)),
)
Table Students (
Students.student_id (INTEGER),
Students.bio_data (VARCHAR(255)),
Students.student_details (VARCHAR(255)),
)
Table Students_Addresses (
Students_Addresses.student_address_id (INTEGER),
Students_Addresses.address_id (INTEGER),
Students_Addresses.address_type_code (CHAR(10)),
Students_Addresses.student_id (INTEGER),
Students_Addresses.date_from (DATETIME(3)),
Students_Addresses.date_to (DATETIME(3)),
)
Table Teachers (
Teachers.teacher_id (INTEGER),
Teachers.teacher_details (VARCHAR(255)),
)
Table Transcripts (
Transcripts.transcript_id (INTEGER),
Transcripts.student_id (INTEGER),
Transcripts.date_of_transcript (DATETIME(3)),
Transcripts.transcript_details (VARCHAR(255)),
)
Possible JOINs:
Achievements.achievement_type_code = Ref_Achievement_Type.achievement_type_code
Achievements.student_id = Students.student_id
Behaviour_Monitoring.student_id = Students.student_id
Classes.student_id = Students.student_id
Classes.teacher_id = Teachers.teacher_id
Detention.detention_type_code = Ref_Detention_Type.detention_type_code
Detention.student_id = Students.student_id
Student_Events.event_type_code = Ref_Event_Types.event_type_code
Student_Events.student_id = Students.student_id
Student_Loans.student_id = Students.student_id
Students_Addresses.address_id = Addresses.address_id
Students_Addresses.address_type_code = Ref_Address_Types.address_type_code
Students_Addresses.student_id = Students.student_id
Transcripts.student_id = Students.student_id
| SELECT achievement_type_code , achievement_details , date_achievement FROM Achievements | {
'achievements': ['achievement_id', 'achievement_type_code', 'date_achievement', 'achievement_details']
} | CREATE TABLE Achievements (
Achievements.achievement_id (INTEGER),
Achievements.achievement_type_code (CHAR(15)),
Achievements.student_id (INTEGER),
Achievements.date_achievement (DATETIME(3)),
Achievements.achievement_details (VARCHAR(255)),
Achievements.other_details (VARCHAR(255)),
)
CREATE TABLE Addresses (
Addresses.address_id (INTEGER),
Addresses.address_details (VARCHAR(255)),
)
CREATE TABLE Behaviour_Monitoring (
Behaviour_Monitoring.behaviour_monitoring_id (INTEGER),
Behaviour_Monitoring.student_id (INTEGER),
Behaviour_Monitoring.behaviour_monitoring_details (VARCHAR(255)),
)
CREATE TABLE Classes (
Classes.class_id (INTEGER),
Classes.student_id (INTEGER),
Classes.teacher_id (INTEGER),
Classes.class_details (VARCHAR(255)),
)
CREATE TABLE Detention (
Detention.detention_id (INTEGER),
Detention.detention_type_code (CHAR(10)),
Detention.student_id (INTEGER),
Detention.datetime_detention_start (DATETIME(3)),
Detention.datetime_detention_end (DATETIME(3)),
Detention.detention_summary (VARCHAR(255)),
Detention.other_details (VARCHAR(255)),
)
CREATE TABLE Ref_Achievement_Type (
Ref_Achievement_Type.achievement_type_code (CHAR(15)),
Ref_Achievement_Type.achievement_type_description (VARCHAR(80)),
)
CREATE TABLE Ref_Address_Types (
Ref_Address_Types.address_type_code (CHAR(10)),
Ref_Address_Types.address_type_description (VARCHAR(255)),
)
CREATE TABLE Ref_Detention_Type (
Ref_Detention_Type.detention_type_code (CHAR(10)),
Ref_Detention_Type.detention_type_description (VARCHAR(80)),
)
CREATE TABLE Ref_Event_Types (
Ref_Event_Types.event_type_code (CHAR(10)),
Ref_Event_Types.event_type_description (VARCHAR(255)),
)
CREATE TABLE Student_Events (
Student_Events.event_id (INTEGER),
Student_Events.event_type_code (CHAR(10)),
Student_Events.student_id (INTEGER),
Student_Events.event_date (DATETIME(3)),
Student_Events.other_details (VARCHAR(255)),
)
CREATE TABLE Student_Loans (
Student_Loans.student_loan_id (INTEGER),
Student_Loans.student_id (INTEGER),
Student_Loans.date_of_loan (DATETIME(3)),
Student_Loans.amount_of_loan (DECIMAL(15,4)),
Student_Loans.other_details (VARCHAR(255)),
)
CREATE TABLE Students (
Students.student_id (INTEGER),
Students.bio_data (VARCHAR(255)),
Students.student_details (VARCHAR(255)),
)
CREATE TABLE Students_Addresses (
Students_Addresses.student_address_id (INTEGER),
Students_Addresses.address_id (INTEGER),
Students_Addresses.address_type_code (CHAR(10)),
Students_Addresses.student_id (INTEGER),
Students_Addresses.date_from (DATETIME(3)),
Students_Addresses.date_to (DATETIME(3)),
)
CREATE TABLE Teachers (
Teachers.teacher_id (INTEGER),
Teachers.teacher_details (VARCHAR(255)),
)
CREATE TABLE Transcripts (
Transcripts.transcript_id (INTEGER),
Transcripts.student_id (INTEGER),
Transcripts.date_of_transcript (DATETIME(3)),
Transcripts.transcript_details (VARCHAR(255)),
)
Possible JOINs:
Achievements.achievement_type_code = Ref_Achievement_Type.achievement_type_code
Achievements.student_id = Students.student_id
Behaviour_Monitoring.student_id = Students.student_id
Classes.student_id = Students.student_id
Classes.teacher_id = Teachers.teacher_id
Detention.detention_type_code = Ref_Detention_Type.detention_type_code
Detention.student_id = Students.student_id
Student_Events.event_type_code = Ref_Event_Types.event_type_code
Student_Events.student_id = Students.student_id
Student_Loans.student_id = Students.student_id
Students_Addresses.address_id = Addresses.address_id
Students_Addresses.address_type_code = Ref_Address_Types.address_type_code
Students_Addresses.student_id = Students.student_id
Transcripts.student_id = Students.student_id
| Table Achievements (
Achievements.achievement_id (INTEGER),
Achievements.achievement_type_code (CHAR(15)),
Achievements.student_id (INTEGER),
Achievements.date_achievement (DATETIME(3)),
Achievements.achievement_details (VARCHAR(255)),
Achievements.other_details (VARCHAR(255)),
)
Table Addresses (
Addresses.address_id (INTEGER),
Addresses.address_details (VARCHAR(255)),
)
Table Behaviour_Monitoring (
Behaviour_Monitoring.behaviour_monitoring_id (INTEGER),
Behaviour_Monitoring.student_id (INTEGER),
Behaviour_Monitoring.behaviour_monitoring_details (VARCHAR(255)),
)
Table Classes (
Classes.class_id (INTEGER),
Classes.student_id (INTEGER),
Classes.teacher_id (INTEGER),
Classes.class_details (VARCHAR(255)),
)
Table Detention (
Detention.detention_id (INTEGER),
Detention.detention_type_code (CHAR(10)),
Detention.student_id (INTEGER),
Detention.datetime_detention_start (DATETIME(3)),
Detention.datetime_detention_end (DATETIME(3)),
Detention.detention_summary (VARCHAR(255)),
Detention.other_details (VARCHAR(255)),
)
Table Ref_Achievement_Type (
Ref_Achievement_Type.achievement_type_code (CHAR(15)),
Ref_Achievement_Type.achievement_type_description (VARCHAR(80)),
)
Table Ref_Address_Types (
Ref_Address_Types.address_type_code (CHAR(10)),
Ref_Address_Types.address_type_description (VARCHAR(255)),
)
Table Ref_Detention_Type (
Ref_Detention_Type.detention_type_code (CHAR(10)),
Ref_Detention_Type.detention_type_description (VARCHAR(80)),
)
Table Ref_Event_Types (
Ref_Event_Types.event_type_code (CHAR(10)),
Ref_Event_Types.event_type_description (VARCHAR(255)),
)
Table Student_Events (
Student_Events.event_id (INTEGER),
Student_Events.event_type_code (CHAR(10)),
Student_Events.student_id (INTEGER),
Student_Events.event_date (DATETIME(3)),
Student_Events.other_details (VARCHAR(255)),
)
Table Student_Loans (
Student_Loans.student_loan_id (INTEGER),
Student_Loans.student_id (INTEGER),
Student_Loans.date_of_loan (DATETIME(3)),
Student_Loans.amount_of_loan (DECIMAL(15,4)),
Student_Loans.other_details (VARCHAR(255)),
)
Table Students (
Students.student_id (INTEGER),
Students.bio_data (VARCHAR(255)),
Students.student_details (VARCHAR(255)),
)
Table Students_Addresses (
Students_Addresses.student_address_id (INTEGER),
Students_Addresses.address_id (INTEGER),
Students_Addresses.address_type_code (CHAR(10)),
Students_Addresses.student_id (INTEGER),
Students_Addresses.date_from (DATETIME(3)),
Students_Addresses.date_to (DATETIME(3)),
)
Table Teachers (
Teachers.teacher_id (INTEGER),
Teachers.teacher_details (VARCHAR(255)),
)
Table Transcripts (
Transcripts.transcript_id (INTEGER),
Transcripts.student_id (INTEGER),
Transcripts.date_of_transcript (DATETIME(3)),
Transcripts.transcript_details (VARCHAR(255)),
)
Possible JOINs:
Achievements.achievement_type_code = Ref_Achievement_Type.achievement_type_code
Achievements.student_id = Students.student_id
Behaviour_Monitoring.student_id = Students.student_id
Classes.student_id = Students.student_id
Classes.teacher_id = Teachers.teacher_id
Detention.detention_type_code = Ref_Detention_Type.detention_type_code
Detention.student_id = Students.student_id
Student_Events.event_type_code = Ref_Event_Types.event_type_code
Student_Events.student_id = Students.student_id
Student_Loans.student_id = Students.student_id
Students_Addresses.address_id = Addresses.address_id
Students_Addresses.address_type_code = Ref_Address_Types.address_type_code
Students_Addresses.student_id = Students.student_id
Transcripts.student_id = Students.student_id
| CREATE TABLE Achievements (
Achievements.achievement_id (INTEGER),
Achievements.achievement_type_code (CHAR(15)),
Achievements.student_id (INTEGER),
Achievements.date_achievement (DATETIME(3)),
Achievements.achievement_details (VARCHAR(255)),
Achievements.other_details (VARCHAR(255)),
)
CREATE TABLE Addresses (
Addresses.address_id (INTEGER),
Addresses.address_details (VARCHAR(255)),
)
CREATE TABLE Behaviour_Monitoring (
Behaviour_Monitoring.behaviour_monitoring_id (INTEGER),
Behaviour_Monitoring.student_id (INTEGER),
Behaviour_Monitoring.behaviour_monitoring_details (VARCHAR(255)),
)
CREATE TABLE Classes (
Classes.class_id (INTEGER),
Classes.student_id (INTEGER),
Classes.teacher_id (INTEGER),
Classes.class_details (VARCHAR(255)),
)
CREATE TABLE Detention (
Detention.detention_id (INTEGER),
Detention.detention_type_code (CHAR(10)),
Detention.student_id (INTEGER),
Detention.datetime_detention_start (DATETIME(3)),
Detention.datetime_detention_end (DATETIME(3)),
Detention.detention_summary (VARCHAR(255)),
Detention.other_details (VARCHAR(255)),
)
CREATE TABLE Ref_Achievement_Type (
Ref_Achievement_Type.achievement_type_code (CHAR(15)),
Ref_Achievement_Type.achievement_type_description (VARCHAR(80)),
)
CREATE TABLE Ref_Address_Types (
Ref_Address_Types.address_type_code (CHAR(10)),
Ref_Address_Types.address_type_description (VARCHAR(255)),
)
CREATE TABLE Ref_Detention_Type (
Ref_Detention_Type.detention_type_code (CHAR(10)),
Ref_Detention_Type.detention_type_description (VARCHAR(80)),
)
CREATE TABLE Ref_Event_Types (
Ref_Event_Types.event_type_code (CHAR(10)),
Ref_Event_Types.event_type_description (VARCHAR(255)),
)
CREATE TABLE Student_Events (
Student_Events.event_id (INTEGER),
Student_Events.event_type_code (CHAR(10)),
Student_Events.student_id (INTEGER),
Student_Events.event_date (DATETIME(3)),
Student_Events.other_details (VARCHAR(255)),
)
CREATE TABLE Student_Loans (
Student_Loans.student_loan_id (INTEGER),
Student_Loans.student_id (INTEGER),
Student_Loans.date_of_loan (DATETIME(3)),
Student_Loans.amount_of_loan (DECIMAL(15,4)),
Student_Loans.other_details (VARCHAR(255)),
)
CREATE TABLE Students (
Students.student_id (INTEGER),
Students.bio_data (VARCHAR(255)),
Students.student_details (VARCHAR(255)),
)
CREATE TABLE Students_Addresses (
Students_Addresses.student_address_id (INTEGER),
Students_Addresses.address_id (INTEGER),
Students_Addresses.address_type_code (CHAR(10)),
Students_Addresses.student_id (INTEGER),
Students_Addresses.date_from (DATETIME(3)),
Students_Addresses.date_to (DATETIME(3)),
)
CREATE TABLE Teachers (
Teachers.teacher_id (INTEGER),
Teachers.teacher_details (VARCHAR(255)),
)
CREATE TABLE Transcripts (
Transcripts.transcript_id (INTEGER),
Transcripts.student_id (INTEGER),
Transcripts.date_of_transcript (DATETIME(3)),
Transcripts.transcript_details (VARCHAR(255)),
)
Possible JOINs:
Achievements.achievement_type_code = Ref_Achievement_Type.achievement_type_code
Achievements.student_id = Students.student_id
Behaviour_Monitoring.student_id = Students.student_id
Classes.student_id = Students.student_id
Classes.teacher_id = Teachers.teacher_id
Detention.detention_type_code = Ref_Detention_Type.detention_type_code
Detention.student_id = Students.student_id
Student_Events.event_type_code = Ref_Event_Types.event_type_code
Student_Events.student_id = Students.student_id
Student_Loans.student_id = Students.student_id
Students_Addresses.address_id = Addresses.address_id
Students_Addresses.address_type_code = Ref_Address_Types.address_type_code
Students_Addresses.student_id = Students.student_id
Transcripts.student_id = Students.student_id
| Table achievements (
achievements.achievement_id (INTEGER),
achievements.achievement_type_code (CHAR(15)),
achievements.student_id (INTEGER),
achievements.date_achievement (DATETIME(3)),
achievements.achievement_details (VARCHAR(255)),
achievements.other_details (VARCHAR(255)),
)
Table addresses (
addresses.address_id (INTEGER),
addresses.address_details (VARCHAR(255)),
)
Table behaviour_monitoring (
behaviour_monitoring.behaviour_monitoring_id (INTEGER),
behaviour_monitoring.student_id (INTEGER),
behaviour_monitoring.behaviour_monitoring_details (VARCHAR(255)),
)
Table classes (
classes.class_id (INTEGER),
classes.student_id (INTEGER),
classes.teacher_id (INTEGER),
classes.class_details (VARCHAR(255)),
)
Table detention (
detention.detention_id (INTEGER),
detention.detention_type_code (CHAR(10)),
detention.student_id (INTEGER),
detention.datetime_detention_start (DATETIME(3)),
detention.datetime_detention_end (DATETIME(3)),
detention.detention_summary (VARCHAR(255)),
detention.other_details (VARCHAR(255)),
)
Table ref_achievement_type (
ref_achievement_type.achievement_type_code (CHAR(15)),
ref_achievement_type.achievement_type_description (VARCHAR(80)),
)
Table ref_address_types (
ref_address_types.address_type_code (CHAR(10)),
ref_address_types.address_type_description (VARCHAR(255)),
)
Table ref_detention_type (
ref_detention_type.detention_type_code (CHAR(10)),
ref_detention_type.detention_type_description (VARCHAR(80)),
)
Table ref_event_types (
ref_event_types.event_type_code (CHAR(10)),
ref_event_types.event_type_description (VARCHAR(255)),
)
Table student_events (
student_events.event_id (INTEGER),
student_events.event_type_code (CHAR(10)),
student_events.student_id (INTEGER),
student_events.event_date (DATETIME(3)),
student_events.other_details (VARCHAR(255)),
)
Table student_loans (
student_loans.student_loan_id (INTEGER),
student_loans.student_id (INTEGER),
student_loans.date_of_loan (DATETIME(3)),
student_loans.amount_of_loan (DECIMAL(15,4)),
student_loans.other_details (VARCHAR(255)),
)
Table students (
students.student_id (INTEGER),
students.bio_data (VARCHAR(255)),
students.student_details (VARCHAR(255)),
)
Table students_addresses (
students_addresses.student_address_id (INTEGER),
students_addresses.address_id (INTEGER),
students_addresses.address_type_code (CHAR(10)),
students_addresses.student_id (INTEGER),
students_addresses.date_from (DATETIME(3)),
students_addresses.date_to (DATETIME(3)),
)
Table teachers (
teachers.teacher_id (INTEGER),
teachers.teacher_details (VARCHAR(255)),
)
Table transcripts (
transcripts.transcript_id (INTEGER),
transcripts.student_id (INTEGER),
transcripts.date_of_transcript (DATETIME(3)),
transcripts.transcript_details (VARCHAR(255)),
)
Possible JOINs:
achievements.achievement_type_code = ref_achievement_type.achievement_type_code
achievements.student_id = students.student_id
behaviour_monitoring.student_id = students.student_id
classes.student_id = students.student_id
classes.teacher_id = teachers.teacher_id
detention.detention_type_code = ref_detention_type.detention_type_code
detention.student_id = students.student_id
student_events.event_type_code = ref_event_types.event_type_code
student_events.student_id = students.student_id
student_loans.student_id = students.student_id
students_addresses.address_id = addresses.address_id
students_addresses.address_type_code = ref_address_types.address_type_code
students_addresses.student_id = students.student_id
transcripts.student_id = students.student_id
| CREATE TABLE achievements (
achievements.achievement_id (INTEGER),
achievements.achievement_type_code (CHAR(15)),
achievements.student_id (INTEGER),
achievements.date_achievement (DATETIME(3)),
achievements.achievement_details (VARCHAR(255)),
achievements.other_details (VARCHAR(255)),
)
CREATE TABLE addresses (
addresses.address_id (INTEGER),
addresses.address_details (VARCHAR(255)),
)
CREATE TABLE behaviour_monitoring (
behaviour_monitoring.behaviour_monitoring_id (INTEGER),
behaviour_monitoring.student_id (INTEGER),
behaviour_monitoring.behaviour_monitoring_details (VARCHAR(255)),
)
CREATE TABLE classes (
classes.class_id (INTEGER),
classes.student_id (INTEGER),
classes.teacher_id (INTEGER),
classes.class_details (VARCHAR(255)),
)
CREATE TABLE detention (
detention.detention_id (INTEGER),
detention.detention_type_code (CHAR(10)),
detention.student_id (INTEGER),
detention.datetime_detention_start (DATETIME(3)),
detention.datetime_detention_end (DATETIME(3)),
detention.detention_summary (VARCHAR(255)),
detention.other_details (VARCHAR(255)),
)
CREATE TABLE ref_achievement_type (
ref_achievement_type.achievement_type_code (CHAR(15)),
ref_achievement_type.achievement_type_description (VARCHAR(80)),
)
CREATE TABLE ref_address_types (
ref_address_types.address_type_code (CHAR(10)),
ref_address_types.address_type_description (VARCHAR(255)),
)
CREATE TABLE ref_detention_type (
ref_detention_type.detention_type_code (CHAR(10)),
ref_detention_type.detention_type_description (VARCHAR(80)),
)
CREATE TABLE ref_event_types (
ref_event_types.event_type_code (CHAR(10)),
ref_event_types.event_type_description (VARCHAR(255)),
)
CREATE TABLE student_events (
student_events.event_id (INTEGER),
student_events.event_type_code (CHAR(10)),
student_events.student_id (INTEGER),
student_events.event_date (DATETIME(3)),
student_events.other_details (VARCHAR(255)),
)
CREATE TABLE student_loans (
student_loans.student_loan_id (INTEGER),
student_loans.student_id (INTEGER),
student_loans.date_of_loan (DATETIME(3)),
student_loans.amount_of_loan (DECIMAL(15,4)),
student_loans.other_details (VARCHAR(255)),
)
CREATE TABLE students (
students.student_id (INTEGER),
students.bio_data (VARCHAR(255)),
students.student_details (VARCHAR(255)),
)
CREATE TABLE students_addresses (
students_addresses.student_address_id (INTEGER),
students_addresses.address_id (INTEGER),
students_addresses.address_type_code (CHAR(10)),
students_addresses.student_id (INTEGER),
students_addresses.date_from (DATETIME(3)),
students_addresses.date_to (DATETIME(3)),
)
CREATE TABLE teachers (
teachers.teacher_id (INTEGER),
teachers.teacher_details (VARCHAR(255)),
)
CREATE TABLE transcripts (
transcripts.transcript_id (INTEGER),
transcripts.student_id (INTEGER),
transcripts.date_of_transcript (DATETIME(3)),
transcripts.transcript_details (VARCHAR(255)),
)
Possible JOINs:
achievements.achievement_type_code = ref_achievement_type.achievement_type_code
achievements.student_id = students.student_id
behaviour_monitoring.student_id = students.student_id
classes.student_id = students.student_id
classes.teacher_id = teachers.teacher_id
detention.detention_type_code = ref_detention_type.detention_type_code
detention.student_id = students.student_id
student_events.event_type_code = ref_event_types.event_type_code
student_events.student_id = students.student_id
student_loans.student_id = students.student_id
students_addresses.address_id = addresses.address_id
students_addresses.address_type_code = ref_address_types.address_type_code
students_addresses.student_id = students.student_id
transcripts.student_id = students.student_id
| {
'Students': ['student_id', 'bio_data', 'student_details'],
'Transcripts': ['transcript_id', 'student_id', 'date_of_transcript', 'transcript_details'],
'Behaviour_Monitoring': ['behaviour_monitoring_id', 'student_id', 'behaviour_monitoring_details'],
'Addresses': ['address_id', 'address_details'],
'Ref_Event_Types': ['event_type_code', 'event_type_description'],
'Ref_Achievement_Type': ['achievement_type_code', 'achievement_type_description'],
'Ref_Address_Types': ['address_type_code', 'address_type_description'],
'Ref_Detention_Type': ['detention_type_code', 'detention_type_description'],
'Student_Events': ['event_id', 'event_type_code', 'student_id', 'event_date', 'other_details'],
'Teachers': ['teacher_id', 'teacher_details'],
'Student_Loans': ['student_loan_id', 'student_id', 'date_of_loan', 'amount_of_loan', 'other_details'],
'Classes': ['class_id', 'student_id', 'teacher_id', 'class_details'],
'Students_Addresses': ['student_address_id', 'address_id', 'address_type_code', 'student_id', 'date_from', 'date_to'],
'Detention': ['detention_id', 'detention_type_code', 'student_id', 'datetime_detention_start', 'datetime_detention_end', 'detention_summary', 'other_details'],
'Achievements': ['achievement_id', 'achievement_type_code', 'student_id', 'date_achievement', 'achievement_details', 'other_details']
} | {
'Achievements': ['achievement_id', 'achievement_type_code', 'date_achievement', 'achievement_details']
} | TABLE Achievements (
Achievements.achievement_id (INTEGER),
Achievements.achievement_type_code (CHAR(15)),
Achievements.student_id (INTEGER),
Achievements.date_achievement (DATETIME(3)),
Achievements.achievement_details (VARCHAR(255)),
Achievements.other_details (VARCHAR(255)),
)
TABLE Addresses (
Addresses.address_id (INTEGER),
Addresses.address_details (VARCHAR(255)),
)
TABLE Behaviour_Monitoring (
Behaviour_Monitoring.behaviour_monitoring_id (INTEGER),
Behaviour_Monitoring.student_id (INTEGER),
Behaviour_Monitoring.behaviour_monitoring_details (VARCHAR(255)),
)
TABLE Classes (
Classes.class_id (INTEGER),
Classes.student_id (INTEGER),
Classes.teacher_id (INTEGER),
Classes.class_details (VARCHAR(255)),
)
TABLE Detention (
Detention.detention_id (INTEGER),
Detention.detention_type_code (CHAR(10)),
Detention.student_id (INTEGER),
Detention.datetime_detention_start (DATETIME(3)),
Detention.datetime_detention_end (DATETIME(3)),
Detention.detention_summary (VARCHAR(255)),
Detention.other_details (VARCHAR(255)),
)
TABLE Ref_Achievement_Type (
Ref_Achievement_Type.achievement_type_code (CHAR(15)),
Ref_Achievement_Type.achievement_type_description (VARCHAR(80)),
)
TABLE Ref_Address_Types (
Ref_Address_Types.address_type_code (CHAR(10)),
Ref_Address_Types.address_type_description (VARCHAR(255)),
)
TABLE Ref_Detention_Type (
Ref_Detention_Type.detention_type_code (CHAR(10)),
Ref_Detention_Type.detention_type_description (VARCHAR(80)),
)
TABLE Ref_Event_Types (
Ref_Event_Types.event_type_code (CHAR(10)),
Ref_Event_Types.event_type_description (VARCHAR(255)),
)
TABLE Student_Events (
Student_Events.event_id (INTEGER),
Student_Events.event_type_code (CHAR(10)),
Student_Events.student_id (INTEGER),
Student_Events.event_date (DATETIME(3)),
Student_Events.other_details (VARCHAR(255)),
)
TABLE Student_Loans (
Student_Loans.student_loan_id (INTEGER),
Student_Loans.student_id (INTEGER),
Student_Loans.date_of_loan (DATETIME(3)),
Student_Loans.amount_of_loan (DECIMAL(15,4)),
Student_Loans.other_details (VARCHAR(255)),
)
TABLE Students (
Students.student_id (INTEGER),
Students.bio_data (VARCHAR(255)),
Students.student_details (VARCHAR(255)),
)
TABLE Students_Addresses (
Students_Addresses.student_address_id (INTEGER),
Students_Addresses.address_id (INTEGER),
Students_Addresses.address_type_code (CHAR(10)),
Students_Addresses.student_id (INTEGER),
Students_Addresses.date_from (DATETIME(3)),
Students_Addresses.date_to (DATETIME(3)),
)
TABLE Teachers (
Teachers.teacher_id (INTEGER),
Teachers.teacher_details (VARCHAR(255)),
)
TABLE Transcripts (
Transcripts.transcript_id (INTEGER),
Transcripts.student_id (INTEGER),
Transcripts.date_of_transcript (DATETIME(3)),
Transcripts.transcript_details (VARCHAR(255)),
)
Possible JOINs:
Achievements.achievement_type_code = Ref_Achievement_Type.achievement_type_code
Achievements.student_id = Students.student_id
Behaviour_Monitoring.student_id = Students.student_id
Classes.student_id = Students.student_id
Classes.teacher_id = Teachers.teacher_id
Detention.detention_type_code = Ref_Detention_Type.detention_type_code
Detention.student_id = Students.student_id
Student_Events.event_type_code = Ref_Event_Types.event_type_code
Student_Events.student_id = Students.student_id
Student_Loans.student_id = Students.student_id
Students_Addresses.address_id = Addresses.address_id
Students_Addresses.address_type_code = Ref_Address_Types.address_type_code
Students_Addresses.student_id = Students.student_id
Transcripts.student_id = Students.student_id
| TABLE Achievements (
Achievements.achievement_id (INTEGER),
Achievements.achievement_type_code (CHAR(15)),
Achievements.student_id (INTEGER),
Achievements.date_achievement (DATETIME(3)),
Achievements.achievement_details (VARCHAR(255)),
Achievements.other_details (VARCHAR(255)),
)
TABLE Addresses (
Addresses.address_id (INTEGER),
Addresses.address_details (VARCHAR(255)),
)
TABLE Behaviour_Monitoring (
Behaviour_Monitoring.behaviour_monitoring_id (INTEGER),
Behaviour_Monitoring.student_id (INTEGER),
Behaviour_Monitoring.behaviour_monitoring_details (VARCHAR(255)),
)
TABLE Classes (
Classes.class_id (INTEGER),
Classes.student_id (INTEGER),
Classes.teacher_id (INTEGER),
Classes.class_details (VARCHAR(255)),
)
TABLE Detention (
Detention.detention_id (INTEGER),
Detention.detention_type_code (CHAR(10)),
Detention.student_id (INTEGER),
Detention.datetime_detention_start (DATETIME(3)),
Detention.datetime_detention_end (DATETIME(3)),
Detention.detention_summary (VARCHAR(255)),
Detention.other_details (VARCHAR(255)),
)
TABLE Ref_Achievement_Type (
Ref_Achievement_Type.achievement_type_code (CHAR(15)),
Ref_Achievement_Type.achievement_type_description (VARCHAR(80)),
)
TABLE Ref_Address_Types (
Ref_Address_Types.address_type_code (CHAR(10)),
Ref_Address_Types.address_type_description (VARCHAR(255)),
)
TABLE Ref_Detention_Type (
Ref_Detention_Type.detention_type_code (CHAR(10)),
Ref_Detention_Type.detention_type_description (VARCHAR(80)),
)
TABLE Ref_Event_Types (
Ref_Event_Types.event_type_code (CHAR(10)),
Ref_Event_Types.event_type_description (VARCHAR(255)),
)
TABLE Student_Events (
Student_Events.event_id (INTEGER),
Student_Events.event_type_code (CHAR(10)),
Student_Events.student_id (INTEGER),
Student_Events.event_date (DATETIME(3)),
Student_Events.other_details (VARCHAR(255)),
)
TABLE Student_Loans (
Student_Loans.student_loan_id (INTEGER),
Student_Loans.student_id (INTEGER),
Student_Loans.date_of_loan (DATETIME(3)),
Student_Loans.amount_of_loan (DECIMAL(15,4)),
Student_Loans.other_details (VARCHAR(255)),
)
TABLE Students (
Students.student_id (INTEGER),
Students.bio_data (VARCHAR(255)),
Students.student_details (VARCHAR(255)),
)
TABLE Students_Addresses (
Students_Addresses.student_address_id (INTEGER),
Students_Addresses.address_id (INTEGER),
Students_Addresses.address_type_code (CHAR(10)),
Students_Addresses.student_id (INTEGER),
Students_Addresses.date_from (DATETIME(3)),
Students_Addresses.date_to (DATETIME(3)),
)
TABLE Teachers (
Teachers.teacher_id (INTEGER),
Teachers.teacher_details (VARCHAR(255)),
)
TABLE Transcripts (
Transcripts.transcript_id (INTEGER),
Transcripts.student_id (INTEGER),
Transcripts.date_of_transcript (DATETIME(3)),
Transcripts.transcript_details (VARCHAR(255)),
)
Possible JOINs:
Achievements.achievement_type_code = Ref_Achievement_Type.achievement_type_code
Achievements.student_id = Students.student_id
Behaviour_Monitoring.student_id = Students.student_id
Classes.student_id = Students.student_id
Classes.teacher_id = Teachers.teacher_id
Detention.detention_type_code = Ref_Detention_Type.detention_type_code
Detention.student_id = Students.student_id
Student_Events.event_type_code = Ref_Event_Types.event_type_code
Student_Events.student_id = Students.student_id
Student_Loans.student_id = Students.student_id
Students_Addresses.address_id = Addresses.address_id
Students_Addresses.address_type_code = Ref_Address_Types.address_type_code
Students_Addresses.student_id = Students.student_id
Transcripts.student_id = Students.student_id
| TABLE achievements (
achievements.achievement_id (INTEGER),
achievements.achievement_type_code (CHAR(15)),
achievements.student_id (INTEGER),
achievements.date_achievement (DATETIME(3)),
achievements.achievement_details (VARCHAR(255)),
achievements.other_details (VARCHAR(255)),
)
TABLE addresses (
addresses.address_id (INTEGER),
addresses.address_details (VARCHAR(255)),
)
TABLE behaviour_monitoring (
behaviour_monitoring.behaviour_monitoring_id (INTEGER),
behaviour_monitoring.student_id (INTEGER),
behaviour_monitoring.behaviour_monitoring_details (VARCHAR(255)),
)
TABLE classes (
classes.class_id (INTEGER),
classes.student_id (INTEGER),
classes.teacher_id (INTEGER),
classes.class_details (VARCHAR(255)),
)
TABLE detention (
detention.detention_id (INTEGER),
detention.detention_type_code (CHAR(10)),
detention.student_id (INTEGER),
detention.datetime_detention_start (DATETIME(3)),
detention.datetime_detention_end (DATETIME(3)),
detention.detention_summary (VARCHAR(255)),
detention.other_details (VARCHAR(255)),
)
TABLE ref_achievement_type (
ref_achievement_type.achievement_type_code (CHAR(15)),
ref_achievement_type.achievement_type_description (VARCHAR(80)),
)
TABLE ref_address_types (
ref_address_types.address_type_code (CHAR(10)),
ref_address_types.address_type_description (VARCHAR(255)),
)
TABLE ref_detention_type (
ref_detention_type.detention_type_code (CHAR(10)),
ref_detention_type.detention_type_description (VARCHAR(80)),
)
TABLE ref_event_types (
ref_event_types.event_type_code (CHAR(10)),
ref_event_types.event_type_description (VARCHAR(255)),
)
TABLE student_events (
student_events.event_id (INTEGER),
student_events.event_type_code (CHAR(10)),
student_events.student_id (INTEGER),
student_events.event_date (DATETIME(3)),
student_events.other_details (VARCHAR(255)),
)
TABLE student_loans (
student_loans.student_loan_id (INTEGER),
student_loans.student_id (INTEGER),
student_loans.date_of_loan (DATETIME(3)),
student_loans.amount_of_loan (DECIMAL(15,4)),
student_loans.other_details (VARCHAR(255)),
)
TABLE students (
students.student_id (INTEGER),
students.bio_data (VARCHAR(255)),
students.student_details (VARCHAR(255)),
)
TABLE students_addresses (
students_addresses.student_address_id (INTEGER),
students_addresses.address_id (INTEGER),
students_addresses.address_type_code (CHAR(10)),
students_addresses.student_id (INTEGER),
students_addresses.date_from (DATETIME(3)),
students_addresses.date_to (DATETIME(3)),
)
TABLE teachers (
teachers.teacher_id (INTEGER),
teachers.teacher_details (VARCHAR(255)),
)
TABLE transcripts (
transcripts.transcript_id (INTEGER),
transcripts.student_id (INTEGER),
transcripts.date_of_transcript (DATETIME(3)),
transcripts.transcript_details (VARCHAR(255)),
)
Possible JOINs:
achievements.achievement_type_code = ref_achievement_type.achievement_type_code
achievements.student_id = students.student_id
behaviour_monitoring.student_id = students.student_id
classes.student_id = students.student_id
classes.teacher_id = teachers.teacher_id
detention.detention_type_code = ref_detention_type.detention_type_code
detention.student_id = students.student_id
student_events.event_type_code = ref_event_types.event_type_code
student_events.student_id = students.student_id
student_loans.student_id = students.student_id
students_addresses.address_id = addresses.address_id
students_addresses.address_type_code = ref_address_types.address_type_code
students_addresses.student_id = students.student_id
transcripts.student_id = students.student_id
|
advertising_agencies |
CREATE TABLE "Agencies" (
agency_id INTEGER,
agency_details VARCHAR(255) NOT NULL,
PRIMARY KEY (agency_id)
)
CREATE TABLE "Clients" (
client_id INTEGER,
agency_id INTEGER NOT NULL,
sic_code VARCHAR(10) NOT NULL,
client_details VARCHAR(255) NOT NULL,
PRIMARY KEY (client_id),
FOREIGN KEY(agency_id) REFERENCES "Agencies" (agency_id)
)
CREATE TABLE "Invoices" (
invoice_id INTEGER,
client_id INTEGER NOT NULL,
invoice_status VARCHAR(10) NOT NULL,
invoice_details VARCHAR(255) NOT NULL,
PRIMARY KEY (invoice_id),
FOREIGN KEY(client_id) REFERENCES "Clients" (client_id)
)
CREATE TABLE "Meetings" (
meeting_id INTEGER,
client_id INTEGER NOT NULL,
meeting_outcome VARCHAR(10) NOT NULL,
meeting_type VARCHAR(10) NOT NULL,
billable_yn VARCHAR(1),
start_date_time DATETIME,
end_date_time DATETIME,
purpose_of_meeting VARCHAR(255),
other_details VARCHAR(255) NOT NULL,
PRIMARY KEY (meeting_id),
FOREIGN KEY(client_id) REFERENCES "Clients" (client_id)
)
CREATE TABLE "Payments" (
payment_id INTEGER NOT NULL,
invoice_id INTEGER NOT NULL,
payment_details VARCHAR(255) NOT NULL,
FOREIGN KEY(invoice_id) REFERENCES "Invoices" (invoice_id)
)
CREATE TABLE "Staff" (
staff_id INTEGER,
agency_id INTEGER NOT NULL,
staff_details VARCHAR(255) NOT NULL,
PRIMARY KEY (staff_id)
)
CREATE TABLE "Staff_in_Meetings" (
meeting_id INTEGER NOT NULL,
staff_id INTEGER NOT NULL,
FOREIGN KEY(staff_id) REFERENCES "Staff" (staff_id),
FOREIGN KEY(meeting_id) REFERENCES "Meetings" (meeting_id)
) | How many invoices are there for each status code? | medium | Table Agencies (
Agencies.agency_id (INTEGER),
Agencies.agency_details (VARCHAR(255)),
)
Table Clients (
Clients.client_id (INTEGER),
Clients.agency_id (INTEGER),
Clients.sic_code (VARCHAR(10)),
Clients.client_details (VARCHAR(255)),
)
Table Invoices (
Invoices.invoice_id (INTEGER),
Invoices.client_id (INTEGER),
Invoices.invoice_status (VARCHAR(10)),
Invoices.invoice_details (VARCHAR(255)),
)
Table Meetings (
Meetings.meeting_id (INTEGER),
Meetings.client_id (INTEGER),
Meetings.meeting_outcome (VARCHAR(10)),
Meetings.meeting_type (VARCHAR(10)),
Meetings.billable_yn (VARCHAR(1)),
Meetings.start_date_time (DATETIME),
Meetings.end_date_time (DATETIME),
Meetings.purpose_of_meeting (VARCHAR(255)),
Meetings.other_details (VARCHAR(255)),
)
Table Payments (
Payments.payment_id (INTEGER),
Payments.invoice_id (INTEGER),
Payments.payment_details (VARCHAR(255)),
)
Table Staff (
Staff.staff_id (INTEGER),
Staff.agency_id (INTEGER),
Staff.staff_details (VARCHAR(255)),
)
Table Staff_in_Meetings (
Staff_in_Meetings.meeting_id (INTEGER),
Staff_in_Meetings.staff_id (INTEGER),
)
Possible JOINs:
Clients.agency_id = Agencies.agency_id
Invoices.client_id = Clients.client_id
Meetings.client_id = Clients.client_id
Payments.invoice_id = Invoices.invoice_id
Staff_in_Meetings.meeting_id = Meetings.meeting_id
Staff_in_Meetings.staff_id = Staff.staff_id
| SELECT invoice_status , count(*) FROM Invoices GROUP BY invoice_status | {
'invoices': ['invoice_id', 'invoice_status']
} | CREATE TABLE Agencies (
Agencies.agency_id (INTEGER),
Agencies.agency_details (VARCHAR(255)),
)
CREATE TABLE Clients (
Clients.client_id (INTEGER),
Clients.agency_id (INTEGER),
Clients.sic_code (VARCHAR(10)),
Clients.client_details (VARCHAR(255)),
)
CREATE TABLE Invoices (
Invoices.invoice_id (INTEGER),
Invoices.client_id (INTEGER),
Invoices.invoice_status (VARCHAR(10)),
Invoices.invoice_details (VARCHAR(255)),
)
CREATE TABLE Meetings (
Meetings.meeting_id (INTEGER),
Meetings.client_id (INTEGER),
Meetings.meeting_outcome (VARCHAR(10)),
Meetings.meeting_type (VARCHAR(10)),
Meetings.billable_yn (VARCHAR(1)),
Meetings.start_date_time (DATETIME),
Meetings.end_date_time (DATETIME),
Meetings.purpose_of_meeting (VARCHAR(255)),
Meetings.other_details (VARCHAR(255)),
)
CREATE TABLE Payments (
Payments.payment_id (INTEGER),
Payments.invoice_id (INTEGER),
Payments.payment_details (VARCHAR(255)),
)
CREATE TABLE Staff (
Staff.staff_id (INTEGER),
Staff.agency_id (INTEGER),
Staff.staff_details (VARCHAR(255)),
)
CREATE TABLE Staff_in_Meetings (
Staff_in_Meetings.meeting_id (INTEGER),
Staff_in_Meetings.staff_id (INTEGER),
)
Possible JOINs:
Clients.agency_id = Agencies.agency_id
Invoices.client_id = Clients.client_id
Meetings.client_id = Clients.client_id
Payments.invoice_id = Invoices.invoice_id
Staff_in_Meetings.meeting_id = Meetings.meeting_id
Staff_in_Meetings.staff_id = Staff.staff_id
| Table Agencies (
Agencies.agency_id (INTEGER),
Agencies.agency_details (VARCHAR(255)),
)
Table Clients (
Clients.client_id (INTEGER),
Clients.agency_id (INTEGER),
Clients.sic_code (VARCHAR(10)),
Clients.client_details (VARCHAR(255)),
)
Table Invoices (
Invoices.invoice_id (INTEGER),
Invoices.client_id (INTEGER),
Invoices.invoice_status (VARCHAR(10)),
Invoices.invoice_details (VARCHAR(255)),
)
Table Meetings (
Meetings.meeting_id (INTEGER),
Meetings.client_id (INTEGER),
Meetings.meeting_outcome (VARCHAR(10)),
Meetings.meeting_type (VARCHAR(10)),
Meetings.billable_yn (VARCHAR(1)),
Meetings.start_date_time (DATETIME),
Meetings.end_date_time (DATETIME),
Meetings.purpose_of_meeting (VARCHAR(255)),
Meetings.other_details (VARCHAR(255)),
)
Table Payments (
Payments.payment_id (INTEGER),
Payments.invoice_id (INTEGER),
Payments.payment_details (VARCHAR(255)),
)
Table Staff (
Staff.staff_id (INTEGER),
Staff.agency_id (INTEGER),
Staff.staff_details (VARCHAR(255)),
)
Table Staff_in_Meetings (
Staff_in_Meetings.meeting_id (INTEGER),
Staff_in_Meetings.staff_id (INTEGER),
)
Possible JOINs:
Clients.agency_id = Agencies.agency_id
Invoices.client_id = Clients.client_id
Meetings.client_id = Clients.client_id
Payments.invoice_id = Invoices.invoice_id
Staff_in_Meetings.meeting_id = Meetings.meeting_id
Staff_in_Meetings.staff_id = Staff.staff_id
| CREATE TABLE Agencies (
Agencies.agency_id (INTEGER),
Agencies.agency_details (VARCHAR(255)),
)
CREATE TABLE Clients (
Clients.client_id (INTEGER),
Clients.agency_id (INTEGER),
Clients.sic_code (VARCHAR(10)),
Clients.client_details (VARCHAR(255)),
)
CREATE TABLE Invoices (
Invoices.invoice_id (INTEGER),
Invoices.client_id (INTEGER),
Invoices.invoice_status (VARCHAR(10)),
Invoices.invoice_details (VARCHAR(255)),
)
CREATE TABLE Meetings (
Meetings.meeting_id (INTEGER),
Meetings.client_id (INTEGER),
Meetings.meeting_outcome (VARCHAR(10)),
Meetings.meeting_type (VARCHAR(10)),
Meetings.billable_yn (VARCHAR(1)),
Meetings.start_date_time (DATETIME),
Meetings.end_date_time (DATETIME),
Meetings.purpose_of_meeting (VARCHAR(255)),
Meetings.other_details (VARCHAR(255)),
)
CREATE TABLE Payments (
Payments.payment_id (INTEGER),
Payments.invoice_id (INTEGER),
Payments.payment_details (VARCHAR(255)),
)
CREATE TABLE Staff (
Staff.staff_id (INTEGER),
Staff.agency_id (INTEGER),
Staff.staff_details (VARCHAR(255)),
)
CREATE TABLE Staff_in_Meetings (
Staff_in_Meetings.meeting_id (INTEGER),
Staff_in_Meetings.staff_id (INTEGER),
)
Possible JOINs:
Clients.agency_id = Agencies.agency_id
Invoices.client_id = Clients.client_id
Meetings.client_id = Clients.client_id
Payments.invoice_id = Invoices.invoice_id
Staff_in_Meetings.meeting_id = Meetings.meeting_id
Staff_in_Meetings.staff_id = Staff.staff_id
| Table agencies (
agencies.agency_id (INTEGER),
agencies.agency_details (VARCHAR(255)),
)
Table clients (
clients.client_id (INTEGER),
clients.agency_id (INTEGER),
clients.sic_code (VARCHAR(10)),
clients.client_details (VARCHAR(255)),
)
Table invoices (
invoices.invoice_id (INTEGER),
invoices.client_id (INTEGER),
invoices.invoice_status (VARCHAR(10)),
invoices.invoice_details (VARCHAR(255)),
)
Table meetings (
meetings.meeting_id (INTEGER),
meetings.client_id (INTEGER),
meetings.meeting_outcome (VARCHAR(10)),
meetings.meeting_type (VARCHAR(10)),
meetings.billable_yn (VARCHAR(1)),
meetings.start_date_time (DATETIME),
meetings.end_date_time (DATETIME),
meetings.purpose_of_meeting (VARCHAR(255)),
meetings.other_details (VARCHAR(255)),
)
Table payments (
payments.payment_id (INTEGER),
payments.invoice_id (INTEGER),
payments.payment_details (VARCHAR(255)),
)
Table staff (
staff.staff_id (INTEGER),
staff.agency_id (INTEGER),
staff.staff_details (VARCHAR(255)),
)
Table staff_in_meetings (
staff_in_meetings.meeting_id (INTEGER),
staff_in_meetings.staff_id (INTEGER),
)
Possible JOINs:
clients.agency_id = agencies.agency_id
invoices.client_id = clients.client_id
meetings.client_id = clients.client_id
payments.invoice_id = invoices.invoice_id
staff_in_meetings.meeting_id = meetings.meeting_id
staff_in_meetings.staff_id = staff.staff_id
| CREATE TABLE agencies (
agencies.agency_id (INTEGER),
agencies.agency_details (VARCHAR(255)),
)
CREATE TABLE clients (
clients.client_id (INTEGER),
clients.agency_id (INTEGER),
clients.sic_code (VARCHAR(10)),
clients.client_details (VARCHAR(255)),
)
CREATE TABLE invoices (
invoices.invoice_id (INTEGER),
invoices.client_id (INTEGER),
invoices.invoice_status (VARCHAR(10)),
invoices.invoice_details (VARCHAR(255)),
)
CREATE TABLE meetings (
meetings.meeting_id (INTEGER),
meetings.client_id (INTEGER),
meetings.meeting_outcome (VARCHAR(10)),
meetings.meeting_type (VARCHAR(10)),
meetings.billable_yn (VARCHAR(1)),
meetings.start_date_time (DATETIME),
meetings.end_date_time (DATETIME),
meetings.purpose_of_meeting (VARCHAR(255)),
meetings.other_details (VARCHAR(255)),
)
CREATE TABLE payments (
payments.payment_id (INTEGER),
payments.invoice_id (INTEGER),
payments.payment_details (VARCHAR(255)),
)
CREATE TABLE staff (
staff.staff_id (INTEGER),
staff.agency_id (INTEGER),
staff.staff_details (VARCHAR(255)),
)
CREATE TABLE staff_in_meetings (
staff_in_meetings.meeting_id (INTEGER),
staff_in_meetings.staff_id (INTEGER),
)
Possible JOINs:
clients.agency_id = agencies.agency_id
invoices.client_id = clients.client_id
meetings.client_id = clients.client_id
payments.invoice_id = invoices.invoice_id
staff_in_meetings.meeting_id = meetings.meeting_id
staff_in_meetings.staff_id = staff.staff_id
| {
'Agencies': ['agency_id', 'agency_details'],
'Staff': ['staff_id', 'agency_id', 'staff_details'],
'Clients': ['client_id', 'agency_id', 'sic_code', 'client_details'],
'Invoices': ['invoice_id', 'client_id', 'invoice_status', 'invoice_details'],
'Meetings': ['meeting_id', 'client_id', 'meeting_outcome', 'meeting_type', 'billable_yn', 'start_date_time', 'end_date_time', 'purpose_of_meeting', 'other_details'],
'Payments': ['payment_id', 'invoice_id', 'payment_details'],
'Staff_in_Meetings': ['meeting_id', 'staff_id']
} | {
'Invoices': ['invoice_id', 'invoice_status']
} | TABLE Agencies (
Agencies.agency_id (INTEGER),
Agencies.agency_details (VARCHAR(255)),
)
TABLE Clients (
Clients.client_id (INTEGER),
Clients.agency_id (INTEGER),
Clients.sic_code (VARCHAR(10)),
Clients.client_details (VARCHAR(255)),
)
TABLE Invoices (
Invoices.invoice_id (INTEGER),
Invoices.client_id (INTEGER),
Invoices.invoice_status (VARCHAR(10)),
Invoices.invoice_details (VARCHAR(255)),
)
TABLE Meetings (
Meetings.meeting_id (INTEGER),
Meetings.client_id (INTEGER),
Meetings.meeting_outcome (VARCHAR(10)),
Meetings.meeting_type (VARCHAR(10)),
Meetings.billable_yn (VARCHAR(1)),
Meetings.start_date_time (DATETIME),
Meetings.end_date_time (DATETIME),
Meetings.purpose_of_meeting (VARCHAR(255)),
Meetings.other_details (VARCHAR(255)),
)
TABLE Payments (
Payments.payment_id (INTEGER),
Payments.invoice_id (INTEGER),
Payments.payment_details (VARCHAR(255)),
)
TABLE Staff (
Staff.staff_id (INTEGER),
Staff.agency_id (INTEGER),
Staff.staff_details (VARCHAR(255)),
)
TABLE Staff_in_Meetings (
Staff_in_Meetings.meeting_id (INTEGER),
Staff_in_Meetings.staff_id (INTEGER),
)
Possible JOINs:
Clients.agency_id = Agencies.agency_id
Invoices.client_id = Clients.client_id
Meetings.client_id = Clients.client_id
Payments.invoice_id = Invoices.invoice_id
Staff_in_Meetings.meeting_id = Meetings.meeting_id
Staff_in_Meetings.staff_id = Staff.staff_id
| TABLE Agencies (
Agencies.agency_id (INTEGER),
Agencies.agency_details (VARCHAR(255)),
)
TABLE Clients (
Clients.client_id (INTEGER),
Clients.agency_id (INTEGER),
Clients.sic_code (VARCHAR(10)),
Clients.client_details (VARCHAR(255)),
)
TABLE Invoices (
Invoices.invoice_id (INTEGER),
Invoices.client_id (INTEGER),
Invoices.invoice_status (VARCHAR(10)),
Invoices.invoice_details (VARCHAR(255)),
)
TABLE Meetings (
Meetings.meeting_id (INTEGER),
Meetings.client_id (INTEGER),
Meetings.meeting_outcome (VARCHAR(10)),
Meetings.meeting_type (VARCHAR(10)),
Meetings.billable_yn (VARCHAR(1)),
Meetings.start_date_time (DATETIME),
Meetings.end_date_time (DATETIME),
Meetings.purpose_of_meeting (VARCHAR(255)),
Meetings.other_details (VARCHAR(255)),
)
TABLE Payments (
Payments.payment_id (INTEGER),
Payments.invoice_id (INTEGER),
Payments.payment_details (VARCHAR(255)),
)
TABLE Staff (
Staff.staff_id (INTEGER),
Staff.agency_id (INTEGER),
Staff.staff_details (VARCHAR(255)),
)
TABLE Staff_in_Meetings (
Staff_in_Meetings.meeting_id (INTEGER),
Staff_in_Meetings.staff_id (INTEGER),
)
Possible JOINs:
Clients.agency_id = Agencies.agency_id
Invoices.client_id = Clients.client_id
Meetings.client_id = Clients.client_id
Payments.invoice_id = Invoices.invoice_id
Staff_in_Meetings.meeting_id = Meetings.meeting_id
Staff_in_Meetings.staff_id = Staff.staff_id
| TABLE agencies (
agencies.agency_id (INTEGER),
agencies.agency_details (VARCHAR(255)),
)
TABLE clients (
clients.client_id (INTEGER),
clients.agency_id (INTEGER),
clients.sic_code (VARCHAR(10)),
clients.client_details (VARCHAR(255)),
)
TABLE invoices (
invoices.invoice_id (INTEGER),
invoices.client_id (INTEGER),
invoices.invoice_status (VARCHAR(10)),
invoices.invoice_details (VARCHAR(255)),
)
TABLE meetings (
meetings.meeting_id (INTEGER),
meetings.client_id (INTEGER),
meetings.meeting_outcome (VARCHAR(10)),
meetings.meeting_type (VARCHAR(10)),
meetings.billable_yn (VARCHAR(1)),
meetings.start_date_time (DATETIME),
meetings.end_date_time (DATETIME),
meetings.purpose_of_meeting (VARCHAR(255)),
meetings.other_details (VARCHAR(255)),
)
TABLE payments (
payments.payment_id (INTEGER),
payments.invoice_id (INTEGER),
payments.payment_details (VARCHAR(255)),
)
TABLE staff (
staff.staff_id (INTEGER),
staff.agency_id (INTEGER),
staff.staff_details (VARCHAR(255)),
)
TABLE staff_in_meetings (
staff_in_meetings.meeting_id (INTEGER),
staff_in_meetings.staff_id (INTEGER),
)
Possible JOINs:
clients.agency_id = agencies.agency_id
invoices.client_id = clients.client_id
meetings.client_id = clients.client_id
payments.invoice_id = invoices.invoice_id
staff_in_meetings.meeting_id = meetings.meeting_id
staff_in_meetings.staff_id = staff.staff_id
|
bakery_1 |
CREATE TABLE customers (
"Id" INTEGER,
"LastName" TEXT,
"FirstName" TEXT,
PRIMARY KEY ("Id")
)
CREATE TABLE goods (
"Id" TEXT,
"Flavor" TEXT,
"Food" TEXT,
"Price" REAL,
PRIMARY KEY ("Id")
)
CREATE TABLE items (
"Receipt" INTEGER,
"Ordinal" INTEGER,
"Item" TEXT,
PRIMARY KEY ("Receipt", "Ordinal"),
FOREIGN KEY("Item") REFERENCES goods ("Id")
)
CREATE TABLE receipts (
"ReceiptNumber" INTEGER,
"Date" TEXT,
"CustomerId" INTEGER,
PRIMARY KEY ("ReceiptNumber"),
FOREIGN KEY("CustomerId") REFERENCES customers ("Id")
) | For each type of food, what are the average, maximum and minimum price? | medium | Table customers (
customers.Id (INTEGER),
customers.LastName (TEXT),
customers.FirstName (TEXT),
)
Table goods (
goods.Id (TEXT),
goods.Flavor (TEXT),
goods.Food (TEXT),
goods.Price (REAL),
)
Table items (
items.Receipt (INTEGER),
items.Ordinal (INTEGER),
items.Item (TEXT),
)
Table receipts (
receipts.ReceiptNumber (INTEGER),
receipts.Date (TEXT),
receipts.CustomerId (INTEGER),
)
Possible JOINs:
items.Item = goods.Id
receipts.CustomerId = customers.Id
| SELECT food , avg(price) , max(price) , min(price) FROM goods GROUP BY food | {
'goods': ['id', 'food', 'price']
} | CREATE TABLE customers (
customers.Id (INTEGER),
customers.LastName (TEXT),
customers.FirstName (TEXT),
)
CREATE TABLE goods (
goods.Id (TEXT),
goods.Flavor (TEXT),
goods.Food (TEXT),
goods.Price (REAL),
)
CREATE TABLE items (
items.Receipt (INTEGER),
items.Ordinal (INTEGER),
items.Item (TEXT),
)
CREATE TABLE receipts (
receipts.ReceiptNumber (INTEGER),
receipts.Date (TEXT),
receipts.CustomerId (INTEGER),
)
Possible JOINs:
items.Item = goods.Id
receipts.CustomerId = customers.Id
| Table customers (
customers.id (INTEGER),
customers.lastname (TEXT),
customers.firstname (TEXT),
)
Table goods (
goods.id (TEXT),
goods.flavor (TEXT),
goods.food (TEXT),
goods.price (REAL),
)
Table items (
items.receipt (INTEGER),
items.ordinal (INTEGER),
items.item (TEXT),
)
Table receipts (
receipts.receiptnumber (INTEGER),
receipts.date (TEXT),
receipts.customerid (INTEGER),
)
Possible JOINs:
items.item = goods.id
receipts.customerid = customers.id
| CREATE TABLE customers (
customers.id (INTEGER),
customers.lastname (TEXT),
customers.firstname (TEXT),
)
CREATE TABLE goods (
goods.id (TEXT),
goods.flavor (TEXT),
goods.food (TEXT),
goods.price (REAL),
)
CREATE TABLE items (
items.receipt (INTEGER),
items.ordinal (INTEGER),
items.item (TEXT),
)
CREATE TABLE receipts (
receipts.receiptnumber (INTEGER),
receipts.date (TEXT),
receipts.customerid (INTEGER),
)
Possible JOINs:
items.item = goods.id
receipts.customerid = customers.id
| Table customers (
customers.id (INTEGER),
customers.lastname (TEXT),
customers.firstname (TEXT),
)
Table goods (
goods.id (TEXT),
goods.flavor (TEXT),
goods.food (TEXT),
goods.price (REAL),
)
Table items (
items.receipt (INTEGER),
items.ordinal (INTEGER),
items.item (TEXT),
)
Table receipts (
receipts.receiptnumber (INTEGER),
receipts.date (TEXT),
receipts.customerid (INTEGER),
)
Possible JOINs:
items.item = goods.id
receipts.customerid = customers.id
| CREATE TABLE customers (
customers.id (INTEGER),
customers.lastname (TEXT),
customers.firstname (TEXT),
)
CREATE TABLE goods (
goods.id (TEXT),
goods.flavor (TEXT),
goods.food (TEXT),
goods.price (REAL),
)
CREATE TABLE items (
items.receipt (INTEGER),
items.ordinal (INTEGER),
items.item (TEXT),
)
CREATE TABLE receipts (
receipts.receiptnumber (INTEGER),
receipts.date (TEXT),
receipts.customerid (INTEGER),
)
Possible JOINs:
items.item = goods.id
receipts.customerid = customers.id
| {
'customers': ['Id', 'LastName', 'FirstName'],
'goods': ['Id', 'Flavor', 'Food', 'Price'],
'items': ['Receipt', 'Ordinal', 'Item'],
'receipts': ['ReceiptNumber', 'Date', 'CustomerId']
} | {
'goods': ['Id', 'Food', 'Price']
} | TABLE customers (
customers.Id (INTEGER),
customers.LastName (TEXT),
customers.FirstName (TEXT),
)
TABLE goods (
goods.Id (TEXT),
goods.Flavor (TEXT),
goods.Food (TEXT),
goods.Price (REAL),
)
TABLE items (
items.Receipt (INTEGER),
items.Ordinal (INTEGER),
items.Item (TEXT),
)
TABLE receipts (
receipts.ReceiptNumber (INTEGER),
receipts.Date (TEXT),
receipts.CustomerId (INTEGER),
)
Possible JOINs:
items.Item = goods.Id
receipts.CustomerId = customers.Id
| TABLE customers (
customers.id (INTEGER),
customers.lastname (TEXT),
customers.firstname (TEXT),
)
TABLE goods (
goods.id (TEXT),
goods.flavor (TEXT),
goods.food (TEXT),
goods.price (REAL),
)
TABLE items (
items.receipt (INTEGER),
items.ordinal (INTEGER),
items.item (TEXT),
)
TABLE receipts (
receipts.receiptnumber (INTEGER),
receipts.date (TEXT),
receipts.customerid (INTEGER),
)
Possible JOINs:
items.item = goods.id
receipts.customerid = customers.id
| TABLE customers (
customers.id (INTEGER),
customers.lastname (TEXT),
customers.firstname (TEXT),
)
TABLE goods (
goods.id (TEXT),
goods.flavor (TEXT),
goods.food (TEXT),
goods.price (REAL),
)
TABLE items (
items.receipt (INTEGER),
items.ordinal (INTEGER),
items.item (TEXT),
)
TABLE receipts (
receipts.receiptnumber (INTEGER),
receipts.date (TEXT),
receipts.customerid (INTEGER),
)
Possible JOINs:
items.item = goods.id
receipts.customerid = customers.id
|
book_1 |
CREATE TABLE Client
(IdClient CHAR(10) PRIMARY KEY,
Name VARCHAR(25) NOT NULL,
Address VARCHAR(60) NOT NULL,
NumCC CHAR(16) NOT NULL)
/*
0 rows from Client table:
IdClient Name Address NumCC
*/
CREATE TABLE Orders
(IdOrder CHAR(10) PRIMARY KEY,
IdClient CHAR(10) NOT NULL REFERENCES Client on delete cascade,
DateOrder DATE,
DateExped DATE)
/*
0 rows from Orders table:
IdOrder IdClient DateOrder DateExped
*/
CREATE TABLE Author
( idAuthor NUMBER PRIMARY KEY,
Name VARCHAR(25))
/*
0 rows from Author table:
idAuthor Name
*/
CREATE TABLE Book
(ISBN CHAR(15) PRIMARY KEY,
Title VARCHAR(60) NOT NULL,
Author CHAR(4) NOT NULL,
PurchasePrice NUMBER(6,2) DEFAULT 0,
SalePrice NUMBER(6,2) DEFAULT 0)
/*
0 rows from Book table:
ISBN Title Author PurchasePrice SalePrice
*/
CREATE TABLE Author_Book
(ISBN CHAR(15),
Author NUMBER,
CONSTRAINT al_PK PRIMARY KEY (ISBN, Author),
CONSTRAINT BookA_FK FOREIGN KEY (ISBN) REFERENCES `Book`(ISBN) on delete cascade,
CONSTRAINT Author_FK FOREIGN KEY (Author) REFERENCES `Author`(idAuthorA))
/*
0 rows from Author_Book table:
ISBN Author
*/
CREATE TABLE Books_Order(
ISBN CHAR(15),
IdOrder CHAR(10),
amount NUMBER(3) CHECK (amount >0),
CONSTRAINT lp_PK PRIMARY KEY (ISBN, idOrder),
CONSTRAINT Book_FK FOREIGN KEY (ISBN) REFERENCES `Book`(ISBN) on delete cascade,
CONSTRAINT pedido_FK FOREIGN KEY (IdOrder) REFERENCES `Orders`(IdOrder) on delete cascade)
/*
0 rows from Books_Order table:
ISBN IdOrder amount
*/
| Show all book titles for books that have no orders. | hard | Table Author (
Author.idAuthor (NUMBER),
Author.Name (VARCHAR(25)),
)
Table Author_Book (
Author_Book.ISBN (CHAR(15)),
Author_Book.Author (NUMBER),
)
Table Book (
Book.ISBN (CHAR(15)),
Book.Title (VARCHAR(60)),
Book.Author (CHAR(4)),
Book.PurchasePrice (NUMBER(6,2)),
Book.SalePrice (NUMBER(6,2)),
)
Table Books_Order (
Books_Order.ISBN (CHAR(15)),
Books_Order.IdOrder (CHAR(10)),
Books_Order.amount (NUMBER(3)),
)
Table Client (
Client.IdClient (CHAR(10)),
Client.Name (VARCHAR(25)),
Client.Address (VARCHAR(60)),
Client.NumCC (CHAR(16)),
)
Table Orders (
Orders.IdOrder (CHAR(10)),
Orders.IdClient (CHAR(10)),
Orders.DateOrder (DATE),
Orders.DateExped (DATE),
)
Possible JOINs:
Author_Book.ISBN = Book.ISBN
Author_Book.Author = Author.idAuthorA
Books_Order.ISBN = Book.ISBN
Books_Order.IdOrder = Orders.IdOrder
Orders.IdClient = Client.IdClient
| SELECT title FROM book EXCEPT SELECT book.title FROM book JOIN books_order ON book.isbn = books_order.isbn | {
'book': ['isbn', 'title'],
'books_order': ['isbn']
} | CREATE TABLE Author (
Author.idAuthor (NUMBER),
Author.Name (VARCHAR(25)),
)
CREATE TABLE Author_Book (
Author_Book.ISBN (CHAR(15)),
Author_Book.Author (NUMBER),
)
CREATE TABLE Book (
Book.ISBN (CHAR(15)),
Book.Title (VARCHAR(60)),
Book.Author (CHAR(4)),
Book.PurchasePrice (NUMBER(6,2)),
Book.SalePrice (NUMBER(6,2)),
)
CREATE TABLE Books_Order (
Books_Order.ISBN (CHAR(15)),
Books_Order.IdOrder (CHAR(10)),
Books_Order.amount (NUMBER(3)),
)
CREATE TABLE Client (
Client.IdClient (CHAR(10)),
Client.Name (VARCHAR(25)),
Client.Address (VARCHAR(60)),
Client.NumCC (CHAR(16)),
)
CREATE TABLE Orders (
Orders.IdOrder (CHAR(10)),
Orders.IdClient (CHAR(10)),
Orders.DateOrder (DATE),
Orders.DateExped (DATE),
)
Possible JOINs:
Author_Book.ISBN = Book.ISBN
Author_Book.Author = Author.idAuthorA
Books_Order.ISBN = Book.ISBN
Books_Order.IdOrder = Orders.IdOrder
Orders.IdClient = Client.IdClient
| Table Author (
Author.idauthor (NUMBER),
Author.name (VARCHAR(25)),
)
Table Author_Book (
Author_Book.isbn (CHAR(15)),
Author_Book.author (NUMBER),
)
Table Book (
Book.isbn (CHAR(15)),
Book.title (VARCHAR(60)),
Book.author (CHAR(4)),
Book.purchaseprice (NUMBER(6,2)),
Book.saleprice (NUMBER(6,2)),
)
Table Books_Order (
Books_Order.isbn (CHAR(15)),
Books_Order.idorder (CHAR(10)),
Books_Order.amount (NUMBER(3)),
)
Table Client (
Client.idclient (CHAR(10)),
Client.name (VARCHAR(25)),
Client.address (VARCHAR(60)),
Client.numcc (CHAR(16)),
)
Table Orders (
Orders.idorder (CHAR(10)),
Orders.idclient (CHAR(10)),
Orders.dateorder (DATE),
Orders.dateexped (DATE),
)
Possible JOINs:
Author_Book.isbn = Book.isbn
Author_Book.author = Author.idauthora
Books_Order.isbn = Book.isbn
Books_Order.idorder = Orders.idorder
Orders.idclient = Client.idclient
| CREATE TABLE Author (
Author.idauthor (NUMBER),
Author.name (VARCHAR(25)),
)
CREATE TABLE Author_Book (
Author_Book.isbn (CHAR(15)),
Author_Book.author (NUMBER),
)
CREATE TABLE Book (
Book.isbn (CHAR(15)),
Book.title (VARCHAR(60)),
Book.author (CHAR(4)),
Book.purchaseprice (NUMBER(6,2)),
Book.saleprice (NUMBER(6,2)),
)
CREATE TABLE Books_Order (
Books_Order.isbn (CHAR(15)),
Books_Order.idorder (CHAR(10)),
Books_Order.amount (NUMBER(3)),
)
CREATE TABLE Client (
Client.idclient (CHAR(10)),
Client.name (VARCHAR(25)),
Client.address (VARCHAR(60)),
Client.numcc (CHAR(16)),
)
CREATE TABLE Orders (
Orders.idorder (CHAR(10)),
Orders.idclient (CHAR(10)),
Orders.dateorder (DATE),
Orders.dateexped (DATE),
)
Possible JOINs:
Author_Book.isbn = Book.isbn
Author_Book.author = Author.idauthora
Books_Order.isbn = Book.isbn
Books_Order.idorder = Orders.idorder
Orders.idclient = Client.idclient
| Table author (
author.idauthor (NUMBER),
author.name (VARCHAR(25)),
)
Table author_book (
author_book.isbn (CHAR(15)),
author_book.author (NUMBER),
)
Table book (
book.isbn (CHAR(15)),
book.title (VARCHAR(60)),
book.author (CHAR(4)),
book.purchaseprice (NUMBER(6,2)),
book.saleprice (NUMBER(6,2)),
)
Table books_order (
books_order.isbn (CHAR(15)),
books_order.idorder (CHAR(10)),
books_order.amount (NUMBER(3)),
)
Table client (
client.idclient (CHAR(10)),
client.name (VARCHAR(25)),
client.address (VARCHAR(60)),
client.numcc (CHAR(16)),
)
Table orders (
orders.idorder (CHAR(10)),
orders.idclient (CHAR(10)),
orders.dateorder (DATE),
orders.dateexped (DATE),
)
Possible JOINs:
author_book.isbn = book.isbn
author_book.author = author.idauthora
books_order.isbn = book.isbn
books_order.idorder = orders.idorder
orders.idclient = client.idclient
| CREATE TABLE author (
author.idauthor (NUMBER),
author.name (VARCHAR(25)),
)
CREATE TABLE author_book (
author_book.isbn (CHAR(15)),
author_book.author (NUMBER),
)
CREATE TABLE book (
book.isbn (CHAR(15)),
book.title (VARCHAR(60)),
book.author (CHAR(4)),
book.purchaseprice (NUMBER(6,2)),
book.saleprice (NUMBER(6,2)),
)
CREATE TABLE books_order (
books_order.isbn (CHAR(15)),
books_order.idorder (CHAR(10)),
books_order.amount (NUMBER(3)),
)
CREATE TABLE client (
client.idclient (CHAR(10)),
client.name (VARCHAR(25)),
client.address (VARCHAR(60)),
client.numcc (CHAR(16)),
)
CREATE TABLE orders (
orders.idorder (CHAR(10)),
orders.idclient (CHAR(10)),
orders.dateorder (DATE),
orders.dateexped (DATE),
)
Possible JOINs:
author_book.isbn = book.isbn
author_book.author = author.idauthora
books_order.isbn = book.isbn
books_order.idorder = orders.idorder
orders.idclient = client.idclient
| {
'Client': ['IdClient', 'Name', 'Address', 'NumCC'],
'Orders': ['IdOrder', 'IdClient', 'DateOrder', 'DateExped'],
'Author': ['idAuthor', 'Name'],
'Book': ['ISBN', 'Title', 'Author', 'PurchasePrice', 'SalePrice'],
'Author_Book': ['ISBN', 'Author'],
'Books_Order': ['ISBN', 'IdOrder', 'amount']
} | {
'Book': ['ISBN', 'Title'],
'Books_Order': ['ISBN']
} | TABLE Author (
Author.idAuthor (NUMBER),
Author.Name (VARCHAR(25)),
)
TABLE Author_Book (
Author_Book.ISBN (CHAR(15)),
Author_Book.Author (NUMBER),
)
TABLE Book (
Book.ISBN (CHAR(15)),
Book.Title (VARCHAR(60)),
Book.Author (CHAR(4)),
Book.PurchasePrice (NUMBER(6,2)),
Book.SalePrice (NUMBER(6,2)),
)
TABLE Books_Order (
Books_Order.ISBN (CHAR(15)),
Books_Order.IdOrder (CHAR(10)),
Books_Order.amount (NUMBER(3)),
)
TABLE Client (
Client.IdClient (CHAR(10)),
Client.Name (VARCHAR(25)),
Client.Address (VARCHAR(60)),
Client.NumCC (CHAR(16)),
)
TABLE Orders (
Orders.IdOrder (CHAR(10)),
Orders.IdClient (CHAR(10)),
Orders.DateOrder (DATE),
Orders.DateExped (DATE),
)
Possible JOINs:
Author_Book.ISBN = Book.ISBN
Author_Book.Author = Author.idAuthorA
Books_Order.ISBN = Book.ISBN
Books_Order.IdOrder = Orders.IdOrder
Orders.IdClient = Client.IdClient
| TABLE Author (
Author.idauthor (NUMBER),
Author.name (VARCHAR(25)),
)
TABLE Author_Book (
Author_Book.isbn (CHAR(15)),
Author_Book.author (NUMBER),
)
TABLE Book (
Book.isbn (CHAR(15)),
Book.title (VARCHAR(60)),
Book.author (CHAR(4)),
Book.purchaseprice (NUMBER(6,2)),
Book.saleprice (NUMBER(6,2)),
)
TABLE Books_Order (
Books_Order.isbn (CHAR(15)),
Books_Order.idorder (CHAR(10)),
Books_Order.amount (NUMBER(3)),
)
TABLE Client (
Client.idclient (CHAR(10)),
Client.name (VARCHAR(25)),
Client.address (VARCHAR(60)),
Client.numcc (CHAR(16)),
)
TABLE Orders (
Orders.idorder (CHAR(10)),
Orders.idclient (CHAR(10)),
Orders.dateorder (DATE),
Orders.dateexped (DATE),
)
Possible JOINs:
Author_Book.isbn = Book.isbn
Author_Book.author = Author.idauthora
Books_Order.isbn = Book.isbn
Books_Order.idorder = Orders.idorder
Orders.idclient = Client.idclient
| TABLE author (
author.idauthor (NUMBER),
author.name (VARCHAR(25)),
)
TABLE author_book (
author_book.isbn (CHAR(15)),
author_book.author (NUMBER),
)
TABLE book (
book.isbn (CHAR(15)),
book.title (VARCHAR(60)),
book.author (CHAR(4)),
book.purchaseprice (NUMBER(6,2)),
book.saleprice (NUMBER(6,2)),
)
TABLE books_order (
books_order.isbn (CHAR(15)),
books_order.idorder (CHAR(10)),
books_order.amount (NUMBER(3)),
)
TABLE client (
client.idclient (CHAR(10)),
client.name (VARCHAR(25)),
client.address (VARCHAR(60)),
client.numcc (CHAR(16)),
)
TABLE orders (
orders.idorder (CHAR(10)),
orders.idclient (CHAR(10)),
orders.dateorder (DATE),
orders.dateexped (DATE),
)
Possible JOINs:
author_book.isbn = book.isbn
author_book.author = author.idauthora
books_order.isbn = book.isbn
books_order.idorder = orders.idorder
orders.idclient = client.idclient
|
book_review |
CREATE TABLE book (
"Book_ID" INTEGER,
"Title" TEXT,
"Type" TEXT,
"Pages" INTEGER,
"Chapters" INTEGER,
"Audio" TEXT,
"Release" TEXT,
PRIMARY KEY ("Book_ID")
)
CREATE TABLE review (
"Review_ID" INTEGER,
"Book_ID" INTEGER,
"Rating" REAL,
"Readers_in_Million" REAL,
"Rank" INTEGER,
PRIMARY KEY ("Review_ID"),
FOREIGN KEY("Book_ID") REFERENCES book ("Book_ID")
) | What are the type and title of the books that are not rated? | extra | Table book (
book.Book_ID (INT),
book.Title (TEXT),
book.Type (TEXT),
book.Pages (INT),
book.Chapters (INT),
book.Audio (TEXT),
book.Release (TEXT),
)
Table review (
review.Review_ID (INT),
review.Book_ID (INT),
review.Rating (REAL),
review.Readers_in_Million (REAL),
review.Rank (INT),
)
Possible JOINs:
review.Book_ID = book.Book_ID
| SELECT TYPE , title FROM book EXCEPT SELECT book.type , book.title FROM book JOIN review ON book.Book_ID = review.Book_ID; | {
'book': ['book_id', 'title', 'type'],
'review': ['review_id', 'book_id']
} | CREATE TABLE book (
book.Book_ID (INT),
book.Title (TEXT),
book.Type (TEXT),
book.Pages (INT),
book.Chapters (INT),
book.Audio (TEXT),
book.Release (TEXT),
)
CREATE TABLE review (
review.Review_ID (INT),
review.Book_ID (INT),
review.Rating (REAL),
review.Readers_in_Million (REAL),
review.Rank (INT),
)
Possible JOINs:
review.Book_ID = book.Book_ID
| Table book (
book.book_id (INT),
book.title (TEXT),
book.type (TEXT),
book.pages (INT),
book.chapters (INT),
book.audio (TEXT),
book.release (TEXT),
)
Table review (
review.review_id (INT),
review.book_id (INT),
review.rating (REAL),
review.readers_in_million (REAL),
review.rank (INT),
)
Possible JOINs:
review.book_id = book.book_id
| CREATE TABLE book (
book.book_id (INT),
book.title (TEXT),
book.type (TEXT),
book.pages (INT),
book.chapters (INT),
book.audio (TEXT),
book.release (TEXT),
)
CREATE TABLE review (
review.review_id (INT),
review.book_id (INT),
review.rating (REAL),
review.readers_in_million (REAL),
review.rank (INT),
)
Possible JOINs:
review.book_id = book.book_id
| Table book (
book.book_id (INT),
book.title (TEXT),
book.type (TEXT),
book.pages (INT),
book.chapters (INT),
book.audio (TEXT),
book.release (TEXT),
)
Table review (
review.review_id (INT),
review.book_id (INT),
review.rating (REAL),
review.readers_in_million (REAL),
review.rank (INT),
)
Possible JOINs:
review.book_id = book.book_id
| CREATE TABLE book (
book.book_id (INT),
book.title (TEXT),
book.type (TEXT),
book.pages (INT),
book.chapters (INT),
book.audio (TEXT),
book.release (TEXT),
)
CREATE TABLE review (
review.review_id (INT),
review.book_id (INT),
review.rating (REAL),
review.readers_in_million (REAL),
review.rank (INT),
)
Possible JOINs:
review.book_id = book.book_id
| {
'book': ['Book_ID', 'Title', 'Type', 'Pages', 'Chapters', 'Audio', 'Release'],
'review': ['Review_ID', 'Book_ID', 'Rating', 'Readers_in_Million', 'Rank']
} | {
'book': ['Book_ID', 'Title', 'Type'],
'review': ['Review_ID', 'Book_ID']
} | TABLE book (
book.Book_ID (INT),
book.Title (TEXT),
book.Type (TEXT),
book.Pages (INT),
book.Chapters (INT),
book.Audio (TEXT),
book.Release (TEXT),
)
TABLE review (
review.Review_ID (INT),
review.Book_ID (INT),
review.Rating (REAL),
review.Readers_in_Million (REAL),
review.Rank (INT),
)
Possible JOINs:
review.Book_ID = book.Book_ID
| TABLE book (
book.book_id (INT),
book.title (TEXT),
book.type (TEXT),
book.pages (INT),
book.chapters (INT),
book.audio (TEXT),
book.release (TEXT),
)
TABLE review (
review.review_id (INT),
review.book_id (INT),
review.rating (REAL),
review.readers_in_million (REAL),
review.rank (INT),
)
Possible JOINs:
review.book_id = book.book_id
| TABLE book (
book.book_id (INT),
book.title (TEXT),
book.type (TEXT),
book.pages (INT),
book.chapters (INT),
book.audio (TEXT),
book.release (TEXT),
)
TABLE review (
review.review_id (INT),
review.book_id (INT),
review.rating (REAL),
review.readers_in_million (REAL),
review.rank (INT),
)
Possible JOINs:
review.book_id = book.book_id
|
cre_Doc_Workflow |
CREATE TABLE "Authors" (
author_name VARCHAR(255) NOT NULL,
other_details VARCHAR(255) NOT NULL,
PRIMARY KEY (author_name)
)
CREATE TABLE "Business_Processes" (
process_id INTEGER NOT NULL,
next_process_id INTEGER,
process_name VARCHAR(255) NOT NULL,
process_description VARCHAR(255) NOT NULL,
other_details VARCHAR(255),
PRIMARY KEY (process_id)
)
CREATE TABLE "Documents" (
document_id INTEGER NOT NULL,
author_name VARCHAR(255) NOT NULL,
document_name VARCHAR(255) NOT NULL,
document_description VARCHAR(255) NOT NULL,
other_details VARCHAR(255),
PRIMARY KEY (document_id),
FOREIGN KEY(author_name) REFERENCES "Authors" (author_name)
)
CREATE TABLE "Documents_Processes" (
document_id INTEGER NOT NULL,
process_id INTEGER NOT NULL,
process_outcome_code CHAR(15) NOT NULL,
process_status_code CHAR(15) NOT NULL,
PRIMARY KEY (document_id, process_id),
FOREIGN KEY(document_id) REFERENCES "Documents" (document_id),
FOREIGN KEY(process_id) REFERENCES "Business_Processes" (process_id),
FOREIGN KEY(process_outcome_code) REFERENCES "Process_Outcomes" (process_outcome_code),
FOREIGN KEY(process_status_code) REFERENCES "Process_Status" (process_status_code)
)
CREATE TABLE "Process_Outcomes" (
process_outcome_code CHAR(15) NOT NULL,
process_outcome_description VARCHAR(255) NOT NULL,
PRIMARY KEY (process_outcome_code)
)
CREATE TABLE "Process_Status" (
process_status_code CHAR(15) NOT NULL,
process_status_description VARCHAR(255) NOT NULL,
PRIMARY KEY (process_status_code)
)
CREATE TABLE "Ref_Staff_Roles" (
staff_role_code CHAR(15) NOT NULL,
staff_role_description VARCHAR(255) NOT NULL,
PRIMARY KEY (staff_role_code)
)
CREATE TABLE "Staff" (
staff_id INTEGER NOT NULL,
staff_details VARCHAR(255) NOT NULL,
PRIMARY KEY (staff_id)
)
CREATE TABLE "Staff_in_Processes" (
document_id INTEGER NOT NULL,
process_id INTEGER NOT NULL,
staff_id INTEGER NOT NULL,
staff_role_code CHAR(15) NOT NULL,
date_from DATETIME,
date_to DATETIME,
other_details VARCHAR(255),
PRIMARY KEY (document_id, process_id, staff_id),
FOREIGN KEY(staff_id) REFERENCES "Staff" (staff_id),
FOREIGN KEY(document_id, process_id) REFERENCES "Documents_Processes" (document_id, process_id),
FOREIGN KEY(staff_role_code) REFERENCES "Ref_Staff_Roles" (staff_role_code)
) | Show the other details for the author Addison Denesik. | easy | Table Authors (
Authors.author_name (VARCHAR(255)),
Authors.other_details (VARCHAR(255)),
)
Table Business_Processes (
Business_Processes.process_id (INTEGER),
Business_Processes.next_process_id (INTEGER),
Business_Processes.process_name (VARCHAR(255)),
Business_Processes.process_description (VARCHAR(255)),
Business_Processes.other_details (VARCHAR(255)),
)
Table Documents (
Documents.document_id (INTEGER),
Documents.author_name (VARCHAR(255)),
Documents.document_name (VARCHAR(255)),
Documents.document_description (VARCHAR(255)),
Documents.other_details (VARCHAR(255)),
)
Table Documents_Processes (
Documents_Processes.document_id (INTEGER),
Documents_Processes.process_id (INTEGER),
Documents_Processes.process_outcome_code (CHAR(15)),
Documents_Processes.process_status_code (CHAR(15)),
)
Table Process_Outcomes (
Process_Outcomes.process_outcome_code (CHAR(15)),
Process_Outcomes.process_outcome_description (VARCHAR(255)),
)
Table Process_Status (
Process_Status.process_status_code (CHAR(15)),
Process_Status.process_status_description (VARCHAR(255)),
)
Table Ref_Staff_Roles (
Ref_Staff_Roles.staff_role_code (CHAR(15)),
Ref_Staff_Roles.staff_role_description (VARCHAR(255)),
)
Table Staff (
Staff.staff_id (INTEGER),
Staff.staff_details (VARCHAR(255)),
)
Table Staff_in_Processes (
Staff_in_Processes.document_id (INTEGER),
Staff_in_Processes.process_id (INTEGER),
Staff_in_Processes.staff_id (INTEGER),
Staff_in_Processes.staff_role_code (CHAR(15)),
Staff_in_Processes.date_from (DATETIME),
Staff_in_Processes.date_to (DATETIME),
Staff_in_Processes.other_details (VARCHAR(255)),
)
Possible JOINs:
Documents.author_name = Authors.author_name
Documents_Processes.document_id = Documents.document_id
Documents_Processes.process_id = Business_Processes.process_id
Documents_Processes.process_outcome_code = Process_Outcomes.process_outcome_code
Documents_Processes.process_status_code = Process_Status.process_status_code
Staff_in_Processes.document_id = Documents_Processes.document_id
Staff_in_Processes.process_id = Documents_Processes.process_id
Staff_in_Processes.staff_id = Staff.staff_id
Staff_in_Processes.staff_role_code = Ref_Staff_Roles.staff_role_code
| SELECT other_details FROM Authors WHERE author_name = "Addison Denesik" | {
'authors': ['author_name', 'other_details']
} | CREATE TABLE Authors (
Authors.author_name (VARCHAR(255)),
Authors.other_details (VARCHAR(255)),
)
CREATE TABLE Business_Processes (
Business_Processes.process_id (INTEGER),
Business_Processes.next_process_id (INTEGER),
Business_Processes.process_name (VARCHAR(255)),
Business_Processes.process_description (VARCHAR(255)),
Business_Processes.other_details (VARCHAR(255)),
)
CREATE TABLE Documents (
Documents.document_id (INTEGER),
Documents.author_name (VARCHAR(255)),
Documents.document_name (VARCHAR(255)),
Documents.document_description (VARCHAR(255)),
Documents.other_details (VARCHAR(255)),
)
CREATE TABLE Documents_Processes (
Documents_Processes.document_id (INTEGER),
Documents_Processes.process_id (INTEGER),
Documents_Processes.process_outcome_code (CHAR(15)),
Documents_Processes.process_status_code (CHAR(15)),
)
CREATE TABLE Process_Outcomes (
Process_Outcomes.process_outcome_code (CHAR(15)),
Process_Outcomes.process_outcome_description (VARCHAR(255)),
)
CREATE TABLE Process_Status (
Process_Status.process_status_code (CHAR(15)),
Process_Status.process_status_description (VARCHAR(255)),
)
CREATE TABLE Ref_Staff_Roles (
Ref_Staff_Roles.staff_role_code (CHAR(15)),
Ref_Staff_Roles.staff_role_description (VARCHAR(255)),
)
CREATE TABLE Staff (
Staff.staff_id (INTEGER),
Staff.staff_details (VARCHAR(255)),
)
CREATE TABLE Staff_in_Processes (
Staff_in_Processes.document_id (INTEGER),
Staff_in_Processes.process_id (INTEGER),
Staff_in_Processes.staff_id (INTEGER),
Staff_in_Processes.staff_role_code (CHAR(15)),
Staff_in_Processes.date_from (DATETIME),
Staff_in_Processes.date_to (DATETIME),
Staff_in_Processes.other_details (VARCHAR(255)),
)
Possible JOINs:
Documents.author_name = Authors.author_name
Documents_Processes.document_id = Documents.document_id
Documents_Processes.process_id = Business_Processes.process_id
Documents_Processes.process_outcome_code = Process_Outcomes.process_outcome_code
Documents_Processes.process_status_code = Process_Status.process_status_code
Staff_in_Processes.document_id = Documents_Processes.document_id
Staff_in_Processes.process_id = Documents_Processes.process_id
Staff_in_Processes.staff_id = Staff.staff_id
Staff_in_Processes.staff_role_code = Ref_Staff_Roles.staff_role_code
| Table Authors (
Authors.author_name (VARCHAR(255)),
Authors.other_details (VARCHAR(255)),
)
Table Business_Processes (
Business_Processes.process_id (INTEGER),
Business_Processes.next_process_id (INTEGER),
Business_Processes.process_name (VARCHAR(255)),
Business_Processes.process_description (VARCHAR(255)),
Business_Processes.other_details (VARCHAR(255)),
)
Table Documents (
Documents.document_id (INTEGER),
Documents.author_name (VARCHAR(255)),
Documents.document_name (VARCHAR(255)),
Documents.document_description (VARCHAR(255)),
Documents.other_details (VARCHAR(255)),
)
Table Documents_Processes (
Documents_Processes.document_id (INTEGER),
Documents_Processes.process_id (INTEGER),
Documents_Processes.process_outcome_code (CHAR(15)),
Documents_Processes.process_status_code (CHAR(15)),
)
Table Process_Outcomes (
Process_Outcomes.process_outcome_code (CHAR(15)),
Process_Outcomes.process_outcome_description (VARCHAR(255)),
)
Table Process_Status (
Process_Status.process_status_code (CHAR(15)),
Process_Status.process_status_description (VARCHAR(255)),
)
Table Ref_Staff_Roles (
Ref_Staff_Roles.staff_role_code (CHAR(15)),
Ref_Staff_Roles.staff_role_description (VARCHAR(255)),
)
Table Staff (
Staff.staff_id (INTEGER),
Staff.staff_details (VARCHAR(255)),
)
Table Staff_in_Processes (
Staff_in_Processes.document_id (INTEGER),
Staff_in_Processes.process_id (INTEGER),
Staff_in_Processes.staff_id (INTEGER),
Staff_in_Processes.staff_role_code (CHAR(15)),
Staff_in_Processes.date_from (DATETIME),
Staff_in_Processes.date_to (DATETIME),
Staff_in_Processes.other_details (VARCHAR(255)),
)
Possible JOINs:
Documents.author_name = Authors.author_name
Documents_Processes.document_id = Documents.document_id
Documents_Processes.process_id = Business_Processes.process_id
Documents_Processes.process_outcome_code = Process_Outcomes.process_outcome_code
Documents_Processes.process_status_code = Process_Status.process_status_code
Staff_in_Processes.document_id = Documents_Processes.document_id
Staff_in_Processes.process_id = Documents_Processes.process_id
Staff_in_Processes.staff_id = Staff.staff_id
Staff_in_Processes.staff_role_code = Ref_Staff_Roles.staff_role_code
| CREATE TABLE Authors (
Authors.author_name (VARCHAR(255)),
Authors.other_details (VARCHAR(255)),
)
CREATE TABLE Business_Processes (
Business_Processes.process_id (INTEGER),
Business_Processes.next_process_id (INTEGER),
Business_Processes.process_name (VARCHAR(255)),
Business_Processes.process_description (VARCHAR(255)),
Business_Processes.other_details (VARCHAR(255)),
)
CREATE TABLE Documents (
Documents.document_id (INTEGER),
Documents.author_name (VARCHAR(255)),
Documents.document_name (VARCHAR(255)),
Documents.document_description (VARCHAR(255)),
Documents.other_details (VARCHAR(255)),
)
CREATE TABLE Documents_Processes (
Documents_Processes.document_id (INTEGER),
Documents_Processes.process_id (INTEGER),
Documents_Processes.process_outcome_code (CHAR(15)),
Documents_Processes.process_status_code (CHAR(15)),
)
CREATE TABLE Process_Outcomes (
Process_Outcomes.process_outcome_code (CHAR(15)),
Process_Outcomes.process_outcome_description (VARCHAR(255)),
)
CREATE TABLE Process_Status (
Process_Status.process_status_code (CHAR(15)),
Process_Status.process_status_description (VARCHAR(255)),
)
CREATE TABLE Ref_Staff_Roles (
Ref_Staff_Roles.staff_role_code (CHAR(15)),
Ref_Staff_Roles.staff_role_description (VARCHAR(255)),
)
CREATE TABLE Staff (
Staff.staff_id (INTEGER),
Staff.staff_details (VARCHAR(255)),
)
CREATE TABLE Staff_in_Processes (
Staff_in_Processes.document_id (INTEGER),
Staff_in_Processes.process_id (INTEGER),
Staff_in_Processes.staff_id (INTEGER),
Staff_in_Processes.staff_role_code (CHAR(15)),
Staff_in_Processes.date_from (DATETIME),
Staff_in_Processes.date_to (DATETIME),
Staff_in_Processes.other_details (VARCHAR(255)),
)
Possible JOINs:
Documents.author_name = Authors.author_name
Documents_Processes.document_id = Documents.document_id
Documents_Processes.process_id = Business_Processes.process_id
Documents_Processes.process_outcome_code = Process_Outcomes.process_outcome_code
Documents_Processes.process_status_code = Process_Status.process_status_code
Staff_in_Processes.document_id = Documents_Processes.document_id
Staff_in_Processes.process_id = Documents_Processes.process_id
Staff_in_Processes.staff_id = Staff.staff_id
Staff_in_Processes.staff_role_code = Ref_Staff_Roles.staff_role_code
| Table authors (
authors.author_name (VARCHAR(255)),
authors.other_details (VARCHAR(255)),
)
Table business_processes (
business_processes.process_id (INTEGER),
business_processes.next_process_id (INTEGER),
business_processes.process_name (VARCHAR(255)),
business_processes.process_description (VARCHAR(255)),
business_processes.other_details (VARCHAR(255)),
)
Table documents (
documents.document_id (INTEGER),
documents.author_name (VARCHAR(255)),
documents.document_name (VARCHAR(255)),
documents.document_description (VARCHAR(255)),
documents.other_details (VARCHAR(255)),
)
Table documents_processes (
documents_processes.document_id (INTEGER),
documents_processes.process_id (INTEGER),
documents_processes.process_outcome_code (CHAR(15)),
documents_processes.process_status_code (CHAR(15)),
)
Table process_outcomes (
process_outcomes.process_outcome_code (CHAR(15)),
process_outcomes.process_outcome_description (VARCHAR(255)),
)
Table process_status (
process_status.process_status_code (CHAR(15)),
process_status.process_status_description (VARCHAR(255)),
)
Table ref_staff_roles (
ref_staff_roles.staff_role_code (CHAR(15)),
ref_staff_roles.staff_role_description (VARCHAR(255)),
)
Table staff (
staff.staff_id (INTEGER),
staff.staff_details (VARCHAR(255)),
)
Table staff_in_processes (
staff_in_processes.document_id (INTEGER),
staff_in_processes.process_id (INTEGER),
staff_in_processes.staff_id (INTEGER),
staff_in_processes.staff_role_code (CHAR(15)),
staff_in_processes.date_from (DATETIME),
staff_in_processes.date_to (DATETIME),
staff_in_processes.other_details (VARCHAR(255)),
)
Possible JOINs:
documents.author_name = authors.author_name
documents_processes.document_id = documents.document_id
documents_processes.process_id = business_processes.process_id
documents_processes.process_outcome_code = process_outcomes.process_outcome_code
documents_processes.process_status_code = process_status.process_status_code
staff_in_processes.document_id = documents_processes.document_id
staff_in_processes.process_id = documents_processes.process_id
staff_in_processes.staff_id = staff.staff_id
staff_in_processes.staff_role_code = ref_staff_roles.staff_role_code
| CREATE TABLE authors (
authors.author_name (VARCHAR(255)),
authors.other_details (VARCHAR(255)),
)
CREATE TABLE business_processes (
business_processes.process_id (INTEGER),
business_processes.next_process_id (INTEGER),
business_processes.process_name (VARCHAR(255)),
business_processes.process_description (VARCHAR(255)),
business_processes.other_details (VARCHAR(255)),
)
CREATE TABLE documents (
documents.document_id (INTEGER),
documents.author_name (VARCHAR(255)),
documents.document_name (VARCHAR(255)),
documents.document_description (VARCHAR(255)),
documents.other_details (VARCHAR(255)),
)
CREATE TABLE documents_processes (
documents_processes.document_id (INTEGER),
documents_processes.process_id (INTEGER),
documents_processes.process_outcome_code (CHAR(15)),
documents_processes.process_status_code (CHAR(15)),
)
CREATE TABLE process_outcomes (
process_outcomes.process_outcome_code (CHAR(15)),
process_outcomes.process_outcome_description (VARCHAR(255)),
)
CREATE TABLE process_status (
process_status.process_status_code (CHAR(15)),
process_status.process_status_description (VARCHAR(255)),
)
CREATE TABLE ref_staff_roles (
ref_staff_roles.staff_role_code (CHAR(15)),
ref_staff_roles.staff_role_description (VARCHAR(255)),
)
CREATE TABLE staff (
staff.staff_id (INTEGER),
staff.staff_details (VARCHAR(255)),
)
CREATE TABLE staff_in_processes (
staff_in_processes.document_id (INTEGER),
staff_in_processes.process_id (INTEGER),
staff_in_processes.staff_id (INTEGER),
staff_in_processes.staff_role_code (CHAR(15)),
staff_in_processes.date_from (DATETIME),
staff_in_processes.date_to (DATETIME),
staff_in_processes.other_details (VARCHAR(255)),
)
Possible JOINs:
documents.author_name = authors.author_name
documents_processes.document_id = documents.document_id
documents_processes.process_id = business_processes.process_id
documents_processes.process_outcome_code = process_outcomes.process_outcome_code
documents_processes.process_status_code = process_status.process_status_code
staff_in_processes.document_id = documents_processes.document_id
staff_in_processes.process_id = documents_processes.process_id
staff_in_processes.staff_id = staff.staff_id
staff_in_processes.staff_role_code = ref_staff_roles.staff_role_code
| {
'Staff': ['staff_id', 'staff_details'],
'Ref_Staff_Roles': ['staff_role_code', 'staff_role_description'],
'Process_Outcomes': ['process_outcome_code', 'process_outcome_description'],
'Process_Status': ['process_status_code', 'process_status_description'],
'Authors': ['author_name', 'other_details'],
'Documents': ['document_id', 'author_name', 'document_name', 'document_description', 'other_details'],
'Business_Processes': ['process_id', 'next_process_id', 'process_name', 'process_description', 'other_details'],
'Documents_Processes': ['document_id', 'process_id', 'process_outcome_code', 'process_status_code'],
'Staff_in_Processes': ['document_id', 'process_id', 'staff_id', 'staff_role_code', 'date_from', 'date_to', 'other_details']
} | {
'Authors': ['author_name', 'other_details']
} | TABLE Authors (
Authors.author_name (VARCHAR(255)),
Authors.other_details (VARCHAR(255)),
)
TABLE Business_Processes (
Business_Processes.process_id (INTEGER),
Business_Processes.next_process_id (INTEGER),
Business_Processes.process_name (VARCHAR(255)),
Business_Processes.process_description (VARCHAR(255)),
Business_Processes.other_details (VARCHAR(255)),
)
TABLE Documents (
Documents.document_id (INTEGER),
Documents.author_name (VARCHAR(255)),
Documents.document_name (VARCHAR(255)),
Documents.document_description (VARCHAR(255)),
Documents.other_details (VARCHAR(255)),
)
TABLE Documents_Processes (
Documents_Processes.document_id (INTEGER),
Documents_Processes.process_id (INTEGER),
Documents_Processes.process_outcome_code (CHAR(15)),
Documents_Processes.process_status_code (CHAR(15)),
)
TABLE Process_Outcomes (
Process_Outcomes.process_outcome_code (CHAR(15)),
Process_Outcomes.process_outcome_description (VARCHAR(255)),
)
TABLE Process_Status (
Process_Status.process_status_code (CHAR(15)),
Process_Status.process_status_description (VARCHAR(255)),
)
TABLE Ref_Staff_Roles (
Ref_Staff_Roles.staff_role_code (CHAR(15)),
Ref_Staff_Roles.staff_role_description (VARCHAR(255)),
)
TABLE Staff (
Staff.staff_id (INTEGER),
Staff.staff_details (VARCHAR(255)),
)
TABLE Staff_in_Processes (
Staff_in_Processes.document_id (INTEGER),
Staff_in_Processes.process_id (INTEGER),
Staff_in_Processes.staff_id (INTEGER),
Staff_in_Processes.staff_role_code (CHAR(15)),
Staff_in_Processes.date_from (DATETIME),
Staff_in_Processes.date_to (DATETIME),
Staff_in_Processes.other_details (VARCHAR(255)),
)
Possible JOINs:
Documents.author_name = Authors.author_name
Documents_Processes.document_id = Documents.document_id
Documents_Processes.process_id = Business_Processes.process_id
Documents_Processes.process_outcome_code = Process_Outcomes.process_outcome_code
Documents_Processes.process_status_code = Process_Status.process_status_code
Staff_in_Processes.document_id = Documents_Processes.document_id
Staff_in_Processes.process_id = Documents_Processes.process_id
Staff_in_Processes.staff_id = Staff.staff_id
Staff_in_Processes.staff_role_code = Ref_Staff_Roles.staff_role_code
| TABLE Authors (
Authors.author_name (VARCHAR(255)),
Authors.other_details (VARCHAR(255)),
)
TABLE Business_Processes (
Business_Processes.process_id (INTEGER),
Business_Processes.next_process_id (INTEGER),
Business_Processes.process_name (VARCHAR(255)),
Business_Processes.process_description (VARCHAR(255)),
Business_Processes.other_details (VARCHAR(255)),
)
TABLE Documents (
Documents.document_id (INTEGER),
Documents.author_name (VARCHAR(255)),
Documents.document_name (VARCHAR(255)),
Documents.document_description (VARCHAR(255)),
Documents.other_details (VARCHAR(255)),
)
TABLE Documents_Processes (
Documents_Processes.document_id (INTEGER),
Documents_Processes.process_id (INTEGER),
Documents_Processes.process_outcome_code (CHAR(15)),
Documents_Processes.process_status_code (CHAR(15)),
)
TABLE Process_Outcomes (
Process_Outcomes.process_outcome_code (CHAR(15)),
Process_Outcomes.process_outcome_description (VARCHAR(255)),
)
TABLE Process_Status (
Process_Status.process_status_code (CHAR(15)),
Process_Status.process_status_description (VARCHAR(255)),
)
TABLE Ref_Staff_Roles (
Ref_Staff_Roles.staff_role_code (CHAR(15)),
Ref_Staff_Roles.staff_role_description (VARCHAR(255)),
)
TABLE Staff (
Staff.staff_id (INTEGER),
Staff.staff_details (VARCHAR(255)),
)
TABLE Staff_in_Processes (
Staff_in_Processes.document_id (INTEGER),
Staff_in_Processes.process_id (INTEGER),
Staff_in_Processes.staff_id (INTEGER),
Staff_in_Processes.staff_role_code (CHAR(15)),
Staff_in_Processes.date_from (DATETIME),
Staff_in_Processes.date_to (DATETIME),
Staff_in_Processes.other_details (VARCHAR(255)),
)
Possible JOINs:
Documents.author_name = Authors.author_name
Documents_Processes.document_id = Documents.document_id
Documents_Processes.process_id = Business_Processes.process_id
Documents_Processes.process_outcome_code = Process_Outcomes.process_outcome_code
Documents_Processes.process_status_code = Process_Status.process_status_code
Staff_in_Processes.document_id = Documents_Processes.document_id
Staff_in_Processes.process_id = Documents_Processes.process_id
Staff_in_Processes.staff_id = Staff.staff_id
Staff_in_Processes.staff_role_code = Ref_Staff_Roles.staff_role_code
| TABLE authors (
authors.author_name (VARCHAR(255)),
authors.other_details (VARCHAR(255)),
)
TABLE business_processes (
business_processes.process_id (INTEGER),
business_processes.next_process_id (INTEGER),
business_processes.process_name (VARCHAR(255)),
business_processes.process_description (VARCHAR(255)),
business_processes.other_details (VARCHAR(255)),
)
TABLE documents (
documents.document_id (INTEGER),
documents.author_name (VARCHAR(255)),
documents.document_name (VARCHAR(255)),
documents.document_description (VARCHAR(255)),
documents.other_details (VARCHAR(255)),
)
TABLE documents_processes (
documents_processes.document_id (INTEGER),
documents_processes.process_id (INTEGER),
documents_processes.process_outcome_code (CHAR(15)),
documents_processes.process_status_code (CHAR(15)),
)
TABLE process_outcomes (
process_outcomes.process_outcome_code (CHAR(15)),
process_outcomes.process_outcome_description (VARCHAR(255)),
)
TABLE process_status (
process_status.process_status_code (CHAR(15)),
process_status.process_status_description (VARCHAR(255)),
)
TABLE ref_staff_roles (
ref_staff_roles.staff_role_code (CHAR(15)),
ref_staff_roles.staff_role_description (VARCHAR(255)),
)
TABLE staff (
staff.staff_id (INTEGER),
staff.staff_details (VARCHAR(255)),
)
TABLE staff_in_processes (
staff_in_processes.document_id (INTEGER),
staff_in_processes.process_id (INTEGER),
staff_in_processes.staff_id (INTEGER),
staff_in_processes.staff_role_code (CHAR(15)),
staff_in_processes.date_from (DATETIME),
staff_in_processes.date_to (DATETIME),
staff_in_processes.other_details (VARCHAR(255)),
)
Possible JOINs:
documents.author_name = authors.author_name
documents_processes.document_id = documents.document_id
documents_processes.process_id = business_processes.process_id
documents_processes.process_outcome_code = process_outcomes.process_outcome_code
documents_processes.process_status_code = process_status.process_status_code
staff_in_processes.document_id = documents_processes.document_id
staff_in_processes.process_id = documents_processes.process_id
staff_in_processes.staff_id = staff.staff_id
staff_in_processes.staff_role_code = ref_staff_roles.staff_role_code
|