SQL
stringlengths 18
577
| question
stringlengths 317
11.5k
|
---|---|
SELECT T1.firstname , T1.lastname FROM Reservations AS T1 JOIN Rooms AS T2 ON T1.Room = T2.RoomId WHERE T1.Rate - T2.basePrice > 0
|
Given the Table rooms having columns as RoomId has datatype text, roomName has datatype text, beds has datatype number, bedType has datatype text, maxOccupancy has datatype number, basePrice has datatype number, decor has datatype text which has RoomId and Given the Table reservations having columns as Code has datatype number, Room has datatype text, CheckIn has datatype text, CheckOut has datatype text, Rate has datatype number, LastName has datatype text, FirstName has datatype text, Adults has datatype number, Kids has datatype number which has Code. Answer the question by writing the appropriate SQL code. What are the first and last names of people who payed more than the rooms' base prices?
|
SELECT count(*) FROM Rooms;
|
Given the Table rooms having columns as RoomId has datatype text, roomName has datatype text, beds has datatype number, bedType has datatype text, maxOccupancy has datatype number, basePrice has datatype number, decor has datatype text which has RoomId and Given the Table reservations having columns as Code has datatype number, Room has datatype text, CheckIn has datatype text, CheckOut has datatype text, Rate has datatype number, LastName has datatype text, FirstName has datatype text, Adults has datatype number, Kids has datatype number which has Code. Answer the question by writing the appropriate SQL code. How many rooms are there?
|
SELECT count(*) FROM Rooms;
|
Given the Table rooms having columns as RoomId has datatype text, roomName has datatype text, beds has datatype number, bedType has datatype text, maxOccupancy has datatype number, basePrice has datatype number, decor has datatype text which has RoomId and Given the Table reservations having columns as Code has datatype number, Room has datatype text, CheckIn has datatype text, CheckOut has datatype text, Rate has datatype number, LastName has datatype text, FirstName has datatype text, Adults has datatype number, Kids has datatype number which has Code. Answer the question by writing the appropriate SQL code. What is the total number of rooms available in this inn?
|
SELECT count(*) FROM Rooms WHERE bedType = "King";
|
Given the Table rooms having columns as RoomId has datatype text, roomName has datatype text, beds has datatype number, bedType has datatype text, maxOccupancy has datatype number, basePrice has datatype number, decor has datatype text which has RoomId and Given the Table reservations having columns as Code has datatype number, Room has datatype text, CheckIn has datatype text, CheckOut has datatype text, Rate has datatype number, LastName has datatype text, FirstName has datatype text, Adults has datatype number, Kids has datatype number which has Code. Answer the question by writing the appropriate SQL code. Find the number of rooms with a king bed.
|
SELECT count(*) FROM Rooms WHERE bedType = "King";
|
Given the Table rooms having columns as RoomId has datatype text, roomName has datatype text, beds has datatype number, bedType has datatype text, maxOccupancy has datatype number, basePrice has datatype number, decor has datatype text which has RoomId and Given the Table reservations having columns as Code has datatype number, Room has datatype text, CheckIn has datatype text, CheckOut has datatype text, Rate has datatype number, LastName has datatype text, FirstName has datatype text, Adults has datatype number, Kids has datatype number which has Code. Answer the question by writing the appropriate SQL code. How many rooms have a king bed?
|
SELECT bedType , count(*) FROM Rooms GROUP BY bedType;
|
Given the Table rooms having columns as RoomId has datatype text, roomName has datatype text, beds has datatype number, bedType has datatype text, maxOccupancy has datatype number, basePrice has datatype number, decor has datatype text which has RoomId and Given the Table reservations having columns as Code has datatype number, Room has datatype text, CheckIn has datatype text, CheckOut has datatype text, Rate has datatype number, LastName has datatype text, FirstName has datatype text, Adults has datatype number, Kids has datatype number which has Code. Answer the question by writing the appropriate SQL code. Find the number of rooms for each bed type.
|
SELECT bedType , count(*) FROM Rooms GROUP BY bedType;
|
Given the Table rooms having columns as RoomId has datatype text, roomName has datatype text, beds has datatype number, bedType has datatype text, maxOccupancy has datatype number, basePrice has datatype number, decor has datatype text which has RoomId and Given the Table reservations having columns as Code has datatype number, Room has datatype text, CheckIn has datatype text, CheckOut has datatype text, Rate has datatype number, LastName has datatype text, FirstName has datatype text, Adults has datatype number, Kids has datatype number which has Code. Answer the question by writing the appropriate SQL code. What are the number of rooms for each bed type?
|
SELECT roomName FROM Rooms ORDER BY maxOccupancy DESC LIMIT 1;
|
Given the Table rooms having columns as RoomId has datatype text, roomName has datatype text, beds has datatype number, bedType has datatype text, maxOccupancy has datatype number, basePrice has datatype number, decor has datatype text which has RoomId and Given the Table reservations having columns as Code has datatype number, Room has datatype text, CheckIn has datatype text, CheckOut has datatype text, Rate has datatype number, LastName has datatype text, FirstName has datatype text, Adults has datatype number, Kids has datatype number which has Code. Answer the question by writing the appropriate SQL code. Find the name of the room with the maximum occupancy.
|
SELECT roomName FROM Rooms ORDER BY maxOccupancy DESC LIMIT 1;
|
Given the Table rooms having columns as RoomId has datatype text, roomName has datatype text, beds has datatype number, bedType has datatype text, maxOccupancy has datatype number, basePrice has datatype number, decor has datatype text which has RoomId and Given the Table reservations having columns as Code has datatype number, Room has datatype text, CheckIn has datatype text, CheckOut has datatype text, Rate has datatype number, LastName has datatype text, FirstName has datatype text, Adults has datatype number, Kids has datatype number which has Code. Answer the question by writing the appropriate SQL code. What is the name of the room that can accommodate the most people?
|
SELECT RoomId , roomName FROM Rooms ORDER BY basePrice DESC LIMIT 1;
|
Given the Table rooms having columns as RoomId has datatype text, roomName has datatype text, beds has datatype number, bedType has datatype text, maxOccupancy has datatype number, basePrice has datatype number, decor has datatype text which has RoomId and Given the Table reservations having columns as Code has datatype number, Room has datatype text, CheckIn has datatype text, CheckOut has datatype text, Rate has datatype number, LastName has datatype text, FirstName has datatype text, Adults has datatype number, Kids has datatype number which has Code. Answer the question by writing the appropriate SQL code. Find the id and name of the most expensive base price room.
|
SELECT RoomId , roomName FROM Rooms ORDER BY basePrice DESC LIMIT 1;
|
Given the Table rooms having columns as RoomId has datatype text, roomName has datatype text, beds has datatype number, bedType has datatype text, maxOccupancy has datatype number, basePrice has datatype number, decor has datatype text which has RoomId and Given the Table reservations having columns as Code has datatype number, Room has datatype text, CheckIn has datatype text, CheckOut has datatype text, Rate has datatype number, LastName has datatype text, FirstName has datatype text, Adults has datatype number, Kids has datatype number which has Code. Answer the question by writing the appropriate SQL code. Which room has the highest base price?
|
SELECT roomName , bedType FROM Rooms WHERE decor = "traditional";
|
Given the Table rooms having columns as RoomId has datatype text, roomName has datatype text, beds has datatype number, bedType has datatype text, maxOccupancy has datatype number, basePrice has datatype number, decor has datatype text which has RoomId and Given the Table reservations having columns as Code has datatype number, Room has datatype text, CheckIn has datatype text, CheckOut has datatype text, Rate has datatype number, LastName has datatype text, FirstName has datatype text, Adults has datatype number, Kids has datatype number which has Code. Answer the question by writing the appropriate SQL code. List the type of bed and name of all traditional rooms.
|
SELECT roomName , bedType FROM Rooms WHERE decor = "traditional";
|
Given the Table rooms having columns as RoomId has datatype text, roomName has datatype text, beds has datatype number, bedType has datatype text, maxOccupancy has datatype number, basePrice has datatype number, decor has datatype text which has RoomId and Given the Table reservations having columns as Code has datatype number, Room has datatype text, CheckIn has datatype text, CheckOut has datatype text, Rate has datatype number, LastName has datatype text, FirstName has datatype text, Adults has datatype number, Kids has datatype number which has Code. Answer the question by writing the appropriate SQL code. What are the bed type and name of all the rooms with traditional decor?
|
SELECT decor , count(*) FROM Rooms WHERE bedType = "King" GROUP BY decor;
|
Given the Table rooms having columns as RoomId has datatype text, roomName has datatype text, beds has datatype number, bedType has datatype text, maxOccupancy has datatype number, basePrice has datatype number, decor has datatype text which has RoomId and Given the Table reservations having columns as Code has datatype number, Room has datatype text, CheckIn has datatype text, CheckOut has datatype text, Rate has datatype number, LastName has datatype text, FirstName has datatype text, Adults has datatype number, Kids has datatype number which has Code. Answer the question by writing the appropriate SQL code. Find the number of rooms with king bed for each decor type.
|
SELECT decor , count(*) FROM Rooms WHERE bedType = "King" GROUP BY decor;
|
Given the Table rooms having columns as RoomId has datatype text, roomName has datatype text, beds has datatype number, bedType has datatype text, maxOccupancy has datatype number, basePrice has datatype number, decor has datatype text which has RoomId and Given the Table reservations having columns as Code has datatype number, Room has datatype text, CheckIn has datatype text, CheckOut has datatype text, Rate has datatype number, LastName has datatype text, FirstName has datatype text, Adults has datatype number, Kids has datatype number which has Code. Answer the question by writing the appropriate SQL code. How many rooms have king beds? Report the number for each decor type.
|
SELECT decor , avg(basePrice) , min(basePrice) FROM Rooms GROUP BY decor;
|
Given the Table rooms having columns as RoomId has datatype text, roomName has datatype text, beds has datatype number, bedType has datatype text, maxOccupancy has datatype number, basePrice has datatype number, decor has datatype text which has RoomId and Given the Table reservations having columns as Code has datatype number, Room has datatype text, CheckIn has datatype text, CheckOut has datatype text, Rate has datatype number, LastName has datatype text, FirstName has datatype text, Adults has datatype number, Kids has datatype number which has Code. Answer the question by writing the appropriate SQL code. Find the average and minimum price of the rooms in different decor.
|
SELECT decor , avg(basePrice) , min(basePrice) FROM Rooms GROUP BY decor;
|
Given the Table rooms having columns as RoomId has datatype text, roomName has datatype text, beds has datatype number, bedType has datatype text, maxOccupancy has datatype number, basePrice has datatype number, decor has datatype text which has RoomId and Given the Table reservations having columns as Code has datatype number, Room has datatype text, CheckIn has datatype text, CheckOut has datatype text, Rate has datatype number, LastName has datatype text, FirstName has datatype text, Adults has datatype number, Kids has datatype number which has Code. Answer the question by writing the appropriate SQL code. What is the average minimum and price of the rooms for each different decor.
|
SELECT roomName FROM Rooms ORDER BY basePrice;
|
Given the Table rooms having columns as RoomId has datatype text, roomName has datatype text, beds has datatype number, bedType has datatype text, maxOccupancy has datatype number, basePrice has datatype number, decor has datatype text which has RoomId and Given the Table reservations having columns as Code has datatype number, Room has datatype text, CheckIn has datatype text, CheckOut has datatype text, Rate has datatype number, LastName has datatype text, FirstName has datatype text, Adults has datatype number, Kids has datatype number which has Code. Answer the question by writing the appropriate SQL code. List the name of all rooms sorted by their prices.
|
SELECT roomName FROM Rooms ORDER BY basePrice;
|
Given the Table rooms having columns as RoomId has datatype text, roomName has datatype text, beds has datatype number, bedType has datatype text, maxOccupancy has datatype number, basePrice has datatype number, decor has datatype text which has RoomId and Given the Table reservations having columns as Code has datatype number, Room has datatype text, CheckIn has datatype text, CheckOut has datatype text, Rate has datatype number, LastName has datatype text, FirstName has datatype text, Adults has datatype number, Kids has datatype number which has Code. Answer the question by writing the appropriate SQL code. Sort all the rooms according to the price. Just report the room names.
|
SELECT decor , count(*) FROM Rooms WHERE basePrice > 120 GROUP BY decor;
|
Given the Table rooms having columns as RoomId has datatype text, roomName has datatype text, beds has datatype number, bedType has datatype text, maxOccupancy has datatype number, basePrice has datatype number, decor has datatype text which has RoomId and Given the Table reservations having columns as Code has datatype number, Room has datatype text, CheckIn has datatype text, CheckOut has datatype text, Rate has datatype number, LastName has datatype text, FirstName has datatype text, Adults has datatype number, Kids has datatype number which has Code. Answer the question by writing the appropriate SQL code. Find the number of rooms with price higher than 120 for different decor.
|
SELECT decor , count(*) FROM Rooms WHERE basePrice > 120 GROUP BY decor;
|
Given the Table rooms having columns as RoomId has datatype text, roomName has datatype text, beds has datatype number, bedType has datatype text, maxOccupancy has datatype number, basePrice has datatype number, decor has datatype text which has RoomId and Given the Table reservations having columns as Code has datatype number, Room has datatype text, CheckIn has datatype text, CheckOut has datatype text, Rate has datatype number, LastName has datatype text, FirstName has datatype text, Adults has datatype number, Kids has datatype number which has Code. Answer the question by writing the appropriate SQL code. How many rooms cost more than 120, for each different decor?
|
SELECT bedType , avg(basePrice) FROM Rooms GROUP BY bedType;
|
Given the Table rooms having columns as RoomId has datatype text, roomName has datatype text, beds has datatype number, bedType has datatype text, maxOccupancy has datatype number, basePrice has datatype number, decor has datatype text which has RoomId and Given the Table reservations having columns as Code has datatype number, Room has datatype text, CheckIn has datatype text, CheckOut has datatype text, Rate has datatype number, LastName has datatype text, FirstName has datatype text, Adults has datatype number, Kids has datatype number which has Code. Answer the question by writing the appropriate SQL code. For each bed type, find the average room price.
|
SELECT bedType , avg(basePrice) FROM Rooms GROUP BY bedType;
|
Given the Table rooms having columns as RoomId has datatype text, roomName has datatype text, beds has datatype number, bedType has datatype text, maxOccupancy has datatype number, basePrice has datatype number, decor has datatype text which has RoomId and Given the Table reservations having columns as Code has datatype number, Room has datatype text, CheckIn has datatype text, CheckOut has datatype text, Rate has datatype number, LastName has datatype text, FirstName has datatype text, Adults has datatype number, Kids has datatype number which has Code. Answer the question by writing the appropriate SQL code. What is the average base price of rooms, for each bed type?
|
SELECT roomName FROM Rooms WHERE bedType = "King" OR bedType = "Queen";
|
Given the Table rooms having columns as RoomId has datatype text, roomName has datatype text, beds has datatype number, bedType has datatype text, maxOccupancy has datatype number, basePrice has datatype number, decor has datatype text which has RoomId and Given the Table reservations having columns as Code has datatype number, Room has datatype text, CheckIn has datatype text, CheckOut has datatype text, Rate has datatype number, LastName has datatype text, FirstName has datatype text, Adults has datatype number, Kids has datatype number which has Code. Answer the question by writing the appropriate SQL code. List the name of rooms with king or queen bed.
|
SELECT roomName FROM Rooms WHERE bedType = "King" OR bedType = "Queen";
|
Given the Table rooms having columns as RoomId has datatype text, roomName has datatype text, beds has datatype number, bedType has datatype text, maxOccupancy has datatype number, basePrice has datatype number, decor has datatype text which has RoomId and Given the Table reservations having columns as Code has datatype number, Room has datatype text, CheckIn has datatype text, CheckOut has datatype text, Rate has datatype number, LastName has datatype text, FirstName has datatype text, Adults has datatype number, Kids has datatype number which has Code. Answer the question by writing the appropriate SQL code. What are the names of rooms that have either king or queen bed?
|
SELECT count(DISTINCT bedType) FROM Rooms;
|
Given the Table rooms having columns as RoomId has datatype text, roomName has datatype text, beds has datatype number, bedType has datatype text, maxOccupancy has datatype number, basePrice has datatype number, decor has datatype text which has RoomId and Given the Table reservations having columns as Code has datatype number, Room has datatype text, CheckIn has datatype text, CheckOut has datatype text, Rate has datatype number, LastName has datatype text, FirstName has datatype text, Adults has datatype number, Kids has datatype number which has Code. Answer the question by writing the appropriate SQL code. How many different types of beds are there?
|
SELECT count(DISTINCT bedType) FROM Rooms;
|
Given the Table rooms having columns as RoomId has datatype text, roomName has datatype text, beds has datatype number, bedType has datatype text, maxOccupancy has datatype number, basePrice has datatype number, decor has datatype text which has RoomId and Given the Table reservations having columns as Code has datatype number, Room has datatype text, CheckIn has datatype text, CheckOut has datatype text, Rate has datatype number, LastName has datatype text, FirstName has datatype text, Adults has datatype number, Kids has datatype number which has Code. Answer the question by writing the appropriate SQL code. Find the number of distinct bed types available in this inn.
|
SELECT RoomId , roomName FROM Rooms ORDER BY basePrice DESC LIMIT 3;
|
Given the Table rooms having columns as RoomId has datatype text, roomName has datatype text, beds has datatype number, bedType has datatype text, maxOccupancy has datatype number, basePrice has datatype number, decor has datatype text which has RoomId and Given the Table reservations having columns as Code has datatype number, Room has datatype text, CheckIn has datatype text, CheckOut has datatype text, Rate has datatype number, LastName has datatype text, FirstName has datatype text, Adults has datatype number, Kids has datatype number which has Code. Answer the question by writing the appropriate SQL code. Find the name and id of the top 3 expensive rooms.
|
SELECT RoomId , roomName FROM Rooms ORDER BY basePrice DESC LIMIT 3;
|
Given the Table rooms having columns as RoomId has datatype text, roomName has datatype text, beds has datatype number, bedType has datatype text, maxOccupancy has datatype number, basePrice has datatype number, decor has datatype text which has RoomId and Given the Table reservations having columns as Code has datatype number, Room has datatype text, CheckIn has datatype text, CheckOut has datatype text, Rate has datatype number, LastName has datatype text, FirstName has datatype text, Adults has datatype number, Kids has datatype number which has Code. Answer the question by writing the appropriate SQL code. What are the name and id of the three highest priced rooms?
|
SELECT roomName FROM Rooms WHERE basePrice > ( SELECT avg(basePrice) FROM Rooms );
|
Given the Table rooms having columns as RoomId has datatype text, roomName has datatype text, beds has datatype number, bedType has datatype text, maxOccupancy has datatype number, basePrice has datatype number, decor has datatype text which has RoomId and Given the Table reservations having columns as Code has datatype number, Room has datatype text, CheckIn has datatype text, CheckOut has datatype text, Rate has datatype number, LastName has datatype text, FirstName has datatype text, Adults has datatype number, Kids has datatype number which has Code. Answer the question by writing the appropriate SQL code. Find the name of rooms whose price is higher than the average price.
|
SELECT roomName FROM Rooms WHERE basePrice > ( SELECT avg(basePrice) FROM Rooms );
|
Given the Table rooms having columns as RoomId has datatype text, roomName has datatype text, beds has datatype number, bedType has datatype text, maxOccupancy has datatype number, basePrice has datatype number, decor has datatype text which has RoomId and Given the Table reservations having columns as Code has datatype number, Room has datatype text, CheckIn has datatype text, CheckOut has datatype text, Rate has datatype number, LastName has datatype text, FirstName has datatype text, Adults has datatype number, Kids has datatype number which has Code. Answer the question by writing the appropriate SQL code. What are the name of rooms that cost more than the average.
|
SELECT count(*) FROM rooms WHERE roomid NOT IN (SELECT DISTINCT room FROM reservations)
|
Given the Table rooms having columns as RoomId has datatype text, roomName has datatype text, beds has datatype number, bedType has datatype text, maxOccupancy has datatype number, basePrice has datatype number, decor has datatype text which has RoomId and Given the Table reservations having columns as Code has datatype number, Room has datatype text, CheckIn has datatype text, CheckOut has datatype text, Rate has datatype number, LastName has datatype text, FirstName has datatype text, Adults has datatype number, Kids has datatype number which has Code. Answer the question by writing the appropriate SQL code. Find the number of rooms that do not have any reservation.
|
SELECT count(*) FROM rooms WHERE roomid NOT IN (SELECT DISTINCT room FROM reservations)
|
Given the Table rooms having columns as RoomId has datatype text, roomName has datatype text, beds has datatype number, bedType has datatype text, maxOccupancy has datatype number, basePrice has datatype number, decor has datatype text which has RoomId and Given the Table reservations having columns as Code has datatype number, Room has datatype text, CheckIn has datatype text, CheckOut has datatype text, Rate has datatype number, LastName has datatype text, FirstName has datatype text, Adults has datatype number, Kids has datatype number which has Code. Answer the question by writing the appropriate SQL code. How many rooms have not had any reservation yet?
|
SELECT T2.roomName , count(*) , T1.Room FROM Reservations AS T1 JOIN Rooms AS T2 ON T1.Room = T2.RoomId GROUP BY T1.Room
|
Given the Table rooms having columns as RoomId has datatype text, roomName has datatype text, beds has datatype number, bedType has datatype text, maxOccupancy has datatype number, basePrice has datatype number, decor has datatype text which has RoomId and Given the Table reservations having columns as Code has datatype number, Room has datatype text, CheckIn has datatype text, CheckOut has datatype text, Rate has datatype number, LastName has datatype text, FirstName has datatype text, Adults has datatype number, Kids has datatype number which has Code. Answer the question by writing the appropriate SQL code. Return the name and number of reservations made for each of the rooms.
|
SELECT T2.roomName , count(*) , T1.Room FROM Reservations AS T1 JOIN Rooms AS T2 ON T1.Room = T2.RoomId GROUP BY T1.Room
|
Given the Table rooms having columns as RoomId has datatype text, roomName has datatype text, beds has datatype number, bedType has datatype text, maxOccupancy has datatype number, basePrice has datatype number, decor has datatype text which has RoomId and Given the Table reservations having columns as Code has datatype number, Room has datatype text, CheckIn has datatype text, CheckOut has datatype text, Rate has datatype number, LastName has datatype text, FirstName has datatype text, Adults has datatype number, Kids has datatype number which has Code. Answer the question by writing the appropriate SQL code. For each room, find its name and the number of times reservations were made for it.
|
SELECT T2.roomName FROM Reservations AS T1 JOIN Rooms AS T2 ON T1.Room = T2.RoomId GROUP BY T1.Room HAVING count(*) > 60
|
Given the Table rooms having columns as RoomId has datatype text, roomName has datatype text, beds has datatype number, bedType has datatype text, maxOccupancy has datatype number, basePrice has datatype number, decor has datatype text which has RoomId and Given the Table reservations having columns as Code has datatype number, Room has datatype text, CheckIn has datatype text, CheckOut has datatype text, Rate has datatype number, LastName has datatype text, FirstName has datatype text, Adults has datatype number, Kids has datatype number which has Code. Answer the question by writing the appropriate SQL code. Find the names of rooms that have been reserved for more than 60 times.
|
SELECT T2.roomName FROM Reservations AS T1 JOIN Rooms AS T2 ON T1.Room = T2.RoomId GROUP BY T1.Room HAVING count(*) > 60
|
Given the Table rooms having columns as RoomId has datatype text, roomName has datatype text, beds has datatype number, bedType has datatype text, maxOccupancy has datatype number, basePrice has datatype number, decor has datatype text which has RoomId and Given the Table reservations having columns as Code has datatype number, Room has datatype text, CheckIn has datatype text, CheckOut has datatype text, Rate has datatype number, LastName has datatype text, FirstName has datatype text, Adults has datatype number, Kids has datatype number which has Code. Answer the question by writing the appropriate SQL code. What are the names of rooms whose reservation frequency exceeds 60 times?
|
SELECT roomname FROM rooms WHERE baseprice BETWEEN 120 AND 150
|
Given the Table rooms having columns as RoomId has datatype text, roomName has datatype text, beds has datatype number, bedType has datatype text, maxOccupancy has datatype number, basePrice has datatype number, decor has datatype text which has RoomId and Given the Table reservations having columns as Code has datatype number, Room has datatype text, CheckIn has datatype text, CheckOut has datatype text, Rate has datatype number, LastName has datatype text, FirstName has datatype text, Adults has datatype number, Kids has datatype number which has Code. Answer the question by writing the appropriate SQL code. Find the name of rooms whose base price is between 120 and 150.
|
SELECT roomname FROM rooms WHERE baseprice BETWEEN 120 AND 150
|
Given the Table rooms having columns as RoomId has datatype text, roomName has datatype text, beds has datatype number, bedType has datatype text, maxOccupancy has datatype number, basePrice has datatype number, decor has datatype text which has RoomId and Given the Table reservations having columns as Code has datatype number, Room has datatype text, CheckIn has datatype text, CheckOut has datatype text, Rate has datatype number, LastName has datatype text, FirstName has datatype text, Adults has datatype number, Kids has datatype number which has Code. Answer the question by writing the appropriate SQL code. Which rooms cost between 120 and 150? Give me the room names.
|
SELECT T2.roomName FROM Reservations AS T1 JOIN Rooms AS T2 ON T1.Room = T2.RoomId WHERE firstname LIKE '%ROY%'
|
Given the Table rooms having columns as RoomId has datatype text, roomName has datatype text, beds has datatype number, bedType has datatype text, maxOccupancy has datatype number, basePrice has datatype number, decor has datatype text which has RoomId and Given the Table reservations having columns as Code has datatype number, Room has datatype text, CheckIn has datatype text, CheckOut has datatype text, Rate has datatype number, LastName has datatype text, FirstName has datatype text, Adults has datatype number, Kids has datatype number which has Code. Answer the question by writing the appropriate SQL code. Find the name of rooms booked by some customers whose first name contains ROY.
|
SELECT T2.roomName FROM Reservations AS T1 JOIN Rooms AS T2 ON T1.Room = T2.RoomId WHERE firstname LIKE '%ROY%'
|
Given the Table rooms having columns as RoomId has datatype text, roomName has datatype text, beds has datatype number, bedType has datatype text, maxOccupancy has datatype number, basePrice has datatype number, decor has datatype text which has RoomId and Given the Table reservations having columns as Code has datatype number, Room has datatype text, CheckIn has datatype text, CheckOut has datatype text, Rate has datatype number, LastName has datatype text, FirstName has datatype text, Adults has datatype number, Kids has datatype number which has Code. Answer the question by writing the appropriate SQL code. What are the name of rooms booked by customers whose first name has "ROY" in part?
|
SELECT T1.cmi_details FROM Customer_Master_Index AS T1 JOIN CMI_Cross_References AS T2 ON T1.master_customer_id = T2.master_customer_id WHERE T2.source_system_code = 'Tax'
|
Given the Table customer master index having columns as master_customer_id has datatype number, cmi_details has datatype text which has master_customer_id and Given the Table cmi cross references having columns as cmi_cross_ref_id has datatype number, master_customer_id has datatype number, source_system_code has datatype text which has cmi_cross_ref_id and Given the Table council tax having columns as council_tax_id has datatype number, cmi_cross_ref_id has datatype number which has council_tax_id and Given the Table business rates having columns as business_rates_id has datatype number, cmi_cross_ref_id has datatype number which has business_rates_id and Given the Table benefits overpayments having columns as council_tax_id has datatype number, cmi_cross_ref_id has datatype number which has council_tax_id and Given the Table parking fines having columns as council_tax_id has datatype number, cmi_cross_ref_id has datatype number which has council_tax_id and Given the Table rent arrears having columns as council_tax_id has datatype number, cmi_cross_ref_id has datatype number which has council_tax_id and Given the Table electoral register having columns as electoral_register_id has datatype number, cmi_cross_ref_id has datatype number which has electoral_register_id. Answer the question by writing the appropriate SQL code. what are the details of the cmi masters that have the cross reference code 'Tax'?
|
SELECT T1.cmi_cross_ref_id , T1.source_system_code FROM CMI_Cross_References AS T1 JOIN Council_Tax AS T2 ON T1.cmi_cross_ref_id = T2.cmi_cross_ref_id GROUP BY T1.cmi_cross_ref_id HAVING count(*) >= 1
|
Given the Table customer master index having columns as master_customer_id has datatype number, cmi_details has datatype text which has master_customer_id and Given the Table cmi cross references having columns as cmi_cross_ref_id has datatype number, master_customer_id has datatype number, source_system_code has datatype text which has cmi_cross_ref_id and Given the Table council tax having columns as council_tax_id has datatype number, cmi_cross_ref_id has datatype number which has council_tax_id and Given the Table business rates having columns as business_rates_id has datatype number, cmi_cross_ref_id has datatype number which has business_rates_id and Given the Table benefits overpayments having columns as council_tax_id has datatype number, cmi_cross_ref_id has datatype number which has council_tax_id and Given the Table parking fines having columns as council_tax_id has datatype number, cmi_cross_ref_id has datatype number which has council_tax_id and Given the Table rent arrears having columns as council_tax_id has datatype number, cmi_cross_ref_id has datatype number which has council_tax_id and Given the Table electoral register having columns as electoral_register_id has datatype number, cmi_cross_ref_id has datatype number which has electoral_register_id. Answer the question by writing the appropriate SQL code. What is the cmi cross reference id that is related to at least one council tax entry? List the cross reference id and source system code.
|
SELECT T2.cmi_cross_ref_id , T2.master_customer_id , count(*) FROM Business_Rates AS T1 JOIN CMI_Cross_References AS T2 ON T1.cmi_cross_ref_id = T2.cmi_cross_ref_id GROUP BY T2.cmi_cross_ref_id
|
Given the Table customer master index having columns as master_customer_id has datatype number, cmi_details has datatype text which has master_customer_id and Given the Table cmi cross references having columns as cmi_cross_ref_id has datatype number, master_customer_id has datatype number, source_system_code has datatype text which has cmi_cross_ref_id and Given the Table council tax having columns as council_tax_id has datatype number, cmi_cross_ref_id has datatype number which has council_tax_id and Given the Table business rates having columns as business_rates_id has datatype number, cmi_cross_ref_id has datatype number which has business_rates_id and Given the Table benefits overpayments having columns as council_tax_id has datatype number, cmi_cross_ref_id has datatype number which has council_tax_id and Given the Table parking fines having columns as council_tax_id has datatype number, cmi_cross_ref_id has datatype number which has council_tax_id and Given the Table rent arrears having columns as council_tax_id has datatype number, cmi_cross_ref_id has datatype number which has council_tax_id and Given the Table electoral register having columns as electoral_register_id has datatype number, cmi_cross_ref_id has datatype number which has electoral_register_id. Answer the question by writing the appropriate SQL code. How many business rates are related to each cmi cross reference? List cross reference id, master customer id and the n
|
SELECT T1.source_system_code , T2.council_tax_id FROM CMI_Cross_References AS T1 JOIN Benefits_Overpayments AS T2 ON T1.cmi_cross_ref_id = T2.cmi_cross_ref_id ORDER BY T2.council_tax_id
|
Given the Table customer master index having columns as master_customer_id has datatype number, cmi_details has datatype text which has master_customer_id and Given the Table cmi cross references having columns as cmi_cross_ref_id has datatype number, master_customer_id has datatype number, source_system_code has datatype text which has cmi_cross_ref_id and Given the Table council tax having columns as council_tax_id has datatype number, cmi_cross_ref_id has datatype number which has council_tax_id and Given the Table business rates having columns as business_rates_id has datatype number, cmi_cross_ref_id has datatype number which has business_rates_id and Given the Table benefits overpayments having columns as council_tax_id has datatype number, cmi_cross_ref_id has datatype number which has council_tax_id and Given the Table parking fines having columns as council_tax_id has datatype number, cmi_cross_ref_id has datatype number which has council_tax_id and Given the Table rent arrears having columns as council_tax_id has datatype number, cmi_cross_ref_id has datatype number which has council_tax_id and Given the Table electoral register having columns as electoral_register_id has datatype number, cmi_cross_ref_id has datatype number which has electoral_register_id. Answer the question by writing the appropriate SQL code. What is the tax source system code related to the benefits and overpayments? List the code and the benifit id, order by benifit id.
|
SELECT T1.source_system_code , T1.master_customer_id , T2.council_tax_id FROM CMI_Cross_References AS T1 JOIN Parking_Fines AS T2 ON T1.cmi_cross_ref_id = T2.cmi_cross_ref_id
|
Given the Table customer master index having columns as master_customer_id has datatype number, cmi_details has datatype text which has master_customer_id and Given the Table cmi cross references having columns as cmi_cross_ref_id has datatype number, master_customer_id has datatype number, source_system_code has datatype text which has cmi_cross_ref_id and Given the Table council tax having columns as council_tax_id has datatype number, cmi_cross_ref_id has datatype number which has council_tax_id and Given the Table business rates having columns as business_rates_id has datatype number, cmi_cross_ref_id has datatype number which has business_rates_id and Given the Table benefits overpayments having columns as council_tax_id has datatype number, cmi_cross_ref_id has datatype number which has council_tax_id and Given the Table parking fines having columns as council_tax_id has datatype number, cmi_cross_ref_id has datatype number which has council_tax_id and Given the Table rent arrears having columns as council_tax_id has datatype number, cmi_cross_ref_id has datatype number which has council_tax_id and Given the Table electoral register having columns as electoral_register_id has datatype number, cmi_cross_ref_id has datatype number which has electoral_register_id. Answer the question by writing the appropriate SQL code. Wat is the tax source system code and master customer id of the taxes related to each parking fine id?
|
SELECT T1.council_tax_id FROM Rent_Arrears AS T1 JOIN CMI_Cross_References AS T2 ON T1.cmi_cross_ref_id = T2.cmi_cross_ref_id JOIN Customer_Master_Index AS T3 ON T3.master_customer_id = T2.master_customer_id WHERE T3.cmi_details != 'Schmidt , Kertzmann and Lubowitz'
|
Given the Table customer master index having columns as master_customer_id has datatype number, cmi_details has datatype text which has master_customer_id and Given the Table cmi cross references having columns as cmi_cross_ref_id has datatype number, master_customer_id has datatype number, source_system_code has datatype text which has cmi_cross_ref_id and Given the Table council tax having columns as council_tax_id has datatype number, cmi_cross_ref_id has datatype number which has council_tax_id and Given the Table business rates having columns as business_rates_id has datatype number, cmi_cross_ref_id has datatype number which has business_rates_id and Given the Table benefits overpayments having columns as council_tax_id has datatype number, cmi_cross_ref_id has datatype number which has council_tax_id and Given the Table parking fines having columns as council_tax_id has datatype number, cmi_cross_ref_id has datatype number which has council_tax_id and Given the Table rent arrears having columns as council_tax_id has datatype number, cmi_cross_ref_id has datatype number which has council_tax_id and Given the Table electoral register having columns as electoral_register_id has datatype number, cmi_cross_ref_id has datatype number which has electoral_register_id. Answer the question by writing the appropriate SQL code. What are the renting arrears tax ids related to the customer master index whose detail is not 'Schmidt, Kertzmann and Lubowitz'?
|
SELECT T1.electoral_register_id FROM Electoral_Register AS T1 JOIN CMI_Cross_References AS T2 ON T1.cmi_cross_ref_id = T2.cmi_cross_ref_id WHERE T2.source_system_code = 'Electoral' OR T2.source_system_code = 'Tax'
|
Given the Table customer master index having columns as master_customer_id has datatype number, cmi_details has datatype text which has master_customer_id and Given the Table cmi cross references having columns as cmi_cross_ref_id has datatype number, master_customer_id has datatype number, source_system_code has datatype text which has cmi_cross_ref_id and Given the Table council tax having columns as council_tax_id has datatype number, cmi_cross_ref_id has datatype number which has council_tax_id and Given the Table business rates having columns as business_rates_id has datatype number, cmi_cross_ref_id has datatype number which has business_rates_id and Given the Table benefits overpayments having columns as council_tax_id has datatype number, cmi_cross_ref_id has datatype number which has council_tax_id and Given the Table parking fines having columns as council_tax_id has datatype number, cmi_cross_ref_id has datatype number which has council_tax_id and Given the Table rent arrears having columns as council_tax_id has datatype number, cmi_cross_ref_id has datatype number which has council_tax_id and Given the Table electoral register having columns as electoral_register_id has datatype number, cmi_cross_ref_id has datatype number which has electoral_register_id. Answer the question by writing the appropriate SQL code. What are the register ids of electoral registries that have the cross reference source system code 'Electoral' or 'Tax'?
|
SELECT count(DISTINCT source_system_code) FROM CMI_cross_references
|
Given the Table customer master index having columns as master_customer_id has datatype number, cmi_details has datatype text which has master_customer_id and Given the Table cmi cross references having columns as cmi_cross_ref_id has datatype number, master_customer_id has datatype number, source_system_code has datatype text which has cmi_cross_ref_id and Given the Table council tax having columns as council_tax_id has datatype number, cmi_cross_ref_id has datatype number which has council_tax_id and Given the Table business rates having columns as business_rates_id has datatype number, cmi_cross_ref_id has datatype number which has business_rates_id and Given the Table benefits overpayments having columns as council_tax_id has datatype number, cmi_cross_ref_id has datatype number which has council_tax_id and Given the Table parking fines having columns as council_tax_id has datatype number, cmi_cross_ref_id has datatype number which has council_tax_id and Given the Table rent arrears having columns as council_tax_id has datatype number, cmi_cross_ref_id has datatype number which has council_tax_id and Given the Table electoral register having columns as electoral_register_id has datatype number, cmi_cross_ref_id has datatype number which has electoral_register_id. Answer the question by writing the appropriate SQL code. How many different source system code for the cmi cross references are there?
|
SELECT * FROM customer_master_index ORDER BY cmi_details DESC
|
Given the Table customer master index having columns as master_customer_id has datatype number, cmi_details has datatype text which has master_customer_id and Given the Table cmi cross references having columns as cmi_cross_ref_id has datatype number, master_customer_id has datatype number, source_system_code has datatype text which has cmi_cross_ref_id and Given the Table council tax having columns as council_tax_id has datatype number, cmi_cross_ref_id has datatype number which has council_tax_id and Given the Table business rates having columns as business_rates_id has datatype number, cmi_cross_ref_id has datatype number which has business_rates_id and Given the Table benefits overpayments having columns as council_tax_id has datatype number, cmi_cross_ref_id has datatype number which has council_tax_id and Given the Table parking fines having columns as council_tax_id has datatype number, cmi_cross_ref_id has datatype number which has council_tax_id and Given the Table rent arrears having columns as council_tax_id has datatype number, cmi_cross_ref_id has datatype number which has council_tax_id and Given the Table electoral register having columns as electoral_register_id has datatype number, cmi_cross_ref_id has datatype number which has electoral_register_id. Answer the question by writing the appropriate SQL code. List all information about customer master index, and sort them by details in descending order.
|
SELECT council_tax_id , cmi_cross_ref_id FROM parking_fines
|
Given the Table customer master index having columns as master_customer_id has datatype number, cmi_details has datatype text which has master_customer_id and Given the Table cmi cross references having columns as cmi_cross_ref_id has datatype number, master_customer_id has datatype number, source_system_code has datatype text which has cmi_cross_ref_id and Given the Table council tax having columns as council_tax_id has datatype number, cmi_cross_ref_id has datatype number which has council_tax_id and Given the Table business rates having columns as business_rates_id has datatype number, cmi_cross_ref_id has datatype number which has business_rates_id and Given the Table benefits overpayments having columns as council_tax_id has datatype number, cmi_cross_ref_id has datatype number which has council_tax_id and Given the Table parking fines having columns as council_tax_id has datatype number, cmi_cross_ref_id has datatype number which has council_tax_id and Given the Table rent arrears having columns as council_tax_id has datatype number, cmi_cross_ref_id has datatype number which has council_tax_id and Given the Table electoral register having columns as electoral_register_id has datatype number, cmi_cross_ref_id has datatype number which has electoral_register_id. Answer the question by writing the appropriate SQL code. List the council tax ids and their related cmi cross references of all the parking fines.
|
SELECT count(*) FROM rent_arrears
|
Given the Table customer master index having columns as master_customer_id has datatype number, cmi_details has datatype text which has master_customer_id and Given the Table cmi cross references having columns as cmi_cross_ref_id has datatype number, master_customer_id has datatype number, source_system_code has datatype text which has cmi_cross_ref_id and Given the Table council tax having columns as council_tax_id has datatype number, cmi_cross_ref_id has datatype number which has council_tax_id and Given the Table business rates having columns as business_rates_id has datatype number, cmi_cross_ref_id has datatype number which has business_rates_id and Given the Table benefits overpayments having columns as council_tax_id has datatype number, cmi_cross_ref_id has datatype number which has council_tax_id and Given the Table parking fines having columns as council_tax_id has datatype number, cmi_cross_ref_id has datatype number which has council_tax_id and Given the Table rent arrears having columns as council_tax_id has datatype number, cmi_cross_ref_id has datatype number which has council_tax_id and Given the Table electoral register having columns as electoral_register_id has datatype number, cmi_cross_ref_id has datatype number which has electoral_register_id. Answer the question by writing the appropriate SQL code. How many council taxes are collected for renting arrears ?
|
SELECT DISTINCT T2.source_system_code FROM customer_master_index AS T1 JOIN cmi_cross_references AS T2 ON T1.master_customer_id = T2.master_customer_id WHERE T1.cmi_details = 'Gottlieb , Becker and Wyman'
|
Given the Table customer master index having columns as master_customer_id has datatype number, cmi_details has datatype text which has master_customer_id and Given the Table cmi cross references having columns as cmi_cross_ref_id has datatype number, master_customer_id has datatype number, source_system_code has datatype text which has cmi_cross_ref_id and Given the Table council tax having columns as council_tax_id has datatype number, cmi_cross_ref_id has datatype number which has council_tax_id and Given the Table business rates having columns as business_rates_id has datatype number, cmi_cross_ref_id has datatype number which has business_rates_id and Given the Table benefits overpayments having columns as council_tax_id has datatype number, cmi_cross_ref_id has datatype number which has council_tax_id and Given the Table parking fines having columns as council_tax_id has datatype number, cmi_cross_ref_id has datatype number which has council_tax_id and Given the Table rent arrears having columns as council_tax_id has datatype number, cmi_cross_ref_id has datatype number which has council_tax_id and Given the Table electoral register having columns as electoral_register_id has datatype number, cmi_cross_ref_id has datatype number which has electoral_register_id. Answer the question by writing the appropriate SQL code. What are the distinct cross reference source system codes which are related to the master customer details 'Gottlieb, Becker and Wyman'?
|
SELECT cmi_cross_ref_id FROM cmi_cross_references EXCEPT SELECT cmi_cross_ref_id FROM parking_fines
|
Given the Table customer master index having columns as master_customer_id has datatype number, cmi_details has datatype text which has master_customer_id and Given the Table cmi cross references having columns as cmi_cross_ref_id has datatype number, master_customer_id has datatype number, source_system_code has datatype text which has cmi_cross_ref_id and Given the Table council tax having columns as council_tax_id has datatype number, cmi_cross_ref_id has datatype number which has council_tax_id and Given the Table business rates having columns as business_rates_id has datatype number, cmi_cross_ref_id has datatype number which has business_rates_id and Given the Table benefits overpayments having columns as council_tax_id has datatype number, cmi_cross_ref_id has datatype number which has council_tax_id and Given the Table parking fines having columns as council_tax_id has datatype number, cmi_cross_ref_id has datatype number which has council_tax_id and Given the Table rent arrears having columns as council_tax_id has datatype number, cmi_cross_ref_id has datatype number which has council_tax_id and Given the Table electoral register having columns as electoral_register_id has datatype number, cmi_cross_ref_id has datatype number which has electoral_register_id. Answer the question by writing the appropriate SQL code. Which cmi cross reference id is not related to any parking taxes?
|
SELECT DISTINCT source_system_code FROM cmi_cross_references WHERE source_system_code LIKE '%en%'
|
Given the Table customer master index having columns as master_customer_id has datatype number, cmi_details has datatype text which has master_customer_id and Given the Table cmi cross references having columns as cmi_cross_ref_id has datatype number, master_customer_id has datatype number, source_system_code has datatype text which has cmi_cross_ref_id and Given the Table council tax having columns as council_tax_id has datatype number, cmi_cross_ref_id has datatype number which has council_tax_id and Given the Table business rates having columns as business_rates_id has datatype number, cmi_cross_ref_id has datatype number which has business_rates_id and Given the Table benefits overpayments having columns as council_tax_id has datatype number, cmi_cross_ref_id has datatype number which has council_tax_id and Given the Table parking fines having columns as council_tax_id has datatype number, cmi_cross_ref_id has datatype number which has council_tax_id and Given the Table rent arrears having columns as council_tax_id has datatype number, cmi_cross_ref_id has datatype number which has council_tax_id and Given the Table electoral register having columns as electoral_register_id has datatype number, cmi_cross_ref_id has datatype number which has electoral_register_id. Answer the question by writing the appropriate SQL code. Which distinct source system code includes the substring 'en'?
|
SELECT count(*) FROM party
|
Given the Table party having columns as Party_ID has datatype number, Party_Theme has datatype text, Location has datatype text, First_year has datatype text, Last_year has datatype text, Number_of_hosts has datatype number which has Party_ID and Given the Table host having columns as Host_ID has datatype number, Name has datatype text, Nationality has datatype text, Age has datatype text which has Host_ID and Given the Table party host having columns as Party_ID has datatype number, Host_ID has datatype number, Is_Main_in_Charge has datatype others which has Party_ID. Answer the question by writing the appropriate SQL code. How many parties are there?
|
SELECT count(*) FROM party
|
Given the Table party having columns as Party_ID has datatype number, Party_Theme has datatype text, Location has datatype text, First_year has datatype text, Last_year has datatype text, Number_of_hosts has datatype number which has Party_ID and Given the Table host having columns as Host_ID has datatype number, Name has datatype text, Nationality has datatype text, Age has datatype text which has Host_ID and Given the Table party host having columns as Party_ID has datatype number, Host_ID has datatype number, Is_Main_in_Charge has datatype others which has Party_ID. Answer the question by writing the appropriate SQL code. Count the number of parties.
|
SELECT Party_Theme FROM party ORDER BY Number_of_hosts ASC
|
Given the Table party having columns as Party_ID has datatype number, Party_Theme has datatype text, Location has datatype text, First_year has datatype text, Last_year has datatype text, Number_of_hosts has datatype number which has Party_ID and Given the Table host having columns as Host_ID has datatype number, Name has datatype text, Nationality has datatype text, Age has datatype text which has Host_ID and Given the Table party host having columns as Party_ID has datatype number, Host_ID has datatype number, Is_Main_in_Charge has datatype others which has Party_ID. Answer the question by writing the appropriate SQL code. List the themes of parties in ascending order of number of hosts.
|
SELECT Party_Theme FROM party ORDER BY Number_of_hosts ASC
|
Given the Table party having columns as Party_ID has datatype number, Party_Theme has datatype text, Location has datatype text, First_year has datatype text, Last_year has datatype text, Number_of_hosts has datatype number which has Party_ID and Given the Table host having columns as Host_ID has datatype number, Name has datatype text, Nationality has datatype text, Age has datatype text which has Host_ID and Given the Table party host having columns as Party_ID has datatype number, Host_ID has datatype number, Is_Main_in_Charge has datatype others which has Party_ID. Answer the question by writing the appropriate SQL code. What are the themes of parties ordered by the number of hosts in ascending manner?
|
SELECT Party_Theme , LOCATION FROM party
|
Given the Table party having columns as Party_ID has datatype number, Party_Theme has datatype text, Location has datatype text, First_year has datatype text, Last_year has datatype text, Number_of_hosts has datatype number which has Party_ID and Given the Table host having columns as Host_ID has datatype number, Name has datatype text, Nationality has datatype text, Age has datatype text which has Host_ID and Given the Table party host having columns as Party_ID has datatype number, Host_ID has datatype number, Is_Main_in_Charge has datatype others which has Party_ID. Answer the question by writing the appropriate SQL code. What are the themes and locations of parties?
|
SELECT Party_Theme , LOCATION FROM party
|
Given the Table party having columns as Party_ID has datatype number, Party_Theme has datatype text, Location has datatype text, First_year has datatype text, Last_year has datatype text, Number_of_hosts has datatype number which has Party_ID and Given the Table host having columns as Host_ID has datatype number, Name has datatype text, Nationality has datatype text, Age has datatype text which has Host_ID and Given the Table party host having columns as Party_ID has datatype number, Host_ID has datatype number, Is_Main_in_Charge has datatype others which has Party_ID. Answer the question by writing the appropriate SQL code. Give me the theme and location of each party.
|
SELECT First_year , Last_year FROM party WHERE Party_Theme = "Spring" OR Party_Theme = "Teqnology"
|
Given the Table party having columns as Party_ID has datatype number, Party_Theme has datatype text, Location has datatype text, First_year has datatype text, Last_year has datatype text, Number_of_hosts has datatype number which has Party_ID and Given the Table host having columns as Host_ID has datatype number, Name has datatype text, Nationality has datatype text, Age has datatype text which has Host_ID and Given the Table party host having columns as Party_ID has datatype number, Host_ID has datatype number, Is_Main_in_Charge has datatype others which has Party_ID. Answer the question by writing the appropriate SQL code. Show the first year and last year of parties with theme "Spring" or "Teqnology".
|
SELECT First_year , Last_year FROM party WHERE Party_Theme = "Spring" OR Party_Theme = "Teqnology"
|
Given the Table party having columns as Party_ID has datatype number, Party_Theme has datatype text, Location has datatype text, First_year has datatype text, Last_year has datatype text, Number_of_hosts has datatype number which has Party_ID and Given the Table host having columns as Host_ID has datatype number, Name has datatype text, Nationality has datatype text, Age has datatype text which has Host_ID and Given the Table party host having columns as Party_ID has datatype number, Host_ID has datatype number, Is_Main_in_Charge has datatype others which has Party_ID. Answer the question by writing the appropriate SQL code. What are the first year and last year of the parties whose theme is "Spring" or "Teqnology"?
|
SELECT avg(Number_of_hosts) FROM party
|
Given the Table party having columns as Party_ID has datatype number, Party_Theme has datatype text, Location has datatype text, First_year has datatype text, Last_year has datatype text, Number_of_hosts has datatype number which has Party_ID and Given the Table host having columns as Host_ID has datatype number, Name has datatype text, Nationality has datatype text, Age has datatype text which has Host_ID and Given the Table party host having columns as Party_ID has datatype number, Host_ID has datatype number, Is_Main_in_Charge has datatype others which has Party_ID. Answer the question by writing the appropriate SQL code. What is the average number of hosts for parties?
|
SELECT avg(Number_of_hosts) FROM party
|
Given the Table party having columns as Party_ID has datatype number, Party_Theme has datatype text, Location has datatype text, First_year has datatype text, Last_year has datatype text, Number_of_hosts has datatype number which has Party_ID and Given the Table host having columns as Host_ID has datatype number, Name has datatype text, Nationality has datatype text, Age has datatype text which has Host_ID and Given the Table party host having columns as Party_ID has datatype number, Host_ID has datatype number, Is_Main_in_Charge has datatype others which has Party_ID. Answer the question by writing the appropriate SQL code. Compute the average number of hosts for parties.
|
SELECT LOCATION FROM party ORDER BY Number_of_hosts DESC LIMIT 1
|
Given the Table party having columns as Party_ID has datatype number, Party_Theme has datatype text, Location has datatype text, First_year has datatype text, Last_year has datatype text, Number_of_hosts has datatype number which has Party_ID and Given the Table host having columns as Host_ID has datatype number, Name has datatype text, Nationality has datatype text, Age has datatype text which has Host_ID and Given the Table party host having columns as Party_ID has datatype number, Host_ID has datatype number, Is_Main_in_Charge has datatype others which has Party_ID. Answer the question by writing the appropriate SQL code. What is the location of the party with the most hosts?
|
SELECT LOCATION FROM party ORDER BY Number_of_hosts DESC LIMIT 1
|
Given the Table party having columns as Party_ID has datatype number, Party_Theme has datatype text, Location has datatype text, First_year has datatype text, Last_year has datatype text, Number_of_hosts has datatype number which has Party_ID and Given the Table host having columns as Host_ID has datatype number, Name has datatype text, Nationality has datatype text, Age has datatype text which has Host_ID and Given the Table party host having columns as Party_ID has datatype number, Host_ID has datatype number, Is_Main_in_Charge has datatype others which has Party_ID. Answer the question by writing the appropriate SQL code. Which party had the most hosts? Give me the party location.
|
SELECT Nationality , COUNT(*) FROM HOST GROUP BY Nationality
|
Given the Table party having columns as Party_ID has datatype number, Party_Theme has datatype text, Location has datatype text, First_year has datatype text, Last_year has datatype text, Number_of_hosts has datatype number which has Party_ID and Given the Table host having columns as Host_ID has datatype number, Name has datatype text, Nationality has datatype text, Age has datatype text which has Host_ID and Given the Table party host having columns as Party_ID has datatype number, Host_ID has datatype number, Is_Main_in_Charge has datatype others which has Party_ID. Answer the question by writing the appropriate SQL code. Show different nationalities along with the number of hosts of each nationality.
|
SELECT Nationality , COUNT(*) FROM HOST GROUP BY Nationality
|
Given the Table party having columns as Party_ID has datatype number, Party_Theme has datatype text, Location has datatype text, First_year has datatype text, Last_year has datatype text, Number_of_hosts has datatype number which has Party_ID and Given the Table host having columns as Host_ID has datatype number, Name has datatype text, Nationality has datatype text, Age has datatype text which has Host_ID and Given the Table party host having columns as Party_ID has datatype number, Host_ID has datatype number, Is_Main_in_Charge has datatype others which has Party_ID. Answer the question by writing the appropriate SQL code. How many hosts does each nationality have? List the nationality and the count.
|
SELECT Nationality FROM HOST GROUP BY Nationality ORDER BY COUNT(*) DESC LIMIT 1
|
Given the Table party having columns as Party_ID has datatype number, Party_Theme has datatype text, Location has datatype text, First_year has datatype text, Last_year has datatype text, Number_of_hosts has datatype number which has Party_ID and Given the Table host having columns as Host_ID has datatype number, Name has datatype text, Nationality has datatype text, Age has datatype text which has Host_ID and Given the Table party host having columns as Party_ID has datatype number, Host_ID has datatype number, Is_Main_in_Charge has datatype others which has Party_ID. Answer the question by writing the appropriate SQL code. Show the most common nationality of hosts.
|
SELECT Nationality FROM HOST GROUP BY Nationality ORDER BY COUNT(*) DESC LIMIT 1
|
Given the Table party having columns as Party_ID has datatype number, Party_Theme has datatype text, Location has datatype text, First_year has datatype text, Last_year has datatype text, Number_of_hosts has datatype number which has Party_ID and Given the Table host having columns as Host_ID has datatype number, Name has datatype text, Nationality has datatype text, Age has datatype text which has Host_ID and Given the Table party host having columns as Party_ID has datatype number, Host_ID has datatype number, Is_Main_in_Charge has datatype others which has Party_ID. Answer the question by writing the appropriate SQL code. Which nationality has the most hosts?
|
SELECT Nationality FROM HOST WHERE Age > 45 INTERSECT SELECT Nationality FROM HOST WHERE Age < 35
|
Given the Table party having columns as Party_ID has datatype number, Party_Theme has datatype text, Location has datatype text, First_year has datatype text, Last_year has datatype text, Number_of_hosts has datatype number which has Party_ID and Given the Table host having columns as Host_ID has datatype number, Name has datatype text, Nationality has datatype text, Age has datatype text which has Host_ID and Given the Table party host having columns as Party_ID has datatype number, Host_ID has datatype number, Is_Main_in_Charge has datatype others which has Party_ID. Answer the question by writing the appropriate SQL code. Show the nations that have both hosts older than 45 and hosts younger than 35.
|
SELECT Nationality FROM HOST WHERE Age > 45 INTERSECT SELECT Nationality FROM HOST WHERE Age < 35
|
Given the Table party having columns as Party_ID has datatype number, Party_Theme has datatype text, Location has datatype text, First_year has datatype text, Last_year has datatype text, Number_of_hosts has datatype number which has Party_ID and Given the Table host having columns as Host_ID has datatype number, Name has datatype text, Nationality has datatype text, Age has datatype text which has Host_ID and Given the Table party host having columns as Party_ID has datatype number, Host_ID has datatype number, Is_Main_in_Charge has datatype others which has Party_ID. Answer the question by writing the appropriate SQL code. Which nations have both hosts of age above 45 and hosts of age below 35?
|
SELECT T3.Party_Theme , T2.Name FROM party_host AS T1 JOIN HOST AS T2 ON T1.Host_ID = T2.Host_ID JOIN party AS T3 ON T1.Party_ID = T3.Party_ID
|
Given the Table party having columns as Party_ID has datatype number, Party_Theme has datatype text, Location has datatype text, First_year has datatype text, Last_year has datatype text, Number_of_hosts has datatype number which has Party_ID and Given the Table host having columns as Host_ID has datatype number, Name has datatype text, Nationality has datatype text, Age has datatype text which has Host_ID and Given the Table party host having columns as Party_ID has datatype number, Host_ID has datatype number, Is_Main_in_Charge has datatype others which has Party_ID. Answer the question by writing the appropriate SQL code. Show the themes of parties and the names of the party hosts.
|
SELECT T3.Party_Theme , T2.Name FROM party_host AS T1 JOIN HOST AS T2 ON T1.Host_ID = T2.Host_ID JOIN party AS T3 ON T1.Party_ID = T3.Party_ID
|
Given the Table party having columns as Party_ID has datatype number, Party_Theme has datatype text, Location has datatype text, First_year has datatype text, Last_year has datatype text, Number_of_hosts has datatype number which has Party_ID and Given the Table host having columns as Host_ID has datatype number, Name has datatype text, Nationality has datatype text, Age has datatype text which has Host_ID and Given the Table party host having columns as Party_ID has datatype number, Host_ID has datatype number, Is_Main_in_Charge has datatype others which has Party_ID. Answer the question by writing the appropriate SQL code. For each party, return its theme and the name of its host.
|
SELECT T3.Location , T2.Name FROM party_host AS T1 JOIN HOST AS T2 ON T1.Host_ID = T2.Host_ID JOIN party AS T3 ON T1.Party_ID = T3.Party_ID ORDER BY T2.Age
|
Given the Table party having columns as Party_ID has datatype number, Party_Theme has datatype text, Location has datatype text, First_year has datatype text, Last_year has datatype text, Number_of_hosts has datatype number which has Party_ID and Given the Table host having columns as Host_ID has datatype number, Name has datatype text, Nationality has datatype text, Age has datatype text which has Host_ID and Given the Table party host having columns as Party_ID has datatype number, Host_ID has datatype number, Is_Main_in_Charge has datatype others which has Party_ID. Answer the question by writing the appropriate SQL code. Show the locations of parties and the names of the party hosts in ascending order of the age of the host.
|
SELECT T3.Location , T2.Name FROM party_host AS T1 JOIN HOST AS T2 ON T1.Host_ID = T2.Host_ID JOIN party AS T3 ON T1.Party_ID = T3.Party_ID ORDER BY T2.Age
|
Given the Table party having columns as Party_ID has datatype number, Party_Theme has datatype text, Location has datatype text, First_year has datatype text, Last_year has datatype text, Number_of_hosts has datatype number which has Party_ID and Given the Table host having columns as Host_ID has datatype number, Name has datatype text, Nationality has datatype text, Age has datatype text which has Host_ID and Given the Table party host having columns as Party_ID has datatype number, Host_ID has datatype number, Is_Main_in_Charge has datatype others which has Party_ID. Answer the question by writing the appropriate SQL code. For each party, find its location and the name of its host. Sort the result in ascending order of the age of the host.
|
SELECT T3.Location FROM party_host AS T1 JOIN HOST AS T2 ON T1.Host_ID = T2.Host_ID JOIN party AS T3 ON T1.Party_ID = T3.Party_ID WHERE T2.Age > 50
|
Given the Table party having columns as Party_ID has datatype number, Party_Theme has datatype text, Location has datatype text, First_year has datatype text, Last_year has datatype text, Number_of_hosts has datatype number which has Party_ID and Given the Table host having columns as Host_ID has datatype number, Name has datatype text, Nationality has datatype text, Age has datatype text which has Host_ID and Given the Table party host having columns as Party_ID has datatype number, Host_ID has datatype number, Is_Main_in_Charge has datatype others which has Party_ID. Answer the question by writing the appropriate SQL code. Show the locations of parties with hosts older than 50.
|
SELECT T3.Location FROM party_host AS T1 JOIN HOST AS T2 ON T1.Host_ID = T2.Host_ID JOIN party AS T3 ON T1.Party_ID = T3.Party_ID WHERE T2.Age > 50
|
Given the Table party having columns as Party_ID has datatype number, Party_Theme has datatype text, Location has datatype text, First_year has datatype text, Last_year has datatype text, Number_of_hosts has datatype number which has Party_ID and Given the Table host having columns as Host_ID has datatype number, Name has datatype text, Nationality has datatype text, Age has datatype text which has Host_ID and Given the Table party host having columns as Party_ID has datatype number, Host_ID has datatype number, Is_Main_in_Charge has datatype others which has Party_ID. Answer the question by writing the appropriate SQL code. Which parties have hosts of age above 50? Give me the party locations.
|
SELECT T2.Name FROM party_host AS T1 JOIN HOST AS T2 ON T1.Host_ID = T2.Host_ID JOIN party AS T3 ON T1.Party_ID = T3.Party_ID WHERE T3.Number_of_hosts > 20
|
Given the Table party having columns as Party_ID has datatype number, Party_Theme has datatype text, Location has datatype text, First_year has datatype text, Last_year has datatype text, Number_of_hosts has datatype number which has Party_ID and Given the Table host having columns as Host_ID has datatype number, Name has datatype text, Nationality has datatype text, Age has datatype text which has Host_ID and Given the Table party host having columns as Party_ID has datatype number, Host_ID has datatype number, Is_Main_in_Charge has datatype others which has Party_ID. Answer the question by writing the appropriate SQL code. Show the host names for parties with number of hosts greater than 20.
|
SELECT T2.Name FROM party_host AS T1 JOIN HOST AS T2 ON T1.Host_ID = T2.Host_ID JOIN party AS T3 ON T1.Party_ID = T3.Party_ID WHERE T3.Number_of_hosts > 20
|
Given the Table party having columns as Party_ID has datatype number, Party_Theme has datatype text, Location has datatype text, First_year has datatype text, Last_year has datatype text, Number_of_hosts has datatype number which has Party_ID and Given the Table host having columns as Host_ID has datatype number, Name has datatype text, Nationality has datatype text, Age has datatype text which has Host_ID and Given the Table party host having columns as Party_ID has datatype number, Host_ID has datatype number, Is_Main_in_Charge has datatype others which has Party_ID. Answer the question by writing the appropriate SQL code. Which parties have more than 20 hosts? Give me the host names for these parties.
|
SELECT Name , Nationality FROM HOST ORDER BY Age DESC LIMIT 1
|
Given the Table party having columns as Party_ID has datatype number, Party_Theme has datatype text, Location has datatype text, First_year has datatype text, Last_year has datatype text, Number_of_hosts has datatype number which has Party_ID and Given the Table host having columns as Host_ID has datatype number, Name has datatype text, Nationality has datatype text, Age has datatype text which has Host_ID and Given the Table party host having columns as Party_ID has datatype number, Host_ID has datatype number, Is_Main_in_Charge has datatype others which has Party_ID. Answer the question by writing the appropriate SQL code. Show the name and the nationality of the oldest host.
|
SELECT Name , Nationality FROM HOST ORDER BY Age DESC LIMIT 1
|
Given the Table party having columns as Party_ID has datatype number, Party_Theme has datatype text, Location has datatype text, First_year has datatype text, Last_year has datatype text, Number_of_hosts has datatype number which has Party_ID and Given the Table host having columns as Host_ID has datatype number, Name has datatype text, Nationality has datatype text, Age has datatype text which has Host_ID and Given the Table party host having columns as Party_ID has datatype number, Host_ID has datatype number, Is_Main_in_Charge has datatype others which has Party_ID. Answer the question by writing the appropriate SQL code. What are the name and the nationality of the host of the highest age?
|
SELECT Name FROM HOST WHERE Host_ID NOT IN (SELECT Host_ID FROM party_host)
|
Given the Table party having columns as Party_ID has datatype number, Party_Theme has datatype text, Location has datatype text, First_year has datatype text, Last_year has datatype text, Number_of_hosts has datatype number which has Party_ID and Given the Table host having columns as Host_ID has datatype number, Name has datatype text, Nationality has datatype text, Age has datatype text which has Host_ID and Given the Table party host having columns as Party_ID has datatype number, Host_ID has datatype number, Is_Main_in_Charge has datatype others which has Party_ID. Answer the question by writing the appropriate SQL code. List the names of hosts who did not serve as a host of any party in our record.
|
SELECT Name FROM HOST WHERE Host_ID NOT IN (SELECT Host_ID FROM party_host)
|
Given the Table party having columns as Party_ID has datatype number, Party_Theme has datatype text, Location has datatype text, First_year has datatype text, Last_year has datatype text, Number_of_hosts has datatype number which has Party_ID and Given the Table host having columns as Host_ID has datatype number, Name has datatype text, Nationality has datatype text, Age has datatype text which has Host_ID and Given the Table party host having columns as Party_ID has datatype number, Host_ID has datatype number, Is_Main_in_Charge has datatype others which has Party_ID. Answer the question by writing the appropriate SQL code. What are the names of hosts who did not host any party in our record?
|
SELECT count(*) FROM region
|
Given the Table storm having columns as Storm_ID has datatype number, Name has datatype text, Dates_active has datatype text, Max_speed has datatype number, Damage_millions_USD has datatype number, Number_Deaths has datatype number which has Storm_ID and Given the Table region having columns as Region_id has datatype number, Region_code has datatype text, Region_name has datatype text which has Region_id and Given the Table affected region having columns as Region_id has datatype number, Storm_ID has datatype number, Number_city_affected has datatype number which has Region_id. Answer the question by writing the appropriate SQL code. How many regions do we have?
|
SELECT count(*) FROM region
|
Given the Table storm having columns as Storm_ID has datatype number, Name has datatype text, Dates_active has datatype text, Max_speed has datatype number, Damage_millions_USD has datatype number, Number_Deaths has datatype number which has Storm_ID and Given the Table region having columns as Region_id has datatype number, Region_code has datatype text, Region_name has datatype text which has Region_id and Given the Table affected region having columns as Region_id has datatype number, Storm_ID has datatype number, Number_city_affected has datatype number which has Region_id. Answer the question by writing the appropriate SQL code. Count the number of regions.
|
SELECT region_code , region_name FROM region ORDER BY region_code
|
Given the Table storm having columns as Storm_ID has datatype number, Name has datatype text, Dates_active has datatype text, Max_speed has datatype number, Damage_millions_USD has datatype number, Number_Deaths has datatype number which has Storm_ID and Given the Table region having columns as Region_id has datatype number, Region_code has datatype text, Region_name has datatype text which has Region_id and Given the Table affected region having columns as Region_id has datatype number, Storm_ID has datatype number, Number_city_affected has datatype number which has Region_id. Answer the question by writing the appropriate SQL code. Show all region code and region name sorted by the codes.
|
SELECT region_code , region_name FROM region ORDER BY region_code
|
Given the Table storm having columns as Storm_ID has datatype number, Name has datatype text, Dates_active has datatype text, Max_speed has datatype number, Damage_millions_USD has datatype number, Number_Deaths has datatype number which has Storm_ID and Given the Table region having columns as Region_id has datatype number, Region_code has datatype text, Region_name has datatype text which has Region_id and Given the Table affected region having columns as Region_id has datatype number, Storm_ID has datatype number, Number_city_affected has datatype number which has Region_id. Answer the question by writing the appropriate SQL code. What are the codes and names for all regions, sorted by codes?
|
SELECT region_name FROM region ORDER BY region_name
|
Given the Table storm having columns as Storm_ID has datatype number, Name has datatype text, Dates_active has datatype text, Max_speed has datatype number, Damage_millions_USD has datatype number, Number_Deaths has datatype number which has Storm_ID and Given the Table region having columns as Region_id has datatype number, Region_code has datatype text, Region_name has datatype text which has Region_id and Given the Table affected region having columns as Region_id has datatype number, Storm_ID has datatype number, Number_city_affected has datatype number which has Region_id. Answer the question by writing the appropriate SQL code. List all region names in alphabetical order.
|
SELECT region_name FROM region ORDER BY region_name
|
Given the Table storm having columns as Storm_ID has datatype number, Name has datatype text, Dates_active has datatype text, Max_speed has datatype number, Damage_millions_USD has datatype number, Number_Deaths has datatype number which has Storm_ID and Given the Table region having columns as Region_id has datatype number, Region_code has datatype text, Region_name has datatype text which has Region_id and Given the Table affected region having columns as Region_id has datatype number, Storm_ID has datatype number, Number_city_affected has datatype number which has Region_id. Answer the question by writing the appropriate SQL code. What are the names of the regions in alphabetical order?
|
SELECT region_name FROM region WHERE region_name != 'Denmark'
|
Given the Table storm having columns as Storm_ID has datatype number, Name has datatype text, Dates_active has datatype text, Max_speed has datatype number, Damage_millions_USD has datatype number, Number_Deaths has datatype number which has Storm_ID and Given the Table region having columns as Region_id has datatype number, Region_code has datatype text, Region_name has datatype text which has Region_id and Given the Table affected region having columns as Region_id has datatype number, Storm_ID has datatype number, Number_city_affected has datatype number which has Region_id. Answer the question by writing the appropriate SQL code. Show names for all regions except for Denmark.
|
SELECT region_name FROM region WHERE region_name != 'Denmark'
|
Given the Table storm having columns as Storm_ID has datatype number, Name has datatype text, Dates_active has datatype text, Max_speed has datatype number, Damage_millions_USD has datatype number, Number_Deaths has datatype number which has Storm_ID and Given the Table region having columns as Region_id has datatype number, Region_code has datatype text, Region_name has datatype text which has Region_id and Given the Table affected region having columns as Region_id has datatype number, Storm_ID has datatype number, Number_city_affected has datatype number which has Region_id. Answer the question by writing the appropriate SQL code. Return the names of all regions other than Denmark.
|
SELECT count(*) FROM storm WHERE Number_Deaths > 0
|
Given the Table storm having columns as Storm_ID has datatype number, Name has datatype text, Dates_active has datatype text, Max_speed has datatype number, Damage_millions_USD has datatype number, Number_Deaths has datatype number which has Storm_ID and Given the Table region having columns as Region_id has datatype number, Region_code has datatype text, Region_name has datatype text which has Region_id and Given the Table affected region having columns as Region_id has datatype number, Storm_ID has datatype number, Number_city_affected has datatype number which has Region_id. Answer the question by writing the appropriate SQL code. How many storms had death records?
|
SELECT count(*) FROM storm WHERE Number_Deaths > 0
|
Given the Table storm having columns as Storm_ID has datatype number, Name has datatype text, Dates_active has datatype text, Max_speed has datatype number, Damage_millions_USD has datatype number, Number_Deaths has datatype number which has Storm_ID and Given the Table region having columns as Region_id has datatype number, Region_code has datatype text, Region_name has datatype text which has Region_id and Given the Table affected region having columns as Region_id has datatype number, Storm_ID has datatype number, Number_city_affected has datatype number which has Region_id. Answer the question by writing the appropriate SQL code. Count the number of storms in which at least 1 person died.
|
SELECT name , dates_active , number_deaths FROM storm WHERE number_deaths >= 1
|
Given the Table storm having columns as Storm_ID has datatype number, Name has datatype text, Dates_active has datatype text, Max_speed has datatype number, Damage_millions_USD has datatype number, Number_Deaths has datatype number which has Storm_ID and Given the Table region having columns as Region_id has datatype number, Region_code has datatype text, Region_name has datatype text which has Region_id and Given the Table affected region having columns as Region_id has datatype number, Storm_ID has datatype number, Number_city_affected has datatype number which has Region_id. Answer the question by writing the appropriate SQL code. List name, dates active, and number of deaths for all storms with at least 1 death.
|
SELECT name , dates_active , number_deaths FROM storm WHERE number_deaths >= 1
|
Given the Table storm having columns as Storm_ID has datatype number, Name has datatype text, Dates_active has datatype text, Max_speed has datatype number, Damage_millions_USD has datatype number, Number_Deaths has datatype number which has Storm_ID and Given the Table region having columns as Region_id has datatype number, Region_code has datatype text, Region_name has datatype text which has Region_id and Given the Table affected region having columns as Region_id has datatype number, Storm_ID has datatype number, Number_city_affected has datatype number which has Region_id. Answer the question by writing the appropriate SQL code. What are the names, dates active, and number of deaths for storms that had 1 or more death?
|
SELECT avg(damage_millions_USD) , max(damage_millions_USD) FROM storm WHERE max_speed > 1000
|
Given the Table storm having columns as Storm_ID has datatype number, Name has datatype text, Dates_active has datatype text, Max_speed has datatype number, Damage_millions_USD has datatype number, Number_Deaths has datatype number which has Storm_ID and Given the Table region having columns as Region_id has datatype number, Region_code has datatype text, Region_name has datatype text which has Region_id and Given the Table affected region having columns as Region_id has datatype number, Storm_ID has datatype number, Number_city_affected has datatype number which has Region_id. Answer the question by writing the appropriate SQL code. Show the average and maximum damage for all storms with max speed higher than 1000.
|
SELECT avg(damage_millions_USD) , max(damage_millions_USD) FROM storm WHERE max_speed > 1000
|
Given the Table storm having columns as Storm_ID has datatype number, Name has datatype text, Dates_active has datatype text, Max_speed has datatype number, Damage_millions_USD has datatype number, Number_Deaths has datatype number which has Storm_ID and Given the Table region having columns as Region_id has datatype number, Region_code has datatype text, Region_name has datatype text which has Region_id and Given the Table affected region having columns as Region_id has datatype number, Storm_ID has datatype number, Number_city_affected has datatype number which has Region_id. Answer the question by writing the appropriate SQL code. What is the average and maximum damage in millions for storms that had a max speed over 1000?
|
SELECT sum(number_deaths) , sum(damage_millions_USD) FROM storm WHERE max_speed > (SELECT avg(max_speed) FROM storm)
|
Given the Table storm having columns as Storm_ID has datatype number, Name has datatype text, Dates_active has datatype text, Max_speed has datatype number, Damage_millions_USD has datatype number, Number_Deaths has datatype number which has Storm_ID and Given the Table region having columns as Region_id has datatype number, Region_code has datatype text, Region_name has datatype text which has Region_id and Given the Table affected region having columns as Region_id has datatype number, Storm_ID has datatype number, Number_city_affected has datatype number which has Region_id. Answer the question by writing the appropriate SQL code. What is the total number of deaths and damage for all storms with a max speed greater than the average?
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.