db_id
stringclasses 127
values | query
stringlengths 20
523
| question
stringlengths 16
224
| schema
stringclasses 127
values |
---|---|---|---|
apartment_rentals | SELECT apt_number , room_count FROM Apartments | What are the apartment number and the room count of each apartment? | CREATE TABLE Apartment_Buildings (
building_id INTEGER NOT NULL,
building_short_name CHAR(15),
building_full_name VARCHAR(80),
building_description VARCHAR(255),
building_address VARCHAR(255),
building_manager VARCHAR(50),
building_phone VARCHAR(80),
PRIMARY KEY (building_id),
UNIQUE (building_id)
);
CREATE TABLE Apartments (
apt_id INTEGER NOT NULL ,
building_id INTEGER NOT NULL,
apt_type_code CHAR(15),
apt_number CHAR(10),
bathroom_count INTEGER,
bedroom_count INTEGER,
room_count CHAR(5),
PRIMARY KEY (apt_id),
UNIQUE (apt_id),
FOREIGN KEY (building_id) REFERENCES Apartment_Buildings (building_id)
);
CREATE TABLE Apartment_Facilities (
apt_id INTEGER NOT NULL,
facility_code CHAR(15) NOT NULL,
PRIMARY KEY (apt_id, facility_code),
FOREIGN KEY (apt_id) REFERENCES Apartments (apt_id)
);
CREATE TABLE Guests (
guest_id INTEGER NOT NULL ,
gender_code CHAR(1),
guest_first_name VARCHAR(80),
guest_last_name VARCHAR(80),
date_of_birth DATETIME,
PRIMARY KEY (guest_id),
UNIQUE (guest_id)
);
CREATE TABLE Apartment_Bookings (
apt_booking_id INTEGER NOT NULL,
apt_id INTEGER,
guest_id INTEGER NOT NULL,
booking_status_code CHAR(15) NOT NULL,
booking_start_date DATETIME,
booking_end_date DATETIME,
PRIMARY KEY (apt_booking_id),
UNIQUE (apt_booking_id),
FOREIGN KEY (apt_id) REFERENCES Apartments (apt_id),
FOREIGN KEY (guest_id) REFERENCES Guests (guest_id)
);
CREATE TABLE View_Unit_Status (
apt_id INTEGER,
apt_booking_id INTEGER,
status_date DATETIME NOT NULL,
available_yn BIT,
PRIMARY KEY (status_date),
FOREIGN KEY (apt_id) REFERENCES Apartments (apt_id),
FOREIGN KEY (apt_booking_id) REFERENCES Apartment_Bookings (apt_booking_id)
);
INSERT INTO `Apartment_Buildings` (`building_id`, `building_short_name`, `building_full_name`, `building_description`, `building_address`, `building_manager`, `building_phone`) VALUES (133, 'Normandie Court', 'Normandie Court', 'Studio', '7950 Casper Vista Apt. 176
INSERT INTO `Apartments` (`apt_id`, `building_id`, `apt_type_code`, `apt_number`, `bathroom_count`, `bedroom_count`, `room_count`) VALUES (1, 808, 'Flat', 'Suite 645', 1, 3, '7')
INSERT INTO `Apartment_Facilities` (`apt_id`, `facility_code`) VALUES (1, 'Boardband')
INSERT INTO `Guests` (`guest_id`, `gender_code`, `guest_first_name`, `guest_last_name`, `date_of_birth`) VALUES (1, 'Male', 'Kip', 'DuBuque', '1995-11-04 07:09:57')
INSERT INTO `Apartment_Bookings` (`apt_booking_id`, `apt_id`, `guest_id`, `booking_status_code`, `booking_start_date`, `booking_end_date`) VALUES (258, 10, 2, 'Provisional', '2016-09-26 17:13:49', '2017-10-07 11:38:48')
INSERT INTO `View_Unit_Status` (`apt_id`, `apt_booking_id`, `status_date`, `available_yn`) VALUES (11, 920, '1970-09-28 10:24:29', '1') |
apartment_rentals | SELECT avg(room_count) FROM Apartments WHERE apt_type_code = "Studio" | What is the average number of rooms of apartments with type code "Studio"? | CREATE TABLE Apartment_Buildings (
building_id INTEGER NOT NULL,
building_short_name CHAR(15),
building_full_name VARCHAR(80),
building_description VARCHAR(255),
building_address VARCHAR(255),
building_manager VARCHAR(50),
building_phone VARCHAR(80),
PRIMARY KEY (building_id),
UNIQUE (building_id)
);
CREATE TABLE Apartments (
apt_id INTEGER NOT NULL ,
building_id INTEGER NOT NULL,
apt_type_code CHAR(15),
apt_number CHAR(10),
bathroom_count INTEGER,
bedroom_count INTEGER,
room_count CHAR(5),
PRIMARY KEY (apt_id),
UNIQUE (apt_id),
FOREIGN KEY (building_id) REFERENCES Apartment_Buildings (building_id)
);
CREATE TABLE Apartment_Facilities (
apt_id INTEGER NOT NULL,
facility_code CHAR(15) NOT NULL,
PRIMARY KEY (apt_id, facility_code),
FOREIGN KEY (apt_id) REFERENCES Apartments (apt_id)
);
CREATE TABLE Guests (
guest_id INTEGER NOT NULL ,
gender_code CHAR(1),
guest_first_name VARCHAR(80),
guest_last_name VARCHAR(80),
date_of_birth DATETIME,
PRIMARY KEY (guest_id),
UNIQUE (guest_id)
);
CREATE TABLE Apartment_Bookings (
apt_booking_id INTEGER NOT NULL,
apt_id INTEGER,
guest_id INTEGER NOT NULL,
booking_status_code CHAR(15) NOT NULL,
booking_start_date DATETIME,
booking_end_date DATETIME,
PRIMARY KEY (apt_booking_id),
UNIQUE (apt_booking_id),
FOREIGN KEY (apt_id) REFERENCES Apartments (apt_id),
FOREIGN KEY (guest_id) REFERENCES Guests (guest_id)
);
CREATE TABLE View_Unit_Status (
apt_id INTEGER,
apt_booking_id INTEGER,
status_date DATETIME NOT NULL,
available_yn BIT,
PRIMARY KEY (status_date),
FOREIGN KEY (apt_id) REFERENCES Apartments (apt_id),
FOREIGN KEY (apt_booking_id) REFERENCES Apartment_Bookings (apt_booking_id)
);
INSERT INTO `Apartment_Buildings` (`building_id`, `building_short_name`, `building_full_name`, `building_description`, `building_address`, `building_manager`, `building_phone`) VALUES (133, 'Normandie Court', 'Normandie Court', 'Studio', '7950 Casper Vista Apt. 176
INSERT INTO `Apartments` (`apt_id`, `building_id`, `apt_type_code`, `apt_number`, `bathroom_count`, `bedroom_count`, `room_count`) VALUES (1, 808, 'Flat', 'Suite 645', 1, 3, '7')
INSERT INTO `Apartment_Facilities` (`apt_id`, `facility_code`) VALUES (1, 'Boardband')
INSERT INTO `Guests` (`guest_id`, `gender_code`, `guest_first_name`, `guest_last_name`, `date_of_birth`) VALUES (1, 'Male', 'Kip', 'DuBuque', '1995-11-04 07:09:57')
INSERT INTO `Apartment_Bookings` (`apt_booking_id`, `apt_id`, `guest_id`, `booking_status_code`, `booking_start_date`, `booking_end_date`) VALUES (258, 10, 2, 'Provisional', '2016-09-26 17:13:49', '2017-10-07 11:38:48')
INSERT INTO `View_Unit_Status` (`apt_id`, `apt_booking_id`, `status_date`, `available_yn`) VALUES (11, 920, '1970-09-28 10:24:29', '1') |
apartment_rentals | SELECT avg(room_count) FROM Apartments WHERE apt_type_code = "Studio" | Find the average room count of the apartments that have the "Studio" type code. | CREATE TABLE Apartment_Buildings (
building_id INTEGER NOT NULL,
building_short_name CHAR(15),
building_full_name VARCHAR(80),
building_description VARCHAR(255),
building_address VARCHAR(255),
building_manager VARCHAR(50),
building_phone VARCHAR(80),
PRIMARY KEY (building_id),
UNIQUE (building_id)
);
CREATE TABLE Apartments (
apt_id INTEGER NOT NULL ,
building_id INTEGER NOT NULL,
apt_type_code CHAR(15),
apt_number CHAR(10),
bathroom_count INTEGER,
bedroom_count INTEGER,
room_count CHAR(5),
PRIMARY KEY (apt_id),
UNIQUE (apt_id),
FOREIGN KEY (building_id) REFERENCES Apartment_Buildings (building_id)
);
CREATE TABLE Apartment_Facilities (
apt_id INTEGER NOT NULL,
facility_code CHAR(15) NOT NULL,
PRIMARY KEY (apt_id, facility_code),
FOREIGN KEY (apt_id) REFERENCES Apartments (apt_id)
);
CREATE TABLE Guests (
guest_id INTEGER NOT NULL ,
gender_code CHAR(1),
guest_first_name VARCHAR(80),
guest_last_name VARCHAR(80),
date_of_birth DATETIME,
PRIMARY KEY (guest_id),
UNIQUE (guest_id)
);
CREATE TABLE Apartment_Bookings (
apt_booking_id INTEGER NOT NULL,
apt_id INTEGER,
guest_id INTEGER NOT NULL,
booking_status_code CHAR(15) NOT NULL,
booking_start_date DATETIME,
booking_end_date DATETIME,
PRIMARY KEY (apt_booking_id),
UNIQUE (apt_booking_id),
FOREIGN KEY (apt_id) REFERENCES Apartments (apt_id),
FOREIGN KEY (guest_id) REFERENCES Guests (guest_id)
);
CREATE TABLE View_Unit_Status (
apt_id INTEGER,
apt_booking_id INTEGER,
status_date DATETIME NOT NULL,
available_yn BIT,
PRIMARY KEY (status_date),
FOREIGN KEY (apt_id) REFERENCES Apartments (apt_id),
FOREIGN KEY (apt_booking_id) REFERENCES Apartment_Bookings (apt_booking_id)
);
INSERT INTO `Apartment_Buildings` (`building_id`, `building_short_name`, `building_full_name`, `building_description`, `building_address`, `building_manager`, `building_phone`) VALUES (133, 'Normandie Court', 'Normandie Court', 'Studio', '7950 Casper Vista Apt. 176
INSERT INTO `Apartments` (`apt_id`, `building_id`, `apt_type_code`, `apt_number`, `bathroom_count`, `bedroom_count`, `room_count`) VALUES (1, 808, 'Flat', 'Suite 645', 1, 3, '7')
INSERT INTO `Apartment_Facilities` (`apt_id`, `facility_code`) VALUES (1, 'Boardband')
INSERT INTO `Guests` (`guest_id`, `gender_code`, `guest_first_name`, `guest_last_name`, `date_of_birth`) VALUES (1, 'Male', 'Kip', 'DuBuque', '1995-11-04 07:09:57')
INSERT INTO `Apartment_Bookings` (`apt_booking_id`, `apt_id`, `guest_id`, `booking_status_code`, `booking_start_date`, `booking_end_date`) VALUES (258, 10, 2, 'Provisional', '2016-09-26 17:13:49', '2017-10-07 11:38:48')
INSERT INTO `View_Unit_Status` (`apt_id`, `apt_booking_id`, `status_date`, `available_yn`) VALUES (11, 920, '1970-09-28 10:24:29', '1') |
apartment_rentals | SELECT apt_number FROM Apartments WHERE apt_type_code = "Flat" | Return the apartment numbers of the apartments with type code "Flat". | CREATE TABLE Apartment_Buildings (
building_id INTEGER NOT NULL,
building_short_name CHAR(15),
building_full_name VARCHAR(80),
building_description VARCHAR(255),
building_address VARCHAR(255),
building_manager VARCHAR(50),
building_phone VARCHAR(80),
PRIMARY KEY (building_id),
UNIQUE (building_id)
);
CREATE TABLE Apartments (
apt_id INTEGER NOT NULL ,
building_id INTEGER NOT NULL,
apt_type_code CHAR(15),
apt_number CHAR(10),
bathroom_count INTEGER,
bedroom_count INTEGER,
room_count CHAR(5),
PRIMARY KEY (apt_id),
UNIQUE (apt_id),
FOREIGN KEY (building_id) REFERENCES Apartment_Buildings (building_id)
);
CREATE TABLE Apartment_Facilities (
apt_id INTEGER NOT NULL,
facility_code CHAR(15) NOT NULL,
PRIMARY KEY (apt_id, facility_code),
FOREIGN KEY (apt_id) REFERENCES Apartments (apt_id)
);
CREATE TABLE Guests (
guest_id INTEGER NOT NULL ,
gender_code CHAR(1),
guest_first_name VARCHAR(80),
guest_last_name VARCHAR(80),
date_of_birth DATETIME,
PRIMARY KEY (guest_id),
UNIQUE (guest_id)
);
CREATE TABLE Apartment_Bookings (
apt_booking_id INTEGER NOT NULL,
apt_id INTEGER,
guest_id INTEGER NOT NULL,
booking_status_code CHAR(15) NOT NULL,
booking_start_date DATETIME,
booking_end_date DATETIME,
PRIMARY KEY (apt_booking_id),
UNIQUE (apt_booking_id),
FOREIGN KEY (apt_id) REFERENCES Apartments (apt_id),
FOREIGN KEY (guest_id) REFERENCES Guests (guest_id)
);
CREATE TABLE View_Unit_Status (
apt_id INTEGER,
apt_booking_id INTEGER,
status_date DATETIME NOT NULL,
available_yn BIT,
PRIMARY KEY (status_date),
FOREIGN KEY (apt_id) REFERENCES Apartments (apt_id),
FOREIGN KEY (apt_booking_id) REFERENCES Apartment_Bookings (apt_booking_id)
);
INSERT INTO `Apartment_Buildings` (`building_id`, `building_short_name`, `building_full_name`, `building_description`, `building_address`, `building_manager`, `building_phone`) VALUES (133, 'Normandie Court', 'Normandie Court', 'Studio', '7950 Casper Vista Apt. 176
INSERT INTO `Apartments` (`apt_id`, `building_id`, `apt_type_code`, `apt_number`, `bathroom_count`, `bedroom_count`, `room_count`) VALUES (1, 808, 'Flat', 'Suite 645', 1, 3, '7')
INSERT INTO `Apartment_Facilities` (`apt_id`, `facility_code`) VALUES (1, 'Boardband')
INSERT INTO `Guests` (`guest_id`, `gender_code`, `guest_first_name`, `guest_last_name`, `date_of_birth`) VALUES (1, 'Male', 'Kip', 'DuBuque', '1995-11-04 07:09:57')
INSERT INTO `Apartment_Bookings` (`apt_booking_id`, `apt_id`, `guest_id`, `booking_status_code`, `booking_start_date`, `booking_end_date`) VALUES (258, 10, 2, 'Provisional', '2016-09-26 17:13:49', '2017-10-07 11:38:48')
INSERT INTO `View_Unit_Status` (`apt_id`, `apt_booking_id`, `status_date`, `available_yn`) VALUES (11, 920, '1970-09-28 10:24:29', '1') |
apartment_rentals | SELECT apt_number FROM Apartments WHERE apt_type_code = "Flat" | Which apartments have type code "Flat"? Give me their apartment numbers. | CREATE TABLE Apartment_Buildings (
building_id INTEGER NOT NULL,
building_short_name CHAR(15),
building_full_name VARCHAR(80),
building_description VARCHAR(255),
building_address VARCHAR(255),
building_manager VARCHAR(50),
building_phone VARCHAR(80),
PRIMARY KEY (building_id),
UNIQUE (building_id)
);
CREATE TABLE Apartments (
apt_id INTEGER NOT NULL ,
building_id INTEGER NOT NULL,
apt_type_code CHAR(15),
apt_number CHAR(10),
bathroom_count INTEGER,
bedroom_count INTEGER,
room_count CHAR(5),
PRIMARY KEY (apt_id),
UNIQUE (apt_id),
FOREIGN KEY (building_id) REFERENCES Apartment_Buildings (building_id)
);
CREATE TABLE Apartment_Facilities (
apt_id INTEGER NOT NULL,
facility_code CHAR(15) NOT NULL,
PRIMARY KEY (apt_id, facility_code),
FOREIGN KEY (apt_id) REFERENCES Apartments (apt_id)
);
CREATE TABLE Guests (
guest_id INTEGER NOT NULL ,
gender_code CHAR(1),
guest_first_name VARCHAR(80),
guest_last_name VARCHAR(80),
date_of_birth DATETIME,
PRIMARY KEY (guest_id),
UNIQUE (guest_id)
);
CREATE TABLE Apartment_Bookings (
apt_booking_id INTEGER NOT NULL,
apt_id INTEGER,
guest_id INTEGER NOT NULL,
booking_status_code CHAR(15) NOT NULL,
booking_start_date DATETIME,
booking_end_date DATETIME,
PRIMARY KEY (apt_booking_id),
UNIQUE (apt_booking_id),
FOREIGN KEY (apt_id) REFERENCES Apartments (apt_id),
FOREIGN KEY (guest_id) REFERENCES Guests (guest_id)
);
CREATE TABLE View_Unit_Status (
apt_id INTEGER,
apt_booking_id INTEGER,
status_date DATETIME NOT NULL,
available_yn BIT,
PRIMARY KEY (status_date),
FOREIGN KEY (apt_id) REFERENCES Apartments (apt_id),
FOREIGN KEY (apt_booking_id) REFERENCES Apartment_Bookings (apt_booking_id)
);
INSERT INTO `Apartment_Buildings` (`building_id`, `building_short_name`, `building_full_name`, `building_description`, `building_address`, `building_manager`, `building_phone`) VALUES (133, 'Normandie Court', 'Normandie Court', 'Studio', '7950 Casper Vista Apt. 176
INSERT INTO `Apartments` (`apt_id`, `building_id`, `apt_type_code`, `apt_number`, `bathroom_count`, `bedroom_count`, `room_count`) VALUES (1, 808, 'Flat', 'Suite 645', 1, 3, '7')
INSERT INTO `Apartment_Facilities` (`apt_id`, `facility_code`) VALUES (1, 'Boardband')
INSERT INTO `Guests` (`guest_id`, `gender_code`, `guest_first_name`, `guest_last_name`, `date_of_birth`) VALUES (1, 'Male', 'Kip', 'DuBuque', '1995-11-04 07:09:57')
INSERT INTO `Apartment_Bookings` (`apt_booking_id`, `apt_id`, `guest_id`, `booking_status_code`, `booking_start_date`, `booking_end_date`) VALUES (258, 10, 2, 'Provisional', '2016-09-26 17:13:49', '2017-10-07 11:38:48')
INSERT INTO `View_Unit_Status` (`apt_id`, `apt_booking_id`, `status_date`, `available_yn`) VALUES (11, 920, '1970-09-28 10:24:29', '1') |
apartment_rentals | SELECT guest_first_name , guest_last_name FROM Guests | Return the first names and last names of all guests | CREATE TABLE Apartment_Buildings (
building_id INTEGER NOT NULL,
building_short_name CHAR(15),
building_full_name VARCHAR(80),
building_description VARCHAR(255),
building_address VARCHAR(255),
building_manager VARCHAR(50),
building_phone VARCHAR(80),
PRIMARY KEY (building_id),
UNIQUE (building_id)
);
CREATE TABLE Apartments (
apt_id INTEGER NOT NULL ,
building_id INTEGER NOT NULL,
apt_type_code CHAR(15),
apt_number CHAR(10),
bathroom_count INTEGER,
bedroom_count INTEGER,
room_count CHAR(5),
PRIMARY KEY (apt_id),
UNIQUE (apt_id),
FOREIGN KEY (building_id) REFERENCES Apartment_Buildings (building_id)
);
CREATE TABLE Apartment_Facilities (
apt_id INTEGER NOT NULL,
facility_code CHAR(15) NOT NULL,
PRIMARY KEY (apt_id, facility_code),
FOREIGN KEY (apt_id) REFERENCES Apartments (apt_id)
);
CREATE TABLE Guests (
guest_id INTEGER NOT NULL ,
gender_code CHAR(1),
guest_first_name VARCHAR(80),
guest_last_name VARCHAR(80),
date_of_birth DATETIME,
PRIMARY KEY (guest_id),
UNIQUE (guest_id)
);
CREATE TABLE Apartment_Bookings (
apt_booking_id INTEGER NOT NULL,
apt_id INTEGER,
guest_id INTEGER NOT NULL,
booking_status_code CHAR(15) NOT NULL,
booking_start_date DATETIME,
booking_end_date DATETIME,
PRIMARY KEY (apt_booking_id),
UNIQUE (apt_booking_id),
FOREIGN KEY (apt_id) REFERENCES Apartments (apt_id),
FOREIGN KEY (guest_id) REFERENCES Guests (guest_id)
);
CREATE TABLE View_Unit_Status (
apt_id INTEGER,
apt_booking_id INTEGER,
status_date DATETIME NOT NULL,
available_yn BIT,
PRIMARY KEY (status_date),
FOREIGN KEY (apt_id) REFERENCES Apartments (apt_id),
FOREIGN KEY (apt_booking_id) REFERENCES Apartment_Bookings (apt_booking_id)
);
INSERT INTO `Apartment_Buildings` (`building_id`, `building_short_name`, `building_full_name`, `building_description`, `building_address`, `building_manager`, `building_phone`) VALUES (133, 'Normandie Court', 'Normandie Court', 'Studio', '7950 Casper Vista Apt. 176
INSERT INTO `Apartments` (`apt_id`, `building_id`, `apt_type_code`, `apt_number`, `bathroom_count`, `bedroom_count`, `room_count`) VALUES (1, 808, 'Flat', 'Suite 645', 1, 3, '7')
INSERT INTO `Apartment_Facilities` (`apt_id`, `facility_code`) VALUES (1, 'Boardband')
INSERT INTO `Guests` (`guest_id`, `gender_code`, `guest_first_name`, `guest_last_name`, `date_of_birth`) VALUES (1, 'Male', 'Kip', 'DuBuque', '1995-11-04 07:09:57')
INSERT INTO `Apartment_Bookings` (`apt_booking_id`, `apt_id`, `guest_id`, `booking_status_code`, `booking_start_date`, `booking_end_date`) VALUES (258, 10, 2, 'Provisional', '2016-09-26 17:13:49', '2017-10-07 11:38:48')
INSERT INTO `View_Unit_Status` (`apt_id`, `apt_booking_id`, `status_date`, `available_yn`) VALUES (11, 920, '1970-09-28 10:24:29', '1') |
apartment_rentals | SELECT guest_first_name , guest_last_name FROM Guests | What are the first names and last names of all the guests? | CREATE TABLE Apartment_Buildings (
building_id INTEGER NOT NULL,
building_short_name CHAR(15),
building_full_name VARCHAR(80),
building_description VARCHAR(255),
building_address VARCHAR(255),
building_manager VARCHAR(50),
building_phone VARCHAR(80),
PRIMARY KEY (building_id),
UNIQUE (building_id)
);
CREATE TABLE Apartments (
apt_id INTEGER NOT NULL ,
building_id INTEGER NOT NULL,
apt_type_code CHAR(15),
apt_number CHAR(10),
bathroom_count INTEGER,
bedroom_count INTEGER,
room_count CHAR(5),
PRIMARY KEY (apt_id),
UNIQUE (apt_id),
FOREIGN KEY (building_id) REFERENCES Apartment_Buildings (building_id)
);
CREATE TABLE Apartment_Facilities (
apt_id INTEGER NOT NULL,
facility_code CHAR(15) NOT NULL,
PRIMARY KEY (apt_id, facility_code),
FOREIGN KEY (apt_id) REFERENCES Apartments (apt_id)
);
CREATE TABLE Guests (
guest_id INTEGER NOT NULL ,
gender_code CHAR(1),
guest_first_name VARCHAR(80),
guest_last_name VARCHAR(80),
date_of_birth DATETIME,
PRIMARY KEY (guest_id),
UNIQUE (guest_id)
);
CREATE TABLE Apartment_Bookings (
apt_booking_id INTEGER NOT NULL,
apt_id INTEGER,
guest_id INTEGER NOT NULL,
booking_status_code CHAR(15) NOT NULL,
booking_start_date DATETIME,
booking_end_date DATETIME,
PRIMARY KEY (apt_booking_id),
UNIQUE (apt_booking_id),
FOREIGN KEY (apt_id) REFERENCES Apartments (apt_id),
FOREIGN KEY (guest_id) REFERENCES Guests (guest_id)
);
CREATE TABLE View_Unit_Status (
apt_id INTEGER,
apt_booking_id INTEGER,
status_date DATETIME NOT NULL,
available_yn BIT,
PRIMARY KEY (status_date),
FOREIGN KEY (apt_id) REFERENCES Apartments (apt_id),
FOREIGN KEY (apt_booking_id) REFERENCES Apartment_Bookings (apt_booking_id)
);
INSERT INTO `Apartment_Buildings` (`building_id`, `building_short_name`, `building_full_name`, `building_description`, `building_address`, `building_manager`, `building_phone`) VALUES (133, 'Normandie Court', 'Normandie Court', 'Studio', '7950 Casper Vista Apt. 176
INSERT INTO `Apartments` (`apt_id`, `building_id`, `apt_type_code`, `apt_number`, `bathroom_count`, `bedroom_count`, `room_count`) VALUES (1, 808, 'Flat', 'Suite 645', 1, 3, '7')
INSERT INTO `Apartment_Facilities` (`apt_id`, `facility_code`) VALUES (1, 'Boardband')
INSERT INTO `Guests` (`guest_id`, `gender_code`, `guest_first_name`, `guest_last_name`, `date_of_birth`) VALUES (1, 'Male', 'Kip', 'DuBuque', '1995-11-04 07:09:57')
INSERT INTO `Apartment_Bookings` (`apt_booking_id`, `apt_id`, `guest_id`, `booking_status_code`, `booking_start_date`, `booking_end_date`) VALUES (258, 10, 2, 'Provisional', '2016-09-26 17:13:49', '2017-10-07 11:38:48')
INSERT INTO `View_Unit_Status` (`apt_id`, `apt_booking_id`, `status_date`, `available_yn`) VALUES (11, 920, '1970-09-28 10:24:29', '1') |
apartment_rentals | SELECT date_of_birth FROM Guests WHERE gender_code = "Male" | Return the date of birth for all the guests with gender code "Male". | CREATE TABLE Apartment_Buildings (
building_id INTEGER NOT NULL,
building_short_name CHAR(15),
building_full_name VARCHAR(80),
building_description VARCHAR(255),
building_address VARCHAR(255),
building_manager VARCHAR(50),
building_phone VARCHAR(80),
PRIMARY KEY (building_id),
UNIQUE (building_id)
);
CREATE TABLE Apartments (
apt_id INTEGER NOT NULL ,
building_id INTEGER NOT NULL,
apt_type_code CHAR(15),
apt_number CHAR(10),
bathroom_count INTEGER,
bedroom_count INTEGER,
room_count CHAR(5),
PRIMARY KEY (apt_id),
UNIQUE (apt_id),
FOREIGN KEY (building_id) REFERENCES Apartment_Buildings (building_id)
);
CREATE TABLE Apartment_Facilities (
apt_id INTEGER NOT NULL,
facility_code CHAR(15) NOT NULL,
PRIMARY KEY (apt_id, facility_code),
FOREIGN KEY (apt_id) REFERENCES Apartments (apt_id)
);
CREATE TABLE Guests (
guest_id INTEGER NOT NULL ,
gender_code CHAR(1),
guest_first_name VARCHAR(80),
guest_last_name VARCHAR(80),
date_of_birth DATETIME,
PRIMARY KEY (guest_id),
UNIQUE (guest_id)
);
CREATE TABLE Apartment_Bookings (
apt_booking_id INTEGER NOT NULL,
apt_id INTEGER,
guest_id INTEGER NOT NULL,
booking_status_code CHAR(15) NOT NULL,
booking_start_date DATETIME,
booking_end_date DATETIME,
PRIMARY KEY (apt_booking_id),
UNIQUE (apt_booking_id),
FOREIGN KEY (apt_id) REFERENCES Apartments (apt_id),
FOREIGN KEY (guest_id) REFERENCES Guests (guest_id)
);
CREATE TABLE View_Unit_Status (
apt_id INTEGER,
apt_booking_id INTEGER,
status_date DATETIME NOT NULL,
available_yn BIT,
PRIMARY KEY (status_date),
FOREIGN KEY (apt_id) REFERENCES Apartments (apt_id),
FOREIGN KEY (apt_booking_id) REFERENCES Apartment_Bookings (apt_booking_id)
);
INSERT INTO `Apartment_Buildings` (`building_id`, `building_short_name`, `building_full_name`, `building_description`, `building_address`, `building_manager`, `building_phone`) VALUES (133, 'Normandie Court', 'Normandie Court', 'Studio', '7950 Casper Vista Apt. 176
INSERT INTO `Apartments` (`apt_id`, `building_id`, `apt_type_code`, `apt_number`, `bathroom_count`, `bedroom_count`, `room_count`) VALUES (1, 808, 'Flat', 'Suite 645', 1, 3, '7')
INSERT INTO `Apartment_Facilities` (`apt_id`, `facility_code`) VALUES (1, 'Boardband')
INSERT INTO `Guests` (`guest_id`, `gender_code`, `guest_first_name`, `guest_last_name`, `date_of_birth`) VALUES (1, 'Male', 'Kip', 'DuBuque', '1995-11-04 07:09:57')
INSERT INTO `Apartment_Bookings` (`apt_booking_id`, `apt_id`, `guest_id`, `booking_status_code`, `booking_start_date`, `booking_end_date`) VALUES (258, 10, 2, 'Provisional', '2016-09-26 17:13:49', '2017-10-07 11:38:48')
INSERT INTO `View_Unit_Status` (`apt_id`, `apt_booking_id`, `status_date`, `available_yn`) VALUES (11, 920, '1970-09-28 10:24:29', '1') |
apartment_rentals | SELECT date_of_birth FROM Guests WHERE gender_code = "Male" | What are dates of birth of all the guests whose gender is "Male"? | CREATE TABLE Apartment_Buildings (
building_id INTEGER NOT NULL,
building_short_name CHAR(15),
building_full_name VARCHAR(80),
building_description VARCHAR(255),
building_address VARCHAR(255),
building_manager VARCHAR(50),
building_phone VARCHAR(80),
PRIMARY KEY (building_id),
UNIQUE (building_id)
);
CREATE TABLE Apartments (
apt_id INTEGER NOT NULL ,
building_id INTEGER NOT NULL,
apt_type_code CHAR(15),
apt_number CHAR(10),
bathroom_count INTEGER,
bedroom_count INTEGER,
room_count CHAR(5),
PRIMARY KEY (apt_id),
UNIQUE (apt_id),
FOREIGN KEY (building_id) REFERENCES Apartment_Buildings (building_id)
);
CREATE TABLE Apartment_Facilities (
apt_id INTEGER NOT NULL,
facility_code CHAR(15) NOT NULL,
PRIMARY KEY (apt_id, facility_code),
FOREIGN KEY (apt_id) REFERENCES Apartments (apt_id)
);
CREATE TABLE Guests (
guest_id INTEGER NOT NULL ,
gender_code CHAR(1),
guest_first_name VARCHAR(80),
guest_last_name VARCHAR(80),
date_of_birth DATETIME,
PRIMARY KEY (guest_id),
UNIQUE (guest_id)
);
CREATE TABLE Apartment_Bookings (
apt_booking_id INTEGER NOT NULL,
apt_id INTEGER,
guest_id INTEGER NOT NULL,
booking_status_code CHAR(15) NOT NULL,
booking_start_date DATETIME,
booking_end_date DATETIME,
PRIMARY KEY (apt_booking_id),
UNIQUE (apt_booking_id),
FOREIGN KEY (apt_id) REFERENCES Apartments (apt_id),
FOREIGN KEY (guest_id) REFERENCES Guests (guest_id)
);
CREATE TABLE View_Unit_Status (
apt_id INTEGER,
apt_booking_id INTEGER,
status_date DATETIME NOT NULL,
available_yn BIT,
PRIMARY KEY (status_date),
FOREIGN KEY (apt_id) REFERENCES Apartments (apt_id),
FOREIGN KEY (apt_booking_id) REFERENCES Apartment_Bookings (apt_booking_id)
);
INSERT INTO `Apartment_Buildings` (`building_id`, `building_short_name`, `building_full_name`, `building_description`, `building_address`, `building_manager`, `building_phone`) VALUES (133, 'Normandie Court', 'Normandie Court', 'Studio', '7950 Casper Vista Apt. 176
INSERT INTO `Apartments` (`apt_id`, `building_id`, `apt_type_code`, `apt_number`, `bathroom_count`, `bedroom_count`, `room_count`) VALUES (1, 808, 'Flat', 'Suite 645', 1, 3, '7')
INSERT INTO `Apartment_Facilities` (`apt_id`, `facility_code`) VALUES (1, 'Boardband')
INSERT INTO `Guests` (`guest_id`, `gender_code`, `guest_first_name`, `guest_last_name`, `date_of_birth`) VALUES (1, 'Male', 'Kip', 'DuBuque', '1995-11-04 07:09:57')
INSERT INTO `Apartment_Bookings` (`apt_booking_id`, `apt_id`, `guest_id`, `booking_status_code`, `booking_start_date`, `booking_end_date`) VALUES (258, 10, 2, 'Provisional', '2016-09-26 17:13:49', '2017-10-07 11:38:48')
INSERT INTO `View_Unit_Status` (`apt_id`, `apt_booking_id`, `status_date`, `available_yn`) VALUES (11, 920, '1970-09-28 10:24:29', '1') |
apartment_rentals | 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 | Show the apartment numbers, start dates, and end dates of all the apartment bookings. | CREATE TABLE Apartment_Buildings (
building_id INTEGER NOT NULL,
building_short_name CHAR(15),
building_full_name VARCHAR(80),
building_description VARCHAR(255),
building_address VARCHAR(255),
building_manager VARCHAR(50),
building_phone VARCHAR(80),
PRIMARY KEY (building_id),
UNIQUE (building_id)
);
CREATE TABLE Apartments (
apt_id INTEGER NOT NULL ,
building_id INTEGER NOT NULL,
apt_type_code CHAR(15),
apt_number CHAR(10),
bathroom_count INTEGER,
bedroom_count INTEGER,
room_count CHAR(5),
PRIMARY KEY (apt_id),
UNIQUE (apt_id),
FOREIGN KEY (building_id) REFERENCES Apartment_Buildings (building_id)
);
CREATE TABLE Apartment_Facilities (
apt_id INTEGER NOT NULL,
facility_code CHAR(15) NOT NULL,
PRIMARY KEY (apt_id, facility_code),
FOREIGN KEY (apt_id) REFERENCES Apartments (apt_id)
);
CREATE TABLE Guests (
guest_id INTEGER NOT NULL ,
gender_code CHAR(1),
guest_first_name VARCHAR(80),
guest_last_name VARCHAR(80),
date_of_birth DATETIME,
PRIMARY KEY (guest_id),
UNIQUE (guest_id)
);
CREATE TABLE Apartment_Bookings (
apt_booking_id INTEGER NOT NULL,
apt_id INTEGER,
guest_id INTEGER NOT NULL,
booking_status_code CHAR(15) NOT NULL,
booking_start_date DATETIME,
booking_end_date DATETIME,
PRIMARY KEY (apt_booking_id),
UNIQUE (apt_booking_id),
FOREIGN KEY (apt_id) REFERENCES Apartments (apt_id),
FOREIGN KEY (guest_id) REFERENCES Guests (guest_id)
);
CREATE TABLE View_Unit_Status (
apt_id INTEGER,
apt_booking_id INTEGER,
status_date DATETIME NOT NULL,
available_yn BIT,
PRIMARY KEY (status_date),
FOREIGN KEY (apt_id) REFERENCES Apartments (apt_id),
FOREIGN KEY (apt_booking_id) REFERENCES Apartment_Bookings (apt_booking_id)
);
INSERT INTO `Apartment_Buildings` (`building_id`, `building_short_name`, `building_full_name`, `building_description`, `building_address`, `building_manager`, `building_phone`) VALUES (133, 'Normandie Court', 'Normandie Court', 'Studio', '7950 Casper Vista Apt. 176
INSERT INTO `Apartments` (`apt_id`, `building_id`, `apt_type_code`, `apt_number`, `bathroom_count`, `bedroom_count`, `room_count`) VALUES (1, 808, 'Flat', 'Suite 645', 1, 3, '7')
INSERT INTO `Apartment_Facilities` (`apt_id`, `facility_code`) VALUES (1, 'Boardband')
INSERT INTO `Guests` (`guest_id`, `gender_code`, `guest_first_name`, `guest_last_name`, `date_of_birth`) VALUES (1, 'Male', 'Kip', 'DuBuque', '1995-11-04 07:09:57')
INSERT INTO `Apartment_Bookings` (`apt_booking_id`, `apt_id`, `guest_id`, `booking_status_code`, `booking_start_date`, `booking_end_date`) VALUES (258, 10, 2, 'Provisional', '2016-09-26 17:13:49', '2017-10-07 11:38:48')
INSERT INTO `View_Unit_Status` (`apt_id`, `apt_booking_id`, `status_date`, `available_yn`) VALUES (11, 920, '1970-09-28 10:24:29', '1') |
apartment_rentals | 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 | What are the apartment number, start date, and end date of each apartment booking? | CREATE TABLE Apartment_Buildings (
building_id INTEGER NOT NULL,
building_short_name CHAR(15),
building_full_name VARCHAR(80),
building_description VARCHAR(255),
building_address VARCHAR(255),
building_manager VARCHAR(50),
building_phone VARCHAR(80),
PRIMARY KEY (building_id),
UNIQUE (building_id)
);
CREATE TABLE Apartments (
apt_id INTEGER NOT NULL ,
building_id INTEGER NOT NULL,
apt_type_code CHAR(15),
apt_number CHAR(10),
bathroom_count INTEGER,
bedroom_count INTEGER,
room_count CHAR(5),
PRIMARY KEY (apt_id),
UNIQUE (apt_id),
FOREIGN KEY (building_id) REFERENCES Apartment_Buildings (building_id)
);
CREATE TABLE Apartment_Facilities (
apt_id INTEGER NOT NULL,
facility_code CHAR(15) NOT NULL,
PRIMARY KEY (apt_id, facility_code),
FOREIGN KEY (apt_id) REFERENCES Apartments (apt_id)
);
CREATE TABLE Guests (
guest_id INTEGER NOT NULL ,
gender_code CHAR(1),
guest_first_name VARCHAR(80),
guest_last_name VARCHAR(80),
date_of_birth DATETIME,
PRIMARY KEY (guest_id),
UNIQUE (guest_id)
);
CREATE TABLE Apartment_Bookings (
apt_booking_id INTEGER NOT NULL,
apt_id INTEGER,
guest_id INTEGER NOT NULL,
booking_status_code CHAR(15) NOT NULL,
booking_start_date DATETIME,
booking_end_date DATETIME,
PRIMARY KEY (apt_booking_id),
UNIQUE (apt_booking_id),
FOREIGN KEY (apt_id) REFERENCES Apartments (apt_id),
FOREIGN KEY (guest_id) REFERENCES Guests (guest_id)
);
CREATE TABLE View_Unit_Status (
apt_id INTEGER,
apt_booking_id INTEGER,
status_date DATETIME NOT NULL,
available_yn BIT,
PRIMARY KEY (status_date),
FOREIGN KEY (apt_id) REFERENCES Apartments (apt_id),
FOREIGN KEY (apt_booking_id) REFERENCES Apartment_Bookings (apt_booking_id)
);
INSERT INTO `Apartment_Buildings` (`building_id`, `building_short_name`, `building_full_name`, `building_description`, `building_address`, `building_manager`, `building_phone`) VALUES (133, 'Normandie Court', 'Normandie Court', 'Studio', '7950 Casper Vista Apt. 176
INSERT INTO `Apartments` (`apt_id`, `building_id`, `apt_type_code`, `apt_number`, `bathroom_count`, `bedroom_count`, `room_count`) VALUES (1, 808, 'Flat', 'Suite 645', 1, 3, '7')
INSERT INTO `Apartment_Facilities` (`apt_id`, `facility_code`) VALUES (1, 'Boardband')
INSERT INTO `Guests` (`guest_id`, `gender_code`, `guest_first_name`, `guest_last_name`, `date_of_birth`) VALUES (1, 'Male', 'Kip', 'DuBuque', '1995-11-04 07:09:57')
INSERT INTO `Apartment_Bookings` (`apt_booking_id`, `apt_id`, `guest_id`, `booking_status_code`, `booking_start_date`, `booking_end_date`) VALUES (258, 10, 2, 'Provisional', '2016-09-26 17:13:49', '2017-10-07 11:38:48')
INSERT INTO `View_Unit_Status` (`apt_id`, `apt_booking_id`, `status_date`, `available_yn`) VALUES (11, 920, '1970-09-28 10:24:29', '1') |
apartment_rentals | 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" | What are the booking start and end dates of the apartments with type code "Duplex"? | CREATE TABLE Apartment_Buildings (
building_id INTEGER NOT NULL,
building_short_name CHAR(15),
building_full_name VARCHAR(80),
building_description VARCHAR(255),
building_address VARCHAR(255),
building_manager VARCHAR(50),
building_phone VARCHAR(80),
PRIMARY KEY (building_id),
UNIQUE (building_id)
);
CREATE TABLE Apartments (
apt_id INTEGER NOT NULL ,
building_id INTEGER NOT NULL,
apt_type_code CHAR(15),
apt_number CHAR(10),
bathroom_count INTEGER,
bedroom_count INTEGER,
room_count CHAR(5),
PRIMARY KEY (apt_id),
UNIQUE (apt_id),
FOREIGN KEY (building_id) REFERENCES Apartment_Buildings (building_id)
);
CREATE TABLE Apartment_Facilities (
apt_id INTEGER NOT NULL,
facility_code CHAR(15) NOT NULL,
PRIMARY KEY (apt_id, facility_code),
FOREIGN KEY (apt_id) REFERENCES Apartments (apt_id)
);
CREATE TABLE Guests (
guest_id INTEGER NOT NULL ,
gender_code CHAR(1),
guest_first_name VARCHAR(80),
guest_last_name VARCHAR(80),
date_of_birth DATETIME,
PRIMARY KEY (guest_id),
UNIQUE (guest_id)
);
CREATE TABLE Apartment_Bookings (
apt_booking_id INTEGER NOT NULL,
apt_id INTEGER,
guest_id INTEGER NOT NULL,
booking_status_code CHAR(15) NOT NULL,
booking_start_date DATETIME,
booking_end_date DATETIME,
PRIMARY KEY (apt_booking_id),
UNIQUE (apt_booking_id),
FOREIGN KEY (apt_id) REFERENCES Apartments (apt_id),
FOREIGN KEY (guest_id) REFERENCES Guests (guest_id)
);
CREATE TABLE View_Unit_Status (
apt_id INTEGER,
apt_booking_id INTEGER,
status_date DATETIME NOT NULL,
available_yn BIT,
PRIMARY KEY (status_date),
FOREIGN KEY (apt_id) REFERENCES Apartments (apt_id),
FOREIGN KEY (apt_booking_id) REFERENCES Apartment_Bookings (apt_booking_id)
);
INSERT INTO `Apartment_Buildings` (`building_id`, `building_short_name`, `building_full_name`, `building_description`, `building_address`, `building_manager`, `building_phone`) VALUES (133, 'Normandie Court', 'Normandie Court', 'Studio', '7950 Casper Vista Apt. 176
INSERT INTO `Apartments` (`apt_id`, `building_id`, `apt_type_code`, `apt_number`, `bathroom_count`, `bedroom_count`, `room_count`) VALUES (1, 808, 'Flat', 'Suite 645', 1, 3, '7')
INSERT INTO `Apartment_Facilities` (`apt_id`, `facility_code`) VALUES (1, 'Boardband')
INSERT INTO `Guests` (`guest_id`, `gender_code`, `guest_first_name`, `guest_last_name`, `date_of_birth`) VALUES (1, 'Male', 'Kip', 'DuBuque', '1995-11-04 07:09:57')
INSERT INTO `Apartment_Bookings` (`apt_booking_id`, `apt_id`, `guest_id`, `booking_status_code`, `booking_start_date`, `booking_end_date`) VALUES (258, 10, 2, 'Provisional', '2016-09-26 17:13:49', '2017-10-07 11:38:48')
INSERT INTO `View_Unit_Status` (`apt_id`, `apt_booking_id`, `status_date`, `available_yn`) VALUES (11, 920, '1970-09-28 10:24:29', '1') |
apartment_rentals | 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" | Return the booking start date and end date for the apartments that have type code "Duplex". | CREATE TABLE Apartment_Buildings (
building_id INTEGER NOT NULL,
building_short_name CHAR(15),
building_full_name VARCHAR(80),
building_description VARCHAR(255),
building_address VARCHAR(255),
building_manager VARCHAR(50),
building_phone VARCHAR(80),
PRIMARY KEY (building_id),
UNIQUE (building_id)
);
CREATE TABLE Apartments (
apt_id INTEGER NOT NULL ,
building_id INTEGER NOT NULL,
apt_type_code CHAR(15),
apt_number CHAR(10),
bathroom_count INTEGER,
bedroom_count INTEGER,
room_count CHAR(5),
PRIMARY KEY (apt_id),
UNIQUE (apt_id),
FOREIGN KEY (building_id) REFERENCES Apartment_Buildings (building_id)
);
CREATE TABLE Apartment_Facilities (
apt_id INTEGER NOT NULL,
facility_code CHAR(15) NOT NULL,
PRIMARY KEY (apt_id, facility_code),
FOREIGN KEY (apt_id) REFERENCES Apartments (apt_id)
);
CREATE TABLE Guests (
guest_id INTEGER NOT NULL ,
gender_code CHAR(1),
guest_first_name VARCHAR(80),
guest_last_name VARCHAR(80),
date_of_birth DATETIME,
PRIMARY KEY (guest_id),
UNIQUE (guest_id)
);
CREATE TABLE Apartment_Bookings (
apt_booking_id INTEGER NOT NULL,
apt_id INTEGER,
guest_id INTEGER NOT NULL,
booking_status_code CHAR(15) NOT NULL,
booking_start_date DATETIME,
booking_end_date DATETIME,
PRIMARY KEY (apt_booking_id),
UNIQUE (apt_booking_id),
FOREIGN KEY (apt_id) REFERENCES Apartments (apt_id),
FOREIGN KEY (guest_id) REFERENCES Guests (guest_id)
);
CREATE TABLE View_Unit_Status (
apt_id INTEGER,
apt_booking_id INTEGER,
status_date DATETIME NOT NULL,
available_yn BIT,
PRIMARY KEY (status_date),
FOREIGN KEY (apt_id) REFERENCES Apartments (apt_id),
FOREIGN KEY (apt_booking_id) REFERENCES Apartment_Bookings (apt_booking_id)
);
INSERT INTO `Apartment_Buildings` (`building_id`, `building_short_name`, `building_full_name`, `building_description`, `building_address`, `building_manager`, `building_phone`) VALUES (133, 'Normandie Court', 'Normandie Court', 'Studio', '7950 Casper Vista Apt. 176
INSERT INTO `Apartments` (`apt_id`, `building_id`, `apt_type_code`, `apt_number`, `bathroom_count`, `bedroom_count`, `room_count`) VALUES (1, 808, 'Flat', 'Suite 645', 1, 3, '7')
INSERT INTO `Apartment_Facilities` (`apt_id`, `facility_code`) VALUES (1, 'Boardband')
INSERT INTO `Guests` (`guest_id`, `gender_code`, `guest_first_name`, `guest_last_name`, `date_of_birth`) VALUES (1, 'Male', 'Kip', 'DuBuque', '1995-11-04 07:09:57')
INSERT INTO `Apartment_Bookings` (`apt_booking_id`, `apt_id`, `guest_id`, `booking_status_code`, `booking_start_date`, `booking_end_date`) VALUES (258, 10, 2, 'Provisional', '2016-09-26 17:13:49', '2017-10-07 11:38:48')
INSERT INTO `View_Unit_Status` (`apt_id`, `apt_booking_id`, `status_date`, `available_yn`) VALUES (11, 920, '1970-09-28 10:24:29', '1') |
apartment_rentals | 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 | What are the booking start and end dates of the apartments with more than 2 bedrooms? | CREATE TABLE Apartment_Buildings (
building_id INTEGER NOT NULL,
building_short_name CHAR(15),
building_full_name VARCHAR(80),
building_description VARCHAR(255),
building_address VARCHAR(255),
building_manager VARCHAR(50),
building_phone VARCHAR(80),
PRIMARY KEY (building_id),
UNIQUE (building_id)
);
CREATE TABLE Apartments (
apt_id INTEGER NOT NULL ,
building_id INTEGER NOT NULL,
apt_type_code CHAR(15),
apt_number CHAR(10),
bathroom_count INTEGER,
bedroom_count INTEGER,
room_count CHAR(5),
PRIMARY KEY (apt_id),
UNIQUE (apt_id),
FOREIGN KEY (building_id) REFERENCES Apartment_Buildings (building_id)
);
CREATE TABLE Apartment_Facilities (
apt_id INTEGER NOT NULL,
facility_code CHAR(15) NOT NULL,
PRIMARY KEY (apt_id, facility_code),
FOREIGN KEY (apt_id) REFERENCES Apartments (apt_id)
);
CREATE TABLE Guests (
guest_id INTEGER NOT NULL ,
gender_code CHAR(1),
guest_first_name VARCHAR(80),
guest_last_name VARCHAR(80),
date_of_birth DATETIME,
PRIMARY KEY (guest_id),
UNIQUE (guest_id)
);
CREATE TABLE Apartment_Bookings (
apt_booking_id INTEGER NOT NULL,
apt_id INTEGER,
guest_id INTEGER NOT NULL,
booking_status_code CHAR(15) NOT NULL,
booking_start_date DATETIME,
booking_end_date DATETIME,
PRIMARY KEY (apt_booking_id),
UNIQUE (apt_booking_id),
FOREIGN KEY (apt_id) REFERENCES Apartments (apt_id),
FOREIGN KEY (guest_id) REFERENCES Guests (guest_id)
);
CREATE TABLE View_Unit_Status (
apt_id INTEGER,
apt_booking_id INTEGER,
status_date DATETIME NOT NULL,
available_yn BIT,
PRIMARY KEY (status_date),
FOREIGN KEY (apt_id) REFERENCES Apartments (apt_id),
FOREIGN KEY (apt_booking_id) REFERENCES Apartment_Bookings (apt_booking_id)
);
INSERT INTO `Apartment_Buildings` (`building_id`, `building_short_name`, `building_full_name`, `building_description`, `building_address`, `building_manager`, `building_phone`) VALUES (133, 'Normandie Court', 'Normandie Court', 'Studio', '7950 Casper Vista Apt. 176
INSERT INTO `Apartments` (`apt_id`, `building_id`, `apt_type_code`, `apt_number`, `bathroom_count`, `bedroom_count`, `room_count`) VALUES (1, 808, 'Flat', 'Suite 645', 1, 3, '7')
INSERT INTO `Apartment_Facilities` (`apt_id`, `facility_code`) VALUES (1, 'Boardband')
INSERT INTO `Guests` (`guest_id`, `gender_code`, `guest_first_name`, `guest_last_name`, `date_of_birth`) VALUES (1, 'Male', 'Kip', 'DuBuque', '1995-11-04 07:09:57')
INSERT INTO `Apartment_Bookings` (`apt_booking_id`, `apt_id`, `guest_id`, `booking_status_code`, `booking_start_date`, `booking_end_date`) VALUES (258, 10, 2, 'Provisional', '2016-09-26 17:13:49', '2017-10-07 11:38:48')
INSERT INTO `View_Unit_Status` (`apt_id`, `apt_booking_id`, `status_date`, `available_yn`) VALUES (11, 920, '1970-09-28 10:24:29', '1') |
apartment_rentals | 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 | Find the booking start date and end date for the apartments that have more than two bedrooms. | CREATE TABLE Apartment_Buildings (
building_id INTEGER NOT NULL,
building_short_name CHAR(15),
building_full_name VARCHAR(80),
building_description VARCHAR(255),
building_address VARCHAR(255),
building_manager VARCHAR(50),
building_phone VARCHAR(80),
PRIMARY KEY (building_id),
UNIQUE (building_id)
);
CREATE TABLE Apartments (
apt_id INTEGER NOT NULL ,
building_id INTEGER NOT NULL,
apt_type_code CHAR(15),
apt_number CHAR(10),
bathroom_count INTEGER,
bedroom_count INTEGER,
room_count CHAR(5),
PRIMARY KEY (apt_id),
UNIQUE (apt_id),
FOREIGN KEY (building_id) REFERENCES Apartment_Buildings (building_id)
);
CREATE TABLE Apartment_Facilities (
apt_id INTEGER NOT NULL,
facility_code CHAR(15) NOT NULL,
PRIMARY KEY (apt_id, facility_code),
FOREIGN KEY (apt_id) REFERENCES Apartments (apt_id)
);
CREATE TABLE Guests (
guest_id INTEGER NOT NULL ,
gender_code CHAR(1),
guest_first_name VARCHAR(80),
guest_last_name VARCHAR(80),
date_of_birth DATETIME,
PRIMARY KEY (guest_id),
UNIQUE (guest_id)
);
CREATE TABLE Apartment_Bookings (
apt_booking_id INTEGER NOT NULL,
apt_id INTEGER,
guest_id INTEGER NOT NULL,
booking_status_code CHAR(15) NOT NULL,
booking_start_date DATETIME,
booking_end_date DATETIME,
PRIMARY KEY (apt_booking_id),
UNIQUE (apt_booking_id),
FOREIGN KEY (apt_id) REFERENCES Apartments (apt_id),
FOREIGN KEY (guest_id) REFERENCES Guests (guest_id)
);
CREATE TABLE View_Unit_Status (
apt_id INTEGER,
apt_booking_id INTEGER,
status_date DATETIME NOT NULL,
available_yn BIT,
PRIMARY KEY (status_date),
FOREIGN KEY (apt_id) REFERENCES Apartments (apt_id),
FOREIGN KEY (apt_booking_id) REFERENCES Apartment_Bookings (apt_booking_id)
);
INSERT INTO `Apartment_Buildings` (`building_id`, `building_short_name`, `building_full_name`, `building_description`, `building_address`, `building_manager`, `building_phone`) VALUES (133, 'Normandie Court', 'Normandie Court', 'Studio', '7950 Casper Vista Apt. 176
INSERT INTO `Apartments` (`apt_id`, `building_id`, `apt_type_code`, `apt_number`, `bathroom_count`, `bedroom_count`, `room_count`) VALUES (1, 808, 'Flat', 'Suite 645', 1, 3, '7')
INSERT INTO `Apartment_Facilities` (`apt_id`, `facility_code`) VALUES (1, 'Boardband')
INSERT INTO `Guests` (`guest_id`, `gender_code`, `guest_first_name`, `guest_last_name`, `date_of_birth`) VALUES (1, 'Male', 'Kip', 'DuBuque', '1995-11-04 07:09:57')
INSERT INTO `Apartment_Bookings` (`apt_booking_id`, `apt_id`, `guest_id`, `booking_status_code`, `booking_start_date`, `booking_end_date`) VALUES (258, 10, 2, 'Provisional', '2016-09-26 17:13:49', '2017-10-07 11:38:48')
INSERT INTO `View_Unit_Status` (`apt_id`, `apt_booking_id`, `status_date`, `available_yn`) VALUES (11, 920, '1970-09-28 10:24:29', '1') |
apartment_rentals | 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" | What is the booking status code of the apartment with apartment number "Suite 634"? | CREATE TABLE Apartment_Buildings (
building_id INTEGER NOT NULL,
building_short_name CHAR(15),
building_full_name VARCHAR(80),
building_description VARCHAR(255),
building_address VARCHAR(255),
building_manager VARCHAR(50),
building_phone VARCHAR(80),
PRIMARY KEY (building_id),
UNIQUE (building_id)
);
CREATE TABLE Apartments (
apt_id INTEGER NOT NULL ,
building_id INTEGER NOT NULL,
apt_type_code CHAR(15),
apt_number CHAR(10),
bathroom_count INTEGER,
bedroom_count INTEGER,
room_count CHAR(5),
PRIMARY KEY (apt_id),
UNIQUE (apt_id),
FOREIGN KEY (building_id) REFERENCES Apartment_Buildings (building_id)
);
CREATE TABLE Apartment_Facilities (
apt_id INTEGER NOT NULL,
facility_code CHAR(15) NOT NULL,
PRIMARY KEY (apt_id, facility_code),
FOREIGN KEY (apt_id) REFERENCES Apartments (apt_id)
);
CREATE TABLE Guests (
guest_id INTEGER NOT NULL ,
gender_code CHAR(1),
guest_first_name VARCHAR(80),
guest_last_name VARCHAR(80),
date_of_birth DATETIME,
PRIMARY KEY (guest_id),
UNIQUE (guest_id)
);
CREATE TABLE Apartment_Bookings (
apt_booking_id INTEGER NOT NULL,
apt_id INTEGER,
guest_id INTEGER NOT NULL,
booking_status_code CHAR(15) NOT NULL,
booking_start_date DATETIME,
booking_end_date DATETIME,
PRIMARY KEY (apt_booking_id),
UNIQUE (apt_booking_id),
FOREIGN KEY (apt_id) REFERENCES Apartments (apt_id),
FOREIGN KEY (guest_id) REFERENCES Guests (guest_id)
);
CREATE TABLE View_Unit_Status (
apt_id INTEGER,
apt_booking_id INTEGER,
status_date DATETIME NOT NULL,
available_yn BIT,
PRIMARY KEY (status_date),
FOREIGN KEY (apt_id) REFERENCES Apartments (apt_id),
FOREIGN KEY (apt_booking_id) REFERENCES Apartment_Bookings (apt_booking_id)
);
INSERT INTO `Apartment_Buildings` (`building_id`, `building_short_name`, `building_full_name`, `building_description`, `building_address`, `building_manager`, `building_phone`) VALUES (133, 'Normandie Court', 'Normandie Court', 'Studio', '7950 Casper Vista Apt. 176
INSERT INTO `Apartments` (`apt_id`, `building_id`, `apt_type_code`, `apt_number`, `bathroom_count`, `bedroom_count`, `room_count`) VALUES (1, 808, 'Flat', 'Suite 645', 1, 3, '7')
INSERT INTO `Apartment_Facilities` (`apt_id`, `facility_code`) VALUES (1, 'Boardband')
INSERT INTO `Guests` (`guest_id`, `gender_code`, `guest_first_name`, `guest_last_name`, `date_of_birth`) VALUES (1, 'Male', 'Kip', 'DuBuque', '1995-11-04 07:09:57')
INSERT INTO `Apartment_Bookings` (`apt_booking_id`, `apt_id`, `guest_id`, `booking_status_code`, `booking_start_date`, `booking_end_date`) VALUES (258, 10, 2, 'Provisional', '2016-09-26 17:13:49', '2017-10-07 11:38:48')
INSERT INTO `View_Unit_Status` (`apt_id`, `apt_booking_id`, `status_date`, `available_yn`) VALUES (11, 920, '1970-09-28 10:24:29', '1') |
apartment_rentals | 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" | Tell me the booking status code for the apartment with number "Suite 634". | CREATE TABLE Apartment_Buildings (
building_id INTEGER NOT NULL,
building_short_name CHAR(15),
building_full_name VARCHAR(80),
building_description VARCHAR(255),
building_address VARCHAR(255),
building_manager VARCHAR(50),
building_phone VARCHAR(80),
PRIMARY KEY (building_id),
UNIQUE (building_id)
);
CREATE TABLE Apartments (
apt_id INTEGER NOT NULL ,
building_id INTEGER NOT NULL,
apt_type_code CHAR(15),
apt_number CHAR(10),
bathroom_count INTEGER,
bedroom_count INTEGER,
room_count CHAR(5),
PRIMARY KEY (apt_id),
UNIQUE (apt_id),
FOREIGN KEY (building_id) REFERENCES Apartment_Buildings (building_id)
);
CREATE TABLE Apartment_Facilities (
apt_id INTEGER NOT NULL,
facility_code CHAR(15) NOT NULL,
PRIMARY KEY (apt_id, facility_code),
FOREIGN KEY (apt_id) REFERENCES Apartments (apt_id)
);
CREATE TABLE Guests (
guest_id INTEGER NOT NULL ,
gender_code CHAR(1),
guest_first_name VARCHAR(80),
guest_last_name VARCHAR(80),
date_of_birth DATETIME,
PRIMARY KEY (guest_id),
UNIQUE (guest_id)
);
CREATE TABLE Apartment_Bookings (
apt_booking_id INTEGER NOT NULL,
apt_id INTEGER,
guest_id INTEGER NOT NULL,
booking_status_code CHAR(15) NOT NULL,
booking_start_date DATETIME,
booking_end_date DATETIME,
PRIMARY KEY (apt_booking_id),
UNIQUE (apt_booking_id),
FOREIGN KEY (apt_id) REFERENCES Apartments (apt_id),
FOREIGN KEY (guest_id) REFERENCES Guests (guest_id)
);
CREATE TABLE View_Unit_Status (
apt_id INTEGER,
apt_booking_id INTEGER,
status_date DATETIME NOT NULL,
available_yn BIT,
PRIMARY KEY (status_date),
FOREIGN KEY (apt_id) REFERENCES Apartments (apt_id),
FOREIGN KEY (apt_booking_id) REFERENCES Apartment_Bookings (apt_booking_id)
);
INSERT INTO `Apartment_Buildings` (`building_id`, `building_short_name`, `building_full_name`, `building_description`, `building_address`, `building_manager`, `building_phone`) VALUES (133, 'Normandie Court', 'Normandie Court', 'Studio', '7950 Casper Vista Apt. 176
INSERT INTO `Apartments` (`apt_id`, `building_id`, `apt_type_code`, `apt_number`, `bathroom_count`, `bedroom_count`, `room_count`) VALUES (1, 808, 'Flat', 'Suite 645', 1, 3, '7')
INSERT INTO `Apartment_Facilities` (`apt_id`, `facility_code`) VALUES (1, 'Boardband')
INSERT INTO `Guests` (`guest_id`, `gender_code`, `guest_first_name`, `guest_last_name`, `date_of_birth`) VALUES (1, 'Male', 'Kip', 'DuBuque', '1995-11-04 07:09:57')
INSERT INTO `Apartment_Bookings` (`apt_booking_id`, `apt_id`, `guest_id`, `booking_status_code`, `booking_start_date`, `booking_end_date`) VALUES (258, 10, 2, 'Provisional', '2016-09-26 17:13:49', '2017-10-07 11:38:48')
INSERT INTO `View_Unit_Status` (`apt_id`, `apt_booking_id`, `status_date`, `available_yn`) VALUES (11, 920, '1970-09-28 10:24:29', '1') |
apartment_rentals | 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" | Show the distinct apartment numbers of the apartments that have bookings with status code "Confirmed". | CREATE TABLE Apartment_Buildings (
building_id INTEGER NOT NULL,
building_short_name CHAR(15),
building_full_name VARCHAR(80),
building_description VARCHAR(255),
building_address VARCHAR(255),
building_manager VARCHAR(50),
building_phone VARCHAR(80),
PRIMARY KEY (building_id),
UNIQUE (building_id)
);
CREATE TABLE Apartments (
apt_id INTEGER NOT NULL ,
building_id INTEGER NOT NULL,
apt_type_code CHAR(15),
apt_number CHAR(10),
bathroom_count INTEGER,
bedroom_count INTEGER,
room_count CHAR(5),
PRIMARY KEY (apt_id),
UNIQUE (apt_id),
FOREIGN KEY (building_id) REFERENCES Apartment_Buildings (building_id)
);
CREATE TABLE Apartment_Facilities (
apt_id INTEGER NOT NULL,
facility_code CHAR(15) NOT NULL,
PRIMARY KEY (apt_id, facility_code),
FOREIGN KEY (apt_id) REFERENCES Apartments (apt_id)
);
CREATE TABLE Guests (
guest_id INTEGER NOT NULL ,
gender_code CHAR(1),
guest_first_name VARCHAR(80),
guest_last_name VARCHAR(80),
date_of_birth DATETIME,
PRIMARY KEY (guest_id),
UNIQUE (guest_id)
);
CREATE TABLE Apartment_Bookings (
apt_booking_id INTEGER NOT NULL,
apt_id INTEGER,
guest_id INTEGER NOT NULL,
booking_status_code CHAR(15) NOT NULL,
booking_start_date DATETIME,
booking_end_date DATETIME,
PRIMARY KEY (apt_booking_id),
UNIQUE (apt_booking_id),
FOREIGN KEY (apt_id) REFERENCES Apartments (apt_id),
FOREIGN KEY (guest_id) REFERENCES Guests (guest_id)
);
CREATE TABLE View_Unit_Status (
apt_id INTEGER,
apt_booking_id INTEGER,
status_date DATETIME NOT NULL,
available_yn BIT,
PRIMARY KEY (status_date),
FOREIGN KEY (apt_id) REFERENCES Apartments (apt_id),
FOREIGN KEY (apt_booking_id) REFERENCES Apartment_Bookings (apt_booking_id)
);
INSERT INTO `Apartment_Buildings` (`building_id`, `building_short_name`, `building_full_name`, `building_description`, `building_address`, `building_manager`, `building_phone`) VALUES (133, 'Normandie Court', 'Normandie Court', 'Studio', '7950 Casper Vista Apt. 176
INSERT INTO `Apartments` (`apt_id`, `building_id`, `apt_type_code`, `apt_number`, `bathroom_count`, `bedroom_count`, `room_count`) VALUES (1, 808, 'Flat', 'Suite 645', 1, 3, '7')
INSERT INTO `Apartment_Facilities` (`apt_id`, `facility_code`) VALUES (1, 'Boardband')
INSERT INTO `Guests` (`guest_id`, `gender_code`, `guest_first_name`, `guest_last_name`, `date_of_birth`) VALUES (1, 'Male', 'Kip', 'DuBuque', '1995-11-04 07:09:57')
INSERT INTO `Apartment_Bookings` (`apt_booking_id`, `apt_id`, `guest_id`, `booking_status_code`, `booking_start_date`, `booking_end_date`) VALUES (258, 10, 2, 'Provisional', '2016-09-26 17:13:49', '2017-10-07 11:38:48')
INSERT INTO `View_Unit_Status` (`apt_id`, `apt_booking_id`, `status_date`, `available_yn`) VALUES (11, 920, '1970-09-28 10:24:29', '1') |
apartment_rentals | 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" | Which apartments have bookings with status code "Confirmed"? Return their apartment numbers. | CREATE TABLE Apartment_Buildings (
building_id INTEGER NOT NULL,
building_short_name CHAR(15),
building_full_name VARCHAR(80),
building_description VARCHAR(255),
building_address VARCHAR(255),
building_manager VARCHAR(50),
building_phone VARCHAR(80),
PRIMARY KEY (building_id),
UNIQUE (building_id)
);
CREATE TABLE Apartments (
apt_id INTEGER NOT NULL ,
building_id INTEGER NOT NULL,
apt_type_code CHAR(15),
apt_number CHAR(10),
bathroom_count INTEGER,
bedroom_count INTEGER,
room_count CHAR(5),
PRIMARY KEY (apt_id),
UNIQUE (apt_id),
FOREIGN KEY (building_id) REFERENCES Apartment_Buildings (building_id)
);
CREATE TABLE Apartment_Facilities (
apt_id INTEGER NOT NULL,
facility_code CHAR(15) NOT NULL,
PRIMARY KEY (apt_id, facility_code),
FOREIGN KEY (apt_id) REFERENCES Apartments (apt_id)
);
CREATE TABLE Guests (
guest_id INTEGER NOT NULL ,
gender_code CHAR(1),
guest_first_name VARCHAR(80),
guest_last_name VARCHAR(80),
date_of_birth DATETIME,
PRIMARY KEY (guest_id),
UNIQUE (guest_id)
);
CREATE TABLE Apartment_Bookings (
apt_booking_id INTEGER NOT NULL,
apt_id INTEGER,
guest_id INTEGER NOT NULL,
booking_status_code CHAR(15) NOT NULL,
booking_start_date DATETIME,
booking_end_date DATETIME,
PRIMARY KEY (apt_booking_id),
UNIQUE (apt_booking_id),
FOREIGN KEY (apt_id) REFERENCES Apartments (apt_id),
FOREIGN KEY (guest_id) REFERENCES Guests (guest_id)
);
CREATE TABLE View_Unit_Status (
apt_id INTEGER,
apt_booking_id INTEGER,
status_date DATETIME NOT NULL,
available_yn BIT,
PRIMARY KEY (status_date),
FOREIGN KEY (apt_id) REFERENCES Apartments (apt_id),
FOREIGN KEY (apt_booking_id) REFERENCES Apartment_Bookings (apt_booking_id)
);
INSERT INTO `Apartment_Buildings` (`building_id`, `building_short_name`, `building_full_name`, `building_description`, `building_address`, `building_manager`, `building_phone`) VALUES (133, 'Normandie Court', 'Normandie Court', 'Studio', '7950 Casper Vista Apt. 176
INSERT INTO `Apartments` (`apt_id`, `building_id`, `apt_type_code`, `apt_number`, `bathroom_count`, `bedroom_count`, `room_count`) VALUES (1, 808, 'Flat', 'Suite 645', 1, 3, '7')
INSERT INTO `Apartment_Facilities` (`apt_id`, `facility_code`) VALUES (1, 'Boardband')
INSERT INTO `Guests` (`guest_id`, `gender_code`, `guest_first_name`, `guest_last_name`, `date_of_birth`) VALUES (1, 'Male', 'Kip', 'DuBuque', '1995-11-04 07:09:57')
INSERT INTO `Apartment_Bookings` (`apt_booking_id`, `apt_id`, `guest_id`, `booking_status_code`, `booking_start_date`, `booking_end_date`) VALUES (258, 10, 2, 'Provisional', '2016-09-26 17:13:49', '2017-10-07 11:38:48')
INSERT INTO `View_Unit_Status` (`apt_id`, `apt_booking_id`, `status_date`, `available_yn`) VALUES (11, 920, '1970-09-28 10:24:29', '1') |
apartment_rentals | 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" | Show the average room count of the apartments that have booking status code "Provisional". | CREATE TABLE Apartment_Buildings (
building_id INTEGER NOT NULL,
building_short_name CHAR(15),
building_full_name VARCHAR(80),
building_description VARCHAR(255),
building_address VARCHAR(255),
building_manager VARCHAR(50),
building_phone VARCHAR(80),
PRIMARY KEY (building_id),
UNIQUE (building_id)
);
CREATE TABLE Apartments (
apt_id INTEGER NOT NULL ,
building_id INTEGER NOT NULL,
apt_type_code CHAR(15),
apt_number CHAR(10),
bathroom_count INTEGER,
bedroom_count INTEGER,
room_count CHAR(5),
PRIMARY KEY (apt_id),
UNIQUE (apt_id),
FOREIGN KEY (building_id) REFERENCES Apartment_Buildings (building_id)
);
CREATE TABLE Apartment_Facilities (
apt_id INTEGER NOT NULL,
facility_code CHAR(15) NOT NULL,
PRIMARY KEY (apt_id, facility_code),
FOREIGN KEY (apt_id) REFERENCES Apartments (apt_id)
);
CREATE TABLE Guests (
guest_id INTEGER NOT NULL ,
gender_code CHAR(1),
guest_first_name VARCHAR(80),
guest_last_name VARCHAR(80),
date_of_birth DATETIME,
PRIMARY KEY (guest_id),
UNIQUE (guest_id)
);
CREATE TABLE Apartment_Bookings (
apt_booking_id INTEGER NOT NULL,
apt_id INTEGER,
guest_id INTEGER NOT NULL,
booking_status_code CHAR(15) NOT NULL,
booking_start_date DATETIME,
booking_end_date DATETIME,
PRIMARY KEY (apt_booking_id),
UNIQUE (apt_booking_id),
FOREIGN KEY (apt_id) REFERENCES Apartments (apt_id),
FOREIGN KEY (guest_id) REFERENCES Guests (guest_id)
);
CREATE TABLE View_Unit_Status (
apt_id INTEGER,
apt_booking_id INTEGER,
status_date DATETIME NOT NULL,
available_yn BIT,
PRIMARY KEY (status_date),
FOREIGN KEY (apt_id) REFERENCES Apartments (apt_id),
FOREIGN KEY (apt_booking_id) REFERENCES Apartment_Bookings (apt_booking_id)
);
INSERT INTO `Apartment_Buildings` (`building_id`, `building_short_name`, `building_full_name`, `building_description`, `building_address`, `building_manager`, `building_phone`) VALUES (133, 'Normandie Court', 'Normandie Court', 'Studio', '7950 Casper Vista Apt. 176
INSERT INTO `Apartments` (`apt_id`, `building_id`, `apt_type_code`, `apt_number`, `bathroom_count`, `bedroom_count`, `room_count`) VALUES (1, 808, 'Flat', 'Suite 645', 1, 3, '7')
INSERT INTO `Apartment_Facilities` (`apt_id`, `facility_code`) VALUES (1, 'Boardband')
INSERT INTO `Guests` (`guest_id`, `gender_code`, `guest_first_name`, `guest_last_name`, `date_of_birth`) VALUES (1, 'Male', 'Kip', 'DuBuque', '1995-11-04 07:09:57')
INSERT INTO `Apartment_Bookings` (`apt_booking_id`, `apt_id`, `guest_id`, `booking_status_code`, `booking_start_date`, `booking_end_date`) VALUES (258, 10, 2, 'Provisional', '2016-09-26 17:13:49', '2017-10-07 11:38:48')
INSERT INTO `View_Unit_Status` (`apt_id`, `apt_booking_id`, `status_date`, `available_yn`) VALUES (11, 920, '1970-09-28 10:24:29', '1') |
apartment_rentals | 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" | What is the average room count of the apartments whose booking status code is "Provisional"? | CREATE TABLE Apartment_Buildings (
building_id INTEGER NOT NULL,
building_short_name CHAR(15),
building_full_name VARCHAR(80),
building_description VARCHAR(255),
building_address VARCHAR(255),
building_manager VARCHAR(50),
building_phone VARCHAR(80),
PRIMARY KEY (building_id),
UNIQUE (building_id)
);
CREATE TABLE Apartments (
apt_id INTEGER NOT NULL ,
building_id INTEGER NOT NULL,
apt_type_code CHAR(15),
apt_number CHAR(10),
bathroom_count INTEGER,
bedroom_count INTEGER,
room_count CHAR(5),
PRIMARY KEY (apt_id),
UNIQUE (apt_id),
FOREIGN KEY (building_id) REFERENCES Apartment_Buildings (building_id)
);
CREATE TABLE Apartment_Facilities (
apt_id INTEGER NOT NULL,
facility_code CHAR(15) NOT NULL,
PRIMARY KEY (apt_id, facility_code),
FOREIGN KEY (apt_id) REFERENCES Apartments (apt_id)
);
CREATE TABLE Guests (
guest_id INTEGER NOT NULL ,
gender_code CHAR(1),
guest_first_name VARCHAR(80),
guest_last_name VARCHAR(80),
date_of_birth DATETIME,
PRIMARY KEY (guest_id),
UNIQUE (guest_id)
);
CREATE TABLE Apartment_Bookings (
apt_booking_id INTEGER NOT NULL,
apt_id INTEGER,
guest_id INTEGER NOT NULL,
booking_status_code CHAR(15) NOT NULL,
booking_start_date DATETIME,
booking_end_date DATETIME,
PRIMARY KEY (apt_booking_id),
UNIQUE (apt_booking_id),
FOREIGN KEY (apt_id) REFERENCES Apartments (apt_id),
FOREIGN KEY (guest_id) REFERENCES Guests (guest_id)
);
CREATE TABLE View_Unit_Status (
apt_id INTEGER,
apt_booking_id INTEGER,
status_date DATETIME NOT NULL,
available_yn BIT,
PRIMARY KEY (status_date),
FOREIGN KEY (apt_id) REFERENCES Apartments (apt_id),
FOREIGN KEY (apt_booking_id) REFERENCES Apartment_Bookings (apt_booking_id)
);
INSERT INTO `Apartment_Buildings` (`building_id`, `building_short_name`, `building_full_name`, `building_description`, `building_address`, `building_manager`, `building_phone`) VALUES (133, 'Normandie Court', 'Normandie Court', 'Studio', '7950 Casper Vista Apt. 176
INSERT INTO `Apartments` (`apt_id`, `building_id`, `apt_type_code`, `apt_number`, `bathroom_count`, `bedroom_count`, `room_count`) VALUES (1, 808, 'Flat', 'Suite 645', 1, 3, '7')
INSERT INTO `Apartment_Facilities` (`apt_id`, `facility_code`) VALUES (1, 'Boardband')
INSERT INTO `Guests` (`guest_id`, `gender_code`, `guest_first_name`, `guest_last_name`, `date_of_birth`) VALUES (1, 'Male', 'Kip', 'DuBuque', '1995-11-04 07:09:57')
INSERT INTO `Apartment_Bookings` (`apt_booking_id`, `apt_id`, `guest_id`, `booking_status_code`, `booking_start_date`, `booking_end_date`) VALUES (258, 10, 2, 'Provisional', '2016-09-26 17:13:49', '2017-10-07 11:38:48')
INSERT INTO `View_Unit_Status` (`apt_id`, `apt_booking_id`, `status_date`, `available_yn`) VALUES (11, 920, '1970-09-28 10:24:29', '1') |
apartment_rentals | 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 | Show the guest first names, start dates, and end dates of all the apartment bookings. | CREATE TABLE Apartment_Buildings (
building_id INTEGER NOT NULL,
building_short_name CHAR(15),
building_full_name VARCHAR(80),
building_description VARCHAR(255),
building_address VARCHAR(255),
building_manager VARCHAR(50),
building_phone VARCHAR(80),
PRIMARY KEY (building_id),
UNIQUE (building_id)
);
CREATE TABLE Apartments (
apt_id INTEGER NOT NULL ,
building_id INTEGER NOT NULL,
apt_type_code CHAR(15),
apt_number CHAR(10),
bathroom_count INTEGER,
bedroom_count INTEGER,
room_count CHAR(5),
PRIMARY KEY (apt_id),
UNIQUE (apt_id),
FOREIGN KEY (building_id) REFERENCES Apartment_Buildings (building_id)
);
CREATE TABLE Apartment_Facilities (
apt_id INTEGER NOT NULL,
facility_code CHAR(15) NOT NULL,
PRIMARY KEY (apt_id, facility_code),
FOREIGN KEY (apt_id) REFERENCES Apartments (apt_id)
);
CREATE TABLE Guests (
guest_id INTEGER NOT NULL ,
gender_code CHAR(1),
guest_first_name VARCHAR(80),
guest_last_name VARCHAR(80),
date_of_birth DATETIME,
PRIMARY KEY (guest_id),
UNIQUE (guest_id)
);
CREATE TABLE Apartment_Bookings (
apt_booking_id INTEGER NOT NULL,
apt_id INTEGER,
guest_id INTEGER NOT NULL,
booking_status_code CHAR(15) NOT NULL,
booking_start_date DATETIME,
booking_end_date DATETIME,
PRIMARY KEY (apt_booking_id),
UNIQUE (apt_booking_id),
FOREIGN KEY (apt_id) REFERENCES Apartments (apt_id),
FOREIGN KEY (guest_id) REFERENCES Guests (guest_id)
);
CREATE TABLE View_Unit_Status (
apt_id INTEGER,
apt_booking_id INTEGER,
status_date DATETIME NOT NULL,
available_yn BIT,
PRIMARY KEY (status_date),
FOREIGN KEY (apt_id) REFERENCES Apartments (apt_id),
FOREIGN KEY (apt_booking_id) REFERENCES Apartment_Bookings (apt_booking_id)
);
INSERT INTO `Apartment_Buildings` (`building_id`, `building_short_name`, `building_full_name`, `building_description`, `building_address`, `building_manager`, `building_phone`) VALUES (133, 'Normandie Court', 'Normandie Court', 'Studio', '7950 Casper Vista Apt. 176
INSERT INTO `Apartments` (`apt_id`, `building_id`, `apt_type_code`, `apt_number`, `bathroom_count`, `bedroom_count`, `room_count`) VALUES (1, 808, 'Flat', 'Suite 645', 1, 3, '7')
INSERT INTO `Apartment_Facilities` (`apt_id`, `facility_code`) VALUES (1, 'Boardband')
INSERT INTO `Guests` (`guest_id`, `gender_code`, `guest_first_name`, `guest_last_name`, `date_of_birth`) VALUES (1, 'Male', 'Kip', 'DuBuque', '1995-11-04 07:09:57')
INSERT INTO `Apartment_Bookings` (`apt_booking_id`, `apt_id`, `guest_id`, `booking_status_code`, `booking_start_date`, `booking_end_date`) VALUES (258, 10, 2, 'Provisional', '2016-09-26 17:13:49', '2017-10-07 11:38:48')
INSERT INTO `View_Unit_Status` (`apt_id`, `apt_booking_id`, `status_date`, `available_yn`) VALUES (11, 920, '1970-09-28 10:24:29', '1') |
apartment_rentals | 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 | What are the guest first name, start date, and end date of each apartment booking? | CREATE TABLE Apartment_Buildings (
building_id INTEGER NOT NULL,
building_short_name CHAR(15),
building_full_name VARCHAR(80),
building_description VARCHAR(255),
building_address VARCHAR(255),
building_manager VARCHAR(50),
building_phone VARCHAR(80),
PRIMARY KEY (building_id),
UNIQUE (building_id)
);
CREATE TABLE Apartments (
apt_id INTEGER NOT NULL ,
building_id INTEGER NOT NULL,
apt_type_code CHAR(15),
apt_number CHAR(10),
bathroom_count INTEGER,
bedroom_count INTEGER,
room_count CHAR(5),
PRIMARY KEY (apt_id),
UNIQUE (apt_id),
FOREIGN KEY (building_id) REFERENCES Apartment_Buildings (building_id)
);
CREATE TABLE Apartment_Facilities (
apt_id INTEGER NOT NULL,
facility_code CHAR(15) NOT NULL,
PRIMARY KEY (apt_id, facility_code),
FOREIGN KEY (apt_id) REFERENCES Apartments (apt_id)
);
CREATE TABLE Guests (
guest_id INTEGER NOT NULL ,
gender_code CHAR(1),
guest_first_name VARCHAR(80),
guest_last_name VARCHAR(80),
date_of_birth DATETIME,
PRIMARY KEY (guest_id),
UNIQUE (guest_id)
);
CREATE TABLE Apartment_Bookings (
apt_booking_id INTEGER NOT NULL,
apt_id INTEGER,
guest_id INTEGER NOT NULL,
booking_status_code CHAR(15) NOT NULL,
booking_start_date DATETIME,
booking_end_date DATETIME,
PRIMARY KEY (apt_booking_id),
UNIQUE (apt_booking_id),
FOREIGN KEY (apt_id) REFERENCES Apartments (apt_id),
FOREIGN KEY (guest_id) REFERENCES Guests (guest_id)
);
CREATE TABLE View_Unit_Status (
apt_id INTEGER,
apt_booking_id INTEGER,
status_date DATETIME NOT NULL,
available_yn BIT,
PRIMARY KEY (status_date),
FOREIGN KEY (apt_id) REFERENCES Apartments (apt_id),
FOREIGN KEY (apt_booking_id) REFERENCES Apartment_Bookings (apt_booking_id)
);
INSERT INTO `Apartment_Buildings` (`building_id`, `building_short_name`, `building_full_name`, `building_description`, `building_address`, `building_manager`, `building_phone`) VALUES (133, 'Normandie Court', 'Normandie Court', 'Studio', '7950 Casper Vista Apt. 176
INSERT INTO `Apartments` (`apt_id`, `building_id`, `apt_type_code`, `apt_number`, `bathroom_count`, `bedroom_count`, `room_count`) VALUES (1, 808, 'Flat', 'Suite 645', 1, 3, '7')
INSERT INTO `Apartment_Facilities` (`apt_id`, `facility_code`) VALUES (1, 'Boardband')
INSERT INTO `Guests` (`guest_id`, `gender_code`, `guest_first_name`, `guest_last_name`, `date_of_birth`) VALUES (1, 'Male', 'Kip', 'DuBuque', '1995-11-04 07:09:57')
INSERT INTO `Apartment_Bookings` (`apt_booking_id`, `apt_id`, `guest_id`, `booking_status_code`, `booking_start_date`, `booking_end_date`) VALUES (258, 10, 2, 'Provisional', '2016-09-26 17:13:49', '2017-10-07 11:38:48')
INSERT INTO `View_Unit_Status` (`apt_id`, `apt_booking_id`, `status_date`, `available_yn`) VALUES (11, 920, '1970-09-28 10:24:29', '1') |
apartment_rentals | 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" | Show the start dates and end dates of all the apartment bookings made by guests with gender code "Female". | CREATE TABLE Apartment_Buildings (
building_id INTEGER NOT NULL,
building_short_name CHAR(15),
building_full_name VARCHAR(80),
building_description VARCHAR(255),
building_address VARCHAR(255),
building_manager VARCHAR(50),
building_phone VARCHAR(80),
PRIMARY KEY (building_id),
UNIQUE (building_id)
);
CREATE TABLE Apartments (
apt_id INTEGER NOT NULL ,
building_id INTEGER NOT NULL,
apt_type_code CHAR(15),
apt_number CHAR(10),
bathroom_count INTEGER,
bedroom_count INTEGER,
room_count CHAR(5),
PRIMARY KEY (apt_id),
UNIQUE (apt_id),
FOREIGN KEY (building_id) REFERENCES Apartment_Buildings (building_id)
);
CREATE TABLE Apartment_Facilities (
apt_id INTEGER NOT NULL,
facility_code CHAR(15) NOT NULL,
PRIMARY KEY (apt_id, facility_code),
FOREIGN KEY (apt_id) REFERENCES Apartments (apt_id)
);
CREATE TABLE Guests (
guest_id INTEGER NOT NULL ,
gender_code CHAR(1),
guest_first_name VARCHAR(80),
guest_last_name VARCHAR(80),
date_of_birth DATETIME,
PRIMARY KEY (guest_id),
UNIQUE (guest_id)
);
CREATE TABLE Apartment_Bookings (
apt_booking_id INTEGER NOT NULL,
apt_id INTEGER,
guest_id INTEGER NOT NULL,
booking_status_code CHAR(15) NOT NULL,
booking_start_date DATETIME,
booking_end_date DATETIME,
PRIMARY KEY (apt_booking_id),
UNIQUE (apt_booking_id),
FOREIGN KEY (apt_id) REFERENCES Apartments (apt_id),
FOREIGN KEY (guest_id) REFERENCES Guests (guest_id)
);
CREATE TABLE View_Unit_Status (
apt_id INTEGER,
apt_booking_id INTEGER,
status_date DATETIME NOT NULL,
available_yn BIT,
PRIMARY KEY (status_date),
FOREIGN KEY (apt_id) REFERENCES Apartments (apt_id),
FOREIGN KEY (apt_booking_id) REFERENCES Apartment_Bookings (apt_booking_id)
);
INSERT INTO `Apartment_Buildings` (`building_id`, `building_short_name`, `building_full_name`, `building_description`, `building_address`, `building_manager`, `building_phone`) VALUES (133, 'Normandie Court', 'Normandie Court', 'Studio', '7950 Casper Vista Apt. 176
INSERT INTO `Apartments` (`apt_id`, `building_id`, `apt_type_code`, `apt_number`, `bathroom_count`, `bedroom_count`, `room_count`) VALUES (1, 808, 'Flat', 'Suite 645', 1, 3, '7')
INSERT INTO `Apartment_Facilities` (`apt_id`, `facility_code`) VALUES (1, 'Boardband')
INSERT INTO `Guests` (`guest_id`, `gender_code`, `guest_first_name`, `guest_last_name`, `date_of_birth`) VALUES (1, 'Male', 'Kip', 'DuBuque', '1995-11-04 07:09:57')
INSERT INTO `Apartment_Bookings` (`apt_booking_id`, `apt_id`, `guest_id`, `booking_status_code`, `booking_start_date`, `booking_end_date`) VALUES (258, 10, 2, 'Provisional', '2016-09-26 17:13:49', '2017-10-07 11:38:48')
INSERT INTO `View_Unit_Status` (`apt_id`, `apt_booking_id`, `status_date`, `available_yn`) VALUES (11, 920, '1970-09-28 10:24:29', '1') |
apartment_rentals | 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" | What are the start date and end date of the apartment bookings made by female guests (gender code "Female")? | CREATE TABLE Apartment_Buildings (
building_id INTEGER NOT NULL,
building_short_name CHAR(15),
building_full_name VARCHAR(80),
building_description VARCHAR(255),
building_address VARCHAR(255),
building_manager VARCHAR(50),
building_phone VARCHAR(80),
PRIMARY KEY (building_id),
UNIQUE (building_id)
);
CREATE TABLE Apartments (
apt_id INTEGER NOT NULL ,
building_id INTEGER NOT NULL,
apt_type_code CHAR(15),
apt_number CHAR(10),
bathroom_count INTEGER,
bedroom_count INTEGER,
room_count CHAR(5),
PRIMARY KEY (apt_id),
UNIQUE (apt_id),
FOREIGN KEY (building_id) REFERENCES Apartment_Buildings (building_id)
);
CREATE TABLE Apartment_Facilities (
apt_id INTEGER NOT NULL,
facility_code CHAR(15) NOT NULL,
PRIMARY KEY (apt_id, facility_code),
FOREIGN KEY (apt_id) REFERENCES Apartments (apt_id)
);
CREATE TABLE Guests (
guest_id INTEGER NOT NULL ,
gender_code CHAR(1),
guest_first_name VARCHAR(80),
guest_last_name VARCHAR(80),
date_of_birth DATETIME,
PRIMARY KEY (guest_id),
UNIQUE (guest_id)
);
CREATE TABLE Apartment_Bookings (
apt_booking_id INTEGER NOT NULL,
apt_id INTEGER,
guest_id INTEGER NOT NULL,
booking_status_code CHAR(15) NOT NULL,
booking_start_date DATETIME,
booking_end_date DATETIME,
PRIMARY KEY (apt_booking_id),
UNIQUE (apt_booking_id),
FOREIGN KEY (apt_id) REFERENCES Apartments (apt_id),
FOREIGN KEY (guest_id) REFERENCES Guests (guest_id)
);
CREATE TABLE View_Unit_Status (
apt_id INTEGER,
apt_booking_id INTEGER,
status_date DATETIME NOT NULL,
available_yn BIT,
PRIMARY KEY (status_date),
FOREIGN KEY (apt_id) REFERENCES Apartments (apt_id),
FOREIGN KEY (apt_booking_id) REFERENCES Apartment_Bookings (apt_booking_id)
);
INSERT INTO `Apartment_Buildings` (`building_id`, `building_short_name`, `building_full_name`, `building_description`, `building_address`, `building_manager`, `building_phone`) VALUES (133, 'Normandie Court', 'Normandie Court', 'Studio', '7950 Casper Vista Apt. 176
INSERT INTO `Apartments` (`apt_id`, `building_id`, `apt_type_code`, `apt_number`, `bathroom_count`, `bedroom_count`, `room_count`) VALUES (1, 808, 'Flat', 'Suite 645', 1, 3, '7')
INSERT INTO `Apartment_Facilities` (`apt_id`, `facility_code`) VALUES (1, 'Boardband')
INSERT INTO `Guests` (`guest_id`, `gender_code`, `guest_first_name`, `guest_last_name`, `date_of_birth`) VALUES (1, 'Male', 'Kip', 'DuBuque', '1995-11-04 07:09:57')
INSERT INTO `Apartment_Bookings` (`apt_booking_id`, `apt_id`, `guest_id`, `booking_status_code`, `booking_start_date`, `booking_end_date`) VALUES (258, 10, 2, 'Provisional', '2016-09-26 17:13:49', '2017-10-07 11:38:48')
INSERT INTO `View_Unit_Status` (`apt_id`, `apt_booking_id`, `status_date`, `available_yn`) VALUES (11, 920, '1970-09-28 10:24:29', '1') |
apartment_rentals | 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" | Show the first names and last names of all the guests that have apartment bookings with status code "Confirmed". | CREATE TABLE Apartment_Buildings (
building_id INTEGER NOT NULL,
building_short_name CHAR(15),
building_full_name VARCHAR(80),
building_description VARCHAR(255),
building_address VARCHAR(255),
building_manager VARCHAR(50),
building_phone VARCHAR(80),
PRIMARY KEY (building_id),
UNIQUE (building_id)
);
CREATE TABLE Apartments (
apt_id INTEGER NOT NULL ,
building_id INTEGER NOT NULL,
apt_type_code CHAR(15),
apt_number CHAR(10),
bathroom_count INTEGER,
bedroom_count INTEGER,
room_count CHAR(5),
PRIMARY KEY (apt_id),
UNIQUE (apt_id),
FOREIGN KEY (building_id) REFERENCES Apartment_Buildings (building_id)
);
CREATE TABLE Apartment_Facilities (
apt_id INTEGER NOT NULL,
facility_code CHAR(15) NOT NULL,
PRIMARY KEY (apt_id, facility_code),
FOREIGN KEY (apt_id) REFERENCES Apartments (apt_id)
);
CREATE TABLE Guests (
guest_id INTEGER NOT NULL ,
gender_code CHAR(1),
guest_first_name VARCHAR(80),
guest_last_name VARCHAR(80),
date_of_birth DATETIME,
PRIMARY KEY (guest_id),
UNIQUE (guest_id)
);
CREATE TABLE Apartment_Bookings (
apt_booking_id INTEGER NOT NULL,
apt_id INTEGER,
guest_id INTEGER NOT NULL,
booking_status_code CHAR(15) NOT NULL,
booking_start_date DATETIME,
booking_end_date DATETIME,
PRIMARY KEY (apt_booking_id),
UNIQUE (apt_booking_id),
FOREIGN KEY (apt_id) REFERENCES Apartments (apt_id),
FOREIGN KEY (guest_id) REFERENCES Guests (guest_id)
);
CREATE TABLE View_Unit_Status (
apt_id INTEGER,
apt_booking_id INTEGER,
status_date DATETIME NOT NULL,
available_yn BIT,
PRIMARY KEY (status_date),
FOREIGN KEY (apt_id) REFERENCES Apartments (apt_id),
FOREIGN KEY (apt_booking_id) REFERENCES Apartment_Bookings (apt_booking_id)
);
INSERT INTO `Apartment_Buildings` (`building_id`, `building_short_name`, `building_full_name`, `building_description`, `building_address`, `building_manager`, `building_phone`) VALUES (133, 'Normandie Court', 'Normandie Court', 'Studio', '7950 Casper Vista Apt. 176
INSERT INTO `Apartments` (`apt_id`, `building_id`, `apt_type_code`, `apt_number`, `bathroom_count`, `bedroom_count`, `room_count`) VALUES (1, 808, 'Flat', 'Suite 645', 1, 3, '7')
INSERT INTO `Apartment_Facilities` (`apt_id`, `facility_code`) VALUES (1, 'Boardband')
INSERT INTO `Guests` (`guest_id`, `gender_code`, `guest_first_name`, `guest_last_name`, `date_of_birth`) VALUES (1, 'Male', 'Kip', 'DuBuque', '1995-11-04 07:09:57')
INSERT INTO `Apartment_Bookings` (`apt_booking_id`, `apt_id`, `guest_id`, `booking_status_code`, `booking_start_date`, `booking_end_date`) VALUES (258, 10, 2, 'Provisional', '2016-09-26 17:13:49', '2017-10-07 11:38:48')
INSERT INTO `View_Unit_Status` (`apt_id`, `apt_booking_id`, `status_date`, `available_yn`) VALUES (11, 920, '1970-09-28 10:24:29', '1') |
apartment_rentals | 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" | Which guests have apartment bookings with status code "Confirmed"? Return their first names and last names. | CREATE TABLE Apartment_Buildings (
building_id INTEGER NOT NULL,
building_short_name CHAR(15),
building_full_name VARCHAR(80),
building_description VARCHAR(255),
building_address VARCHAR(255),
building_manager VARCHAR(50),
building_phone VARCHAR(80),
PRIMARY KEY (building_id),
UNIQUE (building_id)
);
CREATE TABLE Apartments (
apt_id INTEGER NOT NULL ,
building_id INTEGER NOT NULL,
apt_type_code CHAR(15),
apt_number CHAR(10),
bathroom_count INTEGER,
bedroom_count INTEGER,
room_count CHAR(5),
PRIMARY KEY (apt_id),
UNIQUE (apt_id),
FOREIGN KEY (building_id) REFERENCES Apartment_Buildings (building_id)
);
CREATE TABLE Apartment_Facilities (
apt_id INTEGER NOT NULL,
facility_code CHAR(15) NOT NULL,
PRIMARY KEY (apt_id, facility_code),
FOREIGN KEY (apt_id) REFERENCES Apartments (apt_id)
);
CREATE TABLE Guests (
guest_id INTEGER NOT NULL ,
gender_code CHAR(1),
guest_first_name VARCHAR(80),
guest_last_name VARCHAR(80),
date_of_birth DATETIME,
PRIMARY KEY (guest_id),
UNIQUE (guest_id)
);
CREATE TABLE Apartment_Bookings (
apt_booking_id INTEGER NOT NULL,
apt_id INTEGER,
guest_id INTEGER NOT NULL,
booking_status_code CHAR(15) NOT NULL,
booking_start_date DATETIME,
booking_end_date DATETIME,
PRIMARY KEY (apt_booking_id),
UNIQUE (apt_booking_id),
FOREIGN KEY (apt_id) REFERENCES Apartments (apt_id),
FOREIGN KEY (guest_id) REFERENCES Guests (guest_id)
);
CREATE TABLE View_Unit_Status (
apt_id INTEGER,
apt_booking_id INTEGER,
status_date DATETIME NOT NULL,
available_yn BIT,
PRIMARY KEY (status_date),
FOREIGN KEY (apt_id) REFERENCES Apartments (apt_id),
FOREIGN KEY (apt_booking_id) REFERENCES Apartment_Bookings (apt_booking_id)
);
INSERT INTO `Apartment_Buildings` (`building_id`, `building_short_name`, `building_full_name`, `building_description`, `building_address`, `building_manager`, `building_phone`) VALUES (133, 'Normandie Court', 'Normandie Court', 'Studio', '7950 Casper Vista Apt. 176
INSERT INTO `Apartments` (`apt_id`, `building_id`, `apt_type_code`, `apt_number`, `bathroom_count`, `bedroom_count`, `room_count`) VALUES (1, 808, 'Flat', 'Suite 645', 1, 3, '7')
INSERT INTO `Apartment_Facilities` (`apt_id`, `facility_code`) VALUES (1, 'Boardband')
INSERT INTO `Guests` (`guest_id`, `gender_code`, `guest_first_name`, `guest_last_name`, `date_of_birth`) VALUES (1, 'Male', 'Kip', 'DuBuque', '1995-11-04 07:09:57')
INSERT INTO `Apartment_Bookings` (`apt_booking_id`, `apt_id`, `guest_id`, `booking_status_code`, `booking_start_date`, `booking_end_date`) VALUES (258, 10, 2, 'Provisional', '2016-09-26 17:13:49', '2017-10-07 11:38:48')
INSERT INTO `View_Unit_Status` (`apt_id`, `apt_booking_id`, `status_date`, `available_yn`) VALUES (11, 920, '1970-09-28 10:24:29', '1') |
apartment_rentals | 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 | Show the facility codes of apartments with more than 4 bedrooms. | CREATE TABLE Apartment_Buildings (
building_id INTEGER NOT NULL,
building_short_name CHAR(15),
building_full_name VARCHAR(80),
building_description VARCHAR(255),
building_address VARCHAR(255),
building_manager VARCHAR(50),
building_phone VARCHAR(80),
PRIMARY KEY (building_id),
UNIQUE (building_id)
);
CREATE TABLE Apartments (
apt_id INTEGER NOT NULL ,
building_id INTEGER NOT NULL,
apt_type_code CHAR(15),
apt_number CHAR(10),
bathroom_count INTEGER,
bedroom_count INTEGER,
room_count CHAR(5),
PRIMARY KEY (apt_id),
UNIQUE (apt_id),
FOREIGN KEY (building_id) REFERENCES Apartment_Buildings (building_id)
);
CREATE TABLE Apartment_Facilities (
apt_id INTEGER NOT NULL,
facility_code CHAR(15) NOT NULL,
PRIMARY KEY (apt_id, facility_code),
FOREIGN KEY (apt_id) REFERENCES Apartments (apt_id)
);
CREATE TABLE Guests (
guest_id INTEGER NOT NULL ,
gender_code CHAR(1),
guest_first_name VARCHAR(80),
guest_last_name VARCHAR(80),
date_of_birth DATETIME,
PRIMARY KEY (guest_id),
UNIQUE (guest_id)
);
CREATE TABLE Apartment_Bookings (
apt_booking_id INTEGER NOT NULL,
apt_id INTEGER,
guest_id INTEGER NOT NULL,
booking_status_code CHAR(15) NOT NULL,
booking_start_date DATETIME,
booking_end_date DATETIME,
PRIMARY KEY (apt_booking_id),
UNIQUE (apt_booking_id),
FOREIGN KEY (apt_id) REFERENCES Apartments (apt_id),
FOREIGN KEY (guest_id) REFERENCES Guests (guest_id)
);
CREATE TABLE View_Unit_Status (
apt_id INTEGER,
apt_booking_id INTEGER,
status_date DATETIME NOT NULL,
available_yn BIT,
PRIMARY KEY (status_date),
FOREIGN KEY (apt_id) REFERENCES Apartments (apt_id),
FOREIGN KEY (apt_booking_id) REFERENCES Apartment_Bookings (apt_booking_id)
);
INSERT INTO `Apartment_Buildings` (`building_id`, `building_short_name`, `building_full_name`, `building_description`, `building_address`, `building_manager`, `building_phone`) VALUES (133, 'Normandie Court', 'Normandie Court', 'Studio', '7950 Casper Vista Apt. 176
INSERT INTO `Apartments` (`apt_id`, `building_id`, `apt_type_code`, `apt_number`, `bathroom_count`, `bedroom_count`, `room_count`) VALUES (1, 808, 'Flat', 'Suite 645', 1, 3, '7')
INSERT INTO `Apartment_Facilities` (`apt_id`, `facility_code`) VALUES (1, 'Boardband')
INSERT INTO `Guests` (`guest_id`, `gender_code`, `guest_first_name`, `guest_last_name`, `date_of_birth`) VALUES (1, 'Male', 'Kip', 'DuBuque', '1995-11-04 07:09:57')
INSERT INTO `Apartment_Bookings` (`apt_booking_id`, `apt_id`, `guest_id`, `booking_status_code`, `booking_start_date`, `booking_end_date`) VALUES (258, 10, 2, 'Provisional', '2016-09-26 17:13:49', '2017-10-07 11:38:48')
INSERT INTO `View_Unit_Status` (`apt_id`, `apt_booking_id`, `status_date`, `available_yn`) VALUES (11, 920, '1970-09-28 10:24:29', '1') |
apartment_rentals | 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 | What are the facility codes of the apartments with more than four bedrooms? | CREATE TABLE Apartment_Buildings (
building_id INTEGER NOT NULL,
building_short_name CHAR(15),
building_full_name VARCHAR(80),
building_description VARCHAR(255),
building_address VARCHAR(255),
building_manager VARCHAR(50),
building_phone VARCHAR(80),
PRIMARY KEY (building_id),
UNIQUE (building_id)
);
CREATE TABLE Apartments (
apt_id INTEGER NOT NULL ,
building_id INTEGER NOT NULL,
apt_type_code CHAR(15),
apt_number CHAR(10),
bathroom_count INTEGER,
bedroom_count INTEGER,
room_count CHAR(5),
PRIMARY KEY (apt_id),
UNIQUE (apt_id),
FOREIGN KEY (building_id) REFERENCES Apartment_Buildings (building_id)
);
CREATE TABLE Apartment_Facilities (
apt_id INTEGER NOT NULL,
facility_code CHAR(15) NOT NULL,
PRIMARY KEY (apt_id, facility_code),
FOREIGN KEY (apt_id) REFERENCES Apartments (apt_id)
);
CREATE TABLE Guests (
guest_id INTEGER NOT NULL ,
gender_code CHAR(1),
guest_first_name VARCHAR(80),
guest_last_name VARCHAR(80),
date_of_birth DATETIME,
PRIMARY KEY (guest_id),
UNIQUE (guest_id)
);
CREATE TABLE Apartment_Bookings (
apt_booking_id INTEGER NOT NULL,
apt_id INTEGER,
guest_id INTEGER NOT NULL,
booking_status_code CHAR(15) NOT NULL,
booking_start_date DATETIME,
booking_end_date DATETIME,
PRIMARY KEY (apt_booking_id),
UNIQUE (apt_booking_id),
FOREIGN KEY (apt_id) REFERENCES Apartments (apt_id),
FOREIGN KEY (guest_id) REFERENCES Guests (guest_id)
);
CREATE TABLE View_Unit_Status (
apt_id INTEGER,
apt_booking_id INTEGER,
status_date DATETIME NOT NULL,
available_yn BIT,
PRIMARY KEY (status_date),
FOREIGN KEY (apt_id) REFERENCES Apartments (apt_id),
FOREIGN KEY (apt_booking_id) REFERENCES Apartment_Bookings (apt_booking_id)
);
INSERT INTO `Apartment_Buildings` (`building_id`, `building_short_name`, `building_full_name`, `building_description`, `building_address`, `building_manager`, `building_phone`) VALUES (133, 'Normandie Court', 'Normandie Court', 'Studio', '7950 Casper Vista Apt. 176
INSERT INTO `Apartments` (`apt_id`, `building_id`, `apt_type_code`, `apt_number`, `bathroom_count`, `bedroom_count`, `room_count`) VALUES (1, 808, 'Flat', 'Suite 645', 1, 3, '7')
INSERT INTO `Apartment_Facilities` (`apt_id`, `facility_code`) VALUES (1, 'Boardband')
INSERT INTO `Guests` (`guest_id`, `gender_code`, `guest_first_name`, `guest_last_name`, `date_of_birth`) VALUES (1, 'Male', 'Kip', 'DuBuque', '1995-11-04 07:09:57')
INSERT INTO `Apartment_Bookings` (`apt_booking_id`, `apt_id`, `guest_id`, `booking_status_code`, `booking_start_date`, `booking_end_date`) VALUES (258, 10, 2, 'Provisional', '2016-09-26 17:13:49', '2017-10-07 11:38:48')
INSERT INTO `View_Unit_Status` (`apt_id`, `apt_booking_id`, `status_date`, `available_yn`) VALUES (11, 920, '1970-09-28 10:24:29', '1') |
apartment_rentals | 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" | Show the total number of rooms of all apartments with facility code "Gym". | CREATE TABLE Apartment_Buildings (
building_id INTEGER NOT NULL,
building_short_name CHAR(15),
building_full_name VARCHAR(80),
building_description VARCHAR(255),
building_address VARCHAR(255),
building_manager VARCHAR(50),
building_phone VARCHAR(80),
PRIMARY KEY (building_id),
UNIQUE (building_id)
);
CREATE TABLE Apartments (
apt_id INTEGER NOT NULL ,
building_id INTEGER NOT NULL,
apt_type_code CHAR(15),
apt_number CHAR(10),
bathroom_count INTEGER,
bedroom_count INTEGER,
room_count CHAR(5),
PRIMARY KEY (apt_id),
UNIQUE (apt_id),
FOREIGN KEY (building_id) REFERENCES Apartment_Buildings (building_id)
);
CREATE TABLE Apartment_Facilities (
apt_id INTEGER NOT NULL,
facility_code CHAR(15) NOT NULL,
PRIMARY KEY (apt_id, facility_code),
FOREIGN KEY (apt_id) REFERENCES Apartments (apt_id)
);
CREATE TABLE Guests (
guest_id INTEGER NOT NULL ,
gender_code CHAR(1),
guest_first_name VARCHAR(80),
guest_last_name VARCHAR(80),
date_of_birth DATETIME,
PRIMARY KEY (guest_id),
UNIQUE (guest_id)
);
CREATE TABLE Apartment_Bookings (
apt_booking_id INTEGER NOT NULL,
apt_id INTEGER,
guest_id INTEGER NOT NULL,
booking_status_code CHAR(15) NOT NULL,
booking_start_date DATETIME,
booking_end_date DATETIME,
PRIMARY KEY (apt_booking_id),
UNIQUE (apt_booking_id),
FOREIGN KEY (apt_id) REFERENCES Apartments (apt_id),
FOREIGN KEY (guest_id) REFERENCES Guests (guest_id)
);
CREATE TABLE View_Unit_Status (
apt_id INTEGER,
apt_booking_id INTEGER,
status_date DATETIME NOT NULL,
available_yn BIT,
PRIMARY KEY (status_date),
FOREIGN KEY (apt_id) REFERENCES Apartments (apt_id),
FOREIGN KEY (apt_booking_id) REFERENCES Apartment_Bookings (apt_booking_id)
);
INSERT INTO `Apartment_Buildings` (`building_id`, `building_short_name`, `building_full_name`, `building_description`, `building_address`, `building_manager`, `building_phone`) VALUES (133, 'Normandie Court', 'Normandie Court', 'Studio', '7950 Casper Vista Apt. 176
INSERT INTO `Apartments` (`apt_id`, `building_id`, `apt_type_code`, `apt_number`, `bathroom_count`, `bedroom_count`, `room_count`) VALUES (1, 808, 'Flat', 'Suite 645', 1, 3, '7')
INSERT INTO `Apartment_Facilities` (`apt_id`, `facility_code`) VALUES (1, 'Boardband')
INSERT INTO `Guests` (`guest_id`, `gender_code`, `guest_first_name`, `guest_last_name`, `date_of_birth`) VALUES (1, 'Male', 'Kip', 'DuBuque', '1995-11-04 07:09:57')
INSERT INTO `Apartment_Bookings` (`apt_booking_id`, `apt_id`, `guest_id`, `booking_status_code`, `booking_start_date`, `booking_end_date`) VALUES (258, 10, 2, 'Provisional', '2016-09-26 17:13:49', '2017-10-07 11:38:48')
INSERT INTO `View_Unit_Status` (`apt_id`, `apt_booking_id`, `status_date`, `available_yn`) VALUES (11, 920, '1970-09-28 10:24:29', '1') |
apartment_rentals | 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" | Find the total number of rooms in the apartments that have facility code "Gym". | CREATE TABLE Apartment_Buildings (
building_id INTEGER NOT NULL,
building_short_name CHAR(15),
building_full_name VARCHAR(80),
building_description VARCHAR(255),
building_address VARCHAR(255),
building_manager VARCHAR(50),
building_phone VARCHAR(80),
PRIMARY KEY (building_id),
UNIQUE (building_id)
);
CREATE TABLE Apartments (
apt_id INTEGER NOT NULL ,
building_id INTEGER NOT NULL,
apt_type_code CHAR(15),
apt_number CHAR(10),
bathroom_count INTEGER,
bedroom_count INTEGER,
room_count CHAR(5),
PRIMARY KEY (apt_id),
UNIQUE (apt_id),
FOREIGN KEY (building_id) REFERENCES Apartment_Buildings (building_id)
);
CREATE TABLE Apartment_Facilities (
apt_id INTEGER NOT NULL,
facility_code CHAR(15) NOT NULL,
PRIMARY KEY (apt_id, facility_code),
FOREIGN KEY (apt_id) REFERENCES Apartments (apt_id)
);
CREATE TABLE Guests (
guest_id INTEGER NOT NULL ,
gender_code CHAR(1),
guest_first_name VARCHAR(80),
guest_last_name VARCHAR(80),
date_of_birth DATETIME,
PRIMARY KEY (guest_id),
UNIQUE (guest_id)
);
CREATE TABLE Apartment_Bookings (
apt_booking_id INTEGER NOT NULL,
apt_id INTEGER,
guest_id INTEGER NOT NULL,
booking_status_code CHAR(15) NOT NULL,
booking_start_date DATETIME,
booking_end_date DATETIME,
PRIMARY KEY (apt_booking_id),
UNIQUE (apt_booking_id),
FOREIGN KEY (apt_id) REFERENCES Apartments (apt_id),
FOREIGN KEY (guest_id) REFERENCES Guests (guest_id)
);
CREATE TABLE View_Unit_Status (
apt_id INTEGER,
apt_booking_id INTEGER,
status_date DATETIME NOT NULL,
available_yn BIT,
PRIMARY KEY (status_date),
FOREIGN KEY (apt_id) REFERENCES Apartments (apt_id),
FOREIGN KEY (apt_booking_id) REFERENCES Apartment_Bookings (apt_booking_id)
);
INSERT INTO `Apartment_Buildings` (`building_id`, `building_short_name`, `building_full_name`, `building_description`, `building_address`, `building_manager`, `building_phone`) VALUES (133, 'Normandie Court', 'Normandie Court', 'Studio', '7950 Casper Vista Apt. 176
INSERT INTO `Apartments` (`apt_id`, `building_id`, `apt_type_code`, `apt_number`, `bathroom_count`, `bedroom_count`, `room_count`) VALUES (1, 808, 'Flat', 'Suite 645', 1, 3, '7')
INSERT INTO `Apartment_Facilities` (`apt_id`, `facility_code`) VALUES (1, 'Boardband')
INSERT INTO `Guests` (`guest_id`, `gender_code`, `guest_first_name`, `guest_last_name`, `date_of_birth`) VALUES (1, 'Male', 'Kip', 'DuBuque', '1995-11-04 07:09:57')
INSERT INTO `Apartment_Bookings` (`apt_booking_id`, `apt_id`, `guest_id`, `booking_status_code`, `booking_start_date`, `booking_end_date`) VALUES (258, 10, 2, 'Provisional', '2016-09-26 17:13:49', '2017-10-07 11:38:48')
INSERT INTO `View_Unit_Status` (`apt_id`, `apt_booking_id`, `status_date`, `available_yn`) VALUES (11, 920, '1970-09-28 10:24:29', '1') |
apartment_rentals | 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" | Show the total number of rooms of the apartments in the building with short name "Columbus Square". | CREATE TABLE Apartment_Buildings (
building_id INTEGER NOT NULL,
building_short_name CHAR(15),
building_full_name VARCHAR(80),
building_description VARCHAR(255),
building_address VARCHAR(255),
building_manager VARCHAR(50),
building_phone VARCHAR(80),
PRIMARY KEY (building_id),
UNIQUE (building_id)
);
CREATE TABLE Apartments (
apt_id INTEGER NOT NULL ,
building_id INTEGER NOT NULL,
apt_type_code CHAR(15),
apt_number CHAR(10),
bathroom_count INTEGER,
bedroom_count INTEGER,
room_count CHAR(5),
PRIMARY KEY (apt_id),
UNIQUE (apt_id),
FOREIGN KEY (building_id) REFERENCES Apartment_Buildings (building_id)
);
CREATE TABLE Apartment_Facilities (
apt_id INTEGER NOT NULL,
facility_code CHAR(15) NOT NULL,
PRIMARY KEY (apt_id, facility_code),
FOREIGN KEY (apt_id) REFERENCES Apartments (apt_id)
);
CREATE TABLE Guests (
guest_id INTEGER NOT NULL ,
gender_code CHAR(1),
guest_first_name VARCHAR(80),
guest_last_name VARCHAR(80),
date_of_birth DATETIME,
PRIMARY KEY (guest_id),
UNIQUE (guest_id)
);
CREATE TABLE Apartment_Bookings (
apt_booking_id INTEGER NOT NULL,
apt_id INTEGER,
guest_id INTEGER NOT NULL,
booking_status_code CHAR(15) NOT NULL,
booking_start_date DATETIME,
booking_end_date DATETIME,
PRIMARY KEY (apt_booking_id),
UNIQUE (apt_booking_id),
FOREIGN KEY (apt_id) REFERENCES Apartments (apt_id),
FOREIGN KEY (guest_id) REFERENCES Guests (guest_id)
);
CREATE TABLE View_Unit_Status (
apt_id INTEGER,
apt_booking_id INTEGER,
status_date DATETIME NOT NULL,
available_yn BIT,
PRIMARY KEY (status_date),
FOREIGN KEY (apt_id) REFERENCES Apartments (apt_id),
FOREIGN KEY (apt_booking_id) REFERENCES Apartment_Bookings (apt_booking_id)
);
INSERT INTO `Apartment_Buildings` (`building_id`, `building_short_name`, `building_full_name`, `building_description`, `building_address`, `building_manager`, `building_phone`) VALUES (133, 'Normandie Court', 'Normandie Court', 'Studio', '7950 Casper Vista Apt. 176
INSERT INTO `Apartments` (`apt_id`, `building_id`, `apt_type_code`, `apt_number`, `bathroom_count`, `bedroom_count`, `room_count`) VALUES (1, 808, 'Flat', 'Suite 645', 1, 3, '7')
INSERT INTO `Apartment_Facilities` (`apt_id`, `facility_code`) VALUES (1, 'Boardband')
INSERT INTO `Guests` (`guest_id`, `gender_code`, `guest_first_name`, `guest_last_name`, `date_of_birth`) VALUES (1, 'Male', 'Kip', 'DuBuque', '1995-11-04 07:09:57')
INSERT INTO `Apartment_Bookings` (`apt_booking_id`, `apt_id`, `guest_id`, `booking_status_code`, `booking_start_date`, `booking_end_date`) VALUES (258, 10, 2, 'Provisional', '2016-09-26 17:13:49', '2017-10-07 11:38:48')
INSERT INTO `View_Unit_Status` (`apt_id`, `apt_booking_id`, `status_date`, `available_yn`) VALUES (11, 920, '1970-09-28 10:24:29', '1') |
apartment_rentals | 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" | How many rooms in total are there in the apartments in the building with short name "Columbus Square"? | CREATE TABLE Apartment_Buildings (
building_id INTEGER NOT NULL,
building_short_name CHAR(15),
building_full_name VARCHAR(80),
building_description VARCHAR(255),
building_address VARCHAR(255),
building_manager VARCHAR(50),
building_phone VARCHAR(80),
PRIMARY KEY (building_id),
UNIQUE (building_id)
);
CREATE TABLE Apartments (
apt_id INTEGER NOT NULL ,
building_id INTEGER NOT NULL,
apt_type_code CHAR(15),
apt_number CHAR(10),
bathroom_count INTEGER,
bedroom_count INTEGER,
room_count CHAR(5),
PRIMARY KEY (apt_id),
UNIQUE (apt_id),
FOREIGN KEY (building_id) REFERENCES Apartment_Buildings (building_id)
);
CREATE TABLE Apartment_Facilities (
apt_id INTEGER NOT NULL,
facility_code CHAR(15) NOT NULL,
PRIMARY KEY (apt_id, facility_code),
FOREIGN KEY (apt_id) REFERENCES Apartments (apt_id)
);
CREATE TABLE Guests (
guest_id INTEGER NOT NULL ,
gender_code CHAR(1),
guest_first_name VARCHAR(80),
guest_last_name VARCHAR(80),
date_of_birth DATETIME,
PRIMARY KEY (guest_id),
UNIQUE (guest_id)
);
CREATE TABLE Apartment_Bookings (
apt_booking_id INTEGER NOT NULL,
apt_id INTEGER,
guest_id INTEGER NOT NULL,
booking_status_code CHAR(15) NOT NULL,
booking_start_date DATETIME,
booking_end_date DATETIME,
PRIMARY KEY (apt_booking_id),
UNIQUE (apt_booking_id),
FOREIGN KEY (apt_id) REFERENCES Apartments (apt_id),
FOREIGN KEY (guest_id) REFERENCES Guests (guest_id)
);
CREATE TABLE View_Unit_Status (
apt_id INTEGER,
apt_booking_id INTEGER,
status_date DATETIME NOT NULL,
available_yn BIT,
PRIMARY KEY (status_date),
FOREIGN KEY (apt_id) REFERENCES Apartments (apt_id),
FOREIGN KEY (apt_booking_id) REFERENCES Apartment_Bookings (apt_booking_id)
);
INSERT INTO `Apartment_Buildings` (`building_id`, `building_short_name`, `building_full_name`, `building_description`, `building_address`, `building_manager`, `building_phone`) VALUES (133, 'Normandie Court', 'Normandie Court', 'Studio', '7950 Casper Vista Apt. 176
INSERT INTO `Apartments` (`apt_id`, `building_id`, `apt_type_code`, `apt_number`, `bathroom_count`, `bedroom_count`, `room_count`) VALUES (1, 808, 'Flat', 'Suite 645', 1, 3, '7')
INSERT INTO `Apartment_Facilities` (`apt_id`, `facility_code`) VALUES (1, 'Boardband')
INSERT INTO `Guests` (`guest_id`, `gender_code`, `guest_first_name`, `guest_last_name`, `date_of_birth`) VALUES (1, 'Male', 'Kip', 'DuBuque', '1995-11-04 07:09:57')
INSERT INTO `Apartment_Bookings` (`apt_booking_id`, `apt_id`, `guest_id`, `booking_status_code`, `booking_start_date`, `booking_end_date`) VALUES (258, 10, 2, 'Provisional', '2016-09-26 17:13:49', '2017-10-07 11:38:48')
INSERT INTO `View_Unit_Status` (`apt_id`, `apt_booking_id`, `status_date`, `available_yn`) VALUES (11, 920, '1970-09-28 10:24:29', '1') |
apartment_rentals | 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 | Show the addresses of the buildings that have apartments with more than 2 bathrooms. | CREATE TABLE Apartment_Buildings (
building_id INTEGER NOT NULL,
building_short_name CHAR(15),
building_full_name VARCHAR(80),
building_description VARCHAR(255),
building_address VARCHAR(255),
building_manager VARCHAR(50),
building_phone VARCHAR(80),
PRIMARY KEY (building_id),
UNIQUE (building_id)
);
CREATE TABLE Apartments (
apt_id INTEGER NOT NULL ,
building_id INTEGER NOT NULL,
apt_type_code CHAR(15),
apt_number CHAR(10),
bathroom_count INTEGER,
bedroom_count INTEGER,
room_count CHAR(5),
PRIMARY KEY (apt_id),
UNIQUE (apt_id),
FOREIGN KEY (building_id) REFERENCES Apartment_Buildings (building_id)
);
CREATE TABLE Apartment_Facilities (
apt_id INTEGER NOT NULL,
facility_code CHAR(15) NOT NULL,
PRIMARY KEY (apt_id, facility_code),
FOREIGN KEY (apt_id) REFERENCES Apartments (apt_id)
);
CREATE TABLE Guests (
guest_id INTEGER NOT NULL ,
gender_code CHAR(1),
guest_first_name VARCHAR(80),
guest_last_name VARCHAR(80),
date_of_birth DATETIME,
PRIMARY KEY (guest_id),
UNIQUE (guest_id)
);
CREATE TABLE Apartment_Bookings (
apt_booking_id INTEGER NOT NULL,
apt_id INTEGER,
guest_id INTEGER NOT NULL,
booking_status_code CHAR(15) NOT NULL,
booking_start_date DATETIME,
booking_end_date DATETIME,
PRIMARY KEY (apt_booking_id),
UNIQUE (apt_booking_id),
FOREIGN KEY (apt_id) REFERENCES Apartments (apt_id),
FOREIGN KEY (guest_id) REFERENCES Guests (guest_id)
);
CREATE TABLE View_Unit_Status (
apt_id INTEGER,
apt_booking_id INTEGER,
status_date DATETIME NOT NULL,
available_yn BIT,
PRIMARY KEY (status_date),
FOREIGN KEY (apt_id) REFERENCES Apartments (apt_id),
FOREIGN KEY (apt_booking_id) REFERENCES Apartment_Bookings (apt_booking_id)
);
INSERT INTO `Apartment_Buildings` (`building_id`, `building_short_name`, `building_full_name`, `building_description`, `building_address`, `building_manager`, `building_phone`) VALUES (133, 'Normandie Court', 'Normandie Court', 'Studio', '7950 Casper Vista Apt. 176
INSERT INTO `Apartments` (`apt_id`, `building_id`, `apt_type_code`, `apt_number`, `bathroom_count`, `bedroom_count`, `room_count`) VALUES (1, 808, 'Flat', 'Suite 645', 1, 3, '7')
INSERT INTO `Apartment_Facilities` (`apt_id`, `facility_code`) VALUES (1, 'Boardband')
INSERT INTO `Guests` (`guest_id`, `gender_code`, `guest_first_name`, `guest_last_name`, `date_of_birth`) VALUES (1, 'Male', 'Kip', 'DuBuque', '1995-11-04 07:09:57')
INSERT INTO `Apartment_Bookings` (`apt_booking_id`, `apt_id`, `guest_id`, `booking_status_code`, `booking_start_date`, `booking_end_date`) VALUES (258, 10, 2, 'Provisional', '2016-09-26 17:13:49', '2017-10-07 11:38:48')
INSERT INTO `View_Unit_Status` (`apt_id`, `apt_booking_id`, `status_date`, `available_yn`) VALUES (11, 920, '1970-09-28 10:24:29', '1') |
apartment_rentals | 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 | Which buildings have apartments that have more than two bathrooms? Give me the addresses of the buildings. | CREATE TABLE Apartment_Buildings (
building_id INTEGER NOT NULL,
building_short_name CHAR(15),
building_full_name VARCHAR(80),
building_description VARCHAR(255),
building_address VARCHAR(255),
building_manager VARCHAR(50),
building_phone VARCHAR(80),
PRIMARY KEY (building_id),
UNIQUE (building_id)
);
CREATE TABLE Apartments (
apt_id INTEGER NOT NULL ,
building_id INTEGER NOT NULL,
apt_type_code CHAR(15),
apt_number CHAR(10),
bathroom_count INTEGER,
bedroom_count INTEGER,
room_count CHAR(5),
PRIMARY KEY (apt_id),
UNIQUE (apt_id),
FOREIGN KEY (building_id) REFERENCES Apartment_Buildings (building_id)
);
CREATE TABLE Apartment_Facilities (
apt_id INTEGER NOT NULL,
facility_code CHAR(15) NOT NULL,
PRIMARY KEY (apt_id, facility_code),
FOREIGN KEY (apt_id) REFERENCES Apartments (apt_id)
);
CREATE TABLE Guests (
guest_id INTEGER NOT NULL ,
gender_code CHAR(1),
guest_first_name VARCHAR(80),
guest_last_name VARCHAR(80),
date_of_birth DATETIME,
PRIMARY KEY (guest_id),
UNIQUE (guest_id)
);
CREATE TABLE Apartment_Bookings (
apt_booking_id INTEGER NOT NULL,
apt_id INTEGER,
guest_id INTEGER NOT NULL,
booking_status_code CHAR(15) NOT NULL,
booking_start_date DATETIME,
booking_end_date DATETIME,
PRIMARY KEY (apt_booking_id),
UNIQUE (apt_booking_id),
FOREIGN KEY (apt_id) REFERENCES Apartments (apt_id),
FOREIGN KEY (guest_id) REFERENCES Guests (guest_id)
);
CREATE TABLE View_Unit_Status (
apt_id INTEGER,
apt_booking_id INTEGER,
status_date DATETIME NOT NULL,
available_yn BIT,
PRIMARY KEY (status_date),
FOREIGN KEY (apt_id) REFERENCES Apartments (apt_id),
FOREIGN KEY (apt_booking_id) REFERENCES Apartment_Bookings (apt_booking_id)
);
INSERT INTO `Apartment_Buildings` (`building_id`, `building_short_name`, `building_full_name`, `building_description`, `building_address`, `building_manager`, `building_phone`) VALUES (133, 'Normandie Court', 'Normandie Court', 'Studio', '7950 Casper Vista Apt. 176
INSERT INTO `Apartments` (`apt_id`, `building_id`, `apt_type_code`, `apt_number`, `bathroom_count`, `bedroom_count`, `room_count`) VALUES (1, 808, 'Flat', 'Suite 645', 1, 3, '7')
INSERT INTO `Apartment_Facilities` (`apt_id`, `facility_code`) VALUES (1, 'Boardband')
INSERT INTO `Guests` (`guest_id`, `gender_code`, `guest_first_name`, `guest_last_name`, `date_of_birth`) VALUES (1, 'Male', 'Kip', 'DuBuque', '1995-11-04 07:09:57')
INSERT INTO `Apartment_Bookings` (`apt_booking_id`, `apt_id`, `guest_id`, `booking_status_code`, `booking_start_date`, `booking_end_date`) VALUES (258, 10, 2, 'Provisional', '2016-09-26 17:13:49', '2017-10-07 11:38:48')
INSERT INTO `View_Unit_Status` (`apt_id`, `apt_booking_id`, `status_date`, `available_yn`) VALUES (11, 920, '1970-09-28 10:24:29', '1') |
apartment_rentals | 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" | Show the apartment type codes and apartment numbers in the buildings managed by "Kyle". | CREATE TABLE Apartment_Buildings (
building_id INTEGER NOT NULL,
building_short_name CHAR(15),
building_full_name VARCHAR(80),
building_description VARCHAR(255),
building_address VARCHAR(255),
building_manager VARCHAR(50),
building_phone VARCHAR(80),
PRIMARY KEY (building_id),
UNIQUE (building_id)
);
CREATE TABLE Apartments (
apt_id INTEGER NOT NULL ,
building_id INTEGER NOT NULL,
apt_type_code CHAR(15),
apt_number CHAR(10),
bathroom_count INTEGER,
bedroom_count INTEGER,
room_count CHAR(5),
PRIMARY KEY (apt_id),
UNIQUE (apt_id),
FOREIGN KEY (building_id) REFERENCES Apartment_Buildings (building_id)
);
CREATE TABLE Apartment_Facilities (
apt_id INTEGER NOT NULL,
facility_code CHAR(15) NOT NULL,
PRIMARY KEY (apt_id, facility_code),
FOREIGN KEY (apt_id) REFERENCES Apartments (apt_id)
);
CREATE TABLE Guests (
guest_id INTEGER NOT NULL ,
gender_code CHAR(1),
guest_first_name VARCHAR(80),
guest_last_name VARCHAR(80),
date_of_birth DATETIME,
PRIMARY KEY (guest_id),
UNIQUE (guest_id)
);
CREATE TABLE Apartment_Bookings (
apt_booking_id INTEGER NOT NULL,
apt_id INTEGER,
guest_id INTEGER NOT NULL,
booking_status_code CHAR(15) NOT NULL,
booking_start_date DATETIME,
booking_end_date DATETIME,
PRIMARY KEY (apt_booking_id),
UNIQUE (apt_booking_id),
FOREIGN KEY (apt_id) REFERENCES Apartments (apt_id),
FOREIGN KEY (guest_id) REFERENCES Guests (guest_id)
);
CREATE TABLE View_Unit_Status (
apt_id INTEGER,
apt_booking_id INTEGER,
status_date DATETIME NOT NULL,
available_yn BIT,
PRIMARY KEY (status_date),
FOREIGN KEY (apt_id) REFERENCES Apartments (apt_id),
FOREIGN KEY (apt_booking_id) REFERENCES Apartment_Bookings (apt_booking_id)
);
INSERT INTO `Apartment_Buildings` (`building_id`, `building_short_name`, `building_full_name`, `building_description`, `building_address`, `building_manager`, `building_phone`) VALUES (133, 'Normandie Court', 'Normandie Court', 'Studio', '7950 Casper Vista Apt. 176
INSERT INTO `Apartments` (`apt_id`, `building_id`, `apt_type_code`, `apt_number`, `bathroom_count`, `bedroom_count`, `room_count`) VALUES (1, 808, 'Flat', 'Suite 645', 1, 3, '7')
INSERT INTO `Apartment_Facilities` (`apt_id`, `facility_code`) VALUES (1, 'Boardband')
INSERT INTO `Guests` (`guest_id`, `gender_code`, `guest_first_name`, `guest_last_name`, `date_of_birth`) VALUES (1, 'Male', 'Kip', 'DuBuque', '1995-11-04 07:09:57')
INSERT INTO `Apartment_Bookings` (`apt_booking_id`, `apt_id`, `guest_id`, `booking_status_code`, `booking_start_date`, `booking_end_date`) VALUES (258, 10, 2, 'Provisional', '2016-09-26 17:13:49', '2017-10-07 11:38:48')
INSERT INTO `View_Unit_Status` (`apt_id`, `apt_booking_id`, `status_date`, `available_yn`) VALUES (11, 920, '1970-09-28 10:24:29', '1') |
apartment_rentals | 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" | What apartment type codes and apartment numbers do the buildings managed by "Kyle" have? | CREATE TABLE Apartment_Buildings (
building_id INTEGER NOT NULL,
building_short_name CHAR(15),
building_full_name VARCHAR(80),
building_description VARCHAR(255),
building_address VARCHAR(255),
building_manager VARCHAR(50),
building_phone VARCHAR(80),
PRIMARY KEY (building_id),
UNIQUE (building_id)
);
CREATE TABLE Apartments (
apt_id INTEGER NOT NULL ,
building_id INTEGER NOT NULL,
apt_type_code CHAR(15),
apt_number CHAR(10),
bathroom_count INTEGER,
bedroom_count INTEGER,
room_count CHAR(5),
PRIMARY KEY (apt_id),
UNIQUE (apt_id),
FOREIGN KEY (building_id) REFERENCES Apartment_Buildings (building_id)
);
CREATE TABLE Apartment_Facilities (
apt_id INTEGER NOT NULL,
facility_code CHAR(15) NOT NULL,
PRIMARY KEY (apt_id, facility_code),
FOREIGN KEY (apt_id) REFERENCES Apartments (apt_id)
);
CREATE TABLE Guests (
guest_id INTEGER NOT NULL ,
gender_code CHAR(1),
guest_first_name VARCHAR(80),
guest_last_name VARCHAR(80),
date_of_birth DATETIME,
PRIMARY KEY (guest_id),
UNIQUE (guest_id)
);
CREATE TABLE Apartment_Bookings (
apt_booking_id INTEGER NOT NULL,
apt_id INTEGER,
guest_id INTEGER NOT NULL,
booking_status_code CHAR(15) NOT NULL,
booking_start_date DATETIME,
booking_end_date DATETIME,
PRIMARY KEY (apt_booking_id),
UNIQUE (apt_booking_id),
FOREIGN KEY (apt_id) REFERENCES Apartments (apt_id),
FOREIGN KEY (guest_id) REFERENCES Guests (guest_id)
);
CREATE TABLE View_Unit_Status (
apt_id INTEGER,
apt_booking_id INTEGER,
status_date DATETIME NOT NULL,
available_yn BIT,
PRIMARY KEY (status_date),
FOREIGN KEY (apt_id) REFERENCES Apartments (apt_id),
FOREIGN KEY (apt_booking_id) REFERENCES Apartment_Bookings (apt_booking_id)
);
INSERT INTO `Apartment_Buildings` (`building_id`, `building_short_name`, `building_full_name`, `building_description`, `building_address`, `building_manager`, `building_phone`) VALUES (133, 'Normandie Court', 'Normandie Court', 'Studio', '7950 Casper Vista Apt. 176
INSERT INTO `Apartments` (`apt_id`, `building_id`, `apt_type_code`, `apt_number`, `bathroom_count`, `bedroom_count`, `room_count`) VALUES (1, 808, 'Flat', 'Suite 645', 1, 3, '7')
INSERT INTO `Apartment_Facilities` (`apt_id`, `facility_code`) VALUES (1, 'Boardband')
INSERT INTO `Guests` (`guest_id`, `gender_code`, `guest_first_name`, `guest_last_name`, `date_of_birth`) VALUES (1, 'Male', 'Kip', 'DuBuque', '1995-11-04 07:09:57')
INSERT INTO `Apartment_Bookings` (`apt_booking_id`, `apt_id`, `guest_id`, `booking_status_code`, `booking_start_date`, `booking_end_date`) VALUES (258, 10, 2, 'Provisional', '2016-09-26 17:13:49', '2017-10-07 11:38:48')
INSERT INTO `View_Unit_Status` (`apt_id`, `apt_booking_id`, `status_date`, `available_yn`) VALUES (11, 920, '1970-09-28 10:24:29', '1') |
apartment_rentals | SELECT booking_status_code , COUNT(*) FROM Apartment_Bookings GROUP BY booking_status_code | Show the booking status code and the corresponding number of bookings. | CREATE TABLE Apartment_Buildings (
building_id INTEGER NOT NULL,
building_short_name CHAR(15),
building_full_name VARCHAR(80),
building_description VARCHAR(255),
building_address VARCHAR(255),
building_manager VARCHAR(50),
building_phone VARCHAR(80),
PRIMARY KEY (building_id),
UNIQUE (building_id)
);
CREATE TABLE Apartments (
apt_id INTEGER NOT NULL ,
building_id INTEGER NOT NULL,
apt_type_code CHAR(15),
apt_number CHAR(10),
bathroom_count INTEGER,
bedroom_count INTEGER,
room_count CHAR(5),
PRIMARY KEY (apt_id),
UNIQUE (apt_id),
FOREIGN KEY (building_id) REFERENCES Apartment_Buildings (building_id)
);
CREATE TABLE Apartment_Facilities (
apt_id INTEGER NOT NULL,
facility_code CHAR(15) NOT NULL,
PRIMARY KEY (apt_id, facility_code),
FOREIGN KEY (apt_id) REFERENCES Apartments (apt_id)
);
CREATE TABLE Guests (
guest_id INTEGER NOT NULL ,
gender_code CHAR(1),
guest_first_name VARCHAR(80),
guest_last_name VARCHAR(80),
date_of_birth DATETIME,
PRIMARY KEY (guest_id),
UNIQUE (guest_id)
);
CREATE TABLE Apartment_Bookings (
apt_booking_id INTEGER NOT NULL,
apt_id INTEGER,
guest_id INTEGER NOT NULL,
booking_status_code CHAR(15) NOT NULL,
booking_start_date DATETIME,
booking_end_date DATETIME,
PRIMARY KEY (apt_booking_id),
UNIQUE (apt_booking_id),
FOREIGN KEY (apt_id) REFERENCES Apartments (apt_id),
FOREIGN KEY (guest_id) REFERENCES Guests (guest_id)
);
CREATE TABLE View_Unit_Status (
apt_id INTEGER,
apt_booking_id INTEGER,
status_date DATETIME NOT NULL,
available_yn BIT,
PRIMARY KEY (status_date),
FOREIGN KEY (apt_id) REFERENCES Apartments (apt_id),
FOREIGN KEY (apt_booking_id) REFERENCES Apartment_Bookings (apt_booking_id)
);
INSERT INTO `Apartment_Buildings` (`building_id`, `building_short_name`, `building_full_name`, `building_description`, `building_address`, `building_manager`, `building_phone`) VALUES (133, 'Normandie Court', 'Normandie Court', 'Studio', '7950 Casper Vista Apt. 176
INSERT INTO `Apartments` (`apt_id`, `building_id`, `apt_type_code`, `apt_number`, `bathroom_count`, `bedroom_count`, `room_count`) VALUES (1, 808, 'Flat', 'Suite 645', 1, 3, '7')
INSERT INTO `Apartment_Facilities` (`apt_id`, `facility_code`) VALUES (1, 'Boardband')
INSERT INTO `Guests` (`guest_id`, `gender_code`, `guest_first_name`, `guest_last_name`, `date_of_birth`) VALUES (1, 'Male', 'Kip', 'DuBuque', '1995-11-04 07:09:57')
INSERT INTO `Apartment_Bookings` (`apt_booking_id`, `apt_id`, `guest_id`, `booking_status_code`, `booking_start_date`, `booking_end_date`) VALUES (258, 10, 2, 'Provisional', '2016-09-26 17:13:49', '2017-10-07 11:38:48')
INSERT INTO `View_Unit_Status` (`apt_id`, `apt_booking_id`, `status_date`, `available_yn`) VALUES (11, 920, '1970-09-28 10:24:29', '1') |
apartment_rentals | SELECT booking_status_code , COUNT(*) FROM Apartment_Bookings GROUP BY booking_status_code | How many bookings does each booking status have? List the booking status code and the number of corresponding bookings. | CREATE TABLE Apartment_Buildings (
building_id INTEGER NOT NULL,
building_short_name CHAR(15),
building_full_name VARCHAR(80),
building_description VARCHAR(255),
building_address VARCHAR(255),
building_manager VARCHAR(50),
building_phone VARCHAR(80),
PRIMARY KEY (building_id),
UNIQUE (building_id)
);
CREATE TABLE Apartments (
apt_id INTEGER NOT NULL ,
building_id INTEGER NOT NULL,
apt_type_code CHAR(15),
apt_number CHAR(10),
bathroom_count INTEGER,
bedroom_count INTEGER,
room_count CHAR(5),
PRIMARY KEY (apt_id),
UNIQUE (apt_id),
FOREIGN KEY (building_id) REFERENCES Apartment_Buildings (building_id)
);
CREATE TABLE Apartment_Facilities (
apt_id INTEGER NOT NULL,
facility_code CHAR(15) NOT NULL,
PRIMARY KEY (apt_id, facility_code),
FOREIGN KEY (apt_id) REFERENCES Apartments (apt_id)
);
CREATE TABLE Guests (
guest_id INTEGER NOT NULL ,
gender_code CHAR(1),
guest_first_name VARCHAR(80),
guest_last_name VARCHAR(80),
date_of_birth DATETIME,
PRIMARY KEY (guest_id),
UNIQUE (guest_id)
);
CREATE TABLE Apartment_Bookings (
apt_booking_id INTEGER NOT NULL,
apt_id INTEGER,
guest_id INTEGER NOT NULL,
booking_status_code CHAR(15) NOT NULL,
booking_start_date DATETIME,
booking_end_date DATETIME,
PRIMARY KEY (apt_booking_id),
UNIQUE (apt_booking_id),
FOREIGN KEY (apt_id) REFERENCES Apartments (apt_id),
FOREIGN KEY (guest_id) REFERENCES Guests (guest_id)
);
CREATE TABLE View_Unit_Status (
apt_id INTEGER,
apt_booking_id INTEGER,
status_date DATETIME NOT NULL,
available_yn BIT,
PRIMARY KEY (status_date),
FOREIGN KEY (apt_id) REFERENCES Apartments (apt_id),
FOREIGN KEY (apt_booking_id) REFERENCES Apartment_Bookings (apt_booking_id)
);
INSERT INTO `Apartment_Buildings` (`building_id`, `building_short_name`, `building_full_name`, `building_description`, `building_address`, `building_manager`, `building_phone`) VALUES (133, 'Normandie Court', 'Normandie Court', 'Studio', '7950 Casper Vista Apt. 176
INSERT INTO `Apartments` (`apt_id`, `building_id`, `apt_type_code`, `apt_number`, `bathroom_count`, `bedroom_count`, `room_count`) VALUES (1, 808, 'Flat', 'Suite 645', 1, 3, '7')
INSERT INTO `Apartment_Facilities` (`apt_id`, `facility_code`) VALUES (1, 'Boardband')
INSERT INTO `Guests` (`guest_id`, `gender_code`, `guest_first_name`, `guest_last_name`, `date_of_birth`) VALUES (1, 'Male', 'Kip', 'DuBuque', '1995-11-04 07:09:57')
INSERT INTO `Apartment_Bookings` (`apt_booking_id`, `apt_id`, `guest_id`, `booking_status_code`, `booking_start_date`, `booking_end_date`) VALUES (258, 10, 2, 'Provisional', '2016-09-26 17:13:49', '2017-10-07 11:38:48')
INSERT INTO `View_Unit_Status` (`apt_id`, `apt_booking_id`, `status_date`, `available_yn`) VALUES (11, 920, '1970-09-28 10:24:29', '1') |
apartment_rentals | SELECT apt_number FROM Apartments ORDER BY room_count ASC | Return all the apartment numbers sorted by the room count in ascending order. | CREATE TABLE Apartment_Buildings (
building_id INTEGER NOT NULL,
building_short_name CHAR(15),
building_full_name VARCHAR(80),
building_description VARCHAR(255),
building_address VARCHAR(255),
building_manager VARCHAR(50),
building_phone VARCHAR(80),
PRIMARY KEY (building_id),
UNIQUE (building_id)
);
CREATE TABLE Apartments (
apt_id INTEGER NOT NULL ,
building_id INTEGER NOT NULL,
apt_type_code CHAR(15),
apt_number CHAR(10),
bathroom_count INTEGER,
bedroom_count INTEGER,
room_count CHAR(5),
PRIMARY KEY (apt_id),
UNIQUE (apt_id),
FOREIGN KEY (building_id) REFERENCES Apartment_Buildings (building_id)
);
CREATE TABLE Apartment_Facilities (
apt_id INTEGER NOT NULL,
facility_code CHAR(15) NOT NULL,
PRIMARY KEY (apt_id, facility_code),
FOREIGN KEY (apt_id) REFERENCES Apartments (apt_id)
);
CREATE TABLE Guests (
guest_id INTEGER NOT NULL ,
gender_code CHAR(1),
guest_first_name VARCHAR(80),
guest_last_name VARCHAR(80),
date_of_birth DATETIME,
PRIMARY KEY (guest_id),
UNIQUE (guest_id)
);
CREATE TABLE Apartment_Bookings (
apt_booking_id INTEGER NOT NULL,
apt_id INTEGER,
guest_id INTEGER NOT NULL,
booking_status_code CHAR(15) NOT NULL,
booking_start_date DATETIME,
booking_end_date DATETIME,
PRIMARY KEY (apt_booking_id),
UNIQUE (apt_booking_id),
FOREIGN KEY (apt_id) REFERENCES Apartments (apt_id),
FOREIGN KEY (guest_id) REFERENCES Guests (guest_id)
);
CREATE TABLE View_Unit_Status (
apt_id INTEGER,
apt_booking_id INTEGER,
status_date DATETIME NOT NULL,
available_yn BIT,
PRIMARY KEY (status_date),
FOREIGN KEY (apt_id) REFERENCES Apartments (apt_id),
FOREIGN KEY (apt_booking_id) REFERENCES Apartment_Bookings (apt_booking_id)
);
INSERT INTO `Apartment_Buildings` (`building_id`, `building_short_name`, `building_full_name`, `building_description`, `building_address`, `building_manager`, `building_phone`) VALUES (133, 'Normandie Court', 'Normandie Court', 'Studio', '7950 Casper Vista Apt. 176
INSERT INTO `Apartments` (`apt_id`, `building_id`, `apt_type_code`, `apt_number`, `bathroom_count`, `bedroom_count`, `room_count`) VALUES (1, 808, 'Flat', 'Suite 645', 1, 3, '7')
INSERT INTO `Apartment_Facilities` (`apt_id`, `facility_code`) VALUES (1, 'Boardband')
INSERT INTO `Guests` (`guest_id`, `gender_code`, `guest_first_name`, `guest_last_name`, `date_of_birth`) VALUES (1, 'Male', 'Kip', 'DuBuque', '1995-11-04 07:09:57')
INSERT INTO `Apartment_Bookings` (`apt_booking_id`, `apt_id`, `guest_id`, `booking_status_code`, `booking_start_date`, `booking_end_date`) VALUES (258, 10, 2, 'Provisional', '2016-09-26 17:13:49', '2017-10-07 11:38:48')
INSERT INTO `View_Unit_Status` (`apt_id`, `apt_booking_id`, `status_date`, `available_yn`) VALUES (11, 920, '1970-09-28 10:24:29', '1') |
apartment_rentals | SELECT apt_number FROM Apartments ORDER BY room_count ASC | Sort the apartment numbers in ascending order of room count. | CREATE TABLE Apartment_Buildings (
building_id INTEGER NOT NULL,
building_short_name CHAR(15),
building_full_name VARCHAR(80),
building_description VARCHAR(255),
building_address VARCHAR(255),
building_manager VARCHAR(50),
building_phone VARCHAR(80),
PRIMARY KEY (building_id),
UNIQUE (building_id)
);
CREATE TABLE Apartments (
apt_id INTEGER NOT NULL ,
building_id INTEGER NOT NULL,
apt_type_code CHAR(15),
apt_number CHAR(10),
bathroom_count INTEGER,
bedroom_count INTEGER,
room_count CHAR(5),
PRIMARY KEY (apt_id),
UNIQUE (apt_id),
FOREIGN KEY (building_id) REFERENCES Apartment_Buildings (building_id)
);
CREATE TABLE Apartment_Facilities (
apt_id INTEGER NOT NULL,
facility_code CHAR(15) NOT NULL,
PRIMARY KEY (apt_id, facility_code),
FOREIGN KEY (apt_id) REFERENCES Apartments (apt_id)
);
CREATE TABLE Guests (
guest_id INTEGER NOT NULL ,
gender_code CHAR(1),
guest_first_name VARCHAR(80),
guest_last_name VARCHAR(80),
date_of_birth DATETIME,
PRIMARY KEY (guest_id),
UNIQUE (guest_id)
);
CREATE TABLE Apartment_Bookings (
apt_booking_id INTEGER NOT NULL,
apt_id INTEGER,
guest_id INTEGER NOT NULL,
booking_status_code CHAR(15) NOT NULL,
booking_start_date DATETIME,
booking_end_date DATETIME,
PRIMARY KEY (apt_booking_id),
UNIQUE (apt_booking_id),
FOREIGN KEY (apt_id) REFERENCES Apartments (apt_id),
FOREIGN KEY (guest_id) REFERENCES Guests (guest_id)
);
CREATE TABLE View_Unit_Status (
apt_id INTEGER,
apt_booking_id INTEGER,
status_date DATETIME NOT NULL,
available_yn BIT,
PRIMARY KEY (status_date),
FOREIGN KEY (apt_id) REFERENCES Apartments (apt_id),
FOREIGN KEY (apt_booking_id) REFERENCES Apartment_Bookings (apt_booking_id)
);
INSERT INTO `Apartment_Buildings` (`building_id`, `building_short_name`, `building_full_name`, `building_description`, `building_address`, `building_manager`, `building_phone`) VALUES (133, 'Normandie Court', 'Normandie Court', 'Studio', '7950 Casper Vista Apt. 176
INSERT INTO `Apartments` (`apt_id`, `building_id`, `apt_type_code`, `apt_number`, `bathroom_count`, `bedroom_count`, `room_count`) VALUES (1, 808, 'Flat', 'Suite 645', 1, 3, '7')
INSERT INTO `Apartment_Facilities` (`apt_id`, `facility_code`) VALUES (1, 'Boardband')
INSERT INTO `Guests` (`guest_id`, `gender_code`, `guest_first_name`, `guest_last_name`, `date_of_birth`) VALUES (1, 'Male', 'Kip', 'DuBuque', '1995-11-04 07:09:57')
INSERT INTO `Apartment_Bookings` (`apt_booking_id`, `apt_id`, `guest_id`, `booking_status_code`, `booking_start_date`, `booking_end_date`) VALUES (258, 10, 2, 'Provisional', '2016-09-26 17:13:49', '2017-10-07 11:38:48')
INSERT INTO `View_Unit_Status` (`apt_id`, `apt_booking_id`, `status_date`, `available_yn`) VALUES (11, 920, '1970-09-28 10:24:29', '1') |
apartment_rentals | SELECT apt_number FROM Apartments ORDER BY bedroom_count DESC LIMIT 1 | Return the apartment number with the largest number of bedrooms. | CREATE TABLE Apartment_Buildings (
building_id INTEGER NOT NULL,
building_short_name CHAR(15),
building_full_name VARCHAR(80),
building_description VARCHAR(255),
building_address VARCHAR(255),
building_manager VARCHAR(50),
building_phone VARCHAR(80),
PRIMARY KEY (building_id),
UNIQUE (building_id)
);
CREATE TABLE Apartments (
apt_id INTEGER NOT NULL ,
building_id INTEGER NOT NULL,
apt_type_code CHAR(15),
apt_number CHAR(10),
bathroom_count INTEGER,
bedroom_count INTEGER,
room_count CHAR(5),
PRIMARY KEY (apt_id),
UNIQUE (apt_id),
FOREIGN KEY (building_id) REFERENCES Apartment_Buildings (building_id)
);
CREATE TABLE Apartment_Facilities (
apt_id INTEGER NOT NULL,
facility_code CHAR(15) NOT NULL,
PRIMARY KEY (apt_id, facility_code),
FOREIGN KEY (apt_id) REFERENCES Apartments (apt_id)
);
CREATE TABLE Guests (
guest_id INTEGER NOT NULL ,
gender_code CHAR(1),
guest_first_name VARCHAR(80),
guest_last_name VARCHAR(80),
date_of_birth DATETIME,
PRIMARY KEY (guest_id),
UNIQUE (guest_id)
);
CREATE TABLE Apartment_Bookings (
apt_booking_id INTEGER NOT NULL,
apt_id INTEGER,
guest_id INTEGER NOT NULL,
booking_status_code CHAR(15) NOT NULL,
booking_start_date DATETIME,
booking_end_date DATETIME,
PRIMARY KEY (apt_booking_id),
UNIQUE (apt_booking_id),
FOREIGN KEY (apt_id) REFERENCES Apartments (apt_id),
FOREIGN KEY (guest_id) REFERENCES Guests (guest_id)
);
CREATE TABLE View_Unit_Status (
apt_id INTEGER,
apt_booking_id INTEGER,
status_date DATETIME NOT NULL,
available_yn BIT,
PRIMARY KEY (status_date),
FOREIGN KEY (apt_id) REFERENCES Apartments (apt_id),
FOREIGN KEY (apt_booking_id) REFERENCES Apartment_Bookings (apt_booking_id)
);
INSERT INTO `Apartment_Buildings` (`building_id`, `building_short_name`, `building_full_name`, `building_description`, `building_address`, `building_manager`, `building_phone`) VALUES (133, 'Normandie Court', 'Normandie Court', 'Studio', '7950 Casper Vista Apt. 176
INSERT INTO `Apartments` (`apt_id`, `building_id`, `apt_type_code`, `apt_number`, `bathroom_count`, `bedroom_count`, `room_count`) VALUES (1, 808, 'Flat', 'Suite 645', 1, 3, '7')
INSERT INTO `Apartment_Facilities` (`apt_id`, `facility_code`) VALUES (1, 'Boardband')
INSERT INTO `Guests` (`guest_id`, `gender_code`, `guest_first_name`, `guest_last_name`, `date_of_birth`) VALUES (1, 'Male', 'Kip', 'DuBuque', '1995-11-04 07:09:57')
INSERT INTO `Apartment_Bookings` (`apt_booking_id`, `apt_id`, `guest_id`, `booking_status_code`, `booking_start_date`, `booking_end_date`) VALUES (258, 10, 2, 'Provisional', '2016-09-26 17:13:49', '2017-10-07 11:38:48')
INSERT INTO `View_Unit_Status` (`apt_id`, `apt_booking_id`, `status_date`, `available_yn`) VALUES (11, 920, '1970-09-28 10:24:29', '1') |
apartment_rentals | SELECT apt_number FROM Apartments ORDER BY bedroom_count DESC LIMIT 1 | What is the apartment number of the apartment with the most beds? | CREATE TABLE Apartment_Buildings (
building_id INTEGER NOT NULL,
building_short_name CHAR(15),
building_full_name VARCHAR(80),
building_description VARCHAR(255),
building_address VARCHAR(255),
building_manager VARCHAR(50),
building_phone VARCHAR(80),
PRIMARY KEY (building_id),
UNIQUE (building_id)
);
CREATE TABLE Apartments (
apt_id INTEGER NOT NULL ,
building_id INTEGER NOT NULL,
apt_type_code CHAR(15),
apt_number CHAR(10),
bathroom_count INTEGER,
bedroom_count INTEGER,
room_count CHAR(5),
PRIMARY KEY (apt_id),
UNIQUE (apt_id),
FOREIGN KEY (building_id) REFERENCES Apartment_Buildings (building_id)
);
CREATE TABLE Apartment_Facilities (
apt_id INTEGER NOT NULL,
facility_code CHAR(15) NOT NULL,
PRIMARY KEY (apt_id, facility_code),
FOREIGN KEY (apt_id) REFERENCES Apartments (apt_id)
);
CREATE TABLE Guests (
guest_id INTEGER NOT NULL ,
gender_code CHAR(1),
guest_first_name VARCHAR(80),
guest_last_name VARCHAR(80),
date_of_birth DATETIME,
PRIMARY KEY (guest_id),
UNIQUE (guest_id)
);
CREATE TABLE Apartment_Bookings (
apt_booking_id INTEGER NOT NULL,
apt_id INTEGER,
guest_id INTEGER NOT NULL,
booking_status_code CHAR(15) NOT NULL,
booking_start_date DATETIME,
booking_end_date DATETIME,
PRIMARY KEY (apt_booking_id),
UNIQUE (apt_booking_id),
FOREIGN KEY (apt_id) REFERENCES Apartments (apt_id),
FOREIGN KEY (guest_id) REFERENCES Guests (guest_id)
);
CREATE TABLE View_Unit_Status (
apt_id INTEGER,
apt_booking_id INTEGER,
status_date DATETIME NOT NULL,
available_yn BIT,
PRIMARY KEY (status_date),
FOREIGN KEY (apt_id) REFERENCES Apartments (apt_id),
FOREIGN KEY (apt_booking_id) REFERENCES Apartment_Bookings (apt_booking_id)
);
INSERT INTO `Apartment_Buildings` (`building_id`, `building_short_name`, `building_full_name`, `building_description`, `building_address`, `building_manager`, `building_phone`) VALUES (133, 'Normandie Court', 'Normandie Court', 'Studio', '7950 Casper Vista Apt. 176
INSERT INTO `Apartments` (`apt_id`, `building_id`, `apt_type_code`, `apt_number`, `bathroom_count`, `bedroom_count`, `room_count`) VALUES (1, 808, 'Flat', 'Suite 645', 1, 3, '7')
INSERT INTO `Apartment_Facilities` (`apt_id`, `facility_code`) VALUES (1, 'Boardband')
INSERT INTO `Guests` (`guest_id`, `gender_code`, `guest_first_name`, `guest_last_name`, `date_of_birth`) VALUES (1, 'Male', 'Kip', 'DuBuque', '1995-11-04 07:09:57')
INSERT INTO `Apartment_Bookings` (`apt_booking_id`, `apt_id`, `guest_id`, `booking_status_code`, `booking_start_date`, `booking_end_date`) VALUES (258, 10, 2, 'Provisional', '2016-09-26 17:13:49', '2017-10-07 11:38:48')
INSERT INTO `View_Unit_Status` (`apt_id`, `apt_booking_id`, `status_date`, `available_yn`) VALUES (11, 920, '1970-09-28 10:24:29', '1') |
apartment_rentals | SELECT apt_type_code , COUNT(*) FROM Apartments GROUP BY apt_type_code ORDER BY COUNT(*) ASC | Show the apartment type codes and the corresponding number of apartments sorted by the number of apartments in ascending order. | CREATE TABLE Apartment_Buildings (
building_id INTEGER NOT NULL,
building_short_name CHAR(15),
building_full_name VARCHAR(80),
building_description VARCHAR(255),
building_address VARCHAR(255),
building_manager VARCHAR(50),
building_phone VARCHAR(80),
PRIMARY KEY (building_id),
UNIQUE (building_id)
);
CREATE TABLE Apartments (
apt_id INTEGER NOT NULL ,
building_id INTEGER NOT NULL,
apt_type_code CHAR(15),
apt_number CHAR(10),
bathroom_count INTEGER,
bedroom_count INTEGER,
room_count CHAR(5),
PRIMARY KEY (apt_id),
UNIQUE (apt_id),
FOREIGN KEY (building_id) REFERENCES Apartment_Buildings (building_id)
);
CREATE TABLE Apartment_Facilities (
apt_id INTEGER NOT NULL,
facility_code CHAR(15) NOT NULL,
PRIMARY KEY (apt_id, facility_code),
FOREIGN KEY (apt_id) REFERENCES Apartments (apt_id)
);
CREATE TABLE Guests (
guest_id INTEGER NOT NULL ,
gender_code CHAR(1),
guest_first_name VARCHAR(80),
guest_last_name VARCHAR(80),
date_of_birth DATETIME,
PRIMARY KEY (guest_id),
UNIQUE (guest_id)
);
CREATE TABLE Apartment_Bookings (
apt_booking_id INTEGER NOT NULL,
apt_id INTEGER,
guest_id INTEGER NOT NULL,
booking_status_code CHAR(15) NOT NULL,
booking_start_date DATETIME,
booking_end_date DATETIME,
PRIMARY KEY (apt_booking_id),
UNIQUE (apt_booking_id),
FOREIGN KEY (apt_id) REFERENCES Apartments (apt_id),
FOREIGN KEY (guest_id) REFERENCES Guests (guest_id)
);
CREATE TABLE View_Unit_Status (
apt_id INTEGER,
apt_booking_id INTEGER,
status_date DATETIME NOT NULL,
available_yn BIT,
PRIMARY KEY (status_date),
FOREIGN KEY (apt_id) REFERENCES Apartments (apt_id),
FOREIGN KEY (apt_booking_id) REFERENCES Apartment_Bookings (apt_booking_id)
);
INSERT INTO `Apartment_Buildings` (`building_id`, `building_short_name`, `building_full_name`, `building_description`, `building_address`, `building_manager`, `building_phone`) VALUES (133, 'Normandie Court', 'Normandie Court', 'Studio', '7950 Casper Vista Apt. 176
INSERT INTO `Apartments` (`apt_id`, `building_id`, `apt_type_code`, `apt_number`, `bathroom_count`, `bedroom_count`, `room_count`) VALUES (1, 808, 'Flat', 'Suite 645', 1, 3, '7')
INSERT INTO `Apartment_Facilities` (`apt_id`, `facility_code`) VALUES (1, 'Boardband')
INSERT INTO `Guests` (`guest_id`, `gender_code`, `guest_first_name`, `guest_last_name`, `date_of_birth`) VALUES (1, 'Male', 'Kip', 'DuBuque', '1995-11-04 07:09:57')
INSERT INTO `Apartment_Bookings` (`apt_booking_id`, `apt_id`, `guest_id`, `booking_status_code`, `booking_start_date`, `booking_end_date`) VALUES (258, 10, 2, 'Provisional', '2016-09-26 17:13:49', '2017-10-07 11:38:48')
INSERT INTO `View_Unit_Status` (`apt_id`, `apt_booking_id`, `status_date`, `available_yn`) VALUES (11, 920, '1970-09-28 10:24:29', '1') |
apartment_rentals | SELECT apt_type_code , COUNT(*) FROM Apartments GROUP BY apt_type_code ORDER BY COUNT(*) ASC | Return each apartment type code with the number of apartments having that apartment type, in ascending order of the number of apartments. | CREATE TABLE Apartment_Buildings (
building_id INTEGER NOT NULL,
building_short_name CHAR(15),
building_full_name VARCHAR(80),
building_description VARCHAR(255),
building_address VARCHAR(255),
building_manager VARCHAR(50),
building_phone VARCHAR(80),
PRIMARY KEY (building_id),
UNIQUE (building_id)
);
CREATE TABLE Apartments (
apt_id INTEGER NOT NULL ,
building_id INTEGER NOT NULL,
apt_type_code CHAR(15),
apt_number CHAR(10),
bathroom_count INTEGER,
bedroom_count INTEGER,
room_count CHAR(5),
PRIMARY KEY (apt_id),
UNIQUE (apt_id),
FOREIGN KEY (building_id) REFERENCES Apartment_Buildings (building_id)
);
CREATE TABLE Apartment_Facilities (
apt_id INTEGER NOT NULL,
facility_code CHAR(15) NOT NULL,
PRIMARY KEY (apt_id, facility_code),
FOREIGN KEY (apt_id) REFERENCES Apartments (apt_id)
);
CREATE TABLE Guests (
guest_id INTEGER NOT NULL ,
gender_code CHAR(1),
guest_first_name VARCHAR(80),
guest_last_name VARCHAR(80),
date_of_birth DATETIME,
PRIMARY KEY (guest_id),
UNIQUE (guest_id)
);
CREATE TABLE Apartment_Bookings (
apt_booking_id INTEGER NOT NULL,
apt_id INTEGER,
guest_id INTEGER NOT NULL,
booking_status_code CHAR(15) NOT NULL,
booking_start_date DATETIME,
booking_end_date DATETIME,
PRIMARY KEY (apt_booking_id),
UNIQUE (apt_booking_id),
FOREIGN KEY (apt_id) REFERENCES Apartments (apt_id),
FOREIGN KEY (guest_id) REFERENCES Guests (guest_id)
);
CREATE TABLE View_Unit_Status (
apt_id INTEGER,
apt_booking_id INTEGER,
status_date DATETIME NOT NULL,
available_yn BIT,
PRIMARY KEY (status_date),
FOREIGN KEY (apt_id) REFERENCES Apartments (apt_id),
FOREIGN KEY (apt_booking_id) REFERENCES Apartment_Bookings (apt_booking_id)
);
INSERT INTO `Apartment_Buildings` (`building_id`, `building_short_name`, `building_full_name`, `building_description`, `building_address`, `building_manager`, `building_phone`) VALUES (133, 'Normandie Court', 'Normandie Court', 'Studio', '7950 Casper Vista Apt. 176
INSERT INTO `Apartments` (`apt_id`, `building_id`, `apt_type_code`, `apt_number`, `bathroom_count`, `bedroom_count`, `room_count`) VALUES (1, 808, 'Flat', 'Suite 645', 1, 3, '7')
INSERT INTO `Apartment_Facilities` (`apt_id`, `facility_code`) VALUES (1, 'Boardband')
INSERT INTO `Guests` (`guest_id`, `gender_code`, `guest_first_name`, `guest_last_name`, `date_of_birth`) VALUES (1, 'Male', 'Kip', 'DuBuque', '1995-11-04 07:09:57')
INSERT INTO `Apartment_Bookings` (`apt_booking_id`, `apt_id`, `guest_id`, `booking_status_code`, `booking_start_date`, `booking_end_date`) VALUES (258, 10, 2, 'Provisional', '2016-09-26 17:13:49', '2017-10-07 11:38:48')
INSERT INTO `View_Unit_Status` (`apt_id`, `apt_booking_id`, `status_date`, `available_yn`) VALUES (11, 920, '1970-09-28 10:24:29', '1') |
apartment_rentals | SELECT apt_type_code FROM Apartments GROUP BY apt_type_code ORDER BY avg(room_count) DESC LIMIT 3 | Show the top 3 apartment type codes sorted by the average number of rooms in descending order. | CREATE TABLE Apartment_Buildings (
building_id INTEGER NOT NULL,
building_short_name CHAR(15),
building_full_name VARCHAR(80),
building_description VARCHAR(255),
building_address VARCHAR(255),
building_manager VARCHAR(50),
building_phone VARCHAR(80),
PRIMARY KEY (building_id),
UNIQUE (building_id)
);
CREATE TABLE Apartments (
apt_id INTEGER NOT NULL ,
building_id INTEGER NOT NULL,
apt_type_code CHAR(15),
apt_number CHAR(10),
bathroom_count INTEGER,
bedroom_count INTEGER,
room_count CHAR(5),
PRIMARY KEY (apt_id),
UNIQUE (apt_id),
FOREIGN KEY (building_id) REFERENCES Apartment_Buildings (building_id)
);
CREATE TABLE Apartment_Facilities (
apt_id INTEGER NOT NULL,
facility_code CHAR(15) NOT NULL,
PRIMARY KEY (apt_id, facility_code),
FOREIGN KEY (apt_id) REFERENCES Apartments (apt_id)
);
CREATE TABLE Guests (
guest_id INTEGER NOT NULL ,
gender_code CHAR(1),
guest_first_name VARCHAR(80),
guest_last_name VARCHAR(80),
date_of_birth DATETIME,
PRIMARY KEY (guest_id),
UNIQUE (guest_id)
);
CREATE TABLE Apartment_Bookings (
apt_booking_id INTEGER NOT NULL,
apt_id INTEGER,
guest_id INTEGER NOT NULL,
booking_status_code CHAR(15) NOT NULL,
booking_start_date DATETIME,
booking_end_date DATETIME,
PRIMARY KEY (apt_booking_id),
UNIQUE (apt_booking_id),
FOREIGN KEY (apt_id) REFERENCES Apartments (apt_id),
FOREIGN KEY (guest_id) REFERENCES Guests (guest_id)
);
CREATE TABLE View_Unit_Status (
apt_id INTEGER,
apt_booking_id INTEGER,
status_date DATETIME NOT NULL,
available_yn BIT,
PRIMARY KEY (status_date),
FOREIGN KEY (apt_id) REFERENCES Apartments (apt_id),
FOREIGN KEY (apt_booking_id) REFERENCES Apartment_Bookings (apt_booking_id)
);
INSERT INTO `Apartment_Buildings` (`building_id`, `building_short_name`, `building_full_name`, `building_description`, `building_address`, `building_manager`, `building_phone`) VALUES (133, 'Normandie Court', 'Normandie Court', 'Studio', '7950 Casper Vista Apt. 176
INSERT INTO `Apartments` (`apt_id`, `building_id`, `apt_type_code`, `apt_number`, `bathroom_count`, `bedroom_count`, `room_count`) VALUES (1, 808, 'Flat', 'Suite 645', 1, 3, '7')
INSERT INTO `Apartment_Facilities` (`apt_id`, `facility_code`) VALUES (1, 'Boardband')
INSERT INTO `Guests` (`guest_id`, `gender_code`, `guest_first_name`, `guest_last_name`, `date_of_birth`) VALUES (1, 'Male', 'Kip', 'DuBuque', '1995-11-04 07:09:57')
INSERT INTO `Apartment_Bookings` (`apt_booking_id`, `apt_id`, `guest_id`, `booking_status_code`, `booking_start_date`, `booking_end_date`) VALUES (258, 10, 2, 'Provisional', '2016-09-26 17:13:49', '2017-10-07 11:38:48')
INSERT INTO `View_Unit_Status` (`apt_id`, `apt_booking_id`, `status_date`, `available_yn`) VALUES (11, 920, '1970-09-28 10:24:29', '1') |
apartment_rentals | SELECT apt_type_code FROM Apartments GROUP BY apt_type_code ORDER BY avg(room_count) DESC LIMIT 3 | What are the top three apartment types in terms of the average room count? Give me the | CREATE TABLE Apartment_Buildings (
building_id INTEGER NOT NULL,
building_short_name CHAR(15),
building_full_name VARCHAR(80),
building_description VARCHAR(255),
building_address VARCHAR(255),
building_manager VARCHAR(50),
building_phone VARCHAR(80),
PRIMARY KEY (building_id),
UNIQUE (building_id)
);
CREATE TABLE Apartments (
apt_id INTEGER NOT NULL ,
building_id INTEGER NOT NULL,
apt_type_code CHAR(15),
apt_number CHAR(10),
bathroom_count INTEGER,
bedroom_count INTEGER,
room_count CHAR(5),
PRIMARY KEY (apt_id),
UNIQUE (apt_id),
FOREIGN KEY (building_id) REFERENCES Apartment_Buildings (building_id)
);
CREATE TABLE Apartment_Facilities (
apt_id INTEGER NOT NULL,
facility_code CHAR(15) NOT NULL,
PRIMARY KEY (apt_id, facility_code),
FOREIGN KEY (apt_id) REFERENCES Apartments (apt_id)
);
CREATE TABLE Guests (
guest_id INTEGER NOT NULL ,
gender_code CHAR(1),
guest_first_name VARCHAR(80),
guest_last_name VARCHAR(80),
date_of_birth DATETIME,
PRIMARY KEY (guest_id),
UNIQUE (guest_id)
);
CREATE TABLE Apartment_Bookings (
apt_booking_id INTEGER NOT NULL,
apt_id INTEGER,
guest_id INTEGER NOT NULL,
booking_status_code CHAR(15) NOT NULL,
booking_start_date DATETIME,
booking_end_date DATETIME,
PRIMARY KEY (apt_booking_id),
UNIQUE (apt_booking_id),
FOREIGN KEY (apt_id) REFERENCES Apartments (apt_id),
FOREIGN KEY (guest_id) REFERENCES Guests (guest_id)
);
CREATE TABLE View_Unit_Status (
apt_id INTEGER,
apt_booking_id INTEGER,
status_date DATETIME NOT NULL,
available_yn BIT,
PRIMARY KEY (status_date),
FOREIGN KEY (apt_id) REFERENCES Apartments (apt_id),
FOREIGN KEY (apt_booking_id) REFERENCES Apartment_Bookings (apt_booking_id)
);
INSERT INTO `Apartment_Buildings` (`building_id`, `building_short_name`, `building_full_name`, `building_description`, `building_address`, `building_manager`, `building_phone`) VALUES (133, 'Normandie Court', 'Normandie Court', 'Studio', '7950 Casper Vista Apt. 176
INSERT INTO `Apartments` (`apt_id`, `building_id`, `apt_type_code`, `apt_number`, `bathroom_count`, `bedroom_count`, `room_count`) VALUES (1, 808, 'Flat', 'Suite 645', 1, 3, '7')
INSERT INTO `Apartment_Facilities` (`apt_id`, `facility_code`) VALUES (1, 'Boardband')
INSERT INTO `Guests` (`guest_id`, `gender_code`, `guest_first_name`, `guest_last_name`, `date_of_birth`) VALUES (1, 'Male', 'Kip', 'DuBuque', '1995-11-04 07:09:57')
INSERT INTO `Apartment_Bookings` (`apt_booking_id`, `apt_id`, `guest_id`, `booking_status_code`, `booking_start_date`, `booking_end_date`) VALUES (258, 10, 2, 'Provisional', '2016-09-26 17:13:49', '2017-10-07 11:38:48')
INSERT INTO `View_Unit_Status` (`apt_id`, `apt_booking_id`, `status_date`, `available_yn`) VALUES (11, 920, '1970-09-28 10:24:29', '1') |
apartment_rentals | SELECT apt_type_code , bathroom_count , bedroom_count FROM Apartments GROUP BY apt_type_code ORDER BY sum(room_count) DESC LIMIT 1 | Show the apartment type code that has the largest number of total rooms, together with the number of bathrooms and number of bedrooms. | CREATE TABLE Apartment_Buildings (
building_id INTEGER NOT NULL,
building_short_name CHAR(15),
building_full_name VARCHAR(80),
building_description VARCHAR(255),
building_address VARCHAR(255),
building_manager VARCHAR(50),
building_phone VARCHAR(80),
PRIMARY KEY (building_id),
UNIQUE (building_id)
);
CREATE TABLE Apartments (
apt_id INTEGER NOT NULL ,
building_id INTEGER NOT NULL,
apt_type_code CHAR(15),
apt_number CHAR(10),
bathroom_count INTEGER,
bedroom_count INTEGER,
room_count CHAR(5),
PRIMARY KEY (apt_id),
UNIQUE (apt_id),
FOREIGN KEY (building_id) REFERENCES Apartment_Buildings (building_id)
);
CREATE TABLE Apartment_Facilities (
apt_id INTEGER NOT NULL,
facility_code CHAR(15) NOT NULL,
PRIMARY KEY (apt_id, facility_code),
FOREIGN KEY (apt_id) REFERENCES Apartments (apt_id)
);
CREATE TABLE Guests (
guest_id INTEGER NOT NULL ,
gender_code CHAR(1),
guest_first_name VARCHAR(80),
guest_last_name VARCHAR(80),
date_of_birth DATETIME,
PRIMARY KEY (guest_id),
UNIQUE (guest_id)
);
CREATE TABLE Apartment_Bookings (
apt_booking_id INTEGER NOT NULL,
apt_id INTEGER,
guest_id INTEGER NOT NULL,
booking_status_code CHAR(15) NOT NULL,
booking_start_date DATETIME,
booking_end_date DATETIME,
PRIMARY KEY (apt_booking_id),
UNIQUE (apt_booking_id),
FOREIGN KEY (apt_id) REFERENCES Apartments (apt_id),
FOREIGN KEY (guest_id) REFERENCES Guests (guest_id)
);
CREATE TABLE View_Unit_Status (
apt_id INTEGER,
apt_booking_id INTEGER,
status_date DATETIME NOT NULL,
available_yn BIT,
PRIMARY KEY (status_date),
FOREIGN KEY (apt_id) REFERENCES Apartments (apt_id),
FOREIGN KEY (apt_booking_id) REFERENCES Apartment_Bookings (apt_booking_id)
);
INSERT INTO `Apartment_Buildings` (`building_id`, `building_short_name`, `building_full_name`, `building_description`, `building_address`, `building_manager`, `building_phone`) VALUES (133, 'Normandie Court', 'Normandie Court', 'Studio', '7950 Casper Vista Apt. 176
INSERT INTO `Apartments` (`apt_id`, `building_id`, `apt_type_code`, `apt_number`, `bathroom_count`, `bedroom_count`, `room_count`) VALUES (1, 808, 'Flat', 'Suite 645', 1, 3, '7')
INSERT INTO `Apartment_Facilities` (`apt_id`, `facility_code`) VALUES (1, 'Boardband')
INSERT INTO `Guests` (`guest_id`, `gender_code`, `guest_first_name`, `guest_last_name`, `date_of_birth`) VALUES (1, 'Male', 'Kip', 'DuBuque', '1995-11-04 07:09:57')
INSERT INTO `Apartment_Bookings` (`apt_booking_id`, `apt_id`, `guest_id`, `booking_status_code`, `booking_start_date`, `booking_end_date`) VALUES (258, 10, 2, 'Provisional', '2016-09-26 17:13:49', '2017-10-07 11:38:48')
INSERT INTO `View_Unit_Status` (`apt_id`, `apt_booking_id`, `status_date`, `available_yn`) VALUES (11, 920, '1970-09-28 10:24:29', '1') |
apartment_rentals | SELECT apt_type_code , bathroom_count , bedroom_count FROM Apartments GROUP BY apt_type_code ORDER BY sum(room_count) DESC LIMIT 1 | Which apartment type has the largest number of total rooms? Return the apartment type code, its number of bathrooms and number of bedrooms. | CREATE TABLE Apartment_Buildings (
building_id INTEGER NOT NULL,
building_short_name CHAR(15),
building_full_name VARCHAR(80),
building_description VARCHAR(255),
building_address VARCHAR(255),
building_manager VARCHAR(50),
building_phone VARCHAR(80),
PRIMARY KEY (building_id),
UNIQUE (building_id)
);
CREATE TABLE Apartments (
apt_id INTEGER NOT NULL ,
building_id INTEGER NOT NULL,
apt_type_code CHAR(15),
apt_number CHAR(10),
bathroom_count INTEGER,
bedroom_count INTEGER,
room_count CHAR(5),
PRIMARY KEY (apt_id),
UNIQUE (apt_id),
FOREIGN KEY (building_id) REFERENCES Apartment_Buildings (building_id)
);
CREATE TABLE Apartment_Facilities (
apt_id INTEGER NOT NULL,
facility_code CHAR(15) NOT NULL,
PRIMARY KEY (apt_id, facility_code),
FOREIGN KEY (apt_id) REFERENCES Apartments (apt_id)
);
CREATE TABLE Guests (
guest_id INTEGER NOT NULL ,
gender_code CHAR(1),
guest_first_name VARCHAR(80),
guest_last_name VARCHAR(80),
date_of_birth DATETIME,
PRIMARY KEY (guest_id),
UNIQUE (guest_id)
);
CREATE TABLE Apartment_Bookings (
apt_booking_id INTEGER NOT NULL,
apt_id INTEGER,
guest_id INTEGER NOT NULL,
booking_status_code CHAR(15) NOT NULL,
booking_start_date DATETIME,
booking_end_date DATETIME,
PRIMARY KEY (apt_booking_id),
UNIQUE (apt_booking_id),
FOREIGN KEY (apt_id) REFERENCES Apartments (apt_id),
FOREIGN KEY (guest_id) REFERENCES Guests (guest_id)
);
CREATE TABLE View_Unit_Status (
apt_id INTEGER,
apt_booking_id INTEGER,
status_date DATETIME NOT NULL,
available_yn BIT,
PRIMARY KEY (status_date),
FOREIGN KEY (apt_id) REFERENCES Apartments (apt_id),
FOREIGN KEY (apt_booking_id) REFERENCES Apartment_Bookings (apt_booking_id)
);
INSERT INTO `Apartment_Buildings` (`building_id`, `building_short_name`, `building_full_name`, `building_description`, `building_address`, `building_manager`, `building_phone`) VALUES (133, 'Normandie Court', 'Normandie Court', 'Studio', '7950 Casper Vista Apt. 176
INSERT INTO `Apartments` (`apt_id`, `building_id`, `apt_type_code`, `apt_number`, `bathroom_count`, `bedroom_count`, `room_count`) VALUES (1, 808, 'Flat', 'Suite 645', 1, 3, '7')
INSERT INTO `Apartment_Facilities` (`apt_id`, `facility_code`) VALUES (1, 'Boardband')
INSERT INTO `Guests` (`guest_id`, `gender_code`, `guest_first_name`, `guest_last_name`, `date_of_birth`) VALUES (1, 'Male', 'Kip', 'DuBuque', '1995-11-04 07:09:57')
INSERT INTO `Apartment_Bookings` (`apt_booking_id`, `apt_id`, `guest_id`, `booking_status_code`, `booking_start_date`, `booking_end_date`) VALUES (258, 10, 2, 'Provisional', '2016-09-26 17:13:49', '2017-10-07 11:38:48')
INSERT INTO `View_Unit_Status` (`apt_id`, `apt_booking_id`, `status_date`, `available_yn`) VALUES (11, 920, '1970-09-28 10:24:29', '1') |
apartment_rentals | SELECT apt_type_code FROM Apartments GROUP BY apt_type_code ORDER BY count(*) DESC LIMIT 1 | Show the most common apartment type code. | CREATE TABLE Apartment_Buildings (
building_id INTEGER NOT NULL,
building_short_name CHAR(15),
building_full_name VARCHAR(80),
building_description VARCHAR(255),
building_address VARCHAR(255),
building_manager VARCHAR(50),
building_phone VARCHAR(80),
PRIMARY KEY (building_id),
UNIQUE (building_id)
);
CREATE TABLE Apartments (
apt_id INTEGER NOT NULL ,
building_id INTEGER NOT NULL,
apt_type_code CHAR(15),
apt_number CHAR(10),
bathroom_count INTEGER,
bedroom_count INTEGER,
room_count CHAR(5),
PRIMARY KEY (apt_id),
UNIQUE (apt_id),
FOREIGN KEY (building_id) REFERENCES Apartment_Buildings (building_id)
);
CREATE TABLE Apartment_Facilities (
apt_id INTEGER NOT NULL,
facility_code CHAR(15) NOT NULL,
PRIMARY KEY (apt_id, facility_code),
FOREIGN KEY (apt_id) REFERENCES Apartments (apt_id)
);
CREATE TABLE Guests (
guest_id INTEGER NOT NULL ,
gender_code CHAR(1),
guest_first_name VARCHAR(80),
guest_last_name VARCHAR(80),
date_of_birth DATETIME,
PRIMARY KEY (guest_id),
UNIQUE (guest_id)
);
CREATE TABLE Apartment_Bookings (
apt_booking_id INTEGER NOT NULL,
apt_id INTEGER,
guest_id INTEGER NOT NULL,
booking_status_code CHAR(15) NOT NULL,
booking_start_date DATETIME,
booking_end_date DATETIME,
PRIMARY KEY (apt_booking_id),
UNIQUE (apt_booking_id),
FOREIGN KEY (apt_id) REFERENCES Apartments (apt_id),
FOREIGN KEY (guest_id) REFERENCES Guests (guest_id)
);
CREATE TABLE View_Unit_Status (
apt_id INTEGER,
apt_booking_id INTEGER,
status_date DATETIME NOT NULL,
available_yn BIT,
PRIMARY KEY (status_date),
FOREIGN KEY (apt_id) REFERENCES Apartments (apt_id),
FOREIGN KEY (apt_booking_id) REFERENCES Apartment_Bookings (apt_booking_id)
);
INSERT INTO `Apartment_Buildings` (`building_id`, `building_short_name`, `building_full_name`, `building_description`, `building_address`, `building_manager`, `building_phone`) VALUES (133, 'Normandie Court', 'Normandie Court', 'Studio', '7950 Casper Vista Apt. 176
INSERT INTO `Apartments` (`apt_id`, `building_id`, `apt_type_code`, `apt_number`, `bathroom_count`, `bedroom_count`, `room_count`) VALUES (1, 808, 'Flat', 'Suite 645', 1, 3, '7')
INSERT INTO `Apartment_Facilities` (`apt_id`, `facility_code`) VALUES (1, 'Boardband')
INSERT INTO `Guests` (`guest_id`, `gender_code`, `guest_first_name`, `guest_last_name`, `date_of_birth`) VALUES (1, 'Male', 'Kip', 'DuBuque', '1995-11-04 07:09:57')
INSERT INTO `Apartment_Bookings` (`apt_booking_id`, `apt_id`, `guest_id`, `booking_status_code`, `booking_start_date`, `booking_end_date`) VALUES (258, 10, 2, 'Provisional', '2016-09-26 17:13:49', '2017-10-07 11:38:48')
INSERT INTO `View_Unit_Status` (`apt_id`, `apt_booking_id`, `status_date`, `available_yn`) VALUES (11, 920, '1970-09-28 10:24:29', '1') |
apartment_rentals | SELECT apt_type_code FROM Apartments GROUP BY apt_type_code ORDER BY count(*) DESC LIMIT 1 | Which apartment type code appears the most often? | CREATE TABLE Apartment_Buildings (
building_id INTEGER NOT NULL,
building_short_name CHAR(15),
building_full_name VARCHAR(80),
building_description VARCHAR(255),
building_address VARCHAR(255),
building_manager VARCHAR(50),
building_phone VARCHAR(80),
PRIMARY KEY (building_id),
UNIQUE (building_id)
);
CREATE TABLE Apartments (
apt_id INTEGER NOT NULL ,
building_id INTEGER NOT NULL,
apt_type_code CHAR(15),
apt_number CHAR(10),
bathroom_count INTEGER,
bedroom_count INTEGER,
room_count CHAR(5),
PRIMARY KEY (apt_id),
UNIQUE (apt_id),
FOREIGN KEY (building_id) REFERENCES Apartment_Buildings (building_id)
);
CREATE TABLE Apartment_Facilities (
apt_id INTEGER NOT NULL,
facility_code CHAR(15) NOT NULL,
PRIMARY KEY (apt_id, facility_code),
FOREIGN KEY (apt_id) REFERENCES Apartments (apt_id)
);
CREATE TABLE Guests (
guest_id INTEGER NOT NULL ,
gender_code CHAR(1),
guest_first_name VARCHAR(80),
guest_last_name VARCHAR(80),
date_of_birth DATETIME,
PRIMARY KEY (guest_id),
UNIQUE (guest_id)
);
CREATE TABLE Apartment_Bookings (
apt_booking_id INTEGER NOT NULL,
apt_id INTEGER,
guest_id INTEGER NOT NULL,
booking_status_code CHAR(15) NOT NULL,
booking_start_date DATETIME,
booking_end_date DATETIME,
PRIMARY KEY (apt_booking_id),
UNIQUE (apt_booking_id),
FOREIGN KEY (apt_id) REFERENCES Apartments (apt_id),
FOREIGN KEY (guest_id) REFERENCES Guests (guest_id)
);
CREATE TABLE View_Unit_Status (
apt_id INTEGER,
apt_booking_id INTEGER,
status_date DATETIME NOT NULL,
available_yn BIT,
PRIMARY KEY (status_date),
FOREIGN KEY (apt_id) REFERENCES Apartments (apt_id),
FOREIGN KEY (apt_booking_id) REFERENCES Apartment_Bookings (apt_booking_id)
);
INSERT INTO `Apartment_Buildings` (`building_id`, `building_short_name`, `building_full_name`, `building_description`, `building_address`, `building_manager`, `building_phone`) VALUES (133, 'Normandie Court', 'Normandie Court', 'Studio', '7950 Casper Vista Apt. 176
INSERT INTO `Apartments` (`apt_id`, `building_id`, `apt_type_code`, `apt_number`, `bathroom_count`, `bedroom_count`, `room_count`) VALUES (1, 808, 'Flat', 'Suite 645', 1, 3, '7')
INSERT INTO `Apartment_Facilities` (`apt_id`, `facility_code`) VALUES (1, 'Boardband')
INSERT INTO `Guests` (`guest_id`, `gender_code`, `guest_first_name`, `guest_last_name`, `date_of_birth`) VALUES (1, 'Male', 'Kip', 'DuBuque', '1995-11-04 07:09:57')
INSERT INTO `Apartment_Bookings` (`apt_booking_id`, `apt_id`, `guest_id`, `booking_status_code`, `booking_start_date`, `booking_end_date`) VALUES (258, 10, 2, 'Provisional', '2016-09-26 17:13:49', '2017-10-07 11:38:48')
INSERT INTO `View_Unit_Status` (`apt_id`, `apt_booking_id`, `status_date`, `available_yn`) VALUES (11, 920, '1970-09-28 10:24:29', '1') |
apartment_rentals | SELECT apt_type_code FROM Apartments WHERE bathroom_count > 1 GROUP BY apt_type_code ORDER BY count(*) DESC LIMIT 1 | Show the most common apartment type code among apartments with more than 1 bathroom. | CREATE TABLE Apartment_Buildings (
building_id INTEGER NOT NULL,
building_short_name CHAR(15),
building_full_name VARCHAR(80),
building_description VARCHAR(255),
building_address VARCHAR(255),
building_manager VARCHAR(50),
building_phone VARCHAR(80),
PRIMARY KEY (building_id),
UNIQUE (building_id)
);
CREATE TABLE Apartments (
apt_id INTEGER NOT NULL ,
building_id INTEGER NOT NULL,
apt_type_code CHAR(15),
apt_number CHAR(10),
bathroom_count INTEGER,
bedroom_count INTEGER,
room_count CHAR(5),
PRIMARY KEY (apt_id),
UNIQUE (apt_id),
FOREIGN KEY (building_id) REFERENCES Apartment_Buildings (building_id)
);
CREATE TABLE Apartment_Facilities (
apt_id INTEGER NOT NULL,
facility_code CHAR(15) NOT NULL,
PRIMARY KEY (apt_id, facility_code),
FOREIGN KEY (apt_id) REFERENCES Apartments (apt_id)
);
CREATE TABLE Guests (
guest_id INTEGER NOT NULL ,
gender_code CHAR(1),
guest_first_name VARCHAR(80),
guest_last_name VARCHAR(80),
date_of_birth DATETIME,
PRIMARY KEY (guest_id),
UNIQUE (guest_id)
);
CREATE TABLE Apartment_Bookings (
apt_booking_id INTEGER NOT NULL,
apt_id INTEGER,
guest_id INTEGER NOT NULL,
booking_status_code CHAR(15) NOT NULL,
booking_start_date DATETIME,
booking_end_date DATETIME,
PRIMARY KEY (apt_booking_id),
UNIQUE (apt_booking_id),
FOREIGN KEY (apt_id) REFERENCES Apartments (apt_id),
FOREIGN KEY (guest_id) REFERENCES Guests (guest_id)
);
CREATE TABLE View_Unit_Status (
apt_id INTEGER,
apt_booking_id INTEGER,
status_date DATETIME NOT NULL,
available_yn BIT,
PRIMARY KEY (status_date),
FOREIGN KEY (apt_id) REFERENCES Apartments (apt_id),
FOREIGN KEY (apt_booking_id) REFERENCES Apartment_Bookings (apt_booking_id)
);
INSERT INTO `Apartment_Buildings` (`building_id`, `building_short_name`, `building_full_name`, `building_description`, `building_address`, `building_manager`, `building_phone`) VALUES (133, 'Normandie Court', 'Normandie Court', 'Studio', '7950 Casper Vista Apt. 176
INSERT INTO `Apartments` (`apt_id`, `building_id`, `apt_type_code`, `apt_number`, `bathroom_count`, `bedroom_count`, `room_count`) VALUES (1, 808, 'Flat', 'Suite 645', 1, 3, '7')
INSERT INTO `Apartment_Facilities` (`apt_id`, `facility_code`) VALUES (1, 'Boardband')
INSERT INTO `Guests` (`guest_id`, `gender_code`, `guest_first_name`, `guest_last_name`, `date_of_birth`) VALUES (1, 'Male', 'Kip', 'DuBuque', '1995-11-04 07:09:57')
INSERT INTO `Apartment_Bookings` (`apt_booking_id`, `apt_id`, `guest_id`, `booking_status_code`, `booking_start_date`, `booking_end_date`) VALUES (258, 10, 2, 'Provisional', '2016-09-26 17:13:49', '2017-10-07 11:38:48')
INSERT INTO `View_Unit_Status` (`apt_id`, `apt_booking_id`, `status_date`, `available_yn`) VALUES (11, 920, '1970-09-28 10:24:29', '1') |
apartment_rentals | SELECT apt_type_code FROM Apartments WHERE bathroom_count > 1 GROUP BY apt_type_code ORDER BY count(*) DESC LIMIT 1 | Which apartment type code is the most common among apartments with more than one bathroom? | CREATE TABLE Apartment_Buildings (
building_id INTEGER NOT NULL,
building_short_name CHAR(15),
building_full_name VARCHAR(80),
building_description VARCHAR(255),
building_address VARCHAR(255),
building_manager VARCHAR(50),
building_phone VARCHAR(80),
PRIMARY KEY (building_id),
UNIQUE (building_id)
);
CREATE TABLE Apartments (
apt_id INTEGER NOT NULL ,
building_id INTEGER NOT NULL,
apt_type_code CHAR(15),
apt_number CHAR(10),
bathroom_count INTEGER,
bedroom_count INTEGER,
room_count CHAR(5),
PRIMARY KEY (apt_id),
UNIQUE (apt_id),
FOREIGN KEY (building_id) REFERENCES Apartment_Buildings (building_id)
);
CREATE TABLE Apartment_Facilities (
apt_id INTEGER NOT NULL,
facility_code CHAR(15) NOT NULL,
PRIMARY KEY (apt_id, facility_code),
FOREIGN KEY (apt_id) REFERENCES Apartments (apt_id)
);
CREATE TABLE Guests (
guest_id INTEGER NOT NULL ,
gender_code CHAR(1),
guest_first_name VARCHAR(80),
guest_last_name VARCHAR(80),
date_of_birth DATETIME,
PRIMARY KEY (guest_id),
UNIQUE (guest_id)
);
CREATE TABLE Apartment_Bookings (
apt_booking_id INTEGER NOT NULL,
apt_id INTEGER,
guest_id INTEGER NOT NULL,
booking_status_code CHAR(15) NOT NULL,
booking_start_date DATETIME,
booking_end_date DATETIME,
PRIMARY KEY (apt_booking_id),
UNIQUE (apt_booking_id),
FOREIGN KEY (apt_id) REFERENCES Apartments (apt_id),
FOREIGN KEY (guest_id) REFERENCES Guests (guest_id)
);
CREATE TABLE View_Unit_Status (
apt_id INTEGER,
apt_booking_id INTEGER,
status_date DATETIME NOT NULL,
available_yn BIT,
PRIMARY KEY (status_date),
FOREIGN KEY (apt_id) REFERENCES Apartments (apt_id),
FOREIGN KEY (apt_booking_id) REFERENCES Apartment_Bookings (apt_booking_id)
);
INSERT INTO `Apartment_Buildings` (`building_id`, `building_short_name`, `building_full_name`, `building_description`, `building_address`, `building_manager`, `building_phone`) VALUES (133, 'Normandie Court', 'Normandie Court', 'Studio', '7950 Casper Vista Apt. 176
INSERT INTO `Apartments` (`apt_id`, `building_id`, `apt_type_code`, `apt_number`, `bathroom_count`, `bedroom_count`, `room_count`) VALUES (1, 808, 'Flat', 'Suite 645', 1, 3, '7')
INSERT INTO `Apartment_Facilities` (`apt_id`, `facility_code`) VALUES (1, 'Boardband')
INSERT INTO `Guests` (`guest_id`, `gender_code`, `guest_first_name`, `guest_last_name`, `date_of_birth`) VALUES (1, 'Male', 'Kip', 'DuBuque', '1995-11-04 07:09:57')
INSERT INTO `Apartment_Bookings` (`apt_booking_id`, `apt_id`, `guest_id`, `booking_status_code`, `booking_start_date`, `booking_end_date`) VALUES (258, 10, 2, 'Provisional', '2016-09-26 17:13:49', '2017-10-07 11:38:48')
INSERT INTO `View_Unit_Status` (`apt_id`, `apt_booking_id`, `status_date`, `available_yn`) VALUES (11, 920, '1970-09-28 10:24:29', '1') |
apartment_rentals | SELECT apt_type_code , max(room_count) , min(room_count) FROM Apartments GROUP BY apt_type_code | Show each apartment type code, and the maximum and minimum number of rooms for each type. | CREATE TABLE Apartment_Buildings (
building_id INTEGER NOT NULL,
building_short_name CHAR(15),
building_full_name VARCHAR(80),
building_description VARCHAR(255),
building_address VARCHAR(255),
building_manager VARCHAR(50),
building_phone VARCHAR(80),
PRIMARY KEY (building_id),
UNIQUE (building_id)
);
CREATE TABLE Apartments (
apt_id INTEGER NOT NULL ,
building_id INTEGER NOT NULL,
apt_type_code CHAR(15),
apt_number CHAR(10),
bathroom_count INTEGER,
bedroom_count INTEGER,
room_count CHAR(5),
PRIMARY KEY (apt_id),
UNIQUE (apt_id),
FOREIGN KEY (building_id) REFERENCES Apartment_Buildings (building_id)
);
CREATE TABLE Apartment_Facilities (
apt_id INTEGER NOT NULL,
facility_code CHAR(15) NOT NULL,
PRIMARY KEY (apt_id, facility_code),
FOREIGN KEY (apt_id) REFERENCES Apartments (apt_id)
);
CREATE TABLE Guests (
guest_id INTEGER NOT NULL ,
gender_code CHAR(1),
guest_first_name VARCHAR(80),
guest_last_name VARCHAR(80),
date_of_birth DATETIME,
PRIMARY KEY (guest_id),
UNIQUE (guest_id)
);
CREATE TABLE Apartment_Bookings (
apt_booking_id INTEGER NOT NULL,
apt_id INTEGER,
guest_id INTEGER NOT NULL,
booking_status_code CHAR(15) NOT NULL,
booking_start_date DATETIME,
booking_end_date DATETIME,
PRIMARY KEY (apt_booking_id),
UNIQUE (apt_booking_id),
FOREIGN KEY (apt_id) REFERENCES Apartments (apt_id),
FOREIGN KEY (guest_id) REFERENCES Guests (guest_id)
);
CREATE TABLE View_Unit_Status (
apt_id INTEGER,
apt_booking_id INTEGER,
status_date DATETIME NOT NULL,
available_yn BIT,
PRIMARY KEY (status_date),
FOREIGN KEY (apt_id) REFERENCES Apartments (apt_id),
FOREIGN KEY (apt_booking_id) REFERENCES Apartment_Bookings (apt_booking_id)
);
INSERT INTO `Apartment_Buildings` (`building_id`, `building_short_name`, `building_full_name`, `building_description`, `building_address`, `building_manager`, `building_phone`) VALUES (133, 'Normandie Court', 'Normandie Court', 'Studio', '7950 Casper Vista Apt. 176
INSERT INTO `Apartments` (`apt_id`, `building_id`, `apt_type_code`, `apt_number`, `bathroom_count`, `bedroom_count`, `room_count`) VALUES (1, 808, 'Flat', 'Suite 645', 1, 3, '7')
INSERT INTO `Apartment_Facilities` (`apt_id`, `facility_code`) VALUES (1, 'Boardband')
INSERT INTO `Guests` (`guest_id`, `gender_code`, `guest_first_name`, `guest_last_name`, `date_of_birth`) VALUES (1, 'Male', 'Kip', 'DuBuque', '1995-11-04 07:09:57')
INSERT INTO `Apartment_Bookings` (`apt_booking_id`, `apt_id`, `guest_id`, `booking_status_code`, `booking_start_date`, `booking_end_date`) VALUES (258, 10, 2, 'Provisional', '2016-09-26 17:13:49', '2017-10-07 11:38:48')
INSERT INTO `View_Unit_Status` (`apt_id`, `apt_booking_id`, `status_date`, `available_yn`) VALUES (11, 920, '1970-09-28 10:24:29', '1') |
apartment_rentals | SELECT apt_type_code , max(room_count) , min(room_count) FROM Apartments GROUP BY apt_type_code | Return each apartment type code along with the maximum and minimum number of rooms among each type. | CREATE TABLE Apartment_Buildings (
building_id INTEGER NOT NULL,
building_short_name CHAR(15),
building_full_name VARCHAR(80),
building_description VARCHAR(255),
building_address VARCHAR(255),
building_manager VARCHAR(50),
building_phone VARCHAR(80),
PRIMARY KEY (building_id),
UNIQUE (building_id)
);
CREATE TABLE Apartments (
apt_id INTEGER NOT NULL ,
building_id INTEGER NOT NULL,
apt_type_code CHAR(15),
apt_number CHAR(10),
bathroom_count INTEGER,
bedroom_count INTEGER,
room_count CHAR(5),
PRIMARY KEY (apt_id),
UNIQUE (apt_id),
FOREIGN KEY (building_id) REFERENCES Apartment_Buildings (building_id)
);
CREATE TABLE Apartment_Facilities (
apt_id INTEGER NOT NULL,
facility_code CHAR(15) NOT NULL,
PRIMARY KEY (apt_id, facility_code),
FOREIGN KEY (apt_id) REFERENCES Apartments (apt_id)
);
CREATE TABLE Guests (
guest_id INTEGER NOT NULL ,
gender_code CHAR(1),
guest_first_name VARCHAR(80),
guest_last_name VARCHAR(80),
date_of_birth DATETIME,
PRIMARY KEY (guest_id),
UNIQUE (guest_id)
);
CREATE TABLE Apartment_Bookings (
apt_booking_id INTEGER NOT NULL,
apt_id INTEGER,
guest_id INTEGER NOT NULL,
booking_status_code CHAR(15) NOT NULL,
booking_start_date DATETIME,
booking_end_date DATETIME,
PRIMARY KEY (apt_booking_id),
UNIQUE (apt_booking_id),
FOREIGN KEY (apt_id) REFERENCES Apartments (apt_id),
FOREIGN KEY (guest_id) REFERENCES Guests (guest_id)
);
CREATE TABLE View_Unit_Status (
apt_id INTEGER,
apt_booking_id INTEGER,
status_date DATETIME NOT NULL,
available_yn BIT,
PRIMARY KEY (status_date),
FOREIGN KEY (apt_id) REFERENCES Apartments (apt_id),
FOREIGN KEY (apt_booking_id) REFERENCES Apartment_Bookings (apt_booking_id)
);
INSERT INTO `Apartment_Buildings` (`building_id`, `building_short_name`, `building_full_name`, `building_description`, `building_address`, `building_manager`, `building_phone`) VALUES (133, 'Normandie Court', 'Normandie Court', 'Studio', '7950 Casper Vista Apt. 176
INSERT INTO `Apartments` (`apt_id`, `building_id`, `apt_type_code`, `apt_number`, `bathroom_count`, `bedroom_count`, `room_count`) VALUES (1, 808, 'Flat', 'Suite 645', 1, 3, '7')
INSERT INTO `Apartment_Facilities` (`apt_id`, `facility_code`) VALUES (1, 'Boardband')
INSERT INTO `Guests` (`guest_id`, `gender_code`, `guest_first_name`, `guest_last_name`, `date_of_birth`) VALUES (1, 'Male', 'Kip', 'DuBuque', '1995-11-04 07:09:57')
INSERT INTO `Apartment_Bookings` (`apt_booking_id`, `apt_id`, `guest_id`, `booking_status_code`, `booking_start_date`, `booking_end_date`) VALUES (258, 10, 2, 'Provisional', '2016-09-26 17:13:49', '2017-10-07 11:38:48')
INSERT INTO `View_Unit_Status` (`apt_id`, `apt_booking_id`, `status_date`, `available_yn`) VALUES (11, 920, '1970-09-28 10:24:29', '1') |
apartment_rentals | SELECT gender_code , COUNT(*) FROM Guests GROUP BY gender_code ORDER BY COUNT(*) DESC | Show each gender code and the corresponding count of guests sorted by the count in descending order. | CREATE TABLE Apartment_Buildings (
building_id INTEGER NOT NULL,
building_short_name CHAR(15),
building_full_name VARCHAR(80),
building_description VARCHAR(255),
building_address VARCHAR(255),
building_manager VARCHAR(50),
building_phone VARCHAR(80),
PRIMARY KEY (building_id),
UNIQUE (building_id)
);
CREATE TABLE Apartments (
apt_id INTEGER NOT NULL ,
building_id INTEGER NOT NULL,
apt_type_code CHAR(15),
apt_number CHAR(10),
bathroom_count INTEGER,
bedroom_count INTEGER,
room_count CHAR(5),
PRIMARY KEY (apt_id),
UNIQUE (apt_id),
FOREIGN KEY (building_id) REFERENCES Apartment_Buildings (building_id)
);
CREATE TABLE Apartment_Facilities (
apt_id INTEGER NOT NULL,
facility_code CHAR(15) NOT NULL,
PRIMARY KEY (apt_id, facility_code),
FOREIGN KEY (apt_id) REFERENCES Apartments (apt_id)
);
CREATE TABLE Guests (
guest_id INTEGER NOT NULL ,
gender_code CHAR(1),
guest_first_name VARCHAR(80),
guest_last_name VARCHAR(80),
date_of_birth DATETIME,
PRIMARY KEY (guest_id),
UNIQUE (guest_id)
);
CREATE TABLE Apartment_Bookings (
apt_booking_id INTEGER NOT NULL,
apt_id INTEGER,
guest_id INTEGER NOT NULL,
booking_status_code CHAR(15) NOT NULL,
booking_start_date DATETIME,
booking_end_date DATETIME,
PRIMARY KEY (apt_booking_id),
UNIQUE (apt_booking_id),
FOREIGN KEY (apt_id) REFERENCES Apartments (apt_id),
FOREIGN KEY (guest_id) REFERENCES Guests (guest_id)
);
CREATE TABLE View_Unit_Status (
apt_id INTEGER,
apt_booking_id INTEGER,
status_date DATETIME NOT NULL,
available_yn BIT,
PRIMARY KEY (status_date),
FOREIGN KEY (apt_id) REFERENCES Apartments (apt_id),
FOREIGN KEY (apt_booking_id) REFERENCES Apartment_Bookings (apt_booking_id)
);
INSERT INTO `Apartment_Buildings` (`building_id`, `building_short_name`, `building_full_name`, `building_description`, `building_address`, `building_manager`, `building_phone`) VALUES (133, 'Normandie Court', 'Normandie Court', 'Studio', '7950 Casper Vista Apt. 176
INSERT INTO `Apartments` (`apt_id`, `building_id`, `apt_type_code`, `apt_number`, `bathroom_count`, `bedroom_count`, `room_count`) VALUES (1, 808, 'Flat', 'Suite 645', 1, 3, '7')
INSERT INTO `Apartment_Facilities` (`apt_id`, `facility_code`) VALUES (1, 'Boardband')
INSERT INTO `Guests` (`guest_id`, `gender_code`, `guest_first_name`, `guest_last_name`, `date_of_birth`) VALUES (1, 'Male', 'Kip', 'DuBuque', '1995-11-04 07:09:57')
INSERT INTO `Apartment_Bookings` (`apt_booking_id`, `apt_id`, `guest_id`, `booking_status_code`, `booking_start_date`, `booking_end_date`) VALUES (258, 10, 2, 'Provisional', '2016-09-26 17:13:49', '2017-10-07 11:38:48')
INSERT INTO `View_Unit_Status` (`apt_id`, `apt_booking_id`, `status_date`, `available_yn`) VALUES (11, 920, '1970-09-28 10:24:29', '1') |
apartment_rentals | SELECT gender_code , COUNT(*) FROM Guests GROUP BY gender_code ORDER BY COUNT(*) DESC | Sort the gender codes in descending order of their corresponding number of guests. Return both the gender codes and counts. | CREATE TABLE Apartment_Buildings (
building_id INTEGER NOT NULL,
building_short_name CHAR(15),
building_full_name VARCHAR(80),
building_description VARCHAR(255),
building_address VARCHAR(255),
building_manager VARCHAR(50),
building_phone VARCHAR(80),
PRIMARY KEY (building_id),
UNIQUE (building_id)
);
CREATE TABLE Apartments (
apt_id INTEGER NOT NULL ,
building_id INTEGER NOT NULL,
apt_type_code CHAR(15),
apt_number CHAR(10),
bathroom_count INTEGER,
bedroom_count INTEGER,
room_count CHAR(5),
PRIMARY KEY (apt_id),
UNIQUE (apt_id),
FOREIGN KEY (building_id) REFERENCES Apartment_Buildings (building_id)
);
CREATE TABLE Apartment_Facilities (
apt_id INTEGER NOT NULL,
facility_code CHAR(15) NOT NULL,
PRIMARY KEY (apt_id, facility_code),
FOREIGN KEY (apt_id) REFERENCES Apartments (apt_id)
);
CREATE TABLE Guests (
guest_id INTEGER NOT NULL ,
gender_code CHAR(1),
guest_first_name VARCHAR(80),
guest_last_name VARCHAR(80),
date_of_birth DATETIME,
PRIMARY KEY (guest_id),
UNIQUE (guest_id)
);
CREATE TABLE Apartment_Bookings (
apt_booking_id INTEGER NOT NULL,
apt_id INTEGER,
guest_id INTEGER NOT NULL,
booking_status_code CHAR(15) NOT NULL,
booking_start_date DATETIME,
booking_end_date DATETIME,
PRIMARY KEY (apt_booking_id),
UNIQUE (apt_booking_id),
FOREIGN KEY (apt_id) REFERENCES Apartments (apt_id),
FOREIGN KEY (guest_id) REFERENCES Guests (guest_id)
);
CREATE TABLE View_Unit_Status (
apt_id INTEGER,
apt_booking_id INTEGER,
status_date DATETIME NOT NULL,
available_yn BIT,
PRIMARY KEY (status_date),
FOREIGN KEY (apt_id) REFERENCES Apartments (apt_id),
FOREIGN KEY (apt_booking_id) REFERENCES Apartment_Bookings (apt_booking_id)
);
INSERT INTO `Apartment_Buildings` (`building_id`, `building_short_name`, `building_full_name`, `building_description`, `building_address`, `building_manager`, `building_phone`) VALUES (133, 'Normandie Court', 'Normandie Court', 'Studio', '7950 Casper Vista Apt. 176
INSERT INTO `Apartments` (`apt_id`, `building_id`, `apt_type_code`, `apt_number`, `bathroom_count`, `bedroom_count`, `room_count`) VALUES (1, 808, 'Flat', 'Suite 645', 1, 3, '7')
INSERT INTO `Apartment_Facilities` (`apt_id`, `facility_code`) VALUES (1, 'Boardband')
INSERT INTO `Guests` (`guest_id`, `gender_code`, `guest_first_name`, `guest_last_name`, `date_of_birth`) VALUES (1, 'Male', 'Kip', 'DuBuque', '1995-11-04 07:09:57')
INSERT INTO `Apartment_Bookings` (`apt_booking_id`, `apt_id`, `guest_id`, `booking_status_code`, `booking_start_date`, `booking_end_date`) VALUES (258, 10, 2, 'Provisional', '2016-09-26 17:13:49', '2017-10-07 11:38:48')
INSERT INTO `View_Unit_Status` (`apt_id`, `apt_booking_id`, `status_date`, `available_yn`) VALUES (11, 920, '1970-09-28 10:24:29', '1') |
apartment_rentals | SELECT count(*) FROM Apartments WHERE apt_id NOT IN (SELECT apt_id FROM Apartment_Facilities) | How many apartments do not have any facility? | CREATE TABLE Apartment_Buildings (
building_id INTEGER NOT NULL,
building_short_name CHAR(15),
building_full_name VARCHAR(80),
building_description VARCHAR(255),
building_address VARCHAR(255),
building_manager VARCHAR(50),
building_phone VARCHAR(80),
PRIMARY KEY (building_id),
UNIQUE (building_id)
);
CREATE TABLE Apartments (
apt_id INTEGER NOT NULL ,
building_id INTEGER NOT NULL,
apt_type_code CHAR(15),
apt_number CHAR(10),
bathroom_count INTEGER,
bedroom_count INTEGER,
room_count CHAR(5),
PRIMARY KEY (apt_id),
UNIQUE (apt_id),
FOREIGN KEY (building_id) REFERENCES Apartment_Buildings (building_id)
);
CREATE TABLE Apartment_Facilities (
apt_id INTEGER NOT NULL,
facility_code CHAR(15) NOT NULL,
PRIMARY KEY (apt_id, facility_code),
FOREIGN KEY (apt_id) REFERENCES Apartments (apt_id)
);
CREATE TABLE Guests (
guest_id INTEGER NOT NULL ,
gender_code CHAR(1),
guest_first_name VARCHAR(80),
guest_last_name VARCHAR(80),
date_of_birth DATETIME,
PRIMARY KEY (guest_id),
UNIQUE (guest_id)
);
CREATE TABLE Apartment_Bookings (
apt_booking_id INTEGER NOT NULL,
apt_id INTEGER,
guest_id INTEGER NOT NULL,
booking_status_code CHAR(15) NOT NULL,
booking_start_date DATETIME,
booking_end_date DATETIME,
PRIMARY KEY (apt_booking_id),
UNIQUE (apt_booking_id),
FOREIGN KEY (apt_id) REFERENCES Apartments (apt_id),
FOREIGN KEY (guest_id) REFERENCES Guests (guest_id)
);
CREATE TABLE View_Unit_Status (
apt_id INTEGER,
apt_booking_id INTEGER,
status_date DATETIME NOT NULL,
available_yn BIT,
PRIMARY KEY (status_date),
FOREIGN KEY (apt_id) REFERENCES Apartments (apt_id),
FOREIGN KEY (apt_booking_id) REFERENCES Apartment_Bookings (apt_booking_id)
);
INSERT INTO `Apartment_Buildings` (`building_id`, `building_short_name`, `building_full_name`, `building_description`, `building_address`, `building_manager`, `building_phone`) VALUES (133, 'Normandie Court', 'Normandie Court', 'Studio', '7950 Casper Vista Apt. 176
INSERT INTO `Apartments` (`apt_id`, `building_id`, `apt_type_code`, `apt_number`, `bathroom_count`, `bedroom_count`, `room_count`) VALUES (1, 808, 'Flat', 'Suite 645', 1, 3, '7')
INSERT INTO `Apartment_Facilities` (`apt_id`, `facility_code`) VALUES (1, 'Boardband')
INSERT INTO `Guests` (`guest_id`, `gender_code`, `guest_first_name`, `guest_last_name`, `date_of_birth`) VALUES (1, 'Male', 'Kip', 'DuBuque', '1995-11-04 07:09:57')
INSERT INTO `Apartment_Bookings` (`apt_booking_id`, `apt_id`, `guest_id`, `booking_status_code`, `booking_start_date`, `booking_end_date`) VALUES (258, 10, 2, 'Provisional', '2016-09-26 17:13:49', '2017-10-07 11:38:48')
INSERT INTO `View_Unit_Status` (`apt_id`, `apt_booking_id`, `status_date`, `available_yn`) VALUES (11, 920, '1970-09-28 10:24:29', '1') |
apartment_rentals | SELECT count(*) FROM Apartments WHERE apt_id NOT IN (SELECT apt_id FROM Apartment_Facilities) | Find the number of apartments that have no facility. | CREATE TABLE Apartment_Buildings (
building_id INTEGER NOT NULL,
building_short_name CHAR(15),
building_full_name VARCHAR(80),
building_description VARCHAR(255),
building_address VARCHAR(255),
building_manager VARCHAR(50),
building_phone VARCHAR(80),
PRIMARY KEY (building_id),
UNIQUE (building_id)
);
CREATE TABLE Apartments (
apt_id INTEGER NOT NULL ,
building_id INTEGER NOT NULL,
apt_type_code CHAR(15),
apt_number CHAR(10),
bathroom_count INTEGER,
bedroom_count INTEGER,
room_count CHAR(5),
PRIMARY KEY (apt_id),
UNIQUE (apt_id),
FOREIGN KEY (building_id) REFERENCES Apartment_Buildings (building_id)
);
CREATE TABLE Apartment_Facilities (
apt_id INTEGER NOT NULL,
facility_code CHAR(15) NOT NULL,
PRIMARY KEY (apt_id, facility_code),
FOREIGN KEY (apt_id) REFERENCES Apartments (apt_id)
);
CREATE TABLE Guests (
guest_id INTEGER NOT NULL ,
gender_code CHAR(1),
guest_first_name VARCHAR(80),
guest_last_name VARCHAR(80),
date_of_birth DATETIME,
PRIMARY KEY (guest_id),
UNIQUE (guest_id)
);
CREATE TABLE Apartment_Bookings (
apt_booking_id INTEGER NOT NULL,
apt_id INTEGER,
guest_id INTEGER NOT NULL,
booking_status_code CHAR(15) NOT NULL,
booking_start_date DATETIME,
booking_end_date DATETIME,
PRIMARY KEY (apt_booking_id),
UNIQUE (apt_booking_id),
FOREIGN KEY (apt_id) REFERENCES Apartments (apt_id),
FOREIGN KEY (guest_id) REFERENCES Guests (guest_id)
);
CREATE TABLE View_Unit_Status (
apt_id INTEGER,
apt_booking_id INTEGER,
status_date DATETIME NOT NULL,
available_yn BIT,
PRIMARY KEY (status_date),
FOREIGN KEY (apt_id) REFERENCES Apartments (apt_id),
FOREIGN KEY (apt_booking_id) REFERENCES Apartment_Bookings (apt_booking_id)
);
INSERT INTO `Apartment_Buildings` (`building_id`, `building_short_name`, `building_full_name`, `building_description`, `building_address`, `building_manager`, `building_phone`) VALUES (133, 'Normandie Court', 'Normandie Court', 'Studio', '7950 Casper Vista Apt. 176
INSERT INTO `Apartments` (`apt_id`, `building_id`, `apt_type_code`, `apt_number`, `bathroom_count`, `bedroom_count`, `room_count`) VALUES (1, 808, 'Flat', 'Suite 645', 1, 3, '7')
INSERT INTO `Apartment_Facilities` (`apt_id`, `facility_code`) VALUES (1, 'Boardband')
INSERT INTO `Guests` (`guest_id`, `gender_code`, `guest_first_name`, `guest_last_name`, `date_of_birth`) VALUES (1, 'Male', 'Kip', 'DuBuque', '1995-11-04 07:09:57')
INSERT INTO `Apartment_Bookings` (`apt_booking_id`, `apt_id`, `guest_id`, `booking_status_code`, `booking_start_date`, `booking_end_date`) VALUES (258, 10, 2, 'Provisional', '2016-09-26 17:13:49', '2017-10-07 11:38:48')
INSERT INTO `View_Unit_Status` (`apt_id`, `apt_booking_id`, `status_date`, `available_yn`) VALUES (11, 920, '1970-09-28 10:24:29', '1') |
apartment_rentals | 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" | Show the apartment numbers of apartments with bookings that have status code both "Provisional" and "Confirmed" | CREATE TABLE Apartment_Buildings (
building_id INTEGER NOT NULL,
building_short_name CHAR(15),
building_full_name VARCHAR(80),
building_description VARCHAR(255),
building_address VARCHAR(255),
building_manager VARCHAR(50),
building_phone VARCHAR(80),
PRIMARY KEY (building_id),
UNIQUE (building_id)
);
CREATE TABLE Apartments (
apt_id INTEGER NOT NULL ,
building_id INTEGER NOT NULL,
apt_type_code CHAR(15),
apt_number CHAR(10),
bathroom_count INTEGER,
bedroom_count INTEGER,
room_count CHAR(5),
PRIMARY KEY (apt_id),
UNIQUE (apt_id),
FOREIGN KEY (building_id) REFERENCES Apartment_Buildings (building_id)
);
CREATE TABLE Apartment_Facilities (
apt_id INTEGER NOT NULL,
facility_code CHAR(15) NOT NULL,
PRIMARY KEY (apt_id, facility_code),
FOREIGN KEY (apt_id) REFERENCES Apartments (apt_id)
);
CREATE TABLE Guests (
guest_id INTEGER NOT NULL ,
gender_code CHAR(1),
guest_first_name VARCHAR(80),
guest_last_name VARCHAR(80),
date_of_birth DATETIME,
PRIMARY KEY (guest_id),
UNIQUE (guest_id)
);
CREATE TABLE Apartment_Bookings (
apt_booking_id INTEGER NOT NULL,
apt_id INTEGER,
guest_id INTEGER NOT NULL,
booking_status_code CHAR(15) NOT NULL,
booking_start_date DATETIME,
booking_end_date DATETIME,
PRIMARY KEY (apt_booking_id),
UNIQUE (apt_booking_id),
FOREIGN KEY (apt_id) REFERENCES Apartments (apt_id),
FOREIGN KEY (guest_id) REFERENCES Guests (guest_id)
);
CREATE TABLE View_Unit_Status (
apt_id INTEGER,
apt_booking_id INTEGER,
status_date DATETIME NOT NULL,
available_yn BIT,
PRIMARY KEY (status_date),
FOREIGN KEY (apt_id) REFERENCES Apartments (apt_id),
FOREIGN KEY (apt_booking_id) REFERENCES Apartment_Bookings (apt_booking_id)
);
INSERT INTO `Apartment_Buildings` (`building_id`, `building_short_name`, `building_full_name`, `building_description`, `building_address`, `building_manager`, `building_phone`) VALUES (133, 'Normandie Court', 'Normandie Court', 'Studio', '7950 Casper Vista Apt. 176
INSERT INTO `Apartments` (`apt_id`, `building_id`, `apt_type_code`, `apt_number`, `bathroom_count`, `bedroom_count`, `room_count`) VALUES (1, 808, 'Flat', 'Suite 645', 1, 3, '7')
INSERT INTO `Apartment_Facilities` (`apt_id`, `facility_code`) VALUES (1, 'Boardband')
INSERT INTO `Guests` (`guest_id`, `gender_code`, `guest_first_name`, `guest_last_name`, `date_of_birth`) VALUES (1, 'Male', 'Kip', 'DuBuque', '1995-11-04 07:09:57')
INSERT INTO `Apartment_Bookings` (`apt_booking_id`, `apt_id`, `guest_id`, `booking_status_code`, `booking_start_date`, `booking_end_date`) VALUES (258, 10, 2, 'Provisional', '2016-09-26 17:13:49', '2017-10-07 11:38:48')
INSERT INTO `View_Unit_Status` (`apt_id`, `apt_booking_id`, `status_date`, `available_yn`) VALUES (11, 920, '1970-09-28 10:24:29', '1') |
apartment_rentals | 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" | Which apartments have bookings with both status codes "Provisional" and "Confirmed"? Give me the apartment numbers. | CREATE TABLE Apartment_Buildings (
building_id INTEGER NOT NULL,
building_short_name CHAR(15),
building_full_name VARCHAR(80),
building_description VARCHAR(255),
building_address VARCHAR(255),
building_manager VARCHAR(50),
building_phone VARCHAR(80),
PRIMARY KEY (building_id),
UNIQUE (building_id)
);
CREATE TABLE Apartments (
apt_id INTEGER NOT NULL ,
building_id INTEGER NOT NULL,
apt_type_code CHAR(15),
apt_number CHAR(10),
bathroom_count INTEGER,
bedroom_count INTEGER,
room_count CHAR(5),
PRIMARY KEY (apt_id),
UNIQUE (apt_id),
FOREIGN KEY (building_id) REFERENCES Apartment_Buildings (building_id)
);
CREATE TABLE Apartment_Facilities (
apt_id INTEGER NOT NULL,
facility_code CHAR(15) NOT NULL,
PRIMARY KEY (apt_id, facility_code),
FOREIGN KEY (apt_id) REFERENCES Apartments (apt_id)
);
CREATE TABLE Guests (
guest_id INTEGER NOT NULL ,
gender_code CHAR(1),
guest_first_name VARCHAR(80),
guest_last_name VARCHAR(80),
date_of_birth DATETIME,
PRIMARY KEY (guest_id),
UNIQUE (guest_id)
);
CREATE TABLE Apartment_Bookings (
apt_booking_id INTEGER NOT NULL,
apt_id INTEGER,
guest_id INTEGER NOT NULL,
booking_status_code CHAR(15) NOT NULL,
booking_start_date DATETIME,
booking_end_date DATETIME,
PRIMARY KEY (apt_booking_id),
UNIQUE (apt_booking_id),
FOREIGN KEY (apt_id) REFERENCES Apartments (apt_id),
FOREIGN KEY (guest_id) REFERENCES Guests (guest_id)
);
CREATE TABLE View_Unit_Status (
apt_id INTEGER,
apt_booking_id INTEGER,
status_date DATETIME NOT NULL,
available_yn BIT,
PRIMARY KEY (status_date),
FOREIGN KEY (apt_id) REFERENCES Apartments (apt_id),
FOREIGN KEY (apt_booking_id) REFERENCES Apartment_Bookings (apt_booking_id)
);
INSERT INTO `Apartment_Buildings` (`building_id`, `building_short_name`, `building_full_name`, `building_description`, `building_address`, `building_manager`, `building_phone`) VALUES (133, 'Normandie Court', 'Normandie Court', 'Studio', '7950 Casper Vista Apt. 176
INSERT INTO `Apartments` (`apt_id`, `building_id`, `apt_type_code`, `apt_number`, `bathroom_count`, `bedroom_count`, `room_count`) VALUES (1, 808, 'Flat', 'Suite 645', 1, 3, '7')
INSERT INTO `Apartment_Facilities` (`apt_id`, `facility_code`) VALUES (1, 'Boardband')
INSERT INTO `Guests` (`guest_id`, `gender_code`, `guest_first_name`, `guest_last_name`, `date_of_birth`) VALUES (1, 'Male', 'Kip', 'DuBuque', '1995-11-04 07:09:57')
INSERT INTO `Apartment_Bookings` (`apt_booking_id`, `apt_id`, `guest_id`, `booking_status_code`, `booking_start_date`, `booking_end_date`) VALUES (258, 10, 2, 'Provisional', '2016-09-26 17:13:49', '2017-10-07 11:38:48')
INSERT INTO `View_Unit_Status` (`apt_id`, `apt_booking_id`, `status_date`, `available_yn`) VALUES (11, 920, '1970-09-28 10:24:29', '1') |
apartment_rentals | 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 | Show the apartment numbers of apartments with unit status availability of both 0 and 1. | CREATE TABLE Apartment_Buildings (
building_id INTEGER NOT NULL,
building_short_name CHAR(15),
building_full_name VARCHAR(80),
building_description VARCHAR(255),
building_address VARCHAR(255),
building_manager VARCHAR(50),
building_phone VARCHAR(80),
PRIMARY KEY (building_id),
UNIQUE (building_id)
);
CREATE TABLE Apartments (
apt_id INTEGER NOT NULL ,
building_id INTEGER NOT NULL,
apt_type_code CHAR(15),
apt_number CHAR(10),
bathroom_count INTEGER,
bedroom_count INTEGER,
room_count CHAR(5),
PRIMARY KEY (apt_id),
UNIQUE (apt_id),
FOREIGN KEY (building_id) REFERENCES Apartment_Buildings (building_id)
);
CREATE TABLE Apartment_Facilities (
apt_id INTEGER NOT NULL,
facility_code CHAR(15) NOT NULL,
PRIMARY KEY (apt_id, facility_code),
FOREIGN KEY (apt_id) REFERENCES Apartments (apt_id)
);
CREATE TABLE Guests (
guest_id INTEGER NOT NULL ,
gender_code CHAR(1),
guest_first_name VARCHAR(80),
guest_last_name VARCHAR(80),
date_of_birth DATETIME,
PRIMARY KEY (guest_id),
UNIQUE (guest_id)
);
CREATE TABLE Apartment_Bookings (
apt_booking_id INTEGER NOT NULL,
apt_id INTEGER,
guest_id INTEGER NOT NULL,
booking_status_code CHAR(15) NOT NULL,
booking_start_date DATETIME,
booking_end_date DATETIME,
PRIMARY KEY (apt_booking_id),
UNIQUE (apt_booking_id),
FOREIGN KEY (apt_id) REFERENCES Apartments (apt_id),
FOREIGN KEY (guest_id) REFERENCES Guests (guest_id)
);
CREATE TABLE View_Unit_Status (
apt_id INTEGER,
apt_booking_id INTEGER,
status_date DATETIME NOT NULL,
available_yn BIT,
PRIMARY KEY (status_date),
FOREIGN KEY (apt_id) REFERENCES Apartments (apt_id),
FOREIGN KEY (apt_booking_id) REFERENCES Apartment_Bookings (apt_booking_id)
);
INSERT INTO `Apartment_Buildings` (`building_id`, `building_short_name`, `building_full_name`, `building_description`, `building_address`, `building_manager`, `building_phone`) VALUES (133, 'Normandie Court', 'Normandie Court', 'Studio', '7950 Casper Vista Apt. 176
INSERT INTO `Apartments` (`apt_id`, `building_id`, `apt_type_code`, `apt_number`, `bathroom_count`, `bedroom_count`, `room_count`) VALUES (1, 808, 'Flat', 'Suite 645', 1, 3, '7')
INSERT INTO `Apartment_Facilities` (`apt_id`, `facility_code`) VALUES (1, 'Boardband')
INSERT INTO `Guests` (`guest_id`, `gender_code`, `guest_first_name`, `guest_last_name`, `date_of_birth`) VALUES (1, 'Male', 'Kip', 'DuBuque', '1995-11-04 07:09:57')
INSERT INTO `Apartment_Bookings` (`apt_booking_id`, `apt_id`, `guest_id`, `booking_status_code`, `booking_start_date`, `booking_end_date`) VALUES (258, 10, 2, 'Provisional', '2016-09-26 17:13:49', '2017-10-07 11:38:48')
INSERT INTO `View_Unit_Status` (`apt_id`, `apt_booking_id`, `status_date`, `available_yn`) VALUES (11, 920, '1970-09-28 10:24:29', '1') |
apartment_rentals | 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 | Which apartments have unit status availability of both 0 and 1? Return their apartment numbers. | CREATE TABLE Apartment_Buildings (
building_id INTEGER NOT NULL,
building_short_name CHAR(15),
building_full_name VARCHAR(80),
building_description VARCHAR(255),
building_address VARCHAR(255),
building_manager VARCHAR(50),
building_phone VARCHAR(80),
PRIMARY KEY (building_id),
UNIQUE (building_id)
);
CREATE TABLE Apartments (
apt_id INTEGER NOT NULL ,
building_id INTEGER NOT NULL,
apt_type_code CHAR(15),
apt_number CHAR(10),
bathroom_count INTEGER,
bedroom_count INTEGER,
room_count CHAR(5),
PRIMARY KEY (apt_id),
UNIQUE (apt_id),
FOREIGN KEY (building_id) REFERENCES Apartment_Buildings (building_id)
);
CREATE TABLE Apartment_Facilities (
apt_id INTEGER NOT NULL,
facility_code CHAR(15) NOT NULL,
PRIMARY KEY (apt_id, facility_code),
FOREIGN KEY (apt_id) REFERENCES Apartments (apt_id)
);
CREATE TABLE Guests (
guest_id INTEGER NOT NULL ,
gender_code CHAR(1),
guest_first_name VARCHAR(80),
guest_last_name VARCHAR(80),
date_of_birth DATETIME,
PRIMARY KEY (guest_id),
UNIQUE (guest_id)
);
CREATE TABLE Apartment_Bookings (
apt_booking_id INTEGER NOT NULL,
apt_id INTEGER,
guest_id INTEGER NOT NULL,
booking_status_code CHAR(15) NOT NULL,
booking_start_date DATETIME,
booking_end_date DATETIME,
PRIMARY KEY (apt_booking_id),
UNIQUE (apt_booking_id),
FOREIGN KEY (apt_id) REFERENCES Apartments (apt_id),
FOREIGN KEY (guest_id) REFERENCES Guests (guest_id)
);
CREATE TABLE View_Unit_Status (
apt_id INTEGER,
apt_booking_id INTEGER,
status_date DATETIME NOT NULL,
available_yn BIT,
PRIMARY KEY (status_date),
FOREIGN KEY (apt_id) REFERENCES Apartments (apt_id),
FOREIGN KEY (apt_booking_id) REFERENCES Apartment_Bookings (apt_booking_id)
);
INSERT INTO `Apartment_Buildings` (`building_id`, `building_short_name`, `building_full_name`, `building_description`, `building_address`, `building_manager`, `building_phone`) VALUES (133, 'Normandie Court', 'Normandie Court', 'Studio', '7950 Casper Vista Apt. 176
INSERT INTO `Apartments` (`apt_id`, `building_id`, `apt_type_code`, `apt_number`, `bathroom_count`, `bedroom_count`, `room_count`) VALUES (1, 808, 'Flat', 'Suite 645', 1, 3, '7')
INSERT INTO `Apartment_Facilities` (`apt_id`, `facility_code`) VALUES (1, 'Boardband')
INSERT INTO `Guests` (`guest_id`, `gender_code`, `guest_first_name`, `guest_last_name`, `date_of_birth`) VALUES (1, 'Male', 'Kip', 'DuBuque', '1995-11-04 07:09:57')
INSERT INTO `Apartment_Bookings` (`apt_booking_id`, `apt_id`, `guest_id`, `booking_status_code`, `booking_start_date`, `booking_end_date`) VALUES (258, 10, 2, 'Provisional', '2016-09-26 17:13:49', '2017-10-07 11:38:48')
INSERT INTO `View_Unit_Status` (`apt_id`, `apt_booking_id`, `status_date`, `available_yn`) VALUES (11, 920, '1970-09-28 10:24:29', '1') |
game_injury | SELECT count(*) FROM game WHERE season > 2007 | How many games are held after season 2007? | CREATE TABLE "stadium" (
"id" int,
"name" text,
"Home_Games" int,
"Average_Attendance" real,
"Total_Attendance" real,
"Capacity_Percentage" real,
primary key ("id")
);
CREATE TABLE "game" (
"stadium_id" int,
"id" int,
"Season" int,
"Date" text,
"Home_team" text,
"Away_team" text,
"Score" text,
"Competition" text,
primary key ("id"),
foreign key ("stadium_id") references `stadium`("id")
);
CREATE TABLE "injury_accident" (
"game_id" int,
"id" int,
"Player" text,
"Injury" text,
"Number_of_matches" text,
"Source" text,
primary key ("id"),
foreign key ("game_id") references `game`("id")
);
INSERT INTO "stadium" VALUES (1,"Cowboys Stadium","8","87047","696377","108.8");
INSERT INTO "game" VALUES (1,1,"2007","18 May 2007","Quruvchi","Pakhtakor","1–1","League");
INSERT INTO "injury_accident" VALUES (1,1,"Davide Santon","Clean-up surgery on his right knee","12","inter.it"); |
game_injury | SELECT Date FROM game ORDER BY home_team DESC | List the dates of games by the home team name in descending order. | CREATE TABLE "stadium" (
"id" int,
"name" text,
"Home_Games" int,
"Average_Attendance" real,
"Total_Attendance" real,
"Capacity_Percentage" real,
primary key ("id")
);
CREATE TABLE "game" (
"stadium_id" int,
"id" int,
"Season" int,
"Date" text,
"Home_team" text,
"Away_team" text,
"Score" text,
"Competition" text,
primary key ("id"),
foreign key ("stadium_id") references `stadium`("id")
);
CREATE TABLE "injury_accident" (
"game_id" int,
"id" int,
"Player" text,
"Injury" text,
"Number_of_matches" text,
"Source" text,
primary key ("id"),
foreign key ("game_id") references `game`("id")
);
INSERT INTO "stadium" VALUES (1,"Cowboys Stadium","8","87047","696377","108.8");
INSERT INTO "game" VALUES (1,1,"2007","18 May 2007","Quruvchi","Pakhtakor","1–1","League");
INSERT INTO "injury_accident" VALUES (1,1,"Davide Santon","Clean-up surgery on his right knee","12","inter.it"); |
game_injury | SELECT season , home_team , away_team FROM game | List the season, home team, away team of all the games. | CREATE TABLE "stadium" (
"id" int,
"name" text,
"Home_Games" int,
"Average_Attendance" real,
"Total_Attendance" real,
"Capacity_Percentage" real,
primary key ("id")
);
CREATE TABLE "game" (
"stadium_id" int,
"id" int,
"Season" int,
"Date" text,
"Home_team" text,
"Away_team" text,
"Score" text,
"Competition" text,
primary key ("id"),
foreign key ("stadium_id") references `stadium`("id")
);
CREATE TABLE "injury_accident" (
"game_id" int,
"id" int,
"Player" text,
"Injury" text,
"Number_of_matches" text,
"Source" text,
primary key ("id"),
foreign key ("game_id") references `game`("id")
);
INSERT INTO "stadium" VALUES (1,"Cowboys Stadium","8","87047","696377","108.8");
INSERT INTO "game" VALUES (1,1,"2007","18 May 2007","Quruvchi","Pakhtakor","1–1","League");
INSERT INTO "injury_accident" VALUES (1,1,"Davide Santon","Clean-up surgery on his right knee","12","inter.it"); |
game_injury | SELECT max(home_games) , min(home_games) , avg(home_games) FROM stadium | What are the maximum, minimum and average home games each stadium held? | CREATE TABLE "stadium" (
"id" int,
"name" text,
"Home_Games" int,
"Average_Attendance" real,
"Total_Attendance" real,
"Capacity_Percentage" real,
primary key ("id")
);
CREATE TABLE "game" (
"stadium_id" int,
"id" int,
"Season" int,
"Date" text,
"Home_team" text,
"Away_team" text,
"Score" text,
"Competition" text,
primary key ("id"),
foreign key ("stadium_id") references `stadium`("id")
);
CREATE TABLE "injury_accident" (
"game_id" int,
"id" int,
"Player" text,
"Injury" text,
"Number_of_matches" text,
"Source" text,
primary key ("id"),
foreign key ("game_id") references `game`("id")
);
INSERT INTO "stadium" VALUES (1,"Cowboys Stadium","8","87047","696377","108.8");
INSERT INTO "game" VALUES (1,1,"2007","18 May 2007","Quruvchi","Pakhtakor","1–1","League");
INSERT INTO "injury_accident" VALUES (1,1,"Davide Santon","Clean-up surgery on his right knee","12","inter.it"); |
game_injury | SELECT average_attendance FROM stadium WHERE capacity_percentage > 100 | What is the average attendance of stadiums with capacity percentage higher than 100%? | CREATE TABLE "stadium" (
"id" int,
"name" text,
"Home_Games" int,
"Average_Attendance" real,
"Total_Attendance" real,
"Capacity_Percentage" real,
primary key ("id")
);
CREATE TABLE "game" (
"stadium_id" int,
"id" int,
"Season" int,
"Date" text,
"Home_team" text,
"Away_team" text,
"Score" text,
"Competition" text,
primary key ("id"),
foreign key ("stadium_id") references `stadium`("id")
);
CREATE TABLE "injury_accident" (
"game_id" int,
"id" int,
"Player" text,
"Injury" text,
"Number_of_matches" text,
"Source" text,
primary key ("id"),
foreign key ("game_id") references `game`("id")
);
INSERT INTO "stadium" VALUES (1,"Cowboys Stadium","8","87047","696377","108.8");
INSERT INTO "game" VALUES (1,1,"2007","18 May 2007","Quruvchi","Pakhtakor","1–1","League");
INSERT INTO "injury_accident" VALUES (1,1,"Davide Santon","Clean-up surgery on his right knee","12","inter.it"); |
game_injury | SELECT player , number_of_matches , SOURCE FROM injury_accident WHERE injury != 'Knee problem' | What are the player name, number of matches, and information source for players who do not suffer from injury of 'Knee problem'? | CREATE TABLE "stadium" (
"id" int,
"name" text,
"Home_Games" int,
"Average_Attendance" real,
"Total_Attendance" real,
"Capacity_Percentage" real,
primary key ("id")
);
CREATE TABLE "game" (
"stadium_id" int,
"id" int,
"Season" int,
"Date" text,
"Home_team" text,
"Away_team" text,
"Score" text,
"Competition" text,
primary key ("id"),
foreign key ("stadium_id") references `stadium`("id")
);
CREATE TABLE "injury_accident" (
"game_id" int,
"id" int,
"Player" text,
"Injury" text,
"Number_of_matches" text,
"Source" text,
primary key ("id"),
foreign key ("game_id") references `game`("id")
);
INSERT INTO "stadium" VALUES (1,"Cowboys Stadium","8","87047","696377","108.8");
INSERT INTO "game" VALUES (1,1,"2007","18 May 2007","Quruvchi","Pakhtakor","1–1","League");
INSERT INTO "injury_accident" VALUES (1,1,"Davide Santon","Clean-up surgery on his right knee","12","inter.it"); |
game_injury | SELECT T1.season FROM game AS T1 JOIN injury_accident AS T2 ON T1.id = T2.game_id WHERE T2.player = 'Walter Samuel' | What is the season of the game which causes the player 'Walter Samuel' to get injured? | CREATE TABLE "stadium" (
"id" int,
"name" text,
"Home_Games" int,
"Average_Attendance" real,
"Total_Attendance" real,
"Capacity_Percentage" real,
primary key ("id")
);
CREATE TABLE "game" (
"stadium_id" int,
"id" int,
"Season" int,
"Date" text,
"Home_team" text,
"Away_team" text,
"Score" text,
"Competition" text,
primary key ("id"),
foreign key ("stadium_id") references `stadium`("id")
);
CREATE TABLE "injury_accident" (
"game_id" int,
"id" int,
"Player" text,
"Injury" text,
"Number_of_matches" text,
"Source" text,
primary key ("id"),
foreign key ("game_id") references `game`("id")
);
INSERT INTO "stadium" VALUES (1,"Cowboys Stadium","8","87047","696377","108.8");
INSERT INTO "game" VALUES (1,1,"2007","18 May 2007","Quruvchi","Pakhtakor","1–1","League");
INSERT INTO "injury_accident" VALUES (1,1,"Davide Santon","Clean-up surgery on his right knee","12","inter.it"); |
game_injury | 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 | What are the ids, scores, and dates of the games which caused at least two injury accidents? | CREATE TABLE "stadium" (
"id" int,
"name" text,
"Home_Games" int,
"Average_Attendance" real,
"Total_Attendance" real,
"Capacity_Percentage" real,
primary key ("id")
);
CREATE TABLE "game" (
"stadium_id" int,
"id" int,
"Season" int,
"Date" text,
"Home_team" text,
"Away_team" text,
"Score" text,
"Competition" text,
primary key ("id"),
foreign key ("stadium_id") references `stadium`("id")
);
CREATE TABLE "injury_accident" (
"game_id" int,
"id" int,
"Player" text,
"Injury" text,
"Number_of_matches" text,
"Source" text,
primary key ("id"),
foreign key ("game_id") references `game`("id")
);
INSERT INTO "stadium" VALUES (1,"Cowboys Stadium","8","87047","696377","108.8");
INSERT INTO "game" VALUES (1,1,"2007","18 May 2007","Quruvchi","Pakhtakor","1–1","League");
INSERT INTO "injury_accident" VALUES (1,1,"Davide Santon","Clean-up surgery on his right knee","12","inter.it"); |
game_injury | 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 | What are the id and name of the stadium where the most injury accidents happened? | CREATE TABLE "stadium" (
"id" int,
"name" text,
"Home_Games" int,
"Average_Attendance" real,
"Total_Attendance" real,
"Capacity_Percentage" real,
primary key ("id")
);
CREATE TABLE "game" (
"stadium_id" int,
"id" int,
"Season" int,
"Date" text,
"Home_team" text,
"Away_team" text,
"Score" text,
"Competition" text,
primary key ("id"),
foreign key ("stadium_id") references `stadium`("id")
);
CREATE TABLE "injury_accident" (
"game_id" int,
"id" int,
"Player" text,
"Injury" text,
"Number_of_matches" text,
"Source" text,
primary key ("id"),
foreign key ("game_id") references `game`("id")
);
INSERT INTO "stadium" VALUES (1,"Cowboys Stadium","8","87047","696377","108.8");
INSERT INTO "game" VALUES (1,1,"2007","18 May 2007","Quruvchi","Pakhtakor","1–1","League");
INSERT INTO "injury_accident" VALUES (1,1,"Davide Santon","Clean-up surgery on his right knee","12","inter.it"); |
game_injury | 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 | Find the id and name of the stadium where the largest number of injury accidents occurred. | CREATE TABLE "stadium" (
"id" int,
"name" text,
"Home_Games" int,
"Average_Attendance" real,
"Total_Attendance" real,
"Capacity_Percentage" real,
primary key ("id")
);
CREATE TABLE "game" (
"stadium_id" int,
"id" int,
"Season" int,
"Date" text,
"Home_team" text,
"Away_team" text,
"Score" text,
"Competition" text,
primary key ("id"),
foreign key ("stadium_id") references `stadium`("id")
);
CREATE TABLE "injury_accident" (
"game_id" int,
"id" int,
"Player" text,
"Injury" text,
"Number_of_matches" text,
"Source" text,
primary key ("id"),
foreign key ("game_id") references `game`("id")
);
INSERT INTO "stadium" VALUES (1,"Cowboys Stadium","8","87047","696377","108.8");
INSERT INTO "game" VALUES (1,1,"2007","18 May 2007","Quruvchi","Pakhtakor","1–1","League");
INSERT INTO "injury_accident" VALUES (1,1,"Davide Santon","Clean-up surgery on his right knee","12","inter.it"); |
game_injury | 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' | In which season and which stadium did any player have an injury of 'Foot injury' or 'Knee problem'? | CREATE TABLE "stadium" (
"id" int,
"name" text,
"Home_Games" int,
"Average_Attendance" real,
"Total_Attendance" real,
"Capacity_Percentage" real,
primary key ("id")
);
CREATE TABLE "game" (
"stadium_id" int,
"id" int,
"Season" int,
"Date" text,
"Home_team" text,
"Away_team" text,
"Score" text,
"Competition" text,
primary key ("id"),
foreign key ("stadium_id") references `stadium`("id")
);
CREATE TABLE "injury_accident" (
"game_id" int,
"id" int,
"Player" text,
"Injury" text,
"Number_of_matches" text,
"Source" text,
primary key ("id"),
foreign key ("game_id") references `game`("id")
);
INSERT INTO "stadium" VALUES (1,"Cowboys Stadium","8","87047","696377","108.8");
INSERT INTO "game" VALUES (1,1,"2007","18 May 2007","Quruvchi","Pakhtakor","1–1","League");
INSERT INTO "injury_accident" VALUES (1,1,"Davide Santon","Clean-up surgery on his right knee","12","inter.it"); |
game_injury | SELECT count(DISTINCT SOURCE) FROM injury_accident | How many different kinds of information sources are there for injury accidents? | CREATE TABLE "stadium" (
"id" int,
"name" text,
"Home_Games" int,
"Average_Attendance" real,
"Total_Attendance" real,
"Capacity_Percentage" real,
primary key ("id")
);
CREATE TABLE "game" (
"stadium_id" int,
"id" int,
"Season" int,
"Date" text,
"Home_team" text,
"Away_team" text,
"Score" text,
"Competition" text,
primary key ("id"),
foreign key ("stadium_id") references `stadium`("id")
);
CREATE TABLE "injury_accident" (
"game_id" int,
"id" int,
"Player" text,
"Injury" text,
"Number_of_matches" text,
"Source" text,
primary key ("id"),
foreign key ("game_id") references `game`("id")
);
INSERT INTO "stadium" VALUES (1,"Cowboys Stadium","8","87047","696377","108.8");
INSERT INTO "game" VALUES (1,1,"2007","18 May 2007","Quruvchi","Pakhtakor","1–1","League");
INSERT INTO "injury_accident" VALUES (1,1,"Davide Santon","Clean-up surgery on his right knee","12","inter.it"); |
game_injury | SELECT count(*) FROM game WHERE id NOT IN ( SELECT game_id FROM injury_accident ) | How many games are free of injury accidents? | CREATE TABLE "stadium" (
"id" int,
"name" text,
"Home_Games" int,
"Average_Attendance" real,
"Total_Attendance" real,
"Capacity_Percentage" real,
primary key ("id")
);
CREATE TABLE "game" (
"stadium_id" int,
"id" int,
"Season" int,
"Date" text,
"Home_team" text,
"Away_team" text,
"Score" text,
"Competition" text,
primary key ("id"),
foreign key ("stadium_id") references `stadium`("id")
);
CREATE TABLE "injury_accident" (
"game_id" int,
"id" int,
"Player" text,
"Injury" text,
"Number_of_matches" text,
"Source" text,
primary key ("id"),
foreign key ("game_id") references `game`("id")
);
INSERT INTO "stadium" VALUES (1,"Cowboys Stadium","8","87047","696377","108.8");
INSERT INTO "game" VALUES (1,1,"2007","18 May 2007","Quruvchi","Pakhtakor","1–1","League");
INSERT INTO "injury_accident" VALUES (1,1,"Davide Santon","Clean-up surgery on his right knee","12","inter.it"); |
game_injury | SELECT count(DISTINCT T1.injury) FROM injury_accident AS T1 JOIN game AS T2 ON T1.game_id = T2.id WHERE T2.season > 2010 | How many distinct kinds of injuries happened after season 2010? | CREATE TABLE "stadium" (
"id" int,
"name" text,
"Home_Games" int,
"Average_Attendance" real,
"Total_Attendance" real,
"Capacity_Percentage" real,
primary key ("id")
);
CREATE TABLE "game" (
"stadium_id" int,
"id" int,
"Season" int,
"Date" text,
"Home_team" text,
"Away_team" text,
"Score" text,
"Competition" text,
primary key ("id"),
foreign key ("stadium_id") references `stadium`("id")
);
CREATE TABLE "injury_accident" (
"game_id" int,
"id" int,
"Player" text,
"Injury" text,
"Number_of_matches" text,
"Source" text,
primary key ("id"),
foreign key ("game_id") references `game`("id")
);
INSERT INTO "stadium" VALUES (1,"Cowboys Stadium","8","87047","696377","108.8");
INSERT INTO "game" VALUES (1,1,"2007","18 May 2007","Quruvchi","Pakhtakor","1–1","League");
INSERT INTO "injury_accident" VALUES (1,1,"Davide Santon","Clean-up surgery on his right knee","12","inter.it"); |
game_injury | 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' | List the name of the stadium where both the player 'Walter Samuel' and the player 'Thiago Motta' got injured. | CREATE TABLE "stadium" (
"id" int,
"name" text,
"Home_Games" int,
"Average_Attendance" real,
"Total_Attendance" real,
"Capacity_Percentage" real,
primary key ("id")
);
CREATE TABLE "game" (
"stadium_id" int,
"id" int,
"Season" int,
"Date" text,
"Home_team" text,
"Away_team" text,
"Score" text,
"Competition" text,
primary key ("id"),
foreign key ("stadium_id") references `stadium`("id")
);
CREATE TABLE "injury_accident" (
"game_id" int,
"id" int,
"Player" text,
"Injury" text,
"Number_of_matches" text,
"Source" text,
primary key ("id"),
foreign key ("game_id") references `game`("id")
);
INSERT INTO "stadium" VALUES (1,"Cowboys Stadium","8","87047","696377","108.8");
INSERT INTO "game" VALUES (1,1,"2007","18 May 2007","Quruvchi","Pakhtakor","1–1","League");
INSERT INTO "injury_accident" VALUES (1,1,"Davide Santon","Clean-up surgery on his right knee","12","inter.it"); |
game_injury | 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 | Show the name, average attendance, total attendance for stadiums where no accidents happened. | CREATE TABLE "stadium" (
"id" int,
"name" text,
"Home_Games" int,
"Average_Attendance" real,
"Total_Attendance" real,
"Capacity_Percentage" real,
primary key ("id")
);
CREATE TABLE "game" (
"stadium_id" int,
"id" int,
"Season" int,
"Date" text,
"Home_team" text,
"Away_team" text,
"Score" text,
"Competition" text,
primary key ("id"),
foreign key ("stadium_id") references `stadium`("id")
);
CREATE TABLE "injury_accident" (
"game_id" int,
"id" int,
"Player" text,
"Injury" text,
"Number_of_matches" text,
"Source" text,
primary key ("id"),
foreign key ("game_id") references `game`("id")
);
INSERT INTO "stadium" VALUES (1,"Cowboys Stadium","8","87047","696377","108.8");
INSERT INTO "game" VALUES (1,1,"2007","18 May 2007","Quruvchi","Pakhtakor","1–1","League");
INSERT INTO "injury_accident" VALUES (1,1,"Davide Santon","Clean-up surgery on his right knee","12","inter.it"); |
game_injury | SELECT name FROM stadium WHERE name LIKE "%Bank%" | Which stadium name contains the substring "Bank"? | CREATE TABLE "stadium" (
"id" int,
"name" text,
"Home_Games" int,
"Average_Attendance" real,
"Total_Attendance" real,
"Capacity_Percentage" real,
primary key ("id")
);
CREATE TABLE "game" (
"stadium_id" int,
"id" int,
"Season" int,
"Date" text,
"Home_team" text,
"Away_team" text,
"Score" text,
"Competition" text,
primary key ("id"),
foreign key ("stadium_id") references `stadium`("id")
);
CREATE TABLE "injury_accident" (
"game_id" int,
"id" int,
"Player" text,
"Injury" text,
"Number_of_matches" text,
"Source" text,
primary key ("id"),
foreign key ("game_id") references `game`("id")
);
INSERT INTO "stadium" VALUES (1,"Cowboys Stadium","8","87047","696377","108.8");
INSERT INTO "game" VALUES (1,1,"2007","18 May 2007","Quruvchi","Pakhtakor","1–1","League");
INSERT INTO "injury_accident" VALUES (1,1,"Davide Santon","Clean-up surgery on his right knee","12","inter.it"); |
game_injury | SELECT T1.id , count(*) FROM stadium AS T1 JOIN game AS T2 ON T1.id = T2.stadium_id GROUP BY T1.id | How many games has each stadium held? | CREATE TABLE "stadium" (
"id" int,
"name" text,
"Home_Games" int,
"Average_Attendance" real,
"Total_Attendance" real,
"Capacity_Percentage" real,
primary key ("id")
);
CREATE TABLE "game" (
"stadium_id" int,
"id" int,
"Season" int,
"Date" text,
"Home_team" text,
"Away_team" text,
"Score" text,
"Competition" text,
primary key ("id"),
foreign key ("stadium_id") references `stadium`("id")
);
CREATE TABLE "injury_accident" (
"game_id" int,
"id" int,
"Player" text,
"Injury" text,
"Number_of_matches" text,
"Source" text,
primary key ("id"),
foreign key ("game_id") references `game`("id")
);
INSERT INTO "stadium" VALUES (1,"Cowboys Stadium","8","87047","696377","108.8");
INSERT INTO "game" VALUES (1,1,"2007","18 May 2007","Quruvchi","Pakhtakor","1–1","League");
INSERT INTO "injury_accident" VALUES (1,1,"Davide Santon","Clean-up surgery on his right knee","12","inter.it"); |
game_injury | 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 | 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. | CREATE TABLE "stadium" (
"id" int,
"name" text,
"Home_Games" int,
"Average_Attendance" real,
"Total_Attendance" real,
"Capacity_Percentage" real,
primary key ("id")
);
CREATE TABLE "game" (
"stadium_id" int,
"id" int,
"Season" int,
"Date" text,
"Home_team" text,
"Away_team" text,
"Score" text,
"Competition" text,
primary key ("id"),
foreign key ("stadium_id") references `stadium`("id")
);
CREATE TABLE "injury_accident" (
"game_id" int,
"id" int,
"Player" text,
"Injury" text,
"Number_of_matches" text,
"Source" text,
primary key ("id"),
foreign key ("game_id") references `game`("id")
);
INSERT INTO "stadium" VALUES (1,"Cowboys Stadium","8","87047","696377","108.8");
INSERT INTO "game" VALUES (1,1,"2007","18 May 2007","Quruvchi","Pakhtakor","1–1","League");
INSERT INTO "injury_accident" VALUES (1,1,"Davide Santon","Clean-up surgery on his right knee","12","inter.it"); |
soccer_1 | SELECT T1.name , T2.name FROM Country AS T1 JOIN League AS T2 ON T1.id = T2.country_id | List all country and league names. | CREATE TABLE "Player_Attributes" (
`id` INTEGER PRIMARY KEY AUTOINCREMENT,
`player_fifa_api_id` INTEGER,
`player_api_id` INTEGER,
`date` TEXT,
`overall_rating` INTEGER,
`potential` INTEGER,
`preferred_foot` TEXT,
`attacking_work_rate` TEXT,
`defensive_work_rate` TEXT,
`crossing` INTEGER,
`finishing` INTEGER,
`heading_accuracy` INTEGER,
`short_passing` INTEGER,
`volleys` INTEGER,
`dribbling` INTEGER,
`curve` INTEGER,
`free_kick_accuracy` INTEGER,
`long_passing` INTEGER,
`ball_control` INTEGER,
`acceleration` INTEGER,
`sprint_speed` INTEGER,
`agility` INTEGER,
`reactions` INTEGER,
`balance` INTEGER,
`shot_power` INTEGER,
`jumping` INTEGER,
`stamina` INTEGER,
`strength` INTEGER,
`long_shots` INTEGER,
`aggression` INTEGER,
`interceptions` INTEGER,
`positioning` INTEGER,
`vision` INTEGER,
`penalties` INTEGER,
`marking` INTEGER,
`standing_tackle` INTEGER,
`sliding_tackle` INTEGER,
`gk_diving` INTEGER,
`gk_handling` INTEGER,
`gk_kicking` INTEGER,
`gk_positioning` INTEGER,
`gk_reflexes` INTEGER,
FOREIGN KEY(`player_fifa_api_id`) REFERENCES `Player`(`player_fifa_api_id`),
FOREIGN KEY(`player_api_id`) REFERENCES `Player`(`player_api_id`)
);
CREATE TABLE `Player` (
`id` INTEGER PRIMARY KEY AUTOINCREMENT,
`player_api_id` INTEGER UNIQUE,
`player_name` TEXT,
`player_fifa_api_id` INTEGER UNIQUE,
`birthday` TEXT,
`height` INTEGER,
`weight` INTEGER
);
CREATE TABLE `Match` (
`id` INTEGER PRIMARY KEY AUTOINCREMENT,
`country_id` INTEGER,
`league_id` INTEGER,
`season` TEXT,
`stage` INTEGER,
`date` TEXT,
`match_api_id` INTEGER UNIQUE,
`home_team_api_id` INTEGER,
`away_team_api_id` INTEGER,
`home_team_goal` INTEGER,
`away_team_goal` INTEGER,
`home_player_X1` INTEGER,
`home_player_X2` INTEGER,
`home_player_X3` INTEGER,
`home_player_X4` INTEGER,
`home_player_X5` INTEGER,
`home_player_X6` INTEGER,
`home_player_X7` INTEGER,
`home_player_X8` INTEGER,
`home_player_X9` INTEGER,
`home_player_X10` INTEGER,
`home_player_X11` INTEGER,
`away_player_X1` INTEGER,
`away_player_X2` INTEGER,
`away_player_X3` INTEGER,
`away_player_X4` INTEGER,
`away_player_X5` INTEGER,
`away_player_X6` INTEGER,
`away_player_X7` INTEGER,
`away_player_X8` INTEGER,
`away_player_X9` INTEGER,
`away_player_X10` INTEGER,
`away_player_X11` INTEGER,
`home_player_Y1` INTEGER,
`home_player_Y2` INTEGER,
`home_player_Y3` INTEGER,
`home_player_Y4` INTEGER,
`home_player_Y5` INTEGER,
`home_player_Y6` INTEGER,
`home_player_Y7` INTEGER,
`home_player_Y8` INTEGER,
`home_player_Y9` INTEGER,
`home_player_Y10` INTEGER,
`home_player_Y11` INTEGER,
`away_player_Y1` INTEGER,
`away_player_Y2` INTEGER,
`away_player_Y3` INTEGER,
`away_player_Y4` INTEGER,
`away_player_Y5` INTEGER,
`away_player_Y6` INTEGER,
`away_player_Y7` INTEGER,
`away_player_Y8` INTEGER,
`away_player_Y9` INTEGER,
`away_player_Y10` INTEGER,
`away_player_Y11` INTEGER,
`home_player_1` INTEGER,
`home_player_2` INTEGER,
`home_player_3` INTEGER,
`home_player_4` INTEGER,
`home_player_5` INTEGER,
`home_player_6` INTEGER,
`home_player_7` INTEGER,
`home_player_8` INTEGER,
`home_player_9` INTEGER,
`home_player_10` INTEGER,
`home_player_11` INTEGER,
`away_player_1` INTEGER,
`away_player_2` INTEGER,
`away_player_3` INTEGER,
`away_player_4` INTEGER,
`away_player_5` INTEGER,
`away_player_6` INTEGER,
`away_player_7` INTEGER,
`away_player_8` INTEGER,
`away_player_9` INTEGER,
`away_player_10` INTEGER,
`away_player_11` INTEGER,
`goal` TEXT,
`shoton` TEXT,
`shotoff` TEXT,
`foulcommit` TEXT,
`card` TEXT,
`cross` TEXT,
`corner` TEXT,
`possession` TEXT,
`B365H` NUMERIC,
`B365D` NUMERIC,
`B365A` NUMERIC,
`BWH` NUMERIC,
`BWD` NUMERIC,
`BWA` NUMERIC,
`IWH` NUMERIC,
`IWD` NUMERIC,
`IWA` NUMERIC,
`LBH` NUMERIC,
`LBD` NUMERIC,
`LBA` NUMERIC,
`PSH` NUMERIC,
`PSD` NUMERIC,
`PSA` NUMERIC,
`WHH` NUMERIC,
`WHD` NUMERIC,
`WHA` NUMERIC,
`SJH` NUMERIC,
`SJD` NUMERIC,
`SJA` NUMERIC,
`VCH` NUMERIC,
`VCD` NUMERIC,
`VCA` NUMERIC,
`GBH` NUMERIC,
`GBD` NUMERIC,
`GBA` NUMERIC,
`BSH` NUMERIC,
`BSD` NUMERIC,
`BSA` NUMERIC,
FOREIGN KEY(`country_id`) REFERENCES `Country`(`id`),
FOREIGN KEY(`league_id`) REFERENCES `League`(`id`),
FOREIGN KEY(`home_team_api_id`) REFERENCES `Team`(`team_api_id`),
FOREIGN KEY(`away_team_api_id`) REFERENCES `Team`(`team_api_id`),
FOREIGN KEY(`home_player_1`) REFERENCES `Player`(`player_api_id`),
FOREIGN KEY(`home_player_2`) REFERENCES `Player`(`player_api_id`),
FOREIGN KEY(`home_player_3`) REFERENCES `Player`(`player_api_id`),
FOREIGN KEY(`home_player_4`) REFERENCES `Player`(`player_api_id`),
FOREIGN KEY(`home_player_5`) REFERENCES `Player`(`player_api_id`),
FOREIGN KEY(`home_player_6`) REFERENCES `Player`(`player_api_id`),
FOREIGN KEY(`home_player_7`) REFERENCES `Player`(`player_api_id`),
FOREIGN KEY(`home_player_8`) REFERENCES `Player`(`player_api_id`),
FOREIGN KEY(`home_player_9`) REFERENCES `Player`(`player_api_id`),
FOREIGN KEY(`home_player_10`) REFERENCES `Player`(`player_api_id`),
FOREIGN KEY(`home_player_11`) REFERENCES `Player`(`player_api_id`),
FOREIGN KEY(`away_player_1`) REFERENCES `Player`(`player_api_id`),
FOREIGN KEY(`away_player_2`) REFERENCES `Player`(`player_api_id`),
FOREIGN KEY(`away_player_3`) REFERENCES `Player`(`player_api_id`),
FOREIGN KEY(`away_player_4`) REFERENCES `Player`(`player_api_id`),
FOREIGN KEY(`away_player_5`) REFERENCES `Player`(`player_api_id`),
FOREIGN KEY(`away_player_6`) REFERENCES `Player`(`player_api_id`),
FOREIGN KEY(`away_player_7`) REFERENCES `Player`(`player_api_id`),
FOREIGN KEY(`away_player_8`) REFERENCES `Player`(`player_api_id`),
FOREIGN KEY(`away_player_9`) REFERENCES `Player`(`player_api_id`),
FOREIGN KEY(`away_player_10`) REFERENCES `Player`(`player_api_id`),
FOREIGN KEY(`away_player_11`) REFERENCES `Player`(`player_api_id`)
);
CREATE TABLE `League` (
`id` INTEGER PRIMARY KEY AUTOINCREMENT,
`country_id` INTEGER,
`name` TEXT UNIQUE,
FOREIGN KEY(`country_id`) REFERENCES `Country`(`id`)
);
CREATE TABLE `Country` (
`id` INTEGER PRIMARY KEY AUTOINCREMENT,
`name` TEXT UNIQUE
);
CREATE TABLE "Team" (
`id` INTEGER PRIMARY KEY AUTOINCREMENT,
`team_api_id` INTEGER UNIQUE,
`team_fifa_api_id` INTEGER,
`team_long_name` TEXT,
`team_short_name` TEXT
);
CREATE TABLE `Team_Attributes` (
`id` INTEGER PRIMARY KEY AUTOINCREMENT,
`team_fifa_api_id` INTEGER,
`team_api_id` INTEGER,
`date` TEXT,
`buildUpPlaySpeed` INTEGER,
`buildUpPlaySpeedClass` TEXT,
`buildUpPlayDribbling` INTEGER,
`buildUpPlayDribblingClass` TEXT,
`buildUpPlayPassing` INTEGER,
`buildUpPlayPassingClass` TEXT,
`buildUpPlayPositioningClass` TEXT,
`chanceCreationPassing` INTEGER,
`chanceCreationPassingClass` TEXT,
`chanceCreationCrossing` INTEGER,
`chanceCreationCrossingClass` TEXT,
`chanceCreationShooting` INTEGER,
`chanceCreationShootingClass` TEXT,
`chanceCreationPositioningClass` TEXT,
`defencePressure` INTEGER,
`defencePressureClass` TEXT,
`defenceAggression` INTEGER,
`defenceAggressionClass` TEXT,
`defenceTeamWidth` INTEGER,
`defenceTeamWidthClass` TEXT,
`defenceDefenderLineClass` TEXT,
FOREIGN KEY(`team_fifa_api_id`) REFERENCES `Team`(`team_fifa_api_id`),
FOREIGN KEY(`team_api_id`) REFERENCES `Team`(`team_api_id`)
);
INSERT INTO "Player_Attributes" VALUES(1,218353,505942,'2016-02-18 00:00:00',67,71,'right','medium','medium',49,44,71,61,44,51,45,39,64,49,60,64,59,47,65,55,58,54,76,35,71,70,45,54,48,65,69,69,6,11,10,8,8);
INSERT INTO "Player" VALUES(1,505942,'Aaron Appindangoye',218353,'1992-02-29 00:00:00',182.88,187);
INSERT INTO "Match" VALUES(1,1,1,'2008/2009',1,'2008-08-17 00:00:00',492473,9987,9993,1,1,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,1.73,3.4,5,1.75,3.35,4.2,1.85,3.2,3.5,1.8,3.3,3.75,NULL,NULL,NULL,1.7,3.3,4.33,1.9,3.3,4,1.65,3.4,4.5,1.78,3.25,4,1.73,3.4,4.2);
INSERT INTO "League" VALUES(1,1,'Belgium Jupiler League');
INSERT INTO "Country" VALUES(1,'Belgium');
INSERT INTO "Team" VALUES(1,9987,673,'KRC Genk','GEN');
INSERT INTO "Team_Attributes" VALUES(1,434,9930,'2010-02-22 00:00:00',60,'Balanced',NULL,'Little',50,'Mixed','Organised',60,'Normal',65,'Normal',55,'Normal','Organised',50,'Medium',55,'Press',45,'Normal','Cover'); |
soccer_1 | SELECT count(*) FROM Country AS T1 JOIN League AS T2 ON T1.id = T2.country_id WHERE T1.name = "England" | How many leagues are there in England? | CREATE TABLE "Player_Attributes" (
`id` INTEGER PRIMARY KEY AUTOINCREMENT,
`player_fifa_api_id` INTEGER,
`player_api_id` INTEGER,
`date` TEXT,
`overall_rating` INTEGER,
`potential` INTEGER,
`preferred_foot` TEXT,
`attacking_work_rate` TEXT,
`defensive_work_rate` TEXT,
`crossing` INTEGER,
`finishing` INTEGER,
`heading_accuracy` INTEGER,
`short_passing` INTEGER,
`volleys` INTEGER,
`dribbling` INTEGER,
`curve` INTEGER,
`free_kick_accuracy` INTEGER,
`long_passing` INTEGER,
`ball_control` INTEGER,
`acceleration` INTEGER,
`sprint_speed` INTEGER,
`agility` INTEGER,
`reactions` INTEGER,
`balance` INTEGER,
`shot_power` INTEGER,
`jumping` INTEGER,
`stamina` INTEGER,
`strength` INTEGER,
`long_shots` INTEGER,
`aggression` INTEGER,
`interceptions` INTEGER,
`positioning` INTEGER,
`vision` INTEGER,
`penalties` INTEGER,
`marking` INTEGER,
`standing_tackle` INTEGER,
`sliding_tackle` INTEGER,
`gk_diving` INTEGER,
`gk_handling` INTEGER,
`gk_kicking` INTEGER,
`gk_positioning` INTEGER,
`gk_reflexes` INTEGER,
FOREIGN KEY(`player_fifa_api_id`) REFERENCES `Player`(`player_fifa_api_id`),
FOREIGN KEY(`player_api_id`) REFERENCES `Player`(`player_api_id`)
);
CREATE TABLE `Player` (
`id` INTEGER PRIMARY KEY AUTOINCREMENT,
`player_api_id` INTEGER UNIQUE,
`player_name` TEXT,
`player_fifa_api_id` INTEGER UNIQUE,
`birthday` TEXT,
`height` INTEGER,
`weight` INTEGER
);
CREATE TABLE `Match` (
`id` INTEGER PRIMARY KEY AUTOINCREMENT,
`country_id` INTEGER,
`league_id` INTEGER,
`season` TEXT,
`stage` INTEGER,
`date` TEXT,
`match_api_id` INTEGER UNIQUE,
`home_team_api_id` INTEGER,
`away_team_api_id` INTEGER,
`home_team_goal` INTEGER,
`away_team_goal` INTEGER,
`home_player_X1` INTEGER,
`home_player_X2` INTEGER,
`home_player_X3` INTEGER,
`home_player_X4` INTEGER,
`home_player_X5` INTEGER,
`home_player_X6` INTEGER,
`home_player_X7` INTEGER,
`home_player_X8` INTEGER,
`home_player_X9` INTEGER,
`home_player_X10` INTEGER,
`home_player_X11` INTEGER,
`away_player_X1` INTEGER,
`away_player_X2` INTEGER,
`away_player_X3` INTEGER,
`away_player_X4` INTEGER,
`away_player_X5` INTEGER,
`away_player_X6` INTEGER,
`away_player_X7` INTEGER,
`away_player_X8` INTEGER,
`away_player_X9` INTEGER,
`away_player_X10` INTEGER,
`away_player_X11` INTEGER,
`home_player_Y1` INTEGER,
`home_player_Y2` INTEGER,
`home_player_Y3` INTEGER,
`home_player_Y4` INTEGER,
`home_player_Y5` INTEGER,
`home_player_Y6` INTEGER,
`home_player_Y7` INTEGER,
`home_player_Y8` INTEGER,
`home_player_Y9` INTEGER,
`home_player_Y10` INTEGER,
`home_player_Y11` INTEGER,
`away_player_Y1` INTEGER,
`away_player_Y2` INTEGER,
`away_player_Y3` INTEGER,
`away_player_Y4` INTEGER,
`away_player_Y5` INTEGER,
`away_player_Y6` INTEGER,
`away_player_Y7` INTEGER,
`away_player_Y8` INTEGER,
`away_player_Y9` INTEGER,
`away_player_Y10` INTEGER,
`away_player_Y11` INTEGER,
`home_player_1` INTEGER,
`home_player_2` INTEGER,
`home_player_3` INTEGER,
`home_player_4` INTEGER,
`home_player_5` INTEGER,
`home_player_6` INTEGER,
`home_player_7` INTEGER,
`home_player_8` INTEGER,
`home_player_9` INTEGER,
`home_player_10` INTEGER,
`home_player_11` INTEGER,
`away_player_1` INTEGER,
`away_player_2` INTEGER,
`away_player_3` INTEGER,
`away_player_4` INTEGER,
`away_player_5` INTEGER,
`away_player_6` INTEGER,
`away_player_7` INTEGER,
`away_player_8` INTEGER,
`away_player_9` INTEGER,
`away_player_10` INTEGER,
`away_player_11` INTEGER,
`goal` TEXT,
`shoton` TEXT,
`shotoff` TEXT,
`foulcommit` TEXT,
`card` TEXT,
`cross` TEXT,
`corner` TEXT,
`possession` TEXT,
`B365H` NUMERIC,
`B365D` NUMERIC,
`B365A` NUMERIC,
`BWH` NUMERIC,
`BWD` NUMERIC,
`BWA` NUMERIC,
`IWH` NUMERIC,
`IWD` NUMERIC,
`IWA` NUMERIC,
`LBH` NUMERIC,
`LBD` NUMERIC,
`LBA` NUMERIC,
`PSH` NUMERIC,
`PSD` NUMERIC,
`PSA` NUMERIC,
`WHH` NUMERIC,
`WHD` NUMERIC,
`WHA` NUMERIC,
`SJH` NUMERIC,
`SJD` NUMERIC,
`SJA` NUMERIC,
`VCH` NUMERIC,
`VCD` NUMERIC,
`VCA` NUMERIC,
`GBH` NUMERIC,
`GBD` NUMERIC,
`GBA` NUMERIC,
`BSH` NUMERIC,
`BSD` NUMERIC,
`BSA` NUMERIC,
FOREIGN KEY(`country_id`) REFERENCES `Country`(`id`),
FOREIGN KEY(`league_id`) REFERENCES `League`(`id`),
FOREIGN KEY(`home_team_api_id`) REFERENCES `Team`(`team_api_id`),
FOREIGN KEY(`away_team_api_id`) REFERENCES `Team`(`team_api_id`),
FOREIGN KEY(`home_player_1`) REFERENCES `Player`(`player_api_id`),
FOREIGN KEY(`home_player_2`) REFERENCES `Player`(`player_api_id`),
FOREIGN KEY(`home_player_3`) REFERENCES `Player`(`player_api_id`),
FOREIGN KEY(`home_player_4`) REFERENCES `Player`(`player_api_id`),
FOREIGN KEY(`home_player_5`) REFERENCES `Player`(`player_api_id`),
FOREIGN KEY(`home_player_6`) REFERENCES `Player`(`player_api_id`),
FOREIGN KEY(`home_player_7`) REFERENCES `Player`(`player_api_id`),
FOREIGN KEY(`home_player_8`) REFERENCES `Player`(`player_api_id`),
FOREIGN KEY(`home_player_9`) REFERENCES `Player`(`player_api_id`),
FOREIGN KEY(`home_player_10`) REFERENCES `Player`(`player_api_id`),
FOREIGN KEY(`home_player_11`) REFERENCES `Player`(`player_api_id`),
FOREIGN KEY(`away_player_1`) REFERENCES `Player`(`player_api_id`),
FOREIGN KEY(`away_player_2`) REFERENCES `Player`(`player_api_id`),
FOREIGN KEY(`away_player_3`) REFERENCES `Player`(`player_api_id`),
FOREIGN KEY(`away_player_4`) REFERENCES `Player`(`player_api_id`),
FOREIGN KEY(`away_player_5`) REFERENCES `Player`(`player_api_id`),
FOREIGN KEY(`away_player_6`) REFERENCES `Player`(`player_api_id`),
FOREIGN KEY(`away_player_7`) REFERENCES `Player`(`player_api_id`),
FOREIGN KEY(`away_player_8`) REFERENCES `Player`(`player_api_id`),
FOREIGN KEY(`away_player_9`) REFERENCES `Player`(`player_api_id`),
FOREIGN KEY(`away_player_10`) REFERENCES `Player`(`player_api_id`),
FOREIGN KEY(`away_player_11`) REFERENCES `Player`(`player_api_id`)
);
CREATE TABLE `League` (
`id` INTEGER PRIMARY KEY AUTOINCREMENT,
`country_id` INTEGER,
`name` TEXT UNIQUE,
FOREIGN KEY(`country_id`) REFERENCES `Country`(`id`)
);
CREATE TABLE `Country` (
`id` INTEGER PRIMARY KEY AUTOINCREMENT,
`name` TEXT UNIQUE
);
CREATE TABLE "Team" (
`id` INTEGER PRIMARY KEY AUTOINCREMENT,
`team_api_id` INTEGER UNIQUE,
`team_fifa_api_id` INTEGER,
`team_long_name` TEXT,
`team_short_name` TEXT
);
CREATE TABLE `Team_Attributes` (
`id` INTEGER PRIMARY KEY AUTOINCREMENT,
`team_fifa_api_id` INTEGER,
`team_api_id` INTEGER,
`date` TEXT,
`buildUpPlaySpeed` INTEGER,
`buildUpPlaySpeedClass` TEXT,
`buildUpPlayDribbling` INTEGER,
`buildUpPlayDribblingClass` TEXT,
`buildUpPlayPassing` INTEGER,
`buildUpPlayPassingClass` TEXT,
`buildUpPlayPositioningClass` TEXT,
`chanceCreationPassing` INTEGER,
`chanceCreationPassingClass` TEXT,
`chanceCreationCrossing` INTEGER,
`chanceCreationCrossingClass` TEXT,
`chanceCreationShooting` INTEGER,
`chanceCreationShootingClass` TEXT,
`chanceCreationPositioningClass` TEXT,
`defencePressure` INTEGER,
`defencePressureClass` TEXT,
`defenceAggression` INTEGER,
`defenceAggressionClass` TEXT,
`defenceTeamWidth` INTEGER,
`defenceTeamWidthClass` TEXT,
`defenceDefenderLineClass` TEXT,
FOREIGN KEY(`team_fifa_api_id`) REFERENCES `Team`(`team_fifa_api_id`),
FOREIGN KEY(`team_api_id`) REFERENCES `Team`(`team_api_id`)
);
INSERT INTO "Player_Attributes" VALUES(1,218353,505942,'2016-02-18 00:00:00',67,71,'right','medium','medium',49,44,71,61,44,51,45,39,64,49,60,64,59,47,65,55,58,54,76,35,71,70,45,54,48,65,69,69,6,11,10,8,8);
INSERT INTO "Player" VALUES(1,505942,'Aaron Appindangoye',218353,'1992-02-29 00:00:00',182.88,187);
INSERT INTO "Match" VALUES(1,1,1,'2008/2009',1,'2008-08-17 00:00:00',492473,9987,9993,1,1,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,1.73,3.4,5,1.75,3.35,4.2,1.85,3.2,3.5,1.8,3.3,3.75,NULL,NULL,NULL,1.7,3.3,4.33,1.9,3.3,4,1.65,3.4,4.5,1.78,3.25,4,1.73,3.4,4.2);
INSERT INTO "League" VALUES(1,1,'Belgium Jupiler League');
INSERT INTO "Country" VALUES(1,'Belgium');
INSERT INTO "Team" VALUES(1,9987,673,'KRC Genk','GEN');
INSERT INTO "Team_Attributes" VALUES(1,434,9930,'2010-02-22 00:00:00',60,'Balanced',NULL,'Little',50,'Mixed','Organised',60,'Normal',65,'Normal',55,'Normal','Organised',50,'Medium',55,'Press',45,'Normal','Cover'); |
soccer_1 | SELECT avg(weight) FROM Player | What is the average weight of all players? | CREATE TABLE "Player_Attributes" (
`id` INTEGER PRIMARY KEY AUTOINCREMENT,
`player_fifa_api_id` INTEGER,
`player_api_id` INTEGER,
`date` TEXT,
`overall_rating` INTEGER,
`potential` INTEGER,
`preferred_foot` TEXT,
`attacking_work_rate` TEXT,
`defensive_work_rate` TEXT,
`crossing` INTEGER,
`finishing` INTEGER,
`heading_accuracy` INTEGER,
`short_passing` INTEGER,
`volleys` INTEGER,
`dribbling` INTEGER,
`curve` INTEGER,
`free_kick_accuracy` INTEGER,
`long_passing` INTEGER,
`ball_control` INTEGER,
`acceleration` INTEGER,
`sprint_speed` INTEGER,
`agility` INTEGER,
`reactions` INTEGER,
`balance` INTEGER,
`shot_power` INTEGER,
`jumping` INTEGER,
`stamina` INTEGER,
`strength` INTEGER,
`long_shots` INTEGER,
`aggression` INTEGER,
`interceptions` INTEGER,
`positioning` INTEGER,
`vision` INTEGER,
`penalties` INTEGER,
`marking` INTEGER,
`standing_tackle` INTEGER,
`sliding_tackle` INTEGER,
`gk_diving` INTEGER,
`gk_handling` INTEGER,
`gk_kicking` INTEGER,
`gk_positioning` INTEGER,
`gk_reflexes` INTEGER,
FOREIGN KEY(`player_fifa_api_id`) REFERENCES `Player`(`player_fifa_api_id`),
FOREIGN KEY(`player_api_id`) REFERENCES `Player`(`player_api_id`)
);
CREATE TABLE `Player` (
`id` INTEGER PRIMARY KEY AUTOINCREMENT,
`player_api_id` INTEGER UNIQUE,
`player_name` TEXT,
`player_fifa_api_id` INTEGER UNIQUE,
`birthday` TEXT,
`height` INTEGER,
`weight` INTEGER
);
CREATE TABLE `Match` (
`id` INTEGER PRIMARY KEY AUTOINCREMENT,
`country_id` INTEGER,
`league_id` INTEGER,
`season` TEXT,
`stage` INTEGER,
`date` TEXT,
`match_api_id` INTEGER UNIQUE,
`home_team_api_id` INTEGER,
`away_team_api_id` INTEGER,
`home_team_goal` INTEGER,
`away_team_goal` INTEGER,
`home_player_X1` INTEGER,
`home_player_X2` INTEGER,
`home_player_X3` INTEGER,
`home_player_X4` INTEGER,
`home_player_X5` INTEGER,
`home_player_X6` INTEGER,
`home_player_X7` INTEGER,
`home_player_X8` INTEGER,
`home_player_X9` INTEGER,
`home_player_X10` INTEGER,
`home_player_X11` INTEGER,
`away_player_X1` INTEGER,
`away_player_X2` INTEGER,
`away_player_X3` INTEGER,
`away_player_X4` INTEGER,
`away_player_X5` INTEGER,
`away_player_X6` INTEGER,
`away_player_X7` INTEGER,
`away_player_X8` INTEGER,
`away_player_X9` INTEGER,
`away_player_X10` INTEGER,
`away_player_X11` INTEGER,
`home_player_Y1` INTEGER,
`home_player_Y2` INTEGER,
`home_player_Y3` INTEGER,
`home_player_Y4` INTEGER,
`home_player_Y5` INTEGER,
`home_player_Y6` INTEGER,
`home_player_Y7` INTEGER,
`home_player_Y8` INTEGER,
`home_player_Y9` INTEGER,
`home_player_Y10` INTEGER,
`home_player_Y11` INTEGER,
`away_player_Y1` INTEGER,
`away_player_Y2` INTEGER,
`away_player_Y3` INTEGER,
`away_player_Y4` INTEGER,
`away_player_Y5` INTEGER,
`away_player_Y6` INTEGER,
`away_player_Y7` INTEGER,
`away_player_Y8` INTEGER,
`away_player_Y9` INTEGER,
`away_player_Y10` INTEGER,
`away_player_Y11` INTEGER,
`home_player_1` INTEGER,
`home_player_2` INTEGER,
`home_player_3` INTEGER,
`home_player_4` INTEGER,
`home_player_5` INTEGER,
`home_player_6` INTEGER,
`home_player_7` INTEGER,
`home_player_8` INTEGER,
`home_player_9` INTEGER,
`home_player_10` INTEGER,
`home_player_11` INTEGER,
`away_player_1` INTEGER,
`away_player_2` INTEGER,
`away_player_3` INTEGER,
`away_player_4` INTEGER,
`away_player_5` INTEGER,
`away_player_6` INTEGER,
`away_player_7` INTEGER,
`away_player_8` INTEGER,
`away_player_9` INTEGER,
`away_player_10` INTEGER,
`away_player_11` INTEGER,
`goal` TEXT,
`shoton` TEXT,
`shotoff` TEXT,
`foulcommit` TEXT,
`card` TEXT,
`cross` TEXT,
`corner` TEXT,
`possession` TEXT,
`B365H` NUMERIC,
`B365D` NUMERIC,
`B365A` NUMERIC,
`BWH` NUMERIC,
`BWD` NUMERIC,
`BWA` NUMERIC,
`IWH` NUMERIC,
`IWD` NUMERIC,
`IWA` NUMERIC,
`LBH` NUMERIC,
`LBD` NUMERIC,
`LBA` NUMERIC,
`PSH` NUMERIC,
`PSD` NUMERIC,
`PSA` NUMERIC,
`WHH` NUMERIC,
`WHD` NUMERIC,
`WHA` NUMERIC,
`SJH` NUMERIC,
`SJD` NUMERIC,
`SJA` NUMERIC,
`VCH` NUMERIC,
`VCD` NUMERIC,
`VCA` NUMERIC,
`GBH` NUMERIC,
`GBD` NUMERIC,
`GBA` NUMERIC,
`BSH` NUMERIC,
`BSD` NUMERIC,
`BSA` NUMERIC,
FOREIGN KEY(`country_id`) REFERENCES `Country`(`id`),
FOREIGN KEY(`league_id`) REFERENCES `League`(`id`),
FOREIGN KEY(`home_team_api_id`) REFERENCES `Team`(`team_api_id`),
FOREIGN KEY(`away_team_api_id`) REFERENCES `Team`(`team_api_id`),
FOREIGN KEY(`home_player_1`) REFERENCES `Player`(`player_api_id`),
FOREIGN KEY(`home_player_2`) REFERENCES `Player`(`player_api_id`),
FOREIGN KEY(`home_player_3`) REFERENCES `Player`(`player_api_id`),
FOREIGN KEY(`home_player_4`) REFERENCES `Player`(`player_api_id`),
FOREIGN KEY(`home_player_5`) REFERENCES `Player`(`player_api_id`),
FOREIGN KEY(`home_player_6`) REFERENCES `Player`(`player_api_id`),
FOREIGN KEY(`home_player_7`) REFERENCES `Player`(`player_api_id`),
FOREIGN KEY(`home_player_8`) REFERENCES `Player`(`player_api_id`),
FOREIGN KEY(`home_player_9`) REFERENCES `Player`(`player_api_id`),
FOREIGN KEY(`home_player_10`) REFERENCES `Player`(`player_api_id`),
FOREIGN KEY(`home_player_11`) REFERENCES `Player`(`player_api_id`),
FOREIGN KEY(`away_player_1`) REFERENCES `Player`(`player_api_id`),
FOREIGN KEY(`away_player_2`) REFERENCES `Player`(`player_api_id`),
FOREIGN KEY(`away_player_3`) REFERENCES `Player`(`player_api_id`),
FOREIGN KEY(`away_player_4`) REFERENCES `Player`(`player_api_id`),
FOREIGN KEY(`away_player_5`) REFERENCES `Player`(`player_api_id`),
FOREIGN KEY(`away_player_6`) REFERENCES `Player`(`player_api_id`),
FOREIGN KEY(`away_player_7`) REFERENCES `Player`(`player_api_id`),
FOREIGN KEY(`away_player_8`) REFERENCES `Player`(`player_api_id`),
FOREIGN KEY(`away_player_9`) REFERENCES `Player`(`player_api_id`),
FOREIGN KEY(`away_player_10`) REFERENCES `Player`(`player_api_id`),
FOREIGN KEY(`away_player_11`) REFERENCES `Player`(`player_api_id`)
);
CREATE TABLE `League` (
`id` INTEGER PRIMARY KEY AUTOINCREMENT,
`country_id` INTEGER,
`name` TEXT UNIQUE,
FOREIGN KEY(`country_id`) REFERENCES `Country`(`id`)
);
CREATE TABLE `Country` (
`id` INTEGER PRIMARY KEY AUTOINCREMENT,
`name` TEXT UNIQUE
);
CREATE TABLE "Team" (
`id` INTEGER PRIMARY KEY AUTOINCREMENT,
`team_api_id` INTEGER UNIQUE,
`team_fifa_api_id` INTEGER,
`team_long_name` TEXT,
`team_short_name` TEXT
);
CREATE TABLE `Team_Attributes` (
`id` INTEGER PRIMARY KEY AUTOINCREMENT,
`team_fifa_api_id` INTEGER,
`team_api_id` INTEGER,
`date` TEXT,
`buildUpPlaySpeed` INTEGER,
`buildUpPlaySpeedClass` TEXT,
`buildUpPlayDribbling` INTEGER,
`buildUpPlayDribblingClass` TEXT,
`buildUpPlayPassing` INTEGER,
`buildUpPlayPassingClass` TEXT,
`buildUpPlayPositioningClass` TEXT,
`chanceCreationPassing` INTEGER,
`chanceCreationPassingClass` TEXT,
`chanceCreationCrossing` INTEGER,
`chanceCreationCrossingClass` TEXT,
`chanceCreationShooting` INTEGER,
`chanceCreationShootingClass` TEXT,
`chanceCreationPositioningClass` TEXT,
`defencePressure` INTEGER,
`defencePressureClass` TEXT,
`defenceAggression` INTEGER,
`defenceAggressionClass` TEXT,
`defenceTeamWidth` INTEGER,
`defenceTeamWidthClass` TEXT,
`defenceDefenderLineClass` TEXT,
FOREIGN KEY(`team_fifa_api_id`) REFERENCES `Team`(`team_fifa_api_id`),
FOREIGN KEY(`team_api_id`) REFERENCES `Team`(`team_api_id`)
);
INSERT INTO "Player_Attributes" VALUES(1,218353,505942,'2016-02-18 00:00:00',67,71,'right','medium','medium',49,44,71,61,44,51,45,39,64,49,60,64,59,47,65,55,58,54,76,35,71,70,45,54,48,65,69,69,6,11,10,8,8);
INSERT INTO "Player" VALUES(1,505942,'Aaron Appindangoye',218353,'1992-02-29 00:00:00',182.88,187);
INSERT INTO "Match" VALUES(1,1,1,'2008/2009',1,'2008-08-17 00:00:00',492473,9987,9993,1,1,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,1.73,3.4,5,1.75,3.35,4.2,1.85,3.2,3.5,1.8,3.3,3.75,NULL,NULL,NULL,1.7,3.3,4.33,1.9,3.3,4,1.65,3.4,4.5,1.78,3.25,4,1.73,3.4,4.2);
INSERT INTO "League" VALUES(1,1,'Belgium Jupiler League');
INSERT INTO "Country" VALUES(1,'Belgium');
INSERT INTO "Team" VALUES(1,9987,673,'KRC Genk','GEN');
INSERT INTO "Team_Attributes" VALUES(1,434,9930,'2010-02-22 00:00:00',60,'Balanced',NULL,'Little',50,'Mixed','Organised',60,'Normal',65,'Normal',55,'Normal','Organised',50,'Medium',55,'Press',45,'Normal','Cover'); |
soccer_1 | SELECT max(weight) , min(weight) FROM Player | What is the maximum and minimum height of all players? | CREATE TABLE "Player_Attributes" (
`id` INTEGER PRIMARY KEY AUTOINCREMENT,
`player_fifa_api_id` INTEGER,
`player_api_id` INTEGER,
`date` TEXT,
`overall_rating` INTEGER,
`potential` INTEGER,
`preferred_foot` TEXT,
`attacking_work_rate` TEXT,
`defensive_work_rate` TEXT,
`crossing` INTEGER,
`finishing` INTEGER,
`heading_accuracy` INTEGER,
`short_passing` INTEGER,
`volleys` INTEGER,
`dribbling` INTEGER,
`curve` INTEGER,
`free_kick_accuracy` INTEGER,
`long_passing` INTEGER,
`ball_control` INTEGER,
`acceleration` INTEGER,
`sprint_speed` INTEGER,
`agility` INTEGER,
`reactions` INTEGER,
`balance` INTEGER,
`shot_power` INTEGER,
`jumping` INTEGER,
`stamina` INTEGER,
`strength` INTEGER,
`long_shots` INTEGER,
`aggression` INTEGER,
`interceptions` INTEGER,
`positioning` INTEGER,
`vision` INTEGER,
`penalties` INTEGER,
`marking` INTEGER,
`standing_tackle` INTEGER,
`sliding_tackle` INTEGER,
`gk_diving` INTEGER,
`gk_handling` INTEGER,
`gk_kicking` INTEGER,
`gk_positioning` INTEGER,
`gk_reflexes` INTEGER,
FOREIGN KEY(`player_fifa_api_id`) REFERENCES `Player`(`player_fifa_api_id`),
FOREIGN KEY(`player_api_id`) REFERENCES `Player`(`player_api_id`)
);
CREATE TABLE `Player` (
`id` INTEGER PRIMARY KEY AUTOINCREMENT,
`player_api_id` INTEGER UNIQUE,
`player_name` TEXT,
`player_fifa_api_id` INTEGER UNIQUE,
`birthday` TEXT,
`height` INTEGER,
`weight` INTEGER
);
CREATE TABLE `Match` (
`id` INTEGER PRIMARY KEY AUTOINCREMENT,
`country_id` INTEGER,
`league_id` INTEGER,
`season` TEXT,
`stage` INTEGER,
`date` TEXT,
`match_api_id` INTEGER UNIQUE,
`home_team_api_id` INTEGER,
`away_team_api_id` INTEGER,
`home_team_goal` INTEGER,
`away_team_goal` INTEGER,
`home_player_X1` INTEGER,
`home_player_X2` INTEGER,
`home_player_X3` INTEGER,
`home_player_X4` INTEGER,
`home_player_X5` INTEGER,
`home_player_X6` INTEGER,
`home_player_X7` INTEGER,
`home_player_X8` INTEGER,
`home_player_X9` INTEGER,
`home_player_X10` INTEGER,
`home_player_X11` INTEGER,
`away_player_X1` INTEGER,
`away_player_X2` INTEGER,
`away_player_X3` INTEGER,
`away_player_X4` INTEGER,
`away_player_X5` INTEGER,
`away_player_X6` INTEGER,
`away_player_X7` INTEGER,
`away_player_X8` INTEGER,
`away_player_X9` INTEGER,
`away_player_X10` INTEGER,
`away_player_X11` INTEGER,
`home_player_Y1` INTEGER,
`home_player_Y2` INTEGER,
`home_player_Y3` INTEGER,
`home_player_Y4` INTEGER,
`home_player_Y5` INTEGER,
`home_player_Y6` INTEGER,
`home_player_Y7` INTEGER,
`home_player_Y8` INTEGER,
`home_player_Y9` INTEGER,
`home_player_Y10` INTEGER,
`home_player_Y11` INTEGER,
`away_player_Y1` INTEGER,
`away_player_Y2` INTEGER,
`away_player_Y3` INTEGER,
`away_player_Y4` INTEGER,
`away_player_Y5` INTEGER,
`away_player_Y6` INTEGER,
`away_player_Y7` INTEGER,
`away_player_Y8` INTEGER,
`away_player_Y9` INTEGER,
`away_player_Y10` INTEGER,
`away_player_Y11` INTEGER,
`home_player_1` INTEGER,
`home_player_2` INTEGER,
`home_player_3` INTEGER,
`home_player_4` INTEGER,
`home_player_5` INTEGER,
`home_player_6` INTEGER,
`home_player_7` INTEGER,
`home_player_8` INTEGER,
`home_player_9` INTEGER,
`home_player_10` INTEGER,
`home_player_11` INTEGER,
`away_player_1` INTEGER,
`away_player_2` INTEGER,
`away_player_3` INTEGER,
`away_player_4` INTEGER,
`away_player_5` INTEGER,
`away_player_6` INTEGER,
`away_player_7` INTEGER,
`away_player_8` INTEGER,
`away_player_9` INTEGER,
`away_player_10` INTEGER,
`away_player_11` INTEGER,
`goal` TEXT,
`shoton` TEXT,
`shotoff` TEXT,
`foulcommit` TEXT,
`card` TEXT,
`cross` TEXT,
`corner` TEXT,
`possession` TEXT,
`B365H` NUMERIC,
`B365D` NUMERIC,
`B365A` NUMERIC,
`BWH` NUMERIC,
`BWD` NUMERIC,
`BWA` NUMERIC,
`IWH` NUMERIC,
`IWD` NUMERIC,
`IWA` NUMERIC,
`LBH` NUMERIC,
`LBD` NUMERIC,
`LBA` NUMERIC,
`PSH` NUMERIC,
`PSD` NUMERIC,
`PSA` NUMERIC,
`WHH` NUMERIC,
`WHD` NUMERIC,
`WHA` NUMERIC,
`SJH` NUMERIC,
`SJD` NUMERIC,
`SJA` NUMERIC,
`VCH` NUMERIC,
`VCD` NUMERIC,
`VCA` NUMERIC,
`GBH` NUMERIC,
`GBD` NUMERIC,
`GBA` NUMERIC,
`BSH` NUMERIC,
`BSD` NUMERIC,
`BSA` NUMERIC,
FOREIGN KEY(`country_id`) REFERENCES `Country`(`id`),
FOREIGN KEY(`league_id`) REFERENCES `League`(`id`),
FOREIGN KEY(`home_team_api_id`) REFERENCES `Team`(`team_api_id`),
FOREIGN KEY(`away_team_api_id`) REFERENCES `Team`(`team_api_id`),
FOREIGN KEY(`home_player_1`) REFERENCES `Player`(`player_api_id`),
FOREIGN KEY(`home_player_2`) REFERENCES `Player`(`player_api_id`),
FOREIGN KEY(`home_player_3`) REFERENCES `Player`(`player_api_id`),
FOREIGN KEY(`home_player_4`) REFERENCES `Player`(`player_api_id`),
FOREIGN KEY(`home_player_5`) REFERENCES `Player`(`player_api_id`),
FOREIGN KEY(`home_player_6`) REFERENCES `Player`(`player_api_id`),
FOREIGN KEY(`home_player_7`) REFERENCES `Player`(`player_api_id`),
FOREIGN KEY(`home_player_8`) REFERENCES `Player`(`player_api_id`),
FOREIGN KEY(`home_player_9`) REFERENCES `Player`(`player_api_id`),
FOREIGN KEY(`home_player_10`) REFERENCES `Player`(`player_api_id`),
FOREIGN KEY(`home_player_11`) REFERENCES `Player`(`player_api_id`),
FOREIGN KEY(`away_player_1`) REFERENCES `Player`(`player_api_id`),
FOREIGN KEY(`away_player_2`) REFERENCES `Player`(`player_api_id`),
FOREIGN KEY(`away_player_3`) REFERENCES `Player`(`player_api_id`),
FOREIGN KEY(`away_player_4`) REFERENCES `Player`(`player_api_id`),
FOREIGN KEY(`away_player_5`) REFERENCES `Player`(`player_api_id`),
FOREIGN KEY(`away_player_6`) REFERENCES `Player`(`player_api_id`),
FOREIGN KEY(`away_player_7`) REFERENCES `Player`(`player_api_id`),
FOREIGN KEY(`away_player_8`) REFERENCES `Player`(`player_api_id`),
FOREIGN KEY(`away_player_9`) REFERENCES `Player`(`player_api_id`),
FOREIGN KEY(`away_player_10`) REFERENCES `Player`(`player_api_id`),
FOREIGN KEY(`away_player_11`) REFERENCES `Player`(`player_api_id`)
);
CREATE TABLE `League` (
`id` INTEGER PRIMARY KEY AUTOINCREMENT,
`country_id` INTEGER,
`name` TEXT UNIQUE,
FOREIGN KEY(`country_id`) REFERENCES `Country`(`id`)
);
CREATE TABLE `Country` (
`id` INTEGER PRIMARY KEY AUTOINCREMENT,
`name` TEXT UNIQUE
);
CREATE TABLE "Team" (
`id` INTEGER PRIMARY KEY AUTOINCREMENT,
`team_api_id` INTEGER UNIQUE,
`team_fifa_api_id` INTEGER,
`team_long_name` TEXT,
`team_short_name` TEXT
);
CREATE TABLE `Team_Attributes` (
`id` INTEGER PRIMARY KEY AUTOINCREMENT,
`team_fifa_api_id` INTEGER,
`team_api_id` INTEGER,
`date` TEXT,
`buildUpPlaySpeed` INTEGER,
`buildUpPlaySpeedClass` TEXT,
`buildUpPlayDribbling` INTEGER,
`buildUpPlayDribblingClass` TEXT,
`buildUpPlayPassing` INTEGER,
`buildUpPlayPassingClass` TEXT,
`buildUpPlayPositioningClass` TEXT,
`chanceCreationPassing` INTEGER,
`chanceCreationPassingClass` TEXT,
`chanceCreationCrossing` INTEGER,
`chanceCreationCrossingClass` TEXT,
`chanceCreationShooting` INTEGER,
`chanceCreationShootingClass` TEXT,
`chanceCreationPositioningClass` TEXT,
`defencePressure` INTEGER,
`defencePressureClass` TEXT,
`defenceAggression` INTEGER,
`defenceAggressionClass` TEXT,
`defenceTeamWidth` INTEGER,
`defenceTeamWidthClass` TEXT,
`defenceDefenderLineClass` TEXT,
FOREIGN KEY(`team_fifa_api_id`) REFERENCES `Team`(`team_fifa_api_id`),
FOREIGN KEY(`team_api_id`) REFERENCES `Team`(`team_api_id`)
);
INSERT INTO "Player_Attributes" VALUES(1,218353,505942,'2016-02-18 00:00:00',67,71,'right','medium','medium',49,44,71,61,44,51,45,39,64,49,60,64,59,47,65,55,58,54,76,35,71,70,45,54,48,65,69,69,6,11,10,8,8);
INSERT INTO "Player" VALUES(1,505942,'Aaron Appindangoye',218353,'1992-02-29 00:00:00',182.88,187);
INSERT INTO "Match" VALUES(1,1,1,'2008/2009',1,'2008-08-17 00:00:00',492473,9987,9993,1,1,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,1.73,3.4,5,1.75,3.35,4.2,1.85,3.2,3.5,1.8,3.3,3.75,NULL,NULL,NULL,1.7,3.3,4.33,1.9,3.3,4,1.65,3.4,4.5,1.78,3.25,4,1.73,3.4,4.2);
INSERT INTO "League" VALUES(1,1,'Belgium Jupiler League');
INSERT INTO "Country" VALUES(1,'Belgium');
INSERT INTO "Team" VALUES(1,9987,673,'KRC Genk','GEN');
INSERT INTO "Team_Attributes" VALUES(1,434,9930,'2010-02-22 00:00:00',60,'Balanced',NULL,'Little',50,'Mixed','Organised',60,'Normal',65,'Normal',55,'Normal','Organised',50,'Medium',55,'Press',45,'Normal','Cover'); |
soccer_1 | 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 ) | List all player names who have an overall rating higher than the average. | CREATE TABLE "Player_Attributes" (
`id` INTEGER PRIMARY KEY AUTOINCREMENT,
`player_fifa_api_id` INTEGER,
`player_api_id` INTEGER,
`date` TEXT,
`overall_rating` INTEGER,
`potential` INTEGER,
`preferred_foot` TEXT,
`attacking_work_rate` TEXT,
`defensive_work_rate` TEXT,
`crossing` INTEGER,
`finishing` INTEGER,
`heading_accuracy` INTEGER,
`short_passing` INTEGER,
`volleys` INTEGER,
`dribbling` INTEGER,
`curve` INTEGER,
`free_kick_accuracy` INTEGER,
`long_passing` INTEGER,
`ball_control` INTEGER,
`acceleration` INTEGER,
`sprint_speed` INTEGER,
`agility` INTEGER,
`reactions` INTEGER,
`balance` INTEGER,
`shot_power` INTEGER,
`jumping` INTEGER,
`stamina` INTEGER,
`strength` INTEGER,
`long_shots` INTEGER,
`aggression` INTEGER,
`interceptions` INTEGER,
`positioning` INTEGER,
`vision` INTEGER,
`penalties` INTEGER,
`marking` INTEGER,
`standing_tackle` INTEGER,
`sliding_tackle` INTEGER,
`gk_diving` INTEGER,
`gk_handling` INTEGER,
`gk_kicking` INTEGER,
`gk_positioning` INTEGER,
`gk_reflexes` INTEGER,
FOREIGN KEY(`player_fifa_api_id`) REFERENCES `Player`(`player_fifa_api_id`),
FOREIGN KEY(`player_api_id`) REFERENCES `Player`(`player_api_id`)
);
CREATE TABLE `Player` (
`id` INTEGER PRIMARY KEY AUTOINCREMENT,
`player_api_id` INTEGER UNIQUE,
`player_name` TEXT,
`player_fifa_api_id` INTEGER UNIQUE,
`birthday` TEXT,
`height` INTEGER,
`weight` INTEGER
);
CREATE TABLE `Match` (
`id` INTEGER PRIMARY KEY AUTOINCREMENT,
`country_id` INTEGER,
`league_id` INTEGER,
`season` TEXT,
`stage` INTEGER,
`date` TEXT,
`match_api_id` INTEGER UNIQUE,
`home_team_api_id` INTEGER,
`away_team_api_id` INTEGER,
`home_team_goal` INTEGER,
`away_team_goal` INTEGER,
`home_player_X1` INTEGER,
`home_player_X2` INTEGER,
`home_player_X3` INTEGER,
`home_player_X4` INTEGER,
`home_player_X5` INTEGER,
`home_player_X6` INTEGER,
`home_player_X7` INTEGER,
`home_player_X8` INTEGER,
`home_player_X9` INTEGER,
`home_player_X10` INTEGER,
`home_player_X11` INTEGER,
`away_player_X1` INTEGER,
`away_player_X2` INTEGER,
`away_player_X3` INTEGER,
`away_player_X4` INTEGER,
`away_player_X5` INTEGER,
`away_player_X6` INTEGER,
`away_player_X7` INTEGER,
`away_player_X8` INTEGER,
`away_player_X9` INTEGER,
`away_player_X10` INTEGER,
`away_player_X11` INTEGER,
`home_player_Y1` INTEGER,
`home_player_Y2` INTEGER,
`home_player_Y3` INTEGER,
`home_player_Y4` INTEGER,
`home_player_Y5` INTEGER,
`home_player_Y6` INTEGER,
`home_player_Y7` INTEGER,
`home_player_Y8` INTEGER,
`home_player_Y9` INTEGER,
`home_player_Y10` INTEGER,
`home_player_Y11` INTEGER,
`away_player_Y1` INTEGER,
`away_player_Y2` INTEGER,
`away_player_Y3` INTEGER,
`away_player_Y4` INTEGER,
`away_player_Y5` INTEGER,
`away_player_Y6` INTEGER,
`away_player_Y7` INTEGER,
`away_player_Y8` INTEGER,
`away_player_Y9` INTEGER,
`away_player_Y10` INTEGER,
`away_player_Y11` INTEGER,
`home_player_1` INTEGER,
`home_player_2` INTEGER,
`home_player_3` INTEGER,
`home_player_4` INTEGER,
`home_player_5` INTEGER,
`home_player_6` INTEGER,
`home_player_7` INTEGER,
`home_player_8` INTEGER,
`home_player_9` INTEGER,
`home_player_10` INTEGER,
`home_player_11` INTEGER,
`away_player_1` INTEGER,
`away_player_2` INTEGER,
`away_player_3` INTEGER,
`away_player_4` INTEGER,
`away_player_5` INTEGER,
`away_player_6` INTEGER,
`away_player_7` INTEGER,
`away_player_8` INTEGER,
`away_player_9` INTEGER,
`away_player_10` INTEGER,
`away_player_11` INTEGER,
`goal` TEXT,
`shoton` TEXT,
`shotoff` TEXT,
`foulcommit` TEXT,
`card` TEXT,
`cross` TEXT,
`corner` TEXT,
`possession` TEXT,
`B365H` NUMERIC,
`B365D` NUMERIC,
`B365A` NUMERIC,
`BWH` NUMERIC,
`BWD` NUMERIC,
`BWA` NUMERIC,
`IWH` NUMERIC,
`IWD` NUMERIC,
`IWA` NUMERIC,
`LBH` NUMERIC,
`LBD` NUMERIC,
`LBA` NUMERIC,
`PSH` NUMERIC,
`PSD` NUMERIC,
`PSA` NUMERIC,
`WHH` NUMERIC,
`WHD` NUMERIC,
`WHA` NUMERIC,
`SJH` NUMERIC,
`SJD` NUMERIC,
`SJA` NUMERIC,
`VCH` NUMERIC,
`VCD` NUMERIC,
`VCA` NUMERIC,
`GBH` NUMERIC,
`GBD` NUMERIC,
`GBA` NUMERIC,
`BSH` NUMERIC,
`BSD` NUMERIC,
`BSA` NUMERIC,
FOREIGN KEY(`country_id`) REFERENCES `Country`(`id`),
FOREIGN KEY(`league_id`) REFERENCES `League`(`id`),
FOREIGN KEY(`home_team_api_id`) REFERENCES `Team`(`team_api_id`),
FOREIGN KEY(`away_team_api_id`) REFERENCES `Team`(`team_api_id`),
FOREIGN KEY(`home_player_1`) REFERENCES `Player`(`player_api_id`),
FOREIGN KEY(`home_player_2`) REFERENCES `Player`(`player_api_id`),
FOREIGN KEY(`home_player_3`) REFERENCES `Player`(`player_api_id`),
FOREIGN KEY(`home_player_4`) REFERENCES `Player`(`player_api_id`),
FOREIGN KEY(`home_player_5`) REFERENCES `Player`(`player_api_id`),
FOREIGN KEY(`home_player_6`) REFERENCES `Player`(`player_api_id`),
FOREIGN KEY(`home_player_7`) REFERENCES `Player`(`player_api_id`),
FOREIGN KEY(`home_player_8`) REFERENCES `Player`(`player_api_id`),
FOREIGN KEY(`home_player_9`) REFERENCES `Player`(`player_api_id`),
FOREIGN KEY(`home_player_10`) REFERENCES `Player`(`player_api_id`),
FOREIGN KEY(`home_player_11`) REFERENCES `Player`(`player_api_id`),
FOREIGN KEY(`away_player_1`) REFERENCES `Player`(`player_api_id`),
FOREIGN KEY(`away_player_2`) REFERENCES `Player`(`player_api_id`),
FOREIGN KEY(`away_player_3`) REFERENCES `Player`(`player_api_id`),
FOREIGN KEY(`away_player_4`) REFERENCES `Player`(`player_api_id`),
FOREIGN KEY(`away_player_5`) REFERENCES `Player`(`player_api_id`),
FOREIGN KEY(`away_player_6`) REFERENCES `Player`(`player_api_id`),
FOREIGN KEY(`away_player_7`) REFERENCES `Player`(`player_api_id`),
FOREIGN KEY(`away_player_8`) REFERENCES `Player`(`player_api_id`),
FOREIGN KEY(`away_player_9`) REFERENCES `Player`(`player_api_id`),
FOREIGN KEY(`away_player_10`) REFERENCES `Player`(`player_api_id`),
FOREIGN KEY(`away_player_11`) REFERENCES `Player`(`player_api_id`)
);
CREATE TABLE `League` (
`id` INTEGER PRIMARY KEY AUTOINCREMENT,
`country_id` INTEGER,
`name` TEXT UNIQUE,
FOREIGN KEY(`country_id`) REFERENCES `Country`(`id`)
);
CREATE TABLE `Country` (
`id` INTEGER PRIMARY KEY AUTOINCREMENT,
`name` TEXT UNIQUE
);
CREATE TABLE "Team" (
`id` INTEGER PRIMARY KEY AUTOINCREMENT,
`team_api_id` INTEGER UNIQUE,
`team_fifa_api_id` INTEGER,
`team_long_name` TEXT,
`team_short_name` TEXT
);
CREATE TABLE `Team_Attributes` (
`id` INTEGER PRIMARY KEY AUTOINCREMENT,
`team_fifa_api_id` INTEGER,
`team_api_id` INTEGER,
`date` TEXT,
`buildUpPlaySpeed` INTEGER,
`buildUpPlaySpeedClass` TEXT,
`buildUpPlayDribbling` INTEGER,
`buildUpPlayDribblingClass` TEXT,
`buildUpPlayPassing` INTEGER,
`buildUpPlayPassingClass` TEXT,
`buildUpPlayPositioningClass` TEXT,
`chanceCreationPassing` INTEGER,
`chanceCreationPassingClass` TEXT,
`chanceCreationCrossing` INTEGER,
`chanceCreationCrossingClass` TEXT,
`chanceCreationShooting` INTEGER,
`chanceCreationShootingClass` TEXT,
`chanceCreationPositioningClass` TEXT,
`defencePressure` INTEGER,
`defencePressureClass` TEXT,
`defenceAggression` INTEGER,
`defenceAggressionClass` TEXT,
`defenceTeamWidth` INTEGER,
`defenceTeamWidthClass` TEXT,
`defenceDefenderLineClass` TEXT,
FOREIGN KEY(`team_fifa_api_id`) REFERENCES `Team`(`team_fifa_api_id`),
FOREIGN KEY(`team_api_id`) REFERENCES `Team`(`team_api_id`)
);
INSERT INTO "Player_Attributes" VALUES(1,218353,505942,'2016-02-18 00:00:00',67,71,'right','medium','medium',49,44,71,61,44,51,45,39,64,49,60,64,59,47,65,55,58,54,76,35,71,70,45,54,48,65,69,69,6,11,10,8,8);
INSERT INTO "Player" VALUES(1,505942,'Aaron Appindangoye',218353,'1992-02-29 00:00:00',182.88,187);
INSERT INTO "Match" VALUES(1,1,1,'2008/2009',1,'2008-08-17 00:00:00',492473,9987,9993,1,1,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,1.73,3.4,5,1.75,3.35,4.2,1.85,3.2,3.5,1.8,3.3,3.75,NULL,NULL,NULL,1.7,3.3,4.33,1.9,3.3,4,1.65,3.4,4.5,1.78,3.25,4,1.73,3.4,4.2);
INSERT INTO "League" VALUES(1,1,'Belgium Jupiler League');
INSERT INTO "Country" VALUES(1,'Belgium');
INSERT INTO "Team" VALUES(1,9987,673,'KRC Genk','GEN');
INSERT INTO "Team_Attributes" VALUES(1,434,9930,'2010-02-22 00:00:00',60,'Balanced',NULL,'Little',50,'Mixed','Organised',60,'Normal',65,'Normal',55,'Normal','Organised',50,'Medium',55,'Press',45,'Normal','Cover'); |
soccer_1 | 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) | What are the names of players who have the best dribbling? | CREATE TABLE "Player_Attributes" (
`id` INTEGER PRIMARY KEY AUTOINCREMENT,
`player_fifa_api_id` INTEGER,
`player_api_id` INTEGER,
`date` TEXT,
`overall_rating` INTEGER,
`potential` INTEGER,
`preferred_foot` TEXT,
`attacking_work_rate` TEXT,
`defensive_work_rate` TEXT,
`crossing` INTEGER,
`finishing` INTEGER,
`heading_accuracy` INTEGER,
`short_passing` INTEGER,
`volleys` INTEGER,
`dribbling` INTEGER,
`curve` INTEGER,
`free_kick_accuracy` INTEGER,
`long_passing` INTEGER,
`ball_control` INTEGER,
`acceleration` INTEGER,
`sprint_speed` INTEGER,
`agility` INTEGER,
`reactions` INTEGER,
`balance` INTEGER,
`shot_power` INTEGER,
`jumping` INTEGER,
`stamina` INTEGER,
`strength` INTEGER,
`long_shots` INTEGER,
`aggression` INTEGER,
`interceptions` INTEGER,
`positioning` INTEGER,
`vision` INTEGER,
`penalties` INTEGER,
`marking` INTEGER,
`standing_tackle` INTEGER,
`sliding_tackle` INTEGER,
`gk_diving` INTEGER,
`gk_handling` INTEGER,
`gk_kicking` INTEGER,
`gk_positioning` INTEGER,
`gk_reflexes` INTEGER,
FOREIGN KEY(`player_fifa_api_id`) REFERENCES `Player`(`player_fifa_api_id`),
FOREIGN KEY(`player_api_id`) REFERENCES `Player`(`player_api_id`)
);
CREATE TABLE `Player` (
`id` INTEGER PRIMARY KEY AUTOINCREMENT,
`player_api_id` INTEGER UNIQUE,
`player_name` TEXT,
`player_fifa_api_id` INTEGER UNIQUE,
`birthday` TEXT,
`height` INTEGER,
`weight` INTEGER
);
CREATE TABLE `Match` (
`id` INTEGER PRIMARY KEY AUTOINCREMENT,
`country_id` INTEGER,
`league_id` INTEGER,
`season` TEXT,
`stage` INTEGER,
`date` TEXT,
`match_api_id` INTEGER UNIQUE,
`home_team_api_id` INTEGER,
`away_team_api_id` INTEGER,
`home_team_goal` INTEGER,
`away_team_goal` INTEGER,
`home_player_X1` INTEGER,
`home_player_X2` INTEGER,
`home_player_X3` INTEGER,
`home_player_X4` INTEGER,
`home_player_X5` INTEGER,
`home_player_X6` INTEGER,
`home_player_X7` INTEGER,
`home_player_X8` INTEGER,
`home_player_X9` INTEGER,
`home_player_X10` INTEGER,
`home_player_X11` INTEGER,
`away_player_X1` INTEGER,
`away_player_X2` INTEGER,
`away_player_X3` INTEGER,
`away_player_X4` INTEGER,
`away_player_X5` INTEGER,
`away_player_X6` INTEGER,
`away_player_X7` INTEGER,
`away_player_X8` INTEGER,
`away_player_X9` INTEGER,
`away_player_X10` INTEGER,
`away_player_X11` INTEGER,
`home_player_Y1` INTEGER,
`home_player_Y2` INTEGER,
`home_player_Y3` INTEGER,
`home_player_Y4` INTEGER,
`home_player_Y5` INTEGER,
`home_player_Y6` INTEGER,
`home_player_Y7` INTEGER,
`home_player_Y8` INTEGER,
`home_player_Y9` INTEGER,
`home_player_Y10` INTEGER,
`home_player_Y11` INTEGER,
`away_player_Y1` INTEGER,
`away_player_Y2` INTEGER,
`away_player_Y3` INTEGER,
`away_player_Y4` INTEGER,
`away_player_Y5` INTEGER,
`away_player_Y6` INTEGER,
`away_player_Y7` INTEGER,
`away_player_Y8` INTEGER,
`away_player_Y9` INTEGER,
`away_player_Y10` INTEGER,
`away_player_Y11` INTEGER,
`home_player_1` INTEGER,
`home_player_2` INTEGER,
`home_player_3` INTEGER,
`home_player_4` INTEGER,
`home_player_5` INTEGER,
`home_player_6` INTEGER,
`home_player_7` INTEGER,
`home_player_8` INTEGER,
`home_player_9` INTEGER,
`home_player_10` INTEGER,
`home_player_11` INTEGER,
`away_player_1` INTEGER,
`away_player_2` INTEGER,
`away_player_3` INTEGER,
`away_player_4` INTEGER,
`away_player_5` INTEGER,
`away_player_6` INTEGER,
`away_player_7` INTEGER,
`away_player_8` INTEGER,
`away_player_9` INTEGER,
`away_player_10` INTEGER,
`away_player_11` INTEGER,
`goal` TEXT,
`shoton` TEXT,
`shotoff` TEXT,
`foulcommit` TEXT,
`card` TEXT,
`cross` TEXT,
`corner` TEXT,
`possession` TEXT,
`B365H` NUMERIC,
`B365D` NUMERIC,
`B365A` NUMERIC,
`BWH` NUMERIC,
`BWD` NUMERIC,
`BWA` NUMERIC,
`IWH` NUMERIC,
`IWD` NUMERIC,
`IWA` NUMERIC,
`LBH` NUMERIC,
`LBD` NUMERIC,
`LBA` NUMERIC,
`PSH` NUMERIC,
`PSD` NUMERIC,
`PSA` NUMERIC,
`WHH` NUMERIC,
`WHD` NUMERIC,
`WHA` NUMERIC,
`SJH` NUMERIC,
`SJD` NUMERIC,
`SJA` NUMERIC,
`VCH` NUMERIC,
`VCD` NUMERIC,
`VCA` NUMERIC,
`GBH` NUMERIC,
`GBD` NUMERIC,
`GBA` NUMERIC,
`BSH` NUMERIC,
`BSD` NUMERIC,
`BSA` NUMERIC,
FOREIGN KEY(`country_id`) REFERENCES `Country`(`id`),
FOREIGN KEY(`league_id`) REFERENCES `League`(`id`),
FOREIGN KEY(`home_team_api_id`) REFERENCES `Team`(`team_api_id`),
FOREIGN KEY(`away_team_api_id`) REFERENCES `Team`(`team_api_id`),
FOREIGN KEY(`home_player_1`) REFERENCES `Player`(`player_api_id`),
FOREIGN KEY(`home_player_2`) REFERENCES `Player`(`player_api_id`),
FOREIGN KEY(`home_player_3`) REFERENCES `Player`(`player_api_id`),
FOREIGN KEY(`home_player_4`) REFERENCES `Player`(`player_api_id`),
FOREIGN KEY(`home_player_5`) REFERENCES `Player`(`player_api_id`),
FOREIGN KEY(`home_player_6`) REFERENCES `Player`(`player_api_id`),
FOREIGN KEY(`home_player_7`) REFERENCES `Player`(`player_api_id`),
FOREIGN KEY(`home_player_8`) REFERENCES `Player`(`player_api_id`),
FOREIGN KEY(`home_player_9`) REFERENCES `Player`(`player_api_id`),
FOREIGN KEY(`home_player_10`) REFERENCES `Player`(`player_api_id`),
FOREIGN KEY(`home_player_11`) REFERENCES `Player`(`player_api_id`),
FOREIGN KEY(`away_player_1`) REFERENCES `Player`(`player_api_id`),
FOREIGN KEY(`away_player_2`) REFERENCES `Player`(`player_api_id`),
FOREIGN KEY(`away_player_3`) REFERENCES `Player`(`player_api_id`),
FOREIGN KEY(`away_player_4`) REFERENCES `Player`(`player_api_id`),
FOREIGN KEY(`away_player_5`) REFERENCES `Player`(`player_api_id`),
FOREIGN KEY(`away_player_6`) REFERENCES `Player`(`player_api_id`),
FOREIGN KEY(`away_player_7`) REFERENCES `Player`(`player_api_id`),
FOREIGN KEY(`away_player_8`) REFERENCES `Player`(`player_api_id`),
FOREIGN KEY(`away_player_9`) REFERENCES `Player`(`player_api_id`),
FOREIGN KEY(`away_player_10`) REFERENCES `Player`(`player_api_id`),
FOREIGN KEY(`away_player_11`) REFERENCES `Player`(`player_api_id`)
);
CREATE TABLE `League` (
`id` INTEGER PRIMARY KEY AUTOINCREMENT,
`country_id` INTEGER,
`name` TEXT UNIQUE,
FOREIGN KEY(`country_id`) REFERENCES `Country`(`id`)
);
CREATE TABLE `Country` (
`id` INTEGER PRIMARY KEY AUTOINCREMENT,
`name` TEXT UNIQUE
);
CREATE TABLE "Team" (
`id` INTEGER PRIMARY KEY AUTOINCREMENT,
`team_api_id` INTEGER UNIQUE,
`team_fifa_api_id` INTEGER,
`team_long_name` TEXT,
`team_short_name` TEXT
);
CREATE TABLE `Team_Attributes` (
`id` INTEGER PRIMARY KEY AUTOINCREMENT,
`team_fifa_api_id` INTEGER,
`team_api_id` INTEGER,
`date` TEXT,
`buildUpPlaySpeed` INTEGER,
`buildUpPlaySpeedClass` TEXT,
`buildUpPlayDribbling` INTEGER,
`buildUpPlayDribblingClass` TEXT,
`buildUpPlayPassing` INTEGER,
`buildUpPlayPassingClass` TEXT,
`buildUpPlayPositioningClass` TEXT,
`chanceCreationPassing` INTEGER,
`chanceCreationPassingClass` TEXT,
`chanceCreationCrossing` INTEGER,
`chanceCreationCrossingClass` TEXT,
`chanceCreationShooting` INTEGER,
`chanceCreationShootingClass` TEXT,
`chanceCreationPositioningClass` TEXT,
`defencePressure` INTEGER,
`defencePressureClass` TEXT,
`defenceAggression` INTEGER,
`defenceAggressionClass` TEXT,
`defenceTeamWidth` INTEGER,
`defenceTeamWidthClass` TEXT,
`defenceDefenderLineClass` TEXT,
FOREIGN KEY(`team_fifa_api_id`) REFERENCES `Team`(`team_fifa_api_id`),
FOREIGN KEY(`team_api_id`) REFERENCES `Team`(`team_api_id`)
);
INSERT INTO "Player_Attributes" VALUES(1,218353,505942,'2016-02-18 00:00:00',67,71,'right','medium','medium',49,44,71,61,44,51,45,39,64,49,60,64,59,47,65,55,58,54,76,35,71,70,45,54,48,65,69,69,6,11,10,8,8);
INSERT INTO "Player" VALUES(1,505942,'Aaron Appindangoye',218353,'1992-02-29 00:00:00',182.88,187);
INSERT INTO "Match" VALUES(1,1,1,'2008/2009',1,'2008-08-17 00:00:00',492473,9987,9993,1,1,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,1.73,3.4,5,1.75,3.35,4.2,1.85,3.2,3.5,1.8,3.3,3.75,NULL,NULL,NULL,1.7,3.3,4.33,1.9,3.3,4,1.65,3.4,4.5,1.78,3.25,4,1.73,3.4,4.2);
INSERT INTO "League" VALUES(1,1,'Belgium Jupiler League');
INSERT INTO "Country" VALUES(1,'Belgium');
INSERT INTO "Team" VALUES(1,9987,673,'KRC Genk','GEN');
INSERT INTO "Team_Attributes" VALUES(1,434,9930,'2010-02-22 00:00:00',60,'Balanced',NULL,'Little',50,'Mixed','Organised',60,'Normal',65,'Normal',55,'Normal','Organised',50,'Medium',55,'Press',45,'Normal','Cover'); |
soccer_1 | 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" | List the names of all players who have a crossing score higher than 90 and prefer their right foot. | CREATE TABLE "Player_Attributes" (
`id` INTEGER PRIMARY KEY AUTOINCREMENT,
`player_fifa_api_id` INTEGER,
`player_api_id` INTEGER,
`date` TEXT,
`overall_rating` INTEGER,
`potential` INTEGER,
`preferred_foot` TEXT,
`attacking_work_rate` TEXT,
`defensive_work_rate` TEXT,
`crossing` INTEGER,
`finishing` INTEGER,
`heading_accuracy` INTEGER,
`short_passing` INTEGER,
`volleys` INTEGER,
`dribbling` INTEGER,
`curve` INTEGER,
`free_kick_accuracy` INTEGER,
`long_passing` INTEGER,
`ball_control` INTEGER,
`acceleration` INTEGER,
`sprint_speed` INTEGER,
`agility` INTEGER,
`reactions` INTEGER,
`balance` INTEGER,
`shot_power` INTEGER,
`jumping` INTEGER,
`stamina` INTEGER,
`strength` INTEGER,
`long_shots` INTEGER,
`aggression` INTEGER,
`interceptions` INTEGER,
`positioning` INTEGER,
`vision` INTEGER,
`penalties` INTEGER,
`marking` INTEGER,
`standing_tackle` INTEGER,
`sliding_tackle` INTEGER,
`gk_diving` INTEGER,
`gk_handling` INTEGER,
`gk_kicking` INTEGER,
`gk_positioning` INTEGER,
`gk_reflexes` INTEGER,
FOREIGN KEY(`player_fifa_api_id`) REFERENCES `Player`(`player_fifa_api_id`),
FOREIGN KEY(`player_api_id`) REFERENCES `Player`(`player_api_id`)
);
CREATE TABLE `Player` (
`id` INTEGER PRIMARY KEY AUTOINCREMENT,
`player_api_id` INTEGER UNIQUE,
`player_name` TEXT,
`player_fifa_api_id` INTEGER UNIQUE,
`birthday` TEXT,
`height` INTEGER,
`weight` INTEGER
);
CREATE TABLE `Match` (
`id` INTEGER PRIMARY KEY AUTOINCREMENT,
`country_id` INTEGER,
`league_id` INTEGER,
`season` TEXT,
`stage` INTEGER,
`date` TEXT,
`match_api_id` INTEGER UNIQUE,
`home_team_api_id` INTEGER,
`away_team_api_id` INTEGER,
`home_team_goal` INTEGER,
`away_team_goal` INTEGER,
`home_player_X1` INTEGER,
`home_player_X2` INTEGER,
`home_player_X3` INTEGER,
`home_player_X4` INTEGER,
`home_player_X5` INTEGER,
`home_player_X6` INTEGER,
`home_player_X7` INTEGER,
`home_player_X8` INTEGER,
`home_player_X9` INTEGER,
`home_player_X10` INTEGER,
`home_player_X11` INTEGER,
`away_player_X1` INTEGER,
`away_player_X2` INTEGER,
`away_player_X3` INTEGER,
`away_player_X4` INTEGER,
`away_player_X5` INTEGER,
`away_player_X6` INTEGER,
`away_player_X7` INTEGER,
`away_player_X8` INTEGER,
`away_player_X9` INTEGER,
`away_player_X10` INTEGER,
`away_player_X11` INTEGER,
`home_player_Y1` INTEGER,
`home_player_Y2` INTEGER,
`home_player_Y3` INTEGER,
`home_player_Y4` INTEGER,
`home_player_Y5` INTEGER,
`home_player_Y6` INTEGER,
`home_player_Y7` INTEGER,
`home_player_Y8` INTEGER,
`home_player_Y9` INTEGER,
`home_player_Y10` INTEGER,
`home_player_Y11` INTEGER,
`away_player_Y1` INTEGER,
`away_player_Y2` INTEGER,
`away_player_Y3` INTEGER,
`away_player_Y4` INTEGER,
`away_player_Y5` INTEGER,
`away_player_Y6` INTEGER,
`away_player_Y7` INTEGER,
`away_player_Y8` INTEGER,
`away_player_Y9` INTEGER,
`away_player_Y10` INTEGER,
`away_player_Y11` INTEGER,
`home_player_1` INTEGER,
`home_player_2` INTEGER,
`home_player_3` INTEGER,
`home_player_4` INTEGER,
`home_player_5` INTEGER,
`home_player_6` INTEGER,
`home_player_7` INTEGER,
`home_player_8` INTEGER,
`home_player_9` INTEGER,
`home_player_10` INTEGER,
`home_player_11` INTEGER,
`away_player_1` INTEGER,
`away_player_2` INTEGER,
`away_player_3` INTEGER,
`away_player_4` INTEGER,
`away_player_5` INTEGER,
`away_player_6` INTEGER,
`away_player_7` INTEGER,
`away_player_8` INTEGER,
`away_player_9` INTEGER,
`away_player_10` INTEGER,
`away_player_11` INTEGER,
`goal` TEXT,
`shoton` TEXT,
`shotoff` TEXT,
`foulcommit` TEXT,
`card` TEXT,
`cross` TEXT,
`corner` TEXT,
`possession` TEXT,
`B365H` NUMERIC,
`B365D` NUMERIC,
`B365A` NUMERIC,
`BWH` NUMERIC,
`BWD` NUMERIC,
`BWA` NUMERIC,
`IWH` NUMERIC,
`IWD` NUMERIC,
`IWA` NUMERIC,
`LBH` NUMERIC,
`LBD` NUMERIC,
`LBA` NUMERIC,
`PSH` NUMERIC,
`PSD` NUMERIC,
`PSA` NUMERIC,
`WHH` NUMERIC,
`WHD` NUMERIC,
`WHA` NUMERIC,
`SJH` NUMERIC,
`SJD` NUMERIC,
`SJA` NUMERIC,
`VCH` NUMERIC,
`VCD` NUMERIC,
`VCA` NUMERIC,
`GBH` NUMERIC,
`GBD` NUMERIC,
`GBA` NUMERIC,
`BSH` NUMERIC,
`BSD` NUMERIC,
`BSA` NUMERIC,
FOREIGN KEY(`country_id`) REFERENCES `Country`(`id`),
FOREIGN KEY(`league_id`) REFERENCES `League`(`id`),
FOREIGN KEY(`home_team_api_id`) REFERENCES `Team`(`team_api_id`),
FOREIGN KEY(`away_team_api_id`) REFERENCES `Team`(`team_api_id`),
FOREIGN KEY(`home_player_1`) REFERENCES `Player`(`player_api_id`),
FOREIGN KEY(`home_player_2`) REFERENCES `Player`(`player_api_id`),
FOREIGN KEY(`home_player_3`) REFERENCES `Player`(`player_api_id`),
FOREIGN KEY(`home_player_4`) REFERENCES `Player`(`player_api_id`),
FOREIGN KEY(`home_player_5`) REFERENCES `Player`(`player_api_id`),
FOREIGN KEY(`home_player_6`) REFERENCES `Player`(`player_api_id`),
FOREIGN KEY(`home_player_7`) REFERENCES `Player`(`player_api_id`),
FOREIGN KEY(`home_player_8`) REFERENCES `Player`(`player_api_id`),
FOREIGN KEY(`home_player_9`) REFERENCES `Player`(`player_api_id`),
FOREIGN KEY(`home_player_10`) REFERENCES `Player`(`player_api_id`),
FOREIGN KEY(`home_player_11`) REFERENCES `Player`(`player_api_id`),
FOREIGN KEY(`away_player_1`) REFERENCES `Player`(`player_api_id`),
FOREIGN KEY(`away_player_2`) REFERENCES `Player`(`player_api_id`),
FOREIGN KEY(`away_player_3`) REFERENCES `Player`(`player_api_id`),
FOREIGN KEY(`away_player_4`) REFERENCES `Player`(`player_api_id`),
FOREIGN KEY(`away_player_5`) REFERENCES `Player`(`player_api_id`),
FOREIGN KEY(`away_player_6`) REFERENCES `Player`(`player_api_id`),
FOREIGN KEY(`away_player_7`) REFERENCES `Player`(`player_api_id`),
FOREIGN KEY(`away_player_8`) REFERENCES `Player`(`player_api_id`),
FOREIGN KEY(`away_player_9`) REFERENCES `Player`(`player_api_id`),
FOREIGN KEY(`away_player_10`) REFERENCES `Player`(`player_api_id`),
FOREIGN KEY(`away_player_11`) REFERENCES `Player`(`player_api_id`)
);
CREATE TABLE `League` (
`id` INTEGER PRIMARY KEY AUTOINCREMENT,
`country_id` INTEGER,
`name` TEXT UNIQUE,
FOREIGN KEY(`country_id`) REFERENCES `Country`(`id`)
);
CREATE TABLE `Country` (
`id` INTEGER PRIMARY KEY AUTOINCREMENT,
`name` TEXT UNIQUE
);
CREATE TABLE "Team" (
`id` INTEGER PRIMARY KEY AUTOINCREMENT,
`team_api_id` INTEGER UNIQUE,
`team_fifa_api_id` INTEGER,
`team_long_name` TEXT,
`team_short_name` TEXT
);
CREATE TABLE `Team_Attributes` (
`id` INTEGER PRIMARY KEY AUTOINCREMENT,
`team_fifa_api_id` INTEGER,
`team_api_id` INTEGER,
`date` TEXT,
`buildUpPlaySpeed` INTEGER,
`buildUpPlaySpeedClass` TEXT,
`buildUpPlayDribbling` INTEGER,
`buildUpPlayDribblingClass` TEXT,
`buildUpPlayPassing` INTEGER,
`buildUpPlayPassingClass` TEXT,
`buildUpPlayPositioningClass` TEXT,
`chanceCreationPassing` INTEGER,
`chanceCreationPassingClass` TEXT,
`chanceCreationCrossing` INTEGER,
`chanceCreationCrossingClass` TEXT,
`chanceCreationShooting` INTEGER,
`chanceCreationShootingClass` TEXT,
`chanceCreationPositioningClass` TEXT,
`defencePressure` INTEGER,
`defencePressureClass` TEXT,
`defenceAggression` INTEGER,
`defenceAggressionClass` TEXT,
`defenceTeamWidth` INTEGER,
`defenceTeamWidthClass` TEXT,
`defenceDefenderLineClass` TEXT,
FOREIGN KEY(`team_fifa_api_id`) REFERENCES `Team`(`team_fifa_api_id`),
FOREIGN KEY(`team_api_id`) REFERENCES `Team`(`team_api_id`)
);
INSERT INTO "Player_Attributes" VALUES(1,218353,505942,'2016-02-18 00:00:00',67,71,'right','medium','medium',49,44,71,61,44,51,45,39,64,49,60,64,59,47,65,55,58,54,76,35,71,70,45,54,48,65,69,69,6,11,10,8,8);
INSERT INTO "Player" VALUES(1,505942,'Aaron Appindangoye',218353,'1992-02-29 00:00:00',182.88,187);
INSERT INTO "Match" VALUES(1,1,1,'2008/2009',1,'2008-08-17 00:00:00',492473,9987,9993,1,1,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,1.73,3.4,5,1.75,3.35,4.2,1.85,3.2,3.5,1.8,3.3,3.75,NULL,NULL,NULL,1.7,3.3,4.33,1.9,3.3,4,1.65,3.4,4.5,1.78,3.25,4,1.73,3.4,4.2);
INSERT INTO "League" VALUES(1,1,'Belgium Jupiler League');
INSERT INTO "Country" VALUES(1,'Belgium');
INSERT INTO "Team" VALUES(1,9987,673,'KRC Genk','GEN');
INSERT INTO "Team_Attributes" VALUES(1,434,9930,'2010-02-22 00:00:00',60,'Balanced',NULL,'Little',50,'Mixed','Organised',60,'Normal',65,'Normal',55,'Normal','Organised',50,'Medium',55,'Press',45,'Normal','Cover'); |
soccer_1 | 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.preferred_foot = "left" AND T2.overall_rating >= 85 AND T2.overall_rating <= 90 | List the names of all left-footed players who have overall rating between 85 and 90. | CREATE TABLE "Player_Attributes" (
`id` INTEGER PRIMARY KEY AUTOINCREMENT,
`player_fifa_api_id` INTEGER,
`player_api_id` INTEGER,
`date` TEXT,
`overall_rating` INTEGER,
`potential` INTEGER,
`preferred_foot` TEXT,
`attacking_work_rate` TEXT,
`defensive_work_rate` TEXT,
`crossing` INTEGER,
`finishing` INTEGER,
`heading_accuracy` INTEGER,
`short_passing` INTEGER,
`volleys` INTEGER,
`dribbling` INTEGER,
`curve` INTEGER,
`free_kick_accuracy` INTEGER,
`long_passing` INTEGER,
`ball_control` INTEGER,
`acceleration` INTEGER,
`sprint_speed` INTEGER,
`agility` INTEGER,
`reactions` INTEGER,
`balance` INTEGER,
`shot_power` INTEGER,
`jumping` INTEGER,
`stamina` INTEGER,
`strength` INTEGER,
`long_shots` INTEGER,
`aggression` INTEGER,
`interceptions` INTEGER,
`positioning` INTEGER,
`vision` INTEGER,
`penalties` INTEGER,
`marking` INTEGER,
`standing_tackle` INTEGER,
`sliding_tackle` INTEGER,
`gk_diving` INTEGER,
`gk_handling` INTEGER,
`gk_kicking` INTEGER,
`gk_positioning` INTEGER,
`gk_reflexes` INTEGER,
FOREIGN KEY(`player_fifa_api_id`) REFERENCES `Player`(`player_fifa_api_id`),
FOREIGN KEY(`player_api_id`) REFERENCES `Player`(`player_api_id`)
);
CREATE TABLE `Player` (
`id` INTEGER PRIMARY KEY AUTOINCREMENT,
`player_api_id` INTEGER UNIQUE,
`player_name` TEXT,
`player_fifa_api_id` INTEGER UNIQUE,
`birthday` TEXT,
`height` INTEGER,
`weight` INTEGER
);
CREATE TABLE `Match` (
`id` INTEGER PRIMARY KEY AUTOINCREMENT,
`country_id` INTEGER,
`league_id` INTEGER,
`season` TEXT,
`stage` INTEGER,
`date` TEXT,
`match_api_id` INTEGER UNIQUE,
`home_team_api_id` INTEGER,
`away_team_api_id` INTEGER,
`home_team_goal` INTEGER,
`away_team_goal` INTEGER,
`home_player_X1` INTEGER,
`home_player_X2` INTEGER,
`home_player_X3` INTEGER,
`home_player_X4` INTEGER,
`home_player_X5` INTEGER,
`home_player_X6` INTEGER,
`home_player_X7` INTEGER,
`home_player_X8` INTEGER,
`home_player_X9` INTEGER,
`home_player_X10` INTEGER,
`home_player_X11` INTEGER,
`away_player_X1` INTEGER,
`away_player_X2` INTEGER,
`away_player_X3` INTEGER,
`away_player_X4` INTEGER,
`away_player_X5` INTEGER,
`away_player_X6` INTEGER,
`away_player_X7` INTEGER,
`away_player_X8` INTEGER,
`away_player_X9` INTEGER,
`away_player_X10` INTEGER,
`away_player_X11` INTEGER,
`home_player_Y1` INTEGER,
`home_player_Y2` INTEGER,
`home_player_Y3` INTEGER,
`home_player_Y4` INTEGER,
`home_player_Y5` INTEGER,
`home_player_Y6` INTEGER,
`home_player_Y7` INTEGER,
`home_player_Y8` INTEGER,
`home_player_Y9` INTEGER,
`home_player_Y10` INTEGER,
`home_player_Y11` INTEGER,
`away_player_Y1` INTEGER,
`away_player_Y2` INTEGER,
`away_player_Y3` INTEGER,
`away_player_Y4` INTEGER,
`away_player_Y5` INTEGER,
`away_player_Y6` INTEGER,
`away_player_Y7` INTEGER,
`away_player_Y8` INTEGER,
`away_player_Y9` INTEGER,
`away_player_Y10` INTEGER,
`away_player_Y11` INTEGER,
`home_player_1` INTEGER,
`home_player_2` INTEGER,
`home_player_3` INTEGER,
`home_player_4` INTEGER,
`home_player_5` INTEGER,
`home_player_6` INTEGER,
`home_player_7` INTEGER,
`home_player_8` INTEGER,
`home_player_9` INTEGER,
`home_player_10` INTEGER,
`home_player_11` INTEGER,
`away_player_1` INTEGER,
`away_player_2` INTEGER,
`away_player_3` INTEGER,
`away_player_4` INTEGER,
`away_player_5` INTEGER,
`away_player_6` INTEGER,
`away_player_7` INTEGER,
`away_player_8` INTEGER,
`away_player_9` INTEGER,
`away_player_10` INTEGER,
`away_player_11` INTEGER,
`goal` TEXT,
`shoton` TEXT,
`shotoff` TEXT,
`foulcommit` TEXT,
`card` TEXT,
`cross` TEXT,
`corner` TEXT,
`possession` TEXT,
`B365H` NUMERIC,
`B365D` NUMERIC,
`B365A` NUMERIC,
`BWH` NUMERIC,
`BWD` NUMERIC,
`BWA` NUMERIC,
`IWH` NUMERIC,
`IWD` NUMERIC,
`IWA` NUMERIC,
`LBH` NUMERIC,
`LBD` NUMERIC,
`LBA` NUMERIC,
`PSH` NUMERIC,
`PSD` NUMERIC,
`PSA` NUMERIC,
`WHH` NUMERIC,
`WHD` NUMERIC,
`WHA` NUMERIC,
`SJH` NUMERIC,
`SJD` NUMERIC,
`SJA` NUMERIC,
`VCH` NUMERIC,
`VCD` NUMERIC,
`VCA` NUMERIC,
`GBH` NUMERIC,
`GBD` NUMERIC,
`GBA` NUMERIC,
`BSH` NUMERIC,
`BSD` NUMERIC,
`BSA` NUMERIC,
FOREIGN KEY(`country_id`) REFERENCES `Country`(`id`),
FOREIGN KEY(`league_id`) REFERENCES `League`(`id`),
FOREIGN KEY(`home_team_api_id`) REFERENCES `Team`(`team_api_id`),
FOREIGN KEY(`away_team_api_id`) REFERENCES `Team`(`team_api_id`),
FOREIGN KEY(`home_player_1`) REFERENCES `Player`(`player_api_id`),
FOREIGN KEY(`home_player_2`) REFERENCES `Player`(`player_api_id`),
FOREIGN KEY(`home_player_3`) REFERENCES `Player`(`player_api_id`),
FOREIGN KEY(`home_player_4`) REFERENCES `Player`(`player_api_id`),
FOREIGN KEY(`home_player_5`) REFERENCES `Player`(`player_api_id`),
FOREIGN KEY(`home_player_6`) REFERENCES `Player`(`player_api_id`),
FOREIGN KEY(`home_player_7`) REFERENCES `Player`(`player_api_id`),
FOREIGN KEY(`home_player_8`) REFERENCES `Player`(`player_api_id`),
FOREIGN KEY(`home_player_9`) REFERENCES `Player`(`player_api_id`),
FOREIGN KEY(`home_player_10`) REFERENCES `Player`(`player_api_id`),
FOREIGN KEY(`home_player_11`) REFERENCES `Player`(`player_api_id`),
FOREIGN KEY(`away_player_1`) REFERENCES `Player`(`player_api_id`),
FOREIGN KEY(`away_player_2`) REFERENCES `Player`(`player_api_id`),
FOREIGN KEY(`away_player_3`) REFERENCES `Player`(`player_api_id`),
FOREIGN KEY(`away_player_4`) REFERENCES `Player`(`player_api_id`),
FOREIGN KEY(`away_player_5`) REFERENCES `Player`(`player_api_id`),
FOREIGN KEY(`away_player_6`) REFERENCES `Player`(`player_api_id`),
FOREIGN KEY(`away_player_7`) REFERENCES `Player`(`player_api_id`),
FOREIGN KEY(`away_player_8`) REFERENCES `Player`(`player_api_id`),
FOREIGN KEY(`away_player_9`) REFERENCES `Player`(`player_api_id`),
FOREIGN KEY(`away_player_10`) REFERENCES `Player`(`player_api_id`),
FOREIGN KEY(`away_player_11`) REFERENCES `Player`(`player_api_id`)
);
CREATE TABLE `League` (
`id` INTEGER PRIMARY KEY AUTOINCREMENT,
`country_id` INTEGER,
`name` TEXT UNIQUE,
FOREIGN KEY(`country_id`) REFERENCES `Country`(`id`)
);
CREATE TABLE `Country` (
`id` INTEGER PRIMARY KEY AUTOINCREMENT,
`name` TEXT UNIQUE
);
CREATE TABLE "Team" (
`id` INTEGER PRIMARY KEY AUTOINCREMENT,
`team_api_id` INTEGER UNIQUE,
`team_fifa_api_id` INTEGER,
`team_long_name` TEXT,
`team_short_name` TEXT
);
CREATE TABLE `Team_Attributes` (
`id` INTEGER PRIMARY KEY AUTOINCREMENT,
`team_fifa_api_id` INTEGER,
`team_api_id` INTEGER,
`date` TEXT,
`buildUpPlaySpeed` INTEGER,
`buildUpPlaySpeedClass` TEXT,
`buildUpPlayDribbling` INTEGER,
`buildUpPlayDribblingClass` TEXT,
`buildUpPlayPassing` INTEGER,
`buildUpPlayPassingClass` TEXT,
`buildUpPlayPositioningClass` TEXT,
`chanceCreationPassing` INTEGER,
`chanceCreationPassingClass` TEXT,
`chanceCreationCrossing` INTEGER,
`chanceCreationCrossingClass` TEXT,
`chanceCreationShooting` INTEGER,
`chanceCreationShootingClass` TEXT,
`chanceCreationPositioningClass` TEXT,
`defencePressure` INTEGER,
`defencePressureClass` TEXT,
`defenceAggression` INTEGER,
`defenceAggressionClass` TEXT,
`defenceTeamWidth` INTEGER,
`defenceTeamWidthClass` TEXT,
`defenceDefenderLineClass` TEXT,
FOREIGN KEY(`team_fifa_api_id`) REFERENCES `Team`(`team_fifa_api_id`),
FOREIGN KEY(`team_api_id`) REFERENCES `Team`(`team_api_id`)
);
INSERT INTO "Player_Attributes" VALUES(1,218353,505942,'2016-02-18 00:00:00',67,71,'right','medium','medium',49,44,71,61,44,51,45,39,64,49,60,64,59,47,65,55,58,54,76,35,71,70,45,54,48,65,69,69,6,11,10,8,8);
INSERT INTO "Player" VALUES(1,505942,'Aaron Appindangoye',218353,'1992-02-29 00:00:00',182.88,187);
INSERT INTO "Match" VALUES(1,1,1,'2008/2009',1,'2008-08-17 00:00:00',492473,9987,9993,1,1,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,1.73,3.4,5,1.75,3.35,4.2,1.85,3.2,3.5,1.8,3.3,3.75,NULL,NULL,NULL,1.7,3.3,4.33,1.9,3.3,4,1.65,3.4,4.5,1.78,3.25,4,1.73,3.4,4.2);
INSERT INTO "League" VALUES(1,1,'Belgium Jupiler League');
INSERT INTO "Country" VALUES(1,'Belgium');
INSERT INTO "Team" VALUES(1,9987,673,'KRC Genk','GEN');
INSERT INTO "Team_Attributes" VALUES(1,434,9930,'2010-02-22 00:00:00',60,'Balanced',NULL,'Little',50,'Mixed','Organised',60,'Normal',65,'Normal',55,'Normal','Organised',50,'Medium',55,'Press',45,'Normal','Cover'); |
soccer_1 | SELECT preferred_foot , avg(overall_rating) FROM Player_Attributes GROUP BY preferred_foot | What is the average rating for right-footed players and left-footed players? | CREATE TABLE "Player_Attributes" (
`id` INTEGER PRIMARY KEY AUTOINCREMENT,
`player_fifa_api_id` INTEGER,
`player_api_id` INTEGER,
`date` TEXT,
`overall_rating` INTEGER,
`potential` INTEGER,
`preferred_foot` TEXT,
`attacking_work_rate` TEXT,
`defensive_work_rate` TEXT,
`crossing` INTEGER,
`finishing` INTEGER,
`heading_accuracy` INTEGER,
`short_passing` INTEGER,
`volleys` INTEGER,
`dribbling` INTEGER,
`curve` INTEGER,
`free_kick_accuracy` INTEGER,
`long_passing` INTEGER,
`ball_control` INTEGER,
`acceleration` INTEGER,
`sprint_speed` INTEGER,
`agility` INTEGER,
`reactions` INTEGER,
`balance` INTEGER,
`shot_power` INTEGER,
`jumping` INTEGER,
`stamina` INTEGER,
`strength` INTEGER,
`long_shots` INTEGER,
`aggression` INTEGER,
`interceptions` INTEGER,
`positioning` INTEGER,
`vision` INTEGER,
`penalties` INTEGER,
`marking` INTEGER,
`standing_tackle` INTEGER,
`sliding_tackle` INTEGER,
`gk_diving` INTEGER,
`gk_handling` INTEGER,
`gk_kicking` INTEGER,
`gk_positioning` INTEGER,
`gk_reflexes` INTEGER,
FOREIGN KEY(`player_fifa_api_id`) REFERENCES `Player`(`player_fifa_api_id`),
FOREIGN KEY(`player_api_id`) REFERENCES `Player`(`player_api_id`)
);
CREATE TABLE `Player` (
`id` INTEGER PRIMARY KEY AUTOINCREMENT,
`player_api_id` INTEGER UNIQUE,
`player_name` TEXT,
`player_fifa_api_id` INTEGER UNIQUE,
`birthday` TEXT,
`height` INTEGER,
`weight` INTEGER
);
CREATE TABLE `Match` (
`id` INTEGER PRIMARY KEY AUTOINCREMENT,
`country_id` INTEGER,
`league_id` INTEGER,
`season` TEXT,
`stage` INTEGER,
`date` TEXT,
`match_api_id` INTEGER UNIQUE,
`home_team_api_id` INTEGER,
`away_team_api_id` INTEGER,
`home_team_goal` INTEGER,
`away_team_goal` INTEGER,
`home_player_X1` INTEGER,
`home_player_X2` INTEGER,
`home_player_X3` INTEGER,
`home_player_X4` INTEGER,
`home_player_X5` INTEGER,
`home_player_X6` INTEGER,
`home_player_X7` INTEGER,
`home_player_X8` INTEGER,
`home_player_X9` INTEGER,
`home_player_X10` INTEGER,
`home_player_X11` INTEGER,
`away_player_X1` INTEGER,
`away_player_X2` INTEGER,
`away_player_X3` INTEGER,
`away_player_X4` INTEGER,
`away_player_X5` INTEGER,
`away_player_X6` INTEGER,
`away_player_X7` INTEGER,
`away_player_X8` INTEGER,
`away_player_X9` INTEGER,
`away_player_X10` INTEGER,
`away_player_X11` INTEGER,
`home_player_Y1` INTEGER,
`home_player_Y2` INTEGER,
`home_player_Y3` INTEGER,
`home_player_Y4` INTEGER,
`home_player_Y5` INTEGER,
`home_player_Y6` INTEGER,
`home_player_Y7` INTEGER,
`home_player_Y8` INTEGER,
`home_player_Y9` INTEGER,
`home_player_Y10` INTEGER,
`home_player_Y11` INTEGER,
`away_player_Y1` INTEGER,
`away_player_Y2` INTEGER,
`away_player_Y3` INTEGER,
`away_player_Y4` INTEGER,
`away_player_Y5` INTEGER,
`away_player_Y6` INTEGER,
`away_player_Y7` INTEGER,
`away_player_Y8` INTEGER,
`away_player_Y9` INTEGER,
`away_player_Y10` INTEGER,
`away_player_Y11` INTEGER,
`home_player_1` INTEGER,
`home_player_2` INTEGER,
`home_player_3` INTEGER,
`home_player_4` INTEGER,
`home_player_5` INTEGER,
`home_player_6` INTEGER,
`home_player_7` INTEGER,
`home_player_8` INTEGER,
`home_player_9` INTEGER,
`home_player_10` INTEGER,
`home_player_11` INTEGER,
`away_player_1` INTEGER,
`away_player_2` INTEGER,
`away_player_3` INTEGER,
`away_player_4` INTEGER,
`away_player_5` INTEGER,
`away_player_6` INTEGER,
`away_player_7` INTEGER,
`away_player_8` INTEGER,
`away_player_9` INTEGER,
`away_player_10` INTEGER,
`away_player_11` INTEGER,
`goal` TEXT,
`shoton` TEXT,
`shotoff` TEXT,
`foulcommit` TEXT,
`card` TEXT,
`cross` TEXT,
`corner` TEXT,
`possession` TEXT,
`B365H` NUMERIC,
`B365D` NUMERIC,
`B365A` NUMERIC,
`BWH` NUMERIC,
`BWD` NUMERIC,
`BWA` NUMERIC,
`IWH` NUMERIC,
`IWD` NUMERIC,
`IWA` NUMERIC,
`LBH` NUMERIC,
`LBD` NUMERIC,
`LBA` NUMERIC,
`PSH` NUMERIC,
`PSD` NUMERIC,
`PSA` NUMERIC,
`WHH` NUMERIC,
`WHD` NUMERIC,
`WHA` NUMERIC,
`SJH` NUMERIC,
`SJD` NUMERIC,
`SJA` NUMERIC,
`VCH` NUMERIC,
`VCD` NUMERIC,
`VCA` NUMERIC,
`GBH` NUMERIC,
`GBD` NUMERIC,
`GBA` NUMERIC,
`BSH` NUMERIC,
`BSD` NUMERIC,
`BSA` NUMERIC,
FOREIGN KEY(`country_id`) REFERENCES `Country`(`id`),
FOREIGN KEY(`league_id`) REFERENCES `League`(`id`),
FOREIGN KEY(`home_team_api_id`) REFERENCES `Team`(`team_api_id`),
FOREIGN KEY(`away_team_api_id`) REFERENCES `Team`(`team_api_id`),
FOREIGN KEY(`home_player_1`) REFERENCES `Player`(`player_api_id`),
FOREIGN KEY(`home_player_2`) REFERENCES `Player`(`player_api_id`),
FOREIGN KEY(`home_player_3`) REFERENCES `Player`(`player_api_id`),
FOREIGN KEY(`home_player_4`) REFERENCES `Player`(`player_api_id`),
FOREIGN KEY(`home_player_5`) REFERENCES `Player`(`player_api_id`),
FOREIGN KEY(`home_player_6`) REFERENCES `Player`(`player_api_id`),
FOREIGN KEY(`home_player_7`) REFERENCES `Player`(`player_api_id`),
FOREIGN KEY(`home_player_8`) REFERENCES `Player`(`player_api_id`),
FOREIGN KEY(`home_player_9`) REFERENCES `Player`(`player_api_id`),
FOREIGN KEY(`home_player_10`) REFERENCES `Player`(`player_api_id`),
FOREIGN KEY(`home_player_11`) REFERENCES `Player`(`player_api_id`),
FOREIGN KEY(`away_player_1`) REFERENCES `Player`(`player_api_id`),
FOREIGN KEY(`away_player_2`) REFERENCES `Player`(`player_api_id`),
FOREIGN KEY(`away_player_3`) REFERENCES `Player`(`player_api_id`),
FOREIGN KEY(`away_player_4`) REFERENCES `Player`(`player_api_id`),
FOREIGN KEY(`away_player_5`) REFERENCES `Player`(`player_api_id`),
FOREIGN KEY(`away_player_6`) REFERENCES `Player`(`player_api_id`),
FOREIGN KEY(`away_player_7`) REFERENCES `Player`(`player_api_id`),
FOREIGN KEY(`away_player_8`) REFERENCES `Player`(`player_api_id`),
FOREIGN KEY(`away_player_9`) REFERENCES `Player`(`player_api_id`),
FOREIGN KEY(`away_player_10`) REFERENCES `Player`(`player_api_id`),
FOREIGN KEY(`away_player_11`) REFERENCES `Player`(`player_api_id`)
);
CREATE TABLE `League` (
`id` INTEGER PRIMARY KEY AUTOINCREMENT,
`country_id` INTEGER,
`name` TEXT UNIQUE,
FOREIGN KEY(`country_id`) REFERENCES `Country`(`id`)
);
CREATE TABLE `Country` (
`id` INTEGER PRIMARY KEY AUTOINCREMENT,
`name` TEXT UNIQUE
);
CREATE TABLE "Team" (
`id` INTEGER PRIMARY KEY AUTOINCREMENT,
`team_api_id` INTEGER UNIQUE,
`team_fifa_api_id` INTEGER,
`team_long_name` TEXT,
`team_short_name` TEXT
);
CREATE TABLE `Team_Attributes` (
`id` INTEGER PRIMARY KEY AUTOINCREMENT,
`team_fifa_api_id` INTEGER,
`team_api_id` INTEGER,
`date` TEXT,
`buildUpPlaySpeed` INTEGER,
`buildUpPlaySpeedClass` TEXT,
`buildUpPlayDribbling` INTEGER,
`buildUpPlayDribblingClass` TEXT,
`buildUpPlayPassing` INTEGER,
`buildUpPlayPassingClass` TEXT,
`buildUpPlayPositioningClass` TEXT,
`chanceCreationPassing` INTEGER,
`chanceCreationPassingClass` TEXT,
`chanceCreationCrossing` INTEGER,
`chanceCreationCrossingClass` TEXT,
`chanceCreationShooting` INTEGER,
`chanceCreationShootingClass` TEXT,
`chanceCreationPositioningClass` TEXT,
`defencePressure` INTEGER,
`defencePressureClass` TEXT,
`defenceAggression` INTEGER,
`defenceAggressionClass` TEXT,
`defenceTeamWidth` INTEGER,
`defenceTeamWidthClass` TEXT,
`defenceDefenderLineClass` TEXT,
FOREIGN KEY(`team_fifa_api_id`) REFERENCES `Team`(`team_fifa_api_id`),
FOREIGN KEY(`team_api_id`) REFERENCES `Team`(`team_api_id`)
);
INSERT INTO "Player_Attributes" VALUES(1,218353,505942,'2016-02-18 00:00:00',67,71,'right','medium','medium',49,44,71,61,44,51,45,39,64,49,60,64,59,47,65,55,58,54,76,35,71,70,45,54,48,65,69,69,6,11,10,8,8);
INSERT INTO "Player" VALUES(1,505942,'Aaron Appindangoye',218353,'1992-02-29 00:00:00',182.88,187);
INSERT INTO "Match" VALUES(1,1,1,'2008/2009',1,'2008-08-17 00:00:00',492473,9987,9993,1,1,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,1.73,3.4,5,1.75,3.35,4.2,1.85,3.2,3.5,1.8,3.3,3.75,NULL,NULL,NULL,1.7,3.3,4.33,1.9,3.3,4,1.65,3.4,4.5,1.78,3.25,4,1.73,3.4,4.2);
INSERT INTO "League" VALUES(1,1,'Belgium Jupiler League');
INSERT INTO "Country" VALUES(1,'Belgium');
INSERT INTO "Team" VALUES(1,9987,673,'KRC Genk','GEN');
INSERT INTO "Team_Attributes" VALUES(1,434,9930,'2010-02-22 00:00:00',60,'Balanced',NULL,'Little',50,'Mixed','Organised',60,'Normal',65,'Normal',55,'Normal','Organised',50,'Medium',55,'Press',45,'Normal','Cover'); |
soccer_1 | SELECT preferred_foot , count(*) FROM Player_Attributes WHERE overall_rating > 80 GROUP BY preferred_foot | Of all players with an overall rating greater than 80, how many are right-footed and left-footed? | CREATE TABLE "Player_Attributes" (
`id` INTEGER PRIMARY KEY AUTOINCREMENT,
`player_fifa_api_id` INTEGER,
`player_api_id` INTEGER,
`date` TEXT,
`overall_rating` INTEGER,
`potential` INTEGER,
`preferred_foot` TEXT,
`attacking_work_rate` TEXT,
`defensive_work_rate` TEXT,
`crossing` INTEGER,
`finishing` INTEGER,
`heading_accuracy` INTEGER,
`short_passing` INTEGER,
`volleys` INTEGER,
`dribbling` INTEGER,
`curve` INTEGER,
`free_kick_accuracy` INTEGER,
`long_passing` INTEGER,
`ball_control` INTEGER,
`acceleration` INTEGER,
`sprint_speed` INTEGER,
`agility` INTEGER,
`reactions` INTEGER,
`balance` INTEGER,
`shot_power` INTEGER,
`jumping` INTEGER,
`stamina` INTEGER,
`strength` INTEGER,
`long_shots` INTEGER,
`aggression` INTEGER,
`interceptions` INTEGER,
`positioning` INTEGER,
`vision` INTEGER,
`penalties` INTEGER,
`marking` INTEGER,
`standing_tackle` INTEGER,
`sliding_tackle` INTEGER,
`gk_diving` INTEGER,
`gk_handling` INTEGER,
`gk_kicking` INTEGER,
`gk_positioning` INTEGER,
`gk_reflexes` INTEGER,
FOREIGN KEY(`player_fifa_api_id`) REFERENCES `Player`(`player_fifa_api_id`),
FOREIGN KEY(`player_api_id`) REFERENCES `Player`(`player_api_id`)
);
CREATE TABLE `Player` (
`id` INTEGER PRIMARY KEY AUTOINCREMENT,
`player_api_id` INTEGER UNIQUE,
`player_name` TEXT,
`player_fifa_api_id` INTEGER UNIQUE,
`birthday` TEXT,
`height` INTEGER,
`weight` INTEGER
);
CREATE TABLE `Match` (
`id` INTEGER PRIMARY KEY AUTOINCREMENT,
`country_id` INTEGER,
`league_id` INTEGER,
`season` TEXT,
`stage` INTEGER,
`date` TEXT,
`match_api_id` INTEGER UNIQUE,
`home_team_api_id` INTEGER,
`away_team_api_id` INTEGER,
`home_team_goal` INTEGER,
`away_team_goal` INTEGER,
`home_player_X1` INTEGER,
`home_player_X2` INTEGER,
`home_player_X3` INTEGER,
`home_player_X4` INTEGER,
`home_player_X5` INTEGER,
`home_player_X6` INTEGER,
`home_player_X7` INTEGER,
`home_player_X8` INTEGER,
`home_player_X9` INTEGER,
`home_player_X10` INTEGER,
`home_player_X11` INTEGER,
`away_player_X1` INTEGER,
`away_player_X2` INTEGER,
`away_player_X3` INTEGER,
`away_player_X4` INTEGER,
`away_player_X5` INTEGER,
`away_player_X6` INTEGER,
`away_player_X7` INTEGER,
`away_player_X8` INTEGER,
`away_player_X9` INTEGER,
`away_player_X10` INTEGER,
`away_player_X11` INTEGER,
`home_player_Y1` INTEGER,
`home_player_Y2` INTEGER,
`home_player_Y3` INTEGER,
`home_player_Y4` INTEGER,
`home_player_Y5` INTEGER,
`home_player_Y6` INTEGER,
`home_player_Y7` INTEGER,
`home_player_Y8` INTEGER,
`home_player_Y9` INTEGER,
`home_player_Y10` INTEGER,
`home_player_Y11` INTEGER,
`away_player_Y1` INTEGER,
`away_player_Y2` INTEGER,
`away_player_Y3` INTEGER,
`away_player_Y4` INTEGER,
`away_player_Y5` INTEGER,
`away_player_Y6` INTEGER,
`away_player_Y7` INTEGER,
`away_player_Y8` INTEGER,
`away_player_Y9` INTEGER,
`away_player_Y10` INTEGER,
`away_player_Y11` INTEGER,
`home_player_1` INTEGER,
`home_player_2` INTEGER,
`home_player_3` INTEGER,
`home_player_4` INTEGER,
`home_player_5` INTEGER,
`home_player_6` INTEGER,
`home_player_7` INTEGER,
`home_player_8` INTEGER,
`home_player_9` INTEGER,
`home_player_10` INTEGER,
`home_player_11` INTEGER,
`away_player_1` INTEGER,
`away_player_2` INTEGER,
`away_player_3` INTEGER,
`away_player_4` INTEGER,
`away_player_5` INTEGER,
`away_player_6` INTEGER,
`away_player_7` INTEGER,
`away_player_8` INTEGER,
`away_player_9` INTEGER,
`away_player_10` INTEGER,
`away_player_11` INTEGER,
`goal` TEXT,
`shoton` TEXT,
`shotoff` TEXT,
`foulcommit` TEXT,
`card` TEXT,
`cross` TEXT,
`corner` TEXT,
`possession` TEXT,
`B365H` NUMERIC,
`B365D` NUMERIC,
`B365A` NUMERIC,
`BWH` NUMERIC,
`BWD` NUMERIC,
`BWA` NUMERIC,
`IWH` NUMERIC,
`IWD` NUMERIC,
`IWA` NUMERIC,
`LBH` NUMERIC,
`LBD` NUMERIC,
`LBA` NUMERIC,
`PSH` NUMERIC,
`PSD` NUMERIC,
`PSA` NUMERIC,
`WHH` NUMERIC,
`WHD` NUMERIC,
`WHA` NUMERIC,
`SJH` NUMERIC,
`SJD` NUMERIC,
`SJA` NUMERIC,
`VCH` NUMERIC,
`VCD` NUMERIC,
`VCA` NUMERIC,
`GBH` NUMERIC,
`GBD` NUMERIC,
`GBA` NUMERIC,
`BSH` NUMERIC,
`BSD` NUMERIC,
`BSA` NUMERIC,
FOREIGN KEY(`country_id`) REFERENCES `Country`(`id`),
FOREIGN KEY(`league_id`) REFERENCES `League`(`id`),
FOREIGN KEY(`home_team_api_id`) REFERENCES `Team`(`team_api_id`),
FOREIGN KEY(`away_team_api_id`) REFERENCES `Team`(`team_api_id`),
FOREIGN KEY(`home_player_1`) REFERENCES `Player`(`player_api_id`),
FOREIGN KEY(`home_player_2`) REFERENCES `Player`(`player_api_id`),
FOREIGN KEY(`home_player_3`) REFERENCES `Player`(`player_api_id`),
FOREIGN KEY(`home_player_4`) REFERENCES `Player`(`player_api_id`),
FOREIGN KEY(`home_player_5`) REFERENCES `Player`(`player_api_id`),
FOREIGN KEY(`home_player_6`) REFERENCES `Player`(`player_api_id`),
FOREIGN KEY(`home_player_7`) REFERENCES `Player`(`player_api_id`),
FOREIGN KEY(`home_player_8`) REFERENCES `Player`(`player_api_id`),
FOREIGN KEY(`home_player_9`) REFERENCES `Player`(`player_api_id`),
FOREIGN KEY(`home_player_10`) REFERENCES `Player`(`player_api_id`),
FOREIGN KEY(`home_player_11`) REFERENCES `Player`(`player_api_id`),
FOREIGN KEY(`away_player_1`) REFERENCES `Player`(`player_api_id`),
FOREIGN KEY(`away_player_2`) REFERENCES `Player`(`player_api_id`),
FOREIGN KEY(`away_player_3`) REFERENCES `Player`(`player_api_id`),
FOREIGN KEY(`away_player_4`) REFERENCES `Player`(`player_api_id`),
FOREIGN KEY(`away_player_5`) REFERENCES `Player`(`player_api_id`),
FOREIGN KEY(`away_player_6`) REFERENCES `Player`(`player_api_id`),
FOREIGN KEY(`away_player_7`) REFERENCES `Player`(`player_api_id`),
FOREIGN KEY(`away_player_8`) REFERENCES `Player`(`player_api_id`),
FOREIGN KEY(`away_player_9`) REFERENCES `Player`(`player_api_id`),
FOREIGN KEY(`away_player_10`) REFERENCES `Player`(`player_api_id`),
FOREIGN KEY(`away_player_11`) REFERENCES `Player`(`player_api_id`)
);
CREATE TABLE `League` (
`id` INTEGER PRIMARY KEY AUTOINCREMENT,
`country_id` INTEGER,
`name` TEXT UNIQUE,
FOREIGN KEY(`country_id`) REFERENCES `Country`(`id`)
);
CREATE TABLE `Country` (
`id` INTEGER PRIMARY KEY AUTOINCREMENT,
`name` TEXT UNIQUE
);
CREATE TABLE "Team" (
`id` INTEGER PRIMARY KEY AUTOINCREMENT,
`team_api_id` INTEGER UNIQUE,
`team_fifa_api_id` INTEGER,
`team_long_name` TEXT,
`team_short_name` TEXT
);
CREATE TABLE `Team_Attributes` (
`id` INTEGER PRIMARY KEY AUTOINCREMENT,
`team_fifa_api_id` INTEGER,
`team_api_id` INTEGER,
`date` TEXT,
`buildUpPlaySpeed` INTEGER,
`buildUpPlaySpeedClass` TEXT,
`buildUpPlayDribbling` INTEGER,
`buildUpPlayDribblingClass` TEXT,
`buildUpPlayPassing` INTEGER,
`buildUpPlayPassingClass` TEXT,
`buildUpPlayPositioningClass` TEXT,
`chanceCreationPassing` INTEGER,
`chanceCreationPassingClass` TEXT,
`chanceCreationCrossing` INTEGER,
`chanceCreationCrossingClass` TEXT,
`chanceCreationShooting` INTEGER,
`chanceCreationShootingClass` TEXT,
`chanceCreationPositioningClass` TEXT,
`defencePressure` INTEGER,
`defencePressureClass` TEXT,
`defenceAggression` INTEGER,
`defenceAggressionClass` TEXT,
`defenceTeamWidth` INTEGER,
`defenceTeamWidthClass` TEXT,
`defenceDefenderLineClass` TEXT,
FOREIGN KEY(`team_fifa_api_id`) REFERENCES `Team`(`team_fifa_api_id`),
FOREIGN KEY(`team_api_id`) REFERENCES `Team`(`team_api_id`)
);
INSERT INTO "Player_Attributes" VALUES(1,218353,505942,'2016-02-18 00:00:00',67,71,'right','medium','medium',49,44,71,61,44,51,45,39,64,49,60,64,59,47,65,55,58,54,76,35,71,70,45,54,48,65,69,69,6,11,10,8,8);
INSERT INTO "Player" VALUES(1,505942,'Aaron Appindangoye',218353,'1992-02-29 00:00:00',182.88,187);
INSERT INTO "Match" VALUES(1,1,1,'2008/2009',1,'2008-08-17 00:00:00',492473,9987,9993,1,1,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,1.73,3.4,5,1.75,3.35,4.2,1.85,3.2,3.5,1.8,3.3,3.75,NULL,NULL,NULL,1.7,3.3,4.33,1.9,3.3,4,1.65,3.4,4.5,1.78,3.25,4,1.73,3.4,4.2);
INSERT INTO "League" VALUES(1,1,'Belgium Jupiler League');
INSERT INTO "Country" VALUES(1,'Belgium');
INSERT INTO "Team" VALUES(1,9987,673,'KRC Genk','GEN');
INSERT INTO "Team_Attributes" VALUES(1,434,9930,'2010-02-22 00:00:00',60,'Balanced',NULL,'Little',50,'Mixed','Organised',60,'Normal',65,'Normal',55,'Normal','Organised',50,'Medium',55,'Press',45,'Normal','Cover'); |
soccer_1 | SELECT player_api_id FROM Player WHERE height >= 180 INTERSECT SELECT player_api_id FROM Player_Attributes WHERE overall_rating > 85 | List all of the player ids with a height of at least 180cm and an overall rating higher than 85. | CREATE TABLE "Player_Attributes" (
`id` INTEGER PRIMARY KEY AUTOINCREMENT,
`player_fifa_api_id` INTEGER,
`player_api_id` INTEGER,
`date` TEXT,
`overall_rating` INTEGER,
`potential` INTEGER,
`preferred_foot` TEXT,
`attacking_work_rate` TEXT,
`defensive_work_rate` TEXT,
`crossing` INTEGER,
`finishing` INTEGER,
`heading_accuracy` INTEGER,
`short_passing` INTEGER,
`volleys` INTEGER,
`dribbling` INTEGER,
`curve` INTEGER,
`free_kick_accuracy` INTEGER,
`long_passing` INTEGER,
`ball_control` INTEGER,
`acceleration` INTEGER,
`sprint_speed` INTEGER,
`agility` INTEGER,
`reactions` INTEGER,
`balance` INTEGER,
`shot_power` INTEGER,
`jumping` INTEGER,
`stamina` INTEGER,
`strength` INTEGER,
`long_shots` INTEGER,
`aggression` INTEGER,
`interceptions` INTEGER,
`positioning` INTEGER,
`vision` INTEGER,
`penalties` INTEGER,
`marking` INTEGER,
`standing_tackle` INTEGER,
`sliding_tackle` INTEGER,
`gk_diving` INTEGER,
`gk_handling` INTEGER,
`gk_kicking` INTEGER,
`gk_positioning` INTEGER,
`gk_reflexes` INTEGER,
FOREIGN KEY(`player_fifa_api_id`) REFERENCES `Player`(`player_fifa_api_id`),
FOREIGN KEY(`player_api_id`) REFERENCES `Player`(`player_api_id`)
);
CREATE TABLE `Player` (
`id` INTEGER PRIMARY KEY AUTOINCREMENT,
`player_api_id` INTEGER UNIQUE,
`player_name` TEXT,
`player_fifa_api_id` INTEGER UNIQUE,
`birthday` TEXT,
`height` INTEGER,
`weight` INTEGER
);
CREATE TABLE `Match` (
`id` INTEGER PRIMARY KEY AUTOINCREMENT,
`country_id` INTEGER,
`league_id` INTEGER,
`season` TEXT,
`stage` INTEGER,
`date` TEXT,
`match_api_id` INTEGER UNIQUE,
`home_team_api_id` INTEGER,
`away_team_api_id` INTEGER,
`home_team_goal` INTEGER,
`away_team_goal` INTEGER,
`home_player_X1` INTEGER,
`home_player_X2` INTEGER,
`home_player_X3` INTEGER,
`home_player_X4` INTEGER,
`home_player_X5` INTEGER,
`home_player_X6` INTEGER,
`home_player_X7` INTEGER,
`home_player_X8` INTEGER,
`home_player_X9` INTEGER,
`home_player_X10` INTEGER,
`home_player_X11` INTEGER,
`away_player_X1` INTEGER,
`away_player_X2` INTEGER,
`away_player_X3` INTEGER,
`away_player_X4` INTEGER,
`away_player_X5` INTEGER,
`away_player_X6` INTEGER,
`away_player_X7` INTEGER,
`away_player_X8` INTEGER,
`away_player_X9` INTEGER,
`away_player_X10` INTEGER,
`away_player_X11` INTEGER,
`home_player_Y1` INTEGER,
`home_player_Y2` INTEGER,
`home_player_Y3` INTEGER,
`home_player_Y4` INTEGER,
`home_player_Y5` INTEGER,
`home_player_Y6` INTEGER,
`home_player_Y7` INTEGER,
`home_player_Y8` INTEGER,
`home_player_Y9` INTEGER,
`home_player_Y10` INTEGER,
`home_player_Y11` INTEGER,
`away_player_Y1` INTEGER,
`away_player_Y2` INTEGER,
`away_player_Y3` INTEGER,
`away_player_Y4` INTEGER,
`away_player_Y5` INTEGER,
`away_player_Y6` INTEGER,
`away_player_Y7` INTEGER,
`away_player_Y8` INTEGER,
`away_player_Y9` INTEGER,
`away_player_Y10` INTEGER,
`away_player_Y11` INTEGER,
`home_player_1` INTEGER,
`home_player_2` INTEGER,
`home_player_3` INTEGER,
`home_player_4` INTEGER,
`home_player_5` INTEGER,
`home_player_6` INTEGER,
`home_player_7` INTEGER,
`home_player_8` INTEGER,
`home_player_9` INTEGER,
`home_player_10` INTEGER,
`home_player_11` INTEGER,
`away_player_1` INTEGER,
`away_player_2` INTEGER,
`away_player_3` INTEGER,
`away_player_4` INTEGER,
`away_player_5` INTEGER,
`away_player_6` INTEGER,
`away_player_7` INTEGER,
`away_player_8` INTEGER,
`away_player_9` INTEGER,
`away_player_10` INTEGER,
`away_player_11` INTEGER,
`goal` TEXT,
`shoton` TEXT,
`shotoff` TEXT,
`foulcommit` TEXT,
`card` TEXT,
`cross` TEXT,
`corner` TEXT,
`possession` TEXT,
`B365H` NUMERIC,
`B365D` NUMERIC,
`B365A` NUMERIC,
`BWH` NUMERIC,
`BWD` NUMERIC,
`BWA` NUMERIC,
`IWH` NUMERIC,
`IWD` NUMERIC,
`IWA` NUMERIC,
`LBH` NUMERIC,
`LBD` NUMERIC,
`LBA` NUMERIC,
`PSH` NUMERIC,
`PSD` NUMERIC,
`PSA` NUMERIC,
`WHH` NUMERIC,
`WHD` NUMERIC,
`WHA` NUMERIC,
`SJH` NUMERIC,
`SJD` NUMERIC,
`SJA` NUMERIC,
`VCH` NUMERIC,
`VCD` NUMERIC,
`VCA` NUMERIC,
`GBH` NUMERIC,
`GBD` NUMERIC,
`GBA` NUMERIC,
`BSH` NUMERIC,
`BSD` NUMERIC,
`BSA` NUMERIC,
FOREIGN KEY(`country_id`) REFERENCES `Country`(`id`),
FOREIGN KEY(`league_id`) REFERENCES `League`(`id`),
FOREIGN KEY(`home_team_api_id`) REFERENCES `Team`(`team_api_id`),
FOREIGN KEY(`away_team_api_id`) REFERENCES `Team`(`team_api_id`),
FOREIGN KEY(`home_player_1`) REFERENCES `Player`(`player_api_id`),
FOREIGN KEY(`home_player_2`) REFERENCES `Player`(`player_api_id`),
FOREIGN KEY(`home_player_3`) REFERENCES `Player`(`player_api_id`),
FOREIGN KEY(`home_player_4`) REFERENCES `Player`(`player_api_id`),
FOREIGN KEY(`home_player_5`) REFERENCES `Player`(`player_api_id`),
FOREIGN KEY(`home_player_6`) REFERENCES `Player`(`player_api_id`),
FOREIGN KEY(`home_player_7`) REFERENCES `Player`(`player_api_id`),
FOREIGN KEY(`home_player_8`) REFERENCES `Player`(`player_api_id`),
FOREIGN KEY(`home_player_9`) REFERENCES `Player`(`player_api_id`),
FOREIGN KEY(`home_player_10`) REFERENCES `Player`(`player_api_id`),
FOREIGN KEY(`home_player_11`) REFERENCES `Player`(`player_api_id`),
FOREIGN KEY(`away_player_1`) REFERENCES `Player`(`player_api_id`),
FOREIGN KEY(`away_player_2`) REFERENCES `Player`(`player_api_id`),
FOREIGN KEY(`away_player_3`) REFERENCES `Player`(`player_api_id`),
FOREIGN KEY(`away_player_4`) REFERENCES `Player`(`player_api_id`),
FOREIGN KEY(`away_player_5`) REFERENCES `Player`(`player_api_id`),
FOREIGN KEY(`away_player_6`) REFERENCES `Player`(`player_api_id`),
FOREIGN KEY(`away_player_7`) REFERENCES `Player`(`player_api_id`),
FOREIGN KEY(`away_player_8`) REFERENCES `Player`(`player_api_id`),
FOREIGN KEY(`away_player_9`) REFERENCES `Player`(`player_api_id`),
FOREIGN KEY(`away_player_10`) REFERENCES `Player`(`player_api_id`),
FOREIGN KEY(`away_player_11`) REFERENCES `Player`(`player_api_id`)
);
CREATE TABLE `League` (
`id` INTEGER PRIMARY KEY AUTOINCREMENT,
`country_id` INTEGER,
`name` TEXT UNIQUE,
FOREIGN KEY(`country_id`) REFERENCES `Country`(`id`)
);
CREATE TABLE `Country` (
`id` INTEGER PRIMARY KEY AUTOINCREMENT,
`name` TEXT UNIQUE
);
CREATE TABLE "Team" (
`id` INTEGER PRIMARY KEY AUTOINCREMENT,
`team_api_id` INTEGER UNIQUE,
`team_fifa_api_id` INTEGER,
`team_long_name` TEXT,
`team_short_name` TEXT
);
CREATE TABLE `Team_Attributes` (
`id` INTEGER PRIMARY KEY AUTOINCREMENT,
`team_fifa_api_id` INTEGER,
`team_api_id` INTEGER,
`date` TEXT,
`buildUpPlaySpeed` INTEGER,
`buildUpPlaySpeedClass` TEXT,
`buildUpPlayDribbling` INTEGER,
`buildUpPlayDribblingClass` TEXT,
`buildUpPlayPassing` INTEGER,
`buildUpPlayPassingClass` TEXT,
`buildUpPlayPositioningClass` TEXT,
`chanceCreationPassing` INTEGER,
`chanceCreationPassingClass` TEXT,
`chanceCreationCrossing` INTEGER,
`chanceCreationCrossingClass` TEXT,
`chanceCreationShooting` INTEGER,
`chanceCreationShootingClass` TEXT,
`chanceCreationPositioningClass` TEXT,
`defencePressure` INTEGER,
`defencePressureClass` TEXT,
`defenceAggression` INTEGER,
`defenceAggressionClass` TEXT,
`defenceTeamWidth` INTEGER,
`defenceTeamWidthClass` TEXT,
`defenceDefenderLineClass` TEXT,
FOREIGN KEY(`team_fifa_api_id`) REFERENCES `Team`(`team_fifa_api_id`),
FOREIGN KEY(`team_api_id`) REFERENCES `Team`(`team_api_id`)
);
INSERT INTO "Player_Attributes" VALUES(1,218353,505942,'2016-02-18 00:00:00',67,71,'right','medium','medium',49,44,71,61,44,51,45,39,64,49,60,64,59,47,65,55,58,54,76,35,71,70,45,54,48,65,69,69,6,11,10,8,8);
INSERT INTO "Player" VALUES(1,505942,'Aaron Appindangoye',218353,'1992-02-29 00:00:00',182.88,187);
INSERT INTO "Match" VALUES(1,1,1,'2008/2009',1,'2008-08-17 00:00:00',492473,9987,9993,1,1,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,1.73,3.4,5,1.75,3.35,4.2,1.85,3.2,3.5,1.8,3.3,3.75,NULL,NULL,NULL,1.7,3.3,4.33,1.9,3.3,4,1.65,3.4,4.5,1.78,3.25,4,1.73,3.4,4.2);
INSERT INTO "League" VALUES(1,1,'Belgium Jupiler League');
INSERT INTO "Country" VALUES(1,'Belgium');
INSERT INTO "Team" VALUES(1,9987,673,'KRC Genk','GEN');
INSERT INTO "Team_Attributes" VALUES(1,434,9930,'2010-02-22 00:00:00',60,'Balanced',NULL,'Little',50,'Mixed','Organised',60,'Normal',65,'Normal',55,'Normal','Organised',50,'Medium',55,'Press',45,'Normal','Cover'); |
soccer_1 | SELECT player_api_id FROM Player WHERE height >= 180 AND height <= 190 INTERSECT SELECT player_api_id FROM Player_Attributes WHERE preferred_foot = "left" | List all of the ids for left-footed players with a height between 180cm and 190cm. | CREATE TABLE "Player_Attributes" (
`id` INTEGER PRIMARY KEY AUTOINCREMENT,
`player_fifa_api_id` INTEGER,
`player_api_id` INTEGER,
`date` TEXT,
`overall_rating` INTEGER,
`potential` INTEGER,
`preferred_foot` TEXT,
`attacking_work_rate` TEXT,
`defensive_work_rate` TEXT,
`crossing` INTEGER,
`finishing` INTEGER,
`heading_accuracy` INTEGER,
`short_passing` INTEGER,
`volleys` INTEGER,
`dribbling` INTEGER,
`curve` INTEGER,
`free_kick_accuracy` INTEGER,
`long_passing` INTEGER,
`ball_control` INTEGER,
`acceleration` INTEGER,
`sprint_speed` INTEGER,
`agility` INTEGER,
`reactions` INTEGER,
`balance` INTEGER,
`shot_power` INTEGER,
`jumping` INTEGER,
`stamina` INTEGER,
`strength` INTEGER,
`long_shots` INTEGER,
`aggression` INTEGER,
`interceptions` INTEGER,
`positioning` INTEGER,
`vision` INTEGER,
`penalties` INTEGER,
`marking` INTEGER,
`standing_tackle` INTEGER,
`sliding_tackle` INTEGER,
`gk_diving` INTEGER,
`gk_handling` INTEGER,
`gk_kicking` INTEGER,
`gk_positioning` INTEGER,
`gk_reflexes` INTEGER,
FOREIGN KEY(`player_fifa_api_id`) REFERENCES `Player`(`player_fifa_api_id`),
FOREIGN KEY(`player_api_id`) REFERENCES `Player`(`player_api_id`)
);
CREATE TABLE `Player` (
`id` INTEGER PRIMARY KEY AUTOINCREMENT,
`player_api_id` INTEGER UNIQUE,
`player_name` TEXT,
`player_fifa_api_id` INTEGER UNIQUE,
`birthday` TEXT,
`height` INTEGER,
`weight` INTEGER
);
CREATE TABLE `Match` (
`id` INTEGER PRIMARY KEY AUTOINCREMENT,
`country_id` INTEGER,
`league_id` INTEGER,
`season` TEXT,
`stage` INTEGER,
`date` TEXT,
`match_api_id` INTEGER UNIQUE,
`home_team_api_id` INTEGER,
`away_team_api_id` INTEGER,
`home_team_goal` INTEGER,
`away_team_goal` INTEGER,
`home_player_X1` INTEGER,
`home_player_X2` INTEGER,
`home_player_X3` INTEGER,
`home_player_X4` INTEGER,
`home_player_X5` INTEGER,
`home_player_X6` INTEGER,
`home_player_X7` INTEGER,
`home_player_X8` INTEGER,
`home_player_X9` INTEGER,
`home_player_X10` INTEGER,
`home_player_X11` INTEGER,
`away_player_X1` INTEGER,
`away_player_X2` INTEGER,
`away_player_X3` INTEGER,
`away_player_X4` INTEGER,
`away_player_X5` INTEGER,
`away_player_X6` INTEGER,
`away_player_X7` INTEGER,
`away_player_X8` INTEGER,
`away_player_X9` INTEGER,
`away_player_X10` INTEGER,
`away_player_X11` INTEGER,
`home_player_Y1` INTEGER,
`home_player_Y2` INTEGER,
`home_player_Y3` INTEGER,
`home_player_Y4` INTEGER,
`home_player_Y5` INTEGER,
`home_player_Y6` INTEGER,
`home_player_Y7` INTEGER,
`home_player_Y8` INTEGER,
`home_player_Y9` INTEGER,
`home_player_Y10` INTEGER,
`home_player_Y11` INTEGER,
`away_player_Y1` INTEGER,
`away_player_Y2` INTEGER,
`away_player_Y3` INTEGER,
`away_player_Y4` INTEGER,
`away_player_Y5` INTEGER,
`away_player_Y6` INTEGER,
`away_player_Y7` INTEGER,
`away_player_Y8` INTEGER,
`away_player_Y9` INTEGER,
`away_player_Y10` INTEGER,
`away_player_Y11` INTEGER,
`home_player_1` INTEGER,
`home_player_2` INTEGER,
`home_player_3` INTEGER,
`home_player_4` INTEGER,
`home_player_5` INTEGER,
`home_player_6` INTEGER,
`home_player_7` INTEGER,
`home_player_8` INTEGER,
`home_player_9` INTEGER,
`home_player_10` INTEGER,
`home_player_11` INTEGER,
`away_player_1` INTEGER,
`away_player_2` INTEGER,
`away_player_3` INTEGER,
`away_player_4` INTEGER,
`away_player_5` INTEGER,
`away_player_6` INTEGER,
`away_player_7` INTEGER,
`away_player_8` INTEGER,
`away_player_9` INTEGER,
`away_player_10` INTEGER,
`away_player_11` INTEGER,
`goal` TEXT,
`shoton` TEXT,
`shotoff` TEXT,
`foulcommit` TEXT,
`card` TEXT,
`cross` TEXT,
`corner` TEXT,
`possession` TEXT,
`B365H` NUMERIC,
`B365D` NUMERIC,
`B365A` NUMERIC,
`BWH` NUMERIC,
`BWD` NUMERIC,
`BWA` NUMERIC,
`IWH` NUMERIC,
`IWD` NUMERIC,
`IWA` NUMERIC,
`LBH` NUMERIC,
`LBD` NUMERIC,
`LBA` NUMERIC,
`PSH` NUMERIC,
`PSD` NUMERIC,
`PSA` NUMERIC,
`WHH` NUMERIC,
`WHD` NUMERIC,
`WHA` NUMERIC,
`SJH` NUMERIC,
`SJD` NUMERIC,
`SJA` NUMERIC,
`VCH` NUMERIC,
`VCD` NUMERIC,
`VCA` NUMERIC,
`GBH` NUMERIC,
`GBD` NUMERIC,
`GBA` NUMERIC,
`BSH` NUMERIC,
`BSD` NUMERIC,
`BSA` NUMERIC,
FOREIGN KEY(`country_id`) REFERENCES `Country`(`id`),
FOREIGN KEY(`league_id`) REFERENCES `League`(`id`),
FOREIGN KEY(`home_team_api_id`) REFERENCES `Team`(`team_api_id`),
FOREIGN KEY(`away_team_api_id`) REFERENCES `Team`(`team_api_id`),
FOREIGN KEY(`home_player_1`) REFERENCES `Player`(`player_api_id`),
FOREIGN KEY(`home_player_2`) REFERENCES `Player`(`player_api_id`),
FOREIGN KEY(`home_player_3`) REFERENCES `Player`(`player_api_id`),
FOREIGN KEY(`home_player_4`) REFERENCES `Player`(`player_api_id`),
FOREIGN KEY(`home_player_5`) REFERENCES `Player`(`player_api_id`),
FOREIGN KEY(`home_player_6`) REFERENCES `Player`(`player_api_id`),
FOREIGN KEY(`home_player_7`) REFERENCES `Player`(`player_api_id`),
FOREIGN KEY(`home_player_8`) REFERENCES `Player`(`player_api_id`),
FOREIGN KEY(`home_player_9`) REFERENCES `Player`(`player_api_id`),
FOREIGN KEY(`home_player_10`) REFERENCES `Player`(`player_api_id`),
FOREIGN KEY(`home_player_11`) REFERENCES `Player`(`player_api_id`),
FOREIGN KEY(`away_player_1`) REFERENCES `Player`(`player_api_id`),
FOREIGN KEY(`away_player_2`) REFERENCES `Player`(`player_api_id`),
FOREIGN KEY(`away_player_3`) REFERENCES `Player`(`player_api_id`),
FOREIGN KEY(`away_player_4`) REFERENCES `Player`(`player_api_id`),
FOREIGN KEY(`away_player_5`) REFERENCES `Player`(`player_api_id`),
FOREIGN KEY(`away_player_6`) REFERENCES `Player`(`player_api_id`),
FOREIGN KEY(`away_player_7`) REFERENCES `Player`(`player_api_id`),
FOREIGN KEY(`away_player_8`) REFERENCES `Player`(`player_api_id`),
FOREIGN KEY(`away_player_9`) REFERENCES `Player`(`player_api_id`),
FOREIGN KEY(`away_player_10`) REFERENCES `Player`(`player_api_id`),
FOREIGN KEY(`away_player_11`) REFERENCES `Player`(`player_api_id`)
);
CREATE TABLE `League` (
`id` INTEGER PRIMARY KEY AUTOINCREMENT,
`country_id` INTEGER,
`name` TEXT UNIQUE,
FOREIGN KEY(`country_id`) REFERENCES `Country`(`id`)
);
CREATE TABLE `Country` (
`id` INTEGER PRIMARY KEY AUTOINCREMENT,
`name` TEXT UNIQUE
);
CREATE TABLE "Team" (
`id` INTEGER PRIMARY KEY AUTOINCREMENT,
`team_api_id` INTEGER UNIQUE,
`team_fifa_api_id` INTEGER,
`team_long_name` TEXT,
`team_short_name` TEXT
);
CREATE TABLE `Team_Attributes` (
`id` INTEGER PRIMARY KEY AUTOINCREMENT,
`team_fifa_api_id` INTEGER,
`team_api_id` INTEGER,
`date` TEXT,
`buildUpPlaySpeed` INTEGER,
`buildUpPlaySpeedClass` TEXT,
`buildUpPlayDribbling` INTEGER,
`buildUpPlayDribblingClass` TEXT,
`buildUpPlayPassing` INTEGER,
`buildUpPlayPassingClass` TEXT,
`buildUpPlayPositioningClass` TEXT,
`chanceCreationPassing` INTEGER,
`chanceCreationPassingClass` TEXT,
`chanceCreationCrossing` INTEGER,
`chanceCreationCrossingClass` TEXT,
`chanceCreationShooting` INTEGER,
`chanceCreationShootingClass` TEXT,
`chanceCreationPositioningClass` TEXT,
`defencePressure` INTEGER,
`defencePressureClass` TEXT,
`defenceAggression` INTEGER,
`defenceAggressionClass` TEXT,
`defenceTeamWidth` INTEGER,
`defenceTeamWidthClass` TEXT,
`defenceDefenderLineClass` TEXT,
FOREIGN KEY(`team_fifa_api_id`) REFERENCES `Team`(`team_fifa_api_id`),
FOREIGN KEY(`team_api_id`) REFERENCES `Team`(`team_api_id`)
);
INSERT INTO "Player_Attributes" VALUES(1,218353,505942,'2016-02-18 00:00:00',67,71,'right','medium','medium',49,44,71,61,44,51,45,39,64,49,60,64,59,47,65,55,58,54,76,35,71,70,45,54,48,65,69,69,6,11,10,8,8);
INSERT INTO "Player" VALUES(1,505942,'Aaron Appindangoye',218353,'1992-02-29 00:00:00',182.88,187);
INSERT INTO "Match" VALUES(1,1,1,'2008/2009',1,'2008-08-17 00:00:00',492473,9987,9993,1,1,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,1.73,3.4,5,1.75,3.35,4.2,1.85,3.2,3.5,1.8,3.3,3.75,NULL,NULL,NULL,1.7,3.3,4.33,1.9,3.3,4,1.65,3.4,4.5,1.78,3.25,4,1.73,3.4,4.2);
INSERT INTO "League" VALUES(1,1,'Belgium Jupiler League');
INSERT INTO "Country" VALUES(1,'Belgium');
INSERT INTO "Team" VALUES(1,9987,673,'KRC Genk','GEN');
INSERT INTO "Team_Attributes" VALUES(1,434,9930,'2010-02-22 00:00:00',60,'Balanced',NULL,'Little',50,'Mixed','Organised',60,'Normal',65,'Normal',55,'Normal','Organised',50,'Medium',55,'Press',45,'Normal','Cover'); |
soccer_1 | SELECT DISTINCT T1.player_name FROM Player AS T1 JOIN Player_Attributes AS T2 ON T1.player_api_id = T2.player_api_id ORDER BY overall_rating DESC LIMIT 3 | Who are the top 3 players in terms of overall rating? | CREATE TABLE "Player_Attributes" (
`id` INTEGER PRIMARY KEY AUTOINCREMENT,
`player_fifa_api_id` INTEGER,
`player_api_id` INTEGER,
`date` TEXT,
`overall_rating` INTEGER,
`potential` INTEGER,
`preferred_foot` TEXT,
`attacking_work_rate` TEXT,
`defensive_work_rate` TEXT,
`crossing` INTEGER,
`finishing` INTEGER,
`heading_accuracy` INTEGER,
`short_passing` INTEGER,
`volleys` INTEGER,
`dribbling` INTEGER,
`curve` INTEGER,
`free_kick_accuracy` INTEGER,
`long_passing` INTEGER,
`ball_control` INTEGER,
`acceleration` INTEGER,
`sprint_speed` INTEGER,
`agility` INTEGER,
`reactions` INTEGER,
`balance` INTEGER,
`shot_power` INTEGER,
`jumping` INTEGER,
`stamina` INTEGER,
`strength` INTEGER,
`long_shots` INTEGER,
`aggression` INTEGER,
`interceptions` INTEGER,
`positioning` INTEGER,
`vision` INTEGER,
`penalties` INTEGER,
`marking` INTEGER,
`standing_tackle` INTEGER,
`sliding_tackle` INTEGER,
`gk_diving` INTEGER,
`gk_handling` INTEGER,
`gk_kicking` INTEGER,
`gk_positioning` INTEGER,
`gk_reflexes` INTEGER,
FOREIGN KEY(`player_fifa_api_id`) REFERENCES `Player`(`player_fifa_api_id`),
FOREIGN KEY(`player_api_id`) REFERENCES `Player`(`player_api_id`)
);
CREATE TABLE `Player` (
`id` INTEGER PRIMARY KEY AUTOINCREMENT,
`player_api_id` INTEGER UNIQUE,
`player_name` TEXT,
`player_fifa_api_id` INTEGER UNIQUE,
`birthday` TEXT,
`height` INTEGER,
`weight` INTEGER
);
CREATE TABLE `Match` (
`id` INTEGER PRIMARY KEY AUTOINCREMENT,
`country_id` INTEGER,
`league_id` INTEGER,
`season` TEXT,
`stage` INTEGER,
`date` TEXT,
`match_api_id` INTEGER UNIQUE,
`home_team_api_id` INTEGER,
`away_team_api_id` INTEGER,
`home_team_goal` INTEGER,
`away_team_goal` INTEGER,
`home_player_X1` INTEGER,
`home_player_X2` INTEGER,
`home_player_X3` INTEGER,
`home_player_X4` INTEGER,
`home_player_X5` INTEGER,
`home_player_X6` INTEGER,
`home_player_X7` INTEGER,
`home_player_X8` INTEGER,
`home_player_X9` INTEGER,
`home_player_X10` INTEGER,
`home_player_X11` INTEGER,
`away_player_X1` INTEGER,
`away_player_X2` INTEGER,
`away_player_X3` INTEGER,
`away_player_X4` INTEGER,
`away_player_X5` INTEGER,
`away_player_X6` INTEGER,
`away_player_X7` INTEGER,
`away_player_X8` INTEGER,
`away_player_X9` INTEGER,
`away_player_X10` INTEGER,
`away_player_X11` INTEGER,
`home_player_Y1` INTEGER,
`home_player_Y2` INTEGER,
`home_player_Y3` INTEGER,
`home_player_Y4` INTEGER,
`home_player_Y5` INTEGER,
`home_player_Y6` INTEGER,
`home_player_Y7` INTEGER,
`home_player_Y8` INTEGER,
`home_player_Y9` INTEGER,
`home_player_Y10` INTEGER,
`home_player_Y11` INTEGER,
`away_player_Y1` INTEGER,
`away_player_Y2` INTEGER,
`away_player_Y3` INTEGER,
`away_player_Y4` INTEGER,
`away_player_Y5` INTEGER,
`away_player_Y6` INTEGER,
`away_player_Y7` INTEGER,
`away_player_Y8` INTEGER,
`away_player_Y9` INTEGER,
`away_player_Y10` INTEGER,
`away_player_Y11` INTEGER,
`home_player_1` INTEGER,
`home_player_2` INTEGER,
`home_player_3` INTEGER,
`home_player_4` INTEGER,
`home_player_5` INTEGER,
`home_player_6` INTEGER,
`home_player_7` INTEGER,
`home_player_8` INTEGER,
`home_player_9` INTEGER,
`home_player_10` INTEGER,
`home_player_11` INTEGER,
`away_player_1` INTEGER,
`away_player_2` INTEGER,
`away_player_3` INTEGER,
`away_player_4` INTEGER,
`away_player_5` INTEGER,
`away_player_6` INTEGER,
`away_player_7` INTEGER,
`away_player_8` INTEGER,
`away_player_9` INTEGER,
`away_player_10` INTEGER,
`away_player_11` INTEGER,
`goal` TEXT,
`shoton` TEXT,
`shotoff` TEXT,
`foulcommit` TEXT,
`card` TEXT,
`cross` TEXT,
`corner` TEXT,
`possession` TEXT,
`B365H` NUMERIC,
`B365D` NUMERIC,
`B365A` NUMERIC,
`BWH` NUMERIC,
`BWD` NUMERIC,
`BWA` NUMERIC,
`IWH` NUMERIC,
`IWD` NUMERIC,
`IWA` NUMERIC,
`LBH` NUMERIC,
`LBD` NUMERIC,
`LBA` NUMERIC,
`PSH` NUMERIC,
`PSD` NUMERIC,
`PSA` NUMERIC,
`WHH` NUMERIC,
`WHD` NUMERIC,
`WHA` NUMERIC,
`SJH` NUMERIC,
`SJD` NUMERIC,
`SJA` NUMERIC,
`VCH` NUMERIC,
`VCD` NUMERIC,
`VCA` NUMERIC,
`GBH` NUMERIC,
`GBD` NUMERIC,
`GBA` NUMERIC,
`BSH` NUMERIC,
`BSD` NUMERIC,
`BSA` NUMERIC,
FOREIGN KEY(`country_id`) REFERENCES `Country`(`id`),
FOREIGN KEY(`league_id`) REFERENCES `League`(`id`),
FOREIGN KEY(`home_team_api_id`) REFERENCES `Team`(`team_api_id`),
FOREIGN KEY(`away_team_api_id`) REFERENCES `Team`(`team_api_id`),
FOREIGN KEY(`home_player_1`) REFERENCES `Player`(`player_api_id`),
FOREIGN KEY(`home_player_2`) REFERENCES `Player`(`player_api_id`),
FOREIGN KEY(`home_player_3`) REFERENCES `Player`(`player_api_id`),
FOREIGN KEY(`home_player_4`) REFERENCES `Player`(`player_api_id`),
FOREIGN KEY(`home_player_5`) REFERENCES `Player`(`player_api_id`),
FOREIGN KEY(`home_player_6`) REFERENCES `Player`(`player_api_id`),
FOREIGN KEY(`home_player_7`) REFERENCES `Player`(`player_api_id`),
FOREIGN KEY(`home_player_8`) REFERENCES `Player`(`player_api_id`),
FOREIGN KEY(`home_player_9`) REFERENCES `Player`(`player_api_id`),
FOREIGN KEY(`home_player_10`) REFERENCES `Player`(`player_api_id`),
FOREIGN KEY(`home_player_11`) REFERENCES `Player`(`player_api_id`),
FOREIGN KEY(`away_player_1`) REFERENCES `Player`(`player_api_id`),
FOREIGN KEY(`away_player_2`) REFERENCES `Player`(`player_api_id`),
FOREIGN KEY(`away_player_3`) REFERENCES `Player`(`player_api_id`),
FOREIGN KEY(`away_player_4`) REFERENCES `Player`(`player_api_id`),
FOREIGN KEY(`away_player_5`) REFERENCES `Player`(`player_api_id`),
FOREIGN KEY(`away_player_6`) REFERENCES `Player`(`player_api_id`),
FOREIGN KEY(`away_player_7`) REFERENCES `Player`(`player_api_id`),
FOREIGN KEY(`away_player_8`) REFERENCES `Player`(`player_api_id`),
FOREIGN KEY(`away_player_9`) REFERENCES `Player`(`player_api_id`),
FOREIGN KEY(`away_player_10`) REFERENCES `Player`(`player_api_id`),
FOREIGN KEY(`away_player_11`) REFERENCES `Player`(`player_api_id`)
);
CREATE TABLE `League` (
`id` INTEGER PRIMARY KEY AUTOINCREMENT,
`country_id` INTEGER,
`name` TEXT UNIQUE,
FOREIGN KEY(`country_id`) REFERENCES `Country`(`id`)
);
CREATE TABLE `Country` (
`id` INTEGER PRIMARY KEY AUTOINCREMENT,
`name` TEXT UNIQUE
);
CREATE TABLE "Team" (
`id` INTEGER PRIMARY KEY AUTOINCREMENT,
`team_api_id` INTEGER UNIQUE,
`team_fifa_api_id` INTEGER,
`team_long_name` TEXT,
`team_short_name` TEXT
);
CREATE TABLE `Team_Attributes` (
`id` INTEGER PRIMARY KEY AUTOINCREMENT,
`team_fifa_api_id` INTEGER,
`team_api_id` INTEGER,
`date` TEXT,
`buildUpPlaySpeed` INTEGER,
`buildUpPlaySpeedClass` TEXT,
`buildUpPlayDribbling` INTEGER,
`buildUpPlayDribblingClass` TEXT,
`buildUpPlayPassing` INTEGER,
`buildUpPlayPassingClass` TEXT,
`buildUpPlayPositioningClass` TEXT,
`chanceCreationPassing` INTEGER,
`chanceCreationPassingClass` TEXT,
`chanceCreationCrossing` INTEGER,
`chanceCreationCrossingClass` TEXT,
`chanceCreationShooting` INTEGER,
`chanceCreationShootingClass` TEXT,
`chanceCreationPositioningClass` TEXT,
`defencePressure` INTEGER,
`defencePressureClass` TEXT,
`defenceAggression` INTEGER,
`defenceAggressionClass` TEXT,
`defenceTeamWidth` INTEGER,
`defenceTeamWidthClass` TEXT,
`defenceDefenderLineClass` TEXT,
FOREIGN KEY(`team_fifa_api_id`) REFERENCES `Team`(`team_fifa_api_id`),
FOREIGN KEY(`team_api_id`) REFERENCES `Team`(`team_api_id`)
);
INSERT INTO "Player_Attributes" VALUES(1,218353,505942,'2016-02-18 00:00:00',67,71,'right','medium','medium',49,44,71,61,44,51,45,39,64,49,60,64,59,47,65,55,58,54,76,35,71,70,45,54,48,65,69,69,6,11,10,8,8);
INSERT INTO "Player" VALUES(1,505942,'Aaron Appindangoye',218353,'1992-02-29 00:00:00',182.88,187);
INSERT INTO "Match" VALUES(1,1,1,'2008/2009',1,'2008-08-17 00:00:00',492473,9987,9993,1,1,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,1.73,3.4,5,1.75,3.35,4.2,1.85,3.2,3.5,1.8,3.3,3.75,NULL,NULL,NULL,1.7,3.3,4.33,1.9,3.3,4,1.65,3.4,4.5,1.78,3.25,4,1.73,3.4,4.2);
INSERT INTO "League" VALUES(1,1,'Belgium Jupiler League');
INSERT INTO "Country" VALUES(1,'Belgium');
INSERT INTO "Team" VALUES(1,9987,673,'KRC Genk','GEN');
INSERT INTO "Team_Attributes" VALUES(1,434,9930,'2010-02-22 00:00:00',60,'Balanced',NULL,'Little',50,'Mixed','Organised',60,'Normal',65,'Normal',55,'Normal','Organised',50,'Medium',55,'Press',45,'Normal','Cover'); |
soccer_1 | SELECT DISTINCT T1.player_name , T1.birthday FROM Player AS T1 JOIN Player_Attributes AS T2 ON T1.player_api_id = T2.player_api_id ORDER BY potential DESC LIMIT 5 | List the names and birthdays of the top five players in terms of potential. | CREATE TABLE "Player_Attributes" (
`id` INTEGER PRIMARY KEY AUTOINCREMENT,
`player_fifa_api_id` INTEGER,
`player_api_id` INTEGER,
`date` TEXT,
`overall_rating` INTEGER,
`potential` INTEGER,
`preferred_foot` TEXT,
`attacking_work_rate` TEXT,
`defensive_work_rate` TEXT,
`crossing` INTEGER,
`finishing` INTEGER,
`heading_accuracy` INTEGER,
`short_passing` INTEGER,
`volleys` INTEGER,
`dribbling` INTEGER,
`curve` INTEGER,
`free_kick_accuracy` INTEGER,
`long_passing` INTEGER,
`ball_control` INTEGER,
`acceleration` INTEGER,
`sprint_speed` INTEGER,
`agility` INTEGER,
`reactions` INTEGER,
`balance` INTEGER,
`shot_power` INTEGER,
`jumping` INTEGER,
`stamina` INTEGER,
`strength` INTEGER,
`long_shots` INTEGER,
`aggression` INTEGER,
`interceptions` INTEGER,
`positioning` INTEGER,
`vision` INTEGER,
`penalties` INTEGER,
`marking` INTEGER,
`standing_tackle` INTEGER,
`sliding_tackle` INTEGER,
`gk_diving` INTEGER,
`gk_handling` INTEGER,
`gk_kicking` INTEGER,
`gk_positioning` INTEGER,
`gk_reflexes` INTEGER,
FOREIGN KEY(`player_fifa_api_id`) REFERENCES `Player`(`player_fifa_api_id`),
FOREIGN KEY(`player_api_id`) REFERENCES `Player`(`player_api_id`)
);
CREATE TABLE `Player` (
`id` INTEGER PRIMARY KEY AUTOINCREMENT,
`player_api_id` INTEGER UNIQUE,
`player_name` TEXT,
`player_fifa_api_id` INTEGER UNIQUE,
`birthday` TEXT,
`height` INTEGER,
`weight` INTEGER
);
CREATE TABLE `Match` (
`id` INTEGER PRIMARY KEY AUTOINCREMENT,
`country_id` INTEGER,
`league_id` INTEGER,
`season` TEXT,
`stage` INTEGER,
`date` TEXT,
`match_api_id` INTEGER UNIQUE,
`home_team_api_id` INTEGER,
`away_team_api_id` INTEGER,
`home_team_goal` INTEGER,
`away_team_goal` INTEGER,
`home_player_X1` INTEGER,
`home_player_X2` INTEGER,
`home_player_X3` INTEGER,
`home_player_X4` INTEGER,
`home_player_X5` INTEGER,
`home_player_X6` INTEGER,
`home_player_X7` INTEGER,
`home_player_X8` INTEGER,
`home_player_X9` INTEGER,
`home_player_X10` INTEGER,
`home_player_X11` INTEGER,
`away_player_X1` INTEGER,
`away_player_X2` INTEGER,
`away_player_X3` INTEGER,
`away_player_X4` INTEGER,
`away_player_X5` INTEGER,
`away_player_X6` INTEGER,
`away_player_X7` INTEGER,
`away_player_X8` INTEGER,
`away_player_X9` INTEGER,
`away_player_X10` INTEGER,
`away_player_X11` INTEGER,
`home_player_Y1` INTEGER,
`home_player_Y2` INTEGER,
`home_player_Y3` INTEGER,
`home_player_Y4` INTEGER,
`home_player_Y5` INTEGER,
`home_player_Y6` INTEGER,
`home_player_Y7` INTEGER,
`home_player_Y8` INTEGER,
`home_player_Y9` INTEGER,
`home_player_Y10` INTEGER,
`home_player_Y11` INTEGER,
`away_player_Y1` INTEGER,
`away_player_Y2` INTEGER,
`away_player_Y3` INTEGER,
`away_player_Y4` INTEGER,
`away_player_Y5` INTEGER,
`away_player_Y6` INTEGER,
`away_player_Y7` INTEGER,
`away_player_Y8` INTEGER,
`away_player_Y9` INTEGER,
`away_player_Y10` INTEGER,
`away_player_Y11` INTEGER,
`home_player_1` INTEGER,
`home_player_2` INTEGER,
`home_player_3` INTEGER,
`home_player_4` INTEGER,
`home_player_5` INTEGER,
`home_player_6` INTEGER,
`home_player_7` INTEGER,
`home_player_8` INTEGER,
`home_player_9` INTEGER,
`home_player_10` INTEGER,
`home_player_11` INTEGER,
`away_player_1` INTEGER,
`away_player_2` INTEGER,
`away_player_3` INTEGER,
`away_player_4` INTEGER,
`away_player_5` INTEGER,
`away_player_6` INTEGER,
`away_player_7` INTEGER,
`away_player_8` INTEGER,
`away_player_9` INTEGER,
`away_player_10` INTEGER,
`away_player_11` INTEGER,
`goal` TEXT,
`shoton` TEXT,
`shotoff` TEXT,
`foulcommit` TEXT,
`card` TEXT,
`cross` TEXT,
`corner` TEXT,
`possession` TEXT,
`B365H` NUMERIC,
`B365D` NUMERIC,
`B365A` NUMERIC,
`BWH` NUMERIC,
`BWD` NUMERIC,
`BWA` NUMERIC,
`IWH` NUMERIC,
`IWD` NUMERIC,
`IWA` NUMERIC,
`LBH` NUMERIC,
`LBD` NUMERIC,
`LBA` NUMERIC,
`PSH` NUMERIC,
`PSD` NUMERIC,
`PSA` NUMERIC,
`WHH` NUMERIC,
`WHD` NUMERIC,
`WHA` NUMERIC,
`SJH` NUMERIC,
`SJD` NUMERIC,
`SJA` NUMERIC,
`VCH` NUMERIC,
`VCD` NUMERIC,
`VCA` NUMERIC,
`GBH` NUMERIC,
`GBD` NUMERIC,
`GBA` NUMERIC,
`BSH` NUMERIC,
`BSD` NUMERIC,
`BSA` NUMERIC,
FOREIGN KEY(`country_id`) REFERENCES `Country`(`id`),
FOREIGN KEY(`league_id`) REFERENCES `League`(`id`),
FOREIGN KEY(`home_team_api_id`) REFERENCES `Team`(`team_api_id`),
FOREIGN KEY(`away_team_api_id`) REFERENCES `Team`(`team_api_id`),
FOREIGN KEY(`home_player_1`) REFERENCES `Player`(`player_api_id`),
FOREIGN KEY(`home_player_2`) REFERENCES `Player`(`player_api_id`),
FOREIGN KEY(`home_player_3`) REFERENCES `Player`(`player_api_id`),
FOREIGN KEY(`home_player_4`) REFERENCES `Player`(`player_api_id`),
FOREIGN KEY(`home_player_5`) REFERENCES `Player`(`player_api_id`),
FOREIGN KEY(`home_player_6`) REFERENCES `Player`(`player_api_id`),
FOREIGN KEY(`home_player_7`) REFERENCES `Player`(`player_api_id`),
FOREIGN KEY(`home_player_8`) REFERENCES `Player`(`player_api_id`),
FOREIGN KEY(`home_player_9`) REFERENCES `Player`(`player_api_id`),
FOREIGN KEY(`home_player_10`) REFERENCES `Player`(`player_api_id`),
FOREIGN KEY(`home_player_11`) REFERENCES `Player`(`player_api_id`),
FOREIGN KEY(`away_player_1`) REFERENCES `Player`(`player_api_id`),
FOREIGN KEY(`away_player_2`) REFERENCES `Player`(`player_api_id`),
FOREIGN KEY(`away_player_3`) REFERENCES `Player`(`player_api_id`),
FOREIGN KEY(`away_player_4`) REFERENCES `Player`(`player_api_id`),
FOREIGN KEY(`away_player_5`) REFERENCES `Player`(`player_api_id`),
FOREIGN KEY(`away_player_6`) REFERENCES `Player`(`player_api_id`),
FOREIGN KEY(`away_player_7`) REFERENCES `Player`(`player_api_id`),
FOREIGN KEY(`away_player_8`) REFERENCES `Player`(`player_api_id`),
FOREIGN KEY(`away_player_9`) REFERENCES `Player`(`player_api_id`),
FOREIGN KEY(`away_player_10`) REFERENCES `Player`(`player_api_id`),
FOREIGN KEY(`away_player_11`) REFERENCES `Player`(`player_api_id`)
);
CREATE TABLE `League` (
`id` INTEGER PRIMARY KEY AUTOINCREMENT,
`country_id` INTEGER,
`name` TEXT UNIQUE,
FOREIGN KEY(`country_id`) REFERENCES `Country`(`id`)
);
CREATE TABLE `Country` (
`id` INTEGER PRIMARY KEY AUTOINCREMENT,
`name` TEXT UNIQUE
);
CREATE TABLE "Team" (
`id` INTEGER PRIMARY KEY AUTOINCREMENT,
`team_api_id` INTEGER UNIQUE,
`team_fifa_api_id` INTEGER,
`team_long_name` TEXT,
`team_short_name` TEXT
);
CREATE TABLE `Team_Attributes` (
`id` INTEGER PRIMARY KEY AUTOINCREMENT,
`team_fifa_api_id` INTEGER,
`team_api_id` INTEGER,
`date` TEXT,
`buildUpPlaySpeed` INTEGER,
`buildUpPlaySpeedClass` TEXT,
`buildUpPlayDribbling` INTEGER,
`buildUpPlayDribblingClass` TEXT,
`buildUpPlayPassing` INTEGER,
`buildUpPlayPassingClass` TEXT,
`buildUpPlayPositioningClass` TEXT,
`chanceCreationPassing` INTEGER,
`chanceCreationPassingClass` TEXT,
`chanceCreationCrossing` INTEGER,
`chanceCreationCrossingClass` TEXT,
`chanceCreationShooting` INTEGER,
`chanceCreationShootingClass` TEXT,
`chanceCreationPositioningClass` TEXT,
`defencePressure` INTEGER,
`defencePressureClass` TEXT,
`defenceAggression` INTEGER,
`defenceAggressionClass` TEXT,
`defenceTeamWidth` INTEGER,
`defenceTeamWidthClass` TEXT,
`defenceDefenderLineClass` TEXT,
FOREIGN KEY(`team_fifa_api_id`) REFERENCES `Team`(`team_fifa_api_id`),
FOREIGN KEY(`team_api_id`) REFERENCES `Team`(`team_api_id`)
);
INSERT INTO "Player_Attributes" VALUES(1,218353,505942,'2016-02-18 00:00:00',67,71,'right','medium','medium',49,44,71,61,44,51,45,39,64,49,60,64,59,47,65,55,58,54,76,35,71,70,45,54,48,65,69,69,6,11,10,8,8);
INSERT INTO "Player" VALUES(1,505942,'Aaron Appindangoye',218353,'1992-02-29 00:00:00',182.88,187);
INSERT INTO "Match" VALUES(1,1,1,'2008/2009',1,'2008-08-17 00:00:00',492473,9987,9993,1,1,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,1.73,3.4,5,1.75,3.35,4.2,1.85,3.2,3.5,1.8,3.3,3.75,NULL,NULL,NULL,1.7,3.3,4.33,1.9,3.3,4,1.65,3.4,4.5,1.78,3.25,4,1.73,3.4,4.2);
INSERT INTO "League" VALUES(1,1,'Belgium Jupiler League');
INSERT INTO "Country" VALUES(1,'Belgium');
INSERT INTO "Team" VALUES(1,9987,673,'KRC Genk','GEN');
INSERT INTO "Team_Attributes" VALUES(1,434,9930,'2010-02-22 00:00:00',60,'Balanced',NULL,'Little',50,'Mixed','Organised',60,'Normal',65,'Normal',55,'Normal','Organised',50,'Medium',55,'Press',45,'Normal','Cover'); |
performance_attendance | SELECT count(*) FROM performance | How many performances are there? | CREATE TABLE "member" (
"Member_ID" text,
"Name" text,
"Nationality" text,
"Role" text,
PRIMARY KEY ("Member_ID")
);
CREATE TABLE "performance" (
"Performance_ID" real,
"Date" text,
"Host" text,
"Location" text,
"Attendance" int,
PRIMARY KEY ("Performance_ID")
);
CREATE TABLE "member_attendance" (
"Member_ID" int,
"Performance_ID" int,
"Num_of_Pieces" int,
PRIMARY KEY ("Member_ID","Performance_ID"),
FOREIGN KEY ("Member_ID") REFERENCES `member`("Member_ID"),
FOREIGN KEY ("Performance_ID") REFERENCES `performance`("Performance_ID")
);
INSERT INTO "member" VALUES ("1","Wilfredo Ruiz","Uruguay","Prime Violin");
INSERT INTO "performance" VALUES (1,"February 2","Boston Bruins","TD Garden","165");
INSERT INTO "member_attendance" VALUES (11,3,2); |
performance_attendance | SELECT HOST FROM performance ORDER BY Attendance ASC | List the hosts of performances in ascending order of attendance. | CREATE TABLE "member" (
"Member_ID" text,
"Name" text,
"Nationality" text,
"Role" text,
PRIMARY KEY ("Member_ID")
);
CREATE TABLE "performance" (
"Performance_ID" real,
"Date" text,
"Host" text,
"Location" text,
"Attendance" int,
PRIMARY KEY ("Performance_ID")
);
CREATE TABLE "member_attendance" (
"Member_ID" int,
"Performance_ID" int,
"Num_of_Pieces" int,
PRIMARY KEY ("Member_ID","Performance_ID"),
FOREIGN KEY ("Member_ID") REFERENCES `member`("Member_ID"),
FOREIGN KEY ("Performance_ID") REFERENCES `performance`("Performance_ID")
);
INSERT INTO "member" VALUES ("1","Wilfredo Ruiz","Uruguay","Prime Violin");
INSERT INTO "performance" VALUES (1,"February 2","Boston Bruins","TD Garden","165");
INSERT INTO "member_attendance" VALUES (11,3,2); |
performance_attendance | SELECT Date , LOCATION FROM performance | What are the dates and locations of performances? | CREATE TABLE "member" (
"Member_ID" text,
"Name" text,
"Nationality" text,
"Role" text,
PRIMARY KEY ("Member_ID")
);
CREATE TABLE "performance" (
"Performance_ID" real,
"Date" text,
"Host" text,
"Location" text,
"Attendance" int,
PRIMARY KEY ("Performance_ID")
);
CREATE TABLE "member_attendance" (
"Member_ID" int,
"Performance_ID" int,
"Num_of_Pieces" int,
PRIMARY KEY ("Member_ID","Performance_ID"),
FOREIGN KEY ("Member_ID") REFERENCES `member`("Member_ID"),
FOREIGN KEY ("Performance_ID") REFERENCES `performance`("Performance_ID")
);
INSERT INTO "member" VALUES ("1","Wilfredo Ruiz","Uruguay","Prime Violin");
INSERT INTO "performance" VALUES (1,"February 2","Boston Bruins","TD Garden","165");
INSERT INTO "member_attendance" VALUES (11,3,2); |
performance_attendance | SELECT Attendance FROM performance WHERE LOCATION = "TD Garden" OR LOCATION = "Bell Centre" | Show the attendances of the performances at location "TD Garden" or "Bell Centre" | CREATE TABLE "member" (
"Member_ID" text,
"Name" text,
"Nationality" text,
"Role" text,
PRIMARY KEY ("Member_ID")
);
CREATE TABLE "performance" (
"Performance_ID" real,
"Date" text,
"Host" text,
"Location" text,
"Attendance" int,
PRIMARY KEY ("Performance_ID")
);
CREATE TABLE "member_attendance" (
"Member_ID" int,
"Performance_ID" int,
"Num_of_Pieces" int,
PRIMARY KEY ("Member_ID","Performance_ID"),
FOREIGN KEY ("Member_ID") REFERENCES `member`("Member_ID"),
FOREIGN KEY ("Performance_ID") REFERENCES `performance`("Performance_ID")
);
INSERT INTO "member" VALUES ("1","Wilfredo Ruiz","Uruguay","Prime Violin");
INSERT INTO "performance" VALUES (1,"February 2","Boston Bruins","TD Garden","165");
INSERT INTO "member_attendance" VALUES (11,3,2); |
Subsets and Splits