db_id
stringclasses 140
values | messages
listlengths 2
2
|
---|---|
apartment_rentals | [
{
"content": "Translate the following question to SQL: Show the short names of the buildings managed by \"Emma\".\n\nSchema: CREATE TABLE Apartment_Buildings (\n building_id INTEGER NOT NULL PRIMARY KEY,\n building_short_name CHAR(15),\n building_full_name VARCHAR(80),\n building_description VARCHAR(255),\n building_address VARCHAR(255),\n building_manager VARCHAR(50),\n building_phone VARCHAR(80),\n UNIQUE (building_id)\n);\n\nCREATE TABLE Apartments (\n apt_id INTEGER NOT NULL PRIMARY KEY,\n building_id INTEGER NOT NULL,\n apt_type_code CHAR(15),\n apt_number CHAR(10),\n bathroom_count INTEGER,\n bedroom_count INTEGER,\n room_count CHAR(5),\n UNIQUE (apt_id),\n FOREIGN KEY (building_id) REFERENCES Apartment_Buildings(building_id)\n);\n\nCREATE TABLE Apartment_Facilities (\n apt_id INTEGER NOT NULL PRIMARY KEY,\n facility_code CHAR(15) NOT NULL PRIMARY KEY,\n PRIMARY KEY (apt_id, facility_code),\n UNIQUE (apt_id, facility_code),\n FOREIGN KEY (apt_id) REFERENCES Apartments(apt_id)\n);\n\nCREATE TABLE Guests (\n guest_id INTEGER NOT NULL PRIMARY KEY,\n gender_code CHAR(1),\n guest_first_name VARCHAR(80),\n guest_last_name VARCHAR(80),\n date_of_birth DATETIME,\n UNIQUE (guest_id)\n);\n\nCREATE TABLE Apartment_Bookings (\n apt_booking_id INTEGER NOT NULL PRIMARY KEY,\n apt_id INTEGER,\n guest_id INTEGER NOT NULL,\n booking_status_code CHAR(15) NOT NULL,\n booking_start_date DATETIME,\n booking_end_date DATETIME,\n UNIQUE (apt_booking_id),\n FOREIGN KEY (guest_id) REFERENCES Guests(guest_id),\n FOREIGN KEY (apt_id) REFERENCES Apartments(apt_id)\n);\n\nCREATE TABLE View_Unit_Status (\n apt_id INTEGER,\n apt_booking_id INTEGER,\n status_date DATETIME NOT NULL PRIMARY KEY,\n available_yn BIT,\n UNIQUE (status_date),\n FOREIGN KEY (apt_booking_id) REFERENCES Apartment_Bookings(apt_booking_id),\n FOREIGN KEY (apt_id) REFERENCES Apartments(apt_id)\n);",
"role": "user"
},
{
"content": "SELECT building_short_name FROM Apartment_Buildings WHERE building_manager\t = \"Emma\"",
"role": "assistant"
}
] |
apartment_rentals | [
{
"content": "Translate the following question to SQL: Which buildings does \"Emma\" manage? Give me the short names of the buildings.\n\nSchema: CREATE TABLE Apartment_Buildings (\n building_id INTEGER NOT NULL PRIMARY KEY,\n building_short_name CHAR(15),\n building_full_name VARCHAR(80),\n building_description VARCHAR(255),\n building_address VARCHAR(255),\n building_manager VARCHAR(50),\n building_phone VARCHAR(80),\n UNIQUE (building_id)\n);\n\nCREATE TABLE Apartments (\n apt_id INTEGER NOT NULL PRIMARY KEY,\n building_id INTEGER NOT NULL,\n apt_type_code CHAR(15),\n apt_number CHAR(10),\n bathroom_count INTEGER,\n bedroom_count INTEGER,\n room_count CHAR(5),\n UNIQUE (apt_id),\n FOREIGN KEY (building_id) REFERENCES Apartment_Buildings(building_id)\n);\n\nCREATE TABLE Apartment_Facilities (\n apt_id INTEGER NOT NULL PRIMARY KEY,\n facility_code CHAR(15) NOT NULL PRIMARY KEY,\n PRIMARY KEY (apt_id, facility_code),\n UNIQUE (apt_id, facility_code),\n FOREIGN KEY (apt_id) REFERENCES Apartments(apt_id)\n);\n\nCREATE TABLE Guests (\n guest_id INTEGER NOT NULL PRIMARY KEY,\n gender_code CHAR(1),\n guest_first_name VARCHAR(80),\n guest_last_name VARCHAR(80),\n date_of_birth DATETIME,\n UNIQUE (guest_id)\n);\n\nCREATE TABLE Apartment_Bookings (\n apt_booking_id INTEGER NOT NULL PRIMARY KEY,\n apt_id INTEGER,\n guest_id INTEGER NOT NULL,\n booking_status_code CHAR(15) NOT NULL,\n booking_start_date DATETIME,\n booking_end_date DATETIME,\n UNIQUE (apt_booking_id),\n FOREIGN KEY (guest_id) REFERENCES Guests(guest_id),\n FOREIGN KEY (apt_id) REFERENCES Apartments(apt_id)\n);\n\nCREATE TABLE View_Unit_Status (\n apt_id INTEGER,\n apt_booking_id INTEGER,\n status_date DATETIME NOT NULL PRIMARY KEY,\n available_yn BIT,\n UNIQUE (status_date),\n FOREIGN KEY (apt_booking_id) REFERENCES Apartment_Bookings(apt_booking_id),\n FOREIGN KEY (apt_id) REFERENCES Apartments(apt_id)\n);",
"role": "user"
},
{
"content": "SELECT building_short_name FROM Apartment_Buildings WHERE building_manager\t = \"Emma\"",
"role": "assistant"
}
] |
apartment_rentals | [
{
"content": "Translate the following question to SQL: Show the addresses and phones of all the buildings managed by \"Brenden\".\n\nSchema: CREATE TABLE Apartment_Buildings (\n building_id INTEGER NOT NULL PRIMARY KEY,\n building_short_name CHAR(15),\n building_full_name VARCHAR(80),\n building_description VARCHAR(255),\n building_address VARCHAR(255),\n building_manager VARCHAR(50),\n building_phone VARCHAR(80),\n UNIQUE (building_id)\n);\n\nCREATE TABLE Apartments (\n apt_id INTEGER NOT NULL PRIMARY KEY,\n building_id INTEGER NOT NULL,\n apt_type_code CHAR(15),\n apt_number CHAR(10),\n bathroom_count INTEGER,\n bedroom_count INTEGER,\n room_count CHAR(5),\n UNIQUE (apt_id),\n FOREIGN KEY (building_id) REFERENCES Apartment_Buildings(building_id)\n);\n\nCREATE TABLE Apartment_Facilities (\n apt_id INTEGER NOT NULL PRIMARY KEY,\n facility_code CHAR(15) NOT NULL PRIMARY KEY,\n PRIMARY KEY (apt_id, facility_code),\n UNIQUE (apt_id, facility_code),\n FOREIGN KEY (apt_id) REFERENCES Apartments(apt_id)\n);\n\nCREATE TABLE Guests (\n guest_id INTEGER NOT NULL PRIMARY KEY,\n gender_code CHAR(1),\n guest_first_name VARCHAR(80),\n guest_last_name VARCHAR(80),\n date_of_birth DATETIME,\n UNIQUE (guest_id)\n);\n\nCREATE TABLE Apartment_Bookings (\n apt_booking_id INTEGER NOT NULL PRIMARY KEY,\n apt_id INTEGER,\n guest_id INTEGER NOT NULL,\n booking_status_code CHAR(15) NOT NULL,\n booking_start_date DATETIME,\n booking_end_date DATETIME,\n UNIQUE (apt_booking_id),\n FOREIGN KEY (guest_id) REFERENCES Guests(guest_id),\n FOREIGN KEY (apt_id) REFERENCES Apartments(apt_id)\n);\n\nCREATE TABLE View_Unit_Status (\n apt_id INTEGER,\n apt_booking_id INTEGER,\n status_date DATETIME NOT NULL PRIMARY KEY,\n available_yn BIT,\n UNIQUE (status_date),\n FOREIGN KEY (apt_booking_id) REFERENCES Apartment_Bookings(apt_booking_id),\n FOREIGN KEY (apt_id) REFERENCES Apartments(apt_id)\n);",
"role": "user"
},
{
"content": "SELECT building_address , building_phone FROM Apartment_Buildings WHERE building_manager\t = \"Brenden\"",
"role": "assistant"
}
] |
apartment_rentals | [
{
"content": "Translate the following question to SQL: What are the address and phone number of the buildings managed by \"Brenden\"?\n\nSchema: CREATE TABLE Apartment_Buildings (\n building_id INTEGER NOT NULL PRIMARY KEY,\n building_short_name CHAR(15),\n building_full_name VARCHAR(80),\n building_description VARCHAR(255),\n building_address VARCHAR(255),\n building_manager VARCHAR(50),\n building_phone VARCHAR(80),\n UNIQUE (building_id)\n);\n\nCREATE TABLE Apartments (\n apt_id INTEGER NOT NULL PRIMARY KEY,\n building_id INTEGER NOT NULL,\n apt_type_code CHAR(15),\n apt_number CHAR(10),\n bathroom_count INTEGER,\n bedroom_count INTEGER,\n room_count CHAR(5),\n UNIQUE (apt_id),\n FOREIGN KEY (building_id) REFERENCES Apartment_Buildings(building_id)\n);\n\nCREATE TABLE Apartment_Facilities (\n apt_id INTEGER NOT NULL PRIMARY KEY,\n facility_code CHAR(15) NOT NULL PRIMARY KEY,\n PRIMARY KEY (apt_id, facility_code),\n UNIQUE (apt_id, facility_code),\n FOREIGN KEY (apt_id) REFERENCES Apartments(apt_id)\n);\n\nCREATE TABLE Guests (\n guest_id INTEGER NOT NULL PRIMARY KEY,\n gender_code CHAR(1),\n guest_first_name VARCHAR(80),\n guest_last_name VARCHAR(80),\n date_of_birth DATETIME,\n UNIQUE (guest_id)\n);\n\nCREATE TABLE Apartment_Bookings (\n apt_booking_id INTEGER NOT NULL PRIMARY KEY,\n apt_id INTEGER,\n guest_id INTEGER NOT NULL,\n booking_status_code CHAR(15) NOT NULL,\n booking_start_date DATETIME,\n booking_end_date DATETIME,\n UNIQUE (apt_booking_id),\n FOREIGN KEY (guest_id) REFERENCES Guests(guest_id),\n FOREIGN KEY (apt_id) REFERENCES Apartments(apt_id)\n);\n\nCREATE TABLE View_Unit_Status (\n apt_id INTEGER,\n apt_booking_id INTEGER,\n status_date DATETIME NOT NULL PRIMARY KEY,\n available_yn BIT,\n UNIQUE (status_date),\n FOREIGN KEY (apt_booking_id) REFERENCES Apartment_Bookings(apt_booking_id),\n FOREIGN KEY (apt_id) REFERENCES Apartments(apt_id)\n);",
"role": "user"
},
{
"content": "SELECT building_address , building_phone FROM Apartment_Buildings WHERE building_manager\t = \"Brenden\"",
"role": "assistant"
}
] |
apartment_rentals | [
{
"content": "Translate the following question to SQL: What are the building full names that contain the word \"court\"?\n\nSchema: CREATE TABLE Apartment_Buildings (\n building_id INTEGER NOT NULL PRIMARY KEY,\n building_short_name CHAR(15),\n building_full_name VARCHAR(80),\n building_description VARCHAR(255),\n building_address VARCHAR(255),\n building_manager VARCHAR(50),\n building_phone VARCHAR(80),\n UNIQUE (building_id)\n);\n\nCREATE TABLE Apartments (\n apt_id INTEGER NOT NULL PRIMARY KEY,\n building_id INTEGER NOT NULL,\n apt_type_code CHAR(15),\n apt_number CHAR(10),\n bathroom_count INTEGER,\n bedroom_count INTEGER,\n room_count CHAR(5),\n UNIQUE (apt_id),\n FOREIGN KEY (building_id) REFERENCES Apartment_Buildings(building_id)\n);\n\nCREATE TABLE Apartment_Facilities (\n apt_id INTEGER NOT NULL PRIMARY KEY,\n facility_code CHAR(15) NOT NULL PRIMARY KEY,\n PRIMARY KEY (apt_id, facility_code),\n UNIQUE (apt_id, facility_code),\n FOREIGN KEY (apt_id) REFERENCES Apartments(apt_id)\n);\n\nCREATE TABLE Guests (\n guest_id INTEGER NOT NULL PRIMARY KEY,\n gender_code CHAR(1),\n guest_first_name VARCHAR(80),\n guest_last_name VARCHAR(80),\n date_of_birth DATETIME,\n UNIQUE (guest_id)\n);\n\nCREATE TABLE Apartment_Bookings (\n apt_booking_id INTEGER NOT NULL PRIMARY KEY,\n apt_id INTEGER,\n guest_id INTEGER NOT NULL,\n booking_status_code CHAR(15) NOT NULL,\n booking_start_date DATETIME,\n booking_end_date DATETIME,\n UNIQUE (apt_booking_id),\n FOREIGN KEY (guest_id) REFERENCES Guests(guest_id),\n FOREIGN KEY (apt_id) REFERENCES Apartments(apt_id)\n);\n\nCREATE TABLE View_Unit_Status (\n apt_id INTEGER,\n apt_booking_id INTEGER,\n status_date DATETIME NOT NULL PRIMARY KEY,\n available_yn BIT,\n UNIQUE (status_date),\n FOREIGN KEY (apt_booking_id) REFERENCES Apartment_Bookings(apt_booking_id),\n FOREIGN KEY (apt_id) REFERENCES Apartments(apt_id)\n);",
"role": "user"
},
{
"content": "SELECT building_full_name FROM Apartment_Buildings WHERE building_full_name LIKE \"%court%\"",
"role": "assistant"
}
] |
apartment_rentals | [
{
"content": "Translate the following question to SQL: Find all the building full names containing the word \"court\".\n\nSchema: CREATE TABLE Apartment_Buildings (\n building_id INTEGER NOT NULL PRIMARY KEY,\n building_short_name CHAR(15),\n building_full_name VARCHAR(80),\n building_description VARCHAR(255),\n building_address VARCHAR(255),\n building_manager VARCHAR(50),\n building_phone VARCHAR(80),\n UNIQUE (building_id)\n);\n\nCREATE TABLE Apartments (\n apt_id INTEGER NOT NULL PRIMARY KEY,\n building_id INTEGER NOT NULL,\n apt_type_code CHAR(15),\n apt_number CHAR(10),\n bathroom_count INTEGER,\n bedroom_count INTEGER,\n room_count CHAR(5),\n UNIQUE (apt_id),\n FOREIGN KEY (building_id) REFERENCES Apartment_Buildings(building_id)\n);\n\nCREATE TABLE Apartment_Facilities (\n apt_id INTEGER NOT NULL PRIMARY KEY,\n facility_code CHAR(15) NOT NULL PRIMARY KEY,\n PRIMARY KEY (apt_id, facility_code),\n UNIQUE (apt_id, facility_code),\n FOREIGN KEY (apt_id) REFERENCES Apartments(apt_id)\n);\n\nCREATE TABLE Guests (\n guest_id INTEGER NOT NULL PRIMARY KEY,\n gender_code CHAR(1),\n guest_first_name VARCHAR(80),\n guest_last_name VARCHAR(80),\n date_of_birth DATETIME,\n UNIQUE (guest_id)\n);\n\nCREATE TABLE Apartment_Bookings (\n apt_booking_id INTEGER NOT NULL PRIMARY KEY,\n apt_id INTEGER,\n guest_id INTEGER NOT NULL,\n booking_status_code CHAR(15) NOT NULL,\n booking_start_date DATETIME,\n booking_end_date DATETIME,\n UNIQUE (apt_booking_id),\n FOREIGN KEY (guest_id) REFERENCES Guests(guest_id),\n FOREIGN KEY (apt_id) REFERENCES Apartments(apt_id)\n);\n\nCREATE TABLE View_Unit_Status (\n apt_id INTEGER,\n apt_booking_id INTEGER,\n status_date DATETIME NOT NULL PRIMARY KEY,\n available_yn BIT,\n UNIQUE (status_date),\n FOREIGN KEY (apt_booking_id) REFERENCES Apartment_Bookings(apt_booking_id),\n FOREIGN KEY (apt_id) REFERENCES Apartments(apt_id)\n);",
"role": "user"
},
{
"content": "SELECT building_full_name FROM Apartment_Buildings WHERE building_full_name LIKE \"%court%\"",
"role": "assistant"
}
] |
apartment_rentals | [
{
"content": "Translate the following question to SQL: What is the minimum and maximum number of bathrooms of all the apartments?\n\nSchema: CREATE TABLE Apartment_Buildings (\n building_id INTEGER NOT NULL PRIMARY KEY,\n building_short_name CHAR(15),\n building_full_name VARCHAR(80),\n building_description VARCHAR(255),\n building_address VARCHAR(255),\n building_manager VARCHAR(50),\n building_phone VARCHAR(80),\n UNIQUE (building_id)\n);\n\nCREATE TABLE Apartments (\n apt_id INTEGER NOT NULL PRIMARY KEY,\n building_id INTEGER NOT NULL,\n apt_type_code CHAR(15),\n apt_number CHAR(10),\n bathroom_count INTEGER,\n bedroom_count INTEGER,\n room_count CHAR(5),\n UNIQUE (apt_id),\n FOREIGN KEY (building_id) REFERENCES Apartment_Buildings(building_id)\n);\n\nCREATE TABLE Apartment_Facilities (\n apt_id INTEGER NOT NULL PRIMARY KEY,\n facility_code CHAR(15) NOT NULL PRIMARY KEY,\n PRIMARY KEY (apt_id, facility_code),\n UNIQUE (apt_id, facility_code),\n FOREIGN KEY (apt_id) REFERENCES Apartments(apt_id)\n);\n\nCREATE TABLE Guests (\n guest_id INTEGER NOT NULL PRIMARY KEY,\n gender_code CHAR(1),\n guest_first_name VARCHAR(80),\n guest_last_name VARCHAR(80),\n date_of_birth DATETIME,\n UNIQUE (guest_id)\n);\n\nCREATE TABLE Apartment_Bookings (\n apt_booking_id INTEGER NOT NULL PRIMARY KEY,\n apt_id INTEGER,\n guest_id INTEGER NOT NULL,\n booking_status_code CHAR(15) NOT NULL,\n booking_start_date DATETIME,\n booking_end_date DATETIME,\n UNIQUE (apt_booking_id),\n FOREIGN KEY (guest_id) REFERENCES Guests(guest_id),\n FOREIGN KEY (apt_id) REFERENCES Apartments(apt_id)\n);\n\nCREATE TABLE View_Unit_Status (\n apt_id INTEGER,\n apt_booking_id INTEGER,\n status_date DATETIME NOT NULL PRIMARY KEY,\n available_yn BIT,\n UNIQUE (status_date),\n FOREIGN KEY (apt_booking_id) REFERENCES Apartment_Bookings(apt_booking_id),\n FOREIGN KEY (apt_id) REFERENCES Apartments(apt_id)\n);",
"role": "user"
},
{
"content": "SELECT min(bathroom_count) , max(bathroom_count) FROM Apartments",
"role": "assistant"
}
] |
apartment_rentals | [
{
"content": "Translate the following question to SQL: Give me the minimum and maximum bathroom count among all the apartments.\n\nSchema: CREATE TABLE Apartment_Buildings (\n building_id INTEGER NOT NULL PRIMARY KEY,\n building_short_name CHAR(15),\n building_full_name VARCHAR(80),\n building_description VARCHAR(255),\n building_address VARCHAR(255),\n building_manager VARCHAR(50),\n building_phone VARCHAR(80),\n UNIQUE (building_id)\n);\n\nCREATE TABLE Apartments (\n apt_id INTEGER NOT NULL PRIMARY KEY,\n building_id INTEGER NOT NULL,\n apt_type_code CHAR(15),\n apt_number CHAR(10),\n bathroom_count INTEGER,\n bedroom_count INTEGER,\n room_count CHAR(5),\n UNIQUE (apt_id),\n FOREIGN KEY (building_id) REFERENCES Apartment_Buildings(building_id)\n);\n\nCREATE TABLE Apartment_Facilities (\n apt_id INTEGER NOT NULL PRIMARY KEY,\n facility_code CHAR(15) NOT NULL PRIMARY KEY,\n PRIMARY KEY (apt_id, facility_code),\n UNIQUE (apt_id, facility_code),\n FOREIGN KEY (apt_id) REFERENCES Apartments(apt_id)\n);\n\nCREATE TABLE Guests (\n guest_id INTEGER NOT NULL PRIMARY KEY,\n gender_code CHAR(1),\n guest_first_name VARCHAR(80),\n guest_last_name VARCHAR(80),\n date_of_birth DATETIME,\n UNIQUE (guest_id)\n);\n\nCREATE TABLE Apartment_Bookings (\n apt_booking_id INTEGER NOT NULL PRIMARY KEY,\n apt_id INTEGER,\n guest_id INTEGER NOT NULL,\n booking_status_code CHAR(15) NOT NULL,\n booking_start_date DATETIME,\n booking_end_date DATETIME,\n UNIQUE (apt_booking_id),\n FOREIGN KEY (guest_id) REFERENCES Guests(guest_id),\n FOREIGN KEY (apt_id) REFERENCES Apartments(apt_id)\n);\n\nCREATE TABLE View_Unit_Status (\n apt_id INTEGER,\n apt_booking_id INTEGER,\n status_date DATETIME NOT NULL PRIMARY KEY,\n available_yn BIT,\n UNIQUE (status_date),\n FOREIGN KEY (apt_booking_id) REFERENCES Apartment_Bookings(apt_booking_id),\n FOREIGN KEY (apt_id) REFERENCES Apartments(apt_id)\n);",
"role": "user"
},
{
"content": "SELECT min(bathroom_count) , max(bathroom_count) FROM Apartments",
"role": "assistant"
}
] |
apartment_rentals | [
{
"content": "Translate the following question to SQL: What is the average number of bedrooms of all apartments?\n\nSchema: CREATE TABLE Apartment_Buildings (\n building_id INTEGER NOT NULL PRIMARY KEY,\n building_short_name CHAR(15),\n building_full_name VARCHAR(80),\n building_description VARCHAR(255),\n building_address VARCHAR(255),\n building_manager VARCHAR(50),\n building_phone VARCHAR(80),\n UNIQUE (building_id)\n);\n\nCREATE TABLE Apartments (\n apt_id INTEGER NOT NULL PRIMARY KEY,\n building_id INTEGER NOT NULL,\n apt_type_code CHAR(15),\n apt_number CHAR(10),\n bathroom_count INTEGER,\n bedroom_count INTEGER,\n room_count CHAR(5),\n UNIQUE (apt_id),\n FOREIGN KEY (building_id) REFERENCES Apartment_Buildings(building_id)\n);\n\nCREATE TABLE Apartment_Facilities (\n apt_id INTEGER NOT NULL PRIMARY KEY,\n facility_code CHAR(15) NOT NULL PRIMARY KEY,\n PRIMARY KEY (apt_id, facility_code),\n UNIQUE (apt_id, facility_code),\n FOREIGN KEY (apt_id) REFERENCES Apartments(apt_id)\n);\n\nCREATE TABLE Guests (\n guest_id INTEGER NOT NULL PRIMARY KEY,\n gender_code CHAR(1),\n guest_first_name VARCHAR(80),\n guest_last_name VARCHAR(80),\n date_of_birth DATETIME,\n UNIQUE (guest_id)\n);\n\nCREATE TABLE Apartment_Bookings (\n apt_booking_id INTEGER NOT NULL PRIMARY KEY,\n apt_id INTEGER,\n guest_id INTEGER NOT NULL,\n booking_status_code CHAR(15) NOT NULL,\n booking_start_date DATETIME,\n booking_end_date DATETIME,\n UNIQUE (apt_booking_id),\n FOREIGN KEY (guest_id) REFERENCES Guests(guest_id),\n FOREIGN KEY (apt_id) REFERENCES Apartments(apt_id)\n);\n\nCREATE TABLE View_Unit_Status (\n apt_id INTEGER,\n apt_booking_id INTEGER,\n status_date DATETIME NOT NULL PRIMARY KEY,\n available_yn BIT,\n UNIQUE (status_date),\n FOREIGN KEY (apt_booking_id) REFERENCES Apartment_Bookings(apt_booking_id),\n FOREIGN KEY (apt_id) REFERENCES Apartments(apt_id)\n);",
"role": "user"
},
{
"content": "SELECT avg(bedroom_count) FROM Apartments",
"role": "assistant"
}
] |
apartment_rentals | [
{
"content": "Translate the following question to SQL: Find the average number of bedrooms of all the apartments.\n\nSchema: CREATE TABLE Apartment_Buildings (\n building_id INTEGER NOT NULL PRIMARY KEY,\n building_short_name CHAR(15),\n building_full_name VARCHAR(80),\n building_description VARCHAR(255),\n building_address VARCHAR(255),\n building_manager VARCHAR(50),\n building_phone VARCHAR(80),\n UNIQUE (building_id)\n);\n\nCREATE TABLE Apartments (\n apt_id INTEGER NOT NULL PRIMARY KEY,\n building_id INTEGER NOT NULL,\n apt_type_code CHAR(15),\n apt_number CHAR(10),\n bathroom_count INTEGER,\n bedroom_count INTEGER,\n room_count CHAR(5),\n UNIQUE (apt_id),\n FOREIGN KEY (building_id) REFERENCES Apartment_Buildings(building_id)\n);\n\nCREATE TABLE Apartment_Facilities (\n apt_id INTEGER NOT NULL PRIMARY KEY,\n facility_code CHAR(15) NOT NULL PRIMARY KEY,\n PRIMARY KEY (apt_id, facility_code),\n UNIQUE (apt_id, facility_code),\n FOREIGN KEY (apt_id) REFERENCES Apartments(apt_id)\n);\n\nCREATE TABLE Guests (\n guest_id INTEGER NOT NULL PRIMARY KEY,\n gender_code CHAR(1),\n guest_first_name VARCHAR(80),\n guest_last_name VARCHAR(80),\n date_of_birth DATETIME,\n UNIQUE (guest_id)\n);\n\nCREATE TABLE Apartment_Bookings (\n apt_booking_id INTEGER NOT NULL PRIMARY KEY,\n apt_id INTEGER,\n guest_id INTEGER NOT NULL,\n booking_status_code CHAR(15) NOT NULL,\n booking_start_date DATETIME,\n booking_end_date DATETIME,\n UNIQUE (apt_booking_id),\n FOREIGN KEY (guest_id) REFERENCES Guests(guest_id),\n FOREIGN KEY (apt_id) REFERENCES Apartments(apt_id)\n);\n\nCREATE TABLE View_Unit_Status (\n apt_id INTEGER,\n apt_booking_id INTEGER,\n status_date DATETIME NOT NULL PRIMARY KEY,\n available_yn BIT,\n UNIQUE (status_date),\n FOREIGN KEY (apt_booking_id) REFERENCES Apartment_Bookings(apt_booking_id),\n FOREIGN KEY (apt_id) REFERENCES Apartments(apt_id)\n);",
"role": "user"
},
{
"content": "SELECT avg(bedroom_count) FROM Apartments",
"role": "assistant"
}
] |
apartment_rentals | [
{
"content": "Translate the following question to SQL: Return the apartment number and the number of rooms for each apartment.\n\nSchema: CREATE TABLE Apartment_Buildings (\n building_id INTEGER NOT NULL PRIMARY KEY,\n building_short_name CHAR(15),\n building_full_name VARCHAR(80),\n building_description VARCHAR(255),\n building_address VARCHAR(255),\n building_manager VARCHAR(50),\n building_phone VARCHAR(80),\n UNIQUE (building_id)\n);\n\nCREATE TABLE Apartments (\n apt_id INTEGER NOT NULL PRIMARY KEY,\n building_id INTEGER NOT NULL,\n apt_type_code CHAR(15),\n apt_number CHAR(10),\n bathroom_count INTEGER,\n bedroom_count INTEGER,\n room_count CHAR(5),\n UNIQUE (apt_id),\n FOREIGN KEY (building_id) REFERENCES Apartment_Buildings(building_id)\n);\n\nCREATE TABLE Apartment_Facilities (\n apt_id INTEGER NOT NULL PRIMARY KEY,\n facility_code CHAR(15) NOT NULL PRIMARY KEY,\n PRIMARY KEY (apt_id, facility_code),\n UNIQUE (apt_id, facility_code),\n FOREIGN KEY (apt_id) REFERENCES Apartments(apt_id)\n);\n\nCREATE TABLE Guests (\n guest_id INTEGER NOT NULL PRIMARY KEY,\n gender_code CHAR(1),\n guest_first_name VARCHAR(80),\n guest_last_name VARCHAR(80),\n date_of_birth DATETIME,\n UNIQUE (guest_id)\n);\n\nCREATE TABLE Apartment_Bookings (\n apt_booking_id INTEGER NOT NULL PRIMARY KEY,\n apt_id INTEGER,\n guest_id INTEGER NOT NULL,\n booking_status_code CHAR(15) NOT NULL,\n booking_start_date DATETIME,\n booking_end_date DATETIME,\n UNIQUE (apt_booking_id),\n FOREIGN KEY (guest_id) REFERENCES Guests(guest_id),\n FOREIGN KEY (apt_id) REFERENCES Apartments(apt_id)\n);\n\nCREATE TABLE View_Unit_Status (\n apt_id INTEGER,\n apt_booking_id INTEGER,\n status_date DATETIME NOT NULL PRIMARY KEY,\n available_yn BIT,\n UNIQUE (status_date),\n FOREIGN KEY (apt_booking_id) REFERENCES Apartment_Bookings(apt_booking_id),\n FOREIGN KEY (apt_id) REFERENCES Apartments(apt_id)\n);",
"role": "user"
},
{
"content": "SELECT apt_number , room_count FROM Apartments",
"role": "assistant"
}
] |
apartment_rentals | [
{
"content": "Translate the following question to SQL: What are the apartment number and the room count of each apartment?\n\nSchema: CREATE TABLE Apartment_Buildings (\n building_id INTEGER NOT NULL PRIMARY KEY,\n building_short_name CHAR(15),\n building_full_name VARCHAR(80),\n building_description VARCHAR(255),\n building_address VARCHAR(255),\n building_manager VARCHAR(50),\n building_phone VARCHAR(80),\n UNIQUE (building_id)\n);\n\nCREATE TABLE Apartments (\n apt_id INTEGER NOT NULL PRIMARY KEY,\n building_id INTEGER NOT NULL,\n apt_type_code CHAR(15),\n apt_number CHAR(10),\n bathroom_count INTEGER,\n bedroom_count INTEGER,\n room_count CHAR(5),\n UNIQUE (apt_id),\n FOREIGN KEY (building_id) REFERENCES Apartment_Buildings(building_id)\n);\n\nCREATE TABLE Apartment_Facilities (\n apt_id INTEGER NOT NULL PRIMARY KEY,\n facility_code CHAR(15) NOT NULL PRIMARY KEY,\n PRIMARY KEY (apt_id, facility_code),\n UNIQUE (apt_id, facility_code),\n FOREIGN KEY (apt_id) REFERENCES Apartments(apt_id)\n);\n\nCREATE TABLE Guests (\n guest_id INTEGER NOT NULL PRIMARY KEY,\n gender_code CHAR(1),\n guest_first_name VARCHAR(80),\n guest_last_name VARCHAR(80),\n date_of_birth DATETIME,\n UNIQUE (guest_id)\n);\n\nCREATE TABLE Apartment_Bookings (\n apt_booking_id INTEGER NOT NULL PRIMARY KEY,\n apt_id INTEGER,\n guest_id INTEGER NOT NULL,\n booking_status_code CHAR(15) NOT NULL,\n booking_start_date DATETIME,\n booking_end_date DATETIME,\n UNIQUE (apt_booking_id),\n FOREIGN KEY (guest_id) REFERENCES Guests(guest_id),\n FOREIGN KEY (apt_id) REFERENCES Apartments(apt_id)\n);\n\nCREATE TABLE View_Unit_Status (\n apt_id INTEGER,\n apt_booking_id INTEGER,\n status_date DATETIME NOT NULL PRIMARY KEY,\n available_yn BIT,\n UNIQUE (status_date),\n FOREIGN KEY (apt_booking_id) REFERENCES Apartment_Bookings(apt_booking_id),\n FOREIGN KEY (apt_id) REFERENCES Apartments(apt_id)\n);",
"role": "user"
},
{
"content": "SELECT apt_number , room_count FROM Apartments",
"role": "assistant"
}
] |
apartment_rentals | [
{
"content": "Translate the following question to SQL: What is the average number of rooms of apartments with type code \"Studio\"?\n\nSchema: CREATE TABLE Apartment_Buildings (\n building_id INTEGER NOT NULL PRIMARY KEY,\n building_short_name CHAR(15),\n building_full_name VARCHAR(80),\n building_description VARCHAR(255),\n building_address VARCHAR(255),\n building_manager VARCHAR(50),\n building_phone VARCHAR(80),\n UNIQUE (building_id)\n);\n\nCREATE TABLE Apartments (\n apt_id INTEGER NOT NULL PRIMARY KEY,\n building_id INTEGER NOT NULL,\n apt_type_code CHAR(15),\n apt_number CHAR(10),\n bathroom_count INTEGER,\n bedroom_count INTEGER,\n room_count CHAR(5),\n UNIQUE (apt_id),\n FOREIGN KEY (building_id) REFERENCES Apartment_Buildings(building_id)\n);\n\nCREATE TABLE Apartment_Facilities (\n apt_id INTEGER NOT NULL PRIMARY KEY,\n facility_code CHAR(15) NOT NULL PRIMARY KEY,\n PRIMARY KEY (apt_id, facility_code),\n UNIQUE (apt_id, facility_code),\n FOREIGN KEY (apt_id) REFERENCES Apartments(apt_id)\n);\n\nCREATE TABLE Guests (\n guest_id INTEGER NOT NULL PRIMARY KEY,\n gender_code CHAR(1),\n guest_first_name VARCHAR(80),\n guest_last_name VARCHAR(80),\n date_of_birth DATETIME,\n UNIQUE (guest_id)\n);\n\nCREATE TABLE Apartment_Bookings (\n apt_booking_id INTEGER NOT NULL PRIMARY KEY,\n apt_id INTEGER,\n guest_id INTEGER NOT NULL,\n booking_status_code CHAR(15) NOT NULL,\n booking_start_date DATETIME,\n booking_end_date DATETIME,\n UNIQUE (apt_booking_id),\n FOREIGN KEY (guest_id) REFERENCES Guests(guest_id),\n FOREIGN KEY (apt_id) REFERENCES Apartments(apt_id)\n);\n\nCREATE TABLE View_Unit_Status (\n apt_id INTEGER,\n apt_booking_id INTEGER,\n status_date DATETIME NOT NULL PRIMARY KEY,\n available_yn BIT,\n UNIQUE (status_date),\n FOREIGN KEY (apt_booking_id) REFERENCES Apartment_Bookings(apt_booking_id),\n FOREIGN KEY (apt_id) REFERENCES Apartments(apt_id)\n);",
"role": "user"
},
{
"content": "SELECT avg(room_count) FROM Apartments WHERE apt_type_code = \"Studio\"",
"role": "assistant"
}
] |
apartment_rentals | [
{
"content": "Translate the following question to SQL: Find the average room count of the apartments that have the \"Studio\" type code.\n\nSchema: CREATE TABLE Apartment_Buildings (\n building_id INTEGER NOT NULL PRIMARY KEY,\n building_short_name CHAR(15),\n building_full_name VARCHAR(80),\n building_description VARCHAR(255),\n building_address VARCHAR(255),\n building_manager VARCHAR(50),\n building_phone VARCHAR(80),\n UNIQUE (building_id)\n);\n\nCREATE TABLE Apartments (\n apt_id INTEGER NOT NULL PRIMARY KEY,\n building_id INTEGER NOT NULL,\n apt_type_code CHAR(15),\n apt_number CHAR(10),\n bathroom_count INTEGER,\n bedroom_count INTEGER,\n room_count CHAR(5),\n UNIQUE (apt_id),\n FOREIGN KEY (building_id) REFERENCES Apartment_Buildings(building_id)\n);\n\nCREATE TABLE Apartment_Facilities (\n apt_id INTEGER NOT NULL PRIMARY KEY,\n facility_code CHAR(15) NOT NULL PRIMARY KEY,\n PRIMARY KEY (apt_id, facility_code),\n UNIQUE (apt_id, facility_code),\n FOREIGN KEY (apt_id) REFERENCES Apartments(apt_id)\n);\n\nCREATE TABLE Guests (\n guest_id INTEGER NOT NULL PRIMARY KEY,\n gender_code CHAR(1),\n guest_first_name VARCHAR(80),\n guest_last_name VARCHAR(80),\n date_of_birth DATETIME,\n UNIQUE (guest_id)\n);\n\nCREATE TABLE Apartment_Bookings (\n apt_booking_id INTEGER NOT NULL PRIMARY KEY,\n apt_id INTEGER,\n guest_id INTEGER NOT NULL,\n booking_status_code CHAR(15) NOT NULL,\n booking_start_date DATETIME,\n booking_end_date DATETIME,\n UNIQUE (apt_booking_id),\n FOREIGN KEY (guest_id) REFERENCES Guests(guest_id),\n FOREIGN KEY (apt_id) REFERENCES Apartments(apt_id)\n);\n\nCREATE TABLE View_Unit_Status (\n apt_id INTEGER,\n apt_booking_id INTEGER,\n status_date DATETIME NOT NULL PRIMARY KEY,\n available_yn BIT,\n UNIQUE (status_date),\n FOREIGN KEY (apt_booking_id) REFERENCES Apartment_Bookings(apt_booking_id),\n FOREIGN KEY (apt_id) REFERENCES Apartments(apt_id)\n);",
"role": "user"
},
{
"content": "SELECT avg(room_count) FROM Apartments WHERE apt_type_code = \"Studio\"",
"role": "assistant"
}
] |
apartment_rentals | [
{
"content": "Translate the following question to SQL: Return the apartment numbers of the apartments with type code \"Flat\".\n\nSchema: CREATE TABLE Apartment_Buildings (\n building_id INTEGER NOT NULL PRIMARY KEY,\n building_short_name CHAR(15),\n building_full_name VARCHAR(80),\n building_description VARCHAR(255),\n building_address VARCHAR(255),\n building_manager VARCHAR(50),\n building_phone VARCHAR(80),\n UNIQUE (building_id)\n);\n\nCREATE TABLE Apartments (\n apt_id INTEGER NOT NULL PRIMARY KEY,\n building_id INTEGER NOT NULL,\n apt_type_code CHAR(15),\n apt_number CHAR(10),\n bathroom_count INTEGER,\n bedroom_count INTEGER,\n room_count CHAR(5),\n UNIQUE (apt_id),\n FOREIGN KEY (building_id) REFERENCES Apartment_Buildings(building_id)\n);\n\nCREATE TABLE Apartment_Facilities (\n apt_id INTEGER NOT NULL PRIMARY KEY,\n facility_code CHAR(15) NOT NULL PRIMARY KEY,\n PRIMARY KEY (apt_id, facility_code),\n UNIQUE (apt_id, facility_code),\n FOREIGN KEY (apt_id) REFERENCES Apartments(apt_id)\n);\n\nCREATE TABLE Guests (\n guest_id INTEGER NOT NULL PRIMARY KEY,\n gender_code CHAR(1),\n guest_first_name VARCHAR(80),\n guest_last_name VARCHAR(80),\n date_of_birth DATETIME,\n UNIQUE (guest_id)\n);\n\nCREATE TABLE Apartment_Bookings (\n apt_booking_id INTEGER NOT NULL PRIMARY KEY,\n apt_id INTEGER,\n guest_id INTEGER NOT NULL,\n booking_status_code CHAR(15) NOT NULL,\n booking_start_date DATETIME,\n booking_end_date DATETIME,\n UNIQUE (apt_booking_id),\n FOREIGN KEY (guest_id) REFERENCES Guests(guest_id),\n FOREIGN KEY (apt_id) REFERENCES Apartments(apt_id)\n);\n\nCREATE TABLE View_Unit_Status (\n apt_id INTEGER,\n apt_booking_id INTEGER,\n status_date DATETIME NOT NULL PRIMARY KEY,\n available_yn BIT,\n UNIQUE (status_date),\n FOREIGN KEY (apt_booking_id) REFERENCES Apartment_Bookings(apt_booking_id),\n FOREIGN KEY (apt_id) REFERENCES Apartments(apt_id)\n);",
"role": "user"
},
{
"content": "SELECT apt_number FROM Apartments WHERE apt_type_code = \"Flat\"",
"role": "assistant"
}
] |
apartment_rentals | [
{
"content": "Translate the following question to SQL: Which apartments have type code \"Flat\"? Give me their apartment numbers.\n\nSchema: CREATE TABLE Apartment_Buildings (\n building_id INTEGER NOT NULL PRIMARY KEY,\n building_short_name CHAR(15),\n building_full_name VARCHAR(80),\n building_description VARCHAR(255),\n building_address VARCHAR(255),\n building_manager VARCHAR(50),\n building_phone VARCHAR(80),\n UNIQUE (building_id)\n);\n\nCREATE TABLE Apartments (\n apt_id INTEGER NOT NULL PRIMARY KEY,\n building_id INTEGER NOT NULL,\n apt_type_code CHAR(15),\n apt_number CHAR(10),\n bathroom_count INTEGER,\n bedroom_count INTEGER,\n room_count CHAR(5),\n UNIQUE (apt_id),\n FOREIGN KEY (building_id) REFERENCES Apartment_Buildings(building_id)\n);\n\nCREATE TABLE Apartment_Facilities (\n apt_id INTEGER NOT NULL PRIMARY KEY,\n facility_code CHAR(15) NOT NULL PRIMARY KEY,\n PRIMARY KEY (apt_id, facility_code),\n UNIQUE (apt_id, facility_code),\n FOREIGN KEY (apt_id) REFERENCES Apartments(apt_id)\n);\n\nCREATE TABLE Guests (\n guest_id INTEGER NOT NULL PRIMARY KEY,\n gender_code CHAR(1),\n guest_first_name VARCHAR(80),\n guest_last_name VARCHAR(80),\n date_of_birth DATETIME,\n UNIQUE (guest_id)\n);\n\nCREATE TABLE Apartment_Bookings (\n apt_booking_id INTEGER NOT NULL PRIMARY KEY,\n apt_id INTEGER,\n guest_id INTEGER NOT NULL,\n booking_status_code CHAR(15) NOT NULL,\n booking_start_date DATETIME,\n booking_end_date DATETIME,\n UNIQUE (apt_booking_id),\n FOREIGN KEY (guest_id) REFERENCES Guests(guest_id),\n FOREIGN KEY (apt_id) REFERENCES Apartments(apt_id)\n);\n\nCREATE TABLE View_Unit_Status (\n apt_id INTEGER,\n apt_booking_id INTEGER,\n status_date DATETIME NOT NULL PRIMARY KEY,\n available_yn BIT,\n UNIQUE (status_date),\n FOREIGN KEY (apt_booking_id) REFERENCES Apartment_Bookings(apt_booking_id),\n FOREIGN KEY (apt_id) REFERENCES Apartments(apt_id)\n);",
"role": "user"
},
{
"content": "SELECT apt_number FROM Apartments WHERE apt_type_code = \"Flat\"",
"role": "assistant"
}
] |
apartment_rentals | [
{
"content": "Translate the following question to SQL: Return the first names and last names of all guests\n\nSchema: CREATE TABLE Apartment_Buildings (\n building_id INTEGER NOT NULL PRIMARY KEY,\n building_short_name CHAR(15),\n building_full_name VARCHAR(80),\n building_description VARCHAR(255),\n building_address VARCHAR(255),\n building_manager VARCHAR(50),\n building_phone VARCHAR(80),\n UNIQUE (building_id)\n);\n\nCREATE TABLE Apartments (\n apt_id INTEGER NOT NULL PRIMARY KEY,\n building_id INTEGER NOT NULL,\n apt_type_code CHAR(15),\n apt_number CHAR(10),\n bathroom_count INTEGER,\n bedroom_count INTEGER,\n room_count CHAR(5),\n UNIQUE (apt_id),\n FOREIGN KEY (building_id) REFERENCES Apartment_Buildings(building_id)\n);\n\nCREATE TABLE Apartment_Facilities (\n apt_id INTEGER NOT NULL PRIMARY KEY,\n facility_code CHAR(15) NOT NULL PRIMARY KEY,\n PRIMARY KEY (apt_id, facility_code),\n UNIQUE (apt_id, facility_code),\n FOREIGN KEY (apt_id) REFERENCES Apartments(apt_id)\n);\n\nCREATE TABLE Guests (\n guest_id INTEGER NOT NULL PRIMARY KEY,\n gender_code CHAR(1),\n guest_first_name VARCHAR(80),\n guest_last_name VARCHAR(80),\n date_of_birth DATETIME,\n UNIQUE (guest_id)\n);\n\nCREATE TABLE Apartment_Bookings (\n apt_booking_id INTEGER NOT NULL PRIMARY KEY,\n apt_id INTEGER,\n guest_id INTEGER NOT NULL,\n booking_status_code CHAR(15) NOT NULL,\n booking_start_date DATETIME,\n booking_end_date DATETIME,\n UNIQUE (apt_booking_id),\n FOREIGN KEY (guest_id) REFERENCES Guests(guest_id),\n FOREIGN KEY (apt_id) REFERENCES Apartments(apt_id)\n);\n\nCREATE TABLE View_Unit_Status (\n apt_id INTEGER,\n apt_booking_id INTEGER,\n status_date DATETIME NOT NULL PRIMARY KEY,\n available_yn BIT,\n UNIQUE (status_date),\n FOREIGN KEY (apt_booking_id) REFERENCES Apartment_Bookings(apt_booking_id),\n FOREIGN KEY (apt_id) REFERENCES Apartments(apt_id)\n);",
"role": "user"
},
{
"content": "SELECT guest_first_name , guest_last_name FROM Guests",
"role": "assistant"
}
] |
apartment_rentals | [
{
"content": "Translate the following question to SQL: What are the first names and last names of all the guests?\n\nSchema: CREATE TABLE Apartment_Buildings (\n building_id INTEGER NOT NULL PRIMARY KEY,\n building_short_name CHAR(15),\n building_full_name VARCHAR(80),\n building_description VARCHAR(255),\n building_address VARCHAR(255),\n building_manager VARCHAR(50),\n building_phone VARCHAR(80),\n UNIQUE (building_id)\n);\n\nCREATE TABLE Apartments (\n apt_id INTEGER NOT NULL PRIMARY KEY,\n building_id INTEGER NOT NULL,\n apt_type_code CHAR(15),\n apt_number CHAR(10),\n bathroom_count INTEGER,\n bedroom_count INTEGER,\n room_count CHAR(5),\n UNIQUE (apt_id),\n FOREIGN KEY (building_id) REFERENCES Apartment_Buildings(building_id)\n);\n\nCREATE TABLE Apartment_Facilities (\n apt_id INTEGER NOT NULL PRIMARY KEY,\n facility_code CHAR(15) NOT NULL PRIMARY KEY,\n PRIMARY KEY (apt_id, facility_code),\n UNIQUE (apt_id, facility_code),\n FOREIGN KEY (apt_id) REFERENCES Apartments(apt_id)\n);\n\nCREATE TABLE Guests (\n guest_id INTEGER NOT NULL PRIMARY KEY,\n gender_code CHAR(1),\n guest_first_name VARCHAR(80),\n guest_last_name VARCHAR(80),\n date_of_birth DATETIME,\n UNIQUE (guest_id)\n);\n\nCREATE TABLE Apartment_Bookings (\n apt_booking_id INTEGER NOT NULL PRIMARY KEY,\n apt_id INTEGER,\n guest_id INTEGER NOT NULL,\n booking_status_code CHAR(15) NOT NULL,\n booking_start_date DATETIME,\n booking_end_date DATETIME,\n UNIQUE (apt_booking_id),\n FOREIGN KEY (guest_id) REFERENCES Guests(guest_id),\n FOREIGN KEY (apt_id) REFERENCES Apartments(apt_id)\n);\n\nCREATE TABLE View_Unit_Status (\n apt_id INTEGER,\n apt_booking_id INTEGER,\n status_date DATETIME NOT NULL PRIMARY KEY,\n available_yn BIT,\n UNIQUE (status_date),\n FOREIGN KEY (apt_booking_id) REFERENCES Apartment_Bookings(apt_booking_id),\n FOREIGN KEY (apt_id) REFERENCES Apartments(apt_id)\n);",
"role": "user"
},
{
"content": "SELECT guest_first_name , guest_last_name FROM Guests",
"role": "assistant"
}
] |
apartment_rentals | [
{
"content": "Translate the following question to SQL: Return the date of birth for all the guests with gender code \"Male\".\n\nSchema: CREATE TABLE Apartment_Buildings (\n building_id INTEGER NOT NULL PRIMARY KEY,\n building_short_name CHAR(15),\n building_full_name VARCHAR(80),\n building_description VARCHAR(255),\n building_address VARCHAR(255),\n building_manager VARCHAR(50),\n building_phone VARCHAR(80),\n UNIQUE (building_id)\n);\n\nCREATE TABLE Apartments (\n apt_id INTEGER NOT NULL PRIMARY KEY,\n building_id INTEGER NOT NULL,\n apt_type_code CHAR(15),\n apt_number CHAR(10),\n bathroom_count INTEGER,\n bedroom_count INTEGER,\n room_count CHAR(5),\n UNIQUE (apt_id),\n FOREIGN KEY (building_id) REFERENCES Apartment_Buildings(building_id)\n);\n\nCREATE TABLE Apartment_Facilities (\n apt_id INTEGER NOT NULL PRIMARY KEY,\n facility_code CHAR(15) NOT NULL PRIMARY KEY,\n PRIMARY KEY (apt_id, facility_code),\n UNIQUE (apt_id, facility_code),\n FOREIGN KEY (apt_id) REFERENCES Apartments(apt_id)\n);\n\nCREATE TABLE Guests (\n guest_id INTEGER NOT NULL PRIMARY KEY,\n gender_code CHAR(1),\n guest_first_name VARCHAR(80),\n guest_last_name VARCHAR(80),\n date_of_birth DATETIME,\n UNIQUE (guest_id)\n);\n\nCREATE TABLE Apartment_Bookings (\n apt_booking_id INTEGER NOT NULL PRIMARY KEY,\n apt_id INTEGER,\n guest_id INTEGER NOT NULL,\n booking_status_code CHAR(15) NOT NULL,\n booking_start_date DATETIME,\n booking_end_date DATETIME,\n UNIQUE (apt_booking_id),\n FOREIGN KEY (guest_id) REFERENCES Guests(guest_id),\n FOREIGN KEY (apt_id) REFERENCES Apartments(apt_id)\n);\n\nCREATE TABLE View_Unit_Status (\n apt_id INTEGER,\n apt_booking_id INTEGER,\n status_date DATETIME NOT NULL PRIMARY KEY,\n available_yn BIT,\n UNIQUE (status_date),\n FOREIGN KEY (apt_booking_id) REFERENCES Apartment_Bookings(apt_booking_id),\n FOREIGN KEY (apt_id) REFERENCES Apartments(apt_id)\n);",
"role": "user"
},
{
"content": "SELECT date_of_birth FROM Guests WHERE gender_code = \"Male\"",
"role": "assistant"
}
] |
apartment_rentals | [
{
"content": "Translate the following question to SQL: What are dates of birth of all the guests whose gender is \"Male\"?\n\nSchema: CREATE TABLE Apartment_Buildings (\n building_id INTEGER NOT NULL PRIMARY KEY,\n building_short_name CHAR(15),\n building_full_name VARCHAR(80),\n building_description VARCHAR(255),\n building_address VARCHAR(255),\n building_manager VARCHAR(50),\n building_phone VARCHAR(80),\n UNIQUE (building_id)\n);\n\nCREATE TABLE Apartments (\n apt_id INTEGER NOT NULL PRIMARY KEY,\n building_id INTEGER NOT NULL,\n apt_type_code CHAR(15),\n apt_number CHAR(10),\n bathroom_count INTEGER,\n bedroom_count INTEGER,\n room_count CHAR(5),\n UNIQUE (apt_id),\n FOREIGN KEY (building_id) REFERENCES Apartment_Buildings(building_id)\n);\n\nCREATE TABLE Apartment_Facilities (\n apt_id INTEGER NOT NULL PRIMARY KEY,\n facility_code CHAR(15) NOT NULL PRIMARY KEY,\n PRIMARY KEY (apt_id, facility_code),\n UNIQUE (apt_id, facility_code),\n FOREIGN KEY (apt_id) REFERENCES Apartments(apt_id)\n);\n\nCREATE TABLE Guests (\n guest_id INTEGER NOT NULL PRIMARY KEY,\n gender_code CHAR(1),\n guest_first_name VARCHAR(80),\n guest_last_name VARCHAR(80),\n date_of_birth DATETIME,\n UNIQUE (guest_id)\n);\n\nCREATE TABLE Apartment_Bookings (\n apt_booking_id INTEGER NOT NULL PRIMARY KEY,\n apt_id INTEGER,\n guest_id INTEGER NOT NULL,\n booking_status_code CHAR(15) NOT NULL,\n booking_start_date DATETIME,\n booking_end_date DATETIME,\n UNIQUE (apt_booking_id),\n FOREIGN KEY (guest_id) REFERENCES Guests(guest_id),\n FOREIGN KEY (apt_id) REFERENCES Apartments(apt_id)\n);\n\nCREATE TABLE View_Unit_Status (\n apt_id INTEGER,\n apt_booking_id INTEGER,\n status_date DATETIME NOT NULL PRIMARY KEY,\n available_yn BIT,\n UNIQUE (status_date),\n FOREIGN KEY (apt_booking_id) REFERENCES Apartment_Bookings(apt_booking_id),\n FOREIGN KEY (apt_id) REFERENCES Apartments(apt_id)\n);",
"role": "user"
},
{
"content": "SELECT date_of_birth FROM Guests WHERE gender_code = \"Male\"",
"role": "assistant"
}
] |
apartment_rentals | [
{
"content": "Translate the following question to SQL: Show the apartment numbers, start dates, and end dates of all the apartment bookings.\n\nSchema: CREATE TABLE Apartment_Buildings (\n building_id INTEGER NOT NULL PRIMARY KEY,\n building_short_name CHAR(15),\n building_full_name VARCHAR(80),\n building_description VARCHAR(255),\n building_address VARCHAR(255),\n building_manager VARCHAR(50),\n building_phone VARCHAR(80),\n UNIQUE (building_id)\n);\n\nCREATE TABLE Apartments (\n apt_id INTEGER NOT NULL PRIMARY KEY,\n building_id INTEGER NOT NULL,\n apt_type_code CHAR(15),\n apt_number CHAR(10),\n bathroom_count INTEGER,\n bedroom_count INTEGER,\n room_count CHAR(5),\n UNIQUE (apt_id),\n FOREIGN KEY (building_id) REFERENCES Apartment_Buildings(building_id)\n);\n\nCREATE TABLE Apartment_Facilities (\n apt_id INTEGER NOT NULL PRIMARY KEY,\n facility_code CHAR(15) NOT NULL PRIMARY KEY,\n PRIMARY KEY (apt_id, facility_code),\n UNIQUE (apt_id, facility_code),\n FOREIGN KEY (apt_id) REFERENCES Apartments(apt_id)\n);\n\nCREATE TABLE Guests (\n guest_id INTEGER NOT NULL PRIMARY KEY,\n gender_code CHAR(1),\n guest_first_name VARCHAR(80),\n guest_last_name VARCHAR(80),\n date_of_birth DATETIME,\n UNIQUE (guest_id)\n);\n\nCREATE TABLE Apartment_Bookings (\n apt_booking_id INTEGER NOT NULL PRIMARY KEY,\n apt_id INTEGER,\n guest_id INTEGER NOT NULL,\n booking_status_code CHAR(15) NOT NULL,\n booking_start_date DATETIME,\n booking_end_date DATETIME,\n UNIQUE (apt_booking_id),\n FOREIGN KEY (guest_id) REFERENCES Guests(guest_id),\n FOREIGN KEY (apt_id) REFERENCES Apartments(apt_id)\n);\n\nCREATE TABLE View_Unit_Status (\n apt_id INTEGER,\n apt_booking_id INTEGER,\n status_date DATETIME NOT NULL PRIMARY KEY,\n available_yn BIT,\n UNIQUE (status_date),\n FOREIGN KEY (apt_booking_id) REFERENCES Apartment_Bookings(apt_booking_id),\n FOREIGN KEY (apt_id) REFERENCES Apartments(apt_id)\n);",
"role": "user"
},
{
"content": "SELECT T2.apt_number , T1.booking_start_date , T1.booking_start_date FROM Apartment_Bookings AS T1 JOIN Apartments AS T2 ON T1.apt_id = T2.apt_id",
"role": "assistant"
}
] |
apartment_rentals | [
{
"content": "Translate the following question to SQL: What are the apartment number, start date, and end date of each apartment booking?\n\nSchema: CREATE TABLE Apartment_Buildings (\n building_id INTEGER NOT NULL PRIMARY KEY,\n building_short_name CHAR(15),\n building_full_name VARCHAR(80),\n building_description VARCHAR(255),\n building_address VARCHAR(255),\n building_manager VARCHAR(50),\n building_phone VARCHAR(80),\n UNIQUE (building_id)\n);\n\nCREATE TABLE Apartments (\n apt_id INTEGER NOT NULL PRIMARY KEY,\n building_id INTEGER NOT NULL,\n apt_type_code CHAR(15),\n apt_number CHAR(10),\n bathroom_count INTEGER,\n bedroom_count INTEGER,\n room_count CHAR(5),\n UNIQUE (apt_id),\n FOREIGN KEY (building_id) REFERENCES Apartment_Buildings(building_id)\n);\n\nCREATE TABLE Apartment_Facilities (\n apt_id INTEGER NOT NULL PRIMARY KEY,\n facility_code CHAR(15) NOT NULL PRIMARY KEY,\n PRIMARY KEY (apt_id, facility_code),\n UNIQUE (apt_id, facility_code),\n FOREIGN KEY (apt_id) REFERENCES Apartments(apt_id)\n);\n\nCREATE TABLE Guests (\n guest_id INTEGER NOT NULL PRIMARY KEY,\n gender_code CHAR(1),\n guest_first_name VARCHAR(80),\n guest_last_name VARCHAR(80),\n date_of_birth DATETIME,\n UNIQUE (guest_id)\n);\n\nCREATE TABLE Apartment_Bookings (\n apt_booking_id INTEGER NOT NULL PRIMARY KEY,\n apt_id INTEGER,\n guest_id INTEGER NOT NULL,\n booking_status_code CHAR(15) NOT NULL,\n booking_start_date DATETIME,\n booking_end_date DATETIME,\n UNIQUE (apt_booking_id),\n FOREIGN KEY (guest_id) REFERENCES Guests(guest_id),\n FOREIGN KEY (apt_id) REFERENCES Apartments(apt_id)\n);\n\nCREATE TABLE View_Unit_Status (\n apt_id INTEGER,\n apt_booking_id INTEGER,\n status_date DATETIME NOT NULL PRIMARY KEY,\n available_yn BIT,\n UNIQUE (status_date),\n FOREIGN KEY (apt_booking_id) REFERENCES Apartment_Bookings(apt_booking_id),\n FOREIGN KEY (apt_id) REFERENCES Apartments(apt_id)\n);",
"role": "user"
},
{
"content": "SELECT T2.apt_number , T1.booking_start_date , T1.booking_start_date FROM Apartment_Bookings AS T1 JOIN Apartments AS T2 ON T1.apt_id = T2.apt_id",
"role": "assistant"
}
] |
apartment_rentals | [
{
"content": "Translate the following question to SQL: What are the booking start and end dates of the apartments with type code \"Duplex\"?\n\nSchema: CREATE TABLE Apartment_Buildings (\n building_id INTEGER NOT NULL PRIMARY KEY,\n building_short_name CHAR(15),\n building_full_name VARCHAR(80),\n building_description VARCHAR(255),\n building_address VARCHAR(255),\n building_manager VARCHAR(50),\n building_phone VARCHAR(80),\n UNIQUE (building_id)\n);\n\nCREATE TABLE Apartments (\n apt_id INTEGER NOT NULL PRIMARY KEY,\n building_id INTEGER NOT NULL,\n apt_type_code CHAR(15),\n apt_number CHAR(10),\n bathroom_count INTEGER,\n bedroom_count INTEGER,\n room_count CHAR(5),\n UNIQUE (apt_id),\n FOREIGN KEY (building_id) REFERENCES Apartment_Buildings(building_id)\n);\n\nCREATE TABLE Apartment_Facilities (\n apt_id INTEGER NOT NULL PRIMARY KEY,\n facility_code CHAR(15) NOT NULL PRIMARY KEY,\n PRIMARY KEY (apt_id, facility_code),\n UNIQUE (apt_id, facility_code),\n FOREIGN KEY (apt_id) REFERENCES Apartments(apt_id)\n);\n\nCREATE TABLE Guests (\n guest_id INTEGER NOT NULL PRIMARY KEY,\n gender_code CHAR(1),\n guest_first_name VARCHAR(80),\n guest_last_name VARCHAR(80),\n date_of_birth DATETIME,\n UNIQUE (guest_id)\n);\n\nCREATE TABLE Apartment_Bookings (\n apt_booking_id INTEGER NOT NULL PRIMARY KEY,\n apt_id INTEGER,\n guest_id INTEGER NOT NULL,\n booking_status_code CHAR(15) NOT NULL,\n booking_start_date DATETIME,\n booking_end_date DATETIME,\n UNIQUE (apt_booking_id),\n FOREIGN KEY (guest_id) REFERENCES Guests(guest_id),\n FOREIGN KEY (apt_id) REFERENCES Apartments(apt_id)\n);\n\nCREATE TABLE View_Unit_Status (\n apt_id INTEGER,\n apt_booking_id INTEGER,\n status_date DATETIME NOT NULL PRIMARY KEY,\n available_yn BIT,\n UNIQUE (status_date),\n FOREIGN KEY (apt_booking_id) REFERENCES Apartment_Bookings(apt_booking_id),\n FOREIGN KEY (apt_id) REFERENCES Apartments(apt_id)\n);",
"role": "user"
},
{
"content": "SELECT T1.booking_start_date , T1.booking_start_date FROM Apartment_Bookings AS T1 JOIN Apartments AS T2 ON T1.apt_id = T2.apt_id WHERE T2.apt_type_code = \"Duplex\"",
"role": "assistant"
}
] |
apartment_rentals | [
{
"content": "Translate the following question to SQL: Return the booking start date and end date for the apartments that have type code \"Duplex\".\n\nSchema: CREATE TABLE Apartment_Buildings (\n building_id INTEGER NOT NULL PRIMARY KEY,\n building_short_name CHAR(15),\n building_full_name VARCHAR(80),\n building_description VARCHAR(255),\n building_address VARCHAR(255),\n building_manager VARCHAR(50),\n building_phone VARCHAR(80),\n UNIQUE (building_id)\n);\n\nCREATE TABLE Apartments (\n apt_id INTEGER NOT NULL PRIMARY KEY,\n building_id INTEGER NOT NULL,\n apt_type_code CHAR(15),\n apt_number CHAR(10),\n bathroom_count INTEGER,\n bedroom_count INTEGER,\n room_count CHAR(5),\n UNIQUE (apt_id),\n FOREIGN KEY (building_id) REFERENCES Apartment_Buildings(building_id)\n);\n\nCREATE TABLE Apartment_Facilities (\n apt_id INTEGER NOT NULL PRIMARY KEY,\n facility_code CHAR(15) NOT NULL PRIMARY KEY,\n PRIMARY KEY (apt_id, facility_code),\n UNIQUE (apt_id, facility_code),\n FOREIGN KEY (apt_id) REFERENCES Apartments(apt_id)\n);\n\nCREATE TABLE Guests (\n guest_id INTEGER NOT NULL PRIMARY KEY,\n gender_code CHAR(1),\n guest_first_name VARCHAR(80),\n guest_last_name VARCHAR(80),\n date_of_birth DATETIME,\n UNIQUE (guest_id)\n);\n\nCREATE TABLE Apartment_Bookings (\n apt_booking_id INTEGER NOT NULL PRIMARY KEY,\n apt_id INTEGER,\n guest_id INTEGER NOT NULL,\n booking_status_code CHAR(15) NOT NULL,\n booking_start_date DATETIME,\n booking_end_date DATETIME,\n UNIQUE (apt_booking_id),\n FOREIGN KEY (guest_id) REFERENCES Guests(guest_id),\n FOREIGN KEY (apt_id) REFERENCES Apartments(apt_id)\n);\n\nCREATE TABLE View_Unit_Status (\n apt_id INTEGER,\n apt_booking_id INTEGER,\n status_date DATETIME NOT NULL PRIMARY KEY,\n available_yn BIT,\n UNIQUE (status_date),\n FOREIGN KEY (apt_booking_id) REFERENCES Apartment_Bookings(apt_booking_id),\n FOREIGN KEY (apt_id) REFERENCES Apartments(apt_id)\n);",
"role": "user"
},
{
"content": "SELECT T1.booking_start_date , T1.booking_start_date FROM Apartment_Bookings AS T1 JOIN Apartments AS T2 ON T1.apt_id = T2.apt_id WHERE T2.apt_type_code = \"Duplex\"",
"role": "assistant"
}
] |
apartment_rentals | [
{
"content": "Translate the following question to SQL: What are the booking start and end dates of the apartments with more than 2 bedrooms?\n\nSchema: CREATE TABLE Apartment_Buildings (\n building_id INTEGER NOT NULL PRIMARY KEY,\n building_short_name CHAR(15),\n building_full_name VARCHAR(80),\n building_description VARCHAR(255),\n building_address VARCHAR(255),\n building_manager VARCHAR(50),\n building_phone VARCHAR(80),\n UNIQUE (building_id)\n);\n\nCREATE TABLE Apartments (\n apt_id INTEGER NOT NULL PRIMARY KEY,\n building_id INTEGER NOT NULL,\n apt_type_code CHAR(15),\n apt_number CHAR(10),\n bathroom_count INTEGER,\n bedroom_count INTEGER,\n room_count CHAR(5),\n UNIQUE (apt_id),\n FOREIGN KEY (building_id) REFERENCES Apartment_Buildings(building_id)\n);\n\nCREATE TABLE Apartment_Facilities (\n apt_id INTEGER NOT NULL PRIMARY KEY,\n facility_code CHAR(15) NOT NULL PRIMARY KEY,\n PRIMARY KEY (apt_id, facility_code),\n UNIQUE (apt_id, facility_code),\n FOREIGN KEY (apt_id) REFERENCES Apartments(apt_id)\n);\n\nCREATE TABLE Guests (\n guest_id INTEGER NOT NULL PRIMARY KEY,\n gender_code CHAR(1),\n guest_first_name VARCHAR(80),\n guest_last_name VARCHAR(80),\n date_of_birth DATETIME,\n UNIQUE (guest_id)\n);\n\nCREATE TABLE Apartment_Bookings (\n apt_booking_id INTEGER NOT NULL PRIMARY KEY,\n apt_id INTEGER,\n guest_id INTEGER NOT NULL,\n booking_status_code CHAR(15) NOT NULL,\n booking_start_date DATETIME,\n booking_end_date DATETIME,\n UNIQUE (apt_booking_id),\n FOREIGN KEY (guest_id) REFERENCES Guests(guest_id),\n FOREIGN KEY (apt_id) REFERENCES Apartments(apt_id)\n);\n\nCREATE TABLE View_Unit_Status (\n apt_id INTEGER,\n apt_booking_id INTEGER,\n status_date DATETIME NOT NULL PRIMARY KEY,\n available_yn BIT,\n UNIQUE (status_date),\n FOREIGN KEY (apt_booking_id) REFERENCES Apartment_Bookings(apt_booking_id),\n FOREIGN KEY (apt_id) REFERENCES Apartments(apt_id)\n);",
"role": "user"
},
{
"content": "SELECT T1.booking_start_date , T1.booking_start_date FROM Apartment_Bookings AS T1 JOIN Apartments AS T2 ON T1.apt_id = T2.apt_id WHERE T2.bedroom_count > 2",
"role": "assistant"
}
] |
apartment_rentals | [
{
"content": "Translate the following question to SQL: Find the booking start date and end date for the apartments that have more than two bedrooms.\n\nSchema: CREATE TABLE Apartment_Buildings (\n building_id INTEGER NOT NULL PRIMARY KEY,\n building_short_name CHAR(15),\n building_full_name VARCHAR(80),\n building_description VARCHAR(255),\n building_address VARCHAR(255),\n building_manager VARCHAR(50),\n building_phone VARCHAR(80),\n UNIQUE (building_id)\n);\n\nCREATE TABLE Apartments (\n apt_id INTEGER NOT NULL PRIMARY KEY,\n building_id INTEGER NOT NULL,\n apt_type_code CHAR(15),\n apt_number CHAR(10),\n bathroom_count INTEGER,\n bedroom_count INTEGER,\n room_count CHAR(5),\n UNIQUE (apt_id),\n FOREIGN KEY (building_id) REFERENCES Apartment_Buildings(building_id)\n);\n\nCREATE TABLE Apartment_Facilities (\n apt_id INTEGER NOT NULL PRIMARY KEY,\n facility_code CHAR(15) NOT NULL PRIMARY KEY,\n PRIMARY KEY (apt_id, facility_code),\n UNIQUE (apt_id, facility_code),\n FOREIGN KEY (apt_id) REFERENCES Apartments(apt_id)\n);\n\nCREATE TABLE Guests (\n guest_id INTEGER NOT NULL PRIMARY KEY,\n gender_code CHAR(1),\n guest_first_name VARCHAR(80),\n guest_last_name VARCHAR(80),\n date_of_birth DATETIME,\n UNIQUE (guest_id)\n);\n\nCREATE TABLE Apartment_Bookings (\n apt_booking_id INTEGER NOT NULL PRIMARY KEY,\n apt_id INTEGER,\n guest_id INTEGER NOT NULL,\n booking_status_code CHAR(15) NOT NULL,\n booking_start_date DATETIME,\n booking_end_date DATETIME,\n UNIQUE (apt_booking_id),\n FOREIGN KEY (guest_id) REFERENCES Guests(guest_id),\n FOREIGN KEY (apt_id) REFERENCES Apartments(apt_id)\n);\n\nCREATE TABLE View_Unit_Status (\n apt_id INTEGER,\n apt_booking_id INTEGER,\n status_date DATETIME NOT NULL PRIMARY KEY,\n available_yn BIT,\n UNIQUE (status_date),\n FOREIGN KEY (apt_booking_id) REFERENCES Apartment_Bookings(apt_booking_id),\n FOREIGN KEY (apt_id) REFERENCES Apartments(apt_id)\n);",
"role": "user"
},
{
"content": "SELECT T1.booking_start_date , T1.booking_start_date FROM Apartment_Bookings AS T1 JOIN Apartments AS T2 ON T1.apt_id = T2.apt_id WHERE T2.bedroom_count > 2",
"role": "assistant"
}
] |
apartment_rentals | [
{
"content": "Translate the following question to SQL: What is the booking status code of the apartment with apartment number \"Suite 634\"?\n\nSchema: CREATE TABLE Apartment_Buildings (\n building_id INTEGER NOT NULL PRIMARY KEY,\n building_short_name CHAR(15),\n building_full_name VARCHAR(80),\n building_description VARCHAR(255),\n building_address VARCHAR(255),\n building_manager VARCHAR(50),\n building_phone VARCHAR(80),\n UNIQUE (building_id)\n);\n\nCREATE TABLE Apartments (\n apt_id INTEGER NOT NULL PRIMARY KEY,\n building_id INTEGER NOT NULL,\n apt_type_code CHAR(15),\n apt_number CHAR(10),\n bathroom_count INTEGER,\n bedroom_count INTEGER,\n room_count CHAR(5),\n UNIQUE (apt_id),\n FOREIGN KEY (building_id) REFERENCES Apartment_Buildings(building_id)\n);\n\nCREATE TABLE Apartment_Facilities (\n apt_id INTEGER NOT NULL PRIMARY KEY,\n facility_code CHAR(15) NOT NULL PRIMARY KEY,\n PRIMARY KEY (apt_id, facility_code),\n UNIQUE (apt_id, facility_code),\n FOREIGN KEY (apt_id) REFERENCES Apartments(apt_id)\n);\n\nCREATE TABLE Guests (\n guest_id INTEGER NOT NULL PRIMARY KEY,\n gender_code CHAR(1),\n guest_first_name VARCHAR(80),\n guest_last_name VARCHAR(80),\n date_of_birth DATETIME,\n UNIQUE (guest_id)\n);\n\nCREATE TABLE Apartment_Bookings (\n apt_booking_id INTEGER NOT NULL PRIMARY KEY,\n apt_id INTEGER,\n guest_id INTEGER NOT NULL,\n booking_status_code CHAR(15) NOT NULL,\n booking_start_date DATETIME,\n booking_end_date DATETIME,\n UNIQUE (apt_booking_id),\n FOREIGN KEY (guest_id) REFERENCES Guests(guest_id),\n FOREIGN KEY (apt_id) REFERENCES Apartments(apt_id)\n);\n\nCREATE TABLE View_Unit_Status (\n apt_id INTEGER,\n apt_booking_id INTEGER,\n status_date DATETIME NOT NULL PRIMARY KEY,\n available_yn BIT,\n UNIQUE (status_date),\n FOREIGN KEY (apt_booking_id) REFERENCES Apartment_Bookings(apt_booking_id),\n FOREIGN KEY (apt_id) REFERENCES Apartments(apt_id)\n);",
"role": "user"
},
{
"content": "SELECT T1.booking_status_code FROM Apartment_Bookings AS T1 JOIN Apartments AS T2 ON T1.apt_id = T2.apt_id WHERE T2.apt_number = \"Suite 634\"",
"role": "assistant"
}
] |
apartment_rentals | [
{
"content": "Translate the following question to SQL: Tell me the booking status code for the apartment with number \"Suite 634\".\n\nSchema: CREATE TABLE Apartment_Buildings (\n building_id INTEGER NOT NULL PRIMARY KEY,\n building_short_name CHAR(15),\n building_full_name VARCHAR(80),\n building_description VARCHAR(255),\n building_address VARCHAR(255),\n building_manager VARCHAR(50),\n building_phone VARCHAR(80),\n UNIQUE (building_id)\n);\n\nCREATE TABLE Apartments (\n apt_id INTEGER NOT NULL PRIMARY KEY,\n building_id INTEGER NOT NULL,\n apt_type_code CHAR(15),\n apt_number CHAR(10),\n bathroom_count INTEGER,\n bedroom_count INTEGER,\n room_count CHAR(5),\n UNIQUE (apt_id),\n FOREIGN KEY (building_id) REFERENCES Apartment_Buildings(building_id)\n);\n\nCREATE TABLE Apartment_Facilities (\n apt_id INTEGER NOT NULL PRIMARY KEY,\n facility_code CHAR(15) NOT NULL PRIMARY KEY,\n PRIMARY KEY (apt_id, facility_code),\n UNIQUE (apt_id, facility_code),\n FOREIGN KEY (apt_id) REFERENCES Apartments(apt_id)\n);\n\nCREATE TABLE Guests (\n guest_id INTEGER NOT NULL PRIMARY KEY,\n gender_code CHAR(1),\n guest_first_name VARCHAR(80),\n guest_last_name VARCHAR(80),\n date_of_birth DATETIME,\n UNIQUE (guest_id)\n);\n\nCREATE TABLE Apartment_Bookings (\n apt_booking_id INTEGER NOT NULL PRIMARY KEY,\n apt_id INTEGER,\n guest_id INTEGER NOT NULL,\n booking_status_code CHAR(15) NOT NULL,\n booking_start_date DATETIME,\n booking_end_date DATETIME,\n UNIQUE (apt_booking_id),\n FOREIGN KEY (guest_id) REFERENCES Guests(guest_id),\n FOREIGN KEY (apt_id) REFERENCES Apartments(apt_id)\n);\n\nCREATE TABLE View_Unit_Status (\n apt_id INTEGER,\n apt_booking_id INTEGER,\n status_date DATETIME NOT NULL PRIMARY KEY,\n available_yn BIT,\n UNIQUE (status_date),\n FOREIGN KEY (apt_booking_id) REFERENCES Apartment_Bookings(apt_booking_id),\n FOREIGN KEY (apt_id) REFERENCES Apartments(apt_id)\n);",
"role": "user"
},
{
"content": "SELECT T1.booking_status_code FROM Apartment_Bookings AS T1 JOIN Apartments AS T2 ON T1.apt_id = T2.apt_id WHERE T2.apt_number = \"Suite 634\"",
"role": "assistant"
}
] |
apartment_rentals | [
{
"content": "Translate the following question to SQL: Show the distinct apartment numbers of the apartments that have bookings with status code \"Confirmed\".\n\nSchema: CREATE TABLE Apartment_Buildings (\n building_id INTEGER NOT NULL PRIMARY KEY,\n building_short_name CHAR(15),\n building_full_name VARCHAR(80),\n building_description VARCHAR(255),\n building_address VARCHAR(255),\n building_manager VARCHAR(50),\n building_phone VARCHAR(80),\n UNIQUE (building_id)\n);\n\nCREATE TABLE Apartments (\n apt_id INTEGER NOT NULL PRIMARY KEY,\n building_id INTEGER NOT NULL,\n apt_type_code CHAR(15),\n apt_number CHAR(10),\n bathroom_count INTEGER,\n bedroom_count INTEGER,\n room_count CHAR(5),\n UNIQUE (apt_id),\n FOREIGN KEY (building_id) REFERENCES Apartment_Buildings(building_id)\n);\n\nCREATE TABLE Apartment_Facilities (\n apt_id INTEGER NOT NULL PRIMARY KEY,\n facility_code CHAR(15) NOT NULL PRIMARY KEY,\n PRIMARY KEY (apt_id, facility_code),\n UNIQUE (apt_id, facility_code),\n FOREIGN KEY (apt_id) REFERENCES Apartments(apt_id)\n);\n\nCREATE TABLE Guests (\n guest_id INTEGER NOT NULL PRIMARY KEY,\n gender_code CHAR(1),\n guest_first_name VARCHAR(80),\n guest_last_name VARCHAR(80),\n date_of_birth DATETIME,\n UNIQUE (guest_id)\n);\n\nCREATE TABLE Apartment_Bookings (\n apt_booking_id INTEGER NOT NULL PRIMARY KEY,\n apt_id INTEGER,\n guest_id INTEGER NOT NULL,\n booking_status_code CHAR(15) NOT NULL,\n booking_start_date DATETIME,\n booking_end_date DATETIME,\n UNIQUE (apt_booking_id),\n FOREIGN KEY (guest_id) REFERENCES Guests(guest_id),\n FOREIGN KEY (apt_id) REFERENCES Apartments(apt_id)\n);\n\nCREATE TABLE View_Unit_Status (\n apt_id INTEGER,\n apt_booking_id INTEGER,\n status_date DATETIME NOT NULL PRIMARY KEY,\n available_yn BIT,\n UNIQUE (status_date),\n FOREIGN KEY (apt_booking_id) REFERENCES Apartment_Bookings(apt_booking_id),\n FOREIGN KEY (apt_id) REFERENCES Apartments(apt_id)\n);",
"role": "user"
},
{
"content": "SELECT DISTINCT T2.apt_number FROM Apartment_Bookings AS T1 JOIN Apartments AS T2 ON T1.apt_id = T2.apt_id WHERE T1.booking_status_code = \"Confirmed\"",
"role": "assistant"
}
] |
apartment_rentals | [
{
"content": "Translate the following question to SQL: Which apartments have bookings with status code \"Confirmed\"? Return their apartment numbers.\n\nSchema: CREATE TABLE Apartment_Buildings (\n building_id INTEGER NOT NULL PRIMARY KEY,\n building_short_name CHAR(15),\n building_full_name VARCHAR(80),\n building_description VARCHAR(255),\n building_address VARCHAR(255),\n building_manager VARCHAR(50),\n building_phone VARCHAR(80),\n UNIQUE (building_id)\n);\n\nCREATE TABLE Apartments (\n apt_id INTEGER NOT NULL PRIMARY KEY,\n building_id INTEGER NOT NULL,\n apt_type_code CHAR(15),\n apt_number CHAR(10),\n bathroom_count INTEGER,\n bedroom_count INTEGER,\n room_count CHAR(5),\n UNIQUE (apt_id),\n FOREIGN KEY (building_id) REFERENCES Apartment_Buildings(building_id)\n);\n\nCREATE TABLE Apartment_Facilities (\n apt_id INTEGER NOT NULL PRIMARY KEY,\n facility_code CHAR(15) NOT NULL PRIMARY KEY,\n PRIMARY KEY (apt_id, facility_code),\n UNIQUE (apt_id, facility_code),\n FOREIGN KEY (apt_id) REFERENCES Apartments(apt_id)\n);\n\nCREATE TABLE Guests (\n guest_id INTEGER NOT NULL PRIMARY KEY,\n gender_code CHAR(1),\n guest_first_name VARCHAR(80),\n guest_last_name VARCHAR(80),\n date_of_birth DATETIME,\n UNIQUE (guest_id)\n);\n\nCREATE TABLE Apartment_Bookings (\n apt_booking_id INTEGER NOT NULL PRIMARY KEY,\n apt_id INTEGER,\n guest_id INTEGER NOT NULL,\n booking_status_code CHAR(15) NOT NULL,\n booking_start_date DATETIME,\n booking_end_date DATETIME,\n UNIQUE (apt_booking_id),\n FOREIGN KEY (guest_id) REFERENCES Guests(guest_id),\n FOREIGN KEY (apt_id) REFERENCES Apartments(apt_id)\n);\n\nCREATE TABLE View_Unit_Status (\n apt_id INTEGER,\n apt_booking_id INTEGER,\n status_date DATETIME NOT NULL PRIMARY KEY,\n available_yn BIT,\n UNIQUE (status_date),\n FOREIGN KEY (apt_booking_id) REFERENCES Apartment_Bookings(apt_booking_id),\n FOREIGN KEY (apt_id) REFERENCES Apartments(apt_id)\n);",
"role": "user"
},
{
"content": "SELECT DISTINCT T2.apt_number FROM Apartment_Bookings AS T1 JOIN Apartments AS T2 ON T1.apt_id = T2.apt_id WHERE T1.booking_status_code = \"Confirmed\"",
"role": "assistant"
}
] |
apartment_rentals | [
{
"content": "Translate the following question to SQL: Show the average room count of the apartments that have booking status code \"Provisional\".\n\nSchema: CREATE TABLE Apartment_Buildings (\n building_id INTEGER NOT NULL PRIMARY KEY,\n building_short_name CHAR(15),\n building_full_name VARCHAR(80),\n building_description VARCHAR(255),\n building_address VARCHAR(255),\n building_manager VARCHAR(50),\n building_phone VARCHAR(80),\n UNIQUE (building_id)\n);\n\nCREATE TABLE Apartments (\n apt_id INTEGER NOT NULL PRIMARY KEY,\n building_id INTEGER NOT NULL,\n apt_type_code CHAR(15),\n apt_number CHAR(10),\n bathroom_count INTEGER,\n bedroom_count INTEGER,\n room_count CHAR(5),\n UNIQUE (apt_id),\n FOREIGN KEY (building_id) REFERENCES Apartment_Buildings(building_id)\n);\n\nCREATE TABLE Apartment_Facilities (\n apt_id INTEGER NOT NULL PRIMARY KEY,\n facility_code CHAR(15) NOT NULL PRIMARY KEY,\n PRIMARY KEY (apt_id, facility_code),\n UNIQUE (apt_id, facility_code),\n FOREIGN KEY (apt_id) REFERENCES Apartments(apt_id)\n);\n\nCREATE TABLE Guests (\n guest_id INTEGER NOT NULL PRIMARY KEY,\n gender_code CHAR(1),\n guest_first_name VARCHAR(80),\n guest_last_name VARCHAR(80),\n date_of_birth DATETIME,\n UNIQUE (guest_id)\n);\n\nCREATE TABLE Apartment_Bookings (\n apt_booking_id INTEGER NOT NULL PRIMARY KEY,\n apt_id INTEGER,\n guest_id INTEGER NOT NULL,\n booking_status_code CHAR(15) NOT NULL,\n booking_start_date DATETIME,\n booking_end_date DATETIME,\n UNIQUE (apt_booking_id),\n FOREIGN KEY (guest_id) REFERENCES Guests(guest_id),\n FOREIGN KEY (apt_id) REFERENCES Apartments(apt_id)\n);\n\nCREATE TABLE View_Unit_Status (\n apt_id INTEGER,\n apt_booking_id INTEGER,\n status_date DATETIME NOT NULL PRIMARY KEY,\n available_yn BIT,\n UNIQUE (status_date),\n FOREIGN KEY (apt_booking_id) REFERENCES Apartment_Bookings(apt_booking_id),\n FOREIGN KEY (apt_id) REFERENCES Apartments(apt_id)\n);",
"role": "user"
},
{
"content": "SELECT avg(room_count) FROM Apartment_Bookings AS T1 JOIN Apartments AS T2 ON T1.apt_id = T2.apt_id WHERE T1.booking_status_code = \"Provisional\"",
"role": "assistant"
}
] |
apartment_rentals | [
{
"content": "Translate the following question to SQL: What is the average room count of the apartments whose booking status code is \"Provisional\"?\n\nSchema: CREATE TABLE Apartment_Buildings (\n building_id INTEGER NOT NULL PRIMARY KEY,\n building_short_name CHAR(15),\n building_full_name VARCHAR(80),\n building_description VARCHAR(255),\n building_address VARCHAR(255),\n building_manager VARCHAR(50),\n building_phone VARCHAR(80),\n UNIQUE (building_id)\n);\n\nCREATE TABLE Apartments (\n apt_id INTEGER NOT NULL PRIMARY KEY,\n building_id INTEGER NOT NULL,\n apt_type_code CHAR(15),\n apt_number CHAR(10),\n bathroom_count INTEGER,\n bedroom_count INTEGER,\n room_count CHAR(5),\n UNIQUE (apt_id),\n FOREIGN KEY (building_id) REFERENCES Apartment_Buildings(building_id)\n);\n\nCREATE TABLE Apartment_Facilities (\n apt_id INTEGER NOT NULL PRIMARY KEY,\n facility_code CHAR(15) NOT NULL PRIMARY KEY,\n PRIMARY KEY (apt_id, facility_code),\n UNIQUE (apt_id, facility_code),\n FOREIGN KEY (apt_id) REFERENCES Apartments(apt_id)\n);\n\nCREATE TABLE Guests (\n guest_id INTEGER NOT NULL PRIMARY KEY,\n gender_code CHAR(1),\n guest_first_name VARCHAR(80),\n guest_last_name VARCHAR(80),\n date_of_birth DATETIME,\n UNIQUE (guest_id)\n);\n\nCREATE TABLE Apartment_Bookings (\n apt_booking_id INTEGER NOT NULL PRIMARY KEY,\n apt_id INTEGER,\n guest_id INTEGER NOT NULL,\n booking_status_code CHAR(15) NOT NULL,\n booking_start_date DATETIME,\n booking_end_date DATETIME,\n UNIQUE (apt_booking_id),\n FOREIGN KEY (guest_id) REFERENCES Guests(guest_id),\n FOREIGN KEY (apt_id) REFERENCES Apartments(apt_id)\n);\n\nCREATE TABLE View_Unit_Status (\n apt_id INTEGER,\n apt_booking_id INTEGER,\n status_date DATETIME NOT NULL PRIMARY KEY,\n available_yn BIT,\n UNIQUE (status_date),\n FOREIGN KEY (apt_booking_id) REFERENCES Apartment_Bookings(apt_booking_id),\n FOREIGN KEY (apt_id) REFERENCES Apartments(apt_id)\n);",
"role": "user"
},
{
"content": "SELECT avg(room_count) FROM Apartment_Bookings AS T1 JOIN Apartments AS T2 ON T1.apt_id = T2.apt_id WHERE T1.booking_status_code = \"Provisional\"",
"role": "assistant"
}
] |
apartment_rentals | [
{
"content": "Translate the following question to SQL: Show the guest first names, start dates, and end dates of all the apartment bookings.\n\nSchema: CREATE TABLE Apartment_Buildings (\n building_id INTEGER NOT NULL PRIMARY KEY,\n building_short_name CHAR(15),\n building_full_name VARCHAR(80),\n building_description VARCHAR(255),\n building_address VARCHAR(255),\n building_manager VARCHAR(50),\n building_phone VARCHAR(80),\n UNIQUE (building_id)\n);\n\nCREATE TABLE Apartments (\n apt_id INTEGER NOT NULL PRIMARY KEY,\n building_id INTEGER NOT NULL,\n apt_type_code CHAR(15),\n apt_number CHAR(10),\n bathroom_count INTEGER,\n bedroom_count INTEGER,\n room_count CHAR(5),\n UNIQUE (apt_id),\n FOREIGN KEY (building_id) REFERENCES Apartment_Buildings(building_id)\n);\n\nCREATE TABLE Apartment_Facilities (\n apt_id INTEGER NOT NULL PRIMARY KEY,\n facility_code CHAR(15) NOT NULL PRIMARY KEY,\n PRIMARY KEY (apt_id, facility_code),\n UNIQUE (apt_id, facility_code),\n FOREIGN KEY (apt_id) REFERENCES Apartments(apt_id)\n);\n\nCREATE TABLE Guests (\n guest_id INTEGER NOT NULL PRIMARY KEY,\n gender_code CHAR(1),\n guest_first_name VARCHAR(80),\n guest_last_name VARCHAR(80),\n date_of_birth DATETIME,\n UNIQUE (guest_id)\n);\n\nCREATE TABLE Apartment_Bookings (\n apt_booking_id INTEGER NOT NULL PRIMARY KEY,\n apt_id INTEGER,\n guest_id INTEGER NOT NULL,\n booking_status_code CHAR(15) NOT NULL,\n booking_start_date DATETIME,\n booking_end_date DATETIME,\n UNIQUE (apt_booking_id),\n FOREIGN KEY (guest_id) REFERENCES Guests(guest_id),\n FOREIGN KEY (apt_id) REFERENCES Apartments(apt_id)\n);\n\nCREATE TABLE View_Unit_Status (\n apt_id INTEGER,\n apt_booking_id INTEGER,\n status_date DATETIME NOT NULL PRIMARY KEY,\n available_yn BIT,\n UNIQUE (status_date),\n FOREIGN KEY (apt_booking_id) REFERENCES Apartment_Bookings(apt_booking_id),\n FOREIGN KEY (apt_id) REFERENCES Apartments(apt_id)\n);",
"role": "user"
},
{
"content": "SELECT T2.guest_first_name , T1.booking_start_date , T1.booking_start_date FROM Apartment_Bookings AS T1 JOIN Guests AS T2 ON T1.guest_id = T2.guest_id",
"role": "assistant"
}
] |
apartment_rentals | [
{
"content": "Translate the following question to SQL: What are the guest first name, start date, and end date of each apartment booking?\n\nSchema: CREATE TABLE Apartment_Buildings (\n building_id INTEGER NOT NULL PRIMARY KEY,\n building_short_name CHAR(15),\n building_full_name VARCHAR(80),\n building_description VARCHAR(255),\n building_address VARCHAR(255),\n building_manager VARCHAR(50),\n building_phone VARCHAR(80),\n UNIQUE (building_id)\n);\n\nCREATE TABLE Apartments (\n apt_id INTEGER NOT NULL PRIMARY KEY,\n building_id INTEGER NOT NULL,\n apt_type_code CHAR(15),\n apt_number CHAR(10),\n bathroom_count INTEGER,\n bedroom_count INTEGER,\n room_count CHAR(5),\n UNIQUE (apt_id),\n FOREIGN KEY (building_id) REFERENCES Apartment_Buildings(building_id)\n);\n\nCREATE TABLE Apartment_Facilities (\n apt_id INTEGER NOT NULL PRIMARY KEY,\n facility_code CHAR(15) NOT NULL PRIMARY KEY,\n PRIMARY KEY (apt_id, facility_code),\n UNIQUE (apt_id, facility_code),\n FOREIGN KEY (apt_id) REFERENCES Apartments(apt_id)\n);\n\nCREATE TABLE Guests (\n guest_id INTEGER NOT NULL PRIMARY KEY,\n gender_code CHAR(1),\n guest_first_name VARCHAR(80),\n guest_last_name VARCHAR(80),\n date_of_birth DATETIME,\n UNIQUE (guest_id)\n);\n\nCREATE TABLE Apartment_Bookings (\n apt_booking_id INTEGER NOT NULL PRIMARY KEY,\n apt_id INTEGER,\n guest_id INTEGER NOT NULL,\n booking_status_code CHAR(15) NOT NULL,\n booking_start_date DATETIME,\n booking_end_date DATETIME,\n UNIQUE (apt_booking_id),\n FOREIGN KEY (guest_id) REFERENCES Guests(guest_id),\n FOREIGN KEY (apt_id) REFERENCES Apartments(apt_id)\n);\n\nCREATE TABLE View_Unit_Status (\n apt_id INTEGER,\n apt_booking_id INTEGER,\n status_date DATETIME NOT NULL PRIMARY KEY,\n available_yn BIT,\n UNIQUE (status_date),\n FOREIGN KEY (apt_booking_id) REFERENCES Apartment_Bookings(apt_booking_id),\n FOREIGN KEY (apt_id) REFERENCES Apartments(apt_id)\n);",
"role": "user"
},
{
"content": "SELECT T2.guest_first_name , T1.booking_start_date , T1.booking_start_date FROM Apartment_Bookings AS T1 JOIN Guests AS T2 ON T1.guest_id = T2.guest_id",
"role": "assistant"
}
] |
apartment_rentals | [
{
"content": "Translate the following question to SQL: Show the start dates and end dates of all the apartment bookings made by guests with gender code \"Female\".\n\nSchema: CREATE TABLE Apartment_Buildings (\n building_id INTEGER NOT NULL PRIMARY KEY,\n building_short_name CHAR(15),\n building_full_name VARCHAR(80),\n building_description VARCHAR(255),\n building_address VARCHAR(255),\n building_manager VARCHAR(50),\n building_phone VARCHAR(80),\n UNIQUE (building_id)\n);\n\nCREATE TABLE Apartments (\n apt_id INTEGER NOT NULL PRIMARY KEY,\n building_id INTEGER NOT NULL,\n apt_type_code CHAR(15),\n apt_number CHAR(10),\n bathroom_count INTEGER,\n bedroom_count INTEGER,\n room_count CHAR(5),\n UNIQUE (apt_id),\n FOREIGN KEY (building_id) REFERENCES Apartment_Buildings(building_id)\n);\n\nCREATE TABLE Apartment_Facilities (\n apt_id INTEGER NOT NULL PRIMARY KEY,\n facility_code CHAR(15) NOT NULL PRIMARY KEY,\n PRIMARY KEY (apt_id, facility_code),\n UNIQUE (apt_id, facility_code),\n FOREIGN KEY (apt_id) REFERENCES Apartments(apt_id)\n);\n\nCREATE TABLE Guests (\n guest_id INTEGER NOT NULL PRIMARY KEY,\n gender_code CHAR(1),\n guest_first_name VARCHAR(80),\n guest_last_name VARCHAR(80),\n date_of_birth DATETIME,\n UNIQUE (guest_id)\n);\n\nCREATE TABLE Apartment_Bookings (\n apt_booking_id INTEGER NOT NULL PRIMARY KEY,\n apt_id INTEGER,\n guest_id INTEGER NOT NULL,\n booking_status_code CHAR(15) NOT NULL,\n booking_start_date DATETIME,\n booking_end_date DATETIME,\n UNIQUE (apt_booking_id),\n FOREIGN KEY (guest_id) REFERENCES Guests(guest_id),\n FOREIGN KEY (apt_id) REFERENCES Apartments(apt_id)\n);\n\nCREATE TABLE View_Unit_Status (\n apt_id INTEGER,\n apt_booking_id INTEGER,\n status_date DATETIME NOT NULL PRIMARY KEY,\n available_yn BIT,\n UNIQUE (status_date),\n FOREIGN KEY (apt_booking_id) REFERENCES Apartment_Bookings(apt_booking_id),\n FOREIGN KEY (apt_id) REFERENCES Apartments(apt_id)\n);",
"role": "user"
},
{
"content": "SELECT T1.booking_start_date , T1.booking_start_date FROM Apartment_Bookings AS T1 JOIN Guests AS T2 ON T1.guest_id = T2.guest_id WHERE T2.gender_code = \"Female\"",
"role": "assistant"
}
] |
apartment_rentals | [
{
"content": "Translate the following question to SQL: What are the start date and end date of the apartment bookings made by female guests (gender code \"Female\")?\n\nSchema: CREATE TABLE Apartment_Buildings (\n building_id INTEGER NOT NULL PRIMARY KEY,\n building_short_name CHAR(15),\n building_full_name VARCHAR(80),\n building_description VARCHAR(255),\n building_address VARCHAR(255),\n building_manager VARCHAR(50),\n building_phone VARCHAR(80),\n UNIQUE (building_id)\n);\n\nCREATE TABLE Apartments (\n apt_id INTEGER NOT NULL PRIMARY KEY,\n building_id INTEGER NOT NULL,\n apt_type_code CHAR(15),\n apt_number CHAR(10),\n bathroom_count INTEGER,\n bedroom_count INTEGER,\n room_count CHAR(5),\n UNIQUE (apt_id),\n FOREIGN KEY (building_id) REFERENCES Apartment_Buildings(building_id)\n);\n\nCREATE TABLE Apartment_Facilities (\n apt_id INTEGER NOT NULL PRIMARY KEY,\n facility_code CHAR(15) NOT NULL PRIMARY KEY,\n PRIMARY KEY (apt_id, facility_code),\n UNIQUE (apt_id, facility_code),\n FOREIGN KEY (apt_id) REFERENCES Apartments(apt_id)\n);\n\nCREATE TABLE Guests (\n guest_id INTEGER NOT NULL PRIMARY KEY,\n gender_code CHAR(1),\n guest_first_name VARCHAR(80),\n guest_last_name VARCHAR(80),\n date_of_birth DATETIME,\n UNIQUE (guest_id)\n);\n\nCREATE TABLE Apartment_Bookings (\n apt_booking_id INTEGER NOT NULL PRIMARY KEY,\n apt_id INTEGER,\n guest_id INTEGER NOT NULL,\n booking_status_code CHAR(15) NOT NULL,\n booking_start_date DATETIME,\n booking_end_date DATETIME,\n UNIQUE (apt_booking_id),\n FOREIGN KEY (guest_id) REFERENCES Guests(guest_id),\n FOREIGN KEY (apt_id) REFERENCES Apartments(apt_id)\n);\n\nCREATE TABLE View_Unit_Status (\n apt_id INTEGER,\n apt_booking_id INTEGER,\n status_date DATETIME NOT NULL PRIMARY KEY,\n available_yn BIT,\n UNIQUE (status_date),\n FOREIGN KEY (apt_booking_id) REFERENCES Apartment_Bookings(apt_booking_id),\n FOREIGN KEY (apt_id) REFERENCES Apartments(apt_id)\n);",
"role": "user"
},
{
"content": "SELECT T1.booking_start_date , T1.booking_start_date FROM Apartment_Bookings AS T1 JOIN Guests AS T2 ON T1.guest_id = T2.guest_id WHERE T2.gender_code = \"Female\"",
"role": "assistant"
}
] |
apartment_rentals | [
{
"content": "Translate the following question to SQL: Show the first names and last names of all the guests that have apartment bookings with status code \"Confirmed\".\n\nSchema: CREATE TABLE Apartment_Buildings (\n building_id INTEGER NOT NULL PRIMARY KEY,\n building_short_name CHAR(15),\n building_full_name VARCHAR(80),\n building_description VARCHAR(255),\n building_address VARCHAR(255),\n building_manager VARCHAR(50),\n building_phone VARCHAR(80),\n UNIQUE (building_id)\n);\n\nCREATE TABLE Apartments (\n apt_id INTEGER NOT NULL PRIMARY KEY,\n building_id INTEGER NOT NULL,\n apt_type_code CHAR(15),\n apt_number CHAR(10),\n bathroom_count INTEGER,\n bedroom_count INTEGER,\n room_count CHAR(5),\n UNIQUE (apt_id),\n FOREIGN KEY (building_id) REFERENCES Apartment_Buildings(building_id)\n);\n\nCREATE TABLE Apartment_Facilities (\n apt_id INTEGER NOT NULL PRIMARY KEY,\n facility_code CHAR(15) NOT NULL PRIMARY KEY,\n PRIMARY KEY (apt_id, facility_code),\n UNIQUE (apt_id, facility_code),\n FOREIGN KEY (apt_id) REFERENCES Apartments(apt_id)\n);\n\nCREATE TABLE Guests (\n guest_id INTEGER NOT NULL PRIMARY KEY,\n gender_code CHAR(1),\n guest_first_name VARCHAR(80),\n guest_last_name VARCHAR(80),\n date_of_birth DATETIME,\n UNIQUE (guest_id)\n);\n\nCREATE TABLE Apartment_Bookings (\n apt_booking_id INTEGER NOT NULL PRIMARY KEY,\n apt_id INTEGER,\n guest_id INTEGER NOT NULL,\n booking_status_code CHAR(15) NOT NULL,\n booking_start_date DATETIME,\n booking_end_date DATETIME,\n UNIQUE (apt_booking_id),\n FOREIGN KEY (guest_id) REFERENCES Guests(guest_id),\n FOREIGN KEY (apt_id) REFERENCES Apartments(apt_id)\n);\n\nCREATE TABLE View_Unit_Status (\n apt_id INTEGER,\n apt_booking_id INTEGER,\n status_date DATETIME NOT NULL PRIMARY KEY,\n available_yn BIT,\n UNIQUE (status_date),\n FOREIGN KEY (apt_booking_id) REFERENCES Apartment_Bookings(apt_booking_id),\n FOREIGN KEY (apt_id) REFERENCES Apartments(apt_id)\n);",
"role": "user"
},
{
"content": "SELECT T2.guest_first_name , T2.guest_last_name FROM Apartment_Bookings AS T1 JOIN Guests AS T2 ON T1.guest_id = T2.guest_id WHERE T1.booking_status_code = \"Confirmed\"",
"role": "assistant"
}
] |
apartment_rentals | [
{
"content": "Translate the following question to SQL: Which guests have apartment bookings with status code \"Confirmed\"? Return their first names and last names.\n\nSchema: CREATE TABLE Apartment_Buildings (\n building_id INTEGER NOT NULL PRIMARY KEY,\n building_short_name CHAR(15),\n building_full_name VARCHAR(80),\n building_description VARCHAR(255),\n building_address VARCHAR(255),\n building_manager VARCHAR(50),\n building_phone VARCHAR(80),\n UNIQUE (building_id)\n);\n\nCREATE TABLE Apartments (\n apt_id INTEGER NOT NULL PRIMARY KEY,\n building_id INTEGER NOT NULL,\n apt_type_code CHAR(15),\n apt_number CHAR(10),\n bathroom_count INTEGER,\n bedroom_count INTEGER,\n room_count CHAR(5),\n UNIQUE (apt_id),\n FOREIGN KEY (building_id) REFERENCES Apartment_Buildings(building_id)\n);\n\nCREATE TABLE Apartment_Facilities (\n apt_id INTEGER NOT NULL PRIMARY KEY,\n facility_code CHAR(15) NOT NULL PRIMARY KEY,\n PRIMARY KEY (apt_id, facility_code),\n UNIQUE (apt_id, facility_code),\n FOREIGN KEY (apt_id) REFERENCES Apartments(apt_id)\n);\n\nCREATE TABLE Guests (\n guest_id INTEGER NOT NULL PRIMARY KEY,\n gender_code CHAR(1),\n guest_first_name VARCHAR(80),\n guest_last_name VARCHAR(80),\n date_of_birth DATETIME,\n UNIQUE (guest_id)\n);\n\nCREATE TABLE Apartment_Bookings (\n apt_booking_id INTEGER NOT NULL PRIMARY KEY,\n apt_id INTEGER,\n guest_id INTEGER NOT NULL,\n booking_status_code CHAR(15) NOT NULL,\n booking_start_date DATETIME,\n booking_end_date DATETIME,\n UNIQUE (apt_booking_id),\n FOREIGN KEY (guest_id) REFERENCES Guests(guest_id),\n FOREIGN KEY (apt_id) REFERENCES Apartments(apt_id)\n);\n\nCREATE TABLE View_Unit_Status (\n apt_id INTEGER,\n apt_booking_id INTEGER,\n status_date DATETIME NOT NULL PRIMARY KEY,\n available_yn BIT,\n UNIQUE (status_date),\n FOREIGN KEY (apt_booking_id) REFERENCES Apartment_Bookings(apt_booking_id),\n FOREIGN KEY (apt_id) REFERENCES Apartments(apt_id)\n);",
"role": "user"
},
{
"content": "SELECT T2.guest_first_name , T2.guest_last_name FROM Apartment_Bookings AS T1 JOIN Guests AS T2 ON T1.guest_id = T2.guest_id WHERE T1.booking_status_code = \"Confirmed\"",
"role": "assistant"
}
] |
apartment_rentals | [
{
"content": "Translate the following question to SQL: Show the facility codes of apartments with more than 4 bedrooms.\n\nSchema: CREATE TABLE Apartment_Buildings (\n building_id INTEGER NOT NULL PRIMARY KEY,\n building_short_name CHAR(15),\n building_full_name VARCHAR(80),\n building_description VARCHAR(255),\n building_address VARCHAR(255),\n building_manager VARCHAR(50),\n building_phone VARCHAR(80),\n UNIQUE (building_id)\n);\n\nCREATE TABLE Apartments (\n apt_id INTEGER NOT NULL PRIMARY KEY,\n building_id INTEGER NOT NULL,\n apt_type_code CHAR(15),\n apt_number CHAR(10),\n bathroom_count INTEGER,\n bedroom_count INTEGER,\n room_count CHAR(5),\n UNIQUE (apt_id),\n FOREIGN KEY (building_id) REFERENCES Apartment_Buildings(building_id)\n);\n\nCREATE TABLE Apartment_Facilities (\n apt_id INTEGER NOT NULL PRIMARY KEY,\n facility_code CHAR(15) NOT NULL PRIMARY KEY,\n PRIMARY KEY (apt_id, facility_code),\n UNIQUE (apt_id, facility_code),\n FOREIGN KEY (apt_id) REFERENCES Apartments(apt_id)\n);\n\nCREATE TABLE Guests (\n guest_id INTEGER NOT NULL PRIMARY KEY,\n gender_code CHAR(1),\n guest_first_name VARCHAR(80),\n guest_last_name VARCHAR(80),\n date_of_birth DATETIME,\n UNIQUE (guest_id)\n);\n\nCREATE TABLE Apartment_Bookings (\n apt_booking_id INTEGER NOT NULL PRIMARY KEY,\n apt_id INTEGER,\n guest_id INTEGER NOT NULL,\n booking_status_code CHAR(15) NOT NULL,\n booking_start_date DATETIME,\n booking_end_date DATETIME,\n UNIQUE (apt_booking_id),\n FOREIGN KEY (guest_id) REFERENCES Guests(guest_id),\n FOREIGN KEY (apt_id) REFERENCES Apartments(apt_id)\n);\n\nCREATE TABLE View_Unit_Status (\n apt_id INTEGER,\n apt_booking_id INTEGER,\n status_date DATETIME NOT NULL PRIMARY KEY,\n available_yn BIT,\n UNIQUE (status_date),\n FOREIGN KEY (apt_booking_id) REFERENCES Apartment_Bookings(apt_booking_id),\n FOREIGN KEY (apt_id) REFERENCES Apartments(apt_id)\n);",
"role": "user"
},
{
"content": "SELECT T1.facility_code FROM Apartment_Facilities AS T1 JOIN Apartments AS T2 ON T1.apt_id = T2.apt_id WHERE T2.bedroom_count > 4",
"role": "assistant"
}
] |
apartment_rentals | [
{
"content": "Translate the following question to SQL: What are the facility codes of the apartments with more than four bedrooms?\n\nSchema: CREATE TABLE Apartment_Buildings (\n building_id INTEGER NOT NULL PRIMARY KEY,\n building_short_name CHAR(15),\n building_full_name VARCHAR(80),\n building_description VARCHAR(255),\n building_address VARCHAR(255),\n building_manager VARCHAR(50),\n building_phone VARCHAR(80),\n UNIQUE (building_id)\n);\n\nCREATE TABLE Apartments (\n apt_id INTEGER NOT NULL PRIMARY KEY,\n building_id INTEGER NOT NULL,\n apt_type_code CHAR(15),\n apt_number CHAR(10),\n bathroom_count INTEGER,\n bedroom_count INTEGER,\n room_count CHAR(5),\n UNIQUE (apt_id),\n FOREIGN KEY (building_id) REFERENCES Apartment_Buildings(building_id)\n);\n\nCREATE TABLE Apartment_Facilities (\n apt_id INTEGER NOT NULL PRIMARY KEY,\n facility_code CHAR(15) NOT NULL PRIMARY KEY,\n PRIMARY KEY (apt_id, facility_code),\n UNIQUE (apt_id, facility_code),\n FOREIGN KEY (apt_id) REFERENCES Apartments(apt_id)\n);\n\nCREATE TABLE Guests (\n guest_id INTEGER NOT NULL PRIMARY KEY,\n gender_code CHAR(1),\n guest_first_name VARCHAR(80),\n guest_last_name VARCHAR(80),\n date_of_birth DATETIME,\n UNIQUE (guest_id)\n);\n\nCREATE TABLE Apartment_Bookings (\n apt_booking_id INTEGER NOT NULL PRIMARY KEY,\n apt_id INTEGER,\n guest_id INTEGER NOT NULL,\n booking_status_code CHAR(15) NOT NULL,\n booking_start_date DATETIME,\n booking_end_date DATETIME,\n UNIQUE (apt_booking_id),\n FOREIGN KEY (guest_id) REFERENCES Guests(guest_id),\n FOREIGN KEY (apt_id) REFERENCES Apartments(apt_id)\n);\n\nCREATE TABLE View_Unit_Status (\n apt_id INTEGER,\n apt_booking_id INTEGER,\n status_date DATETIME NOT NULL PRIMARY KEY,\n available_yn BIT,\n UNIQUE (status_date),\n FOREIGN KEY (apt_booking_id) REFERENCES Apartment_Bookings(apt_booking_id),\n FOREIGN KEY (apt_id) REFERENCES Apartments(apt_id)\n);",
"role": "user"
},
{
"content": "SELECT T1.facility_code FROM Apartment_Facilities AS T1 JOIN Apartments AS T2 ON T1.apt_id = T2.apt_id WHERE T2.bedroom_count > 4",
"role": "assistant"
}
] |
apartment_rentals | [
{
"content": "Translate the following question to SQL: Show the total number of rooms of all apartments with facility code \"Gym\".\n\nSchema: CREATE TABLE Apartment_Buildings (\n building_id INTEGER NOT NULL PRIMARY KEY,\n building_short_name CHAR(15),\n building_full_name VARCHAR(80),\n building_description VARCHAR(255),\n building_address VARCHAR(255),\n building_manager VARCHAR(50),\n building_phone VARCHAR(80),\n UNIQUE (building_id)\n);\n\nCREATE TABLE Apartments (\n apt_id INTEGER NOT NULL PRIMARY KEY,\n building_id INTEGER NOT NULL,\n apt_type_code CHAR(15),\n apt_number CHAR(10),\n bathroom_count INTEGER,\n bedroom_count INTEGER,\n room_count CHAR(5),\n UNIQUE (apt_id),\n FOREIGN KEY (building_id) REFERENCES Apartment_Buildings(building_id)\n);\n\nCREATE TABLE Apartment_Facilities (\n apt_id INTEGER NOT NULL PRIMARY KEY,\n facility_code CHAR(15) NOT NULL PRIMARY KEY,\n PRIMARY KEY (apt_id, facility_code),\n UNIQUE (apt_id, facility_code),\n FOREIGN KEY (apt_id) REFERENCES Apartments(apt_id)\n);\n\nCREATE TABLE Guests (\n guest_id INTEGER NOT NULL PRIMARY KEY,\n gender_code CHAR(1),\n guest_first_name VARCHAR(80),\n guest_last_name VARCHAR(80),\n date_of_birth DATETIME,\n UNIQUE (guest_id)\n);\n\nCREATE TABLE Apartment_Bookings (\n apt_booking_id INTEGER NOT NULL PRIMARY KEY,\n apt_id INTEGER,\n guest_id INTEGER NOT NULL,\n booking_status_code CHAR(15) NOT NULL,\n booking_start_date DATETIME,\n booking_end_date DATETIME,\n UNIQUE (apt_booking_id),\n FOREIGN KEY (guest_id) REFERENCES Guests(guest_id),\n FOREIGN KEY (apt_id) REFERENCES Apartments(apt_id)\n);\n\nCREATE TABLE View_Unit_Status (\n apt_id INTEGER,\n apt_booking_id INTEGER,\n status_date DATETIME NOT NULL PRIMARY KEY,\n available_yn BIT,\n UNIQUE (status_date),\n FOREIGN KEY (apt_booking_id) REFERENCES Apartment_Bookings(apt_booking_id),\n FOREIGN KEY (apt_id) REFERENCES Apartments(apt_id)\n);",
"role": "user"
},
{
"content": "SELECT sum(T2.room_count) FROM Apartment_Facilities AS T1 JOIN Apartments AS T2 ON T1.apt_id = T2.apt_id WHERE T1.facility_code = \"Gym\"",
"role": "assistant"
}
] |
apartment_rentals | [
{
"content": "Translate the following question to SQL: Find the total number of rooms in the apartments that have facility code \"Gym\".\n\nSchema: CREATE TABLE Apartment_Buildings (\n building_id INTEGER NOT NULL PRIMARY KEY,\n building_short_name CHAR(15),\n building_full_name VARCHAR(80),\n building_description VARCHAR(255),\n building_address VARCHAR(255),\n building_manager VARCHAR(50),\n building_phone VARCHAR(80),\n UNIQUE (building_id)\n);\n\nCREATE TABLE Apartments (\n apt_id INTEGER NOT NULL PRIMARY KEY,\n building_id INTEGER NOT NULL,\n apt_type_code CHAR(15),\n apt_number CHAR(10),\n bathroom_count INTEGER,\n bedroom_count INTEGER,\n room_count CHAR(5),\n UNIQUE (apt_id),\n FOREIGN KEY (building_id) REFERENCES Apartment_Buildings(building_id)\n);\n\nCREATE TABLE Apartment_Facilities (\n apt_id INTEGER NOT NULL PRIMARY KEY,\n facility_code CHAR(15) NOT NULL PRIMARY KEY,\n PRIMARY KEY (apt_id, facility_code),\n UNIQUE (apt_id, facility_code),\n FOREIGN KEY (apt_id) REFERENCES Apartments(apt_id)\n);\n\nCREATE TABLE Guests (\n guest_id INTEGER NOT NULL PRIMARY KEY,\n gender_code CHAR(1),\n guest_first_name VARCHAR(80),\n guest_last_name VARCHAR(80),\n date_of_birth DATETIME,\n UNIQUE (guest_id)\n);\n\nCREATE TABLE Apartment_Bookings (\n apt_booking_id INTEGER NOT NULL PRIMARY KEY,\n apt_id INTEGER,\n guest_id INTEGER NOT NULL,\n booking_status_code CHAR(15) NOT NULL,\n booking_start_date DATETIME,\n booking_end_date DATETIME,\n UNIQUE (apt_booking_id),\n FOREIGN KEY (guest_id) REFERENCES Guests(guest_id),\n FOREIGN KEY (apt_id) REFERENCES Apartments(apt_id)\n);\n\nCREATE TABLE View_Unit_Status (\n apt_id INTEGER,\n apt_booking_id INTEGER,\n status_date DATETIME NOT NULL PRIMARY KEY,\n available_yn BIT,\n UNIQUE (status_date),\n FOREIGN KEY (apt_booking_id) REFERENCES Apartment_Bookings(apt_booking_id),\n FOREIGN KEY (apt_id) REFERENCES Apartments(apt_id)\n);",
"role": "user"
},
{
"content": "SELECT sum(T2.room_count) FROM Apartment_Facilities AS T1 JOIN Apartments AS T2 ON T1.apt_id = T2.apt_id WHERE T1.facility_code = \"Gym\"",
"role": "assistant"
}
] |
apartment_rentals | [
{
"content": "Translate the following question to SQL: Show the total number of rooms of the apartments in the building with short name \"Columbus Square\".\n\nSchema: CREATE TABLE Apartment_Buildings (\n building_id INTEGER NOT NULL PRIMARY KEY,\n building_short_name CHAR(15),\n building_full_name VARCHAR(80),\n building_description VARCHAR(255),\n building_address VARCHAR(255),\n building_manager VARCHAR(50),\n building_phone VARCHAR(80),\n UNIQUE (building_id)\n);\n\nCREATE TABLE Apartments (\n apt_id INTEGER NOT NULL PRIMARY KEY,\n building_id INTEGER NOT NULL,\n apt_type_code CHAR(15),\n apt_number CHAR(10),\n bathroom_count INTEGER,\n bedroom_count INTEGER,\n room_count CHAR(5),\n UNIQUE (apt_id),\n FOREIGN KEY (building_id) REFERENCES Apartment_Buildings(building_id)\n);\n\nCREATE TABLE Apartment_Facilities (\n apt_id INTEGER NOT NULL PRIMARY KEY,\n facility_code CHAR(15) NOT NULL PRIMARY KEY,\n PRIMARY KEY (apt_id, facility_code),\n UNIQUE (apt_id, facility_code),\n FOREIGN KEY (apt_id) REFERENCES Apartments(apt_id)\n);\n\nCREATE TABLE Guests (\n guest_id INTEGER NOT NULL PRIMARY KEY,\n gender_code CHAR(1),\n guest_first_name VARCHAR(80),\n guest_last_name VARCHAR(80),\n date_of_birth DATETIME,\n UNIQUE (guest_id)\n);\n\nCREATE TABLE Apartment_Bookings (\n apt_booking_id INTEGER NOT NULL PRIMARY KEY,\n apt_id INTEGER,\n guest_id INTEGER NOT NULL,\n booking_status_code CHAR(15) NOT NULL,\n booking_start_date DATETIME,\n booking_end_date DATETIME,\n UNIQUE (apt_booking_id),\n FOREIGN KEY (guest_id) REFERENCES Guests(guest_id),\n FOREIGN KEY (apt_id) REFERENCES Apartments(apt_id)\n);\n\nCREATE TABLE View_Unit_Status (\n apt_id INTEGER,\n apt_booking_id INTEGER,\n status_date DATETIME NOT NULL PRIMARY KEY,\n available_yn BIT,\n UNIQUE (status_date),\n FOREIGN KEY (apt_booking_id) REFERENCES Apartment_Bookings(apt_booking_id),\n FOREIGN KEY (apt_id) REFERENCES Apartments(apt_id)\n);",
"role": "user"
},
{
"content": "SELECT sum(T2.room_count) FROM Apartment_Buildings AS T1 JOIN Apartments AS T2 ON T1.building_id = T2.building_id WHERE T1.building_short_name = \"Columbus Square\"",
"role": "assistant"
}
] |
apartment_rentals | [
{
"content": "Translate the following question to SQL: How many rooms in total are there in the apartments in the building with short name \"Columbus Square\"?\n\nSchema: CREATE TABLE Apartment_Buildings (\n building_id INTEGER NOT NULL PRIMARY KEY,\n building_short_name CHAR(15),\n building_full_name VARCHAR(80),\n building_description VARCHAR(255),\n building_address VARCHAR(255),\n building_manager VARCHAR(50),\n building_phone VARCHAR(80),\n UNIQUE (building_id)\n);\n\nCREATE TABLE Apartments (\n apt_id INTEGER NOT NULL PRIMARY KEY,\n building_id INTEGER NOT NULL,\n apt_type_code CHAR(15),\n apt_number CHAR(10),\n bathroom_count INTEGER,\n bedroom_count INTEGER,\n room_count CHAR(5),\n UNIQUE (apt_id),\n FOREIGN KEY (building_id) REFERENCES Apartment_Buildings(building_id)\n);\n\nCREATE TABLE Apartment_Facilities (\n apt_id INTEGER NOT NULL PRIMARY KEY,\n facility_code CHAR(15) NOT NULL PRIMARY KEY,\n PRIMARY KEY (apt_id, facility_code),\n UNIQUE (apt_id, facility_code),\n FOREIGN KEY (apt_id) REFERENCES Apartments(apt_id)\n);\n\nCREATE TABLE Guests (\n guest_id INTEGER NOT NULL PRIMARY KEY,\n gender_code CHAR(1),\n guest_first_name VARCHAR(80),\n guest_last_name VARCHAR(80),\n date_of_birth DATETIME,\n UNIQUE (guest_id)\n);\n\nCREATE TABLE Apartment_Bookings (\n apt_booking_id INTEGER NOT NULL PRIMARY KEY,\n apt_id INTEGER,\n guest_id INTEGER NOT NULL,\n booking_status_code CHAR(15) NOT NULL,\n booking_start_date DATETIME,\n booking_end_date DATETIME,\n UNIQUE (apt_booking_id),\n FOREIGN KEY (guest_id) REFERENCES Guests(guest_id),\n FOREIGN KEY (apt_id) REFERENCES Apartments(apt_id)\n);\n\nCREATE TABLE View_Unit_Status (\n apt_id INTEGER,\n apt_booking_id INTEGER,\n status_date DATETIME NOT NULL PRIMARY KEY,\n available_yn BIT,\n UNIQUE (status_date),\n FOREIGN KEY (apt_booking_id) REFERENCES Apartment_Bookings(apt_booking_id),\n FOREIGN KEY (apt_id) REFERENCES Apartments(apt_id)\n);",
"role": "user"
},
{
"content": "SELECT sum(T2.room_count) FROM Apartment_Buildings AS T1 JOIN Apartments AS T2 ON T1.building_id = T2.building_id WHERE T1.building_short_name = \"Columbus Square\"",
"role": "assistant"
}
] |
apartment_rentals | [
{
"content": "Translate the following question to SQL: Show the addresses of the buildings that have apartments with more than 2 bathrooms.\n\nSchema: CREATE TABLE Apartment_Buildings (\n building_id INTEGER NOT NULL PRIMARY KEY,\n building_short_name CHAR(15),\n building_full_name VARCHAR(80),\n building_description VARCHAR(255),\n building_address VARCHAR(255),\n building_manager VARCHAR(50),\n building_phone VARCHAR(80),\n UNIQUE (building_id)\n);\n\nCREATE TABLE Apartments (\n apt_id INTEGER NOT NULL PRIMARY KEY,\n building_id INTEGER NOT NULL,\n apt_type_code CHAR(15),\n apt_number CHAR(10),\n bathroom_count INTEGER,\n bedroom_count INTEGER,\n room_count CHAR(5),\n UNIQUE (apt_id),\n FOREIGN KEY (building_id) REFERENCES Apartment_Buildings(building_id)\n);\n\nCREATE TABLE Apartment_Facilities (\n apt_id INTEGER NOT NULL PRIMARY KEY,\n facility_code CHAR(15) NOT NULL PRIMARY KEY,\n PRIMARY KEY (apt_id, facility_code),\n UNIQUE (apt_id, facility_code),\n FOREIGN KEY (apt_id) REFERENCES Apartments(apt_id)\n);\n\nCREATE TABLE Guests (\n guest_id INTEGER NOT NULL PRIMARY KEY,\n gender_code CHAR(1),\n guest_first_name VARCHAR(80),\n guest_last_name VARCHAR(80),\n date_of_birth DATETIME,\n UNIQUE (guest_id)\n);\n\nCREATE TABLE Apartment_Bookings (\n apt_booking_id INTEGER NOT NULL PRIMARY KEY,\n apt_id INTEGER,\n guest_id INTEGER NOT NULL,\n booking_status_code CHAR(15) NOT NULL,\n booking_start_date DATETIME,\n booking_end_date DATETIME,\n UNIQUE (apt_booking_id),\n FOREIGN KEY (guest_id) REFERENCES Guests(guest_id),\n FOREIGN KEY (apt_id) REFERENCES Apartments(apt_id)\n);\n\nCREATE TABLE View_Unit_Status (\n apt_id INTEGER,\n apt_booking_id INTEGER,\n status_date DATETIME NOT NULL PRIMARY KEY,\n available_yn BIT,\n UNIQUE (status_date),\n FOREIGN KEY (apt_booking_id) REFERENCES Apartment_Bookings(apt_booking_id),\n FOREIGN KEY (apt_id) REFERENCES Apartments(apt_id)\n);",
"role": "user"
},
{
"content": "SELECT T1.building_address FROM Apartment_Buildings AS T1 JOIN Apartments AS T2 ON T1.building_id = T2.building_id WHERE T2.bathroom_count > 2",
"role": "assistant"
}
] |
apartment_rentals | [
{
"content": "Translate the following question to SQL: Which buildings have apartments that have more than two bathrooms? Give me the addresses of the buildings.\n\nSchema: CREATE TABLE Apartment_Buildings (\n building_id INTEGER NOT NULL PRIMARY KEY,\n building_short_name CHAR(15),\n building_full_name VARCHAR(80),\n building_description VARCHAR(255),\n building_address VARCHAR(255),\n building_manager VARCHAR(50),\n building_phone VARCHAR(80),\n UNIQUE (building_id)\n);\n\nCREATE TABLE Apartments (\n apt_id INTEGER NOT NULL PRIMARY KEY,\n building_id INTEGER NOT NULL,\n apt_type_code CHAR(15),\n apt_number CHAR(10),\n bathroom_count INTEGER,\n bedroom_count INTEGER,\n room_count CHAR(5),\n UNIQUE (apt_id),\n FOREIGN KEY (building_id) REFERENCES Apartment_Buildings(building_id)\n);\n\nCREATE TABLE Apartment_Facilities (\n apt_id INTEGER NOT NULL PRIMARY KEY,\n facility_code CHAR(15) NOT NULL PRIMARY KEY,\n PRIMARY KEY (apt_id, facility_code),\n UNIQUE (apt_id, facility_code),\n FOREIGN KEY (apt_id) REFERENCES Apartments(apt_id)\n);\n\nCREATE TABLE Guests (\n guest_id INTEGER NOT NULL PRIMARY KEY,\n gender_code CHAR(1),\n guest_first_name VARCHAR(80),\n guest_last_name VARCHAR(80),\n date_of_birth DATETIME,\n UNIQUE (guest_id)\n);\n\nCREATE TABLE Apartment_Bookings (\n apt_booking_id INTEGER NOT NULL PRIMARY KEY,\n apt_id INTEGER,\n guest_id INTEGER NOT NULL,\n booking_status_code CHAR(15) NOT NULL,\n booking_start_date DATETIME,\n booking_end_date DATETIME,\n UNIQUE (apt_booking_id),\n FOREIGN KEY (guest_id) REFERENCES Guests(guest_id),\n FOREIGN KEY (apt_id) REFERENCES Apartments(apt_id)\n);\n\nCREATE TABLE View_Unit_Status (\n apt_id INTEGER,\n apt_booking_id INTEGER,\n status_date DATETIME NOT NULL PRIMARY KEY,\n available_yn BIT,\n UNIQUE (status_date),\n FOREIGN KEY (apt_booking_id) REFERENCES Apartment_Bookings(apt_booking_id),\n FOREIGN KEY (apt_id) REFERENCES Apartments(apt_id)\n);",
"role": "user"
},
{
"content": "SELECT T1.building_address FROM Apartment_Buildings AS T1 JOIN Apartments AS T2 ON T1.building_id = T2.building_id WHERE T2.bathroom_count > 2",
"role": "assistant"
}
] |
apartment_rentals | [
{
"content": "Translate the following question to SQL: Show the apartment type codes and apartment numbers in the buildings managed by \"Kyle\".\n\nSchema: CREATE TABLE Apartment_Buildings (\n building_id INTEGER NOT NULL PRIMARY KEY,\n building_short_name CHAR(15),\n building_full_name VARCHAR(80),\n building_description VARCHAR(255),\n building_address VARCHAR(255),\n building_manager VARCHAR(50),\n building_phone VARCHAR(80),\n UNIQUE (building_id)\n);\n\nCREATE TABLE Apartments (\n apt_id INTEGER NOT NULL PRIMARY KEY,\n building_id INTEGER NOT NULL,\n apt_type_code CHAR(15),\n apt_number CHAR(10),\n bathroom_count INTEGER,\n bedroom_count INTEGER,\n room_count CHAR(5),\n UNIQUE (apt_id),\n FOREIGN KEY (building_id) REFERENCES Apartment_Buildings(building_id)\n);\n\nCREATE TABLE Apartment_Facilities (\n apt_id INTEGER NOT NULL PRIMARY KEY,\n facility_code CHAR(15) NOT NULL PRIMARY KEY,\n PRIMARY KEY (apt_id, facility_code),\n UNIQUE (apt_id, facility_code),\n FOREIGN KEY (apt_id) REFERENCES Apartments(apt_id)\n);\n\nCREATE TABLE Guests (\n guest_id INTEGER NOT NULL PRIMARY KEY,\n gender_code CHAR(1),\n guest_first_name VARCHAR(80),\n guest_last_name VARCHAR(80),\n date_of_birth DATETIME,\n UNIQUE (guest_id)\n);\n\nCREATE TABLE Apartment_Bookings (\n apt_booking_id INTEGER NOT NULL PRIMARY KEY,\n apt_id INTEGER,\n guest_id INTEGER NOT NULL,\n booking_status_code CHAR(15) NOT NULL,\n booking_start_date DATETIME,\n booking_end_date DATETIME,\n UNIQUE (apt_booking_id),\n FOREIGN KEY (guest_id) REFERENCES Guests(guest_id),\n FOREIGN KEY (apt_id) REFERENCES Apartments(apt_id)\n);\n\nCREATE TABLE View_Unit_Status (\n apt_id INTEGER,\n apt_booking_id INTEGER,\n status_date DATETIME NOT NULL PRIMARY KEY,\n available_yn BIT,\n UNIQUE (status_date),\n FOREIGN KEY (apt_booking_id) REFERENCES Apartment_Bookings(apt_booking_id),\n FOREIGN KEY (apt_id) REFERENCES Apartments(apt_id)\n);",
"role": "user"
},
{
"content": "SELECT T2.apt_type_code , T2.apt_number FROM Apartment_Buildings AS T1 JOIN Apartments AS T2 ON T1.building_id = T2.building_id WHERE T1.building_manager = \"Kyle\"",
"role": "assistant"
}
] |
apartment_rentals | [
{
"content": "Translate the following question to SQL: What apartment type codes and apartment numbers do the buildings managed by \"Kyle\" have?\n\nSchema: CREATE TABLE Apartment_Buildings (\n building_id INTEGER NOT NULL PRIMARY KEY,\n building_short_name CHAR(15),\n building_full_name VARCHAR(80),\n building_description VARCHAR(255),\n building_address VARCHAR(255),\n building_manager VARCHAR(50),\n building_phone VARCHAR(80),\n UNIQUE (building_id)\n);\n\nCREATE TABLE Apartments (\n apt_id INTEGER NOT NULL PRIMARY KEY,\n building_id INTEGER NOT NULL,\n apt_type_code CHAR(15),\n apt_number CHAR(10),\n bathroom_count INTEGER,\n bedroom_count INTEGER,\n room_count CHAR(5),\n UNIQUE (apt_id),\n FOREIGN KEY (building_id) REFERENCES Apartment_Buildings(building_id)\n);\n\nCREATE TABLE Apartment_Facilities (\n apt_id INTEGER NOT NULL PRIMARY KEY,\n facility_code CHAR(15) NOT NULL PRIMARY KEY,\n PRIMARY KEY (apt_id, facility_code),\n UNIQUE (apt_id, facility_code),\n FOREIGN KEY (apt_id) REFERENCES Apartments(apt_id)\n);\n\nCREATE TABLE Guests (\n guest_id INTEGER NOT NULL PRIMARY KEY,\n gender_code CHAR(1),\n guest_first_name VARCHAR(80),\n guest_last_name VARCHAR(80),\n date_of_birth DATETIME,\n UNIQUE (guest_id)\n);\n\nCREATE TABLE Apartment_Bookings (\n apt_booking_id INTEGER NOT NULL PRIMARY KEY,\n apt_id INTEGER,\n guest_id INTEGER NOT NULL,\n booking_status_code CHAR(15) NOT NULL,\n booking_start_date DATETIME,\n booking_end_date DATETIME,\n UNIQUE (apt_booking_id),\n FOREIGN KEY (guest_id) REFERENCES Guests(guest_id),\n FOREIGN KEY (apt_id) REFERENCES Apartments(apt_id)\n);\n\nCREATE TABLE View_Unit_Status (\n apt_id INTEGER,\n apt_booking_id INTEGER,\n status_date DATETIME NOT NULL PRIMARY KEY,\n available_yn BIT,\n UNIQUE (status_date),\n FOREIGN KEY (apt_booking_id) REFERENCES Apartment_Bookings(apt_booking_id),\n FOREIGN KEY (apt_id) REFERENCES Apartments(apt_id)\n);",
"role": "user"
},
{
"content": "SELECT T2.apt_type_code , T2.apt_number FROM Apartment_Buildings AS T1 JOIN Apartments AS T2 ON T1.building_id = T2.building_id WHERE T1.building_manager = \"Kyle\"",
"role": "assistant"
}
] |
apartment_rentals | [
{
"content": "Translate the following question to SQL: Show the booking status code and the corresponding number of bookings.\n\nSchema: CREATE TABLE Apartment_Buildings (\n building_id INTEGER NOT NULL PRIMARY KEY,\n building_short_name CHAR(15),\n building_full_name VARCHAR(80),\n building_description VARCHAR(255),\n building_address VARCHAR(255),\n building_manager VARCHAR(50),\n building_phone VARCHAR(80),\n UNIQUE (building_id)\n);\n\nCREATE TABLE Apartments (\n apt_id INTEGER NOT NULL PRIMARY KEY,\n building_id INTEGER NOT NULL,\n apt_type_code CHAR(15),\n apt_number CHAR(10),\n bathroom_count INTEGER,\n bedroom_count INTEGER,\n room_count CHAR(5),\n UNIQUE (apt_id),\n FOREIGN KEY (building_id) REFERENCES Apartment_Buildings(building_id)\n);\n\nCREATE TABLE Apartment_Facilities (\n apt_id INTEGER NOT NULL PRIMARY KEY,\n facility_code CHAR(15) NOT NULL PRIMARY KEY,\n PRIMARY KEY (apt_id, facility_code),\n UNIQUE (apt_id, facility_code),\n FOREIGN KEY (apt_id) REFERENCES Apartments(apt_id)\n);\n\nCREATE TABLE Guests (\n guest_id INTEGER NOT NULL PRIMARY KEY,\n gender_code CHAR(1),\n guest_first_name VARCHAR(80),\n guest_last_name VARCHAR(80),\n date_of_birth DATETIME,\n UNIQUE (guest_id)\n);\n\nCREATE TABLE Apartment_Bookings (\n apt_booking_id INTEGER NOT NULL PRIMARY KEY,\n apt_id INTEGER,\n guest_id INTEGER NOT NULL,\n booking_status_code CHAR(15) NOT NULL,\n booking_start_date DATETIME,\n booking_end_date DATETIME,\n UNIQUE (apt_booking_id),\n FOREIGN KEY (guest_id) REFERENCES Guests(guest_id),\n FOREIGN KEY (apt_id) REFERENCES Apartments(apt_id)\n);\n\nCREATE TABLE View_Unit_Status (\n apt_id INTEGER,\n apt_booking_id INTEGER,\n status_date DATETIME NOT NULL PRIMARY KEY,\n available_yn BIT,\n UNIQUE (status_date),\n FOREIGN KEY (apt_booking_id) REFERENCES Apartment_Bookings(apt_booking_id),\n FOREIGN KEY (apt_id) REFERENCES Apartments(apt_id)\n);",
"role": "user"
},
{
"content": "SELECT \tbooking_status_code , COUNT(*) FROM Apartment_Bookings GROUP BY booking_status_code",
"role": "assistant"
}
] |
apartment_rentals | [
{
"content": "Translate the following question to SQL: How many bookings does each booking status have? List the booking status code and the number of corresponding bookings.\n\nSchema: CREATE TABLE Apartment_Buildings (\n building_id INTEGER NOT NULL PRIMARY KEY,\n building_short_name CHAR(15),\n building_full_name VARCHAR(80),\n building_description VARCHAR(255),\n building_address VARCHAR(255),\n building_manager VARCHAR(50),\n building_phone VARCHAR(80),\n UNIQUE (building_id)\n);\n\nCREATE TABLE Apartments (\n apt_id INTEGER NOT NULL PRIMARY KEY,\n building_id INTEGER NOT NULL,\n apt_type_code CHAR(15),\n apt_number CHAR(10),\n bathroom_count INTEGER,\n bedroom_count INTEGER,\n room_count CHAR(5),\n UNIQUE (apt_id),\n FOREIGN KEY (building_id) REFERENCES Apartment_Buildings(building_id)\n);\n\nCREATE TABLE Apartment_Facilities (\n apt_id INTEGER NOT NULL PRIMARY KEY,\n facility_code CHAR(15) NOT NULL PRIMARY KEY,\n PRIMARY KEY (apt_id, facility_code),\n UNIQUE (apt_id, facility_code),\n FOREIGN KEY (apt_id) REFERENCES Apartments(apt_id)\n);\n\nCREATE TABLE Guests (\n guest_id INTEGER NOT NULL PRIMARY KEY,\n gender_code CHAR(1),\n guest_first_name VARCHAR(80),\n guest_last_name VARCHAR(80),\n date_of_birth DATETIME,\n UNIQUE (guest_id)\n);\n\nCREATE TABLE Apartment_Bookings (\n apt_booking_id INTEGER NOT NULL PRIMARY KEY,\n apt_id INTEGER,\n guest_id INTEGER NOT NULL,\n booking_status_code CHAR(15) NOT NULL,\n booking_start_date DATETIME,\n booking_end_date DATETIME,\n UNIQUE (apt_booking_id),\n FOREIGN KEY (guest_id) REFERENCES Guests(guest_id),\n FOREIGN KEY (apt_id) REFERENCES Apartments(apt_id)\n);\n\nCREATE TABLE View_Unit_Status (\n apt_id INTEGER,\n apt_booking_id INTEGER,\n status_date DATETIME NOT NULL PRIMARY KEY,\n available_yn BIT,\n UNIQUE (status_date),\n FOREIGN KEY (apt_booking_id) REFERENCES Apartment_Bookings(apt_booking_id),\n FOREIGN KEY (apt_id) REFERENCES Apartments(apt_id)\n);",
"role": "user"
},
{
"content": "SELECT \tbooking_status_code , COUNT(*) FROM Apartment_Bookings GROUP BY booking_status_code",
"role": "assistant"
}
] |
apartment_rentals | [
{
"content": "Translate the following question to SQL: Return all the apartment numbers sorted by the room count in ascending order.\n\nSchema: CREATE TABLE Apartment_Buildings (\n building_id INTEGER NOT NULL PRIMARY KEY,\n building_short_name CHAR(15),\n building_full_name VARCHAR(80),\n building_description VARCHAR(255),\n building_address VARCHAR(255),\n building_manager VARCHAR(50),\n building_phone VARCHAR(80),\n UNIQUE (building_id)\n);\n\nCREATE TABLE Apartments (\n apt_id INTEGER NOT NULL PRIMARY KEY,\n building_id INTEGER NOT NULL,\n apt_type_code CHAR(15),\n apt_number CHAR(10),\n bathroom_count INTEGER,\n bedroom_count INTEGER,\n room_count CHAR(5),\n UNIQUE (apt_id),\n FOREIGN KEY (building_id) REFERENCES Apartment_Buildings(building_id)\n);\n\nCREATE TABLE Apartment_Facilities (\n apt_id INTEGER NOT NULL PRIMARY KEY,\n facility_code CHAR(15) NOT NULL PRIMARY KEY,\n PRIMARY KEY (apt_id, facility_code),\n UNIQUE (apt_id, facility_code),\n FOREIGN KEY (apt_id) REFERENCES Apartments(apt_id)\n);\n\nCREATE TABLE Guests (\n guest_id INTEGER NOT NULL PRIMARY KEY,\n gender_code CHAR(1),\n guest_first_name VARCHAR(80),\n guest_last_name VARCHAR(80),\n date_of_birth DATETIME,\n UNIQUE (guest_id)\n);\n\nCREATE TABLE Apartment_Bookings (\n apt_booking_id INTEGER NOT NULL PRIMARY KEY,\n apt_id INTEGER,\n guest_id INTEGER NOT NULL,\n booking_status_code CHAR(15) NOT NULL,\n booking_start_date DATETIME,\n booking_end_date DATETIME,\n UNIQUE (apt_booking_id),\n FOREIGN KEY (guest_id) REFERENCES Guests(guest_id),\n FOREIGN KEY (apt_id) REFERENCES Apartments(apt_id)\n);\n\nCREATE TABLE View_Unit_Status (\n apt_id INTEGER,\n apt_booking_id INTEGER,\n status_date DATETIME NOT NULL PRIMARY KEY,\n available_yn BIT,\n UNIQUE (status_date),\n FOREIGN KEY (apt_booking_id) REFERENCES Apartment_Bookings(apt_booking_id),\n FOREIGN KEY (apt_id) REFERENCES Apartments(apt_id)\n);",
"role": "user"
},
{
"content": "SELECT apt_number FROM Apartments ORDER BY room_count ASC",
"role": "assistant"
}
] |
apartment_rentals | [
{
"content": "Translate the following question to SQL: Sort the apartment numbers in ascending order of room count.\n\nSchema: CREATE TABLE Apartment_Buildings (\n building_id INTEGER NOT NULL PRIMARY KEY,\n building_short_name CHAR(15),\n building_full_name VARCHAR(80),\n building_description VARCHAR(255),\n building_address VARCHAR(255),\n building_manager VARCHAR(50),\n building_phone VARCHAR(80),\n UNIQUE (building_id)\n);\n\nCREATE TABLE Apartments (\n apt_id INTEGER NOT NULL PRIMARY KEY,\n building_id INTEGER NOT NULL,\n apt_type_code CHAR(15),\n apt_number CHAR(10),\n bathroom_count INTEGER,\n bedroom_count INTEGER,\n room_count CHAR(5),\n UNIQUE (apt_id),\n FOREIGN KEY (building_id) REFERENCES Apartment_Buildings(building_id)\n);\n\nCREATE TABLE Apartment_Facilities (\n apt_id INTEGER NOT NULL PRIMARY KEY,\n facility_code CHAR(15) NOT NULL PRIMARY KEY,\n PRIMARY KEY (apt_id, facility_code),\n UNIQUE (apt_id, facility_code),\n FOREIGN KEY (apt_id) REFERENCES Apartments(apt_id)\n);\n\nCREATE TABLE Guests (\n guest_id INTEGER NOT NULL PRIMARY KEY,\n gender_code CHAR(1),\n guest_first_name VARCHAR(80),\n guest_last_name VARCHAR(80),\n date_of_birth DATETIME,\n UNIQUE (guest_id)\n);\n\nCREATE TABLE Apartment_Bookings (\n apt_booking_id INTEGER NOT NULL PRIMARY KEY,\n apt_id INTEGER,\n guest_id INTEGER NOT NULL,\n booking_status_code CHAR(15) NOT NULL,\n booking_start_date DATETIME,\n booking_end_date DATETIME,\n UNIQUE (apt_booking_id),\n FOREIGN KEY (guest_id) REFERENCES Guests(guest_id),\n FOREIGN KEY (apt_id) REFERENCES Apartments(apt_id)\n);\n\nCREATE TABLE View_Unit_Status (\n apt_id INTEGER,\n apt_booking_id INTEGER,\n status_date DATETIME NOT NULL PRIMARY KEY,\n available_yn BIT,\n UNIQUE (status_date),\n FOREIGN KEY (apt_booking_id) REFERENCES Apartment_Bookings(apt_booking_id),\n FOREIGN KEY (apt_id) REFERENCES Apartments(apt_id)\n);",
"role": "user"
},
{
"content": "SELECT apt_number FROM Apartments ORDER BY room_count ASC",
"role": "assistant"
}
] |
apartment_rentals | [
{
"content": "Translate the following question to SQL: Return the apartment number with the largest number of bedrooms.\n\nSchema: CREATE TABLE Apartment_Buildings (\n building_id INTEGER NOT NULL PRIMARY KEY,\n building_short_name CHAR(15),\n building_full_name VARCHAR(80),\n building_description VARCHAR(255),\n building_address VARCHAR(255),\n building_manager VARCHAR(50),\n building_phone VARCHAR(80),\n UNIQUE (building_id)\n);\n\nCREATE TABLE Apartments (\n apt_id INTEGER NOT NULL PRIMARY KEY,\n building_id INTEGER NOT NULL,\n apt_type_code CHAR(15),\n apt_number CHAR(10),\n bathroom_count INTEGER,\n bedroom_count INTEGER,\n room_count CHAR(5),\n UNIQUE (apt_id),\n FOREIGN KEY (building_id) REFERENCES Apartment_Buildings(building_id)\n);\n\nCREATE TABLE Apartment_Facilities (\n apt_id INTEGER NOT NULL PRIMARY KEY,\n facility_code CHAR(15) NOT NULL PRIMARY KEY,\n PRIMARY KEY (apt_id, facility_code),\n UNIQUE (apt_id, facility_code),\n FOREIGN KEY (apt_id) REFERENCES Apartments(apt_id)\n);\n\nCREATE TABLE Guests (\n guest_id INTEGER NOT NULL PRIMARY KEY,\n gender_code CHAR(1),\n guest_first_name VARCHAR(80),\n guest_last_name VARCHAR(80),\n date_of_birth DATETIME,\n UNIQUE (guest_id)\n);\n\nCREATE TABLE Apartment_Bookings (\n apt_booking_id INTEGER NOT NULL PRIMARY KEY,\n apt_id INTEGER,\n guest_id INTEGER NOT NULL,\n booking_status_code CHAR(15) NOT NULL,\n booking_start_date DATETIME,\n booking_end_date DATETIME,\n UNIQUE (apt_booking_id),\n FOREIGN KEY (guest_id) REFERENCES Guests(guest_id),\n FOREIGN KEY (apt_id) REFERENCES Apartments(apt_id)\n);\n\nCREATE TABLE View_Unit_Status (\n apt_id INTEGER,\n apt_booking_id INTEGER,\n status_date DATETIME NOT NULL PRIMARY KEY,\n available_yn BIT,\n UNIQUE (status_date),\n FOREIGN KEY (apt_booking_id) REFERENCES Apartment_Bookings(apt_booking_id),\n FOREIGN KEY (apt_id) REFERENCES Apartments(apt_id)\n);",
"role": "user"
},
{
"content": "SELECT apt_number FROM Apartments ORDER BY bedroom_count DESC LIMIT 1",
"role": "assistant"
}
] |
apartment_rentals | [
{
"content": "Translate the following question to SQL: What is the apartment number of the apartment with the most beds?\n\nSchema: CREATE TABLE Apartment_Buildings (\n building_id INTEGER NOT NULL PRIMARY KEY,\n building_short_name CHAR(15),\n building_full_name VARCHAR(80),\n building_description VARCHAR(255),\n building_address VARCHAR(255),\n building_manager VARCHAR(50),\n building_phone VARCHAR(80),\n UNIQUE (building_id)\n);\n\nCREATE TABLE Apartments (\n apt_id INTEGER NOT NULL PRIMARY KEY,\n building_id INTEGER NOT NULL,\n apt_type_code CHAR(15),\n apt_number CHAR(10),\n bathroom_count INTEGER,\n bedroom_count INTEGER,\n room_count CHAR(5),\n UNIQUE (apt_id),\n FOREIGN KEY (building_id) REFERENCES Apartment_Buildings(building_id)\n);\n\nCREATE TABLE Apartment_Facilities (\n apt_id INTEGER NOT NULL PRIMARY KEY,\n facility_code CHAR(15) NOT NULL PRIMARY KEY,\n PRIMARY KEY (apt_id, facility_code),\n UNIQUE (apt_id, facility_code),\n FOREIGN KEY (apt_id) REFERENCES Apartments(apt_id)\n);\n\nCREATE TABLE Guests (\n guest_id INTEGER NOT NULL PRIMARY KEY,\n gender_code CHAR(1),\n guest_first_name VARCHAR(80),\n guest_last_name VARCHAR(80),\n date_of_birth DATETIME,\n UNIQUE (guest_id)\n);\n\nCREATE TABLE Apartment_Bookings (\n apt_booking_id INTEGER NOT NULL PRIMARY KEY,\n apt_id INTEGER,\n guest_id INTEGER NOT NULL,\n booking_status_code CHAR(15) NOT NULL,\n booking_start_date DATETIME,\n booking_end_date DATETIME,\n UNIQUE (apt_booking_id),\n FOREIGN KEY (guest_id) REFERENCES Guests(guest_id),\n FOREIGN KEY (apt_id) REFERENCES Apartments(apt_id)\n);\n\nCREATE TABLE View_Unit_Status (\n apt_id INTEGER,\n apt_booking_id INTEGER,\n status_date DATETIME NOT NULL PRIMARY KEY,\n available_yn BIT,\n UNIQUE (status_date),\n FOREIGN KEY (apt_booking_id) REFERENCES Apartment_Bookings(apt_booking_id),\n FOREIGN KEY (apt_id) REFERENCES Apartments(apt_id)\n);",
"role": "user"
},
{
"content": "SELECT apt_number FROM Apartments ORDER BY bedroom_count DESC LIMIT 1",
"role": "assistant"
}
] |
apartment_rentals | [
{
"content": "Translate the following question to SQL: Show the apartment type codes and the corresponding number of apartments sorted by the number of apartments in ascending order.\n\nSchema: CREATE TABLE Apartment_Buildings (\n building_id INTEGER NOT NULL PRIMARY KEY,\n building_short_name CHAR(15),\n building_full_name VARCHAR(80),\n building_description VARCHAR(255),\n building_address VARCHAR(255),\n building_manager VARCHAR(50),\n building_phone VARCHAR(80),\n UNIQUE (building_id)\n);\n\nCREATE TABLE Apartments (\n apt_id INTEGER NOT NULL PRIMARY KEY,\n building_id INTEGER NOT NULL,\n apt_type_code CHAR(15),\n apt_number CHAR(10),\n bathroom_count INTEGER,\n bedroom_count INTEGER,\n room_count CHAR(5),\n UNIQUE (apt_id),\n FOREIGN KEY (building_id) REFERENCES Apartment_Buildings(building_id)\n);\n\nCREATE TABLE Apartment_Facilities (\n apt_id INTEGER NOT NULL PRIMARY KEY,\n facility_code CHAR(15) NOT NULL PRIMARY KEY,\n PRIMARY KEY (apt_id, facility_code),\n UNIQUE (apt_id, facility_code),\n FOREIGN KEY (apt_id) REFERENCES Apartments(apt_id)\n);\n\nCREATE TABLE Guests (\n guest_id INTEGER NOT NULL PRIMARY KEY,\n gender_code CHAR(1),\n guest_first_name VARCHAR(80),\n guest_last_name VARCHAR(80),\n date_of_birth DATETIME,\n UNIQUE (guest_id)\n);\n\nCREATE TABLE Apartment_Bookings (\n apt_booking_id INTEGER NOT NULL PRIMARY KEY,\n apt_id INTEGER,\n guest_id INTEGER NOT NULL,\n booking_status_code CHAR(15) NOT NULL,\n booking_start_date DATETIME,\n booking_end_date DATETIME,\n UNIQUE (apt_booking_id),\n FOREIGN KEY (guest_id) REFERENCES Guests(guest_id),\n FOREIGN KEY (apt_id) REFERENCES Apartments(apt_id)\n);\n\nCREATE TABLE View_Unit_Status (\n apt_id INTEGER,\n apt_booking_id INTEGER,\n status_date DATETIME NOT NULL PRIMARY KEY,\n available_yn BIT,\n UNIQUE (status_date),\n FOREIGN KEY (apt_booking_id) REFERENCES Apartment_Bookings(apt_booking_id),\n FOREIGN KEY (apt_id) REFERENCES Apartments(apt_id)\n);",
"role": "user"
},
{
"content": "SELECT apt_type_code , COUNT(*) FROM Apartments GROUP BY apt_type_code ORDER BY COUNT(*) ASC",
"role": "assistant"
}
] |
apartment_rentals | [
{
"content": "Translate the following question to SQL: Return each apartment type code with the number of apartments having that apartment type, in ascending order of the number of apartments.\n\nSchema: CREATE TABLE Apartment_Buildings (\n building_id INTEGER NOT NULL PRIMARY KEY,\n building_short_name CHAR(15),\n building_full_name VARCHAR(80),\n building_description VARCHAR(255),\n building_address VARCHAR(255),\n building_manager VARCHAR(50),\n building_phone VARCHAR(80),\n UNIQUE (building_id)\n);\n\nCREATE TABLE Apartments (\n apt_id INTEGER NOT NULL PRIMARY KEY,\n building_id INTEGER NOT NULL,\n apt_type_code CHAR(15),\n apt_number CHAR(10),\n bathroom_count INTEGER,\n bedroom_count INTEGER,\n room_count CHAR(5),\n UNIQUE (apt_id),\n FOREIGN KEY (building_id) REFERENCES Apartment_Buildings(building_id)\n);\n\nCREATE TABLE Apartment_Facilities (\n apt_id INTEGER NOT NULL PRIMARY KEY,\n facility_code CHAR(15) NOT NULL PRIMARY KEY,\n PRIMARY KEY (apt_id, facility_code),\n UNIQUE (apt_id, facility_code),\n FOREIGN KEY (apt_id) REFERENCES Apartments(apt_id)\n);\n\nCREATE TABLE Guests (\n guest_id INTEGER NOT NULL PRIMARY KEY,\n gender_code CHAR(1),\n guest_first_name VARCHAR(80),\n guest_last_name VARCHAR(80),\n date_of_birth DATETIME,\n UNIQUE (guest_id)\n);\n\nCREATE TABLE Apartment_Bookings (\n apt_booking_id INTEGER NOT NULL PRIMARY KEY,\n apt_id INTEGER,\n guest_id INTEGER NOT NULL,\n booking_status_code CHAR(15) NOT NULL,\n booking_start_date DATETIME,\n booking_end_date DATETIME,\n UNIQUE (apt_booking_id),\n FOREIGN KEY (guest_id) REFERENCES Guests(guest_id),\n FOREIGN KEY (apt_id) REFERENCES Apartments(apt_id)\n);\n\nCREATE TABLE View_Unit_Status (\n apt_id INTEGER,\n apt_booking_id INTEGER,\n status_date DATETIME NOT NULL PRIMARY KEY,\n available_yn BIT,\n UNIQUE (status_date),\n FOREIGN KEY (apt_booking_id) REFERENCES Apartment_Bookings(apt_booking_id),\n FOREIGN KEY (apt_id) REFERENCES Apartments(apt_id)\n);",
"role": "user"
},
{
"content": "SELECT apt_type_code , COUNT(*) FROM Apartments GROUP BY apt_type_code ORDER BY COUNT(*) ASC",
"role": "assistant"
}
] |
apartment_rentals | [
{
"content": "Translate the following question to SQL: Show the top 3 apartment type codes sorted by the average number of rooms in descending order.\n\nSchema: CREATE TABLE Apartment_Buildings (\n building_id INTEGER NOT NULL PRIMARY KEY,\n building_short_name CHAR(15),\n building_full_name VARCHAR(80),\n building_description VARCHAR(255),\n building_address VARCHAR(255),\n building_manager VARCHAR(50),\n building_phone VARCHAR(80),\n UNIQUE (building_id)\n);\n\nCREATE TABLE Apartments (\n apt_id INTEGER NOT NULL PRIMARY KEY,\n building_id INTEGER NOT NULL,\n apt_type_code CHAR(15),\n apt_number CHAR(10),\n bathroom_count INTEGER,\n bedroom_count INTEGER,\n room_count CHAR(5),\n UNIQUE (apt_id),\n FOREIGN KEY (building_id) REFERENCES Apartment_Buildings(building_id)\n);\n\nCREATE TABLE Apartment_Facilities (\n apt_id INTEGER NOT NULL PRIMARY KEY,\n facility_code CHAR(15) NOT NULL PRIMARY KEY,\n PRIMARY KEY (apt_id, facility_code),\n UNIQUE (apt_id, facility_code),\n FOREIGN KEY (apt_id) REFERENCES Apartments(apt_id)\n);\n\nCREATE TABLE Guests (\n guest_id INTEGER NOT NULL PRIMARY KEY,\n gender_code CHAR(1),\n guest_first_name VARCHAR(80),\n guest_last_name VARCHAR(80),\n date_of_birth DATETIME,\n UNIQUE (guest_id)\n);\n\nCREATE TABLE Apartment_Bookings (\n apt_booking_id INTEGER NOT NULL PRIMARY KEY,\n apt_id INTEGER,\n guest_id INTEGER NOT NULL,\n booking_status_code CHAR(15) NOT NULL,\n booking_start_date DATETIME,\n booking_end_date DATETIME,\n UNIQUE (apt_booking_id),\n FOREIGN KEY (guest_id) REFERENCES Guests(guest_id),\n FOREIGN KEY (apt_id) REFERENCES Apartments(apt_id)\n);\n\nCREATE TABLE View_Unit_Status (\n apt_id INTEGER,\n apt_booking_id INTEGER,\n status_date DATETIME NOT NULL PRIMARY KEY,\n available_yn BIT,\n UNIQUE (status_date),\n FOREIGN KEY (apt_booking_id) REFERENCES Apartment_Bookings(apt_booking_id),\n FOREIGN KEY (apt_id) REFERENCES Apartments(apt_id)\n);",
"role": "user"
},
{
"content": "SELECT apt_type_code FROM Apartments GROUP BY apt_type_code ORDER BY avg(room_count) DESC LIMIT 3",
"role": "assistant"
}
] |
apartment_rentals | [
{
"content": "Translate the following question to SQL: What are the top three apartment types in terms of the average room count? Give me the\n\nSchema: CREATE TABLE Apartment_Buildings (\n building_id INTEGER NOT NULL PRIMARY KEY,\n building_short_name CHAR(15),\n building_full_name VARCHAR(80),\n building_description VARCHAR(255),\n building_address VARCHAR(255),\n building_manager VARCHAR(50),\n building_phone VARCHAR(80),\n UNIQUE (building_id)\n);\n\nCREATE TABLE Apartments (\n apt_id INTEGER NOT NULL PRIMARY KEY,\n building_id INTEGER NOT NULL,\n apt_type_code CHAR(15),\n apt_number CHAR(10),\n bathroom_count INTEGER,\n bedroom_count INTEGER,\n room_count CHAR(5),\n UNIQUE (apt_id),\n FOREIGN KEY (building_id) REFERENCES Apartment_Buildings(building_id)\n);\n\nCREATE TABLE Apartment_Facilities (\n apt_id INTEGER NOT NULL PRIMARY KEY,\n facility_code CHAR(15) NOT NULL PRIMARY KEY,\n PRIMARY KEY (apt_id, facility_code),\n UNIQUE (apt_id, facility_code),\n FOREIGN KEY (apt_id) REFERENCES Apartments(apt_id)\n);\n\nCREATE TABLE Guests (\n guest_id INTEGER NOT NULL PRIMARY KEY,\n gender_code CHAR(1),\n guest_first_name VARCHAR(80),\n guest_last_name VARCHAR(80),\n date_of_birth DATETIME,\n UNIQUE (guest_id)\n);\n\nCREATE TABLE Apartment_Bookings (\n apt_booking_id INTEGER NOT NULL PRIMARY KEY,\n apt_id INTEGER,\n guest_id INTEGER NOT NULL,\n booking_status_code CHAR(15) NOT NULL,\n booking_start_date DATETIME,\n booking_end_date DATETIME,\n UNIQUE (apt_booking_id),\n FOREIGN KEY (guest_id) REFERENCES Guests(guest_id),\n FOREIGN KEY (apt_id) REFERENCES Apartments(apt_id)\n);\n\nCREATE TABLE View_Unit_Status (\n apt_id INTEGER,\n apt_booking_id INTEGER,\n status_date DATETIME NOT NULL PRIMARY KEY,\n available_yn BIT,\n UNIQUE (status_date),\n FOREIGN KEY (apt_booking_id) REFERENCES Apartment_Bookings(apt_booking_id),\n FOREIGN KEY (apt_id) REFERENCES Apartments(apt_id)\n);",
"role": "user"
},
{
"content": "SELECT apt_type_code FROM Apartments GROUP BY apt_type_code ORDER BY avg(room_count) DESC LIMIT 3",
"role": "assistant"
}
] |
apartment_rentals | [
{
"content": "Translate the following question to SQL: Show the apartment type code that has the largest number of total rooms, together with the number of bathrooms and number of bedrooms.\n\nSchema: CREATE TABLE Apartment_Buildings (\n building_id INTEGER NOT NULL PRIMARY KEY,\n building_short_name CHAR(15),\n building_full_name VARCHAR(80),\n building_description VARCHAR(255),\n building_address VARCHAR(255),\n building_manager VARCHAR(50),\n building_phone VARCHAR(80),\n UNIQUE (building_id)\n);\n\nCREATE TABLE Apartments (\n apt_id INTEGER NOT NULL PRIMARY KEY,\n building_id INTEGER NOT NULL,\n apt_type_code CHAR(15),\n apt_number CHAR(10),\n bathroom_count INTEGER,\n bedroom_count INTEGER,\n room_count CHAR(5),\n UNIQUE (apt_id),\n FOREIGN KEY (building_id) REFERENCES Apartment_Buildings(building_id)\n);\n\nCREATE TABLE Apartment_Facilities (\n apt_id INTEGER NOT NULL PRIMARY KEY,\n facility_code CHAR(15) NOT NULL PRIMARY KEY,\n PRIMARY KEY (apt_id, facility_code),\n UNIQUE (apt_id, facility_code),\n FOREIGN KEY (apt_id) REFERENCES Apartments(apt_id)\n);\n\nCREATE TABLE Guests (\n guest_id INTEGER NOT NULL PRIMARY KEY,\n gender_code CHAR(1),\n guest_first_name VARCHAR(80),\n guest_last_name VARCHAR(80),\n date_of_birth DATETIME,\n UNIQUE (guest_id)\n);\n\nCREATE TABLE Apartment_Bookings (\n apt_booking_id INTEGER NOT NULL PRIMARY KEY,\n apt_id INTEGER,\n guest_id INTEGER NOT NULL,\n booking_status_code CHAR(15) NOT NULL,\n booking_start_date DATETIME,\n booking_end_date DATETIME,\n UNIQUE (apt_booking_id),\n FOREIGN KEY (guest_id) REFERENCES Guests(guest_id),\n FOREIGN KEY (apt_id) REFERENCES Apartments(apt_id)\n);\n\nCREATE TABLE View_Unit_Status (\n apt_id INTEGER,\n apt_booking_id INTEGER,\n status_date DATETIME NOT NULL PRIMARY KEY,\n available_yn BIT,\n UNIQUE (status_date),\n FOREIGN KEY (apt_booking_id) REFERENCES Apartment_Bookings(apt_booking_id),\n FOREIGN KEY (apt_id) REFERENCES Apartments(apt_id)\n);",
"role": "user"
},
{
"content": "SELECT apt_type_code , bathroom_count , bedroom_count FROM Apartments GROUP BY apt_type_code ORDER BY sum(room_count) DESC LIMIT 1",
"role": "assistant"
}
] |
apartment_rentals | [
{
"content": "Translate the following question to SQL: Which apartment type has the largest number of total rooms? Return the apartment type code, its number of bathrooms and number of bedrooms.\n\nSchema: CREATE TABLE Apartment_Buildings (\n building_id INTEGER NOT NULL PRIMARY KEY,\n building_short_name CHAR(15),\n building_full_name VARCHAR(80),\n building_description VARCHAR(255),\n building_address VARCHAR(255),\n building_manager VARCHAR(50),\n building_phone VARCHAR(80),\n UNIQUE (building_id)\n);\n\nCREATE TABLE Apartments (\n apt_id INTEGER NOT NULL PRIMARY KEY,\n building_id INTEGER NOT NULL,\n apt_type_code CHAR(15),\n apt_number CHAR(10),\n bathroom_count INTEGER,\n bedroom_count INTEGER,\n room_count CHAR(5),\n UNIQUE (apt_id),\n FOREIGN KEY (building_id) REFERENCES Apartment_Buildings(building_id)\n);\n\nCREATE TABLE Apartment_Facilities (\n apt_id INTEGER NOT NULL PRIMARY KEY,\n facility_code CHAR(15) NOT NULL PRIMARY KEY,\n PRIMARY KEY (apt_id, facility_code),\n UNIQUE (apt_id, facility_code),\n FOREIGN KEY (apt_id) REFERENCES Apartments(apt_id)\n);\n\nCREATE TABLE Guests (\n guest_id INTEGER NOT NULL PRIMARY KEY,\n gender_code CHAR(1),\n guest_first_name VARCHAR(80),\n guest_last_name VARCHAR(80),\n date_of_birth DATETIME,\n UNIQUE (guest_id)\n);\n\nCREATE TABLE Apartment_Bookings (\n apt_booking_id INTEGER NOT NULL PRIMARY KEY,\n apt_id INTEGER,\n guest_id INTEGER NOT NULL,\n booking_status_code CHAR(15) NOT NULL,\n booking_start_date DATETIME,\n booking_end_date DATETIME,\n UNIQUE (apt_booking_id),\n FOREIGN KEY (guest_id) REFERENCES Guests(guest_id),\n FOREIGN KEY (apt_id) REFERENCES Apartments(apt_id)\n);\n\nCREATE TABLE View_Unit_Status (\n apt_id INTEGER,\n apt_booking_id INTEGER,\n status_date DATETIME NOT NULL PRIMARY KEY,\n available_yn BIT,\n UNIQUE (status_date),\n FOREIGN KEY (apt_booking_id) REFERENCES Apartment_Bookings(apt_booking_id),\n FOREIGN KEY (apt_id) REFERENCES Apartments(apt_id)\n);",
"role": "user"
},
{
"content": "SELECT apt_type_code , bathroom_count , bedroom_count FROM Apartments GROUP BY apt_type_code ORDER BY sum(room_count) DESC LIMIT 1",
"role": "assistant"
}
] |
apartment_rentals | [
{
"content": "Translate the following question to SQL: Show the most common apartment type code.\n\nSchema: CREATE TABLE Apartment_Buildings (\n building_id INTEGER NOT NULL PRIMARY KEY,\n building_short_name CHAR(15),\n building_full_name VARCHAR(80),\n building_description VARCHAR(255),\n building_address VARCHAR(255),\n building_manager VARCHAR(50),\n building_phone VARCHAR(80),\n UNIQUE (building_id)\n);\n\nCREATE TABLE Apartments (\n apt_id INTEGER NOT NULL PRIMARY KEY,\n building_id INTEGER NOT NULL,\n apt_type_code CHAR(15),\n apt_number CHAR(10),\n bathroom_count INTEGER,\n bedroom_count INTEGER,\n room_count CHAR(5),\n UNIQUE (apt_id),\n FOREIGN KEY (building_id) REFERENCES Apartment_Buildings(building_id)\n);\n\nCREATE TABLE Apartment_Facilities (\n apt_id INTEGER NOT NULL PRIMARY KEY,\n facility_code CHAR(15) NOT NULL PRIMARY KEY,\n PRIMARY KEY (apt_id, facility_code),\n UNIQUE (apt_id, facility_code),\n FOREIGN KEY (apt_id) REFERENCES Apartments(apt_id)\n);\n\nCREATE TABLE Guests (\n guest_id INTEGER NOT NULL PRIMARY KEY,\n gender_code CHAR(1),\n guest_first_name VARCHAR(80),\n guest_last_name VARCHAR(80),\n date_of_birth DATETIME,\n UNIQUE (guest_id)\n);\n\nCREATE TABLE Apartment_Bookings (\n apt_booking_id INTEGER NOT NULL PRIMARY KEY,\n apt_id INTEGER,\n guest_id INTEGER NOT NULL,\n booking_status_code CHAR(15) NOT NULL,\n booking_start_date DATETIME,\n booking_end_date DATETIME,\n UNIQUE (apt_booking_id),\n FOREIGN KEY (guest_id) REFERENCES Guests(guest_id),\n FOREIGN KEY (apt_id) REFERENCES Apartments(apt_id)\n);\n\nCREATE TABLE View_Unit_Status (\n apt_id INTEGER,\n apt_booking_id INTEGER,\n status_date DATETIME NOT NULL PRIMARY KEY,\n available_yn BIT,\n UNIQUE (status_date),\n FOREIGN KEY (apt_booking_id) REFERENCES Apartment_Bookings(apt_booking_id),\n FOREIGN KEY (apt_id) REFERENCES Apartments(apt_id)\n);",
"role": "user"
},
{
"content": "SELECT apt_type_code FROM Apartments GROUP BY apt_type_code ORDER BY count(*) DESC LIMIT 1",
"role": "assistant"
}
] |
apartment_rentals | [
{
"content": "Translate the following question to SQL: Which apartment type code appears the most often?\n\nSchema: CREATE TABLE Apartment_Buildings (\n building_id INTEGER NOT NULL PRIMARY KEY,\n building_short_name CHAR(15),\n building_full_name VARCHAR(80),\n building_description VARCHAR(255),\n building_address VARCHAR(255),\n building_manager VARCHAR(50),\n building_phone VARCHAR(80),\n UNIQUE (building_id)\n);\n\nCREATE TABLE Apartments (\n apt_id INTEGER NOT NULL PRIMARY KEY,\n building_id INTEGER NOT NULL,\n apt_type_code CHAR(15),\n apt_number CHAR(10),\n bathroom_count INTEGER,\n bedroom_count INTEGER,\n room_count CHAR(5),\n UNIQUE (apt_id),\n FOREIGN KEY (building_id) REFERENCES Apartment_Buildings(building_id)\n);\n\nCREATE TABLE Apartment_Facilities (\n apt_id INTEGER NOT NULL PRIMARY KEY,\n facility_code CHAR(15) NOT NULL PRIMARY KEY,\n PRIMARY KEY (apt_id, facility_code),\n UNIQUE (apt_id, facility_code),\n FOREIGN KEY (apt_id) REFERENCES Apartments(apt_id)\n);\n\nCREATE TABLE Guests (\n guest_id INTEGER NOT NULL PRIMARY KEY,\n gender_code CHAR(1),\n guest_first_name VARCHAR(80),\n guest_last_name VARCHAR(80),\n date_of_birth DATETIME,\n UNIQUE (guest_id)\n);\n\nCREATE TABLE Apartment_Bookings (\n apt_booking_id INTEGER NOT NULL PRIMARY KEY,\n apt_id INTEGER,\n guest_id INTEGER NOT NULL,\n booking_status_code CHAR(15) NOT NULL,\n booking_start_date DATETIME,\n booking_end_date DATETIME,\n UNIQUE (apt_booking_id),\n FOREIGN KEY (guest_id) REFERENCES Guests(guest_id),\n FOREIGN KEY (apt_id) REFERENCES Apartments(apt_id)\n);\n\nCREATE TABLE View_Unit_Status (\n apt_id INTEGER,\n apt_booking_id INTEGER,\n status_date DATETIME NOT NULL PRIMARY KEY,\n available_yn BIT,\n UNIQUE (status_date),\n FOREIGN KEY (apt_booking_id) REFERENCES Apartment_Bookings(apt_booking_id),\n FOREIGN KEY (apt_id) REFERENCES Apartments(apt_id)\n);",
"role": "user"
},
{
"content": "SELECT apt_type_code FROM Apartments GROUP BY apt_type_code ORDER BY count(*) DESC LIMIT 1",
"role": "assistant"
}
] |
apartment_rentals | [
{
"content": "Translate the following question to SQL: Show the most common apartment type code among apartments with more than 1 bathroom.\n\nSchema: CREATE TABLE Apartment_Buildings (\n building_id INTEGER NOT NULL PRIMARY KEY,\n building_short_name CHAR(15),\n building_full_name VARCHAR(80),\n building_description VARCHAR(255),\n building_address VARCHAR(255),\n building_manager VARCHAR(50),\n building_phone VARCHAR(80),\n UNIQUE (building_id)\n);\n\nCREATE TABLE Apartments (\n apt_id INTEGER NOT NULL PRIMARY KEY,\n building_id INTEGER NOT NULL,\n apt_type_code CHAR(15),\n apt_number CHAR(10),\n bathroom_count INTEGER,\n bedroom_count INTEGER,\n room_count CHAR(5),\n UNIQUE (apt_id),\n FOREIGN KEY (building_id) REFERENCES Apartment_Buildings(building_id)\n);\n\nCREATE TABLE Apartment_Facilities (\n apt_id INTEGER NOT NULL PRIMARY KEY,\n facility_code CHAR(15) NOT NULL PRIMARY KEY,\n PRIMARY KEY (apt_id, facility_code),\n UNIQUE (apt_id, facility_code),\n FOREIGN KEY (apt_id) REFERENCES Apartments(apt_id)\n);\n\nCREATE TABLE Guests (\n guest_id INTEGER NOT NULL PRIMARY KEY,\n gender_code CHAR(1),\n guest_first_name VARCHAR(80),\n guest_last_name VARCHAR(80),\n date_of_birth DATETIME,\n UNIQUE (guest_id)\n);\n\nCREATE TABLE Apartment_Bookings (\n apt_booking_id INTEGER NOT NULL PRIMARY KEY,\n apt_id INTEGER,\n guest_id INTEGER NOT NULL,\n booking_status_code CHAR(15) NOT NULL,\n booking_start_date DATETIME,\n booking_end_date DATETIME,\n UNIQUE (apt_booking_id),\n FOREIGN KEY (guest_id) REFERENCES Guests(guest_id),\n FOREIGN KEY (apt_id) REFERENCES Apartments(apt_id)\n);\n\nCREATE TABLE View_Unit_Status (\n apt_id INTEGER,\n apt_booking_id INTEGER,\n status_date DATETIME NOT NULL PRIMARY KEY,\n available_yn BIT,\n UNIQUE (status_date),\n FOREIGN KEY (apt_booking_id) REFERENCES Apartment_Bookings(apt_booking_id),\n FOREIGN KEY (apt_id) REFERENCES Apartments(apt_id)\n);",
"role": "user"
},
{
"content": "SELECT apt_type_code FROM Apartments WHERE bathroom_count > 1 GROUP BY apt_type_code ORDER BY count(*) DESC LIMIT 1",
"role": "assistant"
}
] |
apartment_rentals | [
{
"content": "Translate the following question to SQL: Which apartment type code is the most common among apartments with more than one bathroom?\n\nSchema: CREATE TABLE Apartment_Buildings (\n building_id INTEGER NOT NULL PRIMARY KEY,\n building_short_name CHAR(15),\n building_full_name VARCHAR(80),\n building_description VARCHAR(255),\n building_address VARCHAR(255),\n building_manager VARCHAR(50),\n building_phone VARCHAR(80),\n UNIQUE (building_id)\n);\n\nCREATE TABLE Apartments (\n apt_id INTEGER NOT NULL PRIMARY KEY,\n building_id INTEGER NOT NULL,\n apt_type_code CHAR(15),\n apt_number CHAR(10),\n bathroom_count INTEGER,\n bedroom_count INTEGER,\n room_count CHAR(5),\n UNIQUE (apt_id),\n FOREIGN KEY (building_id) REFERENCES Apartment_Buildings(building_id)\n);\n\nCREATE TABLE Apartment_Facilities (\n apt_id INTEGER NOT NULL PRIMARY KEY,\n facility_code CHAR(15) NOT NULL PRIMARY KEY,\n PRIMARY KEY (apt_id, facility_code),\n UNIQUE (apt_id, facility_code),\n FOREIGN KEY (apt_id) REFERENCES Apartments(apt_id)\n);\n\nCREATE TABLE Guests (\n guest_id INTEGER NOT NULL PRIMARY KEY,\n gender_code CHAR(1),\n guest_first_name VARCHAR(80),\n guest_last_name VARCHAR(80),\n date_of_birth DATETIME,\n UNIQUE (guest_id)\n);\n\nCREATE TABLE Apartment_Bookings (\n apt_booking_id INTEGER NOT NULL PRIMARY KEY,\n apt_id INTEGER,\n guest_id INTEGER NOT NULL,\n booking_status_code CHAR(15) NOT NULL,\n booking_start_date DATETIME,\n booking_end_date DATETIME,\n UNIQUE (apt_booking_id),\n FOREIGN KEY (guest_id) REFERENCES Guests(guest_id),\n FOREIGN KEY (apt_id) REFERENCES Apartments(apt_id)\n);\n\nCREATE TABLE View_Unit_Status (\n apt_id INTEGER,\n apt_booking_id INTEGER,\n status_date DATETIME NOT NULL PRIMARY KEY,\n available_yn BIT,\n UNIQUE (status_date),\n FOREIGN KEY (apt_booking_id) REFERENCES Apartment_Bookings(apt_booking_id),\n FOREIGN KEY (apt_id) REFERENCES Apartments(apt_id)\n);",
"role": "user"
},
{
"content": "SELECT apt_type_code FROM Apartments WHERE bathroom_count > 1 GROUP BY apt_type_code ORDER BY count(*) DESC LIMIT 1",
"role": "assistant"
}
] |
apartment_rentals | [
{
"content": "Translate the following question to SQL: Show each apartment type code, and the maximum and minimum number of rooms for each type.\n\nSchema: CREATE TABLE Apartment_Buildings (\n building_id INTEGER NOT NULL PRIMARY KEY,\n building_short_name CHAR(15),\n building_full_name VARCHAR(80),\n building_description VARCHAR(255),\n building_address VARCHAR(255),\n building_manager VARCHAR(50),\n building_phone VARCHAR(80),\n UNIQUE (building_id)\n);\n\nCREATE TABLE Apartments (\n apt_id INTEGER NOT NULL PRIMARY KEY,\n building_id INTEGER NOT NULL,\n apt_type_code CHAR(15),\n apt_number CHAR(10),\n bathroom_count INTEGER,\n bedroom_count INTEGER,\n room_count CHAR(5),\n UNIQUE (apt_id),\n FOREIGN KEY (building_id) REFERENCES Apartment_Buildings(building_id)\n);\n\nCREATE TABLE Apartment_Facilities (\n apt_id INTEGER NOT NULL PRIMARY KEY,\n facility_code CHAR(15) NOT NULL PRIMARY KEY,\n PRIMARY KEY (apt_id, facility_code),\n UNIQUE (apt_id, facility_code),\n FOREIGN KEY (apt_id) REFERENCES Apartments(apt_id)\n);\n\nCREATE TABLE Guests (\n guest_id INTEGER NOT NULL PRIMARY KEY,\n gender_code CHAR(1),\n guest_first_name VARCHAR(80),\n guest_last_name VARCHAR(80),\n date_of_birth DATETIME,\n UNIQUE (guest_id)\n);\n\nCREATE TABLE Apartment_Bookings (\n apt_booking_id INTEGER NOT NULL PRIMARY KEY,\n apt_id INTEGER,\n guest_id INTEGER NOT NULL,\n booking_status_code CHAR(15) NOT NULL,\n booking_start_date DATETIME,\n booking_end_date DATETIME,\n UNIQUE (apt_booking_id),\n FOREIGN KEY (guest_id) REFERENCES Guests(guest_id),\n FOREIGN KEY (apt_id) REFERENCES Apartments(apt_id)\n);\n\nCREATE TABLE View_Unit_Status (\n apt_id INTEGER,\n apt_booking_id INTEGER,\n status_date DATETIME NOT NULL PRIMARY KEY,\n available_yn BIT,\n UNIQUE (status_date),\n FOREIGN KEY (apt_booking_id) REFERENCES Apartment_Bookings(apt_booking_id),\n FOREIGN KEY (apt_id) REFERENCES Apartments(apt_id)\n);",
"role": "user"
},
{
"content": "SELECT apt_type_code , max(room_count) , min(room_count) FROM Apartments GROUP BY apt_type_code",
"role": "assistant"
}
] |
apartment_rentals | [
{
"content": "Translate the following question to SQL: Return each apartment type code along with the maximum and minimum number of rooms among each type.\n\nSchema: CREATE TABLE Apartment_Buildings (\n building_id INTEGER NOT NULL PRIMARY KEY,\n building_short_name CHAR(15),\n building_full_name VARCHAR(80),\n building_description VARCHAR(255),\n building_address VARCHAR(255),\n building_manager VARCHAR(50),\n building_phone VARCHAR(80),\n UNIQUE (building_id)\n);\n\nCREATE TABLE Apartments (\n apt_id INTEGER NOT NULL PRIMARY KEY,\n building_id INTEGER NOT NULL,\n apt_type_code CHAR(15),\n apt_number CHAR(10),\n bathroom_count INTEGER,\n bedroom_count INTEGER,\n room_count CHAR(5),\n UNIQUE (apt_id),\n FOREIGN KEY (building_id) REFERENCES Apartment_Buildings(building_id)\n);\n\nCREATE TABLE Apartment_Facilities (\n apt_id INTEGER NOT NULL PRIMARY KEY,\n facility_code CHAR(15) NOT NULL PRIMARY KEY,\n PRIMARY KEY (apt_id, facility_code),\n UNIQUE (apt_id, facility_code),\n FOREIGN KEY (apt_id) REFERENCES Apartments(apt_id)\n);\n\nCREATE TABLE Guests (\n guest_id INTEGER NOT NULL PRIMARY KEY,\n gender_code CHAR(1),\n guest_first_name VARCHAR(80),\n guest_last_name VARCHAR(80),\n date_of_birth DATETIME,\n UNIQUE (guest_id)\n);\n\nCREATE TABLE Apartment_Bookings (\n apt_booking_id INTEGER NOT NULL PRIMARY KEY,\n apt_id INTEGER,\n guest_id INTEGER NOT NULL,\n booking_status_code CHAR(15) NOT NULL,\n booking_start_date DATETIME,\n booking_end_date DATETIME,\n UNIQUE (apt_booking_id),\n FOREIGN KEY (guest_id) REFERENCES Guests(guest_id),\n FOREIGN KEY (apt_id) REFERENCES Apartments(apt_id)\n);\n\nCREATE TABLE View_Unit_Status (\n apt_id INTEGER,\n apt_booking_id INTEGER,\n status_date DATETIME NOT NULL PRIMARY KEY,\n available_yn BIT,\n UNIQUE (status_date),\n FOREIGN KEY (apt_booking_id) REFERENCES Apartment_Bookings(apt_booking_id),\n FOREIGN KEY (apt_id) REFERENCES Apartments(apt_id)\n);",
"role": "user"
},
{
"content": "SELECT apt_type_code , max(room_count) , min(room_count) FROM Apartments GROUP BY apt_type_code",
"role": "assistant"
}
] |
apartment_rentals | [
{
"content": "Translate the following question to SQL: Show each gender code and the corresponding count of guests sorted by the count in descending order.\n\nSchema: CREATE TABLE Apartment_Buildings (\n building_id INTEGER NOT NULL PRIMARY KEY,\n building_short_name CHAR(15),\n building_full_name VARCHAR(80),\n building_description VARCHAR(255),\n building_address VARCHAR(255),\n building_manager VARCHAR(50),\n building_phone VARCHAR(80),\n UNIQUE (building_id)\n);\n\nCREATE TABLE Apartments (\n apt_id INTEGER NOT NULL PRIMARY KEY,\n building_id INTEGER NOT NULL,\n apt_type_code CHAR(15),\n apt_number CHAR(10),\n bathroom_count INTEGER,\n bedroom_count INTEGER,\n room_count CHAR(5),\n UNIQUE (apt_id),\n FOREIGN KEY (building_id) REFERENCES Apartment_Buildings(building_id)\n);\n\nCREATE TABLE Apartment_Facilities (\n apt_id INTEGER NOT NULL PRIMARY KEY,\n facility_code CHAR(15) NOT NULL PRIMARY KEY,\n PRIMARY KEY (apt_id, facility_code),\n UNIQUE (apt_id, facility_code),\n FOREIGN KEY (apt_id) REFERENCES Apartments(apt_id)\n);\n\nCREATE TABLE Guests (\n guest_id INTEGER NOT NULL PRIMARY KEY,\n gender_code CHAR(1),\n guest_first_name VARCHAR(80),\n guest_last_name VARCHAR(80),\n date_of_birth DATETIME,\n UNIQUE (guest_id)\n);\n\nCREATE TABLE Apartment_Bookings (\n apt_booking_id INTEGER NOT NULL PRIMARY KEY,\n apt_id INTEGER,\n guest_id INTEGER NOT NULL,\n booking_status_code CHAR(15) NOT NULL,\n booking_start_date DATETIME,\n booking_end_date DATETIME,\n UNIQUE (apt_booking_id),\n FOREIGN KEY (guest_id) REFERENCES Guests(guest_id),\n FOREIGN KEY (apt_id) REFERENCES Apartments(apt_id)\n);\n\nCREATE TABLE View_Unit_Status (\n apt_id INTEGER,\n apt_booking_id INTEGER,\n status_date DATETIME NOT NULL PRIMARY KEY,\n available_yn BIT,\n UNIQUE (status_date),\n FOREIGN KEY (apt_booking_id) REFERENCES Apartment_Bookings(apt_booking_id),\n FOREIGN KEY (apt_id) REFERENCES Apartments(apt_id)\n);",
"role": "user"
},
{
"content": "SELECT gender_code , COUNT(*) FROM Guests GROUP BY gender_code ORDER BY COUNT(*) DESC",
"role": "assistant"
}
] |
apartment_rentals | [
{
"content": "Translate the following question to SQL: Sort the gender codes in descending order of their corresponding number of guests. Return both the gender codes and counts.\n\nSchema: CREATE TABLE Apartment_Buildings (\n building_id INTEGER NOT NULL PRIMARY KEY,\n building_short_name CHAR(15),\n building_full_name VARCHAR(80),\n building_description VARCHAR(255),\n building_address VARCHAR(255),\n building_manager VARCHAR(50),\n building_phone VARCHAR(80),\n UNIQUE (building_id)\n);\n\nCREATE TABLE Apartments (\n apt_id INTEGER NOT NULL PRIMARY KEY,\n building_id INTEGER NOT NULL,\n apt_type_code CHAR(15),\n apt_number CHAR(10),\n bathroom_count INTEGER,\n bedroom_count INTEGER,\n room_count CHAR(5),\n UNIQUE (apt_id),\n FOREIGN KEY (building_id) REFERENCES Apartment_Buildings(building_id)\n);\n\nCREATE TABLE Apartment_Facilities (\n apt_id INTEGER NOT NULL PRIMARY KEY,\n facility_code CHAR(15) NOT NULL PRIMARY KEY,\n PRIMARY KEY (apt_id, facility_code),\n UNIQUE (apt_id, facility_code),\n FOREIGN KEY (apt_id) REFERENCES Apartments(apt_id)\n);\n\nCREATE TABLE Guests (\n guest_id INTEGER NOT NULL PRIMARY KEY,\n gender_code CHAR(1),\n guest_first_name VARCHAR(80),\n guest_last_name VARCHAR(80),\n date_of_birth DATETIME,\n UNIQUE (guest_id)\n);\n\nCREATE TABLE Apartment_Bookings (\n apt_booking_id INTEGER NOT NULL PRIMARY KEY,\n apt_id INTEGER,\n guest_id INTEGER NOT NULL,\n booking_status_code CHAR(15) NOT NULL,\n booking_start_date DATETIME,\n booking_end_date DATETIME,\n UNIQUE (apt_booking_id),\n FOREIGN KEY (guest_id) REFERENCES Guests(guest_id),\n FOREIGN KEY (apt_id) REFERENCES Apartments(apt_id)\n);\n\nCREATE TABLE View_Unit_Status (\n apt_id INTEGER,\n apt_booking_id INTEGER,\n status_date DATETIME NOT NULL PRIMARY KEY,\n available_yn BIT,\n UNIQUE (status_date),\n FOREIGN KEY (apt_booking_id) REFERENCES Apartment_Bookings(apt_booking_id),\n FOREIGN KEY (apt_id) REFERENCES Apartments(apt_id)\n);",
"role": "user"
},
{
"content": "SELECT gender_code , COUNT(*) FROM Guests GROUP BY gender_code ORDER BY COUNT(*) DESC",
"role": "assistant"
}
] |
apartment_rentals | [
{
"content": "Translate the following question to SQL: How many apartments do not have any facility?\n\nSchema: CREATE TABLE Apartment_Buildings (\n building_id INTEGER NOT NULL PRIMARY KEY,\n building_short_name CHAR(15),\n building_full_name VARCHAR(80),\n building_description VARCHAR(255),\n building_address VARCHAR(255),\n building_manager VARCHAR(50),\n building_phone VARCHAR(80),\n UNIQUE (building_id)\n);\n\nCREATE TABLE Apartments (\n apt_id INTEGER NOT NULL PRIMARY KEY,\n building_id INTEGER NOT NULL,\n apt_type_code CHAR(15),\n apt_number CHAR(10),\n bathroom_count INTEGER,\n bedroom_count INTEGER,\n room_count CHAR(5),\n UNIQUE (apt_id),\n FOREIGN KEY (building_id) REFERENCES Apartment_Buildings(building_id)\n);\n\nCREATE TABLE Apartment_Facilities (\n apt_id INTEGER NOT NULL PRIMARY KEY,\n facility_code CHAR(15) NOT NULL PRIMARY KEY,\n PRIMARY KEY (apt_id, facility_code),\n UNIQUE (apt_id, facility_code),\n FOREIGN KEY (apt_id) REFERENCES Apartments(apt_id)\n);\n\nCREATE TABLE Guests (\n guest_id INTEGER NOT NULL PRIMARY KEY,\n gender_code CHAR(1),\n guest_first_name VARCHAR(80),\n guest_last_name VARCHAR(80),\n date_of_birth DATETIME,\n UNIQUE (guest_id)\n);\n\nCREATE TABLE Apartment_Bookings (\n apt_booking_id INTEGER NOT NULL PRIMARY KEY,\n apt_id INTEGER,\n guest_id INTEGER NOT NULL,\n booking_status_code CHAR(15) NOT NULL,\n booking_start_date DATETIME,\n booking_end_date DATETIME,\n UNIQUE (apt_booking_id),\n FOREIGN KEY (guest_id) REFERENCES Guests(guest_id),\n FOREIGN KEY (apt_id) REFERENCES Apartments(apt_id)\n);\n\nCREATE TABLE View_Unit_Status (\n apt_id INTEGER,\n apt_booking_id INTEGER,\n status_date DATETIME NOT NULL PRIMARY KEY,\n available_yn BIT,\n UNIQUE (status_date),\n FOREIGN KEY (apt_booking_id) REFERENCES Apartment_Bookings(apt_booking_id),\n FOREIGN KEY (apt_id) REFERENCES Apartments(apt_id)\n);",
"role": "user"
},
{
"content": "SELECT count(*) FROM Apartments WHERE apt_id NOT IN (SELECT apt_id FROM Apartment_Facilities)",
"role": "assistant"
}
] |
apartment_rentals | [
{
"content": "Translate the following question to SQL: Find the number of apartments that have no facility.\n\nSchema: CREATE TABLE Apartment_Buildings (\n building_id INTEGER NOT NULL PRIMARY KEY,\n building_short_name CHAR(15),\n building_full_name VARCHAR(80),\n building_description VARCHAR(255),\n building_address VARCHAR(255),\n building_manager VARCHAR(50),\n building_phone VARCHAR(80),\n UNIQUE (building_id)\n);\n\nCREATE TABLE Apartments (\n apt_id INTEGER NOT NULL PRIMARY KEY,\n building_id INTEGER NOT NULL,\n apt_type_code CHAR(15),\n apt_number CHAR(10),\n bathroom_count INTEGER,\n bedroom_count INTEGER,\n room_count CHAR(5),\n UNIQUE (apt_id),\n FOREIGN KEY (building_id) REFERENCES Apartment_Buildings(building_id)\n);\n\nCREATE TABLE Apartment_Facilities (\n apt_id INTEGER NOT NULL PRIMARY KEY,\n facility_code CHAR(15) NOT NULL PRIMARY KEY,\n PRIMARY KEY (apt_id, facility_code),\n UNIQUE (apt_id, facility_code),\n FOREIGN KEY (apt_id) REFERENCES Apartments(apt_id)\n);\n\nCREATE TABLE Guests (\n guest_id INTEGER NOT NULL PRIMARY KEY,\n gender_code CHAR(1),\n guest_first_name VARCHAR(80),\n guest_last_name VARCHAR(80),\n date_of_birth DATETIME,\n UNIQUE (guest_id)\n);\n\nCREATE TABLE Apartment_Bookings (\n apt_booking_id INTEGER NOT NULL PRIMARY KEY,\n apt_id INTEGER,\n guest_id INTEGER NOT NULL,\n booking_status_code CHAR(15) NOT NULL,\n booking_start_date DATETIME,\n booking_end_date DATETIME,\n UNIQUE (apt_booking_id),\n FOREIGN KEY (guest_id) REFERENCES Guests(guest_id),\n FOREIGN KEY (apt_id) REFERENCES Apartments(apt_id)\n);\n\nCREATE TABLE View_Unit_Status (\n apt_id INTEGER,\n apt_booking_id INTEGER,\n status_date DATETIME NOT NULL PRIMARY KEY,\n available_yn BIT,\n UNIQUE (status_date),\n FOREIGN KEY (apt_booking_id) REFERENCES Apartment_Bookings(apt_booking_id),\n FOREIGN KEY (apt_id) REFERENCES Apartments(apt_id)\n);",
"role": "user"
},
{
"content": "SELECT count(*) FROM Apartments WHERE apt_id NOT IN (SELECT apt_id FROM Apartment_Facilities)",
"role": "assistant"
}
] |
apartment_rentals | [
{
"content": "Translate the following question to SQL: Show the apartment numbers of apartments with bookings that have status code both \"Provisional\" and \"Confirmed\"\n\nSchema: CREATE TABLE Apartment_Buildings (\n building_id INTEGER NOT NULL PRIMARY KEY,\n building_short_name CHAR(15),\n building_full_name VARCHAR(80),\n building_description VARCHAR(255),\n building_address VARCHAR(255),\n building_manager VARCHAR(50),\n building_phone VARCHAR(80),\n UNIQUE (building_id)\n);\n\nCREATE TABLE Apartments (\n apt_id INTEGER NOT NULL PRIMARY KEY,\n building_id INTEGER NOT NULL,\n apt_type_code CHAR(15),\n apt_number CHAR(10),\n bathroom_count INTEGER,\n bedroom_count INTEGER,\n room_count CHAR(5),\n UNIQUE (apt_id),\n FOREIGN KEY (building_id) REFERENCES Apartment_Buildings(building_id)\n);\n\nCREATE TABLE Apartment_Facilities (\n apt_id INTEGER NOT NULL PRIMARY KEY,\n facility_code CHAR(15) NOT NULL PRIMARY KEY,\n PRIMARY KEY (apt_id, facility_code),\n UNIQUE (apt_id, facility_code),\n FOREIGN KEY (apt_id) REFERENCES Apartments(apt_id)\n);\n\nCREATE TABLE Guests (\n guest_id INTEGER NOT NULL PRIMARY KEY,\n gender_code CHAR(1),\n guest_first_name VARCHAR(80),\n guest_last_name VARCHAR(80),\n date_of_birth DATETIME,\n UNIQUE (guest_id)\n);\n\nCREATE TABLE Apartment_Bookings (\n apt_booking_id INTEGER NOT NULL PRIMARY KEY,\n apt_id INTEGER,\n guest_id INTEGER NOT NULL,\n booking_status_code CHAR(15) NOT NULL,\n booking_start_date DATETIME,\n booking_end_date DATETIME,\n UNIQUE (apt_booking_id),\n FOREIGN KEY (guest_id) REFERENCES Guests(guest_id),\n FOREIGN KEY (apt_id) REFERENCES Apartments(apt_id)\n);\n\nCREATE TABLE View_Unit_Status (\n apt_id INTEGER,\n apt_booking_id INTEGER,\n status_date DATETIME NOT NULL PRIMARY KEY,\n available_yn BIT,\n UNIQUE (status_date),\n FOREIGN KEY (apt_booking_id) REFERENCES Apartment_Bookings(apt_booking_id),\n FOREIGN KEY (apt_id) REFERENCES Apartments(apt_id)\n);",
"role": "user"
},
{
"content": "SELECT T2.apt_number FROM Apartment_Bookings AS T1 JOIN Apartments AS T2 ON T1.apt_id = T2.apt_id WHERE T1.booking_status_code = \"Confirmed\" INTERSECT SELECT T2.apt_number FROM Apartment_Bookings AS T1 JOIN Apartments AS T2 ON T1.apt_id = T2.apt_id WHERE T1.booking_status_code = \"Provisional\"",
"role": "assistant"
}
] |
apartment_rentals | [
{
"content": "Translate the following question to SQL: Which apartments have bookings with both status codes \"Provisional\" and \"Confirmed\"? Give me the apartment numbers.\n\nSchema: CREATE TABLE Apartment_Buildings (\n building_id INTEGER NOT NULL PRIMARY KEY,\n building_short_name CHAR(15),\n building_full_name VARCHAR(80),\n building_description VARCHAR(255),\n building_address VARCHAR(255),\n building_manager VARCHAR(50),\n building_phone VARCHAR(80),\n UNIQUE (building_id)\n);\n\nCREATE TABLE Apartments (\n apt_id INTEGER NOT NULL PRIMARY KEY,\n building_id INTEGER NOT NULL,\n apt_type_code CHAR(15),\n apt_number CHAR(10),\n bathroom_count INTEGER,\n bedroom_count INTEGER,\n room_count CHAR(5),\n UNIQUE (apt_id),\n FOREIGN KEY (building_id) REFERENCES Apartment_Buildings(building_id)\n);\n\nCREATE TABLE Apartment_Facilities (\n apt_id INTEGER NOT NULL PRIMARY KEY,\n facility_code CHAR(15) NOT NULL PRIMARY KEY,\n PRIMARY KEY (apt_id, facility_code),\n UNIQUE (apt_id, facility_code),\n FOREIGN KEY (apt_id) REFERENCES Apartments(apt_id)\n);\n\nCREATE TABLE Guests (\n guest_id INTEGER NOT NULL PRIMARY KEY,\n gender_code CHAR(1),\n guest_first_name VARCHAR(80),\n guest_last_name VARCHAR(80),\n date_of_birth DATETIME,\n UNIQUE (guest_id)\n);\n\nCREATE TABLE Apartment_Bookings (\n apt_booking_id INTEGER NOT NULL PRIMARY KEY,\n apt_id INTEGER,\n guest_id INTEGER NOT NULL,\n booking_status_code CHAR(15) NOT NULL,\n booking_start_date DATETIME,\n booking_end_date DATETIME,\n UNIQUE (apt_booking_id),\n FOREIGN KEY (guest_id) REFERENCES Guests(guest_id),\n FOREIGN KEY (apt_id) REFERENCES Apartments(apt_id)\n);\n\nCREATE TABLE View_Unit_Status (\n apt_id INTEGER,\n apt_booking_id INTEGER,\n status_date DATETIME NOT NULL PRIMARY KEY,\n available_yn BIT,\n UNIQUE (status_date),\n FOREIGN KEY (apt_booking_id) REFERENCES Apartment_Bookings(apt_booking_id),\n FOREIGN KEY (apt_id) REFERENCES Apartments(apt_id)\n);",
"role": "user"
},
{
"content": "SELECT T2.apt_number FROM Apartment_Bookings AS T1 JOIN Apartments AS T2 ON T1.apt_id = T2.apt_id WHERE T1.booking_status_code = \"Confirmed\" INTERSECT SELECT T2.apt_number FROM Apartment_Bookings AS T1 JOIN Apartments AS T2 ON T1.apt_id = T2.apt_id WHERE T1.booking_status_code = \"Provisional\"",
"role": "assistant"
}
] |
apartment_rentals | [
{
"content": "Translate the following question to SQL: Show the apartment numbers of apartments with unit status availability of both 0 and 1.\n\nSchema: CREATE TABLE Apartment_Buildings (\n building_id INTEGER NOT NULL PRIMARY KEY,\n building_short_name CHAR(15),\n building_full_name VARCHAR(80),\n building_description VARCHAR(255),\n building_address VARCHAR(255),\n building_manager VARCHAR(50),\n building_phone VARCHAR(80),\n UNIQUE (building_id)\n);\n\nCREATE TABLE Apartments (\n apt_id INTEGER NOT NULL PRIMARY KEY,\n building_id INTEGER NOT NULL,\n apt_type_code CHAR(15),\n apt_number CHAR(10),\n bathroom_count INTEGER,\n bedroom_count INTEGER,\n room_count CHAR(5),\n UNIQUE (apt_id),\n FOREIGN KEY (building_id) REFERENCES Apartment_Buildings(building_id)\n);\n\nCREATE TABLE Apartment_Facilities (\n apt_id INTEGER NOT NULL PRIMARY KEY,\n facility_code CHAR(15) NOT NULL PRIMARY KEY,\n PRIMARY KEY (apt_id, facility_code),\n UNIQUE (apt_id, facility_code),\n FOREIGN KEY (apt_id) REFERENCES Apartments(apt_id)\n);\n\nCREATE TABLE Guests (\n guest_id INTEGER NOT NULL PRIMARY KEY,\n gender_code CHAR(1),\n guest_first_name VARCHAR(80),\n guest_last_name VARCHAR(80),\n date_of_birth DATETIME,\n UNIQUE (guest_id)\n);\n\nCREATE TABLE Apartment_Bookings (\n apt_booking_id INTEGER NOT NULL PRIMARY KEY,\n apt_id INTEGER,\n guest_id INTEGER NOT NULL,\n booking_status_code CHAR(15) NOT NULL,\n booking_start_date DATETIME,\n booking_end_date DATETIME,\n UNIQUE (apt_booking_id),\n FOREIGN KEY (guest_id) REFERENCES Guests(guest_id),\n FOREIGN KEY (apt_id) REFERENCES Apartments(apt_id)\n);\n\nCREATE TABLE View_Unit_Status (\n apt_id INTEGER,\n apt_booking_id INTEGER,\n status_date DATETIME NOT NULL PRIMARY KEY,\n available_yn BIT,\n UNIQUE (status_date),\n FOREIGN KEY (apt_booking_id) REFERENCES Apartment_Bookings(apt_booking_id),\n FOREIGN KEY (apt_id) REFERENCES Apartments(apt_id)\n);",
"role": "user"
},
{
"content": "SELECT T1.apt_number FROM Apartments AS T1 JOIN View_Unit_Status AS T2 ON T1.apt_id = T2.apt_id WHERE T2.available_yn = 0 INTERSECT SELECT T1.apt_number FROM Apartments AS T1 JOIN View_Unit_Status AS T2 ON T1.apt_id = T2.apt_id WHERE T2.available_yn = 1",
"role": "assistant"
}
] |
apartment_rentals | [
{
"content": "Translate the following question to SQL: Which apartments have unit status availability of both 0 and 1? Return their apartment numbers.\n\nSchema: CREATE TABLE Apartment_Buildings (\n building_id INTEGER NOT NULL PRIMARY KEY,\n building_short_name CHAR(15),\n building_full_name VARCHAR(80),\n building_description VARCHAR(255),\n building_address VARCHAR(255),\n building_manager VARCHAR(50),\n building_phone VARCHAR(80),\n UNIQUE (building_id)\n);\n\nCREATE TABLE Apartments (\n apt_id INTEGER NOT NULL PRIMARY KEY,\n building_id INTEGER NOT NULL,\n apt_type_code CHAR(15),\n apt_number CHAR(10),\n bathroom_count INTEGER,\n bedroom_count INTEGER,\n room_count CHAR(5),\n UNIQUE (apt_id),\n FOREIGN KEY (building_id) REFERENCES Apartment_Buildings(building_id)\n);\n\nCREATE TABLE Apartment_Facilities (\n apt_id INTEGER NOT NULL PRIMARY KEY,\n facility_code CHAR(15) NOT NULL PRIMARY KEY,\n PRIMARY KEY (apt_id, facility_code),\n UNIQUE (apt_id, facility_code),\n FOREIGN KEY (apt_id) REFERENCES Apartments(apt_id)\n);\n\nCREATE TABLE Guests (\n guest_id INTEGER NOT NULL PRIMARY KEY,\n gender_code CHAR(1),\n guest_first_name VARCHAR(80),\n guest_last_name VARCHAR(80),\n date_of_birth DATETIME,\n UNIQUE (guest_id)\n);\n\nCREATE TABLE Apartment_Bookings (\n apt_booking_id INTEGER NOT NULL PRIMARY KEY,\n apt_id INTEGER,\n guest_id INTEGER NOT NULL,\n booking_status_code CHAR(15) NOT NULL,\n booking_start_date DATETIME,\n booking_end_date DATETIME,\n UNIQUE (apt_booking_id),\n FOREIGN KEY (guest_id) REFERENCES Guests(guest_id),\n FOREIGN KEY (apt_id) REFERENCES Apartments(apt_id)\n);\n\nCREATE TABLE View_Unit_Status (\n apt_id INTEGER,\n apt_booking_id INTEGER,\n status_date DATETIME NOT NULL PRIMARY KEY,\n available_yn BIT,\n UNIQUE (status_date),\n FOREIGN KEY (apt_booking_id) REFERENCES Apartment_Bookings(apt_booking_id),\n FOREIGN KEY (apt_id) REFERENCES Apartments(apt_id)\n);",
"role": "user"
},
{
"content": "SELECT T1.apt_number FROM Apartments AS T1 JOIN View_Unit_Status AS T2 ON T1.apt_id = T2.apt_id WHERE T2.available_yn = 0 INTERSECT SELECT T1.apt_number FROM Apartments AS T1 JOIN View_Unit_Status AS T2 ON T1.apt_id = T2.apt_id WHERE T2.available_yn = 1",
"role": "assistant"
}
] |
game_injury | [
{
"content": "Translate the following question to SQL: How many games are held after season 2007?\n\nSchema: CREATE TABLE stadium (\n id INT PRIMARY KEY,\n name TEXT,\n Home_Games INT,\n Average_Attendance REAL,\n Total_Attendance REAL,\n Capacity_Percentage REAL,\n UNIQUE (id)\n);\n\nCREATE TABLE game (\n stadium_id INT,\n id INT PRIMARY KEY,\n Season INT,\n Date TEXT,\n Home_team TEXT,\n Away_team TEXT,\n Score TEXT,\n Competition TEXT,\n UNIQUE (id),\n FOREIGN KEY (stadium_id) REFERENCES stadium(id)\n);\n\nCREATE TABLE injury_accident (\n game_id INT,\n id INT PRIMARY KEY,\n Player TEXT,\n Injury TEXT,\n Number_of_matches TEXT,\n Source TEXT,\n UNIQUE (id),\n FOREIGN KEY (game_id) REFERENCES game(id)\n);",
"role": "user"
},
{
"content": "SELECT count(*) FROM game WHERE season > 2007",
"role": "assistant"
}
] |
game_injury | [
{
"content": "Translate the following question to SQL: List the dates of games by the home team name in descending order.\n\nSchema: CREATE TABLE stadium (\n id INT PRIMARY KEY,\n name TEXT,\n Home_Games INT,\n Average_Attendance REAL,\n Total_Attendance REAL,\n Capacity_Percentage REAL,\n UNIQUE (id)\n);\n\nCREATE TABLE game (\n stadium_id INT,\n id INT PRIMARY KEY,\n Season INT,\n Date TEXT,\n Home_team TEXT,\n Away_team TEXT,\n Score TEXT,\n Competition TEXT,\n UNIQUE (id),\n FOREIGN KEY (stadium_id) REFERENCES stadium(id)\n);\n\nCREATE TABLE injury_accident (\n game_id INT,\n id INT PRIMARY KEY,\n Player TEXT,\n Injury TEXT,\n Number_of_matches TEXT,\n Source TEXT,\n UNIQUE (id),\n FOREIGN KEY (game_id) REFERENCES game(id)\n);",
"role": "user"
},
{
"content": "SELECT Date FROM game ORDER BY home_team DESC",
"role": "assistant"
}
] |
game_injury | [
{
"content": "Translate the following question to SQL: List the season, home team, away team of all the games.\n\nSchema: CREATE TABLE stadium (\n id INT PRIMARY KEY,\n name TEXT,\n Home_Games INT,\n Average_Attendance REAL,\n Total_Attendance REAL,\n Capacity_Percentage REAL,\n UNIQUE (id)\n);\n\nCREATE TABLE game (\n stadium_id INT,\n id INT PRIMARY KEY,\n Season INT,\n Date TEXT,\n Home_team TEXT,\n Away_team TEXT,\n Score TEXT,\n Competition TEXT,\n UNIQUE (id),\n FOREIGN KEY (stadium_id) REFERENCES stadium(id)\n);\n\nCREATE TABLE injury_accident (\n game_id INT,\n id INT PRIMARY KEY,\n Player TEXT,\n Injury TEXT,\n Number_of_matches TEXT,\n Source TEXT,\n UNIQUE (id),\n FOREIGN KEY (game_id) REFERENCES game(id)\n);",
"role": "user"
},
{
"content": "SELECT season , home_team , away_team FROM game",
"role": "assistant"
}
] |
game_injury | [
{
"content": "Translate the following question to SQL: What are the maximum, minimum and average home games each stadium held?\n\nSchema: CREATE TABLE stadium (\n id INT PRIMARY KEY,\n name TEXT,\n Home_Games INT,\n Average_Attendance REAL,\n Total_Attendance REAL,\n Capacity_Percentage REAL,\n UNIQUE (id)\n);\n\nCREATE TABLE game (\n stadium_id INT,\n id INT PRIMARY KEY,\n Season INT,\n Date TEXT,\n Home_team TEXT,\n Away_team TEXT,\n Score TEXT,\n Competition TEXT,\n UNIQUE (id),\n FOREIGN KEY (stadium_id) REFERENCES stadium(id)\n);\n\nCREATE TABLE injury_accident (\n game_id INT,\n id INT PRIMARY KEY,\n Player TEXT,\n Injury TEXT,\n Number_of_matches TEXT,\n Source TEXT,\n UNIQUE (id),\n FOREIGN KEY (game_id) REFERENCES game(id)\n);",
"role": "user"
},
{
"content": "SELECT max(home_games) , min(home_games) , avg(home_games) FROM stadium",
"role": "assistant"
}
] |
game_injury | [
{
"content": "Translate the following question to SQL: What is the average attendance of stadiums with capacity percentage higher than 100%?\n\nSchema: CREATE TABLE stadium (\n id INT PRIMARY KEY,\n name TEXT,\n Home_Games INT,\n Average_Attendance REAL,\n Total_Attendance REAL,\n Capacity_Percentage REAL,\n UNIQUE (id)\n);\n\nCREATE TABLE game (\n stadium_id INT,\n id INT PRIMARY KEY,\n Season INT,\n Date TEXT,\n Home_team TEXT,\n Away_team TEXT,\n Score TEXT,\n Competition TEXT,\n UNIQUE (id),\n FOREIGN KEY (stadium_id) REFERENCES stadium(id)\n);\n\nCREATE TABLE injury_accident (\n game_id INT,\n id INT PRIMARY KEY,\n Player TEXT,\n Injury TEXT,\n Number_of_matches TEXT,\n Source TEXT,\n UNIQUE (id),\n FOREIGN KEY (game_id) REFERENCES game(id)\n);",
"role": "user"
},
{
"content": "SELECT average_attendance FROM stadium WHERE capacity_percentage > 100",
"role": "assistant"
}
] |
game_injury | [
{
"content": "Translate the following question to SQL: What are the player name, number of matches, and information source for players who do not suffer from injury of 'Knee problem'?\n\nSchema: CREATE TABLE stadium (\n id INT PRIMARY KEY,\n name TEXT,\n Home_Games INT,\n Average_Attendance REAL,\n Total_Attendance REAL,\n Capacity_Percentage REAL,\n UNIQUE (id)\n);\n\nCREATE TABLE game (\n stadium_id INT,\n id INT PRIMARY KEY,\n Season INT,\n Date TEXT,\n Home_team TEXT,\n Away_team TEXT,\n Score TEXT,\n Competition TEXT,\n UNIQUE (id),\n FOREIGN KEY (stadium_id) REFERENCES stadium(id)\n);\n\nCREATE TABLE injury_accident (\n game_id INT,\n id INT PRIMARY KEY,\n Player TEXT,\n Injury TEXT,\n Number_of_matches TEXT,\n Source TEXT,\n UNIQUE (id),\n FOREIGN KEY (game_id) REFERENCES game(id)\n);",
"role": "user"
},
{
"content": "SELECT player , number_of_matches , SOURCE FROM injury_accident WHERE injury != 'Knee problem'",
"role": "assistant"
}
] |
game_injury | [
{
"content": "Translate the following question to SQL: What is the season of the game which causes the player 'Walter Samuel' to get injured?\n\nSchema: CREATE TABLE stadium (\n id INT PRIMARY KEY,\n name TEXT,\n Home_Games INT,\n Average_Attendance REAL,\n Total_Attendance REAL,\n Capacity_Percentage REAL,\n UNIQUE (id)\n);\n\nCREATE TABLE game (\n stadium_id INT,\n id INT PRIMARY KEY,\n Season INT,\n Date TEXT,\n Home_team TEXT,\n Away_team TEXT,\n Score TEXT,\n Competition TEXT,\n UNIQUE (id),\n FOREIGN KEY (stadium_id) REFERENCES stadium(id)\n);\n\nCREATE TABLE injury_accident (\n game_id INT,\n id INT PRIMARY KEY,\n Player TEXT,\n Injury TEXT,\n Number_of_matches TEXT,\n Source TEXT,\n UNIQUE (id),\n FOREIGN KEY (game_id) REFERENCES game(id)\n);",
"role": "user"
},
{
"content": "SELECT T1.season FROM game AS T1 JOIN injury_accident AS T2 ON T1.id = T2.game_id WHERE T2.player = 'Walter Samuel'",
"role": "assistant"
}
] |
game_injury | [
{
"content": "Translate the following question to SQL: What are the ids, scores, and dates of the games which caused at least two injury accidents?\n\nSchema: CREATE TABLE stadium (\n id INT PRIMARY KEY,\n name TEXT,\n Home_Games INT,\n Average_Attendance REAL,\n Total_Attendance REAL,\n Capacity_Percentage REAL,\n UNIQUE (id)\n);\n\nCREATE TABLE game (\n stadium_id INT,\n id INT PRIMARY KEY,\n Season INT,\n Date TEXT,\n Home_team TEXT,\n Away_team TEXT,\n Score TEXT,\n Competition TEXT,\n UNIQUE (id),\n FOREIGN KEY (stadium_id) REFERENCES stadium(id)\n);\n\nCREATE TABLE injury_accident (\n game_id INT,\n id INT PRIMARY KEY,\n Player TEXT,\n Injury TEXT,\n Number_of_matches TEXT,\n Source TEXT,\n UNIQUE (id),\n FOREIGN KEY (game_id) REFERENCES game(id)\n);",
"role": "user"
},
{
"content": "SELECT T1.id , T1.score , T1.date FROM game AS T1 JOIN injury_accident AS T2 ON T2.game_id = T1.id GROUP BY T1.id HAVING count(*) >= 2",
"role": "assistant"
}
] |
game_injury | [
{
"content": "Translate the following question to SQL: What are the id and name of the stadium where the most injury accidents happened?\n\nSchema: CREATE TABLE stadium (\n id INT PRIMARY KEY,\n name TEXT,\n Home_Games INT,\n Average_Attendance REAL,\n Total_Attendance REAL,\n Capacity_Percentage REAL,\n UNIQUE (id)\n);\n\nCREATE TABLE game (\n stadium_id INT,\n id INT PRIMARY KEY,\n Season INT,\n Date TEXT,\n Home_team TEXT,\n Away_team TEXT,\n Score TEXT,\n Competition TEXT,\n UNIQUE (id),\n FOREIGN KEY (stadium_id) REFERENCES stadium(id)\n);\n\nCREATE TABLE injury_accident (\n game_id INT,\n id INT PRIMARY KEY,\n Player TEXT,\n Injury TEXT,\n Number_of_matches TEXT,\n Source TEXT,\n UNIQUE (id),\n FOREIGN KEY (game_id) REFERENCES game(id)\n);",
"role": "user"
},
{
"content": "SELECT T1.id , T1.name FROM stadium AS T1 JOIN game AS T2 ON T1.id = T2.stadium_id JOIN injury_accident AS T3 ON T2.id = T3.game_id GROUP BY T1.id ORDER BY count(*) DESC LIMIT 1",
"role": "assistant"
}
] |
game_injury | [
{
"content": "Translate the following question to SQL: Find the id and name of the stadium where the largest number of injury accidents occurred.\n\nSchema: CREATE TABLE stadium (\n id INT PRIMARY KEY,\n name TEXT,\n Home_Games INT,\n Average_Attendance REAL,\n Total_Attendance REAL,\n Capacity_Percentage REAL,\n UNIQUE (id)\n);\n\nCREATE TABLE game (\n stadium_id INT,\n id INT PRIMARY KEY,\n Season INT,\n Date TEXT,\n Home_team TEXT,\n Away_team TEXT,\n Score TEXT,\n Competition TEXT,\n UNIQUE (id),\n FOREIGN KEY (stadium_id) REFERENCES stadium(id)\n);\n\nCREATE TABLE injury_accident (\n game_id INT,\n id INT PRIMARY KEY,\n Player TEXT,\n Injury TEXT,\n Number_of_matches TEXT,\n Source TEXT,\n UNIQUE (id),\n FOREIGN KEY (game_id) REFERENCES game(id)\n);",
"role": "user"
},
{
"content": "SELECT T1.id , T1.name FROM stadium AS T1 JOIN game AS T2 ON T1.id = T2.stadium_id JOIN injury_accident AS T3 ON T2.id = T3.game_id GROUP BY T1.id ORDER BY count(*) DESC LIMIT 1",
"role": "assistant"
}
] |
game_injury | [
{
"content": "Translate the following question to SQL: In which season and which stadium did any player have an injury of 'Foot injury' or 'Knee problem'?\n\nSchema: CREATE TABLE stadium (\n id INT PRIMARY KEY,\n name TEXT,\n Home_Games INT,\n Average_Attendance REAL,\n Total_Attendance REAL,\n Capacity_Percentage REAL,\n UNIQUE (id)\n);\n\nCREATE TABLE game (\n stadium_id INT,\n id INT PRIMARY KEY,\n Season INT,\n Date TEXT,\n Home_team TEXT,\n Away_team TEXT,\n Score TEXT,\n Competition TEXT,\n UNIQUE (id),\n FOREIGN KEY (stadium_id) REFERENCES stadium(id)\n);\n\nCREATE TABLE injury_accident (\n game_id INT,\n id INT PRIMARY KEY,\n Player TEXT,\n Injury TEXT,\n Number_of_matches TEXT,\n Source TEXT,\n UNIQUE (id),\n FOREIGN KEY (game_id) REFERENCES game(id)\n);",
"role": "user"
},
{
"content": "SELECT T1.season , T2.name FROM game AS T1 JOIN stadium AS T2 ON T1.stadium_id = T2.id JOIN injury_accident AS T3 ON T1.id = T3.game_id WHERE T3.injury = 'Foot injury' OR T3.injury = 'Knee problem'",
"role": "assistant"
}
] |
game_injury | [
{
"content": "Translate the following question to SQL: How many different kinds of information sources are there for injury accidents?\n\nSchema: CREATE TABLE stadium (\n id INT PRIMARY KEY,\n name TEXT,\n Home_Games INT,\n Average_Attendance REAL,\n Total_Attendance REAL,\n Capacity_Percentage REAL,\n UNIQUE (id)\n);\n\nCREATE TABLE game (\n stadium_id INT,\n id INT PRIMARY KEY,\n Season INT,\n Date TEXT,\n Home_team TEXT,\n Away_team TEXT,\n Score TEXT,\n Competition TEXT,\n UNIQUE (id),\n FOREIGN KEY (stadium_id) REFERENCES stadium(id)\n);\n\nCREATE TABLE injury_accident (\n game_id INT,\n id INT PRIMARY KEY,\n Player TEXT,\n Injury TEXT,\n Number_of_matches TEXT,\n Source TEXT,\n UNIQUE (id),\n FOREIGN KEY (game_id) REFERENCES game(id)\n);",
"role": "user"
},
{
"content": "SELECT count(DISTINCT SOURCE) FROM injury_accident",
"role": "assistant"
}
] |
game_injury | [
{
"content": "Translate the following question to SQL: How many games are free of injury accidents?\n\nSchema: CREATE TABLE stadium (\n id INT PRIMARY KEY,\n name TEXT,\n Home_Games INT,\n Average_Attendance REAL,\n Total_Attendance REAL,\n Capacity_Percentage REAL,\n UNIQUE (id)\n);\n\nCREATE TABLE game (\n stadium_id INT,\n id INT PRIMARY KEY,\n Season INT,\n Date TEXT,\n Home_team TEXT,\n Away_team TEXT,\n Score TEXT,\n Competition TEXT,\n UNIQUE (id),\n FOREIGN KEY (stadium_id) REFERENCES stadium(id)\n);\n\nCREATE TABLE injury_accident (\n game_id INT,\n id INT PRIMARY KEY,\n Player TEXT,\n Injury TEXT,\n Number_of_matches TEXT,\n Source TEXT,\n UNIQUE (id),\n FOREIGN KEY (game_id) REFERENCES game(id)\n);",
"role": "user"
},
{
"content": "SELECT count(*) FROM game WHERE id NOT IN ( SELECT game_id FROM injury_accident )",
"role": "assistant"
}
] |
game_injury | [
{
"content": "Translate the following question to SQL: How many distinct kinds of injuries happened after season 2010?\n\nSchema: CREATE TABLE stadium (\n id INT PRIMARY KEY,\n name TEXT,\n Home_Games INT,\n Average_Attendance REAL,\n Total_Attendance REAL,\n Capacity_Percentage REAL,\n UNIQUE (id)\n);\n\nCREATE TABLE game (\n stadium_id INT,\n id INT PRIMARY KEY,\n Season INT,\n Date TEXT,\n Home_team TEXT,\n Away_team TEXT,\n Score TEXT,\n Competition TEXT,\n UNIQUE (id),\n FOREIGN KEY (stadium_id) REFERENCES stadium(id)\n);\n\nCREATE TABLE injury_accident (\n game_id INT,\n id INT PRIMARY KEY,\n Player TEXT,\n Injury TEXT,\n Number_of_matches TEXT,\n Source TEXT,\n UNIQUE (id),\n FOREIGN KEY (game_id) REFERENCES game(id)\n);",
"role": "user"
},
{
"content": "SELECT count(DISTINCT T1.injury) FROM injury_accident AS T1 JOIN game AS T2 ON T1.game_id = T2.id WHERE T2.season > 2010",
"role": "assistant"
}
] |
game_injury | [
{
"content": "Translate the following question to SQL: List the name of the stadium where both the player 'Walter Samuel' and the player 'Thiago Motta' got injured.\n\nSchema: CREATE TABLE stadium (\n id INT PRIMARY KEY,\n name TEXT,\n Home_Games INT,\n Average_Attendance REAL,\n Total_Attendance REAL,\n Capacity_Percentage REAL,\n UNIQUE (id)\n);\n\nCREATE TABLE game (\n stadium_id INT,\n id INT PRIMARY KEY,\n Season INT,\n Date TEXT,\n Home_team TEXT,\n Away_team TEXT,\n Score TEXT,\n Competition TEXT,\n UNIQUE (id),\n FOREIGN KEY (stadium_id) REFERENCES stadium(id)\n);\n\nCREATE TABLE injury_accident (\n game_id INT,\n id INT PRIMARY KEY,\n Player TEXT,\n Injury TEXT,\n Number_of_matches TEXT,\n Source TEXT,\n UNIQUE (id),\n FOREIGN KEY (game_id) REFERENCES game(id)\n);",
"role": "user"
},
{
"content": "SELECT T2.name FROM game AS T1 JOIN stadium AS T2 ON T1.stadium_id = T2.id JOIN injury_accident AS T3 ON T1.id = T3.game_id WHERE T3.player = 'Walter Samuel' INTERSECT SELECT T2.name FROM game AS T1 JOIN stadium AS T2 ON T1.stadium_id = T2.id JOIN injury_accident AS T3 ON T1.id = T3.game_id WHERE T3.player = 'Thiago Motta'",
"role": "assistant"
}
] |
game_injury | [
{
"content": "Translate the following question to SQL: Show the name, average attendance, total attendance for stadiums where no accidents happened.\n\nSchema: CREATE TABLE stadium (\n id INT PRIMARY KEY,\n name TEXT,\n Home_Games INT,\n Average_Attendance REAL,\n Total_Attendance REAL,\n Capacity_Percentage REAL,\n UNIQUE (id)\n);\n\nCREATE TABLE game (\n stadium_id INT,\n id INT PRIMARY KEY,\n Season INT,\n Date TEXT,\n Home_team TEXT,\n Away_team TEXT,\n Score TEXT,\n Competition TEXT,\n UNIQUE (id),\n FOREIGN KEY (stadium_id) REFERENCES stadium(id)\n);\n\nCREATE TABLE injury_accident (\n game_id INT,\n id INT PRIMARY KEY,\n Player TEXT,\n Injury TEXT,\n Number_of_matches TEXT,\n Source TEXT,\n UNIQUE (id),\n FOREIGN KEY (game_id) REFERENCES game(id)\n);",
"role": "user"
},
{
"content": "SELECT name , average_attendance , total_attendance FROM stadium EXCEPT SELECT T2.name , T2.average_attendance , T2.total_attendance FROM game AS T1 JOIN stadium AS T2 ON T1.stadium_id = T2.id JOIN injury_accident AS T3 ON T1.id = T3.game_id",
"role": "assistant"
}
] |
game_injury | [
{
"content": "Translate the following question to SQL: Which stadium name contains the substring \"Bank\"?\n\nSchema: CREATE TABLE stadium (\n id INT PRIMARY KEY,\n name TEXT,\n Home_Games INT,\n Average_Attendance REAL,\n Total_Attendance REAL,\n Capacity_Percentage REAL,\n UNIQUE (id)\n);\n\nCREATE TABLE game (\n stadium_id INT,\n id INT PRIMARY KEY,\n Season INT,\n Date TEXT,\n Home_team TEXT,\n Away_team TEXT,\n Score TEXT,\n Competition TEXT,\n UNIQUE (id),\n FOREIGN KEY (stadium_id) REFERENCES stadium(id)\n);\n\nCREATE TABLE injury_accident (\n game_id INT,\n id INT PRIMARY KEY,\n Player TEXT,\n Injury TEXT,\n Number_of_matches TEXT,\n Source TEXT,\n UNIQUE (id),\n FOREIGN KEY (game_id) REFERENCES game(id)\n);",
"role": "user"
},
{
"content": "SELECT name FROM stadium WHERE name LIKE \"%Bank%\"",
"role": "assistant"
}
] |
game_injury | [
{
"content": "Translate the following question to SQL: How many games has each stadium held?\n\nSchema: CREATE TABLE stadium (\n id INT PRIMARY KEY,\n name TEXT,\n Home_Games INT,\n Average_Attendance REAL,\n Total_Attendance REAL,\n Capacity_Percentage REAL,\n UNIQUE (id)\n);\n\nCREATE TABLE game (\n stadium_id INT,\n id INT PRIMARY KEY,\n Season INT,\n Date TEXT,\n Home_team TEXT,\n Away_team TEXT,\n Score TEXT,\n Competition TEXT,\n UNIQUE (id),\n FOREIGN KEY (stadium_id) REFERENCES stadium(id)\n);\n\nCREATE TABLE injury_accident (\n game_id INT,\n id INT PRIMARY KEY,\n Player TEXT,\n Injury TEXT,\n Number_of_matches TEXT,\n Source TEXT,\n UNIQUE (id),\n FOREIGN KEY (game_id) REFERENCES game(id)\n);",
"role": "user"
},
{
"content": "SELECT T1.id , count(*) FROM stadium AS T1 JOIN game AS T2 ON T1.id = T2.stadium_id GROUP BY T1.id",
"role": "assistant"
}
] |
game_injury | [
{
"content": "Translate the following question to SQL: For each injury accident, find the date of the game and the name of the injured player in the game, and sort the results in descending order of game season.\n\nSchema: CREATE TABLE stadium (\n id INT PRIMARY KEY,\n name TEXT,\n Home_Games INT,\n Average_Attendance REAL,\n Total_Attendance REAL,\n Capacity_Percentage REAL,\n UNIQUE (id)\n);\n\nCREATE TABLE game (\n stadium_id INT,\n id INT PRIMARY KEY,\n Season INT,\n Date TEXT,\n Home_team TEXT,\n Away_team TEXT,\n Score TEXT,\n Competition TEXT,\n UNIQUE (id),\n FOREIGN KEY (stadium_id) REFERENCES stadium(id)\n);\n\nCREATE TABLE injury_accident (\n game_id INT,\n id INT PRIMARY KEY,\n Player TEXT,\n Injury TEXT,\n Number_of_matches TEXT,\n Source TEXT,\n UNIQUE (id),\n FOREIGN KEY (game_id) REFERENCES game(id)\n);",
"role": "user"
},
{
"content": "SELECT T1.date , T2.player FROM game AS T1 JOIN injury_accident AS T2 ON T1.id = T2.game_id ORDER BY T1.season DESC",
"role": "assistant"
}
] |
soccer_1 | [
{
"content": "Translate the following question to SQL: List all country and league names.\n\nSchema: CREATE TABLE Player_Attributes (\n id INTEGER PRIMARY KEY,\n player_fifa_api_id INTEGER,\n player_api_id INTEGER,\n date TEXT,\n overall_rating INTEGER,\n potential INTEGER,\n preferred_foot TEXT,\n attacking_work_rate TEXT,\n defensive_work_rate TEXT,\n crossing INTEGER,\n finishing INTEGER,\n heading_accuracy INTEGER,\n short_passing INTEGER,\n volleys INTEGER,\n dribbling INTEGER,\n curve INTEGER,\n free_kick_accuracy INTEGER,\n long_passing INTEGER,\n ball_control INTEGER,\n acceleration INTEGER,\n sprint_speed INTEGER,\n agility INTEGER,\n reactions INTEGER,\n balance INTEGER,\n shot_power INTEGER,\n jumping INTEGER,\n stamina INTEGER,\n strength INTEGER,\n long_shots INTEGER,\n aggression INTEGER,\n interceptions INTEGER,\n positioning INTEGER,\n vision INTEGER,\n penalties INTEGER,\n marking INTEGER,\n standing_tackle INTEGER,\n sliding_tackle INTEGER,\n gk_diving INTEGER,\n gk_handling INTEGER,\n gk_kicking INTEGER,\n gk_positioning INTEGER,\n gk_reflexes INTEGER,\n FOREIGN KEY (player_api_id) REFERENCES Player(player_api_id),\n FOREIGN KEY (player_fifa_api_id) REFERENCES Player(player_fifa_api_id)\n);\n\nCREATE TABLE sqlite_sequence (\n name,\n seq\n);\n\nCREATE TABLE Player (\n id INTEGER PRIMARY KEY,\n player_api_id INTEGER,\n player_name TEXT,\n player_fifa_api_id INTEGER,\n birthday TEXT,\n height INTEGER,\n weight INTEGER,\n UNIQUE (player_fifa_api_id),\n UNIQUE (player_api_id)\n);\n\nCREATE TABLE League (\n id INTEGER PRIMARY KEY,\n country_id INTEGER,\n name TEXT,\n UNIQUE (name),\n FOREIGN KEY (country_id) REFERENCES Country(id)\n);\n\nCREATE TABLE Country (\n id INTEGER PRIMARY KEY,\n name TEXT,\n UNIQUE (name)\n);\n\nCREATE TABLE Team (\n id INTEGER PRIMARY KEY,\n team_api_id INTEGER,\n team_fifa_api_id INTEGER,\n team_long_name TEXT,\n team_short_name TEXT,\n UNIQUE (team_api_id)\n);\n\nCREATE TABLE Team_Attributes (\n id INTEGER PRIMARY KEY,\n team_fifa_api_id INTEGER,\n team_api_id INTEGER,\n date TEXT,\n buildUpPlaySpeed INTEGER,\n buildUpPlaySpeedClass TEXT,\n buildUpPlayDribbling INTEGER,\n buildUpPlayDribblingClass TEXT,\n buildUpPlayPassing INTEGER,\n buildUpPlayPassingClass TEXT,\n buildUpPlayPositioningClass TEXT,\n chanceCreationPassing INTEGER,\n chanceCreationPassingClass TEXT,\n chanceCreationCrossing INTEGER,\n chanceCreationCrossingClass TEXT,\n chanceCreationShooting INTEGER,\n chanceCreationShootingClass TEXT,\n chanceCreationPositioningClass TEXT,\n defencePressure INTEGER,\n defencePressureClass TEXT,\n defenceAggression INTEGER,\n defenceAggressionClass TEXT,\n defenceTeamWidth INTEGER,\n defenceTeamWidthClass TEXT,\n defenceDefenderLineClass TEXT,\n FOREIGN KEY (team_api_id) REFERENCES Team(team_api_id),\n FOREIGN KEY (team_fifa_api_id) REFERENCES Team(team_fifa_api_id)\n);",
"role": "user"
},
{
"content": "SELECT T1.name , T2.name FROM Country AS T1 JOIN League AS T2 ON T1.id = T2.country_id",
"role": "assistant"
}
] |
soccer_1 | [
{
"content": "Translate the following question to SQL: How many leagues are there in England?\n\nSchema: CREATE TABLE Player_Attributes (\n id INTEGER PRIMARY KEY,\n player_fifa_api_id INTEGER,\n player_api_id INTEGER,\n date TEXT,\n overall_rating INTEGER,\n potential INTEGER,\n preferred_foot TEXT,\n attacking_work_rate TEXT,\n defensive_work_rate TEXT,\n crossing INTEGER,\n finishing INTEGER,\n heading_accuracy INTEGER,\n short_passing INTEGER,\n volleys INTEGER,\n dribbling INTEGER,\n curve INTEGER,\n free_kick_accuracy INTEGER,\n long_passing INTEGER,\n ball_control INTEGER,\n acceleration INTEGER,\n sprint_speed INTEGER,\n agility INTEGER,\n reactions INTEGER,\n balance INTEGER,\n shot_power INTEGER,\n jumping INTEGER,\n stamina INTEGER,\n strength INTEGER,\n long_shots INTEGER,\n aggression INTEGER,\n interceptions INTEGER,\n positioning INTEGER,\n vision INTEGER,\n penalties INTEGER,\n marking INTEGER,\n standing_tackle INTEGER,\n sliding_tackle INTEGER,\n gk_diving INTEGER,\n gk_handling INTEGER,\n gk_kicking INTEGER,\n gk_positioning INTEGER,\n gk_reflexes INTEGER,\n FOREIGN KEY (player_api_id) REFERENCES Player(player_api_id),\n FOREIGN KEY (player_fifa_api_id) REFERENCES Player(player_fifa_api_id)\n);\n\nCREATE TABLE sqlite_sequence (\n name,\n seq\n);\n\nCREATE TABLE Player (\n id INTEGER PRIMARY KEY,\n player_api_id INTEGER,\n player_name TEXT,\n player_fifa_api_id INTEGER,\n birthday TEXT,\n height INTEGER,\n weight INTEGER,\n UNIQUE (player_fifa_api_id),\n UNIQUE (player_api_id)\n);\n\nCREATE TABLE League (\n id INTEGER PRIMARY KEY,\n country_id INTEGER,\n name TEXT,\n UNIQUE (name),\n FOREIGN KEY (country_id) REFERENCES Country(id)\n);\n\nCREATE TABLE Country (\n id INTEGER PRIMARY KEY,\n name TEXT,\n UNIQUE (name)\n);\n\nCREATE TABLE Team (\n id INTEGER PRIMARY KEY,\n team_api_id INTEGER,\n team_fifa_api_id INTEGER,\n team_long_name TEXT,\n team_short_name TEXT,\n UNIQUE (team_api_id)\n);\n\nCREATE TABLE Team_Attributes (\n id INTEGER PRIMARY KEY,\n team_fifa_api_id INTEGER,\n team_api_id INTEGER,\n date TEXT,\n buildUpPlaySpeed INTEGER,\n buildUpPlaySpeedClass TEXT,\n buildUpPlayDribbling INTEGER,\n buildUpPlayDribblingClass TEXT,\n buildUpPlayPassing INTEGER,\n buildUpPlayPassingClass TEXT,\n buildUpPlayPositioningClass TEXT,\n chanceCreationPassing INTEGER,\n chanceCreationPassingClass TEXT,\n chanceCreationCrossing INTEGER,\n chanceCreationCrossingClass TEXT,\n chanceCreationShooting INTEGER,\n chanceCreationShootingClass TEXT,\n chanceCreationPositioningClass TEXT,\n defencePressure INTEGER,\n defencePressureClass TEXT,\n defenceAggression INTEGER,\n defenceAggressionClass TEXT,\n defenceTeamWidth INTEGER,\n defenceTeamWidthClass TEXT,\n defenceDefenderLineClass TEXT,\n FOREIGN KEY (team_api_id) REFERENCES Team(team_api_id),\n FOREIGN KEY (team_fifa_api_id) REFERENCES Team(team_fifa_api_id)\n);",
"role": "user"
},
{
"content": "SELECT count(*) FROM Country AS T1 JOIN League AS T2 ON T1.id = T2.country_id WHERE T1.name = \"England\"",
"role": "assistant"
}
] |
soccer_1 | [
{
"content": "Translate the following question to SQL: What is the average weight of all players?\n\nSchema: CREATE TABLE Player_Attributes (\n id INTEGER PRIMARY KEY,\n player_fifa_api_id INTEGER,\n player_api_id INTEGER,\n date TEXT,\n overall_rating INTEGER,\n potential INTEGER,\n preferred_foot TEXT,\n attacking_work_rate TEXT,\n defensive_work_rate TEXT,\n crossing INTEGER,\n finishing INTEGER,\n heading_accuracy INTEGER,\n short_passing INTEGER,\n volleys INTEGER,\n dribbling INTEGER,\n curve INTEGER,\n free_kick_accuracy INTEGER,\n long_passing INTEGER,\n ball_control INTEGER,\n acceleration INTEGER,\n sprint_speed INTEGER,\n agility INTEGER,\n reactions INTEGER,\n balance INTEGER,\n shot_power INTEGER,\n jumping INTEGER,\n stamina INTEGER,\n strength INTEGER,\n long_shots INTEGER,\n aggression INTEGER,\n interceptions INTEGER,\n positioning INTEGER,\n vision INTEGER,\n penalties INTEGER,\n marking INTEGER,\n standing_tackle INTEGER,\n sliding_tackle INTEGER,\n gk_diving INTEGER,\n gk_handling INTEGER,\n gk_kicking INTEGER,\n gk_positioning INTEGER,\n gk_reflexes INTEGER,\n FOREIGN KEY (player_api_id) REFERENCES Player(player_api_id),\n FOREIGN KEY (player_fifa_api_id) REFERENCES Player(player_fifa_api_id)\n);\n\nCREATE TABLE sqlite_sequence (\n name,\n seq\n);\n\nCREATE TABLE Player (\n id INTEGER PRIMARY KEY,\n player_api_id INTEGER,\n player_name TEXT,\n player_fifa_api_id INTEGER,\n birthday TEXT,\n height INTEGER,\n weight INTEGER,\n UNIQUE (player_fifa_api_id),\n UNIQUE (player_api_id)\n);\n\nCREATE TABLE League (\n id INTEGER PRIMARY KEY,\n country_id INTEGER,\n name TEXT,\n UNIQUE (name),\n FOREIGN KEY (country_id) REFERENCES Country(id)\n);\n\nCREATE TABLE Country (\n id INTEGER PRIMARY KEY,\n name TEXT,\n UNIQUE (name)\n);\n\nCREATE TABLE Team (\n id INTEGER PRIMARY KEY,\n team_api_id INTEGER,\n team_fifa_api_id INTEGER,\n team_long_name TEXT,\n team_short_name TEXT,\n UNIQUE (team_api_id)\n);\n\nCREATE TABLE Team_Attributes (\n id INTEGER PRIMARY KEY,\n team_fifa_api_id INTEGER,\n team_api_id INTEGER,\n date TEXT,\n buildUpPlaySpeed INTEGER,\n buildUpPlaySpeedClass TEXT,\n buildUpPlayDribbling INTEGER,\n buildUpPlayDribblingClass TEXT,\n buildUpPlayPassing INTEGER,\n buildUpPlayPassingClass TEXT,\n buildUpPlayPositioningClass TEXT,\n chanceCreationPassing INTEGER,\n chanceCreationPassingClass TEXT,\n chanceCreationCrossing INTEGER,\n chanceCreationCrossingClass TEXT,\n chanceCreationShooting INTEGER,\n chanceCreationShootingClass TEXT,\n chanceCreationPositioningClass TEXT,\n defencePressure INTEGER,\n defencePressureClass TEXT,\n defenceAggression INTEGER,\n defenceAggressionClass TEXT,\n defenceTeamWidth INTEGER,\n defenceTeamWidthClass TEXT,\n defenceDefenderLineClass TEXT,\n FOREIGN KEY (team_api_id) REFERENCES Team(team_api_id),\n FOREIGN KEY (team_fifa_api_id) REFERENCES Team(team_fifa_api_id)\n);",
"role": "user"
},
{
"content": "SELECT avg(weight) FROM Player",
"role": "assistant"
}
] |
soccer_1 | [
{
"content": "Translate the following question to SQL: What is the maximum and minimum height of all players?\n\nSchema: CREATE TABLE Player_Attributes (\n id INTEGER PRIMARY KEY,\n player_fifa_api_id INTEGER,\n player_api_id INTEGER,\n date TEXT,\n overall_rating INTEGER,\n potential INTEGER,\n preferred_foot TEXT,\n attacking_work_rate TEXT,\n defensive_work_rate TEXT,\n crossing INTEGER,\n finishing INTEGER,\n heading_accuracy INTEGER,\n short_passing INTEGER,\n volleys INTEGER,\n dribbling INTEGER,\n curve INTEGER,\n free_kick_accuracy INTEGER,\n long_passing INTEGER,\n ball_control INTEGER,\n acceleration INTEGER,\n sprint_speed INTEGER,\n agility INTEGER,\n reactions INTEGER,\n balance INTEGER,\n shot_power INTEGER,\n jumping INTEGER,\n stamina INTEGER,\n strength INTEGER,\n long_shots INTEGER,\n aggression INTEGER,\n interceptions INTEGER,\n positioning INTEGER,\n vision INTEGER,\n penalties INTEGER,\n marking INTEGER,\n standing_tackle INTEGER,\n sliding_tackle INTEGER,\n gk_diving INTEGER,\n gk_handling INTEGER,\n gk_kicking INTEGER,\n gk_positioning INTEGER,\n gk_reflexes INTEGER,\n FOREIGN KEY (player_api_id) REFERENCES Player(player_api_id),\n FOREIGN KEY (player_fifa_api_id) REFERENCES Player(player_fifa_api_id)\n);\n\nCREATE TABLE sqlite_sequence (\n name,\n seq\n);\n\nCREATE TABLE Player (\n id INTEGER PRIMARY KEY,\n player_api_id INTEGER,\n player_name TEXT,\n player_fifa_api_id INTEGER,\n birthday TEXT,\n height INTEGER,\n weight INTEGER,\n UNIQUE (player_fifa_api_id),\n UNIQUE (player_api_id)\n);\n\nCREATE TABLE League (\n id INTEGER PRIMARY KEY,\n country_id INTEGER,\n name TEXT,\n UNIQUE (name),\n FOREIGN KEY (country_id) REFERENCES Country(id)\n);\n\nCREATE TABLE Country (\n id INTEGER PRIMARY KEY,\n name TEXT,\n UNIQUE (name)\n);\n\nCREATE TABLE Team (\n id INTEGER PRIMARY KEY,\n team_api_id INTEGER,\n team_fifa_api_id INTEGER,\n team_long_name TEXT,\n team_short_name TEXT,\n UNIQUE (team_api_id)\n);\n\nCREATE TABLE Team_Attributes (\n id INTEGER PRIMARY KEY,\n team_fifa_api_id INTEGER,\n team_api_id INTEGER,\n date TEXT,\n buildUpPlaySpeed INTEGER,\n buildUpPlaySpeedClass TEXT,\n buildUpPlayDribbling INTEGER,\n buildUpPlayDribblingClass TEXT,\n buildUpPlayPassing INTEGER,\n buildUpPlayPassingClass TEXT,\n buildUpPlayPositioningClass TEXT,\n chanceCreationPassing INTEGER,\n chanceCreationPassingClass TEXT,\n chanceCreationCrossing INTEGER,\n chanceCreationCrossingClass TEXT,\n chanceCreationShooting INTEGER,\n chanceCreationShootingClass TEXT,\n chanceCreationPositioningClass TEXT,\n defencePressure INTEGER,\n defencePressureClass TEXT,\n defenceAggression INTEGER,\n defenceAggressionClass TEXT,\n defenceTeamWidth INTEGER,\n defenceTeamWidthClass TEXT,\n defenceDefenderLineClass TEXT,\n FOREIGN KEY (team_api_id) REFERENCES Team(team_api_id),\n FOREIGN KEY (team_fifa_api_id) REFERENCES Team(team_fifa_api_id)\n);",
"role": "user"
},
{
"content": "SELECT max(weight) , min(weight) FROM Player",
"role": "assistant"
}
] |
soccer_1 | [
{
"content": "Translate the following question to SQL: List all player names who have an overall rating higher than the average.\n\nSchema: CREATE TABLE Player_Attributes (\n id INTEGER PRIMARY KEY,\n player_fifa_api_id INTEGER,\n player_api_id INTEGER,\n date TEXT,\n overall_rating INTEGER,\n potential INTEGER,\n preferred_foot TEXT,\n attacking_work_rate TEXT,\n defensive_work_rate TEXT,\n crossing INTEGER,\n finishing INTEGER,\n heading_accuracy INTEGER,\n short_passing INTEGER,\n volleys INTEGER,\n dribbling INTEGER,\n curve INTEGER,\n free_kick_accuracy INTEGER,\n long_passing INTEGER,\n ball_control INTEGER,\n acceleration INTEGER,\n sprint_speed INTEGER,\n agility INTEGER,\n reactions INTEGER,\n balance INTEGER,\n shot_power INTEGER,\n jumping INTEGER,\n stamina INTEGER,\n strength INTEGER,\n long_shots INTEGER,\n aggression INTEGER,\n interceptions INTEGER,\n positioning INTEGER,\n vision INTEGER,\n penalties INTEGER,\n marking INTEGER,\n standing_tackle INTEGER,\n sliding_tackle INTEGER,\n gk_diving INTEGER,\n gk_handling INTEGER,\n gk_kicking INTEGER,\n gk_positioning INTEGER,\n gk_reflexes INTEGER,\n FOREIGN KEY (player_api_id) REFERENCES Player(player_api_id),\n FOREIGN KEY (player_fifa_api_id) REFERENCES Player(player_fifa_api_id)\n);\n\nCREATE TABLE sqlite_sequence (\n name,\n seq\n);\n\nCREATE TABLE Player (\n id INTEGER PRIMARY KEY,\n player_api_id INTEGER,\n player_name TEXT,\n player_fifa_api_id INTEGER,\n birthday TEXT,\n height INTEGER,\n weight INTEGER,\n UNIQUE (player_fifa_api_id),\n UNIQUE (player_api_id)\n);\n\nCREATE TABLE League (\n id INTEGER PRIMARY KEY,\n country_id INTEGER,\n name TEXT,\n UNIQUE (name),\n FOREIGN KEY (country_id) REFERENCES Country(id)\n);\n\nCREATE TABLE Country (\n id INTEGER PRIMARY KEY,\n name TEXT,\n UNIQUE (name)\n);\n\nCREATE TABLE Team (\n id INTEGER PRIMARY KEY,\n team_api_id INTEGER,\n team_fifa_api_id INTEGER,\n team_long_name TEXT,\n team_short_name TEXT,\n UNIQUE (team_api_id)\n);\n\nCREATE TABLE Team_Attributes (\n id INTEGER PRIMARY KEY,\n team_fifa_api_id INTEGER,\n team_api_id INTEGER,\n date TEXT,\n buildUpPlaySpeed INTEGER,\n buildUpPlaySpeedClass TEXT,\n buildUpPlayDribbling INTEGER,\n buildUpPlayDribblingClass TEXT,\n buildUpPlayPassing INTEGER,\n buildUpPlayPassingClass TEXT,\n buildUpPlayPositioningClass TEXT,\n chanceCreationPassing INTEGER,\n chanceCreationPassingClass TEXT,\n chanceCreationCrossing INTEGER,\n chanceCreationCrossingClass TEXT,\n chanceCreationShooting INTEGER,\n chanceCreationShootingClass TEXT,\n chanceCreationPositioningClass TEXT,\n defencePressure INTEGER,\n defencePressureClass TEXT,\n defenceAggression INTEGER,\n defenceAggressionClass TEXT,\n defenceTeamWidth INTEGER,\n defenceTeamWidthClass TEXT,\n defenceDefenderLineClass TEXT,\n FOREIGN KEY (team_api_id) REFERENCES Team(team_api_id),\n FOREIGN KEY (team_fifa_api_id) REFERENCES Team(team_fifa_api_id)\n);",
"role": "user"
},
{
"content": "SELECT DISTINCT T1.player_name FROM Player AS T1 JOIN Player_Attributes AS T2 ON T1.player_api_id = T2.player_api_id WHERE T2.overall_rating > ( SELECT avg(overall_rating) FROM Player_Attributes )",
"role": "assistant"
}
] |
soccer_1 | [
{
"content": "Translate the following question to SQL: What are the names of players who have the best dribbling?\n\nSchema: CREATE TABLE Player_Attributes (\n id INTEGER PRIMARY KEY,\n player_fifa_api_id INTEGER,\n player_api_id INTEGER,\n date TEXT,\n overall_rating INTEGER,\n potential INTEGER,\n preferred_foot TEXT,\n attacking_work_rate TEXT,\n defensive_work_rate TEXT,\n crossing INTEGER,\n finishing INTEGER,\n heading_accuracy INTEGER,\n short_passing INTEGER,\n volleys INTEGER,\n dribbling INTEGER,\n curve INTEGER,\n free_kick_accuracy INTEGER,\n long_passing INTEGER,\n ball_control INTEGER,\n acceleration INTEGER,\n sprint_speed INTEGER,\n agility INTEGER,\n reactions INTEGER,\n balance INTEGER,\n shot_power INTEGER,\n jumping INTEGER,\n stamina INTEGER,\n strength INTEGER,\n long_shots INTEGER,\n aggression INTEGER,\n interceptions INTEGER,\n positioning INTEGER,\n vision INTEGER,\n penalties INTEGER,\n marking INTEGER,\n standing_tackle INTEGER,\n sliding_tackle INTEGER,\n gk_diving INTEGER,\n gk_handling INTEGER,\n gk_kicking INTEGER,\n gk_positioning INTEGER,\n gk_reflexes INTEGER,\n FOREIGN KEY (player_api_id) REFERENCES Player(player_api_id),\n FOREIGN KEY (player_fifa_api_id) REFERENCES Player(player_fifa_api_id)\n);\n\nCREATE TABLE sqlite_sequence (\n name,\n seq\n);\n\nCREATE TABLE Player (\n id INTEGER PRIMARY KEY,\n player_api_id INTEGER,\n player_name TEXT,\n player_fifa_api_id INTEGER,\n birthday TEXT,\n height INTEGER,\n weight INTEGER,\n UNIQUE (player_fifa_api_id),\n UNIQUE (player_api_id)\n);\n\nCREATE TABLE League (\n id INTEGER PRIMARY KEY,\n country_id INTEGER,\n name TEXT,\n UNIQUE (name),\n FOREIGN KEY (country_id) REFERENCES Country(id)\n);\n\nCREATE TABLE Country (\n id INTEGER PRIMARY KEY,\n name TEXT,\n UNIQUE (name)\n);\n\nCREATE TABLE Team (\n id INTEGER PRIMARY KEY,\n team_api_id INTEGER,\n team_fifa_api_id INTEGER,\n team_long_name TEXT,\n team_short_name TEXT,\n UNIQUE (team_api_id)\n);\n\nCREATE TABLE Team_Attributes (\n id INTEGER PRIMARY KEY,\n team_fifa_api_id INTEGER,\n team_api_id INTEGER,\n date TEXT,\n buildUpPlaySpeed INTEGER,\n buildUpPlaySpeedClass TEXT,\n buildUpPlayDribbling INTEGER,\n buildUpPlayDribblingClass TEXT,\n buildUpPlayPassing INTEGER,\n buildUpPlayPassingClass TEXT,\n buildUpPlayPositioningClass TEXT,\n chanceCreationPassing INTEGER,\n chanceCreationPassingClass TEXT,\n chanceCreationCrossing INTEGER,\n chanceCreationCrossingClass TEXT,\n chanceCreationShooting INTEGER,\n chanceCreationShootingClass TEXT,\n chanceCreationPositioningClass TEXT,\n defencePressure INTEGER,\n defencePressureClass TEXT,\n defenceAggression INTEGER,\n defenceAggressionClass TEXT,\n defenceTeamWidth INTEGER,\n defenceTeamWidthClass TEXT,\n defenceDefenderLineClass TEXT,\n FOREIGN KEY (team_api_id) REFERENCES Team(team_api_id),\n FOREIGN KEY (team_fifa_api_id) REFERENCES Team(team_fifa_api_id)\n);",
"role": "user"
},
{
"content": "SELECT DISTINCT T1.player_name FROM Player AS T1 JOIN Player_Attributes AS T2 ON T1.player_api_id = T2.player_api_id WHERE T2.dribbling = ( SELECT max(overall_rating) FROM Player_Attributes)",
"role": "assistant"
}
] |
soccer_1 | [
{
"content": "Translate the following question to SQL: List the names of all players who have a crossing score higher than 90 and prefer their right foot.\n\nSchema: CREATE TABLE Player_Attributes (\n id INTEGER PRIMARY KEY,\n player_fifa_api_id INTEGER,\n player_api_id INTEGER,\n date TEXT,\n overall_rating INTEGER,\n potential INTEGER,\n preferred_foot TEXT,\n attacking_work_rate TEXT,\n defensive_work_rate TEXT,\n crossing INTEGER,\n finishing INTEGER,\n heading_accuracy INTEGER,\n short_passing INTEGER,\n volleys INTEGER,\n dribbling INTEGER,\n curve INTEGER,\n free_kick_accuracy INTEGER,\n long_passing INTEGER,\n ball_control INTEGER,\n acceleration INTEGER,\n sprint_speed INTEGER,\n agility INTEGER,\n reactions INTEGER,\n balance INTEGER,\n shot_power INTEGER,\n jumping INTEGER,\n stamina INTEGER,\n strength INTEGER,\n long_shots INTEGER,\n aggression INTEGER,\n interceptions INTEGER,\n positioning INTEGER,\n vision INTEGER,\n penalties INTEGER,\n marking INTEGER,\n standing_tackle INTEGER,\n sliding_tackle INTEGER,\n gk_diving INTEGER,\n gk_handling INTEGER,\n gk_kicking INTEGER,\n gk_positioning INTEGER,\n gk_reflexes INTEGER,\n FOREIGN KEY (player_api_id) REFERENCES Player(player_api_id),\n FOREIGN KEY (player_fifa_api_id) REFERENCES Player(player_fifa_api_id)\n);\n\nCREATE TABLE sqlite_sequence (\n name,\n seq\n);\n\nCREATE TABLE Player (\n id INTEGER PRIMARY KEY,\n player_api_id INTEGER,\n player_name TEXT,\n player_fifa_api_id INTEGER,\n birthday TEXT,\n height INTEGER,\n weight INTEGER,\n UNIQUE (player_fifa_api_id),\n UNIQUE (player_api_id)\n);\n\nCREATE TABLE League (\n id INTEGER PRIMARY KEY,\n country_id INTEGER,\n name TEXT,\n UNIQUE (name),\n FOREIGN KEY (country_id) REFERENCES Country(id)\n);\n\nCREATE TABLE Country (\n id INTEGER PRIMARY KEY,\n name TEXT,\n UNIQUE (name)\n);\n\nCREATE TABLE Team (\n id INTEGER PRIMARY KEY,\n team_api_id INTEGER,\n team_fifa_api_id INTEGER,\n team_long_name TEXT,\n team_short_name TEXT,\n UNIQUE (team_api_id)\n);\n\nCREATE TABLE Team_Attributes (\n id INTEGER PRIMARY KEY,\n team_fifa_api_id INTEGER,\n team_api_id INTEGER,\n date TEXT,\n buildUpPlaySpeed INTEGER,\n buildUpPlaySpeedClass TEXT,\n buildUpPlayDribbling INTEGER,\n buildUpPlayDribblingClass TEXT,\n buildUpPlayPassing INTEGER,\n buildUpPlayPassingClass TEXT,\n buildUpPlayPositioningClass TEXT,\n chanceCreationPassing INTEGER,\n chanceCreationPassingClass TEXT,\n chanceCreationCrossing INTEGER,\n chanceCreationCrossingClass TEXT,\n chanceCreationShooting INTEGER,\n chanceCreationShootingClass TEXT,\n chanceCreationPositioningClass TEXT,\n defencePressure INTEGER,\n defencePressureClass TEXT,\n defenceAggression INTEGER,\n defenceAggressionClass TEXT,\n defenceTeamWidth INTEGER,\n defenceTeamWidthClass TEXT,\n defenceDefenderLineClass TEXT,\n FOREIGN KEY (team_api_id) REFERENCES Team(team_api_id),\n FOREIGN KEY (team_fifa_api_id) REFERENCES Team(team_fifa_api_id)\n);",
"role": "user"
},
{
"content": "SELECT DISTINCT T1.player_name FROM Player AS T1 JOIN Player_Attributes AS T2 ON T1.player_api_id = T2.player_api_id WHERE T2.crossing > 90 AND T2.preferred_foot = \"right\"",
"role": "assistant"
}
] |