db_id
stringclasses
127 values
query
stringlengths
20
523
question
stringlengths
16
224
schema
stringclasses
127 values
driving_school
SELECT count(*) FROM Lessons AS T1 JOIN Staff AS T2 ON T1.staff_id = T2.staff_id WHERE T2.first_name LIKE "%a%"
How many lessons taught by staff whose first name has letter 'a' in it?
PRAGMA foreign_keys = ON; CREATE TABLE `Addresses` ( `address_id` INTEGER PRIMARY KEY, `line_1_number_building` VARCHAR(80), `city` VARCHAR(50), `zip_postcode` VARCHAR(20), `state_province_county` VARCHAR(50), `country` VARCHAR(50) ); CREATE TABLE `Staff` ( `staff_id` INTEGER PRIMARY KEY, `staff_address_id` INTEGER NOT NULL, `nickname` VARCHAR(80), `first_name` VARCHAR(80), `middle_name` VARCHAR(80), `last_name` VARCHAR(80), `date_of_birth` DATETIME, `date_joined_staff` DATETIME, `date_left_staff` DATETIME, FOREIGN KEY (`staff_address_id` ) REFERENCES `Addresses`(`address_id` ) ); CREATE TABLE `Vehicles` ( `vehicle_id` INTEGER PRIMARY KEY, `vehicle_details` VARCHAR(255) ); CREATE TABLE `Customers` ( `customer_id` INTEGER PRIMARY KEY, `customer_address_id` INTEGER NOT NULL, `customer_status_code` VARCHAR(15) NOT NULL, `date_became_customer` DATETIME, `date_of_birth` DATETIME, `first_name` VARCHAR(80), `last_name` VARCHAR(80), `amount_outstanding` DOUBLE NULL, `email_address` VARCHAR(250), `phone_number` VARCHAR(255), `cell_mobile_phone_number` VARCHAR(255), FOREIGN KEY (`customer_address_id` ) REFERENCES `Addresses`(`address_id` ) ); CREATE TABLE `Customer_Payments` ( `customer_id` INTEGER NOT NULL, `datetime_payment` DATETIME NOT NULL, `payment_method_code` VARCHAR(10) NOT NULL, `amount_payment` DOUBLE NULL, PRIMARY KEY (`customer_id`,`datetime_payment`), FOREIGN KEY (`customer_id` ) REFERENCES `Customers`(`customer_id` ) ); CREATE TABLE `Lessons` ( `lesson_id` INTEGER PRIMARY KEY, `customer_id` INTEGER NOT NULL, `lesson_status_code` VARCHAR(15) NOT NULL, `staff_id` INTEGER, `vehicle_id` INTEGER NOT NULL, `lesson_date` DATETIME, `lesson_time` VARCHAR(10), `price` DOUBLE NULL, FOREIGN KEY (`vehicle_id` ) REFERENCES `Vehicles`(`vehicle_id` ), FOREIGN KEY (`staff_id` ) REFERENCES `Staff`(`staff_id` ), FOREIGN KEY (`customer_id` ) REFERENCES `Customers`(`customer_id` ) ); INSERT INTO Addresses (`address_id`, `line_1_number_building`, `city`, `zip_postcode`, `state_province_county`, `country`) VALUES (1, '3904 Stroman Passage', 'Port Melyssa', '14445', 'Georgia', 'USA')INSERT INTO Staff (`staff_id`, `staff_address_id`, `nickname`, `first_name`, `middle_name`, `last_name`, `date_of_birth`, `date_joined_staff`, `date_left_staff`) VALUES (1, 14, 'thompson.constantin', 'Janessa', 'Amara', 'Sawayn', '2010-12-08 16:55:14', '2017-04-27 03:21:26', '2018-03-23 22:53:12')INSERT INTO Vehicles (`vehicle_id`, `vehicle_details`) VALUES (1, 'Van')INSERT INTO Customers (`customer_id`, `customer_address_id`, `customer_status_code`, `date_became_customer`, `date_of_birth`, `first_name`, `last_name`, `amount_outstanding`, `email_address`, `phone_number`, `cell_mobile_phone_number`) VALUES (1, 13, 'Bad Customer', '2016-05-11 17:03:48', '1998-12-15 13:24:40', 'Carole', 'Bernhard', '255', 'everette.goyette@example.org', '07278206718', '861-638-9797')INSERT INTO Customer_Payments (`customer_id`, `datetime_payment`, `payment_method_code`, `amount_payment`) VALUES (11, '2018-02-05 18:44:46', 'Direct Debit', '9570.93')INSERT INTO Lessons (`lesson_id`, `customer_id`, `lesson_status_code`, `staff_id`, `vehicle_id`, `lesson_date`, `lesson_time`, `price`) VALUES (1, 6, 'Cancelled', 8, 3, '2018-02-28 10:55:36', '5', '199')
driving_school
SELECT count(*) FROM Lessons AS T1 JOIN Staff AS T2 ON T1.staff_id = T2.staff_id WHERE T2.first_name LIKE "%a%"
How many lessons were taught by a staff member whose first name has the letter 'a' in it?
PRAGMA foreign_keys = ON; CREATE TABLE `Addresses` ( `address_id` INTEGER PRIMARY KEY, `line_1_number_building` VARCHAR(80), `city` VARCHAR(50), `zip_postcode` VARCHAR(20), `state_province_county` VARCHAR(50), `country` VARCHAR(50) ); CREATE TABLE `Staff` ( `staff_id` INTEGER PRIMARY KEY, `staff_address_id` INTEGER NOT NULL, `nickname` VARCHAR(80), `first_name` VARCHAR(80), `middle_name` VARCHAR(80), `last_name` VARCHAR(80), `date_of_birth` DATETIME, `date_joined_staff` DATETIME, `date_left_staff` DATETIME, FOREIGN KEY (`staff_address_id` ) REFERENCES `Addresses`(`address_id` ) ); CREATE TABLE `Vehicles` ( `vehicle_id` INTEGER PRIMARY KEY, `vehicle_details` VARCHAR(255) ); CREATE TABLE `Customers` ( `customer_id` INTEGER PRIMARY KEY, `customer_address_id` INTEGER NOT NULL, `customer_status_code` VARCHAR(15) NOT NULL, `date_became_customer` DATETIME, `date_of_birth` DATETIME, `first_name` VARCHAR(80), `last_name` VARCHAR(80), `amount_outstanding` DOUBLE NULL, `email_address` VARCHAR(250), `phone_number` VARCHAR(255), `cell_mobile_phone_number` VARCHAR(255), FOREIGN KEY (`customer_address_id` ) REFERENCES `Addresses`(`address_id` ) ); CREATE TABLE `Customer_Payments` ( `customer_id` INTEGER NOT NULL, `datetime_payment` DATETIME NOT NULL, `payment_method_code` VARCHAR(10) NOT NULL, `amount_payment` DOUBLE NULL, PRIMARY KEY (`customer_id`,`datetime_payment`), FOREIGN KEY (`customer_id` ) REFERENCES `Customers`(`customer_id` ) ); CREATE TABLE `Lessons` ( `lesson_id` INTEGER PRIMARY KEY, `customer_id` INTEGER NOT NULL, `lesson_status_code` VARCHAR(15) NOT NULL, `staff_id` INTEGER, `vehicle_id` INTEGER NOT NULL, `lesson_date` DATETIME, `lesson_time` VARCHAR(10), `price` DOUBLE NULL, FOREIGN KEY (`vehicle_id` ) REFERENCES `Vehicles`(`vehicle_id` ), FOREIGN KEY (`staff_id` ) REFERENCES `Staff`(`staff_id` ), FOREIGN KEY (`customer_id` ) REFERENCES `Customers`(`customer_id` ) ); INSERT INTO Addresses (`address_id`, `line_1_number_building`, `city`, `zip_postcode`, `state_province_county`, `country`) VALUES (1, '3904 Stroman Passage', 'Port Melyssa', '14445', 'Georgia', 'USA')INSERT INTO Staff (`staff_id`, `staff_address_id`, `nickname`, `first_name`, `middle_name`, `last_name`, `date_of_birth`, `date_joined_staff`, `date_left_staff`) VALUES (1, 14, 'thompson.constantin', 'Janessa', 'Amara', 'Sawayn', '2010-12-08 16:55:14', '2017-04-27 03:21:26', '2018-03-23 22:53:12')INSERT INTO Vehicles (`vehicle_id`, `vehicle_details`) VALUES (1, 'Van')INSERT INTO Customers (`customer_id`, `customer_address_id`, `customer_status_code`, `date_became_customer`, `date_of_birth`, `first_name`, `last_name`, `amount_outstanding`, `email_address`, `phone_number`, `cell_mobile_phone_number`) VALUES (1, 13, 'Bad Customer', '2016-05-11 17:03:48', '1998-12-15 13:24:40', 'Carole', 'Bernhard', '255', 'everette.goyette@example.org', '07278206718', '861-638-9797')INSERT INTO Customer_Payments (`customer_id`, `datetime_payment`, `payment_method_code`, `amount_payment`) VALUES (11, '2018-02-05 18:44:46', 'Direct Debit', '9570.93')INSERT INTO Lessons (`lesson_id`, `customer_id`, `lesson_status_code`, `staff_id`, `vehicle_id`, `lesson_date`, `lesson_time`, `price`) VALUES (1, 6, 'Cancelled', 8, 3, '2018-02-28 10:55:36', '5', '199')
driving_school
SELECT sum(lesson_time) FROM Lessons AS T1 JOIN Staff AS T2 ON T1.staff_id = T2.staff_id WHERE T2.first_name = "Janessa" AND T2.last_name = "Sawayn";
How long is the total lesson time taught by staff with first name as Janessa and last name as Sawayn?
PRAGMA foreign_keys = ON; CREATE TABLE `Addresses` ( `address_id` INTEGER PRIMARY KEY, `line_1_number_building` VARCHAR(80), `city` VARCHAR(50), `zip_postcode` VARCHAR(20), `state_province_county` VARCHAR(50), `country` VARCHAR(50) ); CREATE TABLE `Staff` ( `staff_id` INTEGER PRIMARY KEY, `staff_address_id` INTEGER NOT NULL, `nickname` VARCHAR(80), `first_name` VARCHAR(80), `middle_name` VARCHAR(80), `last_name` VARCHAR(80), `date_of_birth` DATETIME, `date_joined_staff` DATETIME, `date_left_staff` DATETIME, FOREIGN KEY (`staff_address_id` ) REFERENCES `Addresses`(`address_id` ) ); CREATE TABLE `Vehicles` ( `vehicle_id` INTEGER PRIMARY KEY, `vehicle_details` VARCHAR(255) ); CREATE TABLE `Customers` ( `customer_id` INTEGER PRIMARY KEY, `customer_address_id` INTEGER NOT NULL, `customer_status_code` VARCHAR(15) NOT NULL, `date_became_customer` DATETIME, `date_of_birth` DATETIME, `first_name` VARCHAR(80), `last_name` VARCHAR(80), `amount_outstanding` DOUBLE NULL, `email_address` VARCHAR(250), `phone_number` VARCHAR(255), `cell_mobile_phone_number` VARCHAR(255), FOREIGN KEY (`customer_address_id` ) REFERENCES `Addresses`(`address_id` ) ); CREATE TABLE `Customer_Payments` ( `customer_id` INTEGER NOT NULL, `datetime_payment` DATETIME NOT NULL, `payment_method_code` VARCHAR(10) NOT NULL, `amount_payment` DOUBLE NULL, PRIMARY KEY (`customer_id`,`datetime_payment`), FOREIGN KEY (`customer_id` ) REFERENCES `Customers`(`customer_id` ) ); CREATE TABLE `Lessons` ( `lesson_id` INTEGER PRIMARY KEY, `customer_id` INTEGER NOT NULL, `lesson_status_code` VARCHAR(15) NOT NULL, `staff_id` INTEGER, `vehicle_id` INTEGER NOT NULL, `lesson_date` DATETIME, `lesson_time` VARCHAR(10), `price` DOUBLE NULL, FOREIGN KEY (`vehicle_id` ) REFERENCES `Vehicles`(`vehicle_id` ), FOREIGN KEY (`staff_id` ) REFERENCES `Staff`(`staff_id` ), FOREIGN KEY (`customer_id` ) REFERENCES `Customers`(`customer_id` ) ); INSERT INTO Addresses (`address_id`, `line_1_number_building`, `city`, `zip_postcode`, `state_province_county`, `country`) VALUES (1, '3904 Stroman Passage', 'Port Melyssa', '14445', 'Georgia', 'USA')INSERT INTO Staff (`staff_id`, `staff_address_id`, `nickname`, `first_name`, `middle_name`, `last_name`, `date_of_birth`, `date_joined_staff`, `date_left_staff`) VALUES (1, 14, 'thompson.constantin', 'Janessa', 'Amara', 'Sawayn', '2010-12-08 16:55:14', '2017-04-27 03:21:26', '2018-03-23 22:53:12')INSERT INTO Vehicles (`vehicle_id`, `vehicle_details`) VALUES (1, 'Van')INSERT INTO Customers (`customer_id`, `customer_address_id`, `customer_status_code`, `date_became_customer`, `date_of_birth`, `first_name`, `last_name`, `amount_outstanding`, `email_address`, `phone_number`, `cell_mobile_phone_number`) VALUES (1, 13, 'Bad Customer', '2016-05-11 17:03:48', '1998-12-15 13:24:40', 'Carole', 'Bernhard', '255', 'everette.goyette@example.org', '07278206718', '861-638-9797')INSERT INTO Customer_Payments (`customer_id`, `datetime_payment`, `payment_method_code`, `amount_payment`) VALUES (11, '2018-02-05 18:44:46', 'Direct Debit', '9570.93')INSERT INTO Lessons (`lesson_id`, `customer_id`, `lesson_status_code`, `staff_id`, `vehicle_id`, `lesson_date`, `lesson_time`, `price`) VALUES (1, 6, 'Cancelled', 8, 3, '2018-02-28 10:55:36', '5', '199')
driving_school
SELECT sum(lesson_time) FROM Lessons AS T1 JOIN Staff AS T2 ON T1.staff_id = T2.staff_id WHERE T2.first_name = "Janessa" AND T2.last_name = "Sawayn";
What is the total time for all lessons taught by Janessa Sawayn?
PRAGMA foreign_keys = ON; CREATE TABLE `Addresses` ( `address_id` INTEGER PRIMARY KEY, `line_1_number_building` VARCHAR(80), `city` VARCHAR(50), `zip_postcode` VARCHAR(20), `state_province_county` VARCHAR(50), `country` VARCHAR(50) ); CREATE TABLE `Staff` ( `staff_id` INTEGER PRIMARY KEY, `staff_address_id` INTEGER NOT NULL, `nickname` VARCHAR(80), `first_name` VARCHAR(80), `middle_name` VARCHAR(80), `last_name` VARCHAR(80), `date_of_birth` DATETIME, `date_joined_staff` DATETIME, `date_left_staff` DATETIME, FOREIGN KEY (`staff_address_id` ) REFERENCES `Addresses`(`address_id` ) ); CREATE TABLE `Vehicles` ( `vehicle_id` INTEGER PRIMARY KEY, `vehicle_details` VARCHAR(255) ); CREATE TABLE `Customers` ( `customer_id` INTEGER PRIMARY KEY, `customer_address_id` INTEGER NOT NULL, `customer_status_code` VARCHAR(15) NOT NULL, `date_became_customer` DATETIME, `date_of_birth` DATETIME, `first_name` VARCHAR(80), `last_name` VARCHAR(80), `amount_outstanding` DOUBLE NULL, `email_address` VARCHAR(250), `phone_number` VARCHAR(255), `cell_mobile_phone_number` VARCHAR(255), FOREIGN KEY (`customer_address_id` ) REFERENCES `Addresses`(`address_id` ) ); CREATE TABLE `Customer_Payments` ( `customer_id` INTEGER NOT NULL, `datetime_payment` DATETIME NOT NULL, `payment_method_code` VARCHAR(10) NOT NULL, `amount_payment` DOUBLE NULL, PRIMARY KEY (`customer_id`,`datetime_payment`), FOREIGN KEY (`customer_id` ) REFERENCES `Customers`(`customer_id` ) ); CREATE TABLE `Lessons` ( `lesson_id` INTEGER PRIMARY KEY, `customer_id` INTEGER NOT NULL, `lesson_status_code` VARCHAR(15) NOT NULL, `staff_id` INTEGER, `vehicle_id` INTEGER NOT NULL, `lesson_date` DATETIME, `lesson_time` VARCHAR(10), `price` DOUBLE NULL, FOREIGN KEY (`vehicle_id` ) REFERENCES `Vehicles`(`vehicle_id` ), FOREIGN KEY (`staff_id` ) REFERENCES `Staff`(`staff_id` ), FOREIGN KEY (`customer_id` ) REFERENCES `Customers`(`customer_id` ) ); INSERT INTO Addresses (`address_id`, `line_1_number_building`, `city`, `zip_postcode`, `state_province_county`, `country`) VALUES (1, '3904 Stroman Passage', 'Port Melyssa', '14445', 'Georgia', 'USA')INSERT INTO Staff (`staff_id`, `staff_address_id`, `nickname`, `first_name`, `middle_name`, `last_name`, `date_of_birth`, `date_joined_staff`, `date_left_staff`) VALUES (1, 14, 'thompson.constantin', 'Janessa', 'Amara', 'Sawayn', '2010-12-08 16:55:14', '2017-04-27 03:21:26', '2018-03-23 22:53:12')INSERT INTO Vehicles (`vehicle_id`, `vehicle_details`) VALUES (1, 'Van')INSERT INTO Customers (`customer_id`, `customer_address_id`, `customer_status_code`, `date_became_customer`, `date_of_birth`, `first_name`, `last_name`, `amount_outstanding`, `email_address`, `phone_number`, `cell_mobile_phone_number`) VALUES (1, 13, 'Bad Customer', '2016-05-11 17:03:48', '1998-12-15 13:24:40', 'Carole', 'Bernhard', '255', 'everette.goyette@example.org', '07278206718', '861-638-9797')INSERT INTO Customer_Payments (`customer_id`, `datetime_payment`, `payment_method_code`, `amount_payment`) VALUES (11, '2018-02-05 18:44:46', 'Direct Debit', '9570.93')INSERT INTO Lessons (`lesson_id`, `customer_id`, `lesson_status_code`, `staff_id`, `vehicle_id`, `lesson_date`, `lesson_time`, `price`) VALUES (1, 6, 'Cancelled', 8, 3, '2018-02-28 10:55:36', '5', '199')
driving_school
SELECT avg(price) FROM Lessons AS T1 JOIN Staff AS T2 ON T1.staff_id = T2.staff_id WHERE T2.first_name = "Janessa" AND T2.last_name = "Sawayn";
What is average lesson price taught by staff with first name as Janessa and last name as Sawayn?
PRAGMA foreign_keys = ON; CREATE TABLE `Addresses` ( `address_id` INTEGER PRIMARY KEY, `line_1_number_building` VARCHAR(80), `city` VARCHAR(50), `zip_postcode` VARCHAR(20), `state_province_county` VARCHAR(50), `country` VARCHAR(50) ); CREATE TABLE `Staff` ( `staff_id` INTEGER PRIMARY KEY, `staff_address_id` INTEGER NOT NULL, `nickname` VARCHAR(80), `first_name` VARCHAR(80), `middle_name` VARCHAR(80), `last_name` VARCHAR(80), `date_of_birth` DATETIME, `date_joined_staff` DATETIME, `date_left_staff` DATETIME, FOREIGN KEY (`staff_address_id` ) REFERENCES `Addresses`(`address_id` ) ); CREATE TABLE `Vehicles` ( `vehicle_id` INTEGER PRIMARY KEY, `vehicle_details` VARCHAR(255) ); CREATE TABLE `Customers` ( `customer_id` INTEGER PRIMARY KEY, `customer_address_id` INTEGER NOT NULL, `customer_status_code` VARCHAR(15) NOT NULL, `date_became_customer` DATETIME, `date_of_birth` DATETIME, `first_name` VARCHAR(80), `last_name` VARCHAR(80), `amount_outstanding` DOUBLE NULL, `email_address` VARCHAR(250), `phone_number` VARCHAR(255), `cell_mobile_phone_number` VARCHAR(255), FOREIGN KEY (`customer_address_id` ) REFERENCES `Addresses`(`address_id` ) ); CREATE TABLE `Customer_Payments` ( `customer_id` INTEGER NOT NULL, `datetime_payment` DATETIME NOT NULL, `payment_method_code` VARCHAR(10) NOT NULL, `amount_payment` DOUBLE NULL, PRIMARY KEY (`customer_id`,`datetime_payment`), FOREIGN KEY (`customer_id` ) REFERENCES `Customers`(`customer_id` ) ); CREATE TABLE `Lessons` ( `lesson_id` INTEGER PRIMARY KEY, `customer_id` INTEGER NOT NULL, `lesson_status_code` VARCHAR(15) NOT NULL, `staff_id` INTEGER, `vehicle_id` INTEGER NOT NULL, `lesson_date` DATETIME, `lesson_time` VARCHAR(10), `price` DOUBLE NULL, FOREIGN KEY (`vehicle_id` ) REFERENCES `Vehicles`(`vehicle_id` ), FOREIGN KEY (`staff_id` ) REFERENCES `Staff`(`staff_id` ), FOREIGN KEY (`customer_id` ) REFERENCES `Customers`(`customer_id` ) ); INSERT INTO Addresses (`address_id`, `line_1_number_building`, `city`, `zip_postcode`, `state_province_county`, `country`) VALUES (1, '3904 Stroman Passage', 'Port Melyssa', '14445', 'Georgia', 'USA')INSERT INTO Staff (`staff_id`, `staff_address_id`, `nickname`, `first_name`, `middle_name`, `last_name`, `date_of_birth`, `date_joined_staff`, `date_left_staff`) VALUES (1, 14, 'thompson.constantin', 'Janessa', 'Amara', 'Sawayn', '2010-12-08 16:55:14', '2017-04-27 03:21:26', '2018-03-23 22:53:12')INSERT INTO Vehicles (`vehicle_id`, `vehicle_details`) VALUES (1, 'Van')INSERT INTO Customers (`customer_id`, `customer_address_id`, `customer_status_code`, `date_became_customer`, `date_of_birth`, `first_name`, `last_name`, `amount_outstanding`, `email_address`, `phone_number`, `cell_mobile_phone_number`) VALUES (1, 13, 'Bad Customer', '2016-05-11 17:03:48', '1998-12-15 13:24:40', 'Carole', 'Bernhard', '255', 'everette.goyette@example.org', '07278206718', '861-638-9797')INSERT INTO Customer_Payments (`customer_id`, `datetime_payment`, `payment_method_code`, `amount_payment`) VALUES (11, '2018-02-05 18:44:46', 'Direct Debit', '9570.93')INSERT INTO Lessons (`lesson_id`, `customer_id`, `lesson_status_code`, `staff_id`, `vehicle_id`, `lesson_date`, `lesson_time`, `price`) VALUES (1, 6, 'Cancelled', 8, 3, '2018-02-28 10:55:36', '5', '199')
driving_school
SELECT avg(price) FROM Lessons AS T1 JOIN Staff AS T2 ON T1.staff_id = T2.staff_id WHERE T2.first_name = "Janessa" AND T2.last_name = "Sawayn";
What is the average price for a lesson taught by Janessa Sawayn?
PRAGMA foreign_keys = ON; CREATE TABLE `Addresses` ( `address_id` INTEGER PRIMARY KEY, `line_1_number_building` VARCHAR(80), `city` VARCHAR(50), `zip_postcode` VARCHAR(20), `state_province_county` VARCHAR(50), `country` VARCHAR(50) ); CREATE TABLE `Staff` ( `staff_id` INTEGER PRIMARY KEY, `staff_address_id` INTEGER NOT NULL, `nickname` VARCHAR(80), `first_name` VARCHAR(80), `middle_name` VARCHAR(80), `last_name` VARCHAR(80), `date_of_birth` DATETIME, `date_joined_staff` DATETIME, `date_left_staff` DATETIME, FOREIGN KEY (`staff_address_id` ) REFERENCES `Addresses`(`address_id` ) ); CREATE TABLE `Vehicles` ( `vehicle_id` INTEGER PRIMARY KEY, `vehicle_details` VARCHAR(255) ); CREATE TABLE `Customers` ( `customer_id` INTEGER PRIMARY KEY, `customer_address_id` INTEGER NOT NULL, `customer_status_code` VARCHAR(15) NOT NULL, `date_became_customer` DATETIME, `date_of_birth` DATETIME, `first_name` VARCHAR(80), `last_name` VARCHAR(80), `amount_outstanding` DOUBLE NULL, `email_address` VARCHAR(250), `phone_number` VARCHAR(255), `cell_mobile_phone_number` VARCHAR(255), FOREIGN KEY (`customer_address_id` ) REFERENCES `Addresses`(`address_id` ) ); CREATE TABLE `Customer_Payments` ( `customer_id` INTEGER NOT NULL, `datetime_payment` DATETIME NOT NULL, `payment_method_code` VARCHAR(10) NOT NULL, `amount_payment` DOUBLE NULL, PRIMARY KEY (`customer_id`,`datetime_payment`), FOREIGN KEY (`customer_id` ) REFERENCES `Customers`(`customer_id` ) ); CREATE TABLE `Lessons` ( `lesson_id` INTEGER PRIMARY KEY, `customer_id` INTEGER NOT NULL, `lesson_status_code` VARCHAR(15) NOT NULL, `staff_id` INTEGER, `vehicle_id` INTEGER NOT NULL, `lesson_date` DATETIME, `lesson_time` VARCHAR(10), `price` DOUBLE NULL, FOREIGN KEY (`vehicle_id` ) REFERENCES `Vehicles`(`vehicle_id` ), FOREIGN KEY (`staff_id` ) REFERENCES `Staff`(`staff_id` ), FOREIGN KEY (`customer_id` ) REFERENCES `Customers`(`customer_id` ) ); INSERT INTO Addresses (`address_id`, `line_1_number_building`, `city`, `zip_postcode`, `state_province_county`, `country`) VALUES (1, '3904 Stroman Passage', 'Port Melyssa', '14445', 'Georgia', 'USA')INSERT INTO Staff (`staff_id`, `staff_address_id`, `nickname`, `first_name`, `middle_name`, `last_name`, `date_of_birth`, `date_joined_staff`, `date_left_staff`) VALUES (1, 14, 'thompson.constantin', 'Janessa', 'Amara', 'Sawayn', '2010-12-08 16:55:14', '2017-04-27 03:21:26', '2018-03-23 22:53:12')INSERT INTO Vehicles (`vehicle_id`, `vehicle_details`) VALUES (1, 'Van')INSERT INTO Customers (`customer_id`, `customer_address_id`, `customer_status_code`, `date_became_customer`, `date_of_birth`, `first_name`, `last_name`, `amount_outstanding`, `email_address`, `phone_number`, `cell_mobile_phone_number`) VALUES (1, 13, 'Bad Customer', '2016-05-11 17:03:48', '1998-12-15 13:24:40', 'Carole', 'Bernhard', '255', 'everette.goyette@example.org', '07278206718', '861-638-9797')INSERT INTO Customer_Payments (`customer_id`, `datetime_payment`, `payment_method_code`, `amount_payment`) VALUES (11, '2018-02-05 18:44:46', 'Direct Debit', '9570.93')INSERT INTO Lessons (`lesson_id`, `customer_id`, `lesson_status_code`, `staff_id`, `vehicle_id`, `lesson_date`, `lesson_time`, `price`) VALUES (1, 6, 'Cancelled', 8, 3, '2018-02-28 10:55:36', '5', '199')
driving_school
SELECT count(*) FROM Lessons AS T1 JOIN Customers AS T2 ON T1.customer_id = T2.customer_id WHERE T2.first_name = "Ray"
How many lesson does customer with first name Ray took?
PRAGMA foreign_keys = ON; CREATE TABLE `Addresses` ( `address_id` INTEGER PRIMARY KEY, `line_1_number_building` VARCHAR(80), `city` VARCHAR(50), `zip_postcode` VARCHAR(20), `state_province_county` VARCHAR(50), `country` VARCHAR(50) ); CREATE TABLE `Staff` ( `staff_id` INTEGER PRIMARY KEY, `staff_address_id` INTEGER NOT NULL, `nickname` VARCHAR(80), `first_name` VARCHAR(80), `middle_name` VARCHAR(80), `last_name` VARCHAR(80), `date_of_birth` DATETIME, `date_joined_staff` DATETIME, `date_left_staff` DATETIME, FOREIGN KEY (`staff_address_id` ) REFERENCES `Addresses`(`address_id` ) ); CREATE TABLE `Vehicles` ( `vehicle_id` INTEGER PRIMARY KEY, `vehicle_details` VARCHAR(255) ); CREATE TABLE `Customers` ( `customer_id` INTEGER PRIMARY KEY, `customer_address_id` INTEGER NOT NULL, `customer_status_code` VARCHAR(15) NOT NULL, `date_became_customer` DATETIME, `date_of_birth` DATETIME, `first_name` VARCHAR(80), `last_name` VARCHAR(80), `amount_outstanding` DOUBLE NULL, `email_address` VARCHAR(250), `phone_number` VARCHAR(255), `cell_mobile_phone_number` VARCHAR(255), FOREIGN KEY (`customer_address_id` ) REFERENCES `Addresses`(`address_id` ) ); CREATE TABLE `Customer_Payments` ( `customer_id` INTEGER NOT NULL, `datetime_payment` DATETIME NOT NULL, `payment_method_code` VARCHAR(10) NOT NULL, `amount_payment` DOUBLE NULL, PRIMARY KEY (`customer_id`,`datetime_payment`), FOREIGN KEY (`customer_id` ) REFERENCES `Customers`(`customer_id` ) ); CREATE TABLE `Lessons` ( `lesson_id` INTEGER PRIMARY KEY, `customer_id` INTEGER NOT NULL, `lesson_status_code` VARCHAR(15) NOT NULL, `staff_id` INTEGER, `vehicle_id` INTEGER NOT NULL, `lesson_date` DATETIME, `lesson_time` VARCHAR(10), `price` DOUBLE NULL, FOREIGN KEY (`vehicle_id` ) REFERENCES `Vehicles`(`vehicle_id` ), FOREIGN KEY (`staff_id` ) REFERENCES `Staff`(`staff_id` ), FOREIGN KEY (`customer_id` ) REFERENCES `Customers`(`customer_id` ) ); INSERT INTO Addresses (`address_id`, `line_1_number_building`, `city`, `zip_postcode`, `state_province_county`, `country`) VALUES (1, '3904 Stroman Passage', 'Port Melyssa', '14445', 'Georgia', 'USA')INSERT INTO Staff (`staff_id`, `staff_address_id`, `nickname`, `first_name`, `middle_name`, `last_name`, `date_of_birth`, `date_joined_staff`, `date_left_staff`) VALUES (1, 14, 'thompson.constantin', 'Janessa', 'Amara', 'Sawayn', '2010-12-08 16:55:14', '2017-04-27 03:21:26', '2018-03-23 22:53:12')INSERT INTO Vehicles (`vehicle_id`, `vehicle_details`) VALUES (1, 'Van')INSERT INTO Customers (`customer_id`, `customer_address_id`, `customer_status_code`, `date_became_customer`, `date_of_birth`, `first_name`, `last_name`, `amount_outstanding`, `email_address`, `phone_number`, `cell_mobile_phone_number`) VALUES (1, 13, 'Bad Customer', '2016-05-11 17:03:48', '1998-12-15 13:24:40', 'Carole', 'Bernhard', '255', 'everette.goyette@example.org', '07278206718', '861-638-9797')INSERT INTO Customer_Payments (`customer_id`, `datetime_payment`, `payment_method_code`, `amount_payment`) VALUES (11, '2018-02-05 18:44:46', 'Direct Debit', '9570.93')INSERT INTO Lessons (`lesson_id`, `customer_id`, `lesson_status_code`, `staff_id`, `vehicle_id`, `lesson_date`, `lesson_time`, `price`) VALUES (1, 6, 'Cancelled', 8, 3, '2018-02-28 10:55:36', '5', '199')
driving_school
SELECT count(*) FROM Lessons AS T1 JOIN Customers AS T2 ON T1.customer_id = T2.customer_id WHERE T2.first_name = "Ray"
How many lessons did the customer with the first name Ray take?
PRAGMA foreign_keys = ON; CREATE TABLE `Addresses` ( `address_id` INTEGER PRIMARY KEY, `line_1_number_building` VARCHAR(80), `city` VARCHAR(50), `zip_postcode` VARCHAR(20), `state_province_county` VARCHAR(50), `country` VARCHAR(50) ); CREATE TABLE `Staff` ( `staff_id` INTEGER PRIMARY KEY, `staff_address_id` INTEGER NOT NULL, `nickname` VARCHAR(80), `first_name` VARCHAR(80), `middle_name` VARCHAR(80), `last_name` VARCHAR(80), `date_of_birth` DATETIME, `date_joined_staff` DATETIME, `date_left_staff` DATETIME, FOREIGN KEY (`staff_address_id` ) REFERENCES `Addresses`(`address_id` ) ); CREATE TABLE `Vehicles` ( `vehicle_id` INTEGER PRIMARY KEY, `vehicle_details` VARCHAR(255) ); CREATE TABLE `Customers` ( `customer_id` INTEGER PRIMARY KEY, `customer_address_id` INTEGER NOT NULL, `customer_status_code` VARCHAR(15) NOT NULL, `date_became_customer` DATETIME, `date_of_birth` DATETIME, `first_name` VARCHAR(80), `last_name` VARCHAR(80), `amount_outstanding` DOUBLE NULL, `email_address` VARCHAR(250), `phone_number` VARCHAR(255), `cell_mobile_phone_number` VARCHAR(255), FOREIGN KEY (`customer_address_id` ) REFERENCES `Addresses`(`address_id` ) ); CREATE TABLE `Customer_Payments` ( `customer_id` INTEGER NOT NULL, `datetime_payment` DATETIME NOT NULL, `payment_method_code` VARCHAR(10) NOT NULL, `amount_payment` DOUBLE NULL, PRIMARY KEY (`customer_id`,`datetime_payment`), FOREIGN KEY (`customer_id` ) REFERENCES `Customers`(`customer_id` ) ); CREATE TABLE `Lessons` ( `lesson_id` INTEGER PRIMARY KEY, `customer_id` INTEGER NOT NULL, `lesson_status_code` VARCHAR(15) NOT NULL, `staff_id` INTEGER, `vehicle_id` INTEGER NOT NULL, `lesson_date` DATETIME, `lesson_time` VARCHAR(10), `price` DOUBLE NULL, FOREIGN KEY (`vehicle_id` ) REFERENCES `Vehicles`(`vehicle_id` ), FOREIGN KEY (`staff_id` ) REFERENCES `Staff`(`staff_id` ), FOREIGN KEY (`customer_id` ) REFERENCES `Customers`(`customer_id` ) ); INSERT INTO Addresses (`address_id`, `line_1_number_building`, `city`, `zip_postcode`, `state_province_county`, `country`) VALUES (1, '3904 Stroman Passage', 'Port Melyssa', '14445', 'Georgia', 'USA')INSERT INTO Staff (`staff_id`, `staff_address_id`, `nickname`, `first_name`, `middle_name`, `last_name`, `date_of_birth`, `date_joined_staff`, `date_left_staff`) VALUES (1, 14, 'thompson.constantin', 'Janessa', 'Amara', 'Sawayn', '2010-12-08 16:55:14', '2017-04-27 03:21:26', '2018-03-23 22:53:12')INSERT INTO Vehicles (`vehicle_id`, `vehicle_details`) VALUES (1, 'Van')INSERT INTO Customers (`customer_id`, `customer_address_id`, `customer_status_code`, `date_became_customer`, `date_of_birth`, `first_name`, `last_name`, `amount_outstanding`, `email_address`, `phone_number`, `cell_mobile_phone_number`) VALUES (1, 13, 'Bad Customer', '2016-05-11 17:03:48', '1998-12-15 13:24:40', 'Carole', 'Bernhard', '255', 'everette.goyette@example.org', '07278206718', '861-638-9797')INSERT INTO Customer_Payments (`customer_id`, `datetime_payment`, `payment_method_code`, `amount_payment`) VALUES (11, '2018-02-05 18:44:46', 'Direct Debit', '9570.93')INSERT INTO Lessons (`lesson_id`, `customer_id`, `lesson_status_code`, `staff_id`, `vehicle_id`, `lesson_date`, `lesson_time`, `price`) VALUES (1, 6, 'Cancelled', 8, 3, '2018-02-28 10:55:36', '5', '199')
driving_school
SELECT last_name FROM Customers INTERSECT SELECT last_name FROM Staff
Which last names are both used by customers and by staff?
PRAGMA foreign_keys = ON; CREATE TABLE `Addresses` ( `address_id` INTEGER PRIMARY KEY, `line_1_number_building` VARCHAR(80), `city` VARCHAR(50), `zip_postcode` VARCHAR(20), `state_province_county` VARCHAR(50), `country` VARCHAR(50) ); CREATE TABLE `Staff` ( `staff_id` INTEGER PRIMARY KEY, `staff_address_id` INTEGER NOT NULL, `nickname` VARCHAR(80), `first_name` VARCHAR(80), `middle_name` VARCHAR(80), `last_name` VARCHAR(80), `date_of_birth` DATETIME, `date_joined_staff` DATETIME, `date_left_staff` DATETIME, FOREIGN KEY (`staff_address_id` ) REFERENCES `Addresses`(`address_id` ) ); CREATE TABLE `Vehicles` ( `vehicle_id` INTEGER PRIMARY KEY, `vehicle_details` VARCHAR(255) ); CREATE TABLE `Customers` ( `customer_id` INTEGER PRIMARY KEY, `customer_address_id` INTEGER NOT NULL, `customer_status_code` VARCHAR(15) NOT NULL, `date_became_customer` DATETIME, `date_of_birth` DATETIME, `first_name` VARCHAR(80), `last_name` VARCHAR(80), `amount_outstanding` DOUBLE NULL, `email_address` VARCHAR(250), `phone_number` VARCHAR(255), `cell_mobile_phone_number` VARCHAR(255), FOREIGN KEY (`customer_address_id` ) REFERENCES `Addresses`(`address_id` ) ); CREATE TABLE `Customer_Payments` ( `customer_id` INTEGER NOT NULL, `datetime_payment` DATETIME NOT NULL, `payment_method_code` VARCHAR(10) NOT NULL, `amount_payment` DOUBLE NULL, PRIMARY KEY (`customer_id`,`datetime_payment`), FOREIGN KEY (`customer_id` ) REFERENCES `Customers`(`customer_id` ) ); CREATE TABLE `Lessons` ( `lesson_id` INTEGER PRIMARY KEY, `customer_id` INTEGER NOT NULL, `lesson_status_code` VARCHAR(15) NOT NULL, `staff_id` INTEGER, `vehicle_id` INTEGER NOT NULL, `lesson_date` DATETIME, `lesson_time` VARCHAR(10), `price` DOUBLE NULL, FOREIGN KEY (`vehicle_id` ) REFERENCES `Vehicles`(`vehicle_id` ), FOREIGN KEY (`staff_id` ) REFERENCES `Staff`(`staff_id` ), FOREIGN KEY (`customer_id` ) REFERENCES `Customers`(`customer_id` ) ); INSERT INTO Addresses (`address_id`, `line_1_number_building`, `city`, `zip_postcode`, `state_province_county`, `country`) VALUES (1, '3904 Stroman Passage', 'Port Melyssa', '14445', 'Georgia', 'USA')INSERT INTO Staff (`staff_id`, `staff_address_id`, `nickname`, `first_name`, `middle_name`, `last_name`, `date_of_birth`, `date_joined_staff`, `date_left_staff`) VALUES (1, 14, 'thompson.constantin', 'Janessa', 'Amara', 'Sawayn', '2010-12-08 16:55:14', '2017-04-27 03:21:26', '2018-03-23 22:53:12')INSERT INTO Vehicles (`vehicle_id`, `vehicle_details`) VALUES (1, 'Van')INSERT INTO Customers (`customer_id`, `customer_address_id`, `customer_status_code`, `date_became_customer`, `date_of_birth`, `first_name`, `last_name`, `amount_outstanding`, `email_address`, `phone_number`, `cell_mobile_phone_number`) VALUES (1, 13, 'Bad Customer', '2016-05-11 17:03:48', '1998-12-15 13:24:40', 'Carole', 'Bernhard', '255', 'everette.goyette@example.org', '07278206718', '861-638-9797')INSERT INTO Customer_Payments (`customer_id`, `datetime_payment`, `payment_method_code`, `amount_payment`) VALUES (11, '2018-02-05 18:44:46', 'Direct Debit', '9570.93')INSERT INTO Lessons (`lesson_id`, `customer_id`, `lesson_status_code`, `staff_id`, `vehicle_id`, `lesson_date`, `lesson_time`, `price`) VALUES (1, 6, 'Cancelled', 8, 3, '2018-02-28 10:55:36', '5', '199')
driving_school
SELECT last_name FROM Customers INTERSECT SELECT last_name FROM Staff
What are the last names that are used by customers and staff?
PRAGMA foreign_keys = ON; CREATE TABLE `Addresses` ( `address_id` INTEGER PRIMARY KEY, `line_1_number_building` VARCHAR(80), `city` VARCHAR(50), `zip_postcode` VARCHAR(20), `state_province_county` VARCHAR(50), `country` VARCHAR(50) ); CREATE TABLE `Staff` ( `staff_id` INTEGER PRIMARY KEY, `staff_address_id` INTEGER NOT NULL, `nickname` VARCHAR(80), `first_name` VARCHAR(80), `middle_name` VARCHAR(80), `last_name` VARCHAR(80), `date_of_birth` DATETIME, `date_joined_staff` DATETIME, `date_left_staff` DATETIME, FOREIGN KEY (`staff_address_id` ) REFERENCES `Addresses`(`address_id` ) ); CREATE TABLE `Vehicles` ( `vehicle_id` INTEGER PRIMARY KEY, `vehicle_details` VARCHAR(255) ); CREATE TABLE `Customers` ( `customer_id` INTEGER PRIMARY KEY, `customer_address_id` INTEGER NOT NULL, `customer_status_code` VARCHAR(15) NOT NULL, `date_became_customer` DATETIME, `date_of_birth` DATETIME, `first_name` VARCHAR(80), `last_name` VARCHAR(80), `amount_outstanding` DOUBLE NULL, `email_address` VARCHAR(250), `phone_number` VARCHAR(255), `cell_mobile_phone_number` VARCHAR(255), FOREIGN KEY (`customer_address_id` ) REFERENCES `Addresses`(`address_id` ) ); CREATE TABLE `Customer_Payments` ( `customer_id` INTEGER NOT NULL, `datetime_payment` DATETIME NOT NULL, `payment_method_code` VARCHAR(10) NOT NULL, `amount_payment` DOUBLE NULL, PRIMARY KEY (`customer_id`,`datetime_payment`), FOREIGN KEY (`customer_id` ) REFERENCES `Customers`(`customer_id` ) ); CREATE TABLE `Lessons` ( `lesson_id` INTEGER PRIMARY KEY, `customer_id` INTEGER NOT NULL, `lesson_status_code` VARCHAR(15) NOT NULL, `staff_id` INTEGER, `vehicle_id` INTEGER NOT NULL, `lesson_date` DATETIME, `lesson_time` VARCHAR(10), `price` DOUBLE NULL, FOREIGN KEY (`vehicle_id` ) REFERENCES `Vehicles`(`vehicle_id` ), FOREIGN KEY (`staff_id` ) REFERENCES `Staff`(`staff_id` ), FOREIGN KEY (`customer_id` ) REFERENCES `Customers`(`customer_id` ) ); INSERT INTO Addresses (`address_id`, `line_1_number_building`, `city`, `zip_postcode`, `state_province_county`, `country`) VALUES (1, '3904 Stroman Passage', 'Port Melyssa', '14445', 'Georgia', 'USA')INSERT INTO Staff (`staff_id`, `staff_address_id`, `nickname`, `first_name`, `middle_name`, `last_name`, `date_of_birth`, `date_joined_staff`, `date_left_staff`) VALUES (1, 14, 'thompson.constantin', 'Janessa', 'Amara', 'Sawayn', '2010-12-08 16:55:14', '2017-04-27 03:21:26', '2018-03-23 22:53:12')INSERT INTO Vehicles (`vehicle_id`, `vehicle_details`) VALUES (1, 'Van')INSERT INTO Customers (`customer_id`, `customer_address_id`, `customer_status_code`, `date_became_customer`, `date_of_birth`, `first_name`, `last_name`, `amount_outstanding`, `email_address`, `phone_number`, `cell_mobile_phone_number`) VALUES (1, 13, 'Bad Customer', '2016-05-11 17:03:48', '1998-12-15 13:24:40', 'Carole', 'Bernhard', '255', 'everette.goyette@example.org', '07278206718', '861-638-9797')INSERT INTO Customer_Payments (`customer_id`, `datetime_payment`, `payment_method_code`, `amount_payment`) VALUES (11, '2018-02-05 18:44:46', 'Direct Debit', '9570.93')INSERT INTO Lessons (`lesson_id`, `customer_id`, `lesson_status_code`, `staff_id`, `vehicle_id`, `lesson_date`, `lesson_time`, `price`) VALUES (1, 6, 'Cancelled', 8, 3, '2018-02-28 10:55:36', '5', '199')
driving_school
SELECT first_name FROM Staff EXCEPT SELECT T2.first_name FROM Lessons AS T1 JOIN Staff AS T2 ON T1.staff_id = T2.staff_id
What is the first name of the staff who did not give any lesson?
PRAGMA foreign_keys = ON; CREATE TABLE `Addresses` ( `address_id` INTEGER PRIMARY KEY, `line_1_number_building` VARCHAR(80), `city` VARCHAR(50), `zip_postcode` VARCHAR(20), `state_province_county` VARCHAR(50), `country` VARCHAR(50) ); CREATE TABLE `Staff` ( `staff_id` INTEGER PRIMARY KEY, `staff_address_id` INTEGER NOT NULL, `nickname` VARCHAR(80), `first_name` VARCHAR(80), `middle_name` VARCHAR(80), `last_name` VARCHAR(80), `date_of_birth` DATETIME, `date_joined_staff` DATETIME, `date_left_staff` DATETIME, FOREIGN KEY (`staff_address_id` ) REFERENCES `Addresses`(`address_id` ) ); CREATE TABLE `Vehicles` ( `vehicle_id` INTEGER PRIMARY KEY, `vehicle_details` VARCHAR(255) ); CREATE TABLE `Customers` ( `customer_id` INTEGER PRIMARY KEY, `customer_address_id` INTEGER NOT NULL, `customer_status_code` VARCHAR(15) NOT NULL, `date_became_customer` DATETIME, `date_of_birth` DATETIME, `first_name` VARCHAR(80), `last_name` VARCHAR(80), `amount_outstanding` DOUBLE NULL, `email_address` VARCHAR(250), `phone_number` VARCHAR(255), `cell_mobile_phone_number` VARCHAR(255), FOREIGN KEY (`customer_address_id` ) REFERENCES `Addresses`(`address_id` ) ); CREATE TABLE `Customer_Payments` ( `customer_id` INTEGER NOT NULL, `datetime_payment` DATETIME NOT NULL, `payment_method_code` VARCHAR(10) NOT NULL, `amount_payment` DOUBLE NULL, PRIMARY KEY (`customer_id`,`datetime_payment`), FOREIGN KEY (`customer_id` ) REFERENCES `Customers`(`customer_id` ) ); CREATE TABLE `Lessons` ( `lesson_id` INTEGER PRIMARY KEY, `customer_id` INTEGER NOT NULL, `lesson_status_code` VARCHAR(15) NOT NULL, `staff_id` INTEGER, `vehicle_id` INTEGER NOT NULL, `lesson_date` DATETIME, `lesson_time` VARCHAR(10), `price` DOUBLE NULL, FOREIGN KEY (`vehicle_id` ) REFERENCES `Vehicles`(`vehicle_id` ), FOREIGN KEY (`staff_id` ) REFERENCES `Staff`(`staff_id` ), FOREIGN KEY (`customer_id` ) REFERENCES `Customers`(`customer_id` ) ); INSERT INTO Addresses (`address_id`, `line_1_number_building`, `city`, `zip_postcode`, `state_province_county`, `country`) VALUES (1, '3904 Stroman Passage', 'Port Melyssa', '14445', 'Georgia', 'USA')INSERT INTO Staff (`staff_id`, `staff_address_id`, `nickname`, `first_name`, `middle_name`, `last_name`, `date_of_birth`, `date_joined_staff`, `date_left_staff`) VALUES (1, 14, 'thompson.constantin', 'Janessa', 'Amara', 'Sawayn', '2010-12-08 16:55:14', '2017-04-27 03:21:26', '2018-03-23 22:53:12')INSERT INTO Vehicles (`vehicle_id`, `vehicle_details`) VALUES (1, 'Van')INSERT INTO Customers (`customer_id`, `customer_address_id`, `customer_status_code`, `date_became_customer`, `date_of_birth`, `first_name`, `last_name`, `amount_outstanding`, `email_address`, `phone_number`, `cell_mobile_phone_number`) VALUES (1, 13, 'Bad Customer', '2016-05-11 17:03:48', '1998-12-15 13:24:40', 'Carole', 'Bernhard', '255', 'everette.goyette@example.org', '07278206718', '861-638-9797')INSERT INTO Customer_Payments (`customer_id`, `datetime_payment`, `payment_method_code`, `amount_payment`) VALUES (11, '2018-02-05 18:44:46', 'Direct Debit', '9570.93')INSERT INTO Lessons (`lesson_id`, `customer_id`, `lesson_status_code`, `staff_id`, `vehicle_id`, `lesson_date`, `lesson_time`, `price`) VALUES (1, 6, 'Cancelled', 8, 3, '2018-02-28 10:55:36', '5', '199')
driving_school
SELECT first_name FROM Staff EXCEPT SELECT T2.first_name FROM Lessons AS T1 JOIN Staff AS T2 ON T1.staff_id = T2.staff_id
What is the first name of all employees who do not give any lessons?
PRAGMA foreign_keys = ON; CREATE TABLE `Addresses` ( `address_id` INTEGER PRIMARY KEY, `line_1_number_building` VARCHAR(80), `city` VARCHAR(50), `zip_postcode` VARCHAR(20), `state_province_county` VARCHAR(50), `country` VARCHAR(50) ); CREATE TABLE `Staff` ( `staff_id` INTEGER PRIMARY KEY, `staff_address_id` INTEGER NOT NULL, `nickname` VARCHAR(80), `first_name` VARCHAR(80), `middle_name` VARCHAR(80), `last_name` VARCHAR(80), `date_of_birth` DATETIME, `date_joined_staff` DATETIME, `date_left_staff` DATETIME, FOREIGN KEY (`staff_address_id` ) REFERENCES `Addresses`(`address_id` ) ); CREATE TABLE `Vehicles` ( `vehicle_id` INTEGER PRIMARY KEY, `vehicle_details` VARCHAR(255) ); CREATE TABLE `Customers` ( `customer_id` INTEGER PRIMARY KEY, `customer_address_id` INTEGER NOT NULL, `customer_status_code` VARCHAR(15) NOT NULL, `date_became_customer` DATETIME, `date_of_birth` DATETIME, `first_name` VARCHAR(80), `last_name` VARCHAR(80), `amount_outstanding` DOUBLE NULL, `email_address` VARCHAR(250), `phone_number` VARCHAR(255), `cell_mobile_phone_number` VARCHAR(255), FOREIGN KEY (`customer_address_id` ) REFERENCES `Addresses`(`address_id` ) ); CREATE TABLE `Customer_Payments` ( `customer_id` INTEGER NOT NULL, `datetime_payment` DATETIME NOT NULL, `payment_method_code` VARCHAR(10) NOT NULL, `amount_payment` DOUBLE NULL, PRIMARY KEY (`customer_id`,`datetime_payment`), FOREIGN KEY (`customer_id` ) REFERENCES `Customers`(`customer_id` ) ); CREATE TABLE `Lessons` ( `lesson_id` INTEGER PRIMARY KEY, `customer_id` INTEGER NOT NULL, `lesson_status_code` VARCHAR(15) NOT NULL, `staff_id` INTEGER, `vehicle_id` INTEGER NOT NULL, `lesson_date` DATETIME, `lesson_time` VARCHAR(10), `price` DOUBLE NULL, FOREIGN KEY (`vehicle_id` ) REFERENCES `Vehicles`(`vehicle_id` ), FOREIGN KEY (`staff_id` ) REFERENCES `Staff`(`staff_id` ), FOREIGN KEY (`customer_id` ) REFERENCES `Customers`(`customer_id` ) ); INSERT INTO Addresses (`address_id`, `line_1_number_building`, `city`, `zip_postcode`, `state_province_county`, `country`) VALUES (1, '3904 Stroman Passage', 'Port Melyssa', '14445', 'Georgia', 'USA')INSERT INTO Staff (`staff_id`, `staff_address_id`, `nickname`, `first_name`, `middle_name`, `last_name`, `date_of_birth`, `date_joined_staff`, `date_left_staff`) VALUES (1, 14, 'thompson.constantin', 'Janessa', 'Amara', 'Sawayn', '2010-12-08 16:55:14', '2017-04-27 03:21:26', '2018-03-23 22:53:12')INSERT INTO Vehicles (`vehicle_id`, `vehicle_details`) VALUES (1, 'Van')INSERT INTO Customers (`customer_id`, `customer_address_id`, `customer_status_code`, `date_became_customer`, `date_of_birth`, `first_name`, `last_name`, `amount_outstanding`, `email_address`, `phone_number`, `cell_mobile_phone_number`) VALUES (1, 13, 'Bad Customer', '2016-05-11 17:03:48', '1998-12-15 13:24:40', 'Carole', 'Bernhard', '255', 'everette.goyette@example.org', '07278206718', '861-638-9797')INSERT INTO Customer_Payments (`customer_id`, `datetime_payment`, `payment_method_code`, `amount_payment`) VALUES (11, '2018-02-05 18:44:46', 'Direct Debit', '9570.93')INSERT INTO Lessons (`lesson_id`, `customer_id`, `lesson_status_code`, `staff_id`, `vehicle_id`, `lesson_date`, `lesson_time`, `price`) VALUES (1, 6, 'Cancelled', 8, 3, '2018-02-28 10:55:36', '5', '199')
driving_school
SELECT T1.vehicle_id , T1.vehicle_details FROM Vehicles AS T1 JOIN Lessons AS T2 ON T1.vehicle_id = T2.vehicle_id GROUP BY T1.vehicle_id ORDER BY count(*) DESC LIMIT 1
What is the id and detail of the vehicle used in lessons for most of the times?
PRAGMA foreign_keys = ON; CREATE TABLE `Addresses` ( `address_id` INTEGER PRIMARY KEY, `line_1_number_building` VARCHAR(80), `city` VARCHAR(50), `zip_postcode` VARCHAR(20), `state_province_county` VARCHAR(50), `country` VARCHAR(50) ); CREATE TABLE `Staff` ( `staff_id` INTEGER PRIMARY KEY, `staff_address_id` INTEGER NOT NULL, `nickname` VARCHAR(80), `first_name` VARCHAR(80), `middle_name` VARCHAR(80), `last_name` VARCHAR(80), `date_of_birth` DATETIME, `date_joined_staff` DATETIME, `date_left_staff` DATETIME, FOREIGN KEY (`staff_address_id` ) REFERENCES `Addresses`(`address_id` ) ); CREATE TABLE `Vehicles` ( `vehicle_id` INTEGER PRIMARY KEY, `vehicle_details` VARCHAR(255) ); CREATE TABLE `Customers` ( `customer_id` INTEGER PRIMARY KEY, `customer_address_id` INTEGER NOT NULL, `customer_status_code` VARCHAR(15) NOT NULL, `date_became_customer` DATETIME, `date_of_birth` DATETIME, `first_name` VARCHAR(80), `last_name` VARCHAR(80), `amount_outstanding` DOUBLE NULL, `email_address` VARCHAR(250), `phone_number` VARCHAR(255), `cell_mobile_phone_number` VARCHAR(255), FOREIGN KEY (`customer_address_id` ) REFERENCES `Addresses`(`address_id` ) ); CREATE TABLE `Customer_Payments` ( `customer_id` INTEGER NOT NULL, `datetime_payment` DATETIME NOT NULL, `payment_method_code` VARCHAR(10) NOT NULL, `amount_payment` DOUBLE NULL, PRIMARY KEY (`customer_id`,`datetime_payment`), FOREIGN KEY (`customer_id` ) REFERENCES `Customers`(`customer_id` ) ); CREATE TABLE `Lessons` ( `lesson_id` INTEGER PRIMARY KEY, `customer_id` INTEGER NOT NULL, `lesson_status_code` VARCHAR(15) NOT NULL, `staff_id` INTEGER, `vehicle_id` INTEGER NOT NULL, `lesson_date` DATETIME, `lesson_time` VARCHAR(10), `price` DOUBLE NULL, FOREIGN KEY (`vehicle_id` ) REFERENCES `Vehicles`(`vehicle_id` ), FOREIGN KEY (`staff_id` ) REFERENCES `Staff`(`staff_id` ), FOREIGN KEY (`customer_id` ) REFERENCES `Customers`(`customer_id` ) ); INSERT INTO Addresses (`address_id`, `line_1_number_building`, `city`, `zip_postcode`, `state_province_county`, `country`) VALUES (1, '3904 Stroman Passage', 'Port Melyssa', '14445', 'Georgia', 'USA')INSERT INTO Staff (`staff_id`, `staff_address_id`, `nickname`, `first_name`, `middle_name`, `last_name`, `date_of_birth`, `date_joined_staff`, `date_left_staff`) VALUES (1, 14, 'thompson.constantin', 'Janessa', 'Amara', 'Sawayn', '2010-12-08 16:55:14', '2017-04-27 03:21:26', '2018-03-23 22:53:12')INSERT INTO Vehicles (`vehicle_id`, `vehicle_details`) VALUES (1, 'Van')INSERT INTO Customers (`customer_id`, `customer_address_id`, `customer_status_code`, `date_became_customer`, `date_of_birth`, `first_name`, `last_name`, `amount_outstanding`, `email_address`, `phone_number`, `cell_mobile_phone_number`) VALUES (1, 13, 'Bad Customer', '2016-05-11 17:03:48', '1998-12-15 13:24:40', 'Carole', 'Bernhard', '255', 'everette.goyette@example.org', '07278206718', '861-638-9797')INSERT INTO Customer_Payments (`customer_id`, `datetime_payment`, `payment_method_code`, `amount_payment`) VALUES (11, '2018-02-05 18:44:46', 'Direct Debit', '9570.93')INSERT INTO Lessons (`lesson_id`, `customer_id`, `lesson_status_code`, `staff_id`, `vehicle_id`, `lesson_date`, `lesson_time`, `price`) VALUES (1, 6, 'Cancelled', 8, 3, '2018-02-28 10:55:36', '5', '199')
activity_1
SELECT count(*) FROM Faculty
How many faculty do we have?
create table Activity ( actid INTEGER PRIMARY KEY, activity_name varchar(25) ); create table Participates_in ( stuid INTEGER, actid INTEGER, FOREIGN KEY(stuid) REFERENCES Student(StuID), FOREIGN KEY(actid) REFERENCES Activity(actid) ); create table Faculty_Participates_in ( FacID INTEGER, actid INTEGER, FOREIGN KEY(FacID) REFERENCES Faculty(FacID), FOREIGN KEY(actid) REFERENCES Activity(actid) ); create table Student ( StuID INTEGER PRIMARY KEY, LName VARCHAR(12), Fname VARCHAR(12), Age INTEGER, Sex VARCHAR(1), Major INTEGER, Advisor INTEGER, city_code VARCHAR(3) ); create table Faculty ( FacID INTEGER PRIMARY KEY, Lname VARCHAR(15), Fname VARCHAR(15), Rank VARCHAR(15), Sex VARCHAR(1), Phone INTEGER, Room VARCHAR(5), Building VARCHAR(13) ); insert into Faculty values ( 1082, 'Giuliano', 'Mark', 'Instructor', 'M', 2424, '224', 'NEB'); insert into Student values ( 1001, 'Smith', 'Linda', 18, 'F', 600, 1121,'BAL'); insert into Activity values ( 770 , 'Mountain Climbing' ) ; insert into Participates_in values (1001 , 770) ; insert into Faculty_Participates_in values ( 1082, 784) ; INSERT INTO Activity VALUES [(770, 'Mountain Climbing'), (771, 'Canoeing')] INSERT INTO Participates_in VALUES [(1001, 770), (1001, 771)] INSERT INTO Faculty_Participates_in VALUES [(1082, 784), (1082, 785)] INSERT INTO Student VALUES [(1001, 'Smith', 'Linda', 18, 'F', 600, 1121, 'BAL'), (1002, 'Kim', 'Tracy', 19, 'F', 600, 7712, 'HKG')] INSERT INTO Faculty VALUES [(1082, 'Giuliano', 'Mark', 'Instructor', 'M', 2424, '224', 'NEB'), (1121, 'Goodrich', 'Michael', 'Professor', 'M', 3593, '219', 'NEB')]
activity_1
SELECT count(*) FROM Faculty
What is the total number of faculty members?
create table Activity ( actid INTEGER PRIMARY KEY, activity_name varchar(25) ); create table Participates_in ( stuid INTEGER, actid INTEGER, FOREIGN KEY(stuid) REFERENCES Student(StuID), FOREIGN KEY(actid) REFERENCES Activity(actid) ); create table Faculty_Participates_in ( FacID INTEGER, actid INTEGER, FOREIGN KEY(FacID) REFERENCES Faculty(FacID), FOREIGN KEY(actid) REFERENCES Activity(actid) ); create table Student ( StuID INTEGER PRIMARY KEY, LName VARCHAR(12), Fname VARCHAR(12), Age INTEGER, Sex VARCHAR(1), Major INTEGER, Advisor INTEGER, city_code VARCHAR(3) ); create table Faculty ( FacID INTEGER PRIMARY KEY, Lname VARCHAR(15), Fname VARCHAR(15), Rank VARCHAR(15), Sex VARCHAR(1), Phone INTEGER, Room VARCHAR(5), Building VARCHAR(13) ); insert into Faculty values ( 1082, 'Giuliano', 'Mark', 'Instructor', 'M', 2424, '224', 'NEB'); insert into Student values ( 1001, 'Smith', 'Linda', 18, 'F', 600, 1121,'BAL'); insert into Activity values ( 770 , 'Mountain Climbing' ) ; insert into Participates_in values (1001 , 770) ; insert into Faculty_Participates_in values ( 1082, 784) ; INSERT INTO Activity VALUES [(770, 'Mountain Climbing'), (771, 'Canoeing')] INSERT INTO Participates_in VALUES [(1001, 770), (1001, 771)] INSERT INTO Faculty_Participates_in VALUES [(1082, 784), (1082, 785)] INSERT INTO Student VALUES [(1001, 'Smith', 'Linda', 18, 'F', 600, 1121, 'BAL'), (1002, 'Kim', 'Tracy', 19, 'F', 600, 7712, 'HKG')] INSERT INTO Faculty VALUES [(1082, 'Giuliano', 'Mark', 'Instructor', 'M', 2424, '224', 'NEB'), (1121, 'Goodrich', 'Michael', 'Professor', 'M', 3593, '219', 'NEB')]
activity_1
SELECT DISTINCT rank FROM Faculty
What ranks do we have for faculty?
create table Activity ( actid INTEGER PRIMARY KEY, activity_name varchar(25) ); create table Participates_in ( stuid INTEGER, actid INTEGER, FOREIGN KEY(stuid) REFERENCES Student(StuID), FOREIGN KEY(actid) REFERENCES Activity(actid) ); create table Faculty_Participates_in ( FacID INTEGER, actid INTEGER, FOREIGN KEY(FacID) REFERENCES Faculty(FacID), FOREIGN KEY(actid) REFERENCES Activity(actid) ); create table Student ( StuID INTEGER PRIMARY KEY, LName VARCHAR(12), Fname VARCHAR(12), Age INTEGER, Sex VARCHAR(1), Major INTEGER, Advisor INTEGER, city_code VARCHAR(3) ); create table Faculty ( FacID INTEGER PRIMARY KEY, Lname VARCHAR(15), Fname VARCHAR(15), Rank VARCHAR(15), Sex VARCHAR(1), Phone INTEGER, Room VARCHAR(5), Building VARCHAR(13) ); insert into Faculty values ( 1082, 'Giuliano', 'Mark', 'Instructor', 'M', 2424, '224', 'NEB'); insert into Student values ( 1001, 'Smith', 'Linda', 18, 'F', 600, 1121,'BAL'); insert into Activity values ( 770 , 'Mountain Climbing' ) ; insert into Participates_in values (1001 , 770) ; insert into Faculty_Participates_in values ( 1082, 784) ; INSERT INTO Activity VALUES [(770, 'Mountain Climbing'), (771, 'Canoeing')] INSERT INTO Participates_in VALUES [(1001, 770), (1001, 771)] INSERT INTO Faculty_Participates_in VALUES [(1082, 784), (1082, 785)] INSERT INTO Student VALUES [(1001, 'Smith', 'Linda', 18, 'F', 600, 1121, 'BAL'), (1002, 'Kim', 'Tracy', 19, 'F', 600, 7712, 'HKG')] INSERT INTO Faculty VALUES [(1082, 'Giuliano', 'Mark', 'Instructor', 'M', 2424, '224', 'NEB'), (1121, 'Goodrich', 'Michael', 'Professor', 'M', 3593, '219', 'NEB')]
activity_1
SELECT DISTINCT rank FROM Faculty
Find the list of distinct ranks for faculty.
create table Activity ( actid INTEGER PRIMARY KEY, activity_name varchar(25) ); create table Participates_in ( stuid INTEGER, actid INTEGER, FOREIGN KEY(stuid) REFERENCES Student(StuID), FOREIGN KEY(actid) REFERENCES Activity(actid) ); create table Faculty_Participates_in ( FacID INTEGER, actid INTEGER, FOREIGN KEY(FacID) REFERENCES Faculty(FacID), FOREIGN KEY(actid) REFERENCES Activity(actid) ); create table Student ( StuID INTEGER PRIMARY KEY, LName VARCHAR(12), Fname VARCHAR(12), Age INTEGER, Sex VARCHAR(1), Major INTEGER, Advisor INTEGER, city_code VARCHAR(3) ); create table Faculty ( FacID INTEGER PRIMARY KEY, Lname VARCHAR(15), Fname VARCHAR(15), Rank VARCHAR(15), Sex VARCHAR(1), Phone INTEGER, Room VARCHAR(5), Building VARCHAR(13) ); insert into Faculty values ( 1082, 'Giuliano', 'Mark', 'Instructor', 'M', 2424, '224', 'NEB'); insert into Student values ( 1001, 'Smith', 'Linda', 18, 'F', 600, 1121,'BAL'); insert into Activity values ( 770 , 'Mountain Climbing' ) ; insert into Participates_in values (1001 , 770) ; insert into Faculty_Participates_in values ( 1082, 784) ; INSERT INTO Activity VALUES [(770, 'Mountain Climbing'), (771, 'Canoeing')] INSERT INTO Participates_in VALUES [(1001, 770), (1001, 771)] INSERT INTO Faculty_Participates_in VALUES [(1082, 784), (1082, 785)] INSERT INTO Student VALUES [(1001, 'Smith', 'Linda', 18, 'F', 600, 1121, 'BAL'), (1002, 'Kim', 'Tracy', 19, 'F', 600, 7712, 'HKG')] INSERT INTO Faculty VALUES [(1082, 'Giuliano', 'Mark', 'Instructor', 'M', 2424, '224', 'NEB'), (1121, 'Goodrich', 'Michael', 'Professor', 'M', 3593, '219', 'NEB')]
activity_1
SELECT DISTINCT building FROM Faculty
Show all the distinct buildings that have faculty rooms.
create table Activity ( actid INTEGER PRIMARY KEY, activity_name varchar(25) ); create table Participates_in ( stuid INTEGER, actid INTEGER, FOREIGN KEY(stuid) REFERENCES Student(StuID), FOREIGN KEY(actid) REFERENCES Activity(actid) ); create table Faculty_Participates_in ( FacID INTEGER, actid INTEGER, FOREIGN KEY(FacID) REFERENCES Faculty(FacID), FOREIGN KEY(actid) REFERENCES Activity(actid) ); create table Student ( StuID INTEGER PRIMARY KEY, LName VARCHAR(12), Fname VARCHAR(12), Age INTEGER, Sex VARCHAR(1), Major INTEGER, Advisor INTEGER, city_code VARCHAR(3) ); create table Faculty ( FacID INTEGER PRIMARY KEY, Lname VARCHAR(15), Fname VARCHAR(15), Rank VARCHAR(15), Sex VARCHAR(1), Phone INTEGER, Room VARCHAR(5), Building VARCHAR(13) ); insert into Faculty values ( 1082, 'Giuliano', 'Mark', 'Instructor', 'M', 2424, '224', 'NEB'); insert into Student values ( 1001, 'Smith', 'Linda', 18, 'F', 600, 1121,'BAL'); insert into Activity values ( 770 , 'Mountain Climbing' ) ; insert into Participates_in values (1001 , 770) ; insert into Faculty_Participates_in values ( 1082, 784) ; INSERT INTO Activity VALUES [(770, 'Mountain Climbing'), (771, 'Canoeing')] INSERT INTO Participates_in VALUES [(1001, 770), (1001, 771)] INSERT INTO Faculty_Participates_in VALUES [(1082, 784), (1082, 785)] INSERT INTO Student VALUES [(1001, 'Smith', 'Linda', 18, 'F', 600, 1121, 'BAL'), (1002, 'Kim', 'Tracy', 19, 'F', 600, 7712, 'HKG')] INSERT INTO Faculty VALUES [(1082, 'Giuliano', 'Mark', 'Instructor', 'M', 2424, '224', 'NEB'), (1121, 'Goodrich', 'Michael', 'Professor', 'M', 3593, '219', 'NEB')]
activity_1
SELECT DISTINCT building FROM Faculty
What buildings have faculty offices?
create table Activity ( actid INTEGER PRIMARY KEY, activity_name varchar(25) ); create table Participates_in ( stuid INTEGER, actid INTEGER, FOREIGN KEY(stuid) REFERENCES Student(StuID), FOREIGN KEY(actid) REFERENCES Activity(actid) ); create table Faculty_Participates_in ( FacID INTEGER, actid INTEGER, FOREIGN KEY(FacID) REFERENCES Faculty(FacID), FOREIGN KEY(actid) REFERENCES Activity(actid) ); create table Student ( StuID INTEGER PRIMARY KEY, LName VARCHAR(12), Fname VARCHAR(12), Age INTEGER, Sex VARCHAR(1), Major INTEGER, Advisor INTEGER, city_code VARCHAR(3) ); create table Faculty ( FacID INTEGER PRIMARY KEY, Lname VARCHAR(15), Fname VARCHAR(15), Rank VARCHAR(15), Sex VARCHAR(1), Phone INTEGER, Room VARCHAR(5), Building VARCHAR(13) ); insert into Faculty values ( 1082, 'Giuliano', 'Mark', 'Instructor', 'M', 2424, '224', 'NEB'); insert into Student values ( 1001, 'Smith', 'Linda', 18, 'F', 600, 1121,'BAL'); insert into Activity values ( 770 , 'Mountain Climbing' ) ; insert into Participates_in values (1001 , 770) ; insert into Faculty_Participates_in values ( 1082, 784) ; INSERT INTO Activity VALUES [(770, 'Mountain Climbing'), (771, 'Canoeing')] INSERT INTO Participates_in VALUES [(1001, 770), (1001, 771)] INSERT INTO Faculty_Participates_in VALUES [(1082, 784), (1082, 785)] INSERT INTO Student VALUES [(1001, 'Smith', 'Linda', 18, 'F', 600, 1121, 'BAL'), (1002, 'Kim', 'Tracy', 19, 'F', 600, 7712, 'HKG')] INSERT INTO Faculty VALUES [(1082, 'Giuliano', 'Mark', 'Instructor', 'M', 2424, '224', 'NEB'), (1121, 'Goodrich', 'Michael', 'Professor', 'M', 3593, '219', 'NEB')]
activity_1
SELECT rank , Fname , Lname FROM Faculty
Show the rank, first name, and last name for all the faculty.
create table Activity ( actid INTEGER PRIMARY KEY, activity_name varchar(25) ); create table Participates_in ( stuid INTEGER, actid INTEGER, FOREIGN KEY(stuid) REFERENCES Student(StuID), FOREIGN KEY(actid) REFERENCES Activity(actid) ); create table Faculty_Participates_in ( FacID INTEGER, actid INTEGER, FOREIGN KEY(FacID) REFERENCES Faculty(FacID), FOREIGN KEY(actid) REFERENCES Activity(actid) ); create table Student ( StuID INTEGER PRIMARY KEY, LName VARCHAR(12), Fname VARCHAR(12), Age INTEGER, Sex VARCHAR(1), Major INTEGER, Advisor INTEGER, city_code VARCHAR(3) ); create table Faculty ( FacID INTEGER PRIMARY KEY, Lname VARCHAR(15), Fname VARCHAR(15), Rank VARCHAR(15), Sex VARCHAR(1), Phone INTEGER, Room VARCHAR(5), Building VARCHAR(13) ); insert into Faculty values ( 1082, 'Giuliano', 'Mark', 'Instructor', 'M', 2424, '224', 'NEB'); insert into Student values ( 1001, 'Smith', 'Linda', 18, 'F', 600, 1121,'BAL'); insert into Activity values ( 770 , 'Mountain Climbing' ) ; insert into Participates_in values (1001 , 770) ; insert into Faculty_Participates_in values ( 1082, 784) ; INSERT INTO Activity VALUES [(770, 'Mountain Climbing'), (771, 'Canoeing')] INSERT INTO Participates_in VALUES [(1001, 770), (1001, 771)] INSERT INTO Faculty_Participates_in VALUES [(1082, 784), (1082, 785)] INSERT INTO Student VALUES [(1001, 'Smith', 'Linda', 18, 'F', 600, 1121, 'BAL'), (1002, 'Kim', 'Tracy', 19, 'F', 600, 7712, 'HKG')] INSERT INTO Faculty VALUES [(1082, 'Giuliano', 'Mark', 'Instructor', 'M', 2424, '224', 'NEB'), (1121, 'Goodrich', 'Michael', 'Professor', 'M', 3593, '219', 'NEB')]
activity_1
SELECT rank , Fname , Lname FROM Faculty
What are the rank, first name, and last name of the faculty members?
create table Activity ( actid INTEGER PRIMARY KEY, activity_name varchar(25) ); create table Participates_in ( stuid INTEGER, actid INTEGER, FOREIGN KEY(stuid) REFERENCES Student(StuID), FOREIGN KEY(actid) REFERENCES Activity(actid) ); create table Faculty_Participates_in ( FacID INTEGER, actid INTEGER, FOREIGN KEY(FacID) REFERENCES Faculty(FacID), FOREIGN KEY(actid) REFERENCES Activity(actid) ); create table Student ( StuID INTEGER PRIMARY KEY, LName VARCHAR(12), Fname VARCHAR(12), Age INTEGER, Sex VARCHAR(1), Major INTEGER, Advisor INTEGER, city_code VARCHAR(3) ); create table Faculty ( FacID INTEGER PRIMARY KEY, Lname VARCHAR(15), Fname VARCHAR(15), Rank VARCHAR(15), Sex VARCHAR(1), Phone INTEGER, Room VARCHAR(5), Building VARCHAR(13) ); insert into Faculty values ( 1082, 'Giuliano', 'Mark', 'Instructor', 'M', 2424, '224', 'NEB'); insert into Student values ( 1001, 'Smith', 'Linda', 18, 'F', 600, 1121,'BAL'); insert into Activity values ( 770 , 'Mountain Climbing' ) ; insert into Participates_in values (1001 , 770) ; insert into Faculty_Participates_in values ( 1082, 784) ; INSERT INTO Activity VALUES [(770, 'Mountain Climbing'), (771, 'Canoeing')] INSERT INTO Participates_in VALUES [(1001, 770), (1001, 771)] INSERT INTO Faculty_Participates_in VALUES [(1082, 784), (1082, 785)] INSERT INTO Student VALUES [(1001, 'Smith', 'Linda', 18, 'F', 600, 1121, 'BAL'), (1002, 'Kim', 'Tracy', 19, 'F', 600, 7712, 'HKG')] INSERT INTO Faculty VALUES [(1082, 'Giuliano', 'Mark', 'Instructor', 'M', 2424, '224', 'NEB'), (1121, 'Goodrich', 'Michael', 'Professor', 'M', 3593, '219', 'NEB')]
activity_1
SELECT Fname , Lname , phone FROM Faculty WHERE Sex = 'F'
Show the first name, last name, and phone number for all female faculty members.
create table Activity ( actid INTEGER PRIMARY KEY, activity_name varchar(25) ); create table Participates_in ( stuid INTEGER, actid INTEGER, FOREIGN KEY(stuid) REFERENCES Student(StuID), FOREIGN KEY(actid) REFERENCES Activity(actid) ); create table Faculty_Participates_in ( FacID INTEGER, actid INTEGER, FOREIGN KEY(FacID) REFERENCES Faculty(FacID), FOREIGN KEY(actid) REFERENCES Activity(actid) ); create table Student ( StuID INTEGER PRIMARY KEY, LName VARCHAR(12), Fname VARCHAR(12), Age INTEGER, Sex VARCHAR(1), Major INTEGER, Advisor INTEGER, city_code VARCHAR(3) ); create table Faculty ( FacID INTEGER PRIMARY KEY, Lname VARCHAR(15), Fname VARCHAR(15), Rank VARCHAR(15), Sex VARCHAR(1), Phone INTEGER, Room VARCHAR(5), Building VARCHAR(13) ); insert into Faculty values ( 1082, 'Giuliano', 'Mark', 'Instructor', 'M', 2424, '224', 'NEB'); insert into Student values ( 1001, 'Smith', 'Linda', 18, 'F', 600, 1121,'BAL'); insert into Activity values ( 770 , 'Mountain Climbing' ) ; insert into Participates_in values (1001 , 770) ; insert into Faculty_Participates_in values ( 1082, 784) ; INSERT INTO Activity VALUES [(770, 'Mountain Climbing'), (771, 'Canoeing')] INSERT INTO Participates_in VALUES [(1001, 770), (1001, 771)] INSERT INTO Faculty_Participates_in VALUES [(1082, 784), (1082, 785)] INSERT INTO Student VALUES [(1001, 'Smith', 'Linda', 18, 'F', 600, 1121, 'BAL'), (1002, 'Kim', 'Tracy', 19, 'F', 600, 7712, 'HKG')] INSERT INTO Faculty VALUES [(1082, 'Giuliano', 'Mark', 'Instructor', 'M', 2424, '224', 'NEB'), (1121, 'Goodrich', 'Michael', 'Professor', 'M', 3593, '219', 'NEB')]
activity_1
SELECT Fname , Lname , phone FROM Faculty WHERE Sex = 'F'
What are the first name, last name, and phone number of all the female faculty members?
create table Activity ( actid INTEGER PRIMARY KEY, activity_name varchar(25) ); create table Participates_in ( stuid INTEGER, actid INTEGER, FOREIGN KEY(stuid) REFERENCES Student(StuID), FOREIGN KEY(actid) REFERENCES Activity(actid) ); create table Faculty_Participates_in ( FacID INTEGER, actid INTEGER, FOREIGN KEY(FacID) REFERENCES Faculty(FacID), FOREIGN KEY(actid) REFERENCES Activity(actid) ); create table Student ( StuID INTEGER PRIMARY KEY, LName VARCHAR(12), Fname VARCHAR(12), Age INTEGER, Sex VARCHAR(1), Major INTEGER, Advisor INTEGER, city_code VARCHAR(3) ); create table Faculty ( FacID INTEGER PRIMARY KEY, Lname VARCHAR(15), Fname VARCHAR(15), Rank VARCHAR(15), Sex VARCHAR(1), Phone INTEGER, Room VARCHAR(5), Building VARCHAR(13) ); insert into Faculty values ( 1082, 'Giuliano', 'Mark', 'Instructor', 'M', 2424, '224', 'NEB'); insert into Student values ( 1001, 'Smith', 'Linda', 18, 'F', 600, 1121,'BAL'); insert into Activity values ( 770 , 'Mountain Climbing' ) ; insert into Participates_in values (1001 , 770) ; insert into Faculty_Participates_in values ( 1082, 784) ; INSERT INTO Activity VALUES [(770, 'Mountain Climbing'), (771, 'Canoeing')] INSERT INTO Participates_in VALUES [(1001, 770), (1001, 771)] INSERT INTO Faculty_Participates_in VALUES [(1082, 784), (1082, 785)] INSERT INTO Student VALUES [(1001, 'Smith', 'Linda', 18, 'F', 600, 1121, 'BAL'), (1002, 'Kim', 'Tracy', 19, 'F', 600, 7712, 'HKG')] INSERT INTO Faculty VALUES [(1082, 'Giuliano', 'Mark', 'Instructor', 'M', 2424, '224', 'NEB'), (1121, 'Goodrich', 'Michael', 'Professor', 'M', 3593, '219', 'NEB')]
activity_1
SELECT FacID FROM Faculty WHERE Sex = 'M'
Show ids for all the male faculty.
create table Activity ( actid INTEGER PRIMARY KEY, activity_name varchar(25) ); create table Participates_in ( stuid INTEGER, actid INTEGER, FOREIGN KEY(stuid) REFERENCES Student(StuID), FOREIGN KEY(actid) REFERENCES Activity(actid) ); create table Faculty_Participates_in ( FacID INTEGER, actid INTEGER, FOREIGN KEY(FacID) REFERENCES Faculty(FacID), FOREIGN KEY(actid) REFERENCES Activity(actid) ); create table Student ( StuID INTEGER PRIMARY KEY, LName VARCHAR(12), Fname VARCHAR(12), Age INTEGER, Sex VARCHAR(1), Major INTEGER, Advisor INTEGER, city_code VARCHAR(3) ); create table Faculty ( FacID INTEGER PRIMARY KEY, Lname VARCHAR(15), Fname VARCHAR(15), Rank VARCHAR(15), Sex VARCHAR(1), Phone INTEGER, Room VARCHAR(5), Building VARCHAR(13) ); insert into Faculty values ( 1082, 'Giuliano', 'Mark', 'Instructor', 'M', 2424, '224', 'NEB'); insert into Student values ( 1001, 'Smith', 'Linda', 18, 'F', 600, 1121,'BAL'); insert into Activity values ( 770 , 'Mountain Climbing' ) ; insert into Participates_in values (1001 , 770) ; insert into Faculty_Participates_in values ( 1082, 784) ; INSERT INTO Activity VALUES [(770, 'Mountain Climbing'), (771, 'Canoeing')] INSERT INTO Participates_in VALUES [(1001, 770), (1001, 771)] INSERT INTO Faculty_Participates_in VALUES [(1082, 784), (1082, 785)] INSERT INTO Student VALUES [(1001, 'Smith', 'Linda', 18, 'F', 600, 1121, 'BAL'), (1002, 'Kim', 'Tracy', 19, 'F', 600, 7712, 'HKG')] INSERT INTO Faculty VALUES [(1082, 'Giuliano', 'Mark', 'Instructor', 'M', 2424, '224', 'NEB'), (1121, 'Goodrich', 'Michael', 'Professor', 'M', 3593, '219', 'NEB')]
activity_1
SELECT FacID FROM Faculty WHERE Sex = 'M'
What are the faculty ids of all the male faculty members?
create table Activity ( actid INTEGER PRIMARY KEY, activity_name varchar(25) ); create table Participates_in ( stuid INTEGER, actid INTEGER, FOREIGN KEY(stuid) REFERENCES Student(StuID), FOREIGN KEY(actid) REFERENCES Activity(actid) ); create table Faculty_Participates_in ( FacID INTEGER, actid INTEGER, FOREIGN KEY(FacID) REFERENCES Faculty(FacID), FOREIGN KEY(actid) REFERENCES Activity(actid) ); create table Student ( StuID INTEGER PRIMARY KEY, LName VARCHAR(12), Fname VARCHAR(12), Age INTEGER, Sex VARCHAR(1), Major INTEGER, Advisor INTEGER, city_code VARCHAR(3) ); create table Faculty ( FacID INTEGER PRIMARY KEY, Lname VARCHAR(15), Fname VARCHAR(15), Rank VARCHAR(15), Sex VARCHAR(1), Phone INTEGER, Room VARCHAR(5), Building VARCHAR(13) ); insert into Faculty values ( 1082, 'Giuliano', 'Mark', 'Instructor', 'M', 2424, '224', 'NEB'); insert into Student values ( 1001, 'Smith', 'Linda', 18, 'F', 600, 1121,'BAL'); insert into Activity values ( 770 , 'Mountain Climbing' ) ; insert into Participates_in values (1001 , 770) ; insert into Faculty_Participates_in values ( 1082, 784) ; INSERT INTO Activity VALUES [(770, 'Mountain Climbing'), (771, 'Canoeing')] INSERT INTO Participates_in VALUES [(1001, 770), (1001, 771)] INSERT INTO Faculty_Participates_in VALUES [(1082, 784), (1082, 785)] INSERT INTO Student VALUES [(1001, 'Smith', 'Linda', 18, 'F', 600, 1121, 'BAL'), (1002, 'Kim', 'Tracy', 19, 'F', 600, 7712, 'HKG')] INSERT INTO Faculty VALUES [(1082, 'Giuliano', 'Mark', 'Instructor', 'M', 2424, '224', 'NEB'), (1121, 'Goodrich', 'Michael', 'Professor', 'M', 3593, '219', 'NEB')]
activity_1
SELECT count(*) FROM Faculty WHERE Sex = 'F' AND Rank = "Professor"
How many female Professors do we have?
create table Activity ( actid INTEGER PRIMARY KEY, activity_name varchar(25) ); create table Participates_in ( stuid INTEGER, actid INTEGER, FOREIGN KEY(stuid) REFERENCES Student(StuID), FOREIGN KEY(actid) REFERENCES Activity(actid) ); create table Faculty_Participates_in ( FacID INTEGER, actid INTEGER, FOREIGN KEY(FacID) REFERENCES Faculty(FacID), FOREIGN KEY(actid) REFERENCES Activity(actid) ); create table Student ( StuID INTEGER PRIMARY KEY, LName VARCHAR(12), Fname VARCHAR(12), Age INTEGER, Sex VARCHAR(1), Major INTEGER, Advisor INTEGER, city_code VARCHAR(3) ); create table Faculty ( FacID INTEGER PRIMARY KEY, Lname VARCHAR(15), Fname VARCHAR(15), Rank VARCHAR(15), Sex VARCHAR(1), Phone INTEGER, Room VARCHAR(5), Building VARCHAR(13) ); insert into Faculty values ( 1082, 'Giuliano', 'Mark', 'Instructor', 'M', 2424, '224', 'NEB'); insert into Student values ( 1001, 'Smith', 'Linda', 18, 'F', 600, 1121,'BAL'); insert into Activity values ( 770 , 'Mountain Climbing' ) ; insert into Participates_in values (1001 , 770) ; insert into Faculty_Participates_in values ( 1082, 784) ; INSERT INTO Activity VALUES [(770, 'Mountain Climbing'), (771, 'Canoeing')] INSERT INTO Participates_in VALUES [(1001, 770), (1001, 771)] INSERT INTO Faculty_Participates_in VALUES [(1082, 784), (1082, 785)] INSERT INTO Student VALUES [(1001, 'Smith', 'Linda', 18, 'F', 600, 1121, 'BAL'), (1002, 'Kim', 'Tracy', 19, 'F', 600, 7712, 'HKG')] INSERT INTO Faculty VALUES [(1082, 'Giuliano', 'Mark', 'Instructor', 'M', 2424, '224', 'NEB'), (1121, 'Goodrich', 'Michael', 'Professor', 'M', 3593, '219', 'NEB')]
activity_1
SELECT count(*) FROM Faculty WHERE Sex = 'F' AND Rank = "Professor"
Count the number of female Professors we have.
create table Activity ( actid INTEGER PRIMARY KEY, activity_name varchar(25) ); create table Participates_in ( stuid INTEGER, actid INTEGER, FOREIGN KEY(stuid) REFERENCES Student(StuID), FOREIGN KEY(actid) REFERENCES Activity(actid) ); create table Faculty_Participates_in ( FacID INTEGER, actid INTEGER, FOREIGN KEY(FacID) REFERENCES Faculty(FacID), FOREIGN KEY(actid) REFERENCES Activity(actid) ); create table Student ( StuID INTEGER PRIMARY KEY, LName VARCHAR(12), Fname VARCHAR(12), Age INTEGER, Sex VARCHAR(1), Major INTEGER, Advisor INTEGER, city_code VARCHAR(3) ); create table Faculty ( FacID INTEGER PRIMARY KEY, Lname VARCHAR(15), Fname VARCHAR(15), Rank VARCHAR(15), Sex VARCHAR(1), Phone INTEGER, Room VARCHAR(5), Building VARCHAR(13) ); insert into Faculty values ( 1082, 'Giuliano', 'Mark', 'Instructor', 'M', 2424, '224', 'NEB'); insert into Student values ( 1001, 'Smith', 'Linda', 18, 'F', 600, 1121,'BAL'); insert into Activity values ( 770 , 'Mountain Climbing' ) ; insert into Participates_in values (1001 , 770) ; insert into Faculty_Participates_in values ( 1082, 784) ; INSERT INTO Activity VALUES [(770, 'Mountain Climbing'), (771, 'Canoeing')] INSERT INTO Participates_in VALUES [(1001, 770), (1001, 771)] INSERT INTO Faculty_Participates_in VALUES [(1082, 784), (1082, 785)] INSERT INTO Student VALUES [(1001, 'Smith', 'Linda', 18, 'F', 600, 1121, 'BAL'), (1002, 'Kim', 'Tracy', 19, 'F', 600, 7712, 'HKG')] INSERT INTO Faculty VALUES [(1082, 'Giuliano', 'Mark', 'Instructor', 'M', 2424, '224', 'NEB'), (1121, 'Goodrich', 'Michael', 'Professor', 'M', 3593, '219', 'NEB')]
activity_1
SELECT phone , room , building FROM Faculty WHERE Fname = "Jerry" AND Lname = "Prince"
Show the phone, room, and building for the faculty named Jerry Prince.
create table Activity ( actid INTEGER PRIMARY KEY, activity_name varchar(25) ); create table Participates_in ( stuid INTEGER, actid INTEGER, FOREIGN KEY(stuid) REFERENCES Student(StuID), FOREIGN KEY(actid) REFERENCES Activity(actid) ); create table Faculty_Participates_in ( FacID INTEGER, actid INTEGER, FOREIGN KEY(FacID) REFERENCES Faculty(FacID), FOREIGN KEY(actid) REFERENCES Activity(actid) ); create table Student ( StuID INTEGER PRIMARY KEY, LName VARCHAR(12), Fname VARCHAR(12), Age INTEGER, Sex VARCHAR(1), Major INTEGER, Advisor INTEGER, city_code VARCHAR(3) ); create table Faculty ( FacID INTEGER PRIMARY KEY, Lname VARCHAR(15), Fname VARCHAR(15), Rank VARCHAR(15), Sex VARCHAR(1), Phone INTEGER, Room VARCHAR(5), Building VARCHAR(13) ); insert into Faculty values ( 1082, 'Giuliano', 'Mark', 'Instructor', 'M', 2424, '224', 'NEB'); insert into Student values ( 1001, 'Smith', 'Linda', 18, 'F', 600, 1121,'BAL'); insert into Activity values ( 770 , 'Mountain Climbing' ) ; insert into Participates_in values (1001 , 770) ; insert into Faculty_Participates_in values ( 1082, 784) ; INSERT INTO Activity VALUES [(770, 'Mountain Climbing'), (771, 'Canoeing')] INSERT INTO Participates_in VALUES [(1001, 770), (1001, 771)] INSERT INTO Faculty_Participates_in VALUES [(1082, 784), (1082, 785)] INSERT INTO Student VALUES [(1001, 'Smith', 'Linda', 18, 'F', 600, 1121, 'BAL'), (1002, 'Kim', 'Tracy', 19, 'F', 600, 7712, 'HKG')] INSERT INTO Faculty VALUES [(1082, 'Giuliano', 'Mark', 'Instructor', 'M', 2424, '224', 'NEB'), (1121, 'Goodrich', 'Michael', 'Professor', 'M', 3593, '219', 'NEB')]
activity_1
SELECT phone , room , building FROM Faculty WHERE Fname = "Jerry" AND Lname = "Prince"
What are the phone, room, and building of the faculty member called Jerry Prince?
create table Activity ( actid INTEGER PRIMARY KEY, activity_name varchar(25) ); create table Participates_in ( stuid INTEGER, actid INTEGER, FOREIGN KEY(stuid) REFERENCES Student(StuID), FOREIGN KEY(actid) REFERENCES Activity(actid) ); create table Faculty_Participates_in ( FacID INTEGER, actid INTEGER, FOREIGN KEY(FacID) REFERENCES Faculty(FacID), FOREIGN KEY(actid) REFERENCES Activity(actid) ); create table Student ( StuID INTEGER PRIMARY KEY, LName VARCHAR(12), Fname VARCHAR(12), Age INTEGER, Sex VARCHAR(1), Major INTEGER, Advisor INTEGER, city_code VARCHAR(3) ); create table Faculty ( FacID INTEGER PRIMARY KEY, Lname VARCHAR(15), Fname VARCHAR(15), Rank VARCHAR(15), Sex VARCHAR(1), Phone INTEGER, Room VARCHAR(5), Building VARCHAR(13) ); insert into Faculty values ( 1082, 'Giuliano', 'Mark', 'Instructor', 'M', 2424, '224', 'NEB'); insert into Student values ( 1001, 'Smith', 'Linda', 18, 'F', 600, 1121,'BAL'); insert into Activity values ( 770 , 'Mountain Climbing' ) ; insert into Participates_in values (1001 , 770) ; insert into Faculty_Participates_in values ( 1082, 784) ; INSERT INTO Activity VALUES [(770, 'Mountain Climbing'), (771, 'Canoeing')] INSERT INTO Participates_in VALUES [(1001, 770), (1001, 771)] INSERT INTO Faculty_Participates_in VALUES [(1082, 784), (1082, 785)] INSERT INTO Student VALUES [(1001, 'Smith', 'Linda', 18, 'F', 600, 1121, 'BAL'), (1002, 'Kim', 'Tracy', 19, 'F', 600, 7712, 'HKG')] INSERT INTO Faculty VALUES [(1082, 'Giuliano', 'Mark', 'Instructor', 'M', 2424, '224', 'NEB'), (1121, 'Goodrich', 'Michael', 'Professor', 'M', 3593, '219', 'NEB')]
activity_1
SELECT count(*) FROM Faculty WHERE Rank = "Professor" AND building = "NEB"
How many Professors are in building NEB?
create table Activity ( actid INTEGER PRIMARY KEY, activity_name varchar(25) ); create table Participates_in ( stuid INTEGER, actid INTEGER, FOREIGN KEY(stuid) REFERENCES Student(StuID), FOREIGN KEY(actid) REFERENCES Activity(actid) ); create table Faculty_Participates_in ( FacID INTEGER, actid INTEGER, FOREIGN KEY(FacID) REFERENCES Faculty(FacID), FOREIGN KEY(actid) REFERENCES Activity(actid) ); create table Student ( StuID INTEGER PRIMARY KEY, LName VARCHAR(12), Fname VARCHAR(12), Age INTEGER, Sex VARCHAR(1), Major INTEGER, Advisor INTEGER, city_code VARCHAR(3) ); create table Faculty ( FacID INTEGER PRIMARY KEY, Lname VARCHAR(15), Fname VARCHAR(15), Rank VARCHAR(15), Sex VARCHAR(1), Phone INTEGER, Room VARCHAR(5), Building VARCHAR(13) ); insert into Faculty values ( 1082, 'Giuliano', 'Mark', 'Instructor', 'M', 2424, '224', 'NEB'); insert into Student values ( 1001, 'Smith', 'Linda', 18, 'F', 600, 1121,'BAL'); insert into Activity values ( 770 , 'Mountain Climbing' ) ; insert into Participates_in values (1001 , 770) ; insert into Faculty_Participates_in values ( 1082, 784) ; INSERT INTO Activity VALUES [(770, 'Mountain Climbing'), (771, 'Canoeing')] INSERT INTO Participates_in VALUES [(1001, 770), (1001, 771)] INSERT INTO Faculty_Participates_in VALUES [(1082, 784), (1082, 785)] INSERT INTO Student VALUES [(1001, 'Smith', 'Linda', 18, 'F', 600, 1121, 'BAL'), (1002, 'Kim', 'Tracy', 19, 'F', 600, 7712, 'HKG')] INSERT INTO Faculty VALUES [(1082, 'Giuliano', 'Mark', 'Instructor', 'M', 2424, '224', 'NEB'), (1121, 'Goodrich', 'Michael', 'Professor', 'M', 3593, '219', 'NEB')]
activity_1
SELECT count(*) FROM Faculty WHERE Rank = "Professor" AND building = "NEB"
Count the number of Professors who have office in building NEB.
create table Activity ( actid INTEGER PRIMARY KEY, activity_name varchar(25) ); create table Participates_in ( stuid INTEGER, actid INTEGER, FOREIGN KEY(stuid) REFERENCES Student(StuID), FOREIGN KEY(actid) REFERENCES Activity(actid) ); create table Faculty_Participates_in ( FacID INTEGER, actid INTEGER, FOREIGN KEY(FacID) REFERENCES Faculty(FacID), FOREIGN KEY(actid) REFERENCES Activity(actid) ); create table Student ( StuID INTEGER PRIMARY KEY, LName VARCHAR(12), Fname VARCHAR(12), Age INTEGER, Sex VARCHAR(1), Major INTEGER, Advisor INTEGER, city_code VARCHAR(3) ); create table Faculty ( FacID INTEGER PRIMARY KEY, Lname VARCHAR(15), Fname VARCHAR(15), Rank VARCHAR(15), Sex VARCHAR(1), Phone INTEGER, Room VARCHAR(5), Building VARCHAR(13) ); insert into Faculty values ( 1082, 'Giuliano', 'Mark', 'Instructor', 'M', 2424, '224', 'NEB'); insert into Student values ( 1001, 'Smith', 'Linda', 18, 'F', 600, 1121,'BAL'); insert into Activity values ( 770 , 'Mountain Climbing' ) ; insert into Participates_in values (1001 , 770) ; insert into Faculty_Participates_in values ( 1082, 784) ; INSERT INTO Activity VALUES [(770, 'Mountain Climbing'), (771, 'Canoeing')] INSERT INTO Participates_in VALUES [(1001, 770), (1001, 771)] INSERT INTO Faculty_Participates_in VALUES [(1082, 784), (1082, 785)] INSERT INTO Student VALUES [(1001, 'Smith', 'Linda', 18, 'F', 600, 1121, 'BAL'), (1002, 'Kim', 'Tracy', 19, 'F', 600, 7712, 'HKG')] INSERT INTO Faculty VALUES [(1082, 'Giuliano', 'Mark', 'Instructor', 'M', 2424, '224', 'NEB'), (1121, 'Goodrich', 'Michael', 'Professor', 'M', 3593, '219', 'NEB')]
activity_1
SELECT fname , lname FROM Faculty WHERE Rank = "Instructor"
Show the first name and last name for all the instructors.
create table Activity ( actid INTEGER PRIMARY KEY, activity_name varchar(25) ); create table Participates_in ( stuid INTEGER, actid INTEGER, FOREIGN KEY(stuid) REFERENCES Student(StuID), FOREIGN KEY(actid) REFERENCES Activity(actid) ); create table Faculty_Participates_in ( FacID INTEGER, actid INTEGER, FOREIGN KEY(FacID) REFERENCES Faculty(FacID), FOREIGN KEY(actid) REFERENCES Activity(actid) ); create table Student ( StuID INTEGER PRIMARY KEY, LName VARCHAR(12), Fname VARCHAR(12), Age INTEGER, Sex VARCHAR(1), Major INTEGER, Advisor INTEGER, city_code VARCHAR(3) ); create table Faculty ( FacID INTEGER PRIMARY KEY, Lname VARCHAR(15), Fname VARCHAR(15), Rank VARCHAR(15), Sex VARCHAR(1), Phone INTEGER, Room VARCHAR(5), Building VARCHAR(13) ); insert into Faculty values ( 1082, 'Giuliano', 'Mark', 'Instructor', 'M', 2424, '224', 'NEB'); insert into Student values ( 1001, 'Smith', 'Linda', 18, 'F', 600, 1121,'BAL'); insert into Activity values ( 770 , 'Mountain Climbing' ) ; insert into Participates_in values (1001 , 770) ; insert into Faculty_Participates_in values ( 1082, 784) ; INSERT INTO Activity VALUES [(770, 'Mountain Climbing'), (771, 'Canoeing')] INSERT INTO Participates_in VALUES [(1001, 770), (1001, 771)] INSERT INTO Faculty_Participates_in VALUES [(1082, 784), (1082, 785)] INSERT INTO Student VALUES [(1001, 'Smith', 'Linda', 18, 'F', 600, 1121, 'BAL'), (1002, 'Kim', 'Tracy', 19, 'F', 600, 7712, 'HKG')] INSERT INTO Faculty VALUES [(1082, 'Giuliano', 'Mark', 'Instructor', 'M', 2424, '224', 'NEB'), (1121, 'Goodrich', 'Michael', 'Professor', 'M', 3593, '219', 'NEB')]
activity_1
SELECT fname , lname FROM Faculty WHERE Rank = "Instructor"
What are the first name and last name of all the instructors?
create table Activity ( actid INTEGER PRIMARY KEY, activity_name varchar(25) ); create table Participates_in ( stuid INTEGER, actid INTEGER, FOREIGN KEY(stuid) REFERENCES Student(StuID), FOREIGN KEY(actid) REFERENCES Activity(actid) ); create table Faculty_Participates_in ( FacID INTEGER, actid INTEGER, FOREIGN KEY(FacID) REFERENCES Faculty(FacID), FOREIGN KEY(actid) REFERENCES Activity(actid) ); create table Student ( StuID INTEGER PRIMARY KEY, LName VARCHAR(12), Fname VARCHAR(12), Age INTEGER, Sex VARCHAR(1), Major INTEGER, Advisor INTEGER, city_code VARCHAR(3) ); create table Faculty ( FacID INTEGER PRIMARY KEY, Lname VARCHAR(15), Fname VARCHAR(15), Rank VARCHAR(15), Sex VARCHAR(1), Phone INTEGER, Room VARCHAR(5), Building VARCHAR(13) ); insert into Faculty values ( 1082, 'Giuliano', 'Mark', 'Instructor', 'M', 2424, '224', 'NEB'); insert into Student values ( 1001, 'Smith', 'Linda', 18, 'F', 600, 1121,'BAL'); insert into Activity values ( 770 , 'Mountain Climbing' ) ; insert into Participates_in values (1001 , 770) ; insert into Faculty_Participates_in values ( 1082, 784) ; INSERT INTO Activity VALUES [(770, 'Mountain Climbing'), (771, 'Canoeing')] INSERT INTO Participates_in VALUES [(1001, 770), (1001, 771)] INSERT INTO Faculty_Participates_in VALUES [(1082, 784), (1082, 785)] INSERT INTO Student VALUES [(1001, 'Smith', 'Linda', 18, 'F', 600, 1121, 'BAL'), (1002, 'Kim', 'Tracy', 19, 'F', 600, 7712, 'HKG')] INSERT INTO Faculty VALUES [(1082, 'Giuliano', 'Mark', 'Instructor', 'M', 2424, '224', 'NEB'), (1121, 'Goodrich', 'Michael', 'Professor', 'M', 3593, '219', 'NEB')]
activity_1
SELECT building , count(*) FROM Faculty GROUP BY building
Show all the buildings along with the number of faculty members the buildings have.
create table Activity ( actid INTEGER PRIMARY KEY, activity_name varchar(25) ); create table Participates_in ( stuid INTEGER, actid INTEGER, FOREIGN KEY(stuid) REFERENCES Student(StuID), FOREIGN KEY(actid) REFERENCES Activity(actid) ); create table Faculty_Participates_in ( FacID INTEGER, actid INTEGER, FOREIGN KEY(FacID) REFERENCES Faculty(FacID), FOREIGN KEY(actid) REFERENCES Activity(actid) ); create table Student ( StuID INTEGER PRIMARY KEY, LName VARCHAR(12), Fname VARCHAR(12), Age INTEGER, Sex VARCHAR(1), Major INTEGER, Advisor INTEGER, city_code VARCHAR(3) ); create table Faculty ( FacID INTEGER PRIMARY KEY, Lname VARCHAR(15), Fname VARCHAR(15), Rank VARCHAR(15), Sex VARCHAR(1), Phone INTEGER, Room VARCHAR(5), Building VARCHAR(13) ); insert into Faculty values ( 1082, 'Giuliano', 'Mark', 'Instructor', 'M', 2424, '224', 'NEB'); insert into Student values ( 1001, 'Smith', 'Linda', 18, 'F', 600, 1121,'BAL'); insert into Activity values ( 770 , 'Mountain Climbing' ) ; insert into Participates_in values (1001 , 770) ; insert into Faculty_Participates_in values ( 1082, 784) ; INSERT INTO Activity VALUES [(770, 'Mountain Climbing'), (771, 'Canoeing')] INSERT INTO Participates_in VALUES [(1001, 770), (1001, 771)] INSERT INTO Faculty_Participates_in VALUES [(1082, 784), (1082, 785)] INSERT INTO Student VALUES [(1001, 'Smith', 'Linda', 18, 'F', 600, 1121, 'BAL'), (1002, 'Kim', 'Tracy', 19, 'F', 600, 7712, 'HKG')] INSERT INTO Faculty VALUES [(1082, 'Giuliano', 'Mark', 'Instructor', 'M', 2424, '224', 'NEB'), (1121, 'Goodrich', 'Michael', 'Professor', 'M', 3593, '219', 'NEB')]
activity_1
SELECT building , count(*) FROM Faculty GROUP BY building
How many faculty members does each building have? List the result with the name of the building.
create table Activity ( actid INTEGER PRIMARY KEY, activity_name varchar(25) ); create table Participates_in ( stuid INTEGER, actid INTEGER, FOREIGN KEY(stuid) REFERENCES Student(StuID), FOREIGN KEY(actid) REFERENCES Activity(actid) ); create table Faculty_Participates_in ( FacID INTEGER, actid INTEGER, FOREIGN KEY(FacID) REFERENCES Faculty(FacID), FOREIGN KEY(actid) REFERENCES Activity(actid) ); create table Student ( StuID INTEGER PRIMARY KEY, LName VARCHAR(12), Fname VARCHAR(12), Age INTEGER, Sex VARCHAR(1), Major INTEGER, Advisor INTEGER, city_code VARCHAR(3) ); create table Faculty ( FacID INTEGER PRIMARY KEY, Lname VARCHAR(15), Fname VARCHAR(15), Rank VARCHAR(15), Sex VARCHAR(1), Phone INTEGER, Room VARCHAR(5), Building VARCHAR(13) ); insert into Faculty values ( 1082, 'Giuliano', 'Mark', 'Instructor', 'M', 2424, '224', 'NEB'); insert into Student values ( 1001, 'Smith', 'Linda', 18, 'F', 600, 1121,'BAL'); insert into Activity values ( 770 , 'Mountain Climbing' ) ; insert into Participates_in values (1001 , 770) ; insert into Faculty_Participates_in values ( 1082, 784) ; INSERT INTO Activity VALUES [(770, 'Mountain Climbing'), (771, 'Canoeing')] INSERT INTO Participates_in VALUES [(1001, 770), (1001, 771)] INSERT INTO Faculty_Participates_in VALUES [(1082, 784), (1082, 785)] INSERT INTO Student VALUES [(1001, 'Smith', 'Linda', 18, 'F', 600, 1121, 'BAL'), (1002, 'Kim', 'Tracy', 19, 'F', 600, 7712, 'HKG')] INSERT INTO Faculty VALUES [(1082, 'Giuliano', 'Mark', 'Instructor', 'M', 2424, '224', 'NEB'), (1121, 'Goodrich', 'Michael', 'Professor', 'M', 3593, '219', 'NEB')]
activity_1
SELECT building FROM Faculty GROUP BY building ORDER BY count(*) DESC LIMIT 1
Which building has most faculty members?
create table Activity ( actid INTEGER PRIMARY KEY, activity_name varchar(25) ); create table Participates_in ( stuid INTEGER, actid INTEGER, FOREIGN KEY(stuid) REFERENCES Student(StuID), FOREIGN KEY(actid) REFERENCES Activity(actid) ); create table Faculty_Participates_in ( FacID INTEGER, actid INTEGER, FOREIGN KEY(FacID) REFERENCES Faculty(FacID), FOREIGN KEY(actid) REFERENCES Activity(actid) ); create table Student ( StuID INTEGER PRIMARY KEY, LName VARCHAR(12), Fname VARCHAR(12), Age INTEGER, Sex VARCHAR(1), Major INTEGER, Advisor INTEGER, city_code VARCHAR(3) ); create table Faculty ( FacID INTEGER PRIMARY KEY, Lname VARCHAR(15), Fname VARCHAR(15), Rank VARCHAR(15), Sex VARCHAR(1), Phone INTEGER, Room VARCHAR(5), Building VARCHAR(13) ); insert into Faculty values ( 1082, 'Giuliano', 'Mark', 'Instructor', 'M', 2424, '224', 'NEB'); insert into Student values ( 1001, 'Smith', 'Linda', 18, 'F', 600, 1121,'BAL'); insert into Activity values ( 770 , 'Mountain Climbing' ) ; insert into Participates_in values (1001 , 770) ; insert into Faculty_Participates_in values ( 1082, 784) ; INSERT INTO Activity VALUES [(770, 'Mountain Climbing'), (771, 'Canoeing')] INSERT INTO Participates_in VALUES [(1001, 770), (1001, 771)] INSERT INTO Faculty_Participates_in VALUES [(1082, 784), (1082, 785)] INSERT INTO Student VALUES [(1001, 'Smith', 'Linda', 18, 'F', 600, 1121, 'BAL'), (1002, 'Kim', 'Tracy', 19, 'F', 600, 7712, 'HKG')] INSERT INTO Faculty VALUES [(1082, 'Giuliano', 'Mark', 'Instructor', 'M', 2424, '224', 'NEB'), (1121, 'Goodrich', 'Michael', 'Professor', 'M', 3593, '219', 'NEB')]
activity_1
SELECT building FROM Faculty GROUP BY building ORDER BY count(*) DESC LIMIT 1
Find the building that has the largest number of faculty members.
create table Activity ( actid INTEGER PRIMARY KEY, activity_name varchar(25) ); create table Participates_in ( stuid INTEGER, actid INTEGER, FOREIGN KEY(stuid) REFERENCES Student(StuID), FOREIGN KEY(actid) REFERENCES Activity(actid) ); create table Faculty_Participates_in ( FacID INTEGER, actid INTEGER, FOREIGN KEY(FacID) REFERENCES Faculty(FacID), FOREIGN KEY(actid) REFERENCES Activity(actid) ); create table Student ( StuID INTEGER PRIMARY KEY, LName VARCHAR(12), Fname VARCHAR(12), Age INTEGER, Sex VARCHAR(1), Major INTEGER, Advisor INTEGER, city_code VARCHAR(3) ); create table Faculty ( FacID INTEGER PRIMARY KEY, Lname VARCHAR(15), Fname VARCHAR(15), Rank VARCHAR(15), Sex VARCHAR(1), Phone INTEGER, Room VARCHAR(5), Building VARCHAR(13) ); insert into Faculty values ( 1082, 'Giuliano', 'Mark', 'Instructor', 'M', 2424, '224', 'NEB'); insert into Student values ( 1001, 'Smith', 'Linda', 18, 'F', 600, 1121,'BAL'); insert into Activity values ( 770 , 'Mountain Climbing' ) ; insert into Participates_in values (1001 , 770) ; insert into Faculty_Participates_in values ( 1082, 784) ; INSERT INTO Activity VALUES [(770, 'Mountain Climbing'), (771, 'Canoeing')] INSERT INTO Participates_in VALUES [(1001, 770), (1001, 771)] INSERT INTO Faculty_Participates_in VALUES [(1082, 784), (1082, 785)] INSERT INTO Student VALUES [(1001, 'Smith', 'Linda', 18, 'F', 600, 1121, 'BAL'), (1002, 'Kim', 'Tracy', 19, 'F', 600, 7712, 'HKG')] INSERT INTO Faculty VALUES [(1082, 'Giuliano', 'Mark', 'Instructor', 'M', 2424, '224', 'NEB'), (1121, 'Goodrich', 'Michael', 'Professor', 'M', 3593, '219', 'NEB')]
activity_1
SELECT building FROM Faculty WHERE rank = "Professor" GROUP BY building HAVING count(*) >= 10
Show all the buildings that have at least 10 professors.
create table Activity ( actid INTEGER PRIMARY KEY, activity_name varchar(25) ); create table Participates_in ( stuid INTEGER, actid INTEGER, FOREIGN KEY(stuid) REFERENCES Student(StuID), FOREIGN KEY(actid) REFERENCES Activity(actid) ); create table Faculty_Participates_in ( FacID INTEGER, actid INTEGER, FOREIGN KEY(FacID) REFERENCES Faculty(FacID), FOREIGN KEY(actid) REFERENCES Activity(actid) ); create table Student ( StuID INTEGER PRIMARY KEY, LName VARCHAR(12), Fname VARCHAR(12), Age INTEGER, Sex VARCHAR(1), Major INTEGER, Advisor INTEGER, city_code VARCHAR(3) ); create table Faculty ( FacID INTEGER PRIMARY KEY, Lname VARCHAR(15), Fname VARCHAR(15), Rank VARCHAR(15), Sex VARCHAR(1), Phone INTEGER, Room VARCHAR(5), Building VARCHAR(13) ); insert into Faculty values ( 1082, 'Giuliano', 'Mark', 'Instructor', 'M', 2424, '224', 'NEB'); insert into Student values ( 1001, 'Smith', 'Linda', 18, 'F', 600, 1121,'BAL'); insert into Activity values ( 770 , 'Mountain Climbing' ) ; insert into Participates_in values (1001 , 770) ; insert into Faculty_Participates_in values ( 1082, 784) ; INSERT INTO Activity VALUES [(770, 'Mountain Climbing'), (771, 'Canoeing')] INSERT INTO Participates_in VALUES [(1001, 770), (1001, 771)] INSERT INTO Faculty_Participates_in VALUES [(1082, 784), (1082, 785)] INSERT INTO Student VALUES [(1001, 'Smith', 'Linda', 18, 'F', 600, 1121, 'BAL'), (1002, 'Kim', 'Tracy', 19, 'F', 600, 7712, 'HKG')] INSERT INTO Faculty VALUES [(1082, 'Giuliano', 'Mark', 'Instructor', 'M', 2424, '224', 'NEB'), (1121, 'Goodrich', 'Michael', 'Professor', 'M', 3593, '219', 'NEB')]
activity_1
SELECT building FROM Faculty WHERE rank = "Professor" GROUP BY building HAVING count(*) >= 10
In which buildings are there at least ten professors?
create table Activity ( actid INTEGER PRIMARY KEY, activity_name varchar(25) ); create table Participates_in ( stuid INTEGER, actid INTEGER, FOREIGN KEY(stuid) REFERENCES Student(StuID), FOREIGN KEY(actid) REFERENCES Activity(actid) ); create table Faculty_Participates_in ( FacID INTEGER, actid INTEGER, FOREIGN KEY(FacID) REFERENCES Faculty(FacID), FOREIGN KEY(actid) REFERENCES Activity(actid) ); create table Student ( StuID INTEGER PRIMARY KEY, LName VARCHAR(12), Fname VARCHAR(12), Age INTEGER, Sex VARCHAR(1), Major INTEGER, Advisor INTEGER, city_code VARCHAR(3) ); create table Faculty ( FacID INTEGER PRIMARY KEY, Lname VARCHAR(15), Fname VARCHAR(15), Rank VARCHAR(15), Sex VARCHAR(1), Phone INTEGER, Room VARCHAR(5), Building VARCHAR(13) ); insert into Faculty values ( 1082, 'Giuliano', 'Mark', 'Instructor', 'M', 2424, '224', 'NEB'); insert into Student values ( 1001, 'Smith', 'Linda', 18, 'F', 600, 1121,'BAL'); insert into Activity values ( 770 , 'Mountain Climbing' ) ; insert into Participates_in values (1001 , 770) ; insert into Faculty_Participates_in values ( 1082, 784) ; INSERT INTO Activity VALUES [(770, 'Mountain Climbing'), (771, 'Canoeing')] INSERT INTO Participates_in VALUES [(1001, 770), (1001, 771)] INSERT INTO Faculty_Participates_in VALUES [(1082, 784), (1082, 785)] INSERT INTO Student VALUES [(1001, 'Smith', 'Linda', 18, 'F', 600, 1121, 'BAL'), (1002, 'Kim', 'Tracy', 19, 'F', 600, 7712, 'HKG')] INSERT INTO Faculty VALUES [(1082, 'Giuliano', 'Mark', 'Instructor', 'M', 2424, '224', 'NEB'), (1121, 'Goodrich', 'Michael', 'Professor', 'M', 3593, '219', 'NEB')]
activity_1
SELECT rank , count(*) FROM Faculty GROUP BY rank
For each faculty rank, show the number of faculty members who have it.
create table Activity ( actid INTEGER PRIMARY KEY, activity_name varchar(25) ); create table Participates_in ( stuid INTEGER, actid INTEGER, FOREIGN KEY(stuid) REFERENCES Student(StuID), FOREIGN KEY(actid) REFERENCES Activity(actid) ); create table Faculty_Participates_in ( FacID INTEGER, actid INTEGER, FOREIGN KEY(FacID) REFERENCES Faculty(FacID), FOREIGN KEY(actid) REFERENCES Activity(actid) ); create table Student ( StuID INTEGER PRIMARY KEY, LName VARCHAR(12), Fname VARCHAR(12), Age INTEGER, Sex VARCHAR(1), Major INTEGER, Advisor INTEGER, city_code VARCHAR(3) ); create table Faculty ( FacID INTEGER PRIMARY KEY, Lname VARCHAR(15), Fname VARCHAR(15), Rank VARCHAR(15), Sex VARCHAR(1), Phone INTEGER, Room VARCHAR(5), Building VARCHAR(13) ); insert into Faculty values ( 1082, 'Giuliano', 'Mark', 'Instructor', 'M', 2424, '224', 'NEB'); insert into Student values ( 1001, 'Smith', 'Linda', 18, 'F', 600, 1121,'BAL'); insert into Activity values ( 770 , 'Mountain Climbing' ) ; insert into Participates_in values (1001 , 770) ; insert into Faculty_Participates_in values ( 1082, 784) ; INSERT INTO Activity VALUES [(770, 'Mountain Climbing'), (771, 'Canoeing')] INSERT INTO Participates_in VALUES [(1001, 770), (1001, 771)] INSERT INTO Faculty_Participates_in VALUES [(1082, 784), (1082, 785)] INSERT INTO Student VALUES [(1001, 'Smith', 'Linda', 18, 'F', 600, 1121, 'BAL'), (1002, 'Kim', 'Tracy', 19, 'F', 600, 7712, 'HKG')] INSERT INTO Faculty VALUES [(1082, 'Giuliano', 'Mark', 'Instructor', 'M', 2424, '224', 'NEB'), (1121, 'Goodrich', 'Michael', 'Professor', 'M', 3593, '219', 'NEB')]
activity_1
SELECT rank , count(*) FROM Faculty GROUP BY rank
How many faculty members do we have for each faculty rank?
create table Activity ( actid INTEGER PRIMARY KEY, activity_name varchar(25) ); create table Participates_in ( stuid INTEGER, actid INTEGER, FOREIGN KEY(stuid) REFERENCES Student(StuID), FOREIGN KEY(actid) REFERENCES Activity(actid) ); create table Faculty_Participates_in ( FacID INTEGER, actid INTEGER, FOREIGN KEY(FacID) REFERENCES Faculty(FacID), FOREIGN KEY(actid) REFERENCES Activity(actid) ); create table Student ( StuID INTEGER PRIMARY KEY, LName VARCHAR(12), Fname VARCHAR(12), Age INTEGER, Sex VARCHAR(1), Major INTEGER, Advisor INTEGER, city_code VARCHAR(3) ); create table Faculty ( FacID INTEGER PRIMARY KEY, Lname VARCHAR(15), Fname VARCHAR(15), Rank VARCHAR(15), Sex VARCHAR(1), Phone INTEGER, Room VARCHAR(5), Building VARCHAR(13) ); insert into Faculty values ( 1082, 'Giuliano', 'Mark', 'Instructor', 'M', 2424, '224', 'NEB'); insert into Student values ( 1001, 'Smith', 'Linda', 18, 'F', 600, 1121,'BAL'); insert into Activity values ( 770 , 'Mountain Climbing' ) ; insert into Participates_in values (1001 , 770) ; insert into Faculty_Participates_in values ( 1082, 784) ; INSERT INTO Activity VALUES [(770, 'Mountain Climbing'), (771, 'Canoeing')] INSERT INTO Participates_in VALUES [(1001, 770), (1001, 771)] INSERT INTO Faculty_Participates_in VALUES [(1082, 784), (1082, 785)] INSERT INTO Student VALUES [(1001, 'Smith', 'Linda', 18, 'F', 600, 1121, 'BAL'), (1002, 'Kim', 'Tracy', 19, 'F', 600, 7712, 'HKG')] INSERT INTO Faculty VALUES [(1082, 'Giuliano', 'Mark', 'Instructor', 'M', 2424, '224', 'NEB'), (1121, 'Goodrich', 'Michael', 'Professor', 'M', 3593, '219', 'NEB')]
activity_1
SELECT rank , sex , count(*) FROM Faculty GROUP BY rank , sex
Show all the ranks and the number of male and female faculty for each rank.
create table Activity ( actid INTEGER PRIMARY KEY, activity_name varchar(25) ); create table Participates_in ( stuid INTEGER, actid INTEGER, FOREIGN KEY(stuid) REFERENCES Student(StuID), FOREIGN KEY(actid) REFERENCES Activity(actid) ); create table Faculty_Participates_in ( FacID INTEGER, actid INTEGER, FOREIGN KEY(FacID) REFERENCES Faculty(FacID), FOREIGN KEY(actid) REFERENCES Activity(actid) ); create table Student ( StuID INTEGER PRIMARY KEY, LName VARCHAR(12), Fname VARCHAR(12), Age INTEGER, Sex VARCHAR(1), Major INTEGER, Advisor INTEGER, city_code VARCHAR(3) ); create table Faculty ( FacID INTEGER PRIMARY KEY, Lname VARCHAR(15), Fname VARCHAR(15), Rank VARCHAR(15), Sex VARCHAR(1), Phone INTEGER, Room VARCHAR(5), Building VARCHAR(13) ); insert into Faculty values ( 1082, 'Giuliano', 'Mark', 'Instructor', 'M', 2424, '224', 'NEB'); insert into Student values ( 1001, 'Smith', 'Linda', 18, 'F', 600, 1121,'BAL'); insert into Activity values ( 770 , 'Mountain Climbing' ) ; insert into Participates_in values (1001 , 770) ; insert into Faculty_Participates_in values ( 1082, 784) ; INSERT INTO Activity VALUES [(770, 'Mountain Climbing'), (771, 'Canoeing')] INSERT INTO Participates_in VALUES [(1001, 770), (1001, 771)] INSERT INTO Faculty_Participates_in VALUES [(1082, 784), (1082, 785)] INSERT INTO Student VALUES [(1001, 'Smith', 'Linda', 18, 'F', 600, 1121, 'BAL'), (1002, 'Kim', 'Tracy', 19, 'F', 600, 7712, 'HKG')] INSERT INTO Faculty VALUES [(1082, 'Giuliano', 'Mark', 'Instructor', 'M', 2424, '224', 'NEB'), (1121, 'Goodrich', 'Michael', 'Professor', 'M', 3593, '219', 'NEB')]
activity_1
SELECT rank , sex , count(*) FROM Faculty GROUP BY rank , sex
How many faculty members do we have for each rank and gender?
create table Activity ( actid INTEGER PRIMARY KEY, activity_name varchar(25) ); create table Participates_in ( stuid INTEGER, actid INTEGER, FOREIGN KEY(stuid) REFERENCES Student(StuID), FOREIGN KEY(actid) REFERENCES Activity(actid) ); create table Faculty_Participates_in ( FacID INTEGER, actid INTEGER, FOREIGN KEY(FacID) REFERENCES Faculty(FacID), FOREIGN KEY(actid) REFERENCES Activity(actid) ); create table Student ( StuID INTEGER PRIMARY KEY, LName VARCHAR(12), Fname VARCHAR(12), Age INTEGER, Sex VARCHAR(1), Major INTEGER, Advisor INTEGER, city_code VARCHAR(3) ); create table Faculty ( FacID INTEGER PRIMARY KEY, Lname VARCHAR(15), Fname VARCHAR(15), Rank VARCHAR(15), Sex VARCHAR(1), Phone INTEGER, Room VARCHAR(5), Building VARCHAR(13) ); insert into Faculty values ( 1082, 'Giuliano', 'Mark', 'Instructor', 'M', 2424, '224', 'NEB'); insert into Student values ( 1001, 'Smith', 'Linda', 18, 'F', 600, 1121,'BAL'); insert into Activity values ( 770 , 'Mountain Climbing' ) ; insert into Participates_in values (1001 , 770) ; insert into Faculty_Participates_in values ( 1082, 784) ; INSERT INTO Activity VALUES [(770, 'Mountain Climbing'), (771, 'Canoeing')] INSERT INTO Participates_in VALUES [(1001, 770), (1001, 771)] INSERT INTO Faculty_Participates_in VALUES [(1082, 784), (1082, 785)] INSERT INTO Student VALUES [(1001, 'Smith', 'Linda', 18, 'F', 600, 1121, 'BAL'), (1002, 'Kim', 'Tracy', 19, 'F', 600, 7712, 'HKG')] INSERT INTO Faculty VALUES [(1082, 'Giuliano', 'Mark', 'Instructor', 'M', 2424, '224', 'NEB'), (1121, 'Goodrich', 'Michael', 'Professor', 'M', 3593, '219', 'NEB')]
activity_1
SELECT rank FROM Faculty GROUP BY rank ORDER BY count(*) ASC LIMIT 1
Which rank has the smallest number of faculty members?
create table Activity ( actid INTEGER PRIMARY KEY, activity_name varchar(25) ); create table Participates_in ( stuid INTEGER, actid INTEGER, FOREIGN KEY(stuid) REFERENCES Student(StuID), FOREIGN KEY(actid) REFERENCES Activity(actid) ); create table Faculty_Participates_in ( FacID INTEGER, actid INTEGER, FOREIGN KEY(FacID) REFERENCES Faculty(FacID), FOREIGN KEY(actid) REFERENCES Activity(actid) ); create table Student ( StuID INTEGER PRIMARY KEY, LName VARCHAR(12), Fname VARCHAR(12), Age INTEGER, Sex VARCHAR(1), Major INTEGER, Advisor INTEGER, city_code VARCHAR(3) ); create table Faculty ( FacID INTEGER PRIMARY KEY, Lname VARCHAR(15), Fname VARCHAR(15), Rank VARCHAR(15), Sex VARCHAR(1), Phone INTEGER, Room VARCHAR(5), Building VARCHAR(13) ); insert into Faculty values ( 1082, 'Giuliano', 'Mark', 'Instructor', 'M', 2424, '224', 'NEB'); insert into Student values ( 1001, 'Smith', 'Linda', 18, 'F', 600, 1121,'BAL'); insert into Activity values ( 770 , 'Mountain Climbing' ) ; insert into Participates_in values (1001 , 770) ; insert into Faculty_Participates_in values ( 1082, 784) ; INSERT INTO Activity VALUES [(770, 'Mountain Climbing'), (771, 'Canoeing')] INSERT INTO Participates_in VALUES [(1001, 770), (1001, 771)] INSERT INTO Faculty_Participates_in VALUES [(1082, 784), (1082, 785)] INSERT INTO Student VALUES [(1001, 'Smith', 'Linda', 18, 'F', 600, 1121, 'BAL'), (1002, 'Kim', 'Tracy', 19, 'F', 600, 7712, 'HKG')] INSERT INTO Faculty VALUES [(1082, 'Giuliano', 'Mark', 'Instructor', 'M', 2424, '224', 'NEB'), (1121, 'Goodrich', 'Michael', 'Professor', 'M', 3593, '219', 'NEB')]
activity_1
SELECT rank FROM Faculty GROUP BY rank ORDER BY count(*) ASC LIMIT 1
Find the faculty rank that has the least members.
create table Activity ( actid INTEGER PRIMARY KEY, activity_name varchar(25) ); create table Participates_in ( stuid INTEGER, actid INTEGER, FOREIGN KEY(stuid) REFERENCES Student(StuID), FOREIGN KEY(actid) REFERENCES Activity(actid) ); create table Faculty_Participates_in ( FacID INTEGER, actid INTEGER, FOREIGN KEY(FacID) REFERENCES Faculty(FacID), FOREIGN KEY(actid) REFERENCES Activity(actid) ); create table Student ( StuID INTEGER PRIMARY KEY, LName VARCHAR(12), Fname VARCHAR(12), Age INTEGER, Sex VARCHAR(1), Major INTEGER, Advisor INTEGER, city_code VARCHAR(3) ); create table Faculty ( FacID INTEGER PRIMARY KEY, Lname VARCHAR(15), Fname VARCHAR(15), Rank VARCHAR(15), Sex VARCHAR(1), Phone INTEGER, Room VARCHAR(5), Building VARCHAR(13) ); insert into Faculty values ( 1082, 'Giuliano', 'Mark', 'Instructor', 'M', 2424, '224', 'NEB'); insert into Student values ( 1001, 'Smith', 'Linda', 18, 'F', 600, 1121,'BAL'); insert into Activity values ( 770 , 'Mountain Climbing' ) ; insert into Participates_in values (1001 , 770) ; insert into Faculty_Participates_in values ( 1082, 784) ; INSERT INTO Activity VALUES [(770, 'Mountain Climbing'), (771, 'Canoeing')] INSERT INTO Participates_in VALUES [(1001, 770), (1001, 771)] INSERT INTO Faculty_Participates_in VALUES [(1082, 784), (1082, 785)] INSERT INTO Student VALUES [(1001, 'Smith', 'Linda', 18, 'F', 600, 1121, 'BAL'), (1002, 'Kim', 'Tracy', 19, 'F', 600, 7712, 'HKG')] INSERT INTO Faculty VALUES [(1082, 'Giuliano', 'Mark', 'Instructor', 'M', 2424, '224', 'NEB'), (1121, 'Goodrich', 'Michael', 'Professor', 'M', 3593, '219', 'NEB')]
activity_1
SELECT sex , count(*) FROM Faculty WHERE rank = "AsstProf" GROUP BY sex
Show the number of male and female assistant professors.
create table Activity ( actid INTEGER PRIMARY KEY, activity_name varchar(25) ); create table Participates_in ( stuid INTEGER, actid INTEGER, FOREIGN KEY(stuid) REFERENCES Student(StuID), FOREIGN KEY(actid) REFERENCES Activity(actid) ); create table Faculty_Participates_in ( FacID INTEGER, actid INTEGER, FOREIGN KEY(FacID) REFERENCES Faculty(FacID), FOREIGN KEY(actid) REFERENCES Activity(actid) ); create table Student ( StuID INTEGER PRIMARY KEY, LName VARCHAR(12), Fname VARCHAR(12), Age INTEGER, Sex VARCHAR(1), Major INTEGER, Advisor INTEGER, city_code VARCHAR(3) ); create table Faculty ( FacID INTEGER PRIMARY KEY, Lname VARCHAR(15), Fname VARCHAR(15), Rank VARCHAR(15), Sex VARCHAR(1), Phone INTEGER, Room VARCHAR(5), Building VARCHAR(13) ); insert into Faculty values ( 1082, 'Giuliano', 'Mark', 'Instructor', 'M', 2424, '224', 'NEB'); insert into Student values ( 1001, 'Smith', 'Linda', 18, 'F', 600, 1121,'BAL'); insert into Activity values ( 770 , 'Mountain Climbing' ) ; insert into Participates_in values (1001 , 770) ; insert into Faculty_Participates_in values ( 1082, 784) ; INSERT INTO Activity VALUES [(770, 'Mountain Climbing'), (771, 'Canoeing')] INSERT INTO Participates_in VALUES [(1001, 770), (1001, 771)] INSERT INTO Faculty_Participates_in VALUES [(1082, 784), (1082, 785)] INSERT INTO Student VALUES [(1001, 'Smith', 'Linda', 18, 'F', 600, 1121, 'BAL'), (1002, 'Kim', 'Tracy', 19, 'F', 600, 7712, 'HKG')] INSERT INTO Faculty VALUES [(1082, 'Giuliano', 'Mark', 'Instructor', 'M', 2424, '224', 'NEB'), (1121, 'Goodrich', 'Michael', 'Professor', 'M', 3593, '219', 'NEB')]
activity_1
SELECT sex , count(*) FROM Faculty WHERE rank = "AsstProf" GROUP BY sex
How many male and female assistant professors do we have?
create table Activity ( actid INTEGER PRIMARY KEY, activity_name varchar(25) ); create table Participates_in ( stuid INTEGER, actid INTEGER, FOREIGN KEY(stuid) REFERENCES Student(StuID), FOREIGN KEY(actid) REFERENCES Activity(actid) ); create table Faculty_Participates_in ( FacID INTEGER, actid INTEGER, FOREIGN KEY(FacID) REFERENCES Faculty(FacID), FOREIGN KEY(actid) REFERENCES Activity(actid) ); create table Student ( StuID INTEGER PRIMARY KEY, LName VARCHAR(12), Fname VARCHAR(12), Age INTEGER, Sex VARCHAR(1), Major INTEGER, Advisor INTEGER, city_code VARCHAR(3) ); create table Faculty ( FacID INTEGER PRIMARY KEY, Lname VARCHAR(15), Fname VARCHAR(15), Rank VARCHAR(15), Sex VARCHAR(1), Phone INTEGER, Room VARCHAR(5), Building VARCHAR(13) ); insert into Faculty values ( 1082, 'Giuliano', 'Mark', 'Instructor', 'M', 2424, '224', 'NEB'); insert into Student values ( 1001, 'Smith', 'Linda', 18, 'F', 600, 1121,'BAL'); insert into Activity values ( 770 , 'Mountain Climbing' ) ; insert into Participates_in values (1001 , 770) ; insert into Faculty_Participates_in values ( 1082, 784) ; INSERT INTO Activity VALUES [(770, 'Mountain Climbing'), (771, 'Canoeing')] INSERT INTO Participates_in VALUES [(1001, 770), (1001, 771)] INSERT INTO Faculty_Participates_in VALUES [(1082, 784), (1082, 785)] INSERT INTO Student VALUES [(1001, 'Smith', 'Linda', 18, 'F', 600, 1121, 'BAL'), (1002, 'Kim', 'Tracy', 19, 'F', 600, 7712, 'HKG')] INSERT INTO Faculty VALUES [(1082, 'Giuliano', 'Mark', 'Instructor', 'M', 2424, '224', 'NEB'), (1121, 'Goodrich', 'Michael', 'Professor', 'M', 3593, '219', 'NEB')]
activity_1
SELECT T1.fname , T1.lname FROM Faculty AS T1 JOIN Student AS T2 ON T1.FacID = T2.advisor WHERE T2.fname = "Linda" AND T2.lname = "Smith"
What are the first name and last name of Linda Smith's advisor?
create table Activity ( actid INTEGER PRIMARY KEY, activity_name varchar(25) ); create table Participates_in ( stuid INTEGER, actid INTEGER, FOREIGN KEY(stuid) REFERENCES Student(StuID), FOREIGN KEY(actid) REFERENCES Activity(actid) ); create table Faculty_Participates_in ( FacID INTEGER, actid INTEGER, FOREIGN KEY(FacID) REFERENCES Faculty(FacID), FOREIGN KEY(actid) REFERENCES Activity(actid) ); create table Student ( StuID INTEGER PRIMARY KEY, LName VARCHAR(12), Fname VARCHAR(12), Age INTEGER, Sex VARCHAR(1), Major INTEGER, Advisor INTEGER, city_code VARCHAR(3) ); create table Faculty ( FacID INTEGER PRIMARY KEY, Lname VARCHAR(15), Fname VARCHAR(15), Rank VARCHAR(15), Sex VARCHAR(1), Phone INTEGER, Room VARCHAR(5), Building VARCHAR(13) ); insert into Faculty values ( 1082, 'Giuliano', 'Mark', 'Instructor', 'M', 2424, '224', 'NEB'); insert into Student values ( 1001, 'Smith', 'Linda', 18, 'F', 600, 1121,'BAL'); insert into Activity values ( 770 , 'Mountain Climbing' ) ; insert into Participates_in values (1001 , 770) ; insert into Faculty_Participates_in values ( 1082, 784) ; INSERT INTO Activity VALUES [(770, 'Mountain Climbing'), (771, 'Canoeing')] INSERT INTO Participates_in VALUES [(1001, 770), (1001, 771)] INSERT INTO Faculty_Participates_in VALUES [(1082, 784), (1082, 785)] INSERT INTO Student VALUES [(1001, 'Smith', 'Linda', 18, 'F', 600, 1121, 'BAL'), (1002, 'Kim', 'Tracy', 19, 'F', 600, 7712, 'HKG')] INSERT INTO Faculty VALUES [(1082, 'Giuliano', 'Mark', 'Instructor', 'M', 2424, '224', 'NEB'), (1121, 'Goodrich', 'Michael', 'Professor', 'M', 3593, '219', 'NEB')]
activity_1
SELECT T1.fname , T1.lname FROM Faculty AS T1 JOIN Student AS T2 ON T1.FacID = T2.advisor WHERE T2.fname = "Linda" AND T2.lname = "Smith"
Who is the advisor of Linda Smith? Give me the first name and last name.
create table Activity ( actid INTEGER PRIMARY KEY, activity_name varchar(25) ); create table Participates_in ( stuid INTEGER, actid INTEGER, FOREIGN KEY(stuid) REFERENCES Student(StuID), FOREIGN KEY(actid) REFERENCES Activity(actid) ); create table Faculty_Participates_in ( FacID INTEGER, actid INTEGER, FOREIGN KEY(FacID) REFERENCES Faculty(FacID), FOREIGN KEY(actid) REFERENCES Activity(actid) ); create table Student ( StuID INTEGER PRIMARY KEY, LName VARCHAR(12), Fname VARCHAR(12), Age INTEGER, Sex VARCHAR(1), Major INTEGER, Advisor INTEGER, city_code VARCHAR(3) ); create table Faculty ( FacID INTEGER PRIMARY KEY, Lname VARCHAR(15), Fname VARCHAR(15), Rank VARCHAR(15), Sex VARCHAR(1), Phone INTEGER, Room VARCHAR(5), Building VARCHAR(13) ); insert into Faculty values ( 1082, 'Giuliano', 'Mark', 'Instructor', 'M', 2424, '224', 'NEB'); insert into Student values ( 1001, 'Smith', 'Linda', 18, 'F', 600, 1121,'BAL'); insert into Activity values ( 770 , 'Mountain Climbing' ) ; insert into Participates_in values (1001 , 770) ; insert into Faculty_Participates_in values ( 1082, 784) ; INSERT INTO Activity VALUES [(770, 'Mountain Climbing'), (771, 'Canoeing')] INSERT INTO Participates_in VALUES [(1001, 770), (1001, 771)] INSERT INTO Faculty_Participates_in VALUES [(1082, 784), (1082, 785)] INSERT INTO Student VALUES [(1001, 'Smith', 'Linda', 18, 'F', 600, 1121, 'BAL'), (1002, 'Kim', 'Tracy', 19, 'F', 600, 7712, 'HKG')] INSERT INTO Faculty VALUES [(1082, 'Giuliano', 'Mark', 'Instructor', 'M', 2424, '224', 'NEB'), (1121, 'Goodrich', 'Michael', 'Professor', 'M', 3593, '219', 'NEB')]
activity_1
SELECT T2.StuID FROM Faculty AS T1 JOIN Student AS T2 ON T1.FacID = T2.advisor WHERE T1.rank = "Professor"
Show the ids of students whose advisors are professors.
create table Activity ( actid INTEGER PRIMARY KEY, activity_name varchar(25) ); create table Participates_in ( stuid INTEGER, actid INTEGER, FOREIGN KEY(stuid) REFERENCES Student(StuID), FOREIGN KEY(actid) REFERENCES Activity(actid) ); create table Faculty_Participates_in ( FacID INTEGER, actid INTEGER, FOREIGN KEY(FacID) REFERENCES Faculty(FacID), FOREIGN KEY(actid) REFERENCES Activity(actid) ); create table Student ( StuID INTEGER PRIMARY KEY, LName VARCHAR(12), Fname VARCHAR(12), Age INTEGER, Sex VARCHAR(1), Major INTEGER, Advisor INTEGER, city_code VARCHAR(3) ); create table Faculty ( FacID INTEGER PRIMARY KEY, Lname VARCHAR(15), Fname VARCHAR(15), Rank VARCHAR(15), Sex VARCHAR(1), Phone INTEGER, Room VARCHAR(5), Building VARCHAR(13) ); insert into Faculty values ( 1082, 'Giuliano', 'Mark', 'Instructor', 'M', 2424, '224', 'NEB'); insert into Student values ( 1001, 'Smith', 'Linda', 18, 'F', 600, 1121,'BAL'); insert into Activity values ( 770 , 'Mountain Climbing' ) ; insert into Participates_in values (1001 , 770) ; insert into Faculty_Participates_in values ( 1082, 784) ; INSERT INTO Activity VALUES [(770, 'Mountain Climbing'), (771, 'Canoeing')] INSERT INTO Participates_in VALUES [(1001, 770), (1001, 771)] INSERT INTO Faculty_Participates_in VALUES [(1082, 784), (1082, 785)] INSERT INTO Student VALUES [(1001, 'Smith', 'Linda', 18, 'F', 600, 1121, 'BAL'), (1002, 'Kim', 'Tracy', 19, 'F', 600, 7712, 'HKG')] INSERT INTO Faculty VALUES [(1082, 'Giuliano', 'Mark', 'Instructor', 'M', 2424, '224', 'NEB'), (1121, 'Goodrich', 'Michael', 'Professor', 'M', 3593, '219', 'NEB')]
activity_1
SELECT T2.StuID FROM Faculty AS T1 JOIN Student AS T2 ON T1.FacID = T2.advisor WHERE T1.rank = "Professor"
Which students have professors as their advisors? Find their student ids.
create table Activity ( actid INTEGER PRIMARY KEY, activity_name varchar(25) ); create table Participates_in ( stuid INTEGER, actid INTEGER, FOREIGN KEY(stuid) REFERENCES Student(StuID), FOREIGN KEY(actid) REFERENCES Activity(actid) ); create table Faculty_Participates_in ( FacID INTEGER, actid INTEGER, FOREIGN KEY(FacID) REFERENCES Faculty(FacID), FOREIGN KEY(actid) REFERENCES Activity(actid) ); create table Student ( StuID INTEGER PRIMARY KEY, LName VARCHAR(12), Fname VARCHAR(12), Age INTEGER, Sex VARCHAR(1), Major INTEGER, Advisor INTEGER, city_code VARCHAR(3) ); create table Faculty ( FacID INTEGER PRIMARY KEY, Lname VARCHAR(15), Fname VARCHAR(15), Rank VARCHAR(15), Sex VARCHAR(1), Phone INTEGER, Room VARCHAR(5), Building VARCHAR(13) ); insert into Faculty values ( 1082, 'Giuliano', 'Mark', 'Instructor', 'M', 2424, '224', 'NEB'); insert into Student values ( 1001, 'Smith', 'Linda', 18, 'F', 600, 1121,'BAL'); insert into Activity values ( 770 , 'Mountain Climbing' ) ; insert into Participates_in values (1001 , 770) ; insert into Faculty_Participates_in values ( 1082, 784) ; INSERT INTO Activity VALUES [(770, 'Mountain Climbing'), (771, 'Canoeing')] INSERT INTO Participates_in VALUES [(1001, 770), (1001, 771)] INSERT INTO Faculty_Participates_in VALUES [(1082, 784), (1082, 785)] INSERT INTO Student VALUES [(1001, 'Smith', 'Linda', 18, 'F', 600, 1121, 'BAL'), (1002, 'Kim', 'Tracy', 19, 'F', 600, 7712, 'HKG')] INSERT INTO Faculty VALUES [(1082, 'Giuliano', 'Mark', 'Instructor', 'M', 2424, '224', 'NEB'), (1121, 'Goodrich', 'Michael', 'Professor', 'M', 3593, '219', 'NEB')]
activity_1
SELECT T2.fname , T2.lname FROM Faculty AS T1 JOIN Student AS T2 ON T1.FacID = T2.advisor WHERE T1.fname = "Michael" AND T1.lname = "Goodrich"
Show first name and last name for all the students advised by Michael Goodrich.
create table Activity ( actid INTEGER PRIMARY KEY, activity_name varchar(25) ); create table Participates_in ( stuid INTEGER, actid INTEGER, FOREIGN KEY(stuid) REFERENCES Student(StuID), FOREIGN KEY(actid) REFERENCES Activity(actid) ); create table Faculty_Participates_in ( FacID INTEGER, actid INTEGER, FOREIGN KEY(FacID) REFERENCES Faculty(FacID), FOREIGN KEY(actid) REFERENCES Activity(actid) ); create table Student ( StuID INTEGER PRIMARY KEY, LName VARCHAR(12), Fname VARCHAR(12), Age INTEGER, Sex VARCHAR(1), Major INTEGER, Advisor INTEGER, city_code VARCHAR(3) ); create table Faculty ( FacID INTEGER PRIMARY KEY, Lname VARCHAR(15), Fname VARCHAR(15), Rank VARCHAR(15), Sex VARCHAR(1), Phone INTEGER, Room VARCHAR(5), Building VARCHAR(13) ); insert into Faculty values ( 1082, 'Giuliano', 'Mark', 'Instructor', 'M', 2424, '224', 'NEB'); insert into Student values ( 1001, 'Smith', 'Linda', 18, 'F', 600, 1121,'BAL'); insert into Activity values ( 770 , 'Mountain Climbing' ) ; insert into Participates_in values (1001 , 770) ; insert into Faculty_Participates_in values ( 1082, 784) ; INSERT INTO Activity VALUES [(770, 'Mountain Climbing'), (771, 'Canoeing')] INSERT INTO Participates_in VALUES [(1001, 770), (1001, 771)] INSERT INTO Faculty_Participates_in VALUES [(1082, 784), (1082, 785)] INSERT INTO Student VALUES [(1001, 'Smith', 'Linda', 18, 'F', 600, 1121, 'BAL'), (1002, 'Kim', 'Tracy', 19, 'F', 600, 7712, 'HKG')] INSERT INTO Faculty VALUES [(1082, 'Giuliano', 'Mark', 'Instructor', 'M', 2424, '224', 'NEB'), (1121, 'Goodrich', 'Michael', 'Professor', 'M', 3593, '219', 'NEB')]
activity_1
SELECT T2.fname , T2.lname FROM Faculty AS T1 JOIN Student AS T2 ON T1.FacID = T2.advisor WHERE T1.fname = "Michael" AND T1.lname = "Goodrich"
Which students are advised by Michael Goodrich? Give me their first and last names.
create table Activity ( actid INTEGER PRIMARY KEY, activity_name varchar(25) ); create table Participates_in ( stuid INTEGER, actid INTEGER, FOREIGN KEY(stuid) REFERENCES Student(StuID), FOREIGN KEY(actid) REFERENCES Activity(actid) ); create table Faculty_Participates_in ( FacID INTEGER, actid INTEGER, FOREIGN KEY(FacID) REFERENCES Faculty(FacID), FOREIGN KEY(actid) REFERENCES Activity(actid) ); create table Student ( StuID INTEGER PRIMARY KEY, LName VARCHAR(12), Fname VARCHAR(12), Age INTEGER, Sex VARCHAR(1), Major INTEGER, Advisor INTEGER, city_code VARCHAR(3) ); create table Faculty ( FacID INTEGER PRIMARY KEY, Lname VARCHAR(15), Fname VARCHAR(15), Rank VARCHAR(15), Sex VARCHAR(1), Phone INTEGER, Room VARCHAR(5), Building VARCHAR(13) ); insert into Faculty values ( 1082, 'Giuliano', 'Mark', 'Instructor', 'M', 2424, '224', 'NEB'); insert into Student values ( 1001, 'Smith', 'Linda', 18, 'F', 600, 1121,'BAL'); insert into Activity values ( 770 , 'Mountain Climbing' ) ; insert into Participates_in values (1001 , 770) ; insert into Faculty_Participates_in values ( 1082, 784) ; INSERT INTO Activity VALUES [(770, 'Mountain Climbing'), (771, 'Canoeing')] INSERT INTO Participates_in VALUES [(1001, 770), (1001, 771)] INSERT INTO Faculty_Participates_in VALUES [(1082, 784), (1082, 785)] INSERT INTO Student VALUES [(1001, 'Smith', 'Linda', 18, 'F', 600, 1121, 'BAL'), (1002, 'Kim', 'Tracy', 19, 'F', 600, 7712, 'HKG')] INSERT INTO Faculty VALUES [(1082, 'Giuliano', 'Mark', 'Instructor', 'M', 2424, '224', 'NEB'), (1121, 'Goodrich', 'Michael', 'Professor', 'M', 3593, '219', 'NEB')]
activity_1
SELECT T1.FacID , count(*) FROM Faculty AS T1 JOIN Student AS T2 ON T1.FacID = T2.advisor GROUP BY T1.FacID
Show the faculty id of each faculty member, along with the number of students he or she advises.
create table Activity ( actid INTEGER PRIMARY KEY, activity_name varchar(25) ); create table Participates_in ( stuid INTEGER, actid INTEGER, FOREIGN KEY(stuid) REFERENCES Student(StuID), FOREIGN KEY(actid) REFERENCES Activity(actid) ); create table Faculty_Participates_in ( FacID INTEGER, actid INTEGER, FOREIGN KEY(FacID) REFERENCES Faculty(FacID), FOREIGN KEY(actid) REFERENCES Activity(actid) ); create table Student ( StuID INTEGER PRIMARY KEY, LName VARCHAR(12), Fname VARCHAR(12), Age INTEGER, Sex VARCHAR(1), Major INTEGER, Advisor INTEGER, city_code VARCHAR(3) ); create table Faculty ( FacID INTEGER PRIMARY KEY, Lname VARCHAR(15), Fname VARCHAR(15), Rank VARCHAR(15), Sex VARCHAR(1), Phone INTEGER, Room VARCHAR(5), Building VARCHAR(13) ); insert into Faculty values ( 1082, 'Giuliano', 'Mark', 'Instructor', 'M', 2424, '224', 'NEB'); insert into Student values ( 1001, 'Smith', 'Linda', 18, 'F', 600, 1121,'BAL'); insert into Activity values ( 770 , 'Mountain Climbing' ) ; insert into Participates_in values (1001 , 770) ; insert into Faculty_Participates_in values ( 1082, 784) ; INSERT INTO Activity VALUES [(770, 'Mountain Climbing'), (771, 'Canoeing')] INSERT INTO Participates_in VALUES [(1001, 770), (1001, 771)] INSERT INTO Faculty_Participates_in VALUES [(1082, 784), (1082, 785)] INSERT INTO Student VALUES [(1001, 'Smith', 'Linda', 18, 'F', 600, 1121, 'BAL'), (1002, 'Kim', 'Tracy', 19, 'F', 600, 7712, 'HKG')] INSERT INTO Faculty VALUES [(1082, 'Giuliano', 'Mark', 'Instructor', 'M', 2424, '224', 'NEB'), (1121, 'Goodrich', 'Michael', 'Professor', 'M', 3593, '219', 'NEB')]
activity_1
SELECT T1.FacID , count(*) FROM Faculty AS T1 JOIN Student AS T2 ON T1.FacID = T2.advisor GROUP BY T1.FacID
What are the faculty id and the number of students each faculty has?
create table Activity ( actid INTEGER PRIMARY KEY, activity_name varchar(25) ); create table Participates_in ( stuid INTEGER, actid INTEGER, FOREIGN KEY(stuid) REFERENCES Student(StuID), FOREIGN KEY(actid) REFERENCES Activity(actid) ); create table Faculty_Participates_in ( FacID INTEGER, actid INTEGER, FOREIGN KEY(FacID) REFERENCES Faculty(FacID), FOREIGN KEY(actid) REFERENCES Activity(actid) ); create table Student ( StuID INTEGER PRIMARY KEY, LName VARCHAR(12), Fname VARCHAR(12), Age INTEGER, Sex VARCHAR(1), Major INTEGER, Advisor INTEGER, city_code VARCHAR(3) ); create table Faculty ( FacID INTEGER PRIMARY KEY, Lname VARCHAR(15), Fname VARCHAR(15), Rank VARCHAR(15), Sex VARCHAR(1), Phone INTEGER, Room VARCHAR(5), Building VARCHAR(13) ); insert into Faculty values ( 1082, 'Giuliano', 'Mark', 'Instructor', 'M', 2424, '224', 'NEB'); insert into Student values ( 1001, 'Smith', 'Linda', 18, 'F', 600, 1121,'BAL'); insert into Activity values ( 770 , 'Mountain Climbing' ) ; insert into Participates_in values (1001 , 770) ; insert into Faculty_Participates_in values ( 1082, 784) ; INSERT INTO Activity VALUES [(770, 'Mountain Climbing'), (771, 'Canoeing')] INSERT INTO Participates_in VALUES [(1001, 770), (1001, 771)] INSERT INTO Faculty_Participates_in VALUES [(1082, 784), (1082, 785)] INSERT INTO Student VALUES [(1001, 'Smith', 'Linda', 18, 'F', 600, 1121, 'BAL'), (1002, 'Kim', 'Tracy', 19, 'F', 600, 7712, 'HKG')] INSERT INTO Faculty VALUES [(1082, 'Giuliano', 'Mark', 'Instructor', 'M', 2424, '224', 'NEB'), (1121, 'Goodrich', 'Michael', 'Professor', 'M', 3593, '219', 'NEB')]
activity_1
SELECT T1.rank , count(*) FROM Faculty AS T1 JOIN Student AS T2 ON T1.FacID = T2.advisor GROUP BY T1.rank
Show all the faculty ranks and the number of students advised by each rank.
create table Activity ( actid INTEGER PRIMARY KEY, activity_name varchar(25) ); create table Participates_in ( stuid INTEGER, actid INTEGER, FOREIGN KEY(stuid) REFERENCES Student(StuID), FOREIGN KEY(actid) REFERENCES Activity(actid) ); create table Faculty_Participates_in ( FacID INTEGER, actid INTEGER, FOREIGN KEY(FacID) REFERENCES Faculty(FacID), FOREIGN KEY(actid) REFERENCES Activity(actid) ); create table Student ( StuID INTEGER PRIMARY KEY, LName VARCHAR(12), Fname VARCHAR(12), Age INTEGER, Sex VARCHAR(1), Major INTEGER, Advisor INTEGER, city_code VARCHAR(3) ); create table Faculty ( FacID INTEGER PRIMARY KEY, Lname VARCHAR(15), Fname VARCHAR(15), Rank VARCHAR(15), Sex VARCHAR(1), Phone INTEGER, Room VARCHAR(5), Building VARCHAR(13) ); insert into Faculty values ( 1082, 'Giuliano', 'Mark', 'Instructor', 'M', 2424, '224', 'NEB'); insert into Student values ( 1001, 'Smith', 'Linda', 18, 'F', 600, 1121,'BAL'); insert into Activity values ( 770 , 'Mountain Climbing' ) ; insert into Participates_in values (1001 , 770) ; insert into Faculty_Participates_in values ( 1082, 784) ; INSERT INTO Activity VALUES [(770, 'Mountain Climbing'), (771, 'Canoeing')] INSERT INTO Participates_in VALUES [(1001, 770), (1001, 771)] INSERT INTO Faculty_Participates_in VALUES [(1082, 784), (1082, 785)] INSERT INTO Student VALUES [(1001, 'Smith', 'Linda', 18, 'F', 600, 1121, 'BAL'), (1002, 'Kim', 'Tracy', 19, 'F', 600, 7712, 'HKG')] INSERT INTO Faculty VALUES [(1082, 'Giuliano', 'Mark', 'Instructor', 'M', 2424, '224', 'NEB'), (1121, 'Goodrich', 'Michael', 'Professor', 'M', 3593, '219', 'NEB')]
activity_1
SELECT T1.rank , count(*) FROM Faculty AS T1 JOIN Student AS T2 ON T1.FacID = T2.advisor GROUP BY T1.rank
How many students are advised by each rank of faculty? List the rank and the number of students.
create table Activity ( actid INTEGER PRIMARY KEY, activity_name varchar(25) ); create table Participates_in ( stuid INTEGER, actid INTEGER, FOREIGN KEY(stuid) REFERENCES Student(StuID), FOREIGN KEY(actid) REFERENCES Activity(actid) ); create table Faculty_Participates_in ( FacID INTEGER, actid INTEGER, FOREIGN KEY(FacID) REFERENCES Faculty(FacID), FOREIGN KEY(actid) REFERENCES Activity(actid) ); create table Student ( StuID INTEGER PRIMARY KEY, LName VARCHAR(12), Fname VARCHAR(12), Age INTEGER, Sex VARCHAR(1), Major INTEGER, Advisor INTEGER, city_code VARCHAR(3) ); create table Faculty ( FacID INTEGER PRIMARY KEY, Lname VARCHAR(15), Fname VARCHAR(15), Rank VARCHAR(15), Sex VARCHAR(1), Phone INTEGER, Room VARCHAR(5), Building VARCHAR(13) ); insert into Faculty values ( 1082, 'Giuliano', 'Mark', 'Instructor', 'M', 2424, '224', 'NEB'); insert into Student values ( 1001, 'Smith', 'Linda', 18, 'F', 600, 1121,'BAL'); insert into Activity values ( 770 , 'Mountain Climbing' ) ; insert into Participates_in values (1001 , 770) ; insert into Faculty_Participates_in values ( 1082, 784) ; INSERT INTO Activity VALUES [(770, 'Mountain Climbing'), (771, 'Canoeing')] INSERT INTO Participates_in VALUES [(1001, 770), (1001, 771)] INSERT INTO Faculty_Participates_in VALUES [(1082, 784), (1082, 785)] INSERT INTO Student VALUES [(1001, 'Smith', 'Linda', 18, 'F', 600, 1121, 'BAL'), (1002, 'Kim', 'Tracy', 19, 'F', 600, 7712, 'HKG')] INSERT INTO Faculty VALUES [(1082, 'Giuliano', 'Mark', 'Instructor', 'M', 2424, '224', 'NEB'), (1121, 'Goodrich', 'Michael', 'Professor', 'M', 3593, '219', 'NEB')]
activity_1
SELECT T1.fname , T1.lname FROM Faculty AS T1 JOIN Student AS T2 ON T1.FacID = T2.advisor GROUP BY T1.FacID ORDER BY count(*) DESC LIMIT 1
What are the first and last name of the faculty who has the most students?
create table Activity ( actid INTEGER PRIMARY KEY, activity_name varchar(25) ); create table Participates_in ( stuid INTEGER, actid INTEGER, FOREIGN KEY(stuid) REFERENCES Student(StuID), FOREIGN KEY(actid) REFERENCES Activity(actid) ); create table Faculty_Participates_in ( FacID INTEGER, actid INTEGER, FOREIGN KEY(FacID) REFERENCES Faculty(FacID), FOREIGN KEY(actid) REFERENCES Activity(actid) ); create table Student ( StuID INTEGER PRIMARY KEY, LName VARCHAR(12), Fname VARCHAR(12), Age INTEGER, Sex VARCHAR(1), Major INTEGER, Advisor INTEGER, city_code VARCHAR(3) ); create table Faculty ( FacID INTEGER PRIMARY KEY, Lname VARCHAR(15), Fname VARCHAR(15), Rank VARCHAR(15), Sex VARCHAR(1), Phone INTEGER, Room VARCHAR(5), Building VARCHAR(13) ); insert into Faculty values ( 1082, 'Giuliano', 'Mark', 'Instructor', 'M', 2424, '224', 'NEB'); insert into Student values ( 1001, 'Smith', 'Linda', 18, 'F', 600, 1121,'BAL'); insert into Activity values ( 770 , 'Mountain Climbing' ) ; insert into Participates_in values (1001 , 770) ; insert into Faculty_Participates_in values ( 1082, 784) ; INSERT INTO Activity VALUES [(770, 'Mountain Climbing'), (771, 'Canoeing')] INSERT INTO Participates_in VALUES [(1001, 770), (1001, 771)] INSERT INTO Faculty_Participates_in VALUES [(1082, 784), (1082, 785)] INSERT INTO Student VALUES [(1001, 'Smith', 'Linda', 18, 'F', 600, 1121, 'BAL'), (1002, 'Kim', 'Tracy', 19, 'F', 600, 7712, 'HKG')] INSERT INTO Faculty VALUES [(1082, 'Giuliano', 'Mark', 'Instructor', 'M', 2424, '224', 'NEB'), (1121, 'Goodrich', 'Michael', 'Professor', 'M', 3593, '219', 'NEB')]
activity_1
SELECT T1.fname , T1.lname FROM Faculty AS T1 JOIN Student AS T2 ON T1.FacID = T2.advisor GROUP BY T1.FacID ORDER BY count(*) DESC LIMIT 1
Give me the the first and last name of the faculty who advises the most students.
create table Activity ( actid INTEGER PRIMARY KEY, activity_name varchar(25) ); create table Participates_in ( stuid INTEGER, actid INTEGER, FOREIGN KEY(stuid) REFERENCES Student(StuID), FOREIGN KEY(actid) REFERENCES Activity(actid) ); create table Faculty_Participates_in ( FacID INTEGER, actid INTEGER, FOREIGN KEY(FacID) REFERENCES Faculty(FacID), FOREIGN KEY(actid) REFERENCES Activity(actid) ); create table Student ( StuID INTEGER PRIMARY KEY, LName VARCHAR(12), Fname VARCHAR(12), Age INTEGER, Sex VARCHAR(1), Major INTEGER, Advisor INTEGER, city_code VARCHAR(3) ); create table Faculty ( FacID INTEGER PRIMARY KEY, Lname VARCHAR(15), Fname VARCHAR(15), Rank VARCHAR(15), Sex VARCHAR(1), Phone INTEGER, Room VARCHAR(5), Building VARCHAR(13) ); insert into Faculty values ( 1082, 'Giuliano', 'Mark', 'Instructor', 'M', 2424, '224', 'NEB'); insert into Student values ( 1001, 'Smith', 'Linda', 18, 'F', 600, 1121,'BAL'); insert into Activity values ( 770 , 'Mountain Climbing' ) ; insert into Participates_in values (1001 , 770) ; insert into Faculty_Participates_in values ( 1082, 784) ; INSERT INTO Activity VALUES [(770, 'Mountain Climbing'), (771, 'Canoeing')] INSERT INTO Participates_in VALUES [(1001, 770), (1001, 771)] INSERT INTO Faculty_Participates_in VALUES [(1082, 784), (1082, 785)] INSERT INTO Student VALUES [(1001, 'Smith', 'Linda', 18, 'F', 600, 1121, 'BAL'), (1002, 'Kim', 'Tracy', 19, 'F', 600, 7712, 'HKG')] INSERT INTO Faculty VALUES [(1082, 'Giuliano', 'Mark', 'Instructor', 'M', 2424, '224', 'NEB'), (1121, 'Goodrich', 'Michael', 'Professor', 'M', 3593, '219', 'NEB')]
activity_1
SELECT T1.FacID FROM Faculty AS T1 JOIN Student AS T2 ON T1.FacID = T2.advisor GROUP BY T1.FacID HAVING count(*) >= 2
Show the ids for all the faculty members who have at least 2 students.
create table Activity ( actid INTEGER PRIMARY KEY, activity_name varchar(25) ); create table Participates_in ( stuid INTEGER, actid INTEGER, FOREIGN KEY(stuid) REFERENCES Student(StuID), FOREIGN KEY(actid) REFERENCES Activity(actid) ); create table Faculty_Participates_in ( FacID INTEGER, actid INTEGER, FOREIGN KEY(FacID) REFERENCES Faculty(FacID), FOREIGN KEY(actid) REFERENCES Activity(actid) ); create table Student ( StuID INTEGER PRIMARY KEY, LName VARCHAR(12), Fname VARCHAR(12), Age INTEGER, Sex VARCHAR(1), Major INTEGER, Advisor INTEGER, city_code VARCHAR(3) ); create table Faculty ( FacID INTEGER PRIMARY KEY, Lname VARCHAR(15), Fname VARCHAR(15), Rank VARCHAR(15), Sex VARCHAR(1), Phone INTEGER, Room VARCHAR(5), Building VARCHAR(13) ); insert into Faculty values ( 1082, 'Giuliano', 'Mark', 'Instructor', 'M', 2424, '224', 'NEB'); insert into Student values ( 1001, 'Smith', 'Linda', 18, 'F', 600, 1121,'BAL'); insert into Activity values ( 770 , 'Mountain Climbing' ) ; insert into Participates_in values (1001 , 770) ; insert into Faculty_Participates_in values ( 1082, 784) ; INSERT INTO Activity VALUES [(770, 'Mountain Climbing'), (771, 'Canoeing')] INSERT INTO Participates_in VALUES [(1001, 770), (1001, 771)] INSERT INTO Faculty_Participates_in VALUES [(1082, 784), (1082, 785)] INSERT INTO Student VALUES [(1001, 'Smith', 'Linda', 18, 'F', 600, 1121, 'BAL'), (1002, 'Kim', 'Tracy', 19, 'F', 600, 7712, 'HKG')] INSERT INTO Faculty VALUES [(1082, 'Giuliano', 'Mark', 'Instructor', 'M', 2424, '224', 'NEB'), (1121, 'Goodrich', 'Michael', 'Professor', 'M', 3593, '219', 'NEB')]
activity_1
SELECT T1.FacID FROM Faculty AS T1 JOIN Student AS T2 ON T1.FacID = T2.advisor GROUP BY T1.FacID HAVING count(*) >= 2
Which faculty members advise two ore more students? Give me their faculty ids.
create table Activity ( actid INTEGER PRIMARY KEY, activity_name varchar(25) ); create table Participates_in ( stuid INTEGER, actid INTEGER, FOREIGN KEY(stuid) REFERENCES Student(StuID), FOREIGN KEY(actid) REFERENCES Activity(actid) ); create table Faculty_Participates_in ( FacID INTEGER, actid INTEGER, FOREIGN KEY(FacID) REFERENCES Faculty(FacID), FOREIGN KEY(actid) REFERENCES Activity(actid) ); create table Student ( StuID INTEGER PRIMARY KEY, LName VARCHAR(12), Fname VARCHAR(12), Age INTEGER, Sex VARCHAR(1), Major INTEGER, Advisor INTEGER, city_code VARCHAR(3) ); create table Faculty ( FacID INTEGER PRIMARY KEY, Lname VARCHAR(15), Fname VARCHAR(15), Rank VARCHAR(15), Sex VARCHAR(1), Phone INTEGER, Room VARCHAR(5), Building VARCHAR(13) ); insert into Faculty values ( 1082, 'Giuliano', 'Mark', 'Instructor', 'M', 2424, '224', 'NEB'); insert into Student values ( 1001, 'Smith', 'Linda', 18, 'F', 600, 1121,'BAL'); insert into Activity values ( 770 , 'Mountain Climbing' ) ; insert into Participates_in values (1001 , 770) ; insert into Faculty_Participates_in values ( 1082, 784) ; INSERT INTO Activity VALUES [(770, 'Mountain Climbing'), (771, 'Canoeing')] INSERT INTO Participates_in VALUES [(1001, 770), (1001, 771)] INSERT INTO Faculty_Participates_in VALUES [(1082, 784), (1082, 785)] INSERT INTO Student VALUES [(1001, 'Smith', 'Linda', 18, 'F', 600, 1121, 'BAL'), (1002, 'Kim', 'Tracy', 19, 'F', 600, 7712, 'HKG')] INSERT INTO Faculty VALUES [(1082, 'Giuliano', 'Mark', 'Instructor', 'M', 2424, '224', 'NEB'), (1121, 'Goodrich', 'Michael', 'Professor', 'M', 3593, '219', 'NEB')]
activity_1
SELECT FacID FROM Faculty EXCEPT SELECT advisor FROM Student
Show ids for the faculty members who don't advise any student.
create table Activity ( actid INTEGER PRIMARY KEY, activity_name varchar(25) ); create table Participates_in ( stuid INTEGER, actid INTEGER, FOREIGN KEY(stuid) REFERENCES Student(StuID), FOREIGN KEY(actid) REFERENCES Activity(actid) ); create table Faculty_Participates_in ( FacID INTEGER, actid INTEGER, FOREIGN KEY(FacID) REFERENCES Faculty(FacID), FOREIGN KEY(actid) REFERENCES Activity(actid) ); create table Student ( StuID INTEGER PRIMARY KEY, LName VARCHAR(12), Fname VARCHAR(12), Age INTEGER, Sex VARCHAR(1), Major INTEGER, Advisor INTEGER, city_code VARCHAR(3) ); create table Faculty ( FacID INTEGER PRIMARY KEY, Lname VARCHAR(15), Fname VARCHAR(15), Rank VARCHAR(15), Sex VARCHAR(1), Phone INTEGER, Room VARCHAR(5), Building VARCHAR(13) ); insert into Faculty values ( 1082, 'Giuliano', 'Mark', 'Instructor', 'M', 2424, '224', 'NEB'); insert into Student values ( 1001, 'Smith', 'Linda', 18, 'F', 600, 1121,'BAL'); insert into Activity values ( 770 , 'Mountain Climbing' ) ; insert into Participates_in values (1001 , 770) ; insert into Faculty_Participates_in values ( 1082, 784) ; INSERT INTO Activity VALUES [(770, 'Mountain Climbing'), (771, 'Canoeing')] INSERT INTO Participates_in VALUES [(1001, 770), (1001, 771)] INSERT INTO Faculty_Participates_in VALUES [(1082, 784), (1082, 785)] INSERT INTO Student VALUES [(1001, 'Smith', 'Linda', 18, 'F', 600, 1121, 'BAL'), (1002, 'Kim', 'Tracy', 19, 'F', 600, 7712, 'HKG')] INSERT INTO Faculty VALUES [(1082, 'Giuliano', 'Mark', 'Instructor', 'M', 2424, '224', 'NEB'), (1121, 'Goodrich', 'Michael', 'Professor', 'M', 3593, '219', 'NEB')]
activity_1
SELECT FacID FROM Faculty EXCEPT SELECT advisor FROM Student
What are the ids of the faculty members who do not advise any student.
create table Activity ( actid INTEGER PRIMARY KEY, activity_name varchar(25) ); create table Participates_in ( stuid INTEGER, actid INTEGER, FOREIGN KEY(stuid) REFERENCES Student(StuID), FOREIGN KEY(actid) REFERENCES Activity(actid) ); create table Faculty_Participates_in ( FacID INTEGER, actid INTEGER, FOREIGN KEY(FacID) REFERENCES Faculty(FacID), FOREIGN KEY(actid) REFERENCES Activity(actid) ); create table Student ( StuID INTEGER PRIMARY KEY, LName VARCHAR(12), Fname VARCHAR(12), Age INTEGER, Sex VARCHAR(1), Major INTEGER, Advisor INTEGER, city_code VARCHAR(3) ); create table Faculty ( FacID INTEGER PRIMARY KEY, Lname VARCHAR(15), Fname VARCHAR(15), Rank VARCHAR(15), Sex VARCHAR(1), Phone INTEGER, Room VARCHAR(5), Building VARCHAR(13) ); insert into Faculty values ( 1082, 'Giuliano', 'Mark', 'Instructor', 'M', 2424, '224', 'NEB'); insert into Student values ( 1001, 'Smith', 'Linda', 18, 'F', 600, 1121,'BAL'); insert into Activity values ( 770 , 'Mountain Climbing' ) ; insert into Participates_in values (1001 , 770) ; insert into Faculty_Participates_in values ( 1082, 784) ; INSERT INTO Activity VALUES [(770, 'Mountain Climbing'), (771, 'Canoeing')] INSERT INTO Participates_in VALUES [(1001, 770), (1001, 771)] INSERT INTO Faculty_Participates_in VALUES [(1082, 784), (1082, 785)] INSERT INTO Student VALUES [(1001, 'Smith', 'Linda', 18, 'F', 600, 1121, 'BAL'), (1002, 'Kim', 'Tracy', 19, 'F', 600, 7712, 'HKG')] INSERT INTO Faculty VALUES [(1082, 'Giuliano', 'Mark', 'Instructor', 'M', 2424, '224', 'NEB'), (1121, 'Goodrich', 'Michael', 'Professor', 'M', 3593, '219', 'NEB')]
activity_1
SELECT activity_name FROM Activity
What activities do we have?
create table Activity ( actid INTEGER PRIMARY KEY, activity_name varchar(25) ); create table Participates_in ( stuid INTEGER, actid INTEGER, FOREIGN KEY(stuid) REFERENCES Student(StuID), FOREIGN KEY(actid) REFERENCES Activity(actid) ); create table Faculty_Participates_in ( FacID INTEGER, actid INTEGER, FOREIGN KEY(FacID) REFERENCES Faculty(FacID), FOREIGN KEY(actid) REFERENCES Activity(actid) ); create table Student ( StuID INTEGER PRIMARY KEY, LName VARCHAR(12), Fname VARCHAR(12), Age INTEGER, Sex VARCHAR(1), Major INTEGER, Advisor INTEGER, city_code VARCHAR(3) ); create table Faculty ( FacID INTEGER PRIMARY KEY, Lname VARCHAR(15), Fname VARCHAR(15), Rank VARCHAR(15), Sex VARCHAR(1), Phone INTEGER, Room VARCHAR(5), Building VARCHAR(13) ); insert into Faculty values ( 1082, 'Giuliano', 'Mark', 'Instructor', 'M', 2424, '224', 'NEB'); insert into Student values ( 1001, 'Smith', 'Linda', 18, 'F', 600, 1121,'BAL'); insert into Activity values ( 770 , 'Mountain Climbing' ) ; insert into Participates_in values (1001 , 770) ; insert into Faculty_Participates_in values ( 1082, 784) ; INSERT INTO Activity VALUES [(770, 'Mountain Climbing'), (771, 'Canoeing')] INSERT INTO Participates_in VALUES [(1001, 770), (1001, 771)] INSERT INTO Faculty_Participates_in VALUES [(1082, 784), (1082, 785)] INSERT INTO Student VALUES [(1001, 'Smith', 'Linda', 18, 'F', 600, 1121, 'BAL'), (1002, 'Kim', 'Tracy', 19, 'F', 600, 7712, 'HKG')] INSERT INTO Faculty VALUES [(1082, 'Giuliano', 'Mark', 'Instructor', 'M', 2424, '224', 'NEB'), (1121, 'Goodrich', 'Michael', 'Professor', 'M', 3593, '219', 'NEB')]
activity_1
SELECT activity_name FROM Activity
List all the activities we have.
create table Activity ( actid INTEGER PRIMARY KEY, activity_name varchar(25) ); create table Participates_in ( stuid INTEGER, actid INTEGER, FOREIGN KEY(stuid) REFERENCES Student(StuID), FOREIGN KEY(actid) REFERENCES Activity(actid) ); create table Faculty_Participates_in ( FacID INTEGER, actid INTEGER, FOREIGN KEY(FacID) REFERENCES Faculty(FacID), FOREIGN KEY(actid) REFERENCES Activity(actid) ); create table Student ( StuID INTEGER PRIMARY KEY, LName VARCHAR(12), Fname VARCHAR(12), Age INTEGER, Sex VARCHAR(1), Major INTEGER, Advisor INTEGER, city_code VARCHAR(3) ); create table Faculty ( FacID INTEGER PRIMARY KEY, Lname VARCHAR(15), Fname VARCHAR(15), Rank VARCHAR(15), Sex VARCHAR(1), Phone INTEGER, Room VARCHAR(5), Building VARCHAR(13) ); insert into Faculty values ( 1082, 'Giuliano', 'Mark', 'Instructor', 'M', 2424, '224', 'NEB'); insert into Student values ( 1001, 'Smith', 'Linda', 18, 'F', 600, 1121,'BAL'); insert into Activity values ( 770 , 'Mountain Climbing' ) ; insert into Participates_in values (1001 , 770) ; insert into Faculty_Participates_in values ( 1082, 784) ; INSERT INTO Activity VALUES [(770, 'Mountain Climbing'), (771, 'Canoeing')] INSERT INTO Participates_in VALUES [(1001, 770), (1001, 771)] INSERT INTO Faculty_Participates_in VALUES [(1082, 784), (1082, 785)] INSERT INTO Student VALUES [(1001, 'Smith', 'Linda', 18, 'F', 600, 1121, 'BAL'), (1002, 'Kim', 'Tracy', 19, 'F', 600, 7712, 'HKG')] INSERT INTO Faculty VALUES [(1082, 'Giuliano', 'Mark', 'Instructor', 'M', 2424, '224', 'NEB'), (1121, 'Goodrich', 'Michael', 'Professor', 'M', 3593, '219', 'NEB')]
activity_1
SELECT count(*) FROM Activity
How many activities do we have?
create table Activity ( actid INTEGER PRIMARY KEY, activity_name varchar(25) ); create table Participates_in ( stuid INTEGER, actid INTEGER, FOREIGN KEY(stuid) REFERENCES Student(StuID), FOREIGN KEY(actid) REFERENCES Activity(actid) ); create table Faculty_Participates_in ( FacID INTEGER, actid INTEGER, FOREIGN KEY(FacID) REFERENCES Faculty(FacID), FOREIGN KEY(actid) REFERENCES Activity(actid) ); create table Student ( StuID INTEGER PRIMARY KEY, LName VARCHAR(12), Fname VARCHAR(12), Age INTEGER, Sex VARCHAR(1), Major INTEGER, Advisor INTEGER, city_code VARCHAR(3) ); create table Faculty ( FacID INTEGER PRIMARY KEY, Lname VARCHAR(15), Fname VARCHAR(15), Rank VARCHAR(15), Sex VARCHAR(1), Phone INTEGER, Room VARCHAR(5), Building VARCHAR(13) ); insert into Faculty values ( 1082, 'Giuliano', 'Mark', 'Instructor', 'M', 2424, '224', 'NEB'); insert into Student values ( 1001, 'Smith', 'Linda', 18, 'F', 600, 1121,'BAL'); insert into Activity values ( 770 , 'Mountain Climbing' ) ; insert into Participates_in values (1001 , 770) ; insert into Faculty_Participates_in values ( 1082, 784) ; INSERT INTO Activity VALUES [(770, 'Mountain Climbing'), (771, 'Canoeing')] INSERT INTO Participates_in VALUES [(1001, 770), (1001, 771)] INSERT INTO Faculty_Participates_in VALUES [(1082, 784), (1082, 785)] INSERT INTO Student VALUES [(1001, 'Smith', 'Linda', 18, 'F', 600, 1121, 'BAL'), (1002, 'Kim', 'Tracy', 19, 'F', 600, 7712, 'HKG')] INSERT INTO Faculty VALUES [(1082, 'Giuliano', 'Mark', 'Instructor', 'M', 2424, '224', 'NEB'), (1121, 'Goodrich', 'Michael', 'Professor', 'M', 3593, '219', 'NEB')]
activity_1
SELECT count(*) FROM Activity
Find the number of activities available.
create table Activity ( actid INTEGER PRIMARY KEY, activity_name varchar(25) ); create table Participates_in ( stuid INTEGER, actid INTEGER, FOREIGN KEY(stuid) REFERENCES Student(StuID), FOREIGN KEY(actid) REFERENCES Activity(actid) ); create table Faculty_Participates_in ( FacID INTEGER, actid INTEGER, FOREIGN KEY(FacID) REFERENCES Faculty(FacID), FOREIGN KEY(actid) REFERENCES Activity(actid) ); create table Student ( StuID INTEGER PRIMARY KEY, LName VARCHAR(12), Fname VARCHAR(12), Age INTEGER, Sex VARCHAR(1), Major INTEGER, Advisor INTEGER, city_code VARCHAR(3) ); create table Faculty ( FacID INTEGER PRIMARY KEY, Lname VARCHAR(15), Fname VARCHAR(15), Rank VARCHAR(15), Sex VARCHAR(1), Phone INTEGER, Room VARCHAR(5), Building VARCHAR(13) ); insert into Faculty values ( 1082, 'Giuliano', 'Mark', 'Instructor', 'M', 2424, '224', 'NEB'); insert into Student values ( 1001, 'Smith', 'Linda', 18, 'F', 600, 1121,'BAL'); insert into Activity values ( 770 , 'Mountain Climbing' ) ; insert into Participates_in values (1001 , 770) ; insert into Faculty_Participates_in values ( 1082, 784) ; INSERT INTO Activity VALUES [(770, 'Mountain Climbing'), (771, 'Canoeing')] INSERT INTO Participates_in VALUES [(1001, 770), (1001, 771)] INSERT INTO Faculty_Participates_in VALUES [(1082, 784), (1082, 785)] INSERT INTO Student VALUES [(1001, 'Smith', 'Linda', 18, 'F', 600, 1121, 'BAL'), (1002, 'Kim', 'Tracy', 19, 'F', 600, 7712, 'HKG')] INSERT INTO Faculty VALUES [(1082, 'Giuliano', 'Mark', 'Instructor', 'M', 2424, '224', 'NEB'), (1121, 'Goodrich', 'Michael', 'Professor', 'M', 3593, '219', 'NEB')]
activity_1
SELECT count(DISTINCT FacID) FROM Faculty_participates_in
How many faculty members participate in an activity?
create table Activity ( actid INTEGER PRIMARY KEY, activity_name varchar(25) ); create table Participates_in ( stuid INTEGER, actid INTEGER, FOREIGN KEY(stuid) REFERENCES Student(StuID), FOREIGN KEY(actid) REFERENCES Activity(actid) ); create table Faculty_Participates_in ( FacID INTEGER, actid INTEGER, FOREIGN KEY(FacID) REFERENCES Faculty(FacID), FOREIGN KEY(actid) REFERENCES Activity(actid) ); create table Student ( StuID INTEGER PRIMARY KEY, LName VARCHAR(12), Fname VARCHAR(12), Age INTEGER, Sex VARCHAR(1), Major INTEGER, Advisor INTEGER, city_code VARCHAR(3) ); create table Faculty ( FacID INTEGER PRIMARY KEY, Lname VARCHAR(15), Fname VARCHAR(15), Rank VARCHAR(15), Sex VARCHAR(1), Phone INTEGER, Room VARCHAR(5), Building VARCHAR(13) ); insert into Faculty values ( 1082, 'Giuliano', 'Mark', 'Instructor', 'M', 2424, '224', 'NEB'); insert into Student values ( 1001, 'Smith', 'Linda', 18, 'F', 600, 1121,'BAL'); insert into Activity values ( 770 , 'Mountain Climbing' ) ; insert into Participates_in values (1001 , 770) ; insert into Faculty_Participates_in values ( 1082, 784) ; INSERT INTO Activity VALUES [(770, 'Mountain Climbing'), (771, 'Canoeing')] INSERT INTO Participates_in VALUES [(1001, 770), (1001, 771)] INSERT INTO Faculty_Participates_in VALUES [(1082, 784), (1082, 785)] INSERT INTO Student VALUES [(1001, 'Smith', 'Linda', 18, 'F', 600, 1121, 'BAL'), (1002, 'Kim', 'Tracy', 19, 'F', 600, 7712, 'HKG')] INSERT INTO Faculty VALUES [(1082, 'Giuliano', 'Mark', 'Instructor', 'M', 2424, '224', 'NEB'), (1121, 'Goodrich', 'Michael', 'Professor', 'M', 3593, '219', 'NEB')]
activity_1
SELECT count(DISTINCT FacID) FROM Faculty_participates_in
Give me the number of faculty members who participate in an activity
create table Activity ( actid INTEGER PRIMARY KEY, activity_name varchar(25) ); create table Participates_in ( stuid INTEGER, actid INTEGER, FOREIGN KEY(stuid) REFERENCES Student(StuID), FOREIGN KEY(actid) REFERENCES Activity(actid) ); create table Faculty_Participates_in ( FacID INTEGER, actid INTEGER, FOREIGN KEY(FacID) REFERENCES Faculty(FacID), FOREIGN KEY(actid) REFERENCES Activity(actid) ); create table Student ( StuID INTEGER PRIMARY KEY, LName VARCHAR(12), Fname VARCHAR(12), Age INTEGER, Sex VARCHAR(1), Major INTEGER, Advisor INTEGER, city_code VARCHAR(3) ); create table Faculty ( FacID INTEGER PRIMARY KEY, Lname VARCHAR(15), Fname VARCHAR(15), Rank VARCHAR(15), Sex VARCHAR(1), Phone INTEGER, Room VARCHAR(5), Building VARCHAR(13) ); insert into Faculty values ( 1082, 'Giuliano', 'Mark', 'Instructor', 'M', 2424, '224', 'NEB'); insert into Student values ( 1001, 'Smith', 'Linda', 18, 'F', 600, 1121,'BAL'); insert into Activity values ( 770 , 'Mountain Climbing' ) ; insert into Participates_in values (1001 , 770) ; insert into Faculty_Participates_in values ( 1082, 784) ; INSERT INTO Activity VALUES [(770, 'Mountain Climbing'), (771, 'Canoeing')] INSERT INTO Participates_in VALUES [(1001, 770), (1001, 771)] INSERT INTO Faculty_Participates_in VALUES [(1082, 784), (1082, 785)] INSERT INTO Student VALUES [(1001, 'Smith', 'Linda', 18, 'F', 600, 1121, 'BAL'), (1002, 'Kim', 'Tracy', 19, 'F', 600, 7712, 'HKG')] INSERT INTO Faculty VALUES [(1082, 'Giuliano', 'Mark', 'Instructor', 'M', 2424, '224', 'NEB'), (1121, 'Goodrich', 'Michael', 'Professor', 'M', 3593, '219', 'NEB')]
activity_1
SELECT FacID FROM Faculty EXCEPT SELECT FacID FROM Faculty_participates_in
Show the ids of the faculty who don't participate in any activity.
create table Activity ( actid INTEGER PRIMARY KEY, activity_name varchar(25) ); create table Participates_in ( stuid INTEGER, actid INTEGER, FOREIGN KEY(stuid) REFERENCES Student(StuID), FOREIGN KEY(actid) REFERENCES Activity(actid) ); create table Faculty_Participates_in ( FacID INTEGER, actid INTEGER, FOREIGN KEY(FacID) REFERENCES Faculty(FacID), FOREIGN KEY(actid) REFERENCES Activity(actid) ); create table Student ( StuID INTEGER PRIMARY KEY, LName VARCHAR(12), Fname VARCHAR(12), Age INTEGER, Sex VARCHAR(1), Major INTEGER, Advisor INTEGER, city_code VARCHAR(3) ); create table Faculty ( FacID INTEGER PRIMARY KEY, Lname VARCHAR(15), Fname VARCHAR(15), Rank VARCHAR(15), Sex VARCHAR(1), Phone INTEGER, Room VARCHAR(5), Building VARCHAR(13) ); insert into Faculty values ( 1082, 'Giuliano', 'Mark', 'Instructor', 'M', 2424, '224', 'NEB'); insert into Student values ( 1001, 'Smith', 'Linda', 18, 'F', 600, 1121,'BAL'); insert into Activity values ( 770 , 'Mountain Climbing' ) ; insert into Participates_in values (1001 , 770) ; insert into Faculty_Participates_in values ( 1082, 784) ; INSERT INTO Activity VALUES [(770, 'Mountain Climbing'), (771, 'Canoeing')] INSERT INTO Participates_in VALUES [(1001, 770), (1001, 771)] INSERT INTO Faculty_Participates_in VALUES [(1082, 784), (1082, 785)] INSERT INTO Student VALUES [(1001, 'Smith', 'Linda', 18, 'F', 600, 1121, 'BAL'), (1002, 'Kim', 'Tracy', 19, 'F', 600, 7712, 'HKG')] INSERT INTO Faculty VALUES [(1082, 'Giuliano', 'Mark', 'Instructor', 'M', 2424, '224', 'NEB'), (1121, 'Goodrich', 'Michael', 'Professor', 'M', 3593, '219', 'NEB')]
activity_1
SELECT FacID FROM Faculty EXCEPT SELECT FacID FROM Faculty_participates_in
Which faculty do not participate in any activity? Find their faculty ids.
create table Activity ( actid INTEGER PRIMARY KEY, activity_name varchar(25) ); create table Participates_in ( stuid INTEGER, actid INTEGER, FOREIGN KEY(stuid) REFERENCES Student(StuID), FOREIGN KEY(actid) REFERENCES Activity(actid) ); create table Faculty_Participates_in ( FacID INTEGER, actid INTEGER, FOREIGN KEY(FacID) REFERENCES Faculty(FacID), FOREIGN KEY(actid) REFERENCES Activity(actid) ); create table Student ( StuID INTEGER PRIMARY KEY, LName VARCHAR(12), Fname VARCHAR(12), Age INTEGER, Sex VARCHAR(1), Major INTEGER, Advisor INTEGER, city_code VARCHAR(3) ); create table Faculty ( FacID INTEGER PRIMARY KEY, Lname VARCHAR(15), Fname VARCHAR(15), Rank VARCHAR(15), Sex VARCHAR(1), Phone INTEGER, Room VARCHAR(5), Building VARCHAR(13) ); insert into Faculty values ( 1082, 'Giuliano', 'Mark', 'Instructor', 'M', 2424, '224', 'NEB'); insert into Student values ( 1001, 'Smith', 'Linda', 18, 'F', 600, 1121,'BAL'); insert into Activity values ( 770 , 'Mountain Climbing' ) ; insert into Participates_in values (1001 , 770) ; insert into Faculty_Participates_in values ( 1082, 784) ; INSERT INTO Activity VALUES [(770, 'Mountain Climbing'), (771, 'Canoeing')] INSERT INTO Participates_in VALUES [(1001, 770), (1001, 771)] INSERT INTO Faculty_Participates_in VALUES [(1082, 784), (1082, 785)] INSERT INTO Student VALUES [(1001, 'Smith', 'Linda', 18, 'F', 600, 1121, 'BAL'), (1002, 'Kim', 'Tracy', 19, 'F', 600, 7712, 'HKG')] INSERT INTO Faculty VALUES [(1082, 'Giuliano', 'Mark', 'Instructor', 'M', 2424, '224', 'NEB'), (1121, 'Goodrich', 'Michael', 'Professor', 'M', 3593, '219', 'NEB')]
activity_1
SELECT FacID FROM Faculty_participates_in INTERSECT SELECT advisor FROM Student
Show the ids of all the faculty members who participate in an activity and advise a student.
create table Activity ( actid INTEGER PRIMARY KEY, activity_name varchar(25) ); create table Participates_in ( stuid INTEGER, actid INTEGER, FOREIGN KEY(stuid) REFERENCES Student(StuID), FOREIGN KEY(actid) REFERENCES Activity(actid) ); create table Faculty_Participates_in ( FacID INTEGER, actid INTEGER, FOREIGN KEY(FacID) REFERENCES Faculty(FacID), FOREIGN KEY(actid) REFERENCES Activity(actid) ); create table Student ( StuID INTEGER PRIMARY KEY, LName VARCHAR(12), Fname VARCHAR(12), Age INTEGER, Sex VARCHAR(1), Major INTEGER, Advisor INTEGER, city_code VARCHAR(3) ); create table Faculty ( FacID INTEGER PRIMARY KEY, Lname VARCHAR(15), Fname VARCHAR(15), Rank VARCHAR(15), Sex VARCHAR(1), Phone INTEGER, Room VARCHAR(5), Building VARCHAR(13) ); insert into Faculty values ( 1082, 'Giuliano', 'Mark', 'Instructor', 'M', 2424, '224', 'NEB'); insert into Student values ( 1001, 'Smith', 'Linda', 18, 'F', 600, 1121,'BAL'); insert into Activity values ( 770 , 'Mountain Climbing' ) ; insert into Participates_in values (1001 , 770) ; insert into Faculty_Participates_in values ( 1082, 784) ; INSERT INTO Activity VALUES [(770, 'Mountain Climbing'), (771, 'Canoeing')] INSERT INTO Participates_in VALUES [(1001, 770), (1001, 771)] INSERT INTO Faculty_Participates_in VALUES [(1082, 784), (1082, 785)] INSERT INTO Student VALUES [(1001, 'Smith', 'Linda', 18, 'F', 600, 1121, 'BAL'), (1002, 'Kim', 'Tracy', 19, 'F', 600, 7712, 'HKG')] INSERT INTO Faculty VALUES [(1082, 'Giuliano', 'Mark', 'Instructor', 'M', 2424, '224', 'NEB'), (1121, 'Goodrich', 'Michael', 'Professor', 'M', 3593, '219', 'NEB')]
activity_1
SELECT FacID FROM Faculty_participates_in INTERSECT SELECT advisor FROM Student
What are ids of the faculty members who not only participate in an activity but also advise a student.
create table Activity ( actid INTEGER PRIMARY KEY, activity_name varchar(25) ); create table Participates_in ( stuid INTEGER, actid INTEGER, FOREIGN KEY(stuid) REFERENCES Student(StuID), FOREIGN KEY(actid) REFERENCES Activity(actid) ); create table Faculty_Participates_in ( FacID INTEGER, actid INTEGER, FOREIGN KEY(FacID) REFERENCES Faculty(FacID), FOREIGN KEY(actid) REFERENCES Activity(actid) ); create table Student ( StuID INTEGER PRIMARY KEY, LName VARCHAR(12), Fname VARCHAR(12), Age INTEGER, Sex VARCHAR(1), Major INTEGER, Advisor INTEGER, city_code VARCHAR(3) ); create table Faculty ( FacID INTEGER PRIMARY KEY, Lname VARCHAR(15), Fname VARCHAR(15), Rank VARCHAR(15), Sex VARCHAR(1), Phone INTEGER, Room VARCHAR(5), Building VARCHAR(13) ); insert into Faculty values ( 1082, 'Giuliano', 'Mark', 'Instructor', 'M', 2424, '224', 'NEB'); insert into Student values ( 1001, 'Smith', 'Linda', 18, 'F', 600, 1121,'BAL'); insert into Activity values ( 770 , 'Mountain Climbing' ) ; insert into Participates_in values (1001 , 770) ; insert into Faculty_Participates_in values ( 1082, 784) ; INSERT INTO Activity VALUES [(770, 'Mountain Climbing'), (771, 'Canoeing')] INSERT INTO Participates_in VALUES [(1001, 770), (1001, 771)] INSERT INTO Faculty_Participates_in VALUES [(1082, 784), (1082, 785)] INSERT INTO Student VALUES [(1001, 'Smith', 'Linda', 18, 'F', 600, 1121, 'BAL'), (1002, 'Kim', 'Tracy', 19, 'F', 600, 7712, 'HKG')] INSERT INTO Faculty VALUES [(1082, 'Giuliano', 'Mark', 'Instructor', 'M', 2424, '224', 'NEB'), (1121, 'Goodrich', 'Michael', 'Professor', 'M', 3593, '219', 'NEB')]
activity_1
SELECT count(*) FROM Faculty AS T1 JOIN Faculty_participates_in AS T2 ON T1.facID = T2.facID WHERE T1.fname = "Mark" AND T1.lname = "Giuliano"
How many activities does Mark Giuliano participate in?
create table Activity ( actid INTEGER PRIMARY KEY, activity_name varchar(25) ); create table Participates_in ( stuid INTEGER, actid INTEGER, FOREIGN KEY(stuid) REFERENCES Student(StuID), FOREIGN KEY(actid) REFERENCES Activity(actid) ); create table Faculty_Participates_in ( FacID INTEGER, actid INTEGER, FOREIGN KEY(FacID) REFERENCES Faculty(FacID), FOREIGN KEY(actid) REFERENCES Activity(actid) ); create table Student ( StuID INTEGER PRIMARY KEY, LName VARCHAR(12), Fname VARCHAR(12), Age INTEGER, Sex VARCHAR(1), Major INTEGER, Advisor INTEGER, city_code VARCHAR(3) ); create table Faculty ( FacID INTEGER PRIMARY KEY, Lname VARCHAR(15), Fname VARCHAR(15), Rank VARCHAR(15), Sex VARCHAR(1), Phone INTEGER, Room VARCHAR(5), Building VARCHAR(13) ); insert into Faculty values ( 1082, 'Giuliano', 'Mark', 'Instructor', 'M', 2424, '224', 'NEB'); insert into Student values ( 1001, 'Smith', 'Linda', 18, 'F', 600, 1121,'BAL'); insert into Activity values ( 770 , 'Mountain Climbing' ) ; insert into Participates_in values (1001 , 770) ; insert into Faculty_Participates_in values ( 1082, 784) ; INSERT INTO Activity VALUES [(770, 'Mountain Climbing'), (771, 'Canoeing')] INSERT INTO Participates_in VALUES [(1001, 770), (1001, 771)] INSERT INTO Faculty_Participates_in VALUES [(1082, 784), (1082, 785)] INSERT INTO Student VALUES [(1001, 'Smith', 'Linda', 18, 'F', 600, 1121, 'BAL'), (1002, 'Kim', 'Tracy', 19, 'F', 600, 7712, 'HKG')] INSERT INTO Faculty VALUES [(1082, 'Giuliano', 'Mark', 'Instructor', 'M', 2424, '224', 'NEB'), (1121, 'Goodrich', 'Michael', 'Professor', 'M', 3593, '219', 'NEB')]
activity_1
SELECT count(*) FROM Faculty AS T1 JOIN Faculty_participates_in AS T2 ON T1.facID = T2.facID WHERE T1.fname = "Mark" AND T1.lname = "Giuliano"
Find the number of activities Mark Giuliano is involved in.
create table Activity ( actid INTEGER PRIMARY KEY, activity_name varchar(25) ); create table Participates_in ( stuid INTEGER, actid INTEGER, FOREIGN KEY(stuid) REFERENCES Student(StuID), FOREIGN KEY(actid) REFERENCES Activity(actid) ); create table Faculty_Participates_in ( FacID INTEGER, actid INTEGER, FOREIGN KEY(FacID) REFERENCES Faculty(FacID), FOREIGN KEY(actid) REFERENCES Activity(actid) ); create table Student ( StuID INTEGER PRIMARY KEY, LName VARCHAR(12), Fname VARCHAR(12), Age INTEGER, Sex VARCHAR(1), Major INTEGER, Advisor INTEGER, city_code VARCHAR(3) ); create table Faculty ( FacID INTEGER PRIMARY KEY, Lname VARCHAR(15), Fname VARCHAR(15), Rank VARCHAR(15), Sex VARCHAR(1), Phone INTEGER, Room VARCHAR(5), Building VARCHAR(13) ); insert into Faculty values ( 1082, 'Giuliano', 'Mark', 'Instructor', 'M', 2424, '224', 'NEB'); insert into Student values ( 1001, 'Smith', 'Linda', 18, 'F', 600, 1121,'BAL'); insert into Activity values ( 770 , 'Mountain Climbing' ) ; insert into Participates_in values (1001 , 770) ; insert into Faculty_Participates_in values ( 1082, 784) ; INSERT INTO Activity VALUES [(770, 'Mountain Climbing'), (771, 'Canoeing')] INSERT INTO Participates_in VALUES [(1001, 770), (1001, 771)] INSERT INTO Faculty_Participates_in VALUES [(1082, 784), (1082, 785)] INSERT INTO Student VALUES [(1001, 'Smith', 'Linda', 18, 'F', 600, 1121, 'BAL'), (1002, 'Kim', 'Tracy', 19, 'F', 600, 7712, 'HKG')] INSERT INTO Faculty VALUES [(1082, 'Giuliano', 'Mark', 'Instructor', 'M', 2424, '224', 'NEB'), (1121, 'Goodrich', 'Michael', 'Professor', 'M', 3593, '219', 'NEB')]
activity_1
SELECT T3.activity_name FROM Faculty AS T1 JOIN Faculty_participates_in AS T2 ON T1.facID = T2.facID JOIN Activity AS T3 ON T3.actid = T2.actid WHERE T1.fname = "Mark" AND T1.lname = "Giuliano"
Show the names of all the activities Mark Giuliano participates in.
create table Activity ( actid INTEGER PRIMARY KEY, activity_name varchar(25) ); create table Participates_in ( stuid INTEGER, actid INTEGER, FOREIGN KEY(stuid) REFERENCES Student(StuID), FOREIGN KEY(actid) REFERENCES Activity(actid) ); create table Faculty_Participates_in ( FacID INTEGER, actid INTEGER, FOREIGN KEY(FacID) REFERENCES Faculty(FacID), FOREIGN KEY(actid) REFERENCES Activity(actid) ); create table Student ( StuID INTEGER PRIMARY KEY, LName VARCHAR(12), Fname VARCHAR(12), Age INTEGER, Sex VARCHAR(1), Major INTEGER, Advisor INTEGER, city_code VARCHAR(3) ); create table Faculty ( FacID INTEGER PRIMARY KEY, Lname VARCHAR(15), Fname VARCHAR(15), Rank VARCHAR(15), Sex VARCHAR(1), Phone INTEGER, Room VARCHAR(5), Building VARCHAR(13) ); insert into Faculty values ( 1082, 'Giuliano', 'Mark', 'Instructor', 'M', 2424, '224', 'NEB'); insert into Student values ( 1001, 'Smith', 'Linda', 18, 'F', 600, 1121,'BAL'); insert into Activity values ( 770 , 'Mountain Climbing' ) ; insert into Participates_in values (1001 , 770) ; insert into Faculty_Participates_in values ( 1082, 784) ; INSERT INTO Activity VALUES [(770, 'Mountain Climbing'), (771, 'Canoeing')] INSERT INTO Participates_in VALUES [(1001, 770), (1001, 771)] INSERT INTO Faculty_Participates_in VALUES [(1082, 784), (1082, 785)] INSERT INTO Student VALUES [(1001, 'Smith', 'Linda', 18, 'F', 600, 1121, 'BAL'), (1002, 'Kim', 'Tracy', 19, 'F', 600, 7712, 'HKG')] INSERT INTO Faculty VALUES [(1082, 'Giuliano', 'Mark', 'Instructor', 'M', 2424, '224', 'NEB'), (1121, 'Goodrich', 'Michael', 'Professor', 'M', 3593, '219', 'NEB')]
activity_1
SELECT T3.activity_name FROM Faculty AS T1 JOIN Faculty_participates_in AS T2 ON T1.facID = T2.facID JOIN Activity AS T3 ON T3.actid = T2.actid WHERE T1.fname = "Mark" AND T1.lname = "Giuliano"
What are the names of the activities Mark Giuliano is involved in
create table Activity ( actid INTEGER PRIMARY KEY, activity_name varchar(25) ); create table Participates_in ( stuid INTEGER, actid INTEGER, FOREIGN KEY(stuid) REFERENCES Student(StuID), FOREIGN KEY(actid) REFERENCES Activity(actid) ); create table Faculty_Participates_in ( FacID INTEGER, actid INTEGER, FOREIGN KEY(FacID) REFERENCES Faculty(FacID), FOREIGN KEY(actid) REFERENCES Activity(actid) ); create table Student ( StuID INTEGER PRIMARY KEY, LName VARCHAR(12), Fname VARCHAR(12), Age INTEGER, Sex VARCHAR(1), Major INTEGER, Advisor INTEGER, city_code VARCHAR(3) ); create table Faculty ( FacID INTEGER PRIMARY KEY, Lname VARCHAR(15), Fname VARCHAR(15), Rank VARCHAR(15), Sex VARCHAR(1), Phone INTEGER, Room VARCHAR(5), Building VARCHAR(13) ); insert into Faculty values ( 1082, 'Giuliano', 'Mark', 'Instructor', 'M', 2424, '224', 'NEB'); insert into Student values ( 1001, 'Smith', 'Linda', 18, 'F', 600, 1121,'BAL'); insert into Activity values ( 770 , 'Mountain Climbing' ) ; insert into Participates_in values (1001 , 770) ; insert into Faculty_Participates_in values ( 1082, 784) ; INSERT INTO Activity VALUES [(770, 'Mountain Climbing'), (771, 'Canoeing')] INSERT INTO Participates_in VALUES [(1001, 770), (1001, 771)] INSERT INTO Faculty_Participates_in VALUES [(1082, 784), (1082, 785)] INSERT INTO Student VALUES [(1001, 'Smith', 'Linda', 18, 'F', 600, 1121, 'BAL'), (1002, 'Kim', 'Tracy', 19, 'F', 600, 7712, 'HKG')] INSERT INTO Faculty VALUES [(1082, 'Giuliano', 'Mark', 'Instructor', 'M', 2424, '224', 'NEB'), (1121, 'Goodrich', 'Michael', 'Professor', 'M', 3593, '219', 'NEB')]
activity_1
SELECT T1.fname , T1.lname , count(*) , T1.FacID FROM Faculty AS T1 JOIN Faculty_participates_in AS T2 ON T1.facID = T2.facID GROUP BY T1.FacID
Show the first and last name of all the faculty members who participated in some activity, together with the number of activities they participated in.
create table Activity ( actid INTEGER PRIMARY KEY, activity_name varchar(25) ); create table Participates_in ( stuid INTEGER, actid INTEGER, FOREIGN KEY(stuid) REFERENCES Student(StuID), FOREIGN KEY(actid) REFERENCES Activity(actid) ); create table Faculty_Participates_in ( FacID INTEGER, actid INTEGER, FOREIGN KEY(FacID) REFERENCES Faculty(FacID), FOREIGN KEY(actid) REFERENCES Activity(actid) ); create table Student ( StuID INTEGER PRIMARY KEY, LName VARCHAR(12), Fname VARCHAR(12), Age INTEGER, Sex VARCHAR(1), Major INTEGER, Advisor INTEGER, city_code VARCHAR(3) ); create table Faculty ( FacID INTEGER PRIMARY KEY, Lname VARCHAR(15), Fname VARCHAR(15), Rank VARCHAR(15), Sex VARCHAR(1), Phone INTEGER, Room VARCHAR(5), Building VARCHAR(13) ); insert into Faculty values ( 1082, 'Giuliano', 'Mark', 'Instructor', 'M', 2424, '224', 'NEB'); insert into Student values ( 1001, 'Smith', 'Linda', 18, 'F', 600, 1121,'BAL'); insert into Activity values ( 770 , 'Mountain Climbing' ) ; insert into Participates_in values (1001 , 770) ; insert into Faculty_Participates_in values ( 1082, 784) ; INSERT INTO Activity VALUES [(770, 'Mountain Climbing'), (771, 'Canoeing')] INSERT INTO Participates_in VALUES [(1001, 770), (1001, 771)] INSERT INTO Faculty_Participates_in VALUES [(1082, 784), (1082, 785)] INSERT INTO Student VALUES [(1001, 'Smith', 'Linda', 18, 'F', 600, 1121, 'BAL'), (1002, 'Kim', 'Tracy', 19, 'F', 600, 7712, 'HKG')] INSERT INTO Faculty VALUES [(1082, 'Giuliano', 'Mark', 'Instructor', 'M', 2424, '224', 'NEB'), (1121, 'Goodrich', 'Michael', 'Professor', 'M', 3593, '219', 'NEB')]
activity_1
SELECT T1.fname , T1.lname , count(*) , T1.FacID FROM Faculty AS T1 JOIN Faculty_participates_in AS T2 ON T1.facID = T2.facID GROUP BY T1.FacID
What is the first and last name of the faculty members who participated in at least one activity? For each of them, also show the number of activities they participated in.
create table Activity ( actid INTEGER PRIMARY KEY, activity_name varchar(25) ); create table Participates_in ( stuid INTEGER, actid INTEGER, FOREIGN KEY(stuid) REFERENCES Student(StuID), FOREIGN KEY(actid) REFERENCES Activity(actid) ); create table Faculty_Participates_in ( FacID INTEGER, actid INTEGER, FOREIGN KEY(FacID) REFERENCES Faculty(FacID), FOREIGN KEY(actid) REFERENCES Activity(actid) ); create table Student ( StuID INTEGER PRIMARY KEY, LName VARCHAR(12), Fname VARCHAR(12), Age INTEGER, Sex VARCHAR(1), Major INTEGER, Advisor INTEGER, city_code VARCHAR(3) ); create table Faculty ( FacID INTEGER PRIMARY KEY, Lname VARCHAR(15), Fname VARCHAR(15), Rank VARCHAR(15), Sex VARCHAR(1), Phone INTEGER, Room VARCHAR(5), Building VARCHAR(13) ); insert into Faculty values ( 1082, 'Giuliano', 'Mark', 'Instructor', 'M', 2424, '224', 'NEB'); insert into Student values ( 1001, 'Smith', 'Linda', 18, 'F', 600, 1121,'BAL'); insert into Activity values ( 770 , 'Mountain Climbing' ) ; insert into Participates_in values (1001 , 770) ; insert into Faculty_Participates_in values ( 1082, 784) ; INSERT INTO Activity VALUES [(770, 'Mountain Climbing'), (771, 'Canoeing')] INSERT INTO Participates_in VALUES [(1001, 770), (1001, 771)] INSERT INTO Faculty_Participates_in VALUES [(1082, 784), (1082, 785)] INSERT INTO Student VALUES [(1001, 'Smith', 'Linda', 18, 'F', 600, 1121, 'BAL'), (1002, 'Kim', 'Tracy', 19, 'F', 600, 7712, 'HKG')] INSERT INTO Faculty VALUES [(1082, 'Giuliano', 'Mark', 'Instructor', 'M', 2424, '224', 'NEB'), (1121, 'Goodrich', 'Michael', 'Professor', 'M', 3593, '219', 'NEB')]
activity_1
SELECT T1.activity_name , count(*) FROM Activity AS T1 JOIN Faculty_participates_in AS T2 ON T1.actID = T2.actID GROUP BY T1.actID
Show all the activity names and the number of faculty involved in each activity.
create table Activity ( actid INTEGER PRIMARY KEY, activity_name varchar(25) ); create table Participates_in ( stuid INTEGER, actid INTEGER, FOREIGN KEY(stuid) REFERENCES Student(StuID), FOREIGN KEY(actid) REFERENCES Activity(actid) ); create table Faculty_Participates_in ( FacID INTEGER, actid INTEGER, FOREIGN KEY(FacID) REFERENCES Faculty(FacID), FOREIGN KEY(actid) REFERENCES Activity(actid) ); create table Student ( StuID INTEGER PRIMARY KEY, LName VARCHAR(12), Fname VARCHAR(12), Age INTEGER, Sex VARCHAR(1), Major INTEGER, Advisor INTEGER, city_code VARCHAR(3) ); create table Faculty ( FacID INTEGER PRIMARY KEY, Lname VARCHAR(15), Fname VARCHAR(15), Rank VARCHAR(15), Sex VARCHAR(1), Phone INTEGER, Room VARCHAR(5), Building VARCHAR(13) ); insert into Faculty values ( 1082, 'Giuliano', 'Mark', 'Instructor', 'M', 2424, '224', 'NEB'); insert into Student values ( 1001, 'Smith', 'Linda', 18, 'F', 600, 1121,'BAL'); insert into Activity values ( 770 , 'Mountain Climbing' ) ; insert into Participates_in values (1001 , 770) ; insert into Faculty_Participates_in values ( 1082, 784) ; INSERT INTO Activity VALUES [(770, 'Mountain Climbing'), (771, 'Canoeing')] INSERT INTO Participates_in VALUES [(1001, 770), (1001, 771)] INSERT INTO Faculty_Participates_in VALUES [(1082, 784), (1082, 785)] INSERT INTO Student VALUES [(1001, 'Smith', 'Linda', 18, 'F', 600, 1121, 'BAL'), (1002, 'Kim', 'Tracy', 19, 'F', 600, 7712, 'HKG')] INSERT INTO Faculty VALUES [(1082, 'Giuliano', 'Mark', 'Instructor', 'M', 2424, '224', 'NEB'), (1121, 'Goodrich', 'Michael', 'Professor', 'M', 3593, '219', 'NEB')]
activity_1
SELECT T1.activity_name , count(*) FROM Activity AS T1 JOIN Faculty_participates_in AS T2 ON T1.actID = T2.actID GROUP BY T1.actID
How many faculty members participate in each activity? Return the activity names and the number of faculty members.
create table Activity ( actid INTEGER PRIMARY KEY, activity_name varchar(25) ); create table Participates_in ( stuid INTEGER, actid INTEGER, FOREIGN KEY(stuid) REFERENCES Student(StuID), FOREIGN KEY(actid) REFERENCES Activity(actid) ); create table Faculty_Participates_in ( FacID INTEGER, actid INTEGER, FOREIGN KEY(FacID) REFERENCES Faculty(FacID), FOREIGN KEY(actid) REFERENCES Activity(actid) ); create table Student ( StuID INTEGER PRIMARY KEY, LName VARCHAR(12), Fname VARCHAR(12), Age INTEGER, Sex VARCHAR(1), Major INTEGER, Advisor INTEGER, city_code VARCHAR(3) ); create table Faculty ( FacID INTEGER PRIMARY KEY, Lname VARCHAR(15), Fname VARCHAR(15), Rank VARCHAR(15), Sex VARCHAR(1), Phone INTEGER, Room VARCHAR(5), Building VARCHAR(13) ); insert into Faculty values ( 1082, 'Giuliano', 'Mark', 'Instructor', 'M', 2424, '224', 'NEB'); insert into Student values ( 1001, 'Smith', 'Linda', 18, 'F', 600, 1121,'BAL'); insert into Activity values ( 770 , 'Mountain Climbing' ) ; insert into Participates_in values (1001 , 770) ; insert into Faculty_Participates_in values ( 1082, 784) ; INSERT INTO Activity VALUES [(770, 'Mountain Climbing'), (771, 'Canoeing')] INSERT INTO Participates_in VALUES [(1001, 770), (1001, 771)] INSERT INTO Faculty_Participates_in VALUES [(1082, 784), (1082, 785)] INSERT INTO Student VALUES [(1001, 'Smith', 'Linda', 18, 'F', 600, 1121, 'BAL'), (1002, 'Kim', 'Tracy', 19, 'F', 600, 7712, 'HKG')] INSERT INTO Faculty VALUES [(1082, 'Giuliano', 'Mark', 'Instructor', 'M', 2424, '224', 'NEB'), (1121, 'Goodrich', 'Michael', 'Professor', 'M', 3593, '219', 'NEB')]
activity_1
SELECT T1.fname , T1.lname FROM Faculty AS T1 JOIN Faculty_participates_in AS T2 ON T1.facID = T2.facID GROUP BY T1.FacID ORDER BY count(*) DESC LIMIT 1
What is the first and last name of the faculty participating in the most activities?
create table Activity ( actid INTEGER PRIMARY KEY, activity_name varchar(25) ); create table Participates_in ( stuid INTEGER, actid INTEGER, FOREIGN KEY(stuid) REFERENCES Student(StuID), FOREIGN KEY(actid) REFERENCES Activity(actid) ); create table Faculty_Participates_in ( FacID INTEGER, actid INTEGER, FOREIGN KEY(FacID) REFERENCES Faculty(FacID), FOREIGN KEY(actid) REFERENCES Activity(actid) ); create table Student ( StuID INTEGER PRIMARY KEY, LName VARCHAR(12), Fname VARCHAR(12), Age INTEGER, Sex VARCHAR(1), Major INTEGER, Advisor INTEGER, city_code VARCHAR(3) ); create table Faculty ( FacID INTEGER PRIMARY KEY, Lname VARCHAR(15), Fname VARCHAR(15), Rank VARCHAR(15), Sex VARCHAR(1), Phone INTEGER, Room VARCHAR(5), Building VARCHAR(13) ); insert into Faculty values ( 1082, 'Giuliano', 'Mark', 'Instructor', 'M', 2424, '224', 'NEB'); insert into Student values ( 1001, 'Smith', 'Linda', 18, 'F', 600, 1121,'BAL'); insert into Activity values ( 770 , 'Mountain Climbing' ) ; insert into Participates_in values (1001 , 770) ; insert into Faculty_Participates_in values ( 1082, 784) ; INSERT INTO Activity VALUES [(770, 'Mountain Climbing'), (771, 'Canoeing')] INSERT INTO Participates_in VALUES [(1001, 770), (1001, 771)] INSERT INTO Faculty_Participates_in VALUES [(1082, 784), (1082, 785)] INSERT INTO Student VALUES [(1001, 'Smith', 'Linda', 18, 'F', 600, 1121, 'BAL'), (1002, 'Kim', 'Tracy', 19, 'F', 600, 7712, 'HKG')] INSERT INTO Faculty VALUES [(1082, 'Giuliano', 'Mark', 'Instructor', 'M', 2424, '224', 'NEB'), (1121, 'Goodrich', 'Michael', 'Professor', 'M', 3593, '219', 'NEB')]
activity_1
SELECT T1.fname , T1.lname FROM Faculty AS T1 JOIN Faculty_participates_in AS T2 ON T1.facID = T2.facID GROUP BY T1.FacID ORDER BY count(*) DESC LIMIT 1
Find the first and last name of the faculty who is involved in the largest number of activities.
create table Activity ( actid INTEGER PRIMARY KEY, activity_name varchar(25) ); create table Participates_in ( stuid INTEGER, actid INTEGER, FOREIGN KEY(stuid) REFERENCES Student(StuID), FOREIGN KEY(actid) REFERENCES Activity(actid) ); create table Faculty_Participates_in ( FacID INTEGER, actid INTEGER, FOREIGN KEY(FacID) REFERENCES Faculty(FacID), FOREIGN KEY(actid) REFERENCES Activity(actid) ); create table Student ( StuID INTEGER PRIMARY KEY, LName VARCHAR(12), Fname VARCHAR(12), Age INTEGER, Sex VARCHAR(1), Major INTEGER, Advisor INTEGER, city_code VARCHAR(3) ); create table Faculty ( FacID INTEGER PRIMARY KEY, Lname VARCHAR(15), Fname VARCHAR(15), Rank VARCHAR(15), Sex VARCHAR(1), Phone INTEGER, Room VARCHAR(5), Building VARCHAR(13) ); insert into Faculty values ( 1082, 'Giuliano', 'Mark', 'Instructor', 'M', 2424, '224', 'NEB'); insert into Student values ( 1001, 'Smith', 'Linda', 18, 'F', 600, 1121,'BAL'); insert into Activity values ( 770 , 'Mountain Climbing' ) ; insert into Participates_in values (1001 , 770) ; insert into Faculty_Participates_in values ( 1082, 784) ; INSERT INTO Activity VALUES [(770, 'Mountain Climbing'), (771, 'Canoeing')] INSERT INTO Participates_in VALUES [(1001, 770), (1001, 771)] INSERT INTO Faculty_Participates_in VALUES [(1082, 784), (1082, 785)] INSERT INTO Student VALUES [(1001, 'Smith', 'Linda', 18, 'F', 600, 1121, 'BAL'), (1002, 'Kim', 'Tracy', 19, 'F', 600, 7712, 'HKG')] INSERT INTO Faculty VALUES [(1082, 'Giuliano', 'Mark', 'Instructor', 'M', 2424, '224', 'NEB'), (1121, 'Goodrich', 'Michael', 'Professor', 'M', 3593, '219', 'NEB')]
activity_1
SELECT T1.activity_name FROM Activity AS T1 JOIN Faculty_participates_in AS T2 ON T1.actID = T2.actID GROUP BY T1.actID ORDER BY count(*) DESC LIMIT 1
What is the name of the activity that has the most faculty members involved in?
create table Activity ( actid INTEGER PRIMARY KEY, activity_name varchar(25) ); create table Participates_in ( stuid INTEGER, actid INTEGER, FOREIGN KEY(stuid) REFERENCES Student(StuID), FOREIGN KEY(actid) REFERENCES Activity(actid) ); create table Faculty_Participates_in ( FacID INTEGER, actid INTEGER, FOREIGN KEY(FacID) REFERENCES Faculty(FacID), FOREIGN KEY(actid) REFERENCES Activity(actid) ); create table Student ( StuID INTEGER PRIMARY KEY, LName VARCHAR(12), Fname VARCHAR(12), Age INTEGER, Sex VARCHAR(1), Major INTEGER, Advisor INTEGER, city_code VARCHAR(3) ); create table Faculty ( FacID INTEGER PRIMARY KEY, Lname VARCHAR(15), Fname VARCHAR(15), Rank VARCHAR(15), Sex VARCHAR(1), Phone INTEGER, Room VARCHAR(5), Building VARCHAR(13) ); insert into Faculty values ( 1082, 'Giuliano', 'Mark', 'Instructor', 'M', 2424, '224', 'NEB'); insert into Student values ( 1001, 'Smith', 'Linda', 18, 'F', 600, 1121,'BAL'); insert into Activity values ( 770 , 'Mountain Climbing' ) ; insert into Participates_in values (1001 , 770) ; insert into Faculty_Participates_in values ( 1082, 784) ; INSERT INTO Activity VALUES [(770, 'Mountain Climbing'), (771, 'Canoeing')] INSERT INTO Participates_in VALUES [(1001, 770), (1001, 771)] INSERT INTO Faculty_Participates_in VALUES [(1082, 784), (1082, 785)] INSERT INTO Student VALUES [(1001, 'Smith', 'Linda', 18, 'F', 600, 1121, 'BAL'), (1002, 'Kim', 'Tracy', 19, 'F', 600, 7712, 'HKG')] INSERT INTO Faculty VALUES [(1082, 'Giuliano', 'Mark', 'Instructor', 'M', 2424, '224', 'NEB'), (1121, 'Goodrich', 'Michael', 'Professor', 'M', 3593, '219', 'NEB')]
activity_1
SELECT T1.activity_name FROM Activity AS T1 JOIN Faculty_participates_in AS T2 ON T1.actID = T2.actID GROUP BY T1.actID ORDER BY count(*) DESC LIMIT 1
Which activity has the most faculty members participating in? Find the activity name.
create table Activity ( actid INTEGER PRIMARY KEY, activity_name varchar(25) ); create table Participates_in ( stuid INTEGER, actid INTEGER, FOREIGN KEY(stuid) REFERENCES Student(StuID), FOREIGN KEY(actid) REFERENCES Activity(actid) ); create table Faculty_Participates_in ( FacID INTEGER, actid INTEGER, FOREIGN KEY(FacID) REFERENCES Faculty(FacID), FOREIGN KEY(actid) REFERENCES Activity(actid) ); create table Student ( StuID INTEGER PRIMARY KEY, LName VARCHAR(12), Fname VARCHAR(12), Age INTEGER, Sex VARCHAR(1), Major INTEGER, Advisor INTEGER, city_code VARCHAR(3) ); create table Faculty ( FacID INTEGER PRIMARY KEY, Lname VARCHAR(15), Fname VARCHAR(15), Rank VARCHAR(15), Sex VARCHAR(1), Phone INTEGER, Room VARCHAR(5), Building VARCHAR(13) ); insert into Faculty values ( 1082, 'Giuliano', 'Mark', 'Instructor', 'M', 2424, '224', 'NEB'); insert into Student values ( 1001, 'Smith', 'Linda', 18, 'F', 600, 1121,'BAL'); insert into Activity values ( 770 , 'Mountain Climbing' ) ; insert into Participates_in values (1001 , 770) ; insert into Faculty_Participates_in values ( 1082, 784) ; INSERT INTO Activity VALUES [(770, 'Mountain Climbing'), (771, 'Canoeing')] INSERT INTO Participates_in VALUES [(1001, 770), (1001, 771)] INSERT INTO Faculty_Participates_in VALUES [(1082, 784), (1082, 785)] INSERT INTO Student VALUES [(1001, 'Smith', 'Linda', 18, 'F', 600, 1121, 'BAL'), (1002, 'Kim', 'Tracy', 19, 'F', 600, 7712, 'HKG')] INSERT INTO Faculty VALUES [(1082, 'Giuliano', 'Mark', 'Instructor', 'M', 2424, '224', 'NEB'), (1121, 'Goodrich', 'Michael', 'Professor', 'M', 3593, '219', 'NEB')]
activity_1
SELECT StuID FROM Student EXCEPT SELECT StuID FROM Participates_in
Show the ids of the students who don't participate in any activity.
create table Activity ( actid INTEGER PRIMARY KEY, activity_name varchar(25) ); create table Participates_in ( stuid INTEGER, actid INTEGER, FOREIGN KEY(stuid) REFERENCES Student(StuID), FOREIGN KEY(actid) REFERENCES Activity(actid) ); create table Faculty_Participates_in ( FacID INTEGER, actid INTEGER, FOREIGN KEY(FacID) REFERENCES Faculty(FacID), FOREIGN KEY(actid) REFERENCES Activity(actid) ); create table Student ( StuID INTEGER PRIMARY KEY, LName VARCHAR(12), Fname VARCHAR(12), Age INTEGER, Sex VARCHAR(1), Major INTEGER, Advisor INTEGER, city_code VARCHAR(3) ); create table Faculty ( FacID INTEGER PRIMARY KEY, Lname VARCHAR(15), Fname VARCHAR(15), Rank VARCHAR(15), Sex VARCHAR(1), Phone INTEGER, Room VARCHAR(5), Building VARCHAR(13) ); insert into Faculty values ( 1082, 'Giuliano', 'Mark', 'Instructor', 'M', 2424, '224', 'NEB'); insert into Student values ( 1001, 'Smith', 'Linda', 18, 'F', 600, 1121,'BAL'); insert into Activity values ( 770 , 'Mountain Climbing' ) ; insert into Participates_in values (1001 , 770) ; insert into Faculty_Participates_in values ( 1082, 784) ; INSERT INTO Activity VALUES [(770, 'Mountain Climbing'), (771, 'Canoeing')] INSERT INTO Participates_in VALUES [(1001, 770), (1001, 771)] INSERT INTO Faculty_Participates_in VALUES [(1082, 784), (1082, 785)] INSERT INTO Student VALUES [(1001, 'Smith', 'Linda', 18, 'F', 600, 1121, 'BAL'), (1002, 'Kim', 'Tracy', 19, 'F', 600, 7712, 'HKG')] INSERT INTO Faculty VALUES [(1082, 'Giuliano', 'Mark', 'Instructor', 'M', 2424, '224', 'NEB'), (1121, 'Goodrich', 'Michael', 'Professor', 'M', 3593, '219', 'NEB')]
activity_1
SELECT StuID FROM Student EXCEPT SELECT StuID FROM Participates_in
What are the ids of the students who are not involved in any activity
create table Activity ( actid INTEGER PRIMARY KEY, activity_name varchar(25) ); create table Participates_in ( stuid INTEGER, actid INTEGER, FOREIGN KEY(stuid) REFERENCES Student(StuID), FOREIGN KEY(actid) REFERENCES Activity(actid) ); create table Faculty_Participates_in ( FacID INTEGER, actid INTEGER, FOREIGN KEY(FacID) REFERENCES Faculty(FacID), FOREIGN KEY(actid) REFERENCES Activity(actid) ); create table Student ( StuID INTEGER PRIMARY KEY, LName VARCHAR(12), Fname VARCHAR(12), Age INTEGER, Sex VARCHAR(1), Major INTEGER, Advisor INTEGER, city_code VARCHAR(3) ); create table Faculty ( FacID INTEGER PRIMARY KEY, Lname VARCHAR(15), Fname VARCHAR(15), Rank VARCHAR(15), Sex VARCHAR(1), Phone INTEGER, Room VARCHAR(5), Building VARCHAR(13) ); insert into Faculty values ( 1082, 'Giuliano', 'Mark', 'Instructor', 'M', 2424, '224', 'NEB'); insert into Student values ( 1001, 'Smith', 'Linda', 18, 'F', 600, 1121,'BAL'); insert into Activity values ( 770 , 'Mountain Climbing' ) ; insert into Participates_in values (1001 , 770) ; insert into Faculty_Participates_in values ( 1082, 784) ; INSERT INTO Activity VALUES [(770, 'Mountain Climbing'), (771, 'Canoeing')] INSERT INTO Participates_in VALUES [(1001, 770), (1001, 771)] INSERT INTO Faculty_Participates_in VALUES [(1082, 784), (1082, 785)] INSERT INTO Student VALUES [(1001, 'Smith', 'Linda', 18, 'F', 600, 1121, 'BAL'), (1002, 'Kim', 'Tracy', 19, 'F', 600, 7712, 'HKG')] INSERT INTO Faculty VALUES [(1082, 'Giuliano', 'Mark', 'Instructor', 'M', 2424, '224', 'NEB'), (1121, 'Goodrich', 'Michael', 'Professor', 'M', 3593, '219', 'NEB')]
activity_1
SELECT StuID FROM Participates_in INTERSECT SELECT StuID FROM Student WHERE age < 20
Show the ids for all the students who participate in an activity and are under 20.
create table Activity ( actid INTEGER PRIMARY KEY, activity_name varchar(25) ); create table Participates_in ( stuid INTEGER, actid INTEGER, FOREIGN KEY(stuid) REFERENCES Student(StuID), FOREIGN KEY(actid) REFERENCES Activity(actid) ); create table Faculty_Participates_in ( FacID INTEGER, actid INTEGER, FOREIGN KEY(FacID) REFERENCES Faculty(FacID), FOREIGN KEY(actid) REFERENCES Activity(actid) ); create table Student ( StuID INTEGER PRIMARY KEY, LName VARCHAR(12), Fname VARCHAR(12), Age INTEGER, Sex VARCHAR(1), Major INTEGER, Advisor INTEGER, city_code VARCHAR(3) ); create table Faculty ( FacID INTEGER PRIMARY KEY, Lname VARCHAR(15), Fname VARCHAR(15), Rank VARCHAR(15), Sex VARCHAR(1), Phone INTEGER, Room VARCHAR(5), Building VARCHAR(13) ); insert into Faculty values ( 1082, 'Giuliano', 'Mark', 'Instructor', 'M', 2424, '224', 'NEB'); insert into Student values ( 1001, 'Smith', 'Linda', 18, 'F', 600, 1121,'BAL'); insert into Activity values ( 770 , 'Mountain Climbing' ) ; insert into Participates_in values (1001 , 770) ; insert into Faculty_Participates_in values ( 1082, 784) ; INSERT INTO Activity VALUES [(770, 'Mountain Climbing'), (771, 'Canoeing')] INSERT INTO Participates_in VALUES [(1001, 770), (1001, 771)] INSERT INTO Faculty_Participates_in VALUES [(1082, 784), (1082, 785)] INSERT INTO Student VALUES [(1001, 'Smith', 'Linda', 18, 'F', 600, 1121, 'BAL'), (1002, 'Kim', 'Tracy', 19, 'F', 600, 7712, 'HKG')] INSERT INTO Faculty VALUES [(1082, 'Giuliano', 'Mark', 'Instructor', 'M', 2424, '224', 'NEB'), (1121, 'Goodrich', 'Michael', 'Professor', 'M', 3593, '219', 'NEB')]
activity_1
SELECT StuID FROM Participates_in INTERSECT SELECT StuID FROM Student WHERE age < 20
What are the ids of the students who are under 20 years old and are involved in at least one activity.
create table Activity ( actid INTEGER PRIMARY KEY, activity_name varchar(25) ); create table Participates_in ( stuid INTEGER, actid INTEGER, FOREIGN KEY(stuid) REFERENCES Student(StuID), FOREIGN KEY(actid) REFERENCES Activity(actid) ); create table Faculty_Participates_in ( FacID INTEGER, actid INTEGER, FOREIGN KEY(FacID) REFERENCES Faculty(FacID), FOREIGN KEY(actid) REFERENCES Activity(actid) ); create table Student ( StuID INTEGER PRIMARY KEY, LName VARCHAR(12), Fname VARCHAR(12), Age INTEGER, Sex VARCHAR(1), Major INTEGER, Advisor INTEGER, city_code VARCHAR(3) ); create table Faculty ( FacID INTEGER PRIMARY KEY, Lname VARCHAR(15), Fname VARCHAR(15), Rank VARCHAR(15), Sex VARCHAR(1), Phone INTEGER, Room VARCHAR(5), Building VARCHAR(13) ); insert into Faculty values ( 1082, 'Giuliano', 'Mark', 'Instructor', 'M', 2424, '224', 'NEB'); insert into Student values ( 1001, 'Smith', 'Linda', 18, 'F', 600, 1121,'BAL'); insert into Activity values ( 770 , 'Mountain Climbing' ) ; insert into Participates_in values (1001 , 770) ; insert into Faculty_Participates_in values ( 1082, 784) ; INSERT INTO Activity VALUES [(770, 'Mountain Climbing'), (771, 'Canoeing')] INSERT INTO Participates_in VALUES [(1001, 770), (1001, 771)] INSERT INTO Faculty_Participates_in VALUES [(1082, 784), (1082, 785)] INSERT INTO Student VALUES [(1001, 'Smith', 'Linda', 18, 'F', 600, 1121, 'BAL'), (1002, 'Kim', 'Tracy', 19, 'F', 600, 7712, 'HKG')] INSERT INTO Faculty VALUES [(1082, 'Giuliano', 'Mark', 'Instructor', 'M', 2424, '224', 'NEB'), (1121, 'Goodrich', 'Michael', 'Professor', 'M', 3593, '219', 'NEB')]
activity_1
SELECT T1.fname , T1.lname FROM Student AS T1 JOIN Participates_in AS T2 ON T1.StuID = T2.StuID GROUP BY T1.StuID ORDER BY count(*) DESC LIMIT 1
What is the first and last name of the student participating in the most activities?
create table Activity ( actid INTEGER PRIMARY KEY, activity_name varchar(25) ); create table Participates_in ( stuid INTEGER, actid INTEGER, FOREIGN KEY(stuid) REFERENCES Student(StuID), FOREIGN KEY(actid) REFERENCES Activity(actid) ); create table Faculty_Participates_in ( FacID INTEGER, actid INTEGER, FOREIGN KEY(FacID) REFERENCES Faculty(FacID), FOREIGN KEY(actid) REFERENCES Activity(actid) ); create table Student ( StuID INTEGER PRIMARY KEY, LName VARCHAR(12), Fname VARCHAR(12), Age INTEGER, Sex VARCHAR(1), Major INTEGER, Advisor INTEGER, city_code VARCHAR(3) ); create table Faculty ( FacID INTEGER PRIMARY KEY, Lname VARCHAR(15), Fname VARCHAR(15), Rank VARCHAR(15), Sex VARCHAR(1), Phone INTEGER, Room VARCHAR(5), Building VARCHAR(13) ); insert into Faculty values ( 1082, 'Giuliano', 'Mark', 'Instructor', 'M', 2424, '224', 'NEB'); insert into Student values ( 1001, 'Smith', 'Linda', 18, 'F', 600, 1121,'BAL'); insert into Activity values ( 770 , 'Mountain Climbing' ) ; insert into Participates_in values (1001 , 770) ; insert into Faculty_Participates_in values ( 1082, 784) ; INSERT INTO Activity VALUES [(770, 'Mountain Climbing'), (771, 'Canoeing')] INSERT INTO Participates_in VALUES [(1001, 770), (1001, 771)] INSERT INTO Faculty_Participates_in VALUES [(1082, 784), (1082, 785)] INSERT INTO Student VALUES [(1001, 'Smith', 'Linda', 18, 'F', 600, 1121, 'BAL'), (1002, 'Kim', 'Tracy', 19, 'F', 600, 7712, 'HKG')] INSERT INTO Faculty VALUES [(1082, 'Giuliano', 'Mark', 'Instructor', 'M', 2424, '224', 'NEB'), (1121, 'Goodrich', 'Michael', 'Professor', 'M', 3593, '219', 'NEB')]
activity_1
SELECT T1.fname , T1.lname FROM Student AS T1 JOIN Participates_in AS T2 ON T1.StuID = T2.StuID GROUP BY T1.StuID ORDER BY count(*) DESC LIMIT 1
Tell me the first and last name of the student who has the most activities.
create table Activity ( actid INTEGER PRIMARY KEY, activity_name varchar(25) ); create table Participates_in ( stuid INTEGER, actid INTEGER, FOREIGN KEY(stuid) REFERENCES Student(StuID), FOREIGN KEY(actid) REFERENCES Activity(actid) ); create table Faculty_Participates_in ( FacID INTEGER, actid INTEGER, FOREIGN KEY(FacID) REFERENCES Faculty(FacID), FOREIGN KEY(actid) REFERENCES Activity(actid) ); create table Student ( StuID INTEGER PRIMARY KEY, LName VARCHAR(12), Fname VARCHAR(12), Age INTEGER, Sex VARCHAR(1), Major INTEGER, Advisor INTEGER, city_code VARCHAR(3) ); create table Faculty ( FacID INTEGER PRIMARY KEY, Lname VARCHAR(15), Fname VARCHAR(15), Rank VARCHAR(15), Sex VARCHAR(1), Phone INTEGER, Room VARCHAR(5), Building VARCHAR(13) ); insert into Faculty values ( 1082, 'Giuliano', 'Mark', 'Instructor', 'M', 2424, '224', 'NEB'); insert into Student values ( 1001, 'Smith', 'Linda', 18, 'F', 600, 1121,'BAL'); insert into Activity values ( 770 , 'Mountain Climbing' ) ; insert into Participates_in values (1001 , 770) ; insert into Faculty_Participates_in values ( 1082, 784) ; INSERT INTO Activity VALUES [(770, 'Mountain Climbing'), (771, 'Canoeing')] INSERT INTO Participates_in VALUES [(1001, 770), (1001, 771)] INSERT INTO Faculty_Participates_in VALUES [(1082, 784), (1082, 785)] INSERT INTO Student VALUES [(1001, 'Smith', 'Linda', 18, 'F', 600, 1121, 'BAL'), (1002, 'Kim', 'Tracy', 19, 'F', 600, 7712, 'HKG')] INSERT INTO Faculty VALUES [(1082, 'Giuliano', 'Mark', 'Instructor', 'M', 2424, '224', 'NEB'), (1121, 'Goodrich', 'Michael', 'Professor', 'M', 3593, '219', 'NEB')]
activity_1
SELECT T1.activity_name FROM Activity AS T1 JOIN Participates_in AS T2 ON T1.actID = T2.actID GROUP BY T1.actID ORDER BY count(*) DESC LIMIT 1
What is the name of the activity with the most students?
create table Activity ( actid INTEGER PRIMARY KEY, activity_name varchar(25) ); create table Participates_in ( stuid INTEGER, actid INTEGER, FOREIGN KEY(stuid) REFERENCES Student(StuID), FOREIGN KEY(actid) REFERENCES Activity(actid) ); create table Faculty_Participates_in ( FacID INTEGER, actid INTEGER, FOREIGN KEY(FacID) REFERENCES Faculty(FacID), FOREIGN KEY(actid) REFERENCES Activity(actid) ); create table Student ( StuID INTEGER PRIMARY KEY, LName VARCHAR(12), Fname VARCHAR(12), Age INTEGER, Sex VARCHAR(1), Major INTEGER, Advisor INTEGER, city_code VARCHAR(3) ); create table Faculty ( FacID INTEGER PRIMARY KEY, Lname VARCHAR(15), Fname VARCHAR(15), Rank VARCHAR(15), Sex VARCHAR(1), Phone INTEGER, Room VARCHAR(5), Building VARCHAR(13) ); insert into Faculty values ( 1082, 'Giuliano', 'Mark', 'Instructor', 'M', 2424, '224', 'NEB'); insert into Student values ( 1001, 'Smith', 'Linda', 18, 'F', 600, 1121,'BAL'); insert into Activity values ( 770 , 'Mountain Climbing' ) ; insert into Participates_in values (1001 , 770) ; insert into Faculty_Participates_in values ( 1082, 784) ; INSERT INTO Activity VALUES [(770, 'Mountain Climbing'), (771, 'Canoeing')] INSERT INTO Participates_in VALUES [(1001, 770), (1001, 771)] INSERT INTO Faculty_Participates_in VALUES [(1082, 784), (1082, 785)] INSERT INTO Student VALUES [(1001, 'Smith', 'Linda', 18, 'F', 600, 1121, 'BAL'), (1002, 'Kim', 'Tracy', 19, 'F', 600, 7712, 'HKG')] INSERT INTO Faculty VALUES [(1082, 'Giuliano', 'Mark', 'Instructor', 'M', 2424, '224', 'NEB'), (1121, 'Goodrich', 'Michael', 'Professor', 'M', 3593, '219', 'NEB')]
activity_1
SELECT T1.activity_name FROM Activity AS T1 JOIN Participates_in AS T2 ON T1.actID = T2.actID GROUP BY T1.actID ORDER BY count(*) DESC LIMIT 1
Find the name of the activity that has the largest number of student participants.
create table Activity ( actid INTEGER PRIMARY KEY, activity_name varchar(25) ); create table Participates_in ( stuid INTEGER, actid INTEGER, FOREIGN KEY(stuid) REFERENCES Student(StuID), FOREIGN KEY(actid) REFERENCES Activity(actid) ); create table Faculty_Participates_in ( FacID INTEGER, actid INTEGER, FOREIGN KEY(FacID) REFERENCES Faculty(FacID), FOREIGN KEY(actid) REFERENCES Activity(actid) ); create table Student ( StuID INTEGER PRIMARY KEY, LName VARCHAR(12), Fname VARCHAR(12), Age INTEGER, Sex VARCHAR(1), Major INTEGER, Advisor INTEGER, city_code VARCHAR(3) ); create table Faculty ( FacID INTEGER PRIMARY KEY, Lname VARCHAR(15), Fname VARCHAR(15), Rank VARCHAR(15), Sex VARCHAR(1), Phone INTEGER, Room VARCHAR(5), Building VARCHAR(13) ); insert into Faculty values ( 1082, 'Giuliano', 'Mark', 'Instructor', 'M', 2424, '224', 'NEB'); insert into Student values ( 1001, 'Smith', 'Linda', 18, 'F', 600, 1121,'BAL'); insert into Activity values ( 770 , 'Mountain Climbing' ) ; insert into Participates_in values (1001 , 770) ; insert into Faculty_Participates_in values ( 1082, 784) ; INSERT INTO Activity VALUES [(770, 'Mountain Climbing'), (771, 'Canoeing')] INSERT INTO Participates_in VALUES [(1001, 770), (1001, 771)] INSERT INTO Faculty_Participates_in VALUES [(1082, 784), (1082, 785)] INSERT INTO Student VALUES [(1001, 'Smith', 'Linda', 18, 'F', 600, 1121, 'BAL'), (1002, 'Kim', 'Tracy', 19, 'F', 600, 7712, 'HKG')] INSERT INTO Faculty VALUES [(1082, 'Giuliano', 'Mark', 'Instructor', 'M', 2424, '224', 'NEB'), (1121, 'Goodrich', 'Michael', 'Professor', 'M', 3593, '219', 'NEB')]
activity_1
SELECT DISTINCT T1.lname FROM Faculty AS T1 JOIN Faculty_participates_in AS T2 ON T1.facID = T2.facID JOIN activity AS T3 ON T2.actid = T2.actid WHERE T3.activity_name = 'Canoeing' OR T3.activity_name = 'Kayaking'
Find the first names of the faculty members who are playing Canoeing or Kayaking.
create table Activity ( actid INTEGER PRIMARY KEY, activity_name varchar(25) ); create table Participates_in ( stuid INTEGER, actid INTEGER, FOREIGN KEY(stuid) REFERENCES Student(StuID), FOREIGN KEY(actid) REFERENCES Activity(actid) ); create table Faculty_Participates_in ( FacID INTEGER, actid INTEGER, FOREIGN KEY(FacID) REFERENCES Faculty(FacID), FOREIGN KEY(actid) REFERENCES Activity(actid) ); create table Student ( StuID INTEGER PRIMARY KEY, LName VARCHAR(12), Fname VARCHAR(12), Age INTEGER, Sex VARCHAR(1), Major INTEGER, Advisor INTEGER, city_code VARCHAR(3) ); create table Faculty ( FacID INTEGER PRIMARY KEY, Lname VARCHAR(15), Fname VARCHAR(15), Rank VARCHAR(15), Sex VARCHAR(1), Phone INTEGER, Room VARCHAR(5), Building VARCHAR(13) ); insert into Faculty values ( 1082, 'Giuliano', 'Mark', 'Instructor', 'M', 2424, '224', 'NEB'); insert into Student values ( 1001, 'Smith', 'Linda', 18, 'F', 600, 1121,'BAL'); insert into Activity values ( 770 , 'Mountain Climbing' ) ; insert into Participates_in values (1001 , 770) ; insert into Faculty_Participates_in values ( 1082, 784) ; INSERT INTO Activity VALUES [(770, 'Mountain Climbing'), (771, 'Canoeing')] INSERT INTO Participates_in VALUES [(1001, 770), (1001, 771)] INSERT INTO Faculty_Participates_in VALUES [(1082, 784), (1082, 785)] INSERT INTO Student VALUES [(1001, 'Smith', 'Linda', 18, 'F', 600, 1121, 'BAL'), (1002, 'Kim', 'Tracy', 19, 'F', 600, 7712, 'HKG')] INSERT INTO Faculty VALUES [(1082, 'Giuliano', 'Mark', 'Instructor', 'M', 2424, '224', 'NEB'), (1121, 'Goodrich', 'Michael', 'Professor', 'M', 3593, '219', 'NEB')]
activity_1
SELECT DISTINCT T1.lname FROM Faculty AS T1 JOIN Faculty_participates_in AS T2 ON T1.facID = T2.facID JOIN activity AS T3 ON T2.actid = T2.actid WHERE T3.activity_name = 'Canoeing' OR T3.activity_name = 'Kayaking'
Which faculty members are playing either Canoeing or Kayaking? Tell me their first names.
create table Activity ( actid INTEGER PRIMARY KEY, activity_name varchar(25) ); create table Participates_in ( stuid INTEGER, actid INTEGER, FOREIGN KEY(stuid) REFERENCES Student(StuID), FOREIGN KEY(actid) REFERENCES Activity(actid) ); create table Faculty_Participates_in ( FacID INTEGER, actid INTEGER, FOREIGN KEY(FacID) REFERENCES Faculty(FacID), FOREIGN KEY(actid) REFERENCES Activity(actid) ); create table Student ( StuID INTEGER PRIMARY KEY, LName VARCHAR(12), Fname VARCHAR(12), Age INTEGER, Sex VARCHAR(1), Major INTEGER, Advisor INTEGER, city_code VARCHAR(3) ); create table Faculty ( FacID INTEGER PRIMARY KEY, Lname VARCHAR(15), Fname VARCHAR(15), Rank VARCHAR(15), Sex VARCHAR(1), Phone INTEGER, Room VARCHAR(5), Building VARCHAR(13) ); insert into Faculty values ( 1082, 'Giuliano', 'Mark', 'Instructor', 'M', 2424, '224', 'NEB'); insert into Student values ( 1001, 'Smith', 'Linda', 18, 'F', 600, 1121,'BAL'); insert into Activity values ( 770 , 'Mountain Climbing' ) ; insert into Participates_in values (1001 , 770) ; insert into Faculty_Participates_in values ( 1082, 784) ; INSERT INTO Activity VALUES [(770, 'Mountain Climbing'), (771, 'Canoeing')] INSERT INTO Participates_in VALUES [(1001, 770), (1001, 771)] INSERT INTO Faculty_Participates_in VALUES [(1082, 784), (1082, 785)] INSERT INTO Student VALUES [(1001, 'Smith', 'Linda', 18, 'F', 600, 1121, 'BAL'), (1002, 'Kim', 'Tracy', 19, 'F', 600, 7712, 'HKG')] INSERT INTO Faculty VALUES [(1082, 'Giuliano', 'Mark', 'Instructor', 'M', 2424, '224', 'NEB'), (1121, 'Goodrich', 'Michael', 'Professor', 'M', 3593, '219', 'NEB')]
activity_1
SELECT lname FROM faculty WHERE rank = 'Professor' EXCEPT SELECT DISTINCT T1.lname FROM Faculty AS T1 JOIN Faculty_participates_in AS T2 ON T1.facID = T2.facID JOIN activity AS T3 ON T2.actid = T2.actid WHERE T3.activity_name = 'Canoeing' OR T3.activity_name = 'Kayaking'
Find the first names of professors who are not playing Canoeing or Kayaking.
create table Activity ( actid INTEGER PRIMARY KEY, activity_name varchar(25) ); create table Participates_in ( stuid INTEGER, actid INTEGER, FOREIGN KEY(stuid) REFERENCES Student(StuID), FOREIGN KEY(actid) REFERENCES Activity(actid) ); create table Faculty_Participates_in ( FacID INTEGER, actid INTEGER, FOREIGN KEY(FacID) REFERENCES Faculty(FacID), FOREIGN KEY(actid) REFERENCES Activity(actid) ); create table Student ( StuID INTEGER PRIMARY KEY, LName VARCHAR(12), Fname VARCHAR(12), Age INTEGER, Sex VARCHAR(1), Major INTEGER, Advisor INTEGER, city_code VARCHAR(3) ); create table Faculty ( FacID INTEGER PRIMARY KEY, Lname VARCHAR(15), Fname VARCHAR(15), Rank VARCHAR(15), Sex VARCHAR(1), Phone INTEGER, Room VARCHAR(5), Building VARCHAR(13) ); insert into Faculty values ( 1082, 'Giuliano', 'Mark', 'Instructor', 'M', 2424, '224', 'NEB'); insert into Student values ( 1001, 'Smith', 'Linda', 18, 'F', 600, 1121,'BAL'); insert into Activity values ( 770 , 'Mountain Climbing' ) ; insert into Participates_in values (1001 , 770) ; insert into Faculty_Participates_in values ( 1082, 784) ; INSERT INTO Activity VALUES [(770, 'Mountain Climbing'), (771, 'Canoeing')] INSERT INTO Participates_in VALUES [(1001, 770), (1001, 771)] INSERT INTO Faculty_Participates_in VALUES [(1082, 784), (1082, 785)] INSERT INTO Student VALUES [(1001, 'Smith', 'Linda', 18, 'F', 600, 1121, 'BAL'), (1002, 'Kim', 'Tracy', 19, 'F', 600, 7712, 'HKG')] INSERT INTO Faculty VALUES [(1082, 'Giuliano', 'Mark', 'Instructor', 'M', 2424, '224', 'NEB'), (1121, 'Goodrich', 'Michael', 'Professor', 'M', 3593, '219', 'NEB')]
activity_1
SELECT lname FROM faculty WHERE rank = 'Professor' EXCEPT SELECT DISTINCT T1.lname FROM Faculty AS T1 JOIN Faculty_participates_in AS T2 ON T1.facID = T2.facID JOIN activity AS T3 ON T2.actid = T2.actid WHERE T3.activity_name = 'Canoeing' OR T3.activity_name = 'Kayaking'
What are the first names of the professors who do not play Canoeing or Kayaking as activities?
create table Activity ( actid INTEGER PRIMARY KEY, activity_name varchar(25) ); create table Participates_in ( stuid INTEGER, actid INTEGER, FOREIGN KEY(stuid) REFERENCES Student(StuID), FOREIGN KEY(actid) REFERENCES Activity(actid) ); create table Faculty_Participates_in ( FacID INTEGER, actid INTEGER, FOREIGN KEY(FacID) REFERENCES Faculty(FacID), FOREIGN KEY(actid) REFERENCES Activity(actid) ); create table Student ( StuID INTEGER PRIMARY KEY, LName VARCHAR(12), Fname VARCHAR(12), Age INTEGER, Sex VARCHAR(1), Major INTEGER, Advisor INTEGER, city_code VARCHAR(3) ); create table Faculty ( FacID INTEGER PRIMARY KEY, Lname VARCHAR(15), Fname VARCHAR(15), Rank VARCHAR(15), Sex VARCHAR(1), Phone INTEGER, Room VARCHAR(5), Building VARCHAR(13) ); insert into Faculty values ( 1082, 'Giuliano', 'Mark', 'Instructor', 'M', 2424, '224', 'NEB'); insert into Student values ( 1001, 'Smith', 'Linda', 18, 'F', 600, 1121,'BAL'); insert into Activity values ( 770 , 'Mountain Climbing' ) ; insert into Participates_in values (1001 , 770) ; insert into Faculty_Participates_in values ( 1082, 784) ; INSERT INTO Activity VALUES [(770, 'Mountain Climbing'), (771, 'Canoeing')] INSERT INTO Participates_in VALUES [(1001, 770), (1001, 771)] INSERT INTO Faculty_Participates_in VALUES [(1082, 784), (1082, 785)] INSERT INTO Student VALUES [(1001, 'Smith', 'Linda', 18, 'F', 600, 1121, 'BAL'), (1002, 'Kim', 'Tracy', 19, 'F', 600, 7712, 'HKG')] INSERT INTO Faculty VALUES [(1082, 'Giuliano', 'Mark', 'Instructor', 'M', 2424, '224', 'NEB'), (1121, 'Goodrich', 'Michael', 'Professor', 'M', 3593, '219', 'NEB')]
activity_1
SELECT T1.lname FROM Faculty AS T1 JOIN Faculty_participates_in AS T2 ON T1.facID = T2.facID JOIN activity AS T3 ON T2.actid = T2.actid WHERE T3.activity_name = 'Canoeing' INTERSECT SELECT T1.lname FROM Faculty AS T1 JOIN Faculty_participates_in AS T2 ON T1.facID = T2.facID JOIN activity AS T3 ON T2.actid = T2.actid WHERE T3.activity_name = 'Kayaking'
Find the first names of the faculty members who participate in Canoeing and Kayaking.
create table Activity ( actid INTEGER PRIMARY KEY, activity_name varchar(25) ); create table Participates_in ( stuid INTEGER, actid INTEGER, FOREIGN KEY(stuid) REFERENCES Student(StuID), FOREIGN KEY(actid) REFERENCES Activity(actid) ); create table Faculty_Participates_in ( FacID INTEGER, actid INTEGER, FOREIGN KEY(FacID) REFERENCES Faculty(FacID), FOREIGN KEY(actid) REFERENCES Activity(actid) ); create table Student ( StuID INTEGER PRIMARY KEY, LName VARCHAR(12), Fname VARCHAR(12), Age INTEGER, Sex VARCHAR(1), Major INTEGER, Advisor INTEGER, city_code VARCHAR(3) ); create table Faculty ( FacID INTEGER PRIMARY KEY, Lname VARCHAR(15), Fname VARCHAR(15), Rank VARCHAR(15), Sex VARCHAR(1), Phone INTEGER, Room VARCHAR(5), Building VARCHAR(13) ); insert into Faculty values ( 1082, 'Giuliano', 'Mark', 'Instructor', 'M', 2424, '224', 'NEB'); insert into Student values ( 1001, 'Smith', 'Linda', 18, 'F', 600, 1121,'BAL'); insert into Activity values ( 770 , 'Mountain Climbing' ) ; insert into Participates_in values (1001 , 770) ; insert into Faculty_Participates_in values ( 1082, 784) ; INSERT INTO Activity VALUES [(770, 'Mountain Climbing'), (771, 'Canoeing')] INSERT INTO Participates_in VALUES [(1001, 770), (1001, 771)] INSERT INTO Faculty_Participates_in VALUES [(1082, 784), (1082, 785)] INSERT INTO Student VALUES [(1001, 'Smith', 'Linda', 18, 'F', 600, 1121, 'BAL'), (1002, 'Kim', 'Tracy', 19, 'F', 600, 7712, 'HKG')] INSERT INTO Faculty VALUES [(1082, 'Giuliano', 'Mark', 'Instructor', 'M', 2424, '224', 'NEB'), (1121, 'Goodrich', 'Michael', 'Professor', 'M', 3593, '219', 'NEB')]
activity_1
SELECT T1.lname FROM Faculty AS T1 JOIN Faculty_participates_in AS T2 ON T1.facID = T2.facID JOIN activity AS T3 ON T2.actid = T2.actid WHERE T3.activity_name = 'Canoeing' INTERSECT SELECT T1.lname FROM Faculty AS T1 JOIN Faculty_participates_in AS T2 ON T1.facID = T2.facID JOIN activity AS T3 ON T2.actid = T2.actid WHERE T3.activity_name = 'Kayaking'
What are the first names of the faculty members playing both Canoeing and Kayaking?
create table Activity ( actid INTEGER PRIMARY KEY, activity_name varchar(25) ); create table Participates_in ( stuid INTEGER, actid INTEGER, FOREIGN KEY(stuid) REFERENCES Student(StuID), FOREIGN KEY(actid) REFERENCES Activity(actid) ); create table Faculty_Participates_in ( FacID INTEGER, actid INTEGER, FOREIGN KEY(FacID) REFERENCES Faculty(FacID), FOREIGN KEY(actid) REFERENCES Activity(actid) ); create table Student ( StuID INTEGER PRIMARY KEY, LName VARCHAR(12), Fname VARCHAR(12), Age INTEGER, Sex VARCHAR(1), Major INTEGER, Advisor INTEGER, city_code VARCHAR(3) ); create table Faculty ( FacID INTEGER PRIMARY KEY, Lname VARCHAR(15), Fname VARCHAR(15), Rank VARCHAR(15), Sex VARCHAR(1), Phone INTEGER, Room VARCHAR(5), Building VARCHAR(13) ); insert into Faculty values ( 1082, 'Giuliano', 'Mark', 'Instructor', 'M', 2424, '224', 'NEB'); insert into Student values ( 1001, 'Smith', 'Linda', 18, 'F', 600, 1121,'BAL'); insert into Activity values ( 770 , 'Mountain Climbing' ) ; insert into Participates_in values (1001 , 770) ; insert into Faculty_Participates_in values ( 1082, 784) ; INSERT INTO Activity VALUES [(770, 'Mountain Climbing'), (771, 'Canoeing')] INSERT INTO Participates_in VALUES [(1001, 770), (1001, 771)] INSERT INTO Faculty_Participates_in VALUES [(1082, 784), (1082, 785)] INSERT INTO Student VALUES [(1001, 'Smith', 'Linda', 18, 'F', 600, 1121, 'BAL'), (1002, 'Kim', 'Tracy', 19, 'F', 600, 7712, 'HKG')] INSERT INTO Faculty VALUES [(1082, 'Giuliano', 'Mark', 'Instructor', 'M', 2424, '224', 'NEB'), (1121, 'Goodrich', 'Michael', 'Professor', 'M', 3593, '219', 'NEB')]
activity_1
SELECT T1.stuid FROM participates_in AS T1 JOIN activity AS T2 ON T2.actid = T2.actid WHERE T2.activity_name = 'Canoeing' INTERSECT SELECT T1.stuid FROM participates_in AS T1 JOIN activity AS T2 ON T2.actid = T2.actid WHERE T2.activity_name = 'Kayaking'
Find the ids of the students who participate in Canoeing and Kayaking.
create table Activity ( actid INTEGER PRIMARY KEY, activity_name varchar(25) ); create table Participates_in ( stuid INTEGER, actid INTEGER, FOREIGN KEY(stuid) REFERENCES Student(StuID), FOREIGN KEY(actid) REFERENCES Activity(actid) ); create table Faculty_Participates_in ( FacID INTEGER, actid INTEGER, FOREIGN KEY(FacID) REFERENCES Faculty(FacID), FOREIGN KEY(actid) REFERENCES Activity(actid) ); create table Student ( StuID INTEGER PRIMARY KEY, LName VARCHAR(12), Fname VARCHAR(12), Age INTEGER, Sex VARCHAR(1), Major INTEGER, Advisor INTEGER, city_code VARCHAR(3) ); create table Faculty ( FacID INTEGER PRIMARY KEY, Lname VARCHAR(15), Fname VARCHAR(15), Rank VARCHAR(15), Sex VARCHAR(1), Phone INTEGER, Room VARCHAR(5), Building VARCHAR(13) ); insert into Faculty values ( 1082, 'Giuliano', 'Mark', 'Instructor', 'M', 2424, '224', 'NEB'); insert into Student values ( 1001, 'Smith', 'Linda', 18, 'F', 600, 1121,'BAL'); insert into Activity values ( 770 , 'Mountain Climbing' ) ; insert into Participates_in values (1001 , 770) ; insert into Faculty_Participates_in values ( 1082, 784) ; INSERT INTO Activity VALUES [(770, 'Mountain Climbing'), (771, 'Canoeing')] INSERT INTO Participates_in VALUES [(1001, 770), (1001, 771)] INSERT INTO Faculty_Participates_in VALUES [(1082, 784), (1082, 785)] INSERT INTO Student VALUES [(1001, 'Smith', 'Linda', 18, 'F', 600, 1121, 'BAL'), (1002, 'Kim', 'Tracy', 19, 'F', 600, 7712, 'HKG')] INSERT INTO Faculty VALUES [(1082, 'Giuliano', 'Mark', 'Instructor', 'M', 2424, '224', 'NEB'), (1121, 'Goodrich', 'Michael', 'Professor', 'M', 3593, '219', 'NEB')]