Database: store_1

Question: How many albums does Billy Cobham has?
SQL: SELECT count(*) FROM albums AS T1 JOIN artists AS T2 ON  T1.artist_id = T2.id WHERE T2.name = "Billy Cobham";

Question: Eduardo Martins is a customer at which company?
SQL: SELECT company FROM customers WHERE first_name = "Eduardo" AND last_name = "Martins";

Question: What is Astrid Gruber's email and phone number?
SQL: SELECT email ,  phone FROM customers WHERE first_name = "Astrid" AND last_name = "Gruber";

Question: What country does Roberto Almeida live?
SQL: SELECT country FROM customers WHERE first_name = "Roberto" AND last_name = "Almeida";

Question: List the name of albums that are released by artist whose name has 'Led'
SQL: SELECT T2.title FROM artists AS T1 JOIN albums AS T2 ON T1.id  =  T2.artist_id WHERE T1.name LIKE '%Led%'

Question: How many customers does Steve Johnson support?
SQL: SELECT count(*) FROM employees AS T1 JOIN customers AS T2 ON T2.support_rep_id = T1.id WHERE T1.first_name = "Steve" AND T1.last_name = "Johnson";

Question: What is the title, phone and hire date of Nancy Edwards?
SQL: SELECT title ,  phone ,  hire_date FROM employees WHERE first_name = "Nancy" AND last_name = "Edwards";

Question: find the full name of employees who report to Nancy Edwards?
SQL: SELECT T2.first_name , T2.last_name FROM employees AS T1 JOIN employees AS T2 ON T1.id = T2.reports_to WHERE T1.first_name = "Nancy" AND T1.last_name = "Edwards";

Question: What is the address of employee Nancy Edwards?
SQL: SELECT address FROM employees WHERE first_name = "Nancy" AND last_name = "Edwards";

Question: Find the full name of employee who supported the most number of customers.
SQL: SELECT T1.first_name , T1.last_name FROM employees AS T1 JOIN customers AS T2 ON T1.id  =  T2.support_rep_id GROUP BY T1.id ORDER BY count(*) DESC LIMIT 1

Question: What is employee Nancy Edwards's phone number?
SQL: SELECT phone FROM employees WHERE first_name = "Nancy" AND last_name = "Edwards";

Question: Who is the youngest employee in the company? List employee's first and last name.
SQL: SELECT first_name , last_name FROM employees ORDER BY birth_date DESC LIMIT 1;

Question: List top 10 employee work longest in the company. List employee's first and last name.
SQL: SELECT first_name , last_name FROM employees ORDER BY hire_date ASC LIMIT 10;

Question: Find the number of employees whose title is IT Staff from each city?
SQL: SELECT count(*) ,  city FROM employees WHERE title  =  'IT Staff' GROUP BY city

Question: Which employee manage most number of peoples? List employee's first and last name, and number of people report to that employee.
SQL: SELECT T2.first_name , T2.last_name ,  count(T1.reports_to) FROM employees AS T1 JOIN employees AS T2 ON T1.reports_to = T2.id GROUP BY T1.reports_to ORDER BY count(T1.reports_to) DESC LIMIT 1;

Question: How many orders does Lucas Mancini has?
SQL: SELECT count(*) FROM customers AS T1 JOIN invoices AS T2 ON T1.id = T2.customer_id WHERE T1.first_name = "Lucas" AND T1.last_name = "Mancini";