db_name
stringclasses 146
values | prompt
stringlengths 310
4.81k
|
|---|---|
customer_complaints
|
### Complete SQL query only and with no explanation
### SQL tables followed by foreign key information:
#
# Staff ( staff_id, gender, first_name, last_name, email_address, phone_number )
# Customers ( customer_id, customer_type_code, address_line_1, address_line_2, town_city, state, email_address, phone_number )
# Products ( product_id, parent_product_id, product_category_code, date_product_first_available, date_product_discontinued, product_name, product_description, product_price )
# Complaints ( complaint_id, product_id, customer_id, complaint_outcome_code, complaint_status_code, complaint_type_code, date_complaint_raised, date_complaint_closed, staff_id )
#
# Complaints.customer_id can be joined with Customers.customer_id
# Complaints.product_id can be joined with Products.product_id
# Complaints.staff_id can be joined with Staff.staff_id
#
### Question:
#
# How many customers are there in the customer type with the most customers?
#
### SQL:
#
# SELECT count(*) FROM customers GROUP BY customer_type_code ORDER BY count(*) DESC LIMIT 1
#
### End.
|
customer_complaints
|
### Complete SQL query only and with no explanation
### SQL tables followed by foreign key information:
#
# Staff ( staff_id, gender, first_name, last_name, email_address, phone_number )
# Customers ( customer_id, customer_type_code, address_line_1, address_line_2, town_city, state, email_address, phone_number )
# Products ( product_id, parent_product_id, product_category_code, date_product_first_available, date_product_discontinued, product_name, product_description, product_price )
# Complaints ( complaint_id, product_id, customer_id, complaint_outcome_code, complaint_status_code, complaint_type_code, date_complaint_raised, date_complaint_closed, staff_id )
#
# Complaints.customer_id can be joined with Customers.customer_id
# Complaints.product_id can be joined with Products.product_id
# Complaints.staff_id can be joined with Staff.staff_id
#
### Question:
#
# Count the number of customers that have the customer type that is most common.
#
### SQL:
#
# SELECT count(*) FROM customers GROUP BY customer_type_code ORDER BY count(*) DESC LIMIT 1
#
### End.
|
customer_complaints
|
### Complete SQL query only and with no explanation
### SQL tables followed by foreign key information:
#
# Staff ( staff_id, gender, first_name, last_name, email_address, phone_number )
# Customers ( customer_id, customer_type_code, address_line_1, address_line_2, town_city, state, email_address, phone_number )
# Products ( product_id, parent_product_id, product_category_code, date_product_first_available, date_product_discontinued, product_name, product_description, product_price )
# Complaints ( complaint_id, product_id, customer_id, complaint_outcome_code, complaint_status_code, complaint_type_code, date_complaint_raised, date_complaint_closed, staff_id )
#
# Complaints.customer_id can be joined with Customers.customer_id
# Complaints.product_id can be joined with Products.product_id
# Complaints.staff_id can be joined with Staff.staff_id
#
### Question:
#
# What is the last name of the staff who has handled the first ever complaint?
#
### SQL:
#
# SELECT t1.last_name FROM staff AS t1 JOIN complaints AS t2 ON t1.staff_id = t2.staff_id ORDER BY t2.date_complaint_raised LIMIT 1
#
### End.
|
customer_complaints
|
### Complete SQL query only and with no explanation
### SQL tables followed by foreign key information:
#
# Staff ( staff_id, gender, first_name, last_name, email_address, phone_number )
# Customers ( customer_id, customer_type_code, address_line_1, address_line_2, town_city, state, email_address, phone_number )
# Products ( product_id, parent_product_id, product_category_code, date_product_first_available, date_product_discontinued, product_name, product_description, product_price )
# Complaints ( complaint_id, product_id, customer_id, complaint_outcome_code, complaint_status_code, complaint_type_code, date_complaint_raised, date_complaint_closed, staff_id )
#
# Complaints.customer_id can be joined with Customers.customer_id
# Complaints.product_id can be joined with Products.product_id
# Complaints.staff_id can be joined with Staff.staff_id
#
### Question:
#
# Return the last name of the staff member who handled the complaint with the earliest date raised.
#
### SQL:
#
# SELECT t1.last_name FROM staff AS t1 JOIN complaints AS t2 ON t1.staff_id = t2.staff_id ORDER BY t2.date_complaint_raised LIMIT 1
#
### End.
|
customer_complaints
|
### Complete SQL query only and with no explanation
### SQL tables followed by foreign key information:
#
# Staff ( staff_id, gender, first_name, last_name, email_address, phone_number )
# Customers ( customer_id, customer_type_code, address_line_1, address_line_2, town_city, state, email_address, phone_number )
# Products ( product_id, parent_product_id, product_category_code, date_product_first_available, date_product_discontinued, product_name, product_description, product_price )
# Complaints ( complaint_id, product_id, customer_id, complaint_outcome_code, complaint_status_code, complaint_type_code, date_complaint_raised, date_complaint_closed, staff_id )
#
# Complaints.customer_id can be joined with Customers.customer_id
# Complaints.product_id can be joined with Products.product_id
# Complaints.staff_id can be joined with Staff.staff_id
#
### Question:
#
# How many distinct complaint type codes are there in the database?
#
### SQL:
#
# SELECT count(DISTINCT complaint_type_code) FROM complaints
#
### End.
|
customer_complaints
|
### Complete SQL query only and with no explanation
### SQL tables followed by foreign key information:
#
# Staff ( staff_id, gender, first_name, last_name, email_address, phone_number )
# Customers ( customer_id, customer_type_code, address_line_1, address_line_2, town_city, state, email_address, phone_number )
# Products ( product_id, parent_product_id, product_category_code, date_product_first_available, date_product_discontinued, product_name, product_description, product_price )
# Complaints ( complaint_id, product_id, customer_id, complaint_outcome_code, complaint_status_code, complaint_type_code, date_complaint_raised, date_complaint_closed, staff_id )
#
# Complaints.customer_id can be joined with Customers.customer_id
# Complaints.product_id can be joined with Products.product_id
# Complaints.staff_id can be joined with Staff.staff_id
#
### Question:
#
# Count the number of different complaint type codes.
#
### SQL:
#
# SELECT count(DISTINCT complaint_type_code) FROM complaints
#
### End.
|
customer_complaints
|
### Complete SQL query only and with no explanation
### SQL tables followed by foreign key information:
#
# Staff ( staff_id, gender, first_name, last_name, email_address, phone_number )
# Customers ( customer_id, customer_type_code, address_line_1, address_line_2, town_city, state, email_address, phone_number )
# Products ( product_id, parent_product_id, product_category_code, date_product_first_available, date_product_discontinued, product_name, product_description, product_price )
# Complaints ( complaint_id, product_id, customer_id, complaint_outcome_code, complaint_status_code, complaint_type_code, date_complaint_raised, date_complaint_closed, staff_id )
#
# Complaints.customer_id can be joined with Customers.customer_id
# Complaints.product_id can be joined with Products.product_id
# Complaints.staff_id can be joined with Staff.staff_id
#
### Question:
#
# Find the address line 1 and 2 of the customer with email "vbogisich@example.org".
#
### SQL:
#
# SELECT address_line_1 , address_line_2 FROM customers WHERE email_address = "vbogisich@example.org"
#
### End.
|
customer_complaints
|
### Complete SQL query only and with no explanation
### SQL tables followed by foreign key information:
#
# Staff ( staff_id, gender, first_name, last_name, email_address, phone_number )
# Customers ( customer_id, customer_type_code, address_line_1, address_line_2, town_city, state, email_address, phone_number )
# Products ( product_id, parent_product_id, product_category_code, date_product_first_available, date_product_discontinued, product_name, product_description, product_price )
# Complaints ( complaint_id, product_id, customer_id, complaint_outcome_code, complaint_status_code, complaint_type_code, date_complaint_raised, date_complaint_closed, staff_id )
#
# Complaints.customer_id can be joined with Customers.customer_id
# Complaints.product_id can be joined with Products.product_id
# Complaints.staff_id can be joined with Staff.staff_id
#
### Question:
#
# What are lines 1 and 2 of the addressed of the customer with the email "vbogisich@example.org"?
#
### SQL:
#
# SELECT address_line_1 , address_line_2 FROM customers WHERE email_address = "vbogisich@example.org"
#
### End.
|
customer_complaints
|
### Complete SQL query only and with no explanation
### SQL tables followed by foreign key information:
#
# Staff ( staff_id, gender, first_name, last_name, email_address, phone_number )
# Customers ( customer_id, customer_type_code, address_line_1, address_line_2, town_city, state, email_address, phone_number )
# Products ( product_id, parent_product_id, product_category_code, date_product_first_available, date_product_discontinued, product_name, product_description, product_price )
# Complaints ( complaint_id, product_id, customer_id, complaint_outcome_code, complaint_status_code, complaint_type_code, date_complaint_raised, date_complaint_closed, staff_id )
#
# Complaints.customer_id can be joined with Customers.customer_id
# Complaints.product_id can be joined with Products.product_id
# Complaints.staff_id can be joined with Staff.staff_id
#
### Question:
#
# Find the number of complaints with Product Failure type for each complaint status.
#
### SQL:
#
# SELECT complaint_status_code , count(*) FROM complaints WHERE complaint_type_code = "Product Failure" GROUP BY complaint_status_code
#
### End.
|
customer_complaints
|
### Complete SQL query only and with no explanation
### SQL tables followed by foreign key information:
#
# Staff ( staff_id, gender, first_name, last_name, email_address, phone_number )
# Customers ( customer_id, customer_type_code, address_line_1, address_line_2, town_city, state, email_address, phone_number )
# Products ( product_id, parent_product_id, product_category_code, date_product_first_available, date_product_discontinued, product_name, product_description, product_price )
# Complaints ( complaint_id, product_id, customer_id, complaint_outcome_code, complaint_status_code, complaint_type_code, date_complaint_raised, date_complaint_closed, staff_id )
#
# Complaints.customer_id can be joined with Customers.customer_id
# Complaints.product_id can be joined with Products.product_id
# Complaints.staff_id can be joined with Staff.staff_id
#
### Question:
#
# Of complaints with the type code "Product Failure", how many had each different status code?
#
### SQL:
#
# SELECT complaint_status_code , count(*) FROM complaints WHERE complaint_type_code = "Product Failure" GROUP BY complaint_status_code
#
### End.
|
customer_complaints
|
### Complete SQL query only and with no explanation
### SQL tables followed by foreign key information:
#
# Staff ( staff_id, gender, first_name, last_name, email_address, phone_number )
# Customers ( customer_id, customer_type_code, address_line_1, address_line_2, town_city, state, email_address, phone_number )
# Products ( product_id, parent_product_id, product_category_code, date_product_first_available, date_product_discontinued, product_name, product_description, product_price )
# Complaints ( complaint_id, product_id, customer_id, complaint_outcome_code, complaint_status_code, complaint_type_code, date_complaint_raised, date_complaint_closed, staff_id )
#
# Complaints.customer_id can be joined with Customers.customer_id
# Complaints.product_id can be joined with Products.product_id
# Complaints.staff_id can be joined with Staff.staff_id
#
### Question:
#
# What is first names of the top 5 staff who have handled the greatest number of complaints?
#
### SQL:
#
# SELECT t1.first_name FROM staff AS t1 JOIN complaints AS t2 ON t1.staff_id = t2.staff_id GROUP BY t2.staff_id ORDER BY count(*) LIMIT 5
#
### End.
|
customer_complaints
|
### Complete SQL query only and with no explanation
### SQL tables followed by foreign key information:
#
# Staff ( staff_id, gender, first_name, last_name, email_address, phone_number )
# Customers ( customer_id, customer_type_code, address_line_1, address_line_2, town_city, state, email_address, phone_number )
# Products ( product_id, parent_product_id, product_category_code, date_product_first_available, date_product_discontinued, product_name, product_description, product_price )
# Complaints ( complaint_id, product_id, customer_id, complaint_outcome_code, complaint_status_code, complaint_type_code, date_complaint_raised, date_complaint_closed, staff_id )
#
# Complaints.customer_id can be joined with Customers.customer_id
# Complaints.product_id can be joined with Products.product_id
# Complaints.staff_id can be joined with Staff.staff_id
#
### Question:
#
# Return the first names of the 5 staff members who have handled the most complaints.
#
### SQL:
#
# SELECT t1.first_name FROM staff AS t1 JOIN complaints AS t2 ON t1.staff_id = t2.staff_id GROUP BY t2.staff_id ORDER BY count(*) LIMIT 5
#
### End.
|
customer_complaints
|
### Complete SQL query only and with no explanation
### SQL tables followed by foreign key information:
#
# Staff ( staff_id, gender, first_name, last_name, email_address, phone_number )
# Customers ( customer_id, customer_type_code, address_line_1, address_line_2, town_city, state, email_address, phone_number )
# Products ( product_id, parent_product_id, product_category_code, date_product_first_available, date_product_discontinued, product_name, product_description, product_price )
# Complaints ( complaint_id, product_id, customer_id, complaint_outcome_code, complaint_status_code, complaint_type_code, date_complaint_raised, date_complaint_closed, staff_id )
#
# Complaints.customer_id can be joined with Customers.customer_id
# Complaints.product_id can be joined with Products.product_id
# Complaints.staff_id can be joined with Staff.staff_id
#
### Question:
#
# Which state has the most customers?
#
### SQL:
#
# SELECT state FROM customers GROUP BY state ORDER BY count(*) LIMIT 1
#
### End.
|
customer_complaints
|
### Complete SQL query only and with no explanation
### SQL tables followed by foreign key information:
#
# Staff ( staff_id, gender, first_name, last_name, email_address, phone_number )
# Customers ( customer_id, customer_type_code, address_line_1, address_line_2, town_city, state, email_address, phone_number )
# Products ( product_id, parent_product_id, product_category_code, date_product_first_available, date_product_discontinued, product_name, product_description, product_price )
# Complaints ( complaint_id, product_id, customer_id, complaint_outcome_code, complaint_status_code, complaint_type_code, date_complaint_raised, date_complaint_closed, staff_id )
#
# Complaints.customer_id can be joined with Customers.customer_id
# Complaints.product_id can be joined with Products.product_id
# Complaints.staff_id can be joined with Staff.staff_id
#
### Question:
#
# Give the state that has the most customers.
#
### SQL:
#
# SELECT state FROM customers GROUP BY state ORDER BY count(*) LIMIT 1
#
### End.
|
workshop_paper
|
### Complete SQL query only and with no explanation
### SQL tables followed by foreign key information:
#
# workshop ( Workshop_ID, Date, Venue, Name )
# submission ( Submission_ID, Scores, Author, College )
# Acceptance ( Submission_ID, Workshop_ID, Result )
#
# Acceptance.Workshop_ID can be joined with workshop.Workshop_ID
# Acceptance.Submission_ID can be joined with submission.Submission_ID
#
### Question:
#
# How many submissions are there?
#
### SQL:
#
# SELECT count(*) FROM submission
#
### End.
|
workshop_paper
|
### Complete SQL query only and with no explanation
### SQL tables followed by foreign key information:
#
# workshop ( Workshop_ID, Date, Venue, Name )
# submission ( Submission_ID, Scores, Author, College )
# Acceptance ( Submission_ID, Workshop_ID, Result )
#
# Acceptance.Workshop_ID can be joined with workshop.Workshop_ID
# Acceptance.Submission_ID can be joined with submission.Submission_ID
#
### Question:
#
# Count the number of submissions.
#
### SQL:
#
# SELECT count(*) FROM submission
#
### End.
|
workshop_paper
|
### Complete SQL query only and with no explanation
### SQL tables followed by foreign key information:
#
# workshop ( Workshop_ID, Date, Venue, Name )
# submission ( Submission_ID, Scores, Author, College )
# Acceptance ( Submission_ID, Workshop_ID, Result )
#
# Acceptance.Workshop_ID can be joined with workshop.Workshop_ID
# Acceptance.Submission_ID can be joined with submission.Submission_ID
#
### Question:
#
# List the authors of submissions in ascending order of scores.
#
### SQL:
#
# SELECT Author FROM submission ORDER BY Scores ASC
#
### End.
|
workshop_paper
|
### Complete SQL query only and with no explanation
### SQL tables followed by foreign key information:
#
# workshop ( Workshop_ID, Date, Venue, Name )
# submission ( Submission_ID, Scores, Author, College )
# Acceptance ( Submission_ID, Workshop_ID, Result )
#
# Acceptance.Workshop_ID can be joined with workshop.Workshop_ID
# Acceptance.Submission_ID can be joined with submission.Submission_ID
#
### Question:
#
# Find the author for each submission and list them in ascending order of submission score.
#
### SQL:
#
# SELECT Author FROM submission ORDER BY Scores ASC
#
### End.
|
workshop_paper
|
### Complete SQL query only and with no explanation
### SQL tables followed by foreign key information:
#
# workshop ( Workshop_ID, Date, Venue, Name )
# submission ( Submission_ID, Scores, Author, College )
# Acceptance ( Submission_ID, Workshop_ID, Result )
#
# Acceptance.Workshop_ID can be joined with workshop.Workshop_ID
# Acceptance.Submission_ID can be joined with submission.Submission_ID
#
### Question:
#
# What are the authors of submissions and their colleges?
#
### SQL:
#
# SELECT Author , College FROM submission
#
### End.
|
workshop_paper
|
### Complete SQL query only and with no explanation
### SQL tables followed by foreign key information:
#
# workshop ( Workshop_ID, Date, Venue, Name )
# submission ( Submission_ID, Scores, Author, College )
# Acceptance ( Submission_ID, Workshop_ID, Result )
#
# Acceptance.Workshop_ID can be joined with workshop.Workshop_ID
# Acceptance.Submission_ID can be joined with submission.Submission_ID
#
### Question:
#
# For each submission, show the author and their affiliated college.
#
### SQL:
#
# SELECT Author , College FROM submission
#
### End.
|
workshop_paper
|
### Complete SQL query only and with no explanation
### SQL tables followed by foreign key information:
#
# workshop ( Workshop_ID, Date, Venue, Name )
# submission ( Submission_ID, Scores, Author, College )
# Acceptance ( Submission_ID, Workshop_ID, Result )
#
# Acceptance.Workshop_ID can be joined with workshop.Workshop_ID
# Acceptance.Submission_ID can be joined with submission.Submission_ID
#
### Question:
#
# Show the names of authors from college "Florida" or "Temple"
#
### SQL:
#
# SELECT Author FROM submission WHERE College = "Florida" OR College = "Temple"
#
### End.
|
workshop_paper
|
### Complete SQL query only and with no explanation
### SQL tables followed by foreign key information:
#
# workshop ( Workshop_ID, Date, Venue, Name )
# submission ( Submission_ID, Scores, Author, College )
# Acceptance ( Submission_ID, Workshop_ID, Result )
#
# Acceptance.Workshop_ID can be joined with workshop.Workshop_ID
# Acceptance.Submission_ID can be joined with submission.Submission_ID
#
### Question:
#
# Which authors with submissions are from college "Florida" or "Temple"?
#
### SQL:
#
# SELECT Author FROM submission WHERE College = "Florida" OR College = "Temple"
#
### End.
|
workshop_paper
|
### Complete SQL query only and with no explanation
### SQL tables followed by foreign key information:
#
# workshop ( Workshop_ID, Date, Venue, Name )
# submission ( Submission_ID, Scores, Author, College )
# Acceptance ( Submission_ID, Workshop_ID, Result )
#
# Acceptance.Workshop_ID can be joined with workshop.Workshop_ID
# Acceptance.Submission_ID can be joined with submission.Submission_ID
#
### Question:
#
# What is the average score of submissions?
#
### SQL:
#
# SELECT avg(Scores) FROM submission
#
### End.
|
workshop_paper
|
### Complete SQL query only and with no explanation
### SQL tables followed by foreign key information:
#
# workshop ( Workshop_ID, Date, Venue, Name )
# submission ( Submission_ID, Scores, Author, College )
# Acceptance ( Submission_ID, Workshop_ID, Result )
#
# Acceptance.Workshop_ID can be joined with workshop.Workshop_ID
# Acceptance.Submission_ID can be joined with submission.Submission_ID
#
### Question:
#
# Compute the average score of submissions.
#
### SQL:
#
# SELECT avg(Scores) FROM submission
#
### End.
|
workshop_paper
|
### Complete SQL query only and with no explanation
### SQL tables followed by foreign key information:
#
# workshop ( Workshop_ID, Date, Venue, Name )
# submission ( Submission_ID, Scores, Author, College )
# Acceptance ( Submission_ID, Workshop_ID, Result )
#
# Acceptance.Workshop_ID can be joined with workshop.Workshop_ID
# Acceptance.Submission_ID can be joined with submission.Submission_ID
#
### Question:
#
# What is the author of the submission with the highest score?
#
### SQL:
#
# SELECT Author FROM submission ORDER BY Scores DESC LIMIT 1
#
### End.
|
workshop_paper
|
### Complete SQL query only and with no explanation
### SQL tables followed by foreign key information:
#
# workshop ( Workshop_ID, Date, Venue, Name )
# submission ( Submission_ID, Scores, Author, College )
# Acceptance ( Submission_ID, Workshop_ID, Result )
#
# Acceptance.Workshop_ID can be joined with workshop.Workshop_ID
# Acceptance.Submission_ID can be joined with submission.Submission_ID
#
### Question:
#
# Find the author who achieved the highest score in a submission.
#
### SQL:
#
# SELECT Author FROM submission ORDER BY Scores DESC LIMIT 1
#
### End.
|
workshop_paper
|
### Complete SQL query only and with no explanation
### SQL tables followed by foreign key information:
#
# workshop ( Workshop_ID, Date, Venue, Name )
# submission ( Submission_ID, Scores, Author, College )
# Acceptance ( Submission_ID, Workshop_ID, Result )
#
# Acceptance.Workshop_ID can be joined with workshop.Workshop_ID
# Acceptance.Submission_ID can be joined with submission.Submission_ID
#
### Question:
#
# Show different colleges along with the number of authors of submission from each college.
#
### SQL:
#
# SELECT College , COUNT(*) FROM submission GROUP BY College
#
### End.
|
workshop_paper
|
### Complete SQL query only and with no explanation
### SQL tables followed by foreign key information:
#
# workshop ( Workshop_ID, Date, Venue, Name )
# submission ( Submission_ID, Scores, Author, College )
# Acceptance ( Submission_ID, Workshop_ID, Result )
#
# Acceptance.Workshop_ID can be joined with workshop.Workshop_ID
# Acceptance.Submission_ID can be joined with submission.Submission_ID
#
### Question:
#
# For each college, return the college name and the count of authors with submissions from that college.
#
### SQL:
#
# SELECT College , COUNT(*) FROM submission GROUP BY College
#
### End.
|
workshop_paper
|
### Complete SQL query only and with no explanation
### SQL tables followed by foreign key information:
#
# workshop ( Workshop_ID, Date, Venue, Name )
# submission ( Submission_ID, Scores, Author, College )
# Acceptance ( Submission_ID, Workshop_ID, Result )
#
# Acceptance.Workshop_ID can be joined with workshop.Workshop_ID
# Acceptance.Submission_ID can be joined with submission.Submission_ID
#
### Question:
#
# Show the most common college of authors of submissions.
#
### SQL:
#
# SELECT College FROM submission GROUP BY College ORDER BY COUNT(*) DESC LIMIT 1
#
### End.
|
workshop_paper
|
### Complete SQL query only and with no explanation
### SQL tables followed by foreign key information:
#
# workshop ( Workshop_ID, Date, Venue, Name )
# submission ( Submission_ID, Scores, Author, College )
# Acceptance ( Submission_ID, Workshop_ID, Result )
#
# Acceptance.Workshop_ID can be joined with workshop.Workshop_ID
# Acceptance.Submission_ID can be joined with submission.Submission_ID
#
### Question:
#
# Which college has the most authors with submissions?
#
### SQL:
#
# SELECT College FROM submission GROUP BY College ORDER BY COUNT(*) DESC LIMIT 1
#
### End.
|
workshop_paper
|
### Complete SQL query only and with no explanation
### SQL tables followed by foreign key information:
#
# workshop ( Workshop_ID, Date, Venue, Name )
# submission ( Submission_ID, Scores, Author, College )
# Acceptance ( Submission_ID, Workshop_ID, Result )
#
# Acceptance.Workshop_ID can be joined with workshop.Workshop_ID
# Acceptance.Submission_ID can be joined with submission.Submission_ID
#
### Question:
#
# Show the colleges that have both authors with submission score larger than 90 and authors with submission score smaller than 80.
#
### SQL:
#
# SELECT College FROM submission WHERE Scores > 90 INTERSECT SELECT College FROM submission WHERE Scores < 80
#
### End.
|
workshop_paper
|
### Complete SQL query only and with no explanation
### SQL tables followed by foreign key information:
#
# workshop ( Workshop_ID, Date, Venue, Name )
# submission ( Submission_ID, Scores, Author, College )
# Acceptance ( Submission_ID, Workshop_ID, Result )
#
# Acceptance.Workshop_ID can be joined with workshop.Workshop_ID
# Acceptance.Submission_ID can be joined with submission.Submission_ID
#
### Question:
#
# Which colleges have both authors with submission score above 90 and authors with submission score below 80?
#
### SQL:
#
# SELECT College FROM submission WHERE Scores > 90 INTERSECT SELECT College FROM submission WHERE Scores < 80
#
### End.
|
workshop_paper
|
### Complete SQL query only and with no explanation
### SQL tables followed by foreign key information:
#
# workshop ( Workshop_ID, Date, Venue, Name )
# submission ( Submission_ID, Scores, Author, College )
# Acceptance ( Submission_ID, Workshop_ID, Result )
#
# Acceptance.Workshop_ID can be joined with workshop.Workshop_ID
# Acceptance.Submission_ID can be joined with submission.Submission_ID
#
### Question:
#
# Show the authors of submissions and the acceptance results of their submissions.
#
### SQL:
#
# SELECT T2.Author , T1.Result FROM acceptance AS T1 JOIN submission AS T2 ON T1.Submission_ID = T2.Submission_ID
#
### End.
|
workshop_paper
|
### Complete SQL query only and with no explanation
### SQL tables followed by foreign key information:
#
# workshop ( Workshop_ID, Date, Venue, Name )
# submission ( Submission_ID, Scores, Author, College )
# Acceptance ( Submission_ID, Workshop_ID, Result )
#
# Acceptance.Workshop_ID can be joined with workshop.Workshop_ID
# Acceptance.Submission_ID can be joined with submission.Submission_ID
#
### Question:
#
# For each submission, find its author and acceptance result.
#
### SQL:
#
# SELECT T2.Author , T1.Result FROM acceptance AS T1 JOIN submission AS T2 ON T1.Submission_ID = T2.Submission_ID
#
### End.
|
workshop_paper
|
### Complete SQL query only and with no explanation
### SQL tables followed by foreign key information:
#
# workshop ( Workshop_ID, Date, Venue, Name )
# submission ( Submission_ID, Scores, Author, College )
# Acceptance ( Submission_ID, Workshop_ID, Result )
#
# Acceptance.Workshop_ID can be joined with workshop.Workshop_ID
# Acceptance.Submission_ID can be joined with submission.Submission_ID
#
### Question:
#
# Show the result of the submission with the highest score.
#
### SQL:
#
# SELECT T1.Result FROM acceptance AS T1 JOIN submission AS T2 ON T1.Submission_ID = T2.Submission_ID ORDER BY T2.Scores DESC LIMIT 1
#
### End.
|
workshop_paper
|
### Complete SQL query only and with no explanation
### SQL tables followed by foreign key information:
#
# workshop ( Workshop_ID, Date, Venue, Name )
# submission ( Submission_ID, Scores, Author, College )
# Acceptance ( Submission_ID, Workshop_ID, Result )
#
# Acceptance.Workshop_ID can be joined with workshop.Workshop_ID
# Acceptance.Submission_ID can be joined with submission.Submission_ID
#
### Question:
#
# Which submission received the highest score in acceptance result. Show me the result.
#
### SQL:
#
# SELECT T1.Result FROM acceptance AS T1 JOIN submission AS T2 ON T1.Submission_ID = T2.Submission_ID ORDER BY T2.Scores DESC LIMIT 1
#
### End.
|
workshop_paper
|
### Complete SQL query only and with no explanation
### SQL tables followed by foreign key information:
#
# workshop ( Workshop_ID, Date, Venue, Name )
# submission ( Submission_ID, Scores, Author, College )
# Acceptance ( Submission_ID, Workshop_ID, Result )
#
# Acceptance.Workshop_ID can be joined with workshop.Workshop_ID
# Acceptance.Submission_ID can be joined with submission.Submission_ID
#
### Question:
#
# Show each author and the number of workshops they submitted to.
#
### SQL:
#
# SELECT T2.Author , COUNT(DISTINCT T1.workshop_id) FROM acceptance AS T1 JOIN submission AS T2 ON T1.Submission_ID = T2.Submission_ID GROUP BY T2.Author
#
### End.
|
workshop_paper
|
### Complete SQL query only and with no explanation
### SQL tables followed by foreign key information:
#
# workshop ( Workshop_ID, Date, Venue, Name )
# submission ( Submission_ID, Scores, Author, College )
# Acceptance ( Submission_ID, Workshop_ID, Result )
#
# Acceptance.Workshop_ID can be joined with workshop.Workshop_ID
# Acceptance.Submission_ID can be joined with submission.Submission_ID
#
### Question:
#
# How many workshops did each author submit to? Return the author name and the number of workshops.
#
### SQL:
#
# SELECT T2.Author , COUNT(DISTINCT T1.workshop_id) FROM acceptance AS T1 JOIN submission AS T2 ON T1.Submission_ID = T2.Submission_ID GROUP BY T2.Author
#
### End.
|
workshop_paper
|
### Complete SQL query only and with no explanation
### SQL tables followed by foreign key information:
#
# workshop ( Workshop_ID, Date, Venue, Name )
# submission ( Submission_ID, Scores, Author, College )
# Acceptance ( Submission_ID, Workshop_ID, Result )
#
# Acceptance.Workshop_ID can be joined with workshop.Workshop_ID
# Acceptance.Submission_ID can be joined with submission.Submission_ID
#
### Question:
#
# Show the authors who have submissions to more than one workshop.
#
### SQL:
#
# SELECT T2.Author FROM acceptance AS T1 JOIN submission AS T2 ON T1.Submission_ID = T2.Submission_ID GROUP BY T2.Author HAVING COUNT(DISTINCT T1.workshop_id) > 1
#
### End.
|
workshop_paper
|
### Complete SQL query only and with no explanation
### SQL tables followed by foreign key information:
#
# workshop ( Workshop_ID, Date, Venue, Name )
# submission ( Submission_ID, Scores, Author, College )
# Acceptance ( Submission_ID, Workshop_ID, Result )
#
# Acceptance.Workshop_ID can be joined with workshop.Workshop_ID
# Acceptance.Submission_ID can be joined with submission.Submission_ID
#
### Question:
#
# Which authors have submitted to more than one workshop?
#
### SQL:
#
# SELECT T2.Author FROM acceptance AS T1 JOIN submission AS T2 ON T1.Submission_ID = T2.Submission_ID GROUP BY T2.Author HAVING COUNT(DISTINCT T1.workshop_id) > 1
#
### End.
|
workshop_paper
|
### Complete SQL query only and with no explanation
### SQL tables followed by foreign key information:
#
# workshop ( Workshop_ID, Date, Venue, Name )
# submission ( Submission_ID, Scores, Author, College )
# Acceptance ( Submission_ID, Workshop_ID, Result )
#
# Acceptance.Workshop_ID can be joined with workshop.Workshop_ID
# Acceptance.Submission_ID can be joined with submission.Submission_ID
#
### Question:
#
# Show the date and venue of each workshop in ascending alphabetical order of the venue.
#
### SQL:
#
# SELECT Date , Venue FROM workshop ORDER BY Venue
#
### End.
|
workshop_paper
|
### Complete SQL query only and with no explanation
### SQL tables followed by foreign key information:
#
# workshop ( Workshop_ID, Date, Venue, Name )
# submission ( Submission_ID, Scores, Author, College )
# Acceptance ( Submission_ID, Workshop_ID, Result )
#
# Acceptance.Workshop_ID can be joined with workshop.Workshop_ID
# Acceptance.Submission_ID can be joined with submission.Submission_ID
#
### Question:
#
# Sort the each workshop in alphabetical order of the venue. Return the date and venue of each workshop.
#
### SQL:
#
# SELECT Date , Venue FROM workshop ORDER BY Venue
#
### End.
|
workshop_paper
|
### Complete SQL query only and with no explanation
### SQL tables followed by foreign key information:
#
# workshop ( Workshop_ID, Date, Venue, Name )
# submission ( Submission_ID, Scores, Author, College )
# Acceptance ( Submission_ID, Workshop_ID, Result )
#
# Acceptance.Workshop_ID can be joined with workshop.Workshop_ID
# Acceptance.Submission_ID can be joined with submission.Submission_ID
#
### Question:
#
# List the authors who do not have submission to any workshop.
#
### SQL:
#
# SELECT Author FROM submission WHERE Submission_ID NOT IN (SELECT Submission_ID FROM acceptance)
#
### End.
|
workshop_paper
|
### Complete SQL query only and with no explanation
### SQL tables followed by foreign key information:
#
# workshop ( Workshop_ID, Date, Venue, Name )
# submission ( Submission_ID, Scores, Author, College )
# Acceptance ( Submission_ID, Workshop_ID, Result )
#
# Acceptance.Workshop_ID can be joined with workshop.Workshop_ID
# Acceptance.Submission_ID can be joined with submission.Submission_ID
#
### Question:
#
# Which authors did not submit to any workshop?
#
### SQL:
#
# SELECT Author FROM submission WHERE Submission_ID NOT IN (SELECT Submission_ID FROM acceptance)
#
### End.
|
tracking_share_transactions
|
### Complete SQL query only and with no explanation
### SQL tables followed by foreign key information:
#
# Investors ( investor_id, Investor_details )
# Lots ( lot_id, investor_id, lot_details )
# Ref_Transaction_Types ( transaction_type_code, transaction_type_description )
# Transactions ( transaction_id, investor_id, transaction_type_code, date_of_transaction, amount_of_transaction, share_count, other_details )
# Sales ( sales_transaction_id, sales_details )
# Purchases ( purchase_transaction_id, purchase_details )
# Transactions_Lots ( transaction_id, lot_id )
#
# Lots.investor_id can be joined with Investors.investor_id
# Transactions.transaction_type_code can be joined with Ref_Transaction_Types.transaction_type_code
# Transactions.investor_id can be joined with Investors.investor_id
# Sales.sales_transaction_id can be joined with Transactions.transaction_id
# Purchases.purchase_transaction_id can be joined with Transactions.transaction_id
# Transactions_Lots.transaction_id can be joined with Transactions.transaction_id
# Transactions_Lots.lot_id can be joined with Lots.lot_id
#
### Question:
#
# Find the number of investors in total.
#
### SQL:
#
# SELECT count(*) FROM INVESTORS
#
### End.
|
tracking_share_transactions
|
### Complete SQL query only and with no explanation
### SQL tables followed by foreign key information:
#
# Investors ( investor_id, Investor_details )
# Lots ( lot_id, investor_id, lot_details )
# Ref_Transaction_Types ( transaction_type_code, transaction_type_description )
# Transactions ( transaction_id, investor_id, transaction_type_code, date_of_transaction, amount_of_transaction, share_count, other_details )
# Sales ( sales_transaction_id, sales_details )
# Purchases ( purchase_transaction_id, purchase_details )
# Transactions_Lots ( transaction_id, lot_id )
#
# Lots.investor_id can be joined with Investors.investor_id
# Transactions.transaction_type_code can be joined with Ref_Transaction_Types.transaction_type_code
# Transactions.investor_id can be joined with Investors.investor_id
# Sales.sales_transaction_id can be joined with Transactions.transaction_id
# Purchases.purchase_transaction_id can be joined with Transactions.transaction_id
# Transactions_Lots.transaction_id can be joined with Transactions.transaction_id
# Transactions_Lots.lot_id can be joined with Lots.lot_id
#
### Question:
#
# Show all investor details.
#
### SQL:
#
# SELECT Investor_details FROM INVESTORS
#
### End.
|
tracking_share_transactions
|
### Complete SQL query only and with no explanation
### SQL tables followed by foreign key information:
#
# Investors ( investor_id, Investor_details )
# Lots ( lot_id, investor_id, lot_details )
# Ref_Transaction_Types ( transaction_type_code, transaction_type_description )
# Transactions ( transaction_id, investor_id, transaction_type_code, date_of_transaction, amount_of_transaction, share_count, other_details )
# Sales ( sales_transaction_id, sales_details )
# Purchases ( purchase_transaction_id, purchase_details )
# Transactions_Lots ( transaction_id, lot_id )
#
# Lots.investor_id can be joined with Investors.investor_id
# Transactions.transaction_type_code can be joined with Ref_Transaction_Types.transaction_type_code
# Transactions.investor_id can be joined with Investors.investor_id
# Sales.sales_transaction_id can be joined with Transactions.transaction_id
# Purchases.purchase_transaction_id can be joined with Transactions.transaction_id
# Transactions_Lots.transaction_id can be joined with Transactions.transaction_id
# Transactions_Lots.lot_id can be joined with Lots.lot_id
#
### Question:
#
# Show all distinct lot details.
#
### SQL:
#
# SELECT DISTINCT lot_details FROM LOTS
#
### End.
|
tracking_share_transactions
|
### Complete SQL query only and with no explanation
### SQL tables followed by foreign key information:
#
# Investors ( investor_id, Investor_details )
# Lots ( lot_id, investor_id, lot_details )
# Ref_Transaction_Types ( transaction_type_code, transaction_type_description )
# Transactions ( transaction_id, investor_id, transaction_type_code, date_of_transaction, amount_of_transaction, share_count, other_details )
# Sales ( sales_transaction_id, sales_details )
# Purchases ( purchase_transaction_id, purchase_details )
# Transactions_Lots ( transaction_id, lot_id )
#
# Lots.investor_id can be joined with Investors.investor_id
# Transactions.transaction_type_code can be joined with Ref_Transaction_Types.transaction_type_code
# Transactions.investor_id can be joined with Investors.investor_id
# Sales.sales_transaction_id can be joined with Transactions.transaction_id
# Purchases.purchase_transaction_id can be joined with Transactions.transaction_id
# Transactions_Lots.transaction_id can be joined with Transactions.transaction_id
# Transactions_Lots.lot_id can be joined with Lots.lot_id
#
### Question:
#
# Show the maximum amount of transaction.
#
### SQL:
#
# SELECT max(amount_of_transaction) FROM TRANSACTIONS
#
### End.
|
tracking_share_transactions
|
### Complete SQL query only and with no explanation
### SQL tables followed by foreign key information:
#
# Investors ( investor_id, Investor_details )
# Lots ( lot_id, investor_id, lot_details )
# Ref_Transaction_Types ( transaction_type_code, transaction_type_description )
# Transactions ( transaction_id, investor_id, transaction_type_code, date_of_transaction, amount_of_transaction, share_count, other_details )
# Sales ( sales_transaction_id, sales_details )
# Purchases ( purchase_transaction_id, purchase_details )
# Transactions_Lots ( transaction_id, lot_id )
#
# Lots.investor_id can be joined with Investors.investor_id
# Transactions.transaction_type_code can be joined with Ref_Transaction_Types.transaction_type_code
# Transactions.investor_id can be joined with Investors.investor_id
# Sales.sales_transaction_id can be joined with Transactions.transaction_id
# Purchases.purchase_transaction_id can be joined with Transactions.transaction_id
# Transactions_Lots.transaction_id can be joined with Transactions.transaction_id
# Transactions_Lots.lot_id can be joined with Lots.lot_id
#
### Question:
#
# Show all date and share count of transactions.
#
### SQL:
#
# SELECT date_of_transaction , share_count FROM TRANSACTIONS
#
### End.
|
tracking_share_transactions
|
### Complete SQL query only and with no explanation
### SQL tables followed by foreign key information:
#
# Investors ( investor_id, Investor_details )
# Lots ( lot_id, investor_id, lot_details )
# Ref_Transaction_Types ( transaction_type_code, transaction_type_description )
# Transactions ( transaction_id, investor_id, transaction_type_code, date_of_transaction, amount_of_transaction, share_count, other_details )
# Sales ( sales_transaction_id, sales_details )
# Purchases ( purchase_transaction_id, purchase_details )
# Transactions_Lots ( transaction_id, lot_id )
#
# Lots.investor_id can be joined with Investors.investor_id
# Transactions.transaction_type_code can be joined with Ref_Transaction_Types.transaction_type_code
# Transactions.investor_id can be joined with Investors.investor_id
# Sales.sales_transaction_id can be joined with Transactions.transaction_id
# Purchases.purchase_transaction_id can be joined with Transactions.transaction_id
# Transactions_Lots.transaction_id can be joined with Transactions.transaction_id
# Transactions_Lots.lot_id can be joined with Lots.lot_id
#
### Question:
#
# What is the total share of transactions?
#
### SQL:
#
# SELECT sum(share_count) FROM TRANSACTIONS
#
### End.
|
tracking_share_transactions
|
### Complete SQL query only and with no explanation
### SQL tables followed by foreign key information:
#
# Investors ( investor_id, Investor_details )
# Lots ( lot_id, investor_id, lot_details )
# Ref_Transaction_Types ( transaction_type_code, transaction_type_description )
# Transactions ( transaction_id, investor_id, transaction_type_code, date_of_transaction, amount_of_transaction, share_count, other_details )
# Sales ( sales_transaction_id, sales_details )
# Purchases ( purchase_transaction_id, purchase_details )
# Transactions_Lots ( transaction_id, lot_id )
#
# Lots.investor_id can be joined with Investors.investor_id
# Transactions.transaction_type_code can be joined with Ref_Transaction_Types.transaction_type_code
# Transactions.investor_id can be joined with Investors.investor_id
# Sales.sales_transaction_id can be joined with Transactions.transaction_id
# Purchases.purchase_transaction_id can be joined with Transactions.transaction_id
# Transactions_Lots.transaction_id can be joined with Transactions.transaction_id
# Transactions_Lots.lot_id can be joined with Lots.lot_id
#
### Question:
#
# Show all transaction ids with transaction code 'PUR'.
#
### SQL:
#
# SELECT transaction_id FROM TRANSACTIONS WHERE transaction_type_code = 'PUR'
#
### End.
|
tracking_share_transactions
|
### Complete SQL query only and with no explanation
### SQL tables followed by foreign key information:
#
# Investors ( investor_id, Investor_details )
# Lots ( lot_id, investor_id, lot_details )
# Ref_Transaction_Types ( transaction_type_code, transaction_type_description )
# Transactions ( transaction_id, investor_id, transaction_type_code, date_of_transaction, amount_of_transaction, share_count, other_details )
# Sales ( sales_transaction_id, sales_details )
# Purchases ( purchase_transaction_id, purchase_details )
# Transactions_Lots ( transaction_id, lot_id )
#
# Lots.investor_id can be joined with Investors.investor_id
# Transactions.transaction_type_code can be joined with Ref_Transaction_Types.transaction_type_code
# Transactions.investor_id can be joined with Investors.investor_id
# Sales.sales_transaction_id can be joined with Transactions.transaction_id
# Purchases.purchase_transaction_id can be joined with Transactions.transaction_id
# Transactions_Lots.transaction_id can be joined with Transactions.transaction_id
# Transactions_Lots.lot_id can be joined with Lots.lot_id
#
### Question:
#
# Show all dates of transactions whose type code is "SALE".
#
### SQL:
#
# SELECT date_of_transaction FROM TRANSACTIONS WHERE transaction_type_code = "SALE"
#
### End.
|
tracking_share_transactions
|
### Complete SQL query only and with no explanation
### SQL tables followed by foreign key information:
#
# Investors ( investor_id, Investor_details )
# Lots ( lot_id, investor_id, lot_details )
# Ref_Transaction_Types ( transaction_type_code, transaction_type_description )
# Transactions ( transaction_id, investor_id, transaction_type_code, date_of_transaction, amount_of_transaction, share_count, other_details )
# Sales ( sales_transaction_id, sales_details )
# Purchases ( purchase_transaction_id, purchase_details )
# Transactions_Lots ( transaction_id, lot_id )
#
# Lots.investor_id can be joined with Investors.investor_id
# Transactions.transaction_type_code can be joined with Ref_Transaction_Types.transaction_type_code
# Transactions.investor_id can be joined with Investors.investor_id
# Sales.sales_transaction_id can be joined with Transactions.transaction_id
# Purchases.purchase_transaction_id can be joined with Transactions.transaction_id
# Transactions_Lots.transaction_id can be joined with Transactions.transaction_id
# Transactions_Lots.lot_id can be joined with Lots.lot_id
#
### Question:
#
# Show the average amount of transactions with type code "SALE".
#
### SQL:
#
# SELECT avg(amount_of_transaction) FROM TRANSACTIONS WHERE transaction_type_code = "SALE"
#
### End.
|
tracking_share_transactions
|
### Complete SQL query only and with no explanation
### SQL tables followed by foreign key information:
#
# Investors ( investor_id, Investor_details )
# Lots ( lot_id, investor_id, lot_details )
# Ref_Transaction_Types ( transaction_type_code, transaction_type_description )
# Transactions ( transaction_id, investor_id, transaction_type_code, date_of_transaction, amount_of_transaction, share_count, other_details )
# Sales ( sales_transaction_id, sales_details )
# Purchases ( purchase_transaction_id, purchase_details )
# Transactions_Lots ( transaction_id, lot_id )
#
# Lots.investor_id can be joined with Investors.investor_id
# Transactions.transaction_type_code can be joined with Ref_Transaction_Types.transaction_type_code
# Transactions.investor_id can be joined with Investors.investor_id
# Sales.sales_transaction_id can be joined with Transactions.transaction_id
# Purchases.purchase_transaction_id can be joined with Transactions.transaction_id
# Transactions_Lots.transaction_id can be joined with Transactions.transaction_id
# Transactions_Lots.lot_id can be joined with Lots.lot_id
#
### Question:
#
# Show the description of transaction type with code "PUR".
#
### SQL:
#
# SELECT transaction_type_description FROM Ref_Transaction_Types WHERE transaction_type_code = "PUR"
#
### End.
|
tracking_share_transactions
|
### Complete SQL query only and with no explanation
### SQL tables followed by foreign key information:
#
# Investors ( investor_id, Investor_details )
# Lots ( lot_id, investor_id, lot_details )
# Ref_Transaction_Types ( transaction_type_code, transaction_type_description )
# Transactions ( transaction_id, investor_id, transaction_type_code, date_of_transaction, amount_of_transaction, share_count, other_details )
# Sales ( sales_transaction_id, sales_details )
# Purchases ( purchase_transaction_id, purchase_details )
# Transactions_Lots ( transaction_id, lot_id )
#
# Lots.investor_id can be joined with Investors.investor_id
# Transactions.transaction_type_code can be joined with Ref_Transaction_Types.transaction_type_code
# Transactions.investor_id can be joined with Investors.investor_id
# Sales.sales_transaction_id can be joined with Transactions.transaction_id
# Purchases.purchase_transaction_id can be joined with Transactions.transaction_id
# Transactions_Lots.transaction_id can be joined with Transactions.transaction_id
# Transactions_Lots.lot_id can be joined with Lots.lot_id
#
### Question:
#
# Show the minimum amount of transactions whose type code is "PUR" and whose share count is bigger than 50.
#
### SQL:
#
# SELECT min(amount_of_transaction) FROM TRANSACTIONS WHERE transaction_type_code = "PUR" AND share_count > 50
#
### End.
|
tracking_share_transactions
|
### Complete SQL query only and with no explanation
### SQL tables followed by foreign key information:
#
# Investors ( investor_id, Investor_details )
# Lots ( lot_id, investor_id, lot_details )
# Ref_Transaction_Types ( transaction_type_code, transaction_type_description )
# Transactions ( transaction_id, investor_id, transaction_type_code, date_of_transaction, amount_of_transaction, share_count, other_details )
# Sales ( sales_transaction_id, sales_details )
# Purchases ( purchase_transaction_id, purchase_details )
# Transactions_Lots ( transaction_id, lot_id )
#
# Lots.investor_id can be joined with Investors.investor_id
# Transactions.transaction_type_code can be joined with Ref_Transaction_Types.transaction_type_code
# Transactions.investor_id can be joined with Investors.investor_id
# Sales.sales_transaction_id can be joined with Transactions.transaction_id
# Purchases.purchase_transaction_id can be joined with Transactions.transaction_id
# Transactions_Lots.transaction_id can be joined with Transactions.transaction_id
# Transactions_Lots.lot_id can be joined with Lots.lot_id
#
### Question:
#
# Show the maximum share count of transactions where the amount is smaller than 10000
#
### SQL:
#
# SELECT max(share_count) FROM TRANSACTIONS WHERE amount_of_transaction < 10000
#
### End.
|
tracking_share_transactions
|
### Complete SQL query only and with no explanation
### SQL tables followed by foreign key information:
#
# Investors ( investor_id, Investor_details )
# Lots ( lot_id, investor_id, lot_details )
# Ref_Transaction_Types ( transaction_type_code, transaction_type_description )
# Transactions ( transaction_id, investor_id, transaction_type_code, date_of_transaction, amount_of_transaction, share_count, other_details )
# Sales ( sales_transaction_id, sales_details )
# Purchases ( purchase_transaction_id, purchase_details )
# Transactions_Lots ( transaction_id, lot_id )
#
# Lots.investor_id can be joined with Investors.investor_id
# Transactions.transaction_type_code can be joined with Ref_Transaction_Types.transaction_type_code
# Transactions.investor_id can be joined with Investors.investor_id
# Sales.sales_transaction_id can be joined with Transactions.transaction_id
# Purchases.purchase_transaction_id can be joined with Transactions.transaction_id
# Transactions_Lots.transaction_id can be joined with Transactions.transaction_id
# Transactions_Lots.lot_id can be joined with Lots.lot_id
#
### Question:
#
# Show the dates of transactions if the share count is bigger than 100 or the amount is bigger than 1000.
#
### SQL:
#
# SELECT date_of_transaction FROM TRANSACTIONS WHERE share_count > 100 OR amount_of_transaction > 1000
#
### End.
|
tracking_share_transactions
|
### Complete SQL query only and with no explanation
### SQL tables followed by foreign key information:
#
# Investors ( investor_id, Investor_details )
# Lots ( lot_id, investor_id, lot_details )
# Ref_Transaction_Types ( transaction_type_code, transaction_type_description )
# Transactions ( transaction_id, investor_id, transaction_type_code, date_of_transaction, amount_of_transaction, share_count, other_details )
# Sales ( sales_transaction_id, sales_details )
# Purchases ( purchase_transaction_id, purchase_details )
# Transactions_Lots ( transaction_id, lot_id )
#
# Lots.investor_id can be joined with Investors.investor_id
# Transactions.transaction_type_code can be joined with Ref_Transaction_Types.transaction_type_code
# Transactions.investor_id can be joined with Investors.investor_id
# Sales.sales_transaction_id can be joined with Transactions.transaction_id
# Purchases.purchase_transaction_id can be joined with Transactions.transaction_id
# Transactions_Lots.transaction_id can be joined with Transactions.transaction_id
# Transactions_Lots.lot_id can be joined with Lots.lot_id
#
### Question:
#
# Show the transaction type descriptions and dates if the share count is smaller than 10.
#
### SQL:
#
# SELECT T1.transaction_type_description , T2.date_of_transaction FROM Ref_Transaction_Types AS T1 JOIN TRANSACTIONS AS T2 ON T1.transaction_type_code = T2.transaction_type_code WHERE T2.share_count < 10
#
### End.
|
tracking_share_transactions
|
### Complete SQL query only and with no explanation
### SQL tables followed by foreign key information:
#
# Investors ( investor_id, Investor_details )
# Lots ( lot_id, investor_id, lot_details )
# Ref_Transaction_Types ( transaction_type_code, transaction_type_description )
# Transactions ( transaction_id, investor_id, transaction_type_code, date_of_transaction, amount_of_transaction, share_count, other_details )
# Sales ( sales_transaction_id, sales_details )
# Purchases ( purchase_transaction_id, purchase_details )
# Transactions_Lots ( transaction_id, lot_id )
#
# Lots.investor_id can be joined with Investors.investor_id
# Transactions.transaction_type_code can be joined with Ref_Transaction_Types.transaction_type_code
# Transactions.investor_id can be joined with Investors.investor_id
# Sales.sales_transaction_id can be joined with Transactions.transaction_id
# Purchases.purchase_transaction_id can be joined with Transactions.transaction_id
# Transactions_Lots.transaction_id can be joined with Transactions.transaction_id
# Transactions_Lots.lot_id can be joined with Lots.lot_id
#
### Question:
#
# Show details of all investors if they make any transaction with share count greater than 100.
#
### SQL:
#
# SELECT T1.Investor_details FROM INVESTORS AS T1 JOIN TRANSACTIONS AS T2 ON T1.investor_id = T2.investor_id WHERE T2.share_count > 100
#
### End.
|
tracking_share_transactions
|
### Complete SQL query only and with no explanation
### SQL tables followed by foreign key information:
#
# Investors ( investor_id, Investor_details )
# Lots ( lot_id, investor_id, lot_details )
# Ref_Transaction_Types ( transaction_type_code, transaction_type_description )
# Transactions ( transaction_id, investor_id, transaction_type_code, date_of_transaction, amount_of_transaction, share_count, other_details )
# Sales ( sales_transaction_id, sales_details )
# Purchases ( purchase_transaction_id, purchase_details )
# Transactions_Lots ( transaction_id, lot_id )
#
# Lots.investor_id can be joined with Investors.investor_id
# Transactions.transaction_type_code can be joined with Ref_Transaction_Types.transaction_type_code
# Transactions.investor_id can be joined with Investors.investor_id
# Sales.sales_transaction_id can be joined with Transactions.transaction_id
# Purchases.purchase_transaction_id can be joined with Transactions.transaction_id
# Transactions_Lots.transaction_id can be joined with Transactions.transaction_id
# Transactions_Lots.lot_id can be joined with Lots.lot_id
#
### Question:
#
# How many distinct transaction types are used in the transactions?
#
### SQL:
#
# SELECT COUNT(DISTINCT transaction_type_code) FROM TRANSACTIONS
#
### End.
|
tracking_share_transactions
|
### Complete SQL query only and with no explanation
### SQL tables followed by foreign key information:
#
# Investors ( investor_id, Investor_details )
# Lots ( lot_id, investor_id, lot_details )
# Ref_Transaction_Types ( transaction_type_code, transaction_type_description )
# Transactions ( transaction_id, investor_id, transaction_type_code, date_of_transaction, amount_of_transaction, share_count, other_details )
# Sales ( sales_transaction_id, sales_details )
# Purchases ( purchase_transaction_id, purchase_details )
# Transactions_Lots ( transaction_id, lot_id )
#
# Lots.investor_id can be joined with Investors.investor_id
# Transactions.transaction_type_code can be joined with Ref_Transaction_Types.transaction_type_code
# Transactions.investor_id can be joined with Investors.investor_id
# Sales.sales_transaction_id can be joined with Transactions.transaction_id
# Purchases.purchase_transaction_id can be joined with Transactions.transaction_id
# Transactions_Lots.transaction_id can be joined with Transactions.transaction_id
# Transactions_Lots.lot_id can be joined with Lots.lot_id
#
### Question:
#
# Return the lot details and investor ids.
#
### SQL:
#
# SELECT lot_details , investor_id FROM LOTS
#
### End.
|
tracking_share_transactions
|
### Complete SQL query only and with no explanation
### SQL tables followed by foreign key information:
#
# Investors ( investor_id, Investor_details )
# Lots ( lot_id, investor_id, lot_details )
# Ref_Transaction_Types ( transaction_type_code, transaction_type_description )
# Transactions ( transaction_id, investor_id, transaction_type_code, date_of_transaction, amount_of_transaction, share_count, other_details )
# Sales ( sales_transaction_id, sales_details )
# Purchases ( purchase_transaction_id, purchase_details )
# Transactions_Lots ( transaction_id, lot_id )
#
# Lots.investor_id can be joined with Investors.investor_id
# Transactions.transaction_type_code can be joined with Ref_Transaction_Types.transaction_type_code
# Transactions.investor_id can be joined with Investors.investor_id
# Sales.sales_transaction_id can be joined with Transactions.transaction_id
# Purchases.purchase_transaction_id can be joined with Transactions.transaction_id
# Transactions_Lots.transaction_id can be joined with Transactions.transaction_id
# Transactions_Lots.lot_id can be joined with Lots.lot_id
#
### Question:
#
# Return the lot details of lots that belong to investors with details "l"?
#
### SQL:
#
# SELECT T2.lot_details FROM INVESTORS AS T1 JOIN LOTS AS T2 ON T1.investor_id = T2.investor_id WHERE T1.Investor_details = "l"
#
### End.
|
tracking_share_transactions
|
### Complete SQL query only and with no explanation
### SQL tables followed by foreign key information:
#
# Investors ( investor_id, Investor_details )
# Lots ( lot_id, investor_id, lot_details )
# Ref_Transaction_Types ( transaction_type_code, transaction_type_description )
# Transactions ( transaction_id, investor_id, transaction_type_code, date_of_transaction, amount_of_transaction, share_count, other_details )
# Sales ( sales_transaction_id, sales_details )
# Purchases ( purchase_transaction_id, purchase_details )
# Transactions_Lots ( transaction_id, lot_id )
#
# Lots.investor_id can be joined with Investors.investor_id
# Transactions.transaction_type_code can be joined with Ref_Transaction_Types.transaction_type_code
# Transactions.investor_id can be joined with Investors.investor_id
# Sales.sales_transaction_id can be joined with Transactions.transaction_id
# Purchases.purchase_transaction_id can be joined with Transactions.transaction_id
# Transactions_Lots.transaction_id can be joined with Transactions.transaction_id
# Transactions_Lots.lot_id can be joined with Lots.lot_id
#
### Question:
#
# What are the purchase details of transactions with amount bigger than 10000?
#
### SQL:
#
# SELECT T1.purchase_details FROM PURCHASES AS T1 JOIN TRANSACTIONS AS T2 ON T1.purchase_transaction_id = T2.transaction_id WHERE T2.amount_of_transaction > 10000
#
### End.
|
tracking_share_transactions
|
### Complete SQL query only and with no explanation
### SQL tables followed by foreign key information:
#
# Investors ( investor_id, Investor_details )
# Lots ( lot_id, investor_id, lot_details )
# Ref_Transaction_Types ( transaction_type_code, transaction_type_description )
# Transactions ( transaction_id, investor_id, transaction_type_code, date_of_transaction, amount_of_transaction, share_count, other_details )
# Sales ( sales_transaction_id, sales_details )
# Purchases ( purchase_transaction_id, purchase_details )
# Transactions_Lots ( transaction_id, lot_id )
#
# Lots.investor_id can be joined with Investors.investor_id
# Transactions.transaction_type_code can be joined with Ref_Transaction_Types.transaction_type_code
# Transactions.investor_id can be joined with Investors.investor_id
# Sales.sales_transaction_id can be joined with Transactions.transaction_id
# Purchases.purchase_transaction_id can be joined with Transactions.transaction_id
# Transactions_Lots.transaction_id can be joined with Transactions.transaction_id
# Transactions_Lots.lot_id can be joined with Lots.lot_id
#
### Question:
#
# What are the sale details and dates of transactions with amount smaller than 3000?
#
### SQL:
#
# SELECT T1.sales_details , T2.date_of_transaction FROM SALES AS T1 JOIN TRANSACTIONS AS T2 ON T1.sales_transaction_id = T2.transaction_id WHERE T2.amount_of_transaction < 3000
#
### End.
|
tracking_share_transactions
|
### Complete SQL query only and with no explanation
### SQL tables followed by foreign key information:
#
# Investors ( investor_id, Investor_details )
# Lots ( lot_id, investor_id, lot_details )
# Ref_Transaction_Types ( transaction_type_code, transaction_type_description )
# Transactions ( transaction_id, investor_id, transaction_type_code, date_of_transaction, amount_of_transaction, share_count, other_details )
# Sales ( sales_transaction_id, sales_details )
# Purchases ( purchase_transaction_id, purchase_details )
# Transactions_Lots ( transaction_id, lot_id )
#
# Lots.investor_id can be joined with Investors.investor_id
# Transactions.transaction_type_code can be joined with Ref_Transaction_Types.transaction_type_code
# Transactions.investor_id can be joined with Investors.investor_id
# Sales.sales_transaction_id can be joined with Transactions.transaction_id
# Purchases.purchase_transaction_id can be joined with Transactions.transaction_id
# Transactions_Lots.transaction_id can be joined with Transactions.transaction_id
# Transactions_Lots.lot_id can be joined with Lots.lot_id
#
### Question:
#
# What are the lot details of lots associated with transactions with share count smaller than 50?
#
### SQL:
#
# SELECT T1.lot_details FROM LOTS AS T1 JOIN TRANSACTIONS_LOTS AS T2 ON T1.lot_id = T2.transaction_id JOIN TRANSACTIONS AS T3 ON T2.transaction_id = T3.transaction_id WHERE T3.share_count < 50
#
### End.
|
tracking_share_transactions
|
### Complete SQL query only and with no explanation
### SQL tables followed by foreign key information:
#
# Investors ( investor_id, Investor_details )
# Lots ( lot_id, investor_id, lot_details )
# Ref_Transaction_Types ( transaction_type_code, transaction_type_description )
# Transactions ( transaction_id, investor_id, transaction_type_code, date_of_transaction, amount_of_transaction, share_count, other_details )
# Sales ( sales_transaction_id, sales_details )
# Purchases ( purchase_transaction_id, purchase_details )
# Transactions_Lots ( transaction_id, lot_id )
#
# Lots.investor_id can be joined with Investors.investor_id
# Transactions.transaction_type_code can be joined with Ref_Transaction_Types.transaction_type_code
# Transactions.investor_id can be joined with Investors.investor_id
# Sales.sales_transaction_id can be joined with Transactions.transaction_id
# Purchases.purchase_transaction_id can be joined with Transactions.transaction_id
# Transactions_Lots.transaction_id can be joined with Transactions.transaction_id
# Transactions_Lots.lot_id can be joined with Lots.lot_id
#
### Question:
#
# What are the lot details of lots associated with transactions whose share count is bigger than 100 and whose type code is "PUR"?
#
### SQL:
#
# SELECT T1.lot_details FROM LOTS AS T1 JOIN TRANSACTIONS_LOTS AS T2 ON T1.lot_id = T2.transaction_id JOIN TRANSACTIONS AS T3 ON T2.transaction_id = T3.transaction_id WHERE T3.share_count > 100 AND T3.transaction_type_code = "PUR"
#
### End.
|
tracking_share_transactions
|
### Complete SQL query only and with no explanation
### SQL tables followed by foreign key information:
#
# Investors ( investor_id, Investor_details )
# Lots ( lot_id, investor_id, lot_details )
# Ref_Transaction_Types ( transaction_type_code, transaction_type_description )
# Transactions ( transaction_id, investor_id, transaction_type_code, date_of_transaction, amount_of_transaction, share_count, other_details )
# Sales ( sales_transaction_id, sales_details )
# Purchases ( purchase_transaction_id, purchase_details )
# Transactions_Lots ( transaction_id, lot_id )
#
# Lots.investor_id can be joined with Investors.investor_id
# Transactions.transaction_type_code can be joined with Ref_Transaction_Types.transaction_type_code
# Transactions.investor_id can be joined with Investors.investor_id
# Sales.sales_transaction_id can be joined with Transactions.transaction_id
# Purchases.purchase_transaction_id can be joined with Transactions.transaction_id
# Transactions_Lots.transaction_id can be joined with Transactions.transaction_id
# Transactions_Lots.lot_id can be joined with Lots.lot_id
#
### Question:
#
# Show the average transaction amount for different transaction types.
#
### SQL:
#
# SELECT transaction_type_code , avg(amount_of_transaction) FROM TRANSACTIONS GROUP BY transaction_type_code
#
### End.
|
tracking_share_transactions
|
### Complete SQL query only and with no explanation
### SQL tables followed by foreign key information:
#
# Investors ( investor_id, Investor_details )
# Lots ( lot_id, investor_id, lot_details )
# Ref_Transaction_Types ( transaction_type_code, transaction_type_description )
# Transactions ( transaction_id, investor_id, transaction_type_code, date_of_transaction, amount_of_transaction, share_count, other_details )
# Sales ( sales_transaction_id, sales_details )
# Purchases ( purchase_transaction_id, purchase_details )
# Transactions_Lots ( transaction_id, lot_id )
#
# Lots.investor_id can be joined with Investors.investor_id
# Transactions.transaction_type_code can be joined with Ref_Transaction_Types.transaction_type_code
# Transactions.investor_id can be joined with Investors.investor_id
# Sales.sales_transaction_id can be joined with Transactions.transaction_id
# Purchases.purchase_transaction_id can be joined with Transactions.transaction_id
# Transactions_Lots.transaction_id can be joined with Transactions.transaction_id
# Transactions_Lots.lot_id can be joined with Lots.lot_id
#
### Question:
#
# Show the maximum and minimum share count of different transaction types.
#
### SQL:
#
# SELECT transaction_type_code , max(share_count) , min(share_count) FROM TRANSACTIONS GROUP BY transaction_type_code
#
### End.
|
tracking_share_transactions
|
### Complete SQL query only and with no explanation
### SQL tables followed by foreign key information:
#
# Investors ( investor_id, Investor_details )
# Lots ( lot_id, investor_id, lot_details )
# Ref_Transaction_Types ( transaction_type_code, transaction_type_description )
# Transactions ( transaction_id, investor_id, transaction_type_code, date_of_transaction, amount_of_transaction, share_count, other_details )
# Sales ( sales_transaction_id, sales_details )
# Purchases ( purchase_transaction_id, purchase_details )
# Transactions_Lots ( transaction_id, lot_id )
#
# Lots.investor_id can be joined with Investors.investor_id
# Transactions.transaction_type_code can be joined with Ref_Transaction_Types.transaction_type_code
# Transactions.investor_id can be joined with Investors.investor_id
# Sales.sales_transaction_id can be joined with Transactions.transaction_id
# Purchases.purchase_transaction_id can be joined with Transactions.transaction_id
# Transactions_Lots.transaction_id can be joined with Transactions.transaction_id
# Transactions_Lots.lot_id can be joined with Lots.lot_id
#
### Question:
#
# Show the average share count of transactions for different investors.
#
### SQL:
#
# SELECT investor_id , avg(share_count) FROM TRANSACTIONS GROUP BY investor_id
#
### End.
|
tracking_share_transactions
|
### Complete SQL query only and with no explanation
### SQL tables followed by foreign key information:
#
# Investors ( investor_id, Investor_details )
# Lots ( lot_id, investor_id, lot_details )
# Ref_Transaction_Types ( transaction_type_code, transaction_type_description )
# Transactions ( transaction_id, investor_id, transaction_type_code, date_of_transaction, amount_of_transaction, share_count, other_details )
# Sales ( sales_transaction_id, sales_details )
# Purchases ( purchase_transaction_id, purchase_details )
# Transactions_Lots ( transaction_id, lot_id )
#
# Lots.investor_id can be joined with Investors.investor_id
# Transactions.transaction_type_code can be joined with Ref_Transaction_Types.transaction_type_code
# Transactions.investor_id can be joined with Investors.investor_id
# Sales.sales_transaction_id can be joined with Transactions.transaction_id
# Purchases.purchase_transaction_id can be joined with Transactions.transaction_id
# Transactions_Lots.transaction_id can be joined with Transactions.transaction_id
# Transactions_Lots.lot_id can be joined with Lots.lot_id
#
### Question:
#
# Show the average share count of transactions each each investor, ordered by average share count.
#
### SQL:
#
# SELECT investor_id , avg(share_count) FROM TRANSACTIONS GROUP BY investor_id ORDER BY avg(share_count)
#
### End.
|
tracking_share_transactions
|
### Complete SQL query only and with no explanation
### SQL tables followed by foreign key information:
#
# Investors ( investor_id, Investor_details )
# Lots ( lot_id, investor_id, lot_details )
# Ref_Transaction_Types ( transaction_type_code, transaction_type_description )
# Transactions ( transaction_id, investor_id, transaction_type_code, date_of_transaction, amount_of_transaction, share_count, other_details )
# Sales ( sales_transaction_id, sales_details )
# Purchases ( purchase_transaction_id, purchase_details )
# Transactions_Lots ( transaction_id, lot_id )
#
# Lots.investor_id can be joined with Investors.investor_id
# Transactions.transaction_type_code can be joined with Ref_Transaction_Types.transaction_type_code
# Transactions.investor_id can be joined with Investors.investor_id
# Sales.sales_transaction_id can be joined with Transactions.transaction_id
# Purchases.purchase_transaction_id can be joined with Transactions.transaction_id
# Transactions_Lots.transaction_id can be joined with Transactions.transaction_id
# Transactions_Lots.lot_id can be joined with Lots.lot_id
#
### Question:
#
# Show the average amount of transactions for different investors.
#
### SQL:
#
# SELECT investor_id , avg(amount_of_transaction) FROM TRANSACTIONS GROUP BY investor_id
#
### End.
|
tracking_share_transactions
|
### Complete SQL query only and with no explanation
### SQL tables followed by foreign key information:
#
# Investors ( investor_id, Investor_details )
# Lots ( lot_id, investor_id, lot_details )
# Ref_Transaction_Types ( transaction_type_code, transaction_type_description )
# Transactions ( transaction_id, investor_id, transaction_type_code, date_of_transaction, amount_of_transaction, share_count, other_details )
# Sales ( sales_transaction_id, sales_details )
# Purchases ( purchase_transaction_id, purchase_details )
# Transactions_Lots ( transaction_id, lot_id )
#
# Lots.investor_id can be joined with Investors.investor_id
# Transactions.transaction_type_code can be joined with Ref_Transaction_Types.transaction_type_code
# Transactions.investor_id can be joined with Investors.investor_id
# Sales.sales_transaction_id can be joined with Transactions.transaction_id
# Purchases.purchase_transaction_id can be joined with Transactions.transaction_id
# Transactions_Lots.transaction_id can be joined with Transactions.transaction_id
# Transactions_Lots.lot_id can be joined with Lots.lot_id
#
### Question:
#
# Show the average amount of transactions for different lots.
#
### SQL:
#
# SELECT T2.lot_id , avg(amount_of_transaction) FROM TRANSACTIONS AS T1 JOIN Transactions_Lots AS T2 ON T1.transaction_id = T2.transaction_id GROUP BY T2.lot_id
#
### End.
|
tracking_share_transactions
|
### Complete SQL query only and with no explanation
### SQL tables followed by foreign key information:
#
# Investors ( investor_id, Investor_details )
# Lots ( lot_id, investor_id, lot_details )
# Ref_Transaction_Types ( transaction_type_code, transaction_type_description )
# Transactions ( transaction_id, investor_id, transaction_type_code, date_of_transaction, amount_of_transaction, share_count, other_details )
# Sales ( sales_transaction_id, sales_details )
# Purchases ( purchase_transaction_id, purchase_details )
# Transactions_Lots ( transaction_id, lot_id )
#
# Lots.investor_id can be joined with Investors.investor_id
# Transactions.transaction_type_code can be joined with Ref_Transaction_Types.transaction_type_code
# Transactions.investor_id can be joined with Investors.investor_id
# Sales.sales_transaction_id can be joined with Transactions.transaction_id
# Purchases.purchase_transaction_id can be joined with Transactions.transaction_id
# Transactions_Lots.transaction_id can be joined with Transactions.transaction_id
# Transactions_Lots.lot_id can be joined with Lots.lot_id
#
### Question:
#
# Show the average amount of transactions for different lots, ordered by average amount of transactions.
#
### SQL:
#
# SELECT T2.lot_id , avg(amount_of_transaction) FROM TRANSACTIONS AS T1 JOIN Transactions_Lots AS T2 ON T1.transaction_id = T2.transaction_id GROUP BY T2.lot_id ORDER BY avg(amount_of_transaction)
#
### End.
|
tracking_share_transactions
|
### Complete SQL query only and with no explanation
### SQL tables followed by foreign key information:
#
# Investors ( investor_id, Investor_details )
# Lots ( lot_id, investor_id, lot_details )
# Ref_Transaction_Types ( transaction_type_code, transaction_type_description )
# Transactions ( transaction_id, investor_id, transaction_type_code, date_of_transaction, amount_of_transaction, share_count, other_details )
# Sales ( sales_transaction_id, sales_details )
# Purchases ( purchase_transaction_id, purchase_details )
# Transactions_Lots ( transaction_id, lot_id )
#
# Lots.investor_id can be joined with Investors.investor_id
# Transactions.transaction_type_code can be joined with Ref_Transaction_Types.transaction_type_code
# Transactions.investor_id can be joined with Investors.investor_id
# Sales.sales_transaction_id can be joined with Transactions.transaction_id
# Purchases.purchase_transaction_id can be joined with Transactions.transaction_id
# Transactions_Lots.transaction_id can be joined with Transactions.transaction_id
# Transactions_Lots.lot_id can be joined with Lots.lot_id
#
### Question:
#
# Show the number of transactions with transaction type code "SALE" for different investors if it is larger than 0.
#
### SQL:
#
# SELECT investor_id , COUNT(*) FROM TRANSACTIONS WHERE transaction_type_code = "SALE" GROUP BY investor_id
#
### End.
|
tracking_share_transactions
|
### Complete SQL query only and with no explanation
### SQL tables followed by foreign key information:
#
# Investors ( investor_id, Investor_details )
# Lots ( lot_id, investor_id, lot_details )
# Ref_Transaction_Types ( transaction_type_code, transaction_type_description )
# Transactions ( transaction_id, investor_id, transaction_type_code, date_of_transaction, amount_of_transaction, share_count, other_details )
# Sales ( sales_transaction_id, sales_details )
# Purchases ( purchase_transaction_id, purchase_details )
# Transactions_Lots ( transaction_id, lot_id )
#
# Lots.investor_id can be joined with Investors.investor_id
# Transactions.transaction_type_code can be joined with Ref_Transaction_Types.transaction_type_code
# Transactions.investor_id can be joined with Investors.investor_id
# Sales.sales_transaction_id can be joined with Transactions.transaction_id
# Purchases.purchase_transaction_id can be joined with Transactions.transaction_id
# Transactions_Lots.transaction_id can be joined with Transactions.transaction_id
# Transactions_Lots.lot_id can be joined with Lots.lot_id
#
### Question:
#
# Show the number of transactions for different investors.
#
### SQL:
#
# SELECT investor_id , COUNT(*) FROM TRANSACTIONS GROUP BY investor_id
#
### End.
|
tracking_share_transactions
|
### Complete SQL query only and with no explanation
### SQL tables followed by foreign key information:
#
# Investors ( investor_id, Investor_details )
# Lots ( lot_id, investor_id, lot_details )
# Ref_Transaction_Types ( transaction_type_code, transaction_type_description )
# Transactions ( transaction_id, investor_id, transaction_type_code, date_of_transaction, amount_of_transaction, share_count, other_details )
# Sales ( sales_transaction_id, sales_details )
# Purchases ( purchase_transaction_id, purchase_details )
# Transactions_Lots ( transaction_id, lot_id )
#
# Lots.investor_id can be joined with Investors.investor_id
# Transactions.transaction_type_code can be joined with Ref_Transaction_Types.transaction_type_code
# Transactions.investor_id can be joined with Investors.investor_id
# Sales.sales_transaction_id can be joined with Transactions.transaction_id
# Purchases.purchase_transaction_id can be joined with Transactions.transaction_id
# Transactions_Lots.transaction_id can be joined with Transactions.transaction_id
# Transactions_Lots.lot_id can be joined with Lots.lot_id
#
### Question:
#
# Show the transaction type code that occurs the fewest times.
#
### SQL:
#
# SELECT transaction_type_code FROM TRANSACTIONS GROUP BY transaction_type_code ORDER BY COUNT(*) ASC LIMIT 1
#
### End.
|
tracking_share_transactions
|
### Complete SQL query only and with no explanation
### SQL tables followed by foreign key information:
#
# Investors ( investor_id, Investor_details )
# Lots ( lot_id, investor_id, lot_details )
# Ref_Transaction_Types ( transaction_type_code, transaction_type_description )
# Transactions ( transaction_id, investor_id, transaction_type_code, date_of_transaction, amount_of_transaction, share_count, other_details )
# Sales ( sales_transaction_id, sales_details )
# Purchases ( purchase_transaction_id, purchase_details )
# Transactions_Lots ( transaction_id, lot_id )
#
# Lots.investor_id can be joined with Investors.investor_id
# Transactions.transaction_type_code can be joined with Ref_Transaction_Types.transaction_type_code
# Transactions.investor_id can be joined with Investors.investor_id
# Sales.sales_transaction_id can be joined with Transactions.transaction_id
# Purchases.purchase_transaction_id can be joined with Transactions.transaction_id
# Transactions_Lots.transaction_id can be joined with Transactions.transaction_id
# Transactions_Lots.lot_id can be joined with Lots.lot_id
#
### Question:
#
# Show the transaction type code that occurs the most frequently.
#
### SQL:
#
# SELECT transaction_type_code FROM TRANSACTIONS GROUP BY transaction_type_code ORDER BY COUNT(*) DESC LIMIT 1
#
### End.
|
tracking_share_transactions
|
### Complete SQL query only and with no explanation
### SQL tables followed by foreign key information:
#
# Investors ( investor_id, Investor_details )
# Lots ( lot_id, investor_id, lot_details )
# Ref_Transaction_Types ( transaction_type_code, transaction_type_description )
# Transactions ( transaction_id, investor_id, transaction_type_code, date_of_transaction, amount_of_transaction, share_count, other_details )
# Sales ( sales_transaction_id, sales_details )
# Purchases ( purchase_transaction_id, purchase_details )
# Transactions_Lots ( transaction_id, lot_id )
#
# Lots.investor_id can be joined with Investors.investor_id
# Transactions.transaction_type_code can be joined with Ref_Transaction_Types.transaction_type_code
# Transactions.investor_id can be joined with Investors.investor_id
# Sales.sales_transaction_id can be joined with Transactions.transaction_id
# Purchases.purchase_transaction_id can be joined with Transactions.transaction_id
# Transactions_Lots.transaction_id can be joined with Transactions.transaction_id
# Transactions_Lots.lot_id can be joined with Lots.lot_id
#
### Question:
#
# Show the description of the transaction type that occurs most frequently.
#
### SQL:
#
# SELECT T1.transaction_type_description FROM Ref_Transaction_Types AS T1 JOIN TRANSACTIONS AS T2 ON T1.transaction_type_code = T2.transaction_type_code GROUP BY T1.transaction_type_code ORDER BY COUNT(*) DESC LIMIT 1
#
### End.
|
tracking_share_transactions
|
### Complete SQL query only and with no explanation
### SQL tables followed by foreign key information:
#
# Investors ( investor_id, Investor_details )
# Lots ( lot_id, investor_id, lot_details )
# Ref_Transaction_Types ( transaction_type_code, transaction_type_description )
# Transactions ( transaction_id, investor_id, transaction_type_code, date_of_transaction, amount_of_transaction, share_count, other_details )
# Sales ( sales_transaction_id, sales_details )
# Purchases ( purchase_transaction_id, purchase_details )
# Transactions_Lots ( transaction_id, lot_id )
#
# Lots.investor_id can be joined with Investors.investor_id
# Transactions.transaction_type_code can be joined with Ref_Transaction_Types.transaction_type_code
# Transactions.investor_id can be joined with Investors.investor_id
# Sales.sales_transaction_id can be joined with Transactions.transaction_id
# Purchases.purchase_transaction_id can be joined with Transactions.transaction_id
# Transactions_Lots.transaction_id can be joined with Transactions.transaction_id
# Transactions_Lots.lot_id can be joined with Lots.lot_id
#
### Question:
#
# Show the id and details of the investor that has the largest number of transactions.
#
### SQL:
#
# SELECT T2.investor_id , T1.Investor_details FROM INVESTORS AS T1 JOIN TRANSACTIONS AS T2 ON T1.investor_id = T2.investor_id GROUP BY T2.investor_id ORDER BY COUNT(*) DESC LIMIT 1
#
### End.
|
tracking_share_transactions
|
### Complete SQL query only and with no explanation
### SQL tables followed by foreign key information:
#
# Investors ( investor_id, Investor_details )
# Lots ( lot_id, investor_id, lot_details )
# Ref_Transaction_Types ( transaction_type_code, transaction_type_description )
# Transactions ( transaction_id, investor_id, transaction_type_code, date_of_transaction, amount_of_transaction, share_count, other_details )
# Sales ( sales_transaction_id, sales_details )
# Purchases ( purchase_transaction_id, purchase_details )
# Transactions_Lots ( transaction_id, lot_id )
#
# Lots.investor_id can be joined with Investors.investor_id
# Transactions.transaction_type_code can be joined with Ref_Transaction_Types.transaction_type_code
# Transactions.investor_id can be joined with Investors.investor_id
# Sales.sales_transaction_id can be joined with Transactions.transaction_id
# Purchases.purchase_transaction_id can be joined with Transactions.transaction_id
# Transactions_Lots.transaction_id can be joined with Transactions.transaction_id
# Transactions_Lots.lot_id can be joined with Lots.lot_id
#
### Question:
#
# Show the id and details for the investors who have the top 3 number of transactions.
#
### SQL:
#
# SELECT T2.investor_id , T1.Investor_details FROM INVESTORS AS T1 JOIN TRANSACTIONS AS T2 ON T1.investor_id = T2.investor_id GROUP BY T2.investor_id ORDER BY COUNT(*) DESC LIMIT 3
#
### End.
|
tracking_share_transactions
|
### Complete SQL query only and with no explanation
### SQL tables followed by foreign key information:
#
# Investors ( investor_id, Investor_details )
# Lots ( lot_id, investor_id, lot_details )
# Ref_Transaction_Types ( transaction_type_code, transaction_type_description )
# Transactions ( transaction_id, investor_id, transaction_type_code, date_of_transaction, amount_of_transaction, share_count, other_details )
# Sales ( sales_transaction_id, sales_details )
# Purchases ( purchase_transaction_id, purchase_details )
# Transactions_Lots ( transaction_id, lot_id )
#
# Lots.investor_id can be joined with Investors.investor_id
# Transactions.transaction_type_code can be joined with Ref_Transaction_Types.transaction_type_code
# Transactions.investor_id can be joined with Investors.investor_id
# Sales.sales_transaction_id can be joined with Transactions.transaction_id
# Purchases.purchase_transaction_id can be joined with Transactions.transaction_id
# Transactions_Lots.transaction_id can be joined with Transactions.transaction_id
# Transactions_Lots.lot_id can be joined with Lots.lot_id
#
### Question:
#
# Show the ids of the investors who have at least two transactions.
#
### SQL:
#
# SELECT T2.investor_id FROM INVESTORS AS T1 JOIN TRANSACTIONS AS T2 ON T1.investor_id = T2.investor_id GROUP BY T2.investor_id HAVING COUNT(*) >= 2
#
### End.
|
tracking_share_transactions
|
### Complete SQL query only and with no explanation
### SQL tables followed by foreign key information:
#
# Investors ( investor_id, Investor_details )
# Lots ( lot_id, investor_id, lot_details )
# Ref_Transaction_Types ( transaction_type_code, transaction_type_description )
# Transactions ( transaction_id, investor_id, transaction_type_code, date_of_transaction, amount_of_transaction, share_count, other_details )
# Sales ( sales_transaction_id, sales_details )
# Purchases ( purchase_transaction_id, purchase_details )
# Transactions_Lots ( transaction_id, lot_id )
#
# Lots.investor_id can be joined with Investors.investor_id
# Transactions.transaction_type_code can be joined with Ref_Transaction_Types.transaction_type_code
# Transactions.investor_id can be joined with Investors.investor_id
# Sales.sales_transaction_id can be joined with Transactions.transaction_id
# Purchases.purchase_transaction_id can be joined with Transactions.transaction_id
# Transactions_Lots.transaction_id can be joined with Transactions.transaction_id
# Transactions_Lots.lot_id can be joined with Lots.lot_id
#
### Question:
#
# Show the ids and details of the investors who have at least two transactions with type code "SALE".
#
### SQL:
#
# SELECT T2.investor_id , T1.Investor_details FROM INVESTORS AS T1 JOIN TRANSACTIONS AS T2 ON T1.investor_id = T2.investor_id WHERE T2.transaction_type_code = "SALE" GROUP BY T2.investor_id HAVING COUNT(*) >= 2
#
### End.
|
tracking_share_transactions
|
### Complete SQL query only and with no explanation
### SQL tables followed by foreign key information:
#
# Investors ( investor_id, Investor_details )
# Lots ( lot_id, investor_id, lot_details )
# Ref_Transaction_Types ( transaction_type_code, transaction_type_description )
# Transactions ( transaction_id, investor_id, transaction_type_code, date_of_transaction, amount_of_transaction, share_count, other_details )
# Sales ( sales_transaction_id, sales_details )
# Purchases ( purchase_transaction_id, purchase_details )
# Transactions_Lots ( transaction_id, lot_id )
#
# Lots.investor_id can be joined with Investors.investor_id
# Transactions.transaction_type_code can be joined with Ref_Transaction_Types.transaction_type_code
# Transactions.investor_id can be joined with Investors.investor_id
# Sales.sales_transaction_id can be joined with Transactions.transaction_id
# Purchases.purchase_transaction_id can be joined with Transactions.transaction_id
# Transactions_Lots.transaction_id can be joined with Transactions.transaction_id
# Transactions_Lots.lot_id can be joined with Lots.lot_id
#
### Question:
#
# What are the dates of transactions with at least 100 share count or amount bigger than 100?
#
### SQL:
#
# SELECT date_of_transaction FROM TRANSACTIONS WHERE share_count >= 100 OR amount_of_transaction >= 100
#
### End.
|
tracking_share_transactions
|
### Complete SQL query only and with no explanation
### SQL tables followed by foreign key information:
#
# Investors ( investor_id, Investor_details )
# Lots ( lot_id, investor_id, lot_details )
# Ref_Transaction_Types ( transaction_type_code, transaction_type_description )
# Transactions ( transaction_id, investor_id, transaction_type_code, date_of_transaction, amount_of_transaction, share_count, other_details )
# Sales ( sales_transaction_id, sales_details )
# Purchases ( purchase_transaction_id, purchase_details )
# Transactions_Lots ( transaction_id, lot_id )
#
# Lots.investor_id can be joined with Investors.investor_id
# Transactions.transaction_type_code can be joined with Ref_Transaction_Types.transaction_type_code
# Transactions.investor_id can be joined with Investors.investor_id
# Sales.sales_transaction_id can be joined with Transactions.transaction_id
# Purchases.purchase_transaction_id can be joined with Transactions.transaction_id
# Transactions_Lots.transaction_id can be joined with Transactions.transaction_id
# Transactions_Lots.lot_id can be joined with Lots.lot_id
#
### Question:
#
# What are the details of all sales and purchases?
#
### SQL:
#
# SELECT sales_details FROM sales UNION SELECT purchase_details FROM purchases
#
### End.
|
tracking_share_transactions
|
### Complete SQL query only and with no explanation
### SQL tables followed by foreign key information:
#
# Investors ( investor_id, Investor_details )
# Lots ( lot_id, investor_id, lot_details )
# Ref_Transaction_Types ( transaction_type_code, transaction_type_description )
# Transactions ( transaction_id, investor_id, transaction_type_code, date_of_transaction, amount_of_transaction, share_count, other_details )
# Sales ( sales_transaction_id, sales_details )
# Purchases ( purchase_transaction_id, purchase_details )
# Transactions_Lots ( transaction_id, lot_id )
#
# Lots.investor_id can be joined with Investors.investor_id
# Transactions.transaction_type_code can be joined with Ref_Transaction_Types.transaction_type_code
# Transactions.investor_id can be joined with Investors.investor_id
# Sales.sales_transaction_id can be joined with Transactions.transaction_id
# Purchases.purchase_transaction_id can be joined with Transactions.transaction_id
# Transactions_Lots.transaction_id can be joined with Transactions.transaction_id
# Transactions_Lots.lot_id can be joined with Lots.lot_id
#
### Question:
#
# What are the details of the lots which are not used in any transactions?
#
### SQL:
#
# SELECT lot_details FROM Lots EXCEPT SELECT T1.lot_details FROM Lots AS T1 JOIN transactions_lots AS T2 ON T1.lot_id = T2.lot_id
#
### End.
|
cre_Theme_park
|
### Complete SQL query only and with no explanation
### SQL tables followed by foreign key information:
#
# Ref_Hotel_Star_Ratings ( star_rating_code, star_rating_description )
# Locations ( Location_ID, Location_Name, Address, Other_Details )
# Ref_Attraction_Types ( Attraction_Type_Code, Attraction_Type_Description )
# Visitors ( Tourist_ID, Tourist_Details )
# Features ( Feature_ID, Feature_Details )
# Hotels ( hotel_id, star_rating_code, pets_allowed_yn, price_range, other_hotel_details )
# Tourist_Attractions ( Tourist_Attraction_ID, Attraction_Type_Code, Location_ID, How_to_Get_There, Name, Description, Opening_Hours, Other_Details )
# Street_Markets ( Market_ID, Market_Details )
# Shops ( Shop_ID, Shop_Details )
# Museums ( Museum_ID, Museum_Details )
# Royal_Family ( Royal_Family_ID, Royal_Family_Details )
# Theme_Parks ( Theme_Park_ID, Theme_Park_Details )
# Visits ( Visit_ID, Tourist_Attraction_ID, Tourist_ID, Visit_Date, Visit_Details )
# Photos ( Photo_ID, Tourist_Attraction_ID, Name, Description, Filename, Other_Details )
# Staff ( Staff_ID, Tourist_Attraction_ID, Name, Other_Details )
# Tourist_Attraction_Features ( Tourist_Attraction_ID, Feature_ID )
#
# Hotels.star_rating_code can be joined with Ref_Hotel_Star_Ratings.star_rating_code
# Tourist_Attractions.Attraction_Type_Code can be joined with Ref_Attraction_Types.Attraction_Type_Code
# Tourist_Attractions.Location_ID can be joined with Locations.Location_ID
# Street_Markets.Market_ID can be joined with Tourist_Attractions.Tourist_Attraction_ID
# Shops.Shop_ID can be joined with Tourist_Attractions.Tourist_Attraction_ID
# Museums.Museum_ID can be joined with Tourist_Attractions.Tourist_Attraction_ID
# Royal_Family.Royal_Family_ID can be joined with Tourist_Attractions.Tourist_Attraction_ID
# Theme_Parks.Theme_Park_ID can be joined with Tourist_Attractions.Tourist_Attraction_ID
# Visits.Tourist_ID can be joined with Visitors.Tourist_ID
# Visits.Tourist_Attraction_ID can be joined with Tourist_Attractions.Tourist_Attraction_ID
# Photos.Tourist_Attraction_ID can be joined with Tourist_Attractions.Tourist_Attraction_ID
# Staff.Tourist_Attraction_ID can be joined with Tourist_Attractions.Tourist_Attraction_ID
# Tourist_Attraction_Features.Feature_ID can be joined with Features.Feature_ID
# Tourist_Attraction_Features.Tourist_Attraction_ID can be joined with Tourist_Attractions.Tourist_Attraction_ID
#
### Question:
#
# How many available hotels are there in total?
#
### SQL:
#
# SELECT count(*) FROM HOTELS
#
### End.
|
cre_Theme_park
|
### Complete SQL query only and with no explanation
### SQL tables followed by foreign key information:
#
# Ref_Hotel_Star_Ratings ( star_rating_code, star_rating_description )
# Locations ( Location_ID, Location_Name, Address, Other_Details )
# Ref_Attraction_Types ( Attraction_Type_Code, Attraction_Type_Description )
# Visitors ( Tourist_ID, Tourist_Details )
# Features ( Feature_ID, Feature_Details )
# Hotels ( hotel_id, star_rating_code, pets_allowed_yn, price_range, other_hotel_details )
# Tourist_Attractions ( Tourist_Attraction_ID, Attraction_Type_Code, Location_ID, How_to_Get_There, Name, Description, Opening_Hours, Other_Details )
# Street_Markets ( Market_ID, Market_Details )
# Shops ( Shop_ID, Shop_Details )
# Museums ( Museum_ID, Museum_Details )
# Royal_Family ( Royal_Family_ID, Royal_Family_Details )
# Theme_Parks ( Theme_Park_ID, Theme_Park_Details )
# Visits ( Visit_ID, Tourist_Attraction_ID, Tourist_ID, Visit_Date, Visit_Details )
# Photos ( Photo_ID, Tourist_Attraction_ID, Name, Description, Filename, Other_Details )
# Staff ( Staff_ID, Tourist_Attraction_ID, Name, Other_Details )
# Tourist_Attraction_Features ( Tourist_Attraction_ID, Feature_ID )
#
# Hotels.star_rating_code can be joined with Ref_Hotel_Star_Ratings.star_rating_code
# Tourist_Attractions.Attraction_Type_Code can be joined with Ref_Attraction_Types.Attraction_Type_Code
# Tourist_Attractions.Location_ID can be joined with Locations.Location_ID
# Street_Markets.Market_ID can be joined with Tourist_Attractions.Tourist_Attraction_ID
# Shops.Shop_ID can be joined with Tourist_Attractions.Tourist_Attraction_ID
# Museums.Museum_ID can be joined with Tourist_Attractions.Tourist_Attraction_ID
# Royal_Family.Royal_Family_ID can be joined with Tourist_Attractions.Tourist_Attraction_ID
# Theme_Parks.Theme_Park_ID can be joined with Tourist_Attractions.Tourist_Attraction_ID
# Visits.Tourist_ID can be joined with Visitors.Tourist_ID
# Visits.Tourist_Attraction_ID can be joined with Tourist_Attractions.Tourist_Attraction_ID
# Photos.Tourist_Attraction_ID can be joined with Tourist_Attractions.Tourist_Attraction_ID
# Staff.Tourist_Attraction_ID can be joined with Tourist_Attractions.Tourist_Attraction_ID
# Tourist_Attraction_Features.Feature_ID can be joined with Features.Feature_ID
# Tourist_Attraction_Features.Tourist_Attraction_ID can be joined with Tourist_Attractions.Tourist_Attraction_ID
#
### Question:
#
# Find the total number of available hotels.
#
### SQL:
#
# SELECT count(*) FROM HOTELS
#
### End.
|
cre_Theme_park
|
### Complete SQL query only and with no explanation
### SQL tables followed by foreign key information:
#
# Ref_Hotel_Star_Ratings ( star_rating_code, star_rating_description )
# Locations ( Location_ID, Location_Name, Address, Other_Details )
# Ref_Attraction_Types ( Attraction_Type_Code, Attraction_Type_Description )
# Visitors ( Tourist_ID, Tourist_Details )
# Features ( Feature_ID, Feature_Details )
# Hotels ( hotel_id, star_rating_code, pets_allowed_yn, price_range, other_hotel_details )
# Tourist_Attractions ( Tourist_Attraction_ID, Attraction_Type_Code, Location_ID, How_to_Get_There, Name, Description, Opening_Hours, Other_Details )
# Street_Markets ( Market_ID, Market_Details )
# Shops ( Shop_ID, Shop_Details )
# Museums ( Museum_ID, Museum_Details )
# Royal_Family ( Royal_Family_ID, Royal_Family_Details )
# Theme_Parks ( Theme_Park_ID, Theme_Park_Details )
# Visits ( Visit_ID, Tourist_Attraction_ID, Tourist_ID, Visit_Date, Visit_Details )
# Photos ( Photo_ID, Tourist_Attraction_ID, Name, Description, Filename, Other_Details )
# Staff ( Staff_ID, Tourist_Attraction_ID, Name, Other_Details )
# Tourist_Attraction_Features ( Tourist_Attraction_ID, Feature_ID )
#
# Hotels.star_rating_code can be joined with Ref_Hotel_Star_Ratings.star_rating_code
# Tourist_Attractions.Attraction_Type_Code can be joined with Ref_Attraction_Types.Attraction_Type_Code
# Tourist_Attractions.Location_ID can be joined with Locations.Location_ID
# Street_Markets.Market_ID can be joined with Tourist_Attractions.Tourist_Attraction_ID
# Shops.Shop_ID can be joined with Tourist_Attractions.Tourist_Attraction_ID
# Museums.Museum_ID can be joined with Tourist_Attractions.Tourist_Attraction_ID
# Royal_Family.Royal_Family_ID can be joined with Tourist_Attractions.Tourist_Attraction_ID
# Theme_Parks.Theme_Park_ID can be joined with Tourist_Attractions.Tourist_Attraction_ID
# Visits.Tourist_ID can be joined with Visitors.Tourist_ID
# Visits.Tourist_Attraction_ID can be joined with Tourist_Attractions.Tourist_Attraction_ID
# Photos.Tourist_Attraction_ID can be joined with Tourist_Attractions.Tourist_Attraction_ID
# Staff.Tourist_Attraction_ID can be joined with Tourist_Attractions.Tourist_Attraction_ID
# Tourist_Attraction_Features.Feature_ID can be joined with Features.Feature_ID
# Tourist_Attraction_Features.Tourist_Attraction_ID can be joined with Tourist_Attractions.Tourist_Attraction_ID
#
### Question:
#
# What are the price ranges of hotels?
#
### SQL:
#
# SELECT price_range FROM HOTELS
#
### End.
|
cre_Theme_park
|
### Complete SQL query only and with no explanation
### SQL tables followed by foreign key information:
#
# Ref_Hotel_Star_Ratings ( star_rating_code, star_rating_description )
# Locations ( Location_ID, Location_Name, Address, Other_Details )
# Ref_Attraction_Types ( Attraction_Type_Code, Attraction_Type_Description )
# Visitors ( Tourist_ID, Tourist_Details )
# Features ( Feature_ID, Feature_Details )
# Hotels ( hotel_id, star_rating_code, pets_allowed_yn, price_range, other_hotel_details )
# Tourist_Attractions ( Tourist_Attraction_ID, Attraction_Type_Code, Location_ID, How_to_Get_There, Name, Description, Opening_Hours, Other_Details )
# Street_Markets ( Market_ID, Market_Details )
# Shops ( Shop_ID, Shop_Details )
# Museums ( Museum_ID, Museum_Details )
# Royal_Family ( Royal_Family_ID, Royal_Family_Details )
# Theme_Parks ( Theme_Park_ID, Theme_Park_Details )
# Visits ( Visit_ID, Tourist_Attraction_ID, Tourist_ID, Visit_Date, Visit_Details )
# Photos ( Photo_ID, Tourist_Attraction_ID, Name, Description, Filename, Other_Details )
# Staff ( Staff_ID, Tourist_Attraction_ID, Name, Other_Details )
# Tourist_Attraction_Features ( Tourist_Attraction_ID, Feature_ID )
#
# Hotels.star_rating_code can be joined with Ref_Hotel_Star_Ratings.star_rating_code
# Tourist_Attractions.Attraction_Type_Code can be joined with Ref_Attraction_Types.Attraction_Type_Code
# Tourist_Attractions.Location_ID can be joined with Locations.Location_ID
# Street_Markets.Market_ID can be joined with Tourist_Attractions.Tourist_Attraction_ID
# Shops.Shop_ID can be joined with Tourist_Attractions.Tourist_Attraction_ID
# Museums.Museum_ID can be joined with Tourist_Attractions.Tourist_Attraction_ID
# Royal_Family.Royal_Family_ID can be joined with Tourist_Attractions.Tourist_Attraction_ID
# Theme_Parks.Theme_Park_ID can be joined with Tourist_Attractions.Tourist_Attraction_ID
# Visits.Tourist_ID can be joined with Visitors.Tourist_ID
# Visits.Tourist_Attraction_ID can be joined with Tourist_Attractions.Tourist_Attraction_ID
# Photos.Tourist_Attraction_ID can be joined with Tourist_Attractions.Tourist_Attraction_ID
# Staff.Tourist_Attraction_ID can be joined with Tourist_Attractions.Tourist_Attraction_ID
# Tourist_Attraction_Features.Feature_ID can be joined with Features.Feature_ID
# Tourist_Attraction_Features.Tourist_Attraction_ID can be joined with Tourist_Attractions.Tourist_Attraction_ID
#
### Question:
#
# Tell me the price ranges for all the hotels.
#
### SQL:
#
# SELECT price_range FROM HOTELS
#
### End.
|
cre_Theme_park
|
### Complete SQL query only and with no explanation
### SQL tables followed by foreign key information:
#
# Ref_Hotel_Star_Ratings ( star_rating_code, star_rating_description )
# Locations ( Location_ID, Location_Name, Address, Other_Details )
# Ref_Attraction_Types ( Attraction_Type_Code, Attraction_Type_Description )
# Visitors ( Tourist_ID, Tourist_Details )
# Features ( Feature_ID, Feature_Details )
# Hotels ( hotel_id, star_rating_code, pets_allowed_yn, price_range, other_hotel_details )
# Tourist_Attractions ( Tourist_Attraction_ID, Attraction_Type_Code, Location_ID, How_to_Get_There, Name, Description, Opening_Hours, Other_Details )
# Street_Markets ( Market_ID, Market_Details )
# Shops ( Shop_ID, Shop_Details )
# Museums ( Museum_ID, Museum_Details )
# Royal_Family ( Royal_Family_ID, Royal_Family_Details )
# Theme_Parks ( Theme_Park_ID, Theme_Park_Details )
# Visits ( Visit_ID, Tourist_Attraction_ID, Tourist_ID, Visit_Date, Visit_Details )
# Photos ( Photo_ID, Tourist_Attraction_ID, Name, Description, Filename, Other_Details )
# Staff ( Staff_ID, Tourist_Attraction_ID, Name, Other_Details )
# Tourist_Attraction_Features ( Tourist_Attraction_ID, Feature_ID )
#
# Hotels.star_rating_code can be joined with Ref_Hotel_Star_Ratings.star_rating_code
# Tourist_Attractions.Attraction_Type_Code can be joined with Ref_Attraction_Types.Attraction_Type_Code
# Tourist_Attractions.Location_ID can be joined with Locations.Location_ID
# Street_Markets.Market_ID can be joined with Tourist_Attractions.Tourist_Attraction_ID
# Shops.Shop_ID can be joined with Tourist_Attractions.Tourist_Attraction_ID
# Museums.Museum_ID can be joined with Tourist_Attractions.Tourist_Attraction_ID
# Royal_Family.Royal_Family_ID can be joined with Tourist_Attractions.Tourist_Attraction_ID
# Theme_Parks.Theme_Park_ID can be joined with Tourist_Attractions.Tourist_Attraction_ID
# Visits.Tourist_ID can be joined with Visitors.Tourist_ID
# Visits.Tourist_Attraction_ID can be joined with Tourist_Attractions.Tourist_Attraction_ID
# Photos.Tourist_Attraction_ID can be joined with Tourist_Attractions.Tourist_Attraction_ID
# Staff.Tourist_Attraction_ID can be joined with Tourist_Attractions.Tourist_Attraction_ID
# Tourist_Attraction_Features.Feature_ID can be joined with Features.Feature_ID
# Tourist_Attraction_Features.Tourist_Attraction_ID can be joined with Tourist_Attractions.Tourist_Attraction_ID
#
### Question:
#
# Show all distinct location names.
#
### SQL:
#
# SELECT DISTINCT Location_Name FROM LOCATIONS
#
### End.
|
cre_Theme_park
|
### Complete SQL query only and with no explanation
### SQL tables followed by foreign key information:
#
# Ref_Hotel_Star_Ratings ( star_rating_code, star_rating_description )
# Locations ( Location_ID, Location_Name, Address, Other_Details )
# Ref_Attraction_Types ( Attraction_Type_Code, Attraction_Type_Description )
# Visitors ( Tourist_ID, Tourist_Details )
# Features ( Feature_ID, Feature_Details )
# Hotels ( hotel_id, star_rating_code, pets_allowed_yn, price_range, other_hotel_details )
# Tourist_Attractions ( Tourist_Attraction_ID, Attraction_Type_Code, Location_ID, How_to_Get_There, Name, Description, Opening_Hours, Other_Details )
# Street_Markets ( Market_ID, Market_Details )
# Shops ( Shop_ID, Shop_Details )
# Museums ( Museum_ID, Museum_Details )
# Royal_Family ( Royal_Family_ID, Royal_Family_Details )
# Theme_Parks ( Theme_Park_ID, Theme_Park_Details )
# Visits ( Visit_ID, Tourist_Attraction_ID, Tourist_ID, Visit_Date, Visit_Details )
# Photos ( Photo_ID, Tourist_Attraction_ID, Name, Description, Filename, Other_Details )
# Staff ( Staff_ID, Tourist_Attraction_ID, Name, Other_Details )
# Tourist_Attraction_Features ( Tourist_Attraction_ID, Feature_ID )
#
# Hotels.star_rating_code can be joined with Ref_Hotel_Star_Ratings.star_rating_code
# Tourist_Attractions.Attraction_Type_Code can be joined with Ref_Attraction_Types.Attraction_Type_Code
# Tourist_Attractions.Location_ID can be joined with Locations.Location_ID
# Street_Markets.Market_ID can be joined with Tourist_Attractions.Tourist_Attraction_ID
# Shops.Shop_ID can be joined with Tourist_Attractions.Tourist_Attraction_ID
# Museums.Museum_ID can be joined with Tourist_Attractions.Tourist_Attraction_ID
# Royal_Family.Royal_Family_ID can be joined with Tourist_Attractions.Tourist_Attraction_ID
# Theme_Parks.Theme_Park_ID can be joined with Tourist_Attractions.Tourist_Attraction_ID
# Visits.Tourist_ID can be joined with Visitors.Tourist_ID
# Visits.Tourist_Attraction_ID can be joined with Tourist_Attractions.Tourist_Attraction_ID
# Photos.Tourist_Attraction_ID can be joined with Tourist_Attractions.Tourist_Attraction_ID
# Staff.Tourist_Attraction_ID can be joined with Tourist_Attractions.Tourist_Attraction_ID
# Tourist_Attraction_Features.Feature_ID can be joined with Features.Feature_ID
# Tourist_Attraction_Features.Tourist_Attraction_ID can be joined with Tourist_Attractions.Tourist_Attraction_ID
#
### Question:
#
# What are the distinct location names?
#
### SQL:
#
# SELECT DISTINCT Location_Name FROM LOCATIONS
#
### End.
|
cre_Theme_park
|
### Complete SQL query only and with no explanation
### SQL tables followed by foreign key information:
#
# Ref_Hotel_Star_Ratings ( star_rating_code, star_rating_description )
# Locations ( Location_ID, Location_Name, Address, Other_Details )
# Ref_Attraction_Types ( Attraction_Type_Code, Attraction_Type_Description )
# Visitors ( Tourist_ID, Tourist_Details )
# Features ( Feature_ID, Feature_Details )
# Hotels ( hotel_id, star_rating_code, pets_allowed_yn, price_range, other_hotel_details )
# Tourist_Attractions ( Tourist_Attraction_ID, Attraction_Type_Code, Location_ID, How_to_Get_There, Name, Description, Opening_Hours, Other_Details )
# Street_Markets ( Market_ID, Market_Details )
# Shops ( Shop_ID, Shop_Details )
# Museums ( Museum_ID, Museum_Details )
# Royal_Family ( Royal_Family_ID, Royal_Family_Details )
# Theme_Parks ( Theme_Park_ID, Theme_Park_Details )
# Visits ( Visit_ID, Tourist_Attraction_ID, Tourist_ID, Visit_Date, Visit_Details )
# Photos ( Photo_ID, Tourist_Attraction_ID, Name, Description, Filename, Other_Details )
# Staff ( Staff_ID, Tourist_Attraction_ID, Name, Other_Details )
# Tourist_Attraction_Features ( Tourist_Attraction_ID, Feature_ID )
#
# Hotels.star_rating_code can be joined with Ref_Hotel_Star_Ratings.star_rating_code
# Tourist_Attractions.Attraction_Type_Code can be joined with Ref_Attraction_Types.Attraction_Type_Code
# Tourist_Attractions.Location_ID can be joined with Locations.Location_ID
# Street_Markets.Market_ID can be joined with Tourist_Attractions.Tourist_Attraction_ID
# Shops.Shop_ID can be joined with Tourist_Attractions.Tourist_Attraction_ID
# Museums.Museum_ID can be joined with Tourist_Attractions.Tourist_Attraction_ID
# Royal_Family.Royal_Family_ID can be joined with Tourist_Attractions.Tourist_Attraction_ID
# Theme_Parks.Theme_Park_ID can be joined with Tourist_Attractions.Tourist_Attraction_ID
# Visits.Tourist_ID can be joined with Visitors.Tourist_ID
# Visits.Tourist_Attraction_ID can be joined with Tourist_Attractions.Tourist_Attraction_ID
# Photos.Tourist_Attraction_ID can be joined with Tourist_Attractions.Tourist_Attraction_ID
# Staff.Tourist_Attraction_ID can be joined with Tourist_Attractions.Tourist_Attraction_ID
# Tourist_Attraction_Features.Feature_ID can be joined with Features.Feature_ID
# Tourist_Attraction_Features.Tourist_Attraction_ID can be joined with Tourist_Attractions.Tourist_Attraction_ID
#
### Question:
#
# Show the names and details of all the staff members.
#
### SQL:
#
# SELECT Name , Other_Details FROM Staff
#
### End.
|
cre_Theme_park
|
### Complete SQL query only and with no explanation
### SQL tables followed by foreign key information:
#
# Ref_Hotel_Star_Ratings ( star_rating_code, star_rating_description )
# Locations ( Location_ID, Location_Name, Address, Other_Details )
# Ref_Attraction_Types ( Attraction_Type_Code, Attraction_Type_Description )
# Visitors ( Tourist_ID, Tourist_Details )
# Features ( Feature_ID, Feature_Details )
# Hotels ( hotel_id, star_rating_code, pets_allowed_yn, price_range, other_hotel_details )
# Tourist_Attractions ( Tourist_Attraction_ID, Attraction_Type_Code, Location_ID, How_to_Get_There, Name, Description, Opening_Hours, Other_Details )
# Street_Markets ( Market_ID, Market_Details )
# Shops ( Shop_ID, Shop_Details )
# Museums ( Museum_ID, Museum_Details )
# Royal_Family ( Royal_Family_ID, Royal_Family_Details )
# Theme_Parks ( Theme_Park_ID, Theme_Park_Details )
# Visits ( Visit_ID, Tourist_Attraction_ID, Tourist_ID, Visit_Date, Visit_Details )
# Photos ( Photo_ID, Tourist_Attraction_ID, Name, Description, Filename, Other_Details )
# Staff ( Staff_ID, Tourist_Attraction_ID, Name, Other_Details )
# Tourist_Attraction_Features ( Tourist_Attraction_ID, Feature_ID )
#
# Hotels.star_rating_code can be joined with Ref_Hotel_Star_Ratings.star_rating_code
# Tourist_Attractions.Attraction_Type_Code can be joined with Ref_Attraction_Types.Attraction_Type_Code
# Tourist_Attractions.Location_ID can be joined with Locations.Location_ID
# Street_Markets.Market_ID can be joined with Tourist_Attractions.Tourist_Attraction_ID
# Shops.Shop_ID can be joined with Tourist_Attractions.Tourist_Attraction_ID
# Museums.Museum_ID can be joined with Tourist_Attractions.Tourist_Attraction_ID
# Royal_Family.Royal_Family_ID can be joined with Tourist_Attractions.Tourist_Attraction_ID
# Theme_Parks.Theme_Park_ID can be joined with Tourist_Attractions.Tourist_Attraction_ID
# Visits.Tourist_ID can be joined with Visitors.Tourist_ID
# Visits.Tourist_Attraction_ID can be joined with Tourist_Attractions.Tourist_Attraction_ID
# Photos.Tourist_Attraction_ID can be joined with Tourist_Attractions.Tourist_Attraction_ID
# Staff.Tourist_Attraction_ID can be joined with Tourist_Attractions.Tourist_Attraction_ID
# Tourist_Attraction_Features.Feature_ID can be joined with Features.Feature_ID
# Tourist_Attraction_Features.Tourist_Attraction_ID can be joined with Tourist_Attractions.Tourist_Attraction_ID
#
### Question:
#
# What is the name and detail of each staff member?
#
### SQL:
#
# SELECT Name , Other_Details FROM Staff
#
### End.
|
cre_Theme_park
|
### Complete SQL query only and with no explanation
### SQL tables followed by foreign key information:
#
# Ref_Hotel_Star_Ratings ( star_rating_code, star_rating_description )
# Locations ( Location_ID, Location_Name, Address, Other_Details )
# Ref_Attraction_Types ( Attraction_Type_Code, Attraction_Type_Description )
# Visitors ( Tourist_ID, Tourist_Details )
# Features ( Feature_ID, Feature_Details )
# Hotels ( hotel_id, star_rating_code, pets_allowed_yn, price_range, other_hotel_details )
# Tourist_Attractions ( Tourist_Attraction_ID, Attraction_Type_Code, Location_ID, How_to_Get_There, Name, Description, Opening_Hours, Other_Details )
# Street_Markets ( Market_ID, Market_Details )
# Shops ( Shop_ID, Shop_Details )
# Museums ( Museum_ID, Museum_Details )
# Royal_Family ( Royal_Family_ID, Royal_Family_Details )
# Theme_Parks ( Theme_Park_ID, Theme_Park_Details )
# Visits ( Visit_ID, Tourist_Attraction_ID, Tourist_ID, Visit_Date, Visit_Details )
# Photos ( Photo_ID, Tourist_Attraction_ID, Name, Description, Filename, Other_Details )
# Staff ( Staff_ID, Tourist_Attraction_ID, Name, Other_Details )
# Tourist_Attraction_Features ( Tourist_Attraction_ID, Feature_ID )
#
# Hotels.star_rating_code can be joined with Ref_Hotel_Star_Ratings.star_rating_code
# Tourist_Attractions.Attraction_Type_Code can be joined with Ref_Attraction_Types.Attraction_Type_Code
# Tourist_Attractions.Location_ID can be joined with Locations.Location_ID
# Street_Markets.Market_ID can be joined with Tourist_Attractions.Tourist_Attraction_ID
# Shops.Shop_ID can be joined with Tourist_Attractions.Tourist_Attraction_ID
# Museums.Museum_ID can be joined with Tourist_Attractions.Tourist_Attraction_ID
# Royal_Family.Royal_Family_ID can be joined with Tourist_Attractions.Tourist_Attraction_ID
# Theme_Parks.Theme_Park_ID can be joined with Tourist_Attractions.Tourist_Attraction_ID
# Visits.Tourist_ID can be joined with Visitors.Tourist_ID
# Visits.Tourist_Attraction_ID can be joined with Tourist_Attractions.Tourist_Attraction_ID
# Photos.Tourist_Attraction_ID can be joined with Tourist_Attractions.Tourist_Attraction_ID
# Staff.Tourist_Attraction_ID can be joined with Tourist_Attractions.Tourist_Attraction_ID
# Tourist_Attraction_Features.Feature_ID can be joined with Features.Feature_ID
# Tourist_Attraction_Features.Tourist_Attraction_ID can be joined with Tourist_Attractions.Tourist_Attraction_ID
#
### Question:
#
# Show details of all visitors.
#
### SQL:
#
# SELECT Tourist_Details FROM VISITORS
#
### End.
|
cre_Theme_park
|
### Complete SQL query only and with no explanation
### SQL tables followed by foreign key information:
#
# Ref_Hotel_Star_Ratings ( star_rating_code, star_rating_description )
# Locations ( Location_ID, Location_Name, Address, Other_Details )
# Ref_Attraction_Types ( Attraction_Type_Code, Attraction_Type_Description )
# Visitors ( Tourist_ID, Tourist_Details )
# Features ( Feature_ID, Feature_Details )
# Hotels ( hotel_id, star_rating_code, pets_allowed_yn, price_range, other_hotel_details )
# Tourist_Attractions ( Tourist_Attraction_ID, Attraction_Type_Code, Location_ID, How_to_Get_There, Name, Description, Opening_Hours, Other_Details )
# Street_Markets ( Market_ID, Market_Details )
# Shops ( Shop_ID, Shop_Details )
# Museums ( Museum_ID, Museum_Details )
# Royal_Family ( Royal_Family_ID, Royal_Family_Details )
# Theme_Parks ( Theme_Park_ID, Theme_Park_Details )
# Visits ( Visit_ID, Tourist_Attraction_ID, Tourist_ID, Visit_Date, Visit_Details )
# Photos ( Photo_ID, Tourist_Attraction_ID, Name, Description, Filename, Other_Details )
# Staff ( Staff_ID, Tourist_Attraction_ID, Name, Other_Details )
# Tourist_Attraction_Features ( Tourist_Attraction_ID, Feature_ID )
#
# Hotels.star_rating_code can be joined with Ref_Hotel_Star_Ratings.star_rating_code
# Tourist_Attractions.Attraction_Type_Code can be joined with Ref_Attraction_Types.Attraction_Type_Code
# Tourist_Attractions.Location_ID can be joined with Locations.Location_ID
# Street_Markets.Market_ID can be joined with Tourist_Attractions.Tourist_Attraction_ID
# Shops.Shop_ID can be joined with Tourist_Attractions.Tourist_Attraction_ID
# Museums.Museum_ID can be joined with Tourist_Attractions.Tourist_Attraction_ID
# Royal_Family.Royal_Family_ID can be joined with Tourist_Attractions.Tourist_Attraction_ID
# Theme_Parks.Theme_Park_ID can be joined with Tourist_Attractions.Tourist_Attraction_ID
# Visits.Tourist_ID can be joined with Visitors.Tourist_ID
# Visits.Tourist_Attraction_ID can be joined with Tourist_Attractions.Tourist_Attraction_ID
# Photos.Tourist_Attraction_ID can be joined with Tourist_Attractions.Tourist_Attraction_ID
# Staff.Tourist_Attraction_ID can be joined with Tourist_Attractions.Tourist_Attraction_ID
# Tourist_Attraction_Features.Feature_ID can be joined with Features.Feature_ID
# Tourist_Attraction_Features.Tourist_Attraction_ID can be joined with Tourist_Attractions.Tourist_Attraction_ID
#
### Question:
#
# What is the detail of each visitor?
#
### SQL:
#
# SELECT Tourist_Details FROM VISITORS
#
### End.
|
cre_Theme_park
|
### Complete SQL query only and with no explanation
### SQL tables followed by foreign key information:
#
# Ref_Hotel_Star_Ratings ( star_rating_code, star_rating_description )
# Locations ( Location_ID, Location_Name, Address, Other_Details )
# Ref_Attraction_Types ( Attraction_Type_Code, Attraction_Type_Description )
# Visitors ( Tourist_ID, Tourist_Details )
# Features ( Feature_ID, Feature_Details )
# Hotels ( hotel_id, star_rating_code, pets_allowed_yn, price_range, other_hotel_details )
# Tourist_Attractions ( Tourist_Attraction_ID, Attraction_Type_Code, Location_ID, How_to_Get_There, Name, Description, Opening_Hours, Other_Details )
# Street_Markets ( Market_ID, Market_Details )
# Shops ( Shop_ID, Shop_Details )
# Museums ( Museum_ID, Museum_Details )
# Royal_Family ( Royal_Family_ID, Royal_Family_Details )
# Theme_Parks ( Theme_Park_ID, Theme_Park_Details )
# Visits ( Visit_ID, Tourist_Attraction_ID, Tourist_ID, Visit_Date, Visit_Details )
# Photos ( Photo_ID, Tourist_Attraction_ID, Name, Description, Filename, Other_Details )
# Staff ( Staff_ID, Tourist_Attraction_ID, Name, Other_Details )
# Tourist_Attraction_Features ( Tourist_Attraction_ID, Feature_ID )
#
# Hotels.star_rating_code can be joined with Ref_Hotel_Star_Ratings.star_rating_code
# Tourist_Attractions.Attraction_Type_Code can be joined with Ref_Attraction_Types.Attraction_Type_Code
# Tourist_Attractions.Location_ID can be joined with Locations.Location_ID
# Street_Markets.Market_ID can be joined with Tourist_Attractions.Tourist_Attraction_ID
# Shops.Shop_ID can be joined with Tourist_Attractions.Tourist_Attraction_ID
# Museums.Museum_ID can be joined with Tourist_Attractions.Tourist_Attraction_ID
# Royal_Family.Royal_Family_ID can be joined with Tourist_Attractions.Tourist_Attraction_ID
# Theme_Parks.Theme_Park_ID can be joined with Tourist_Attractions.Tourist_Attraction_ID
# Visits.Tourist_ID can be joined with Visitors.Tourist_ID
# Visits.Tourist_Attraction_ID can be joined with Tourist_Attractions.Tourist_Attraction_ID
# Photos.Tourist_Attraction_ID can be joined with Tourist_Attractions.Tourist_Attraction_ID
# Staff.Tourist_Attraction_ID can be joined with Tourist_Attractions.Tourist_Attraction_ID
# Tourist_Attraction_Features.Feature_ID can be joined with Features.Feature_ID
# Tourist_Attraction_Features.Tourist_Attraction_ID can be joined with Tourist_Attractions.Tourist_Attraction_ID
#
### Question:
#
# Show the price ranges of hotels with 5 star ratings.
#
### SQL:
#
# SELECT price_range FROM HOTELS WHERE star_rating_code = "5"
#
### End.
|
cre_Theme_park
|
### Complete SQL query only and with no explanation
### SQL tables followed by foreign key information:
#
# Ref_Hotel_Star_Ratings ( star_rating_code, star_rating_description )
# Locations ( Location_ID, Location_Name, Address, Other_Details )
# Ref_Attraction_Types ( Attraction_Type_Code, Attraction_Type_Description )
# Visitors ( Tourist_ID, Tourist_Details )
# Features ( Feature_ID, Feature_Details )
# Hotels ( hotel_id, star_rating_code, pets_allowed_yn, price_range, other_hotel_details )
# Tourist_Attractions ( Tourist_Attraction_ID, Attraction_Type_Code, Location_ID, How_to_Get_There, Name, Description, Opening_Hours, Other_Details )
# Street_Markets ( Market_ID, Market_Details )
# Shops ( Shop_ID, Shop_Details )
# Museums ( Museum_ID, Museum_Details )
# Royal_Family ( Royal_Family_ID, Royal_Family_Details )
# Theme_Parks ( Theme_Park_ID, Theme_Park_Details )
# Visits ( Visit_ID, Tourist_Attraction_ID, Tourist_ID, Visit_Date, Visit_Details )
# Photos ( Photo_ID, Tourist_Attraction_ID, Name, Description, Filename, Other_Details )
# Staff ( Staff_ID, Tourist_Attraction_ID, Name, Other_Details )
# Tourist_Attraction_Features ( Tourist_Attraction_ID, Feature_ID )
#
# Hotels.star_rating_code can be joined with Ref_Hotel_Star_Ratings.star_rating_code
# Tourist_Attractions.Attraction_Type_Code can be joined with Ref_Attraction_Types.Attraction_Type_Code
# Tourist_Attractions.Location_ID can be joined with Locations.Location_ID
# Street_Markets.Market_ID can be joined with Tourist_Attractions.Tourist_Attraction_ID
# Shops.Shop_ID can be joined with Tourist_Attractions.Tourist_Attraction_ID
# Museums.Museum_ID can be joined with Tourist_Attractions.Tourist_Attraction_ID
# Royal_Family.Royal_Family_ID can be joined with Tourist_Attractions.Tourist_Attraction_ID
# Theme_Parks.Theme_Park_ID can be joined with Tourist_Attractions.Tourist_Attraction_ID
# Visits.Tourist_ID can be joined with Visitors.Tourist_ID
# Visits.Tourist_Attraction_ID can be joined with Tourist_Attractions.Tourist_Attraction_ID
# Photos.Tourist_Attraction_ID can be joined with Tourist_Attractions.Tourist_Attraction_ID
# Staff.Tourist_Attraction_ID can be joined with Tourist_Attractions.Tourist_Attraction_ID
# Tourist_Attraction_Features.Feature_ID can be joined with Features.Feature_ID
# Tourist_Attraction_Features.Tourist_Attraction_ID can be joined with Tourist_Attractions.Tourist_Attraction_ID
#
### Question:
#
# What are the price ranges of five star hotels?
#
### SQL:
#
# SELECT price_range FROM HOTELS WHERE star_rating_code = "5"
#
### End.
|
cre_Theme_park
|
### Complete SQL query only and with no explanation
### SQL tables followed by foreign key information:
#
# Ref_Hotel_Star_Ratings ( star_rating_code, star_rating_description )
# Locations ( Location_ID, Location_Name, Address, Other_Details )
# Ref_Attraction_Types ( Attraction_Type_Code, Attraction_Type_Description )
# Visitors ( Tourist_ID, Tourist_Details )
# Features ( Feature_ID, Feature_Details )
# Hotels ( hotel_id, star_rating_code, pets_allowed_yn, price_range, other_hotel_details )
# Tourist_Attractions ( Tourist_Attraction_ID, Attraction_Type_Code, Location_ID, How_to_Get_There, Name, Description, Opening_Hours, Other_Details )
# Street_Markets ( Market_ID, Market_Details )
# Shops ( Shop_ID, Shop_Details )
# Museums ( Museum_ID, Museum_Details )
# Royal_Family ( Royal_Family_ID, Royal_Family_Details )
# Theme_Parks ( Theme_Park_ID, Theme_Park_Details )
# Visits ( Visit_ID, Tourist_Attraction_ID, Tourist_ID, Visit_Date, Visit_Details )
# Photos ( Photo_ID, Tourist_Attraction_ID, Name, Description, Filename, Other_Details )
# Staff ( Staff_ID, Tourist_Attraction_ID, Name, Other_Details )
# Tourist_Attraction_Features ( Tourist_Attraction_ID, Feature_ID )
#
# Hotels.star_rating_code can be joined with Ref_Hotel_Star_Ratings.star_rating_code
# Tourist_Attractions.Attraction_Type_Code can be joined with Ref_Attraction_Types.Attraction_Type_Code
# Tourist_Attractions.Location_ID can be joined with Locations.Location_ID
# Street_Markets.Market_ID can be joined with Tourist_Attractions.Tourist_Attraction_ID
# Shops.Shop_ID can be joined with Tourist_Attractions.Tourist_Attraction_ID
# Museums.Museum_ID can be joined with Tourist_Attractions.Tourist_Attraction_ID
# Royal_Family.Royal_Family_ID can be joined with Tourist_Attractions.Tourist_Attraction_ID
# Theme_Parks.Theme_Park_ID can be joined with Tourist_Attractions.Tourist_Attraction_ID
# Visits.Tourist_ID can be joined with Visitors.Tourist_ID
# Visits.Tourist_Attraction_ID can be joined with Tourist_Attractions.Tourist_Attraction_ID
# Photos.Tourist_Attraction_ID can be joined with Tourist_Attractions.Tourist_Attraction_ID
# Staff.Tourist_Attraction_ID can be joined with Tourist_Attractions.Tourist_Attraction_ID
# Tourist_Attraction_Features.Feature_ID can be joined with Features.Feature_ID
# Tourist_Attraction_Features.Tourist_Attraction_ID can be joined with Tourist_Attractions.Tourist_Attraction_ID
#
### Question:
#
# Show the average price range of hotels that have 5 star ratings and allow pets.
#
### SQL:
#
# SELECT avg(price_range) FROM HOTELS WHERE star_rating_code = "5" AND pets_allowed_yn = 1
#
### End.
|
cre_Theme_park
|
### Complete SQL query only and with no explanation
### SQL tables followed by foreign key information:
#
# Ref_Hotel_Star_Ratings ( star_rating_code, star_rating_description )
# Locations ( Location_ID, Location_Name, Address, Other_Details )
# Ref_Attraction_Types ( Attraction_Type_Code, Attraction_Type_Description )
# Visitors ( Tourist_ID, Tourist_Details )
# Features ( Feature_ID, Feature_Details )
# Hotels ( hotel_id, star_rating_code, pets_allowed_yn, price_range, other_hotel_details )
# Tourist_Attractions ( Tourist_Attraction_ID, Attraction_Type_Code, Location_ID, How_to_Get_There, Name, Description, Opening_Hours, Other_Details )
# Street_Markets ( Market_ID, Market_Details )
# Shops ( Shop_ID, Shop_Details )
# Museums ( Museum_ID, Museum_Details )
# Royal_Family ( Royal_Family_ID, Royal_Family_Details )
# Theme_Parks ( Theme_Park_ID, Theme_Park_Details )
# Visits ( Visit_ID, Tourist_Attraction_ID, Tourist_ID, Visit_Date, Visit_Details )
# Photos ( Photo_ID, Tourist_Attraction_ID, Name, Description, Filename, Other_Details )
# Staff ( Staff_ID, Tourist_Attraction_ID, Name, Other_Details )
# Tourist_Attraction_Features ( Tourist_Attraction_ID, Feature_ID )
#
# Hotels.star_rating_code can be joined with Ref_Hotel_Star_Ratings.star_rating_code
# Tourist_Attractions.Attraction_Type_Code can be joined with Ref_Attraction_Types.Attraction_Type_Code
# Tourist_Attractions.Location_ID can be joined with Locations.Location_ID
# Street_Markets.Market_ID can be joined with Tourist_Attractions.Tourist_Attraction_ID
# Shops.Shop_ID can be joined with Tourist_Attractions.Tourist_Attraction_ID
# Museums.Museum_ID can be joined with Tourist_Attractions.Tourist_Attraction_ID
# Royal_Family.Royal_Family_ID can be joined with Tourist_Attractions.Tourist_Attraction_ID
# Theme_Parks.Theme_Park_ID can be joined with Tourist_Attractions.Tourist_Attraction_ID
# Visits.Tourist_ID can be joined with Visitors.Tourist_ID
# Visits.Tourist_Attraction_ID can be joined with Tourist_Attractions.Tourist_Attraction_ID
# Photos.Tourist_Attraction_ID can be joined with Tourist_Attractions.Tourist_Attraction_ID
# Staff.Tourist_Attraction_ID can be joined with Tourist_Attractions.Tourist_Attraction_ID
# Tourist_Attraction_Features.Feature_ID can be joined with Features.Feature_ID
# Tourist_Attraction_Features.Tourist_Attraction_ID can be joined with Tourist_Attractions.Tourist_Attraction_ID
#
### Question:
#
# What is the average price range of five star hotels that allow pets?
#
### SQL:
#
# SELECT avg(price_range) FROM HOTELS WHERE star_rating_code = "5" AND pets_allowed_yn = 1
#
### End.
|
cre_Theme_park
|
### Complete SQL query only and with no explanation
### SQL tables followed by foreign key information:
#
# Ref_Hotel_Star_Ratings ( star_rating_code, star_rating_description )
# Locations ( Location_ID, Location_Name, Address, Other_Details )
# Ref_Attraction_Types ( Attraction_Type_Code, Attraction_Type_Description )
# Visitors ( Tourist_ID, Tourist_Details )
# Features ( Feature_ID, Feature_Details )
# Hotels ( hotel_id, star_rating_code, pets_allowed_yn, price_range, other_hotel_details )
# Tourist_Attractions ( Tourist_Attraction_ID, Attraction_Type_Code, Location_ID, How_to_Get_There, Name, Description, Opening_Hours, Other_Details )
# Street_Markets ( Market_ID, Market_Details )
# Shops ( Shop_ID, Shop_Details )
# Museums ( Museum_ID, Museum_Details )
# Royal_Family ( Royal_Family_ID, Royal_Family_Details )
# Theme_Parks ( Theme_Park_ID, Theme_Park_Details )
# Visits ( Visit_ID, Tourist_Attraction_ID, Tourist_ID, Visit_Date, Visit_Details )
# Photos ( Photo_ID, Tourist_Attraction_ID, Name, Description, Filename, Other_Details )
# Staff ( Staff_ID, Tourist_Attraction_ID, Name, Other_Details )
# Tourist_Attraction_Features ( Tourist_Attraction_ID, Feature_ID )
#
# Hotels.star_rating_code can be joined with Ref_Hotel_Star_Ratings.star_rating_code
# Tourist_Attractions.Attraction_Type_Code can be joined with Ref_Attraction_Types.Attraction_Type_Code
# Tourist_Attractions.Location_ID can be joined with Locations.Location_ID
# Street_Markets.Market_ID can be joined with Tourist_Attractions.Tourist_Attraction_ID
# Shops.Shop_ID can be joined with Tourist_Attractions.Tourist_Attraction_ID
# Museums.Museum_ID can be joined with Tourist_Attractions.Tourist_Attraction_ID
# Royal_Family.Royal_Family_ID can be joined with Tourist_Attractions.Tourist_Attraction_ID
# Theme_Parks.Theme_Park_ID can be joined with Tourist_Attractions.Tourist_Attraction_ID
# Visits.Tourist_ID can be joined with Visitors.Tourist_ID
# Visits.Tourist_Attraction_ID can be joined with Tourist_Attractions.Tourist_Attraction_ID
# Photos.Tourist_Attraction_ID can be joined with Tourist_Attractions.Tourist_Attraction_ID
# Staff.Tourist_Attraction_ID can be joined with Tourist_Attractions.Tourist_Attraction_ID
# Tourist_Attraction_Features.Feature_ID can be joined with Features.Feature_ID
# Tourist_Attraction_Features.Tourist_Attraction_ID can be joined with Tourist_Attractions.Tourist_Attraction_ID
#
### Question:
#
# What is the address of the location "UK Gallery"?
#
### SQL:
#
# SELECT Address FROM LOCATIONS WHERE Location_Name = "UK Gallery"
#
### End.
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.