combined_text
stringlengths 106
1.05k
|
---|
###question:What are the positions with both players having more than 20 points and less than 10 points.###answer:SELECT POSITION FROM player WHERE Points > 20 INTERSECT SELECT POSITION FROM player WHERE Points < 10###context:CREATE TABLE player (POSITION VARCHAR, Points INTEGER) |
###question:Show total points of all players.###answer:SELECT SUM(Points) FROM player###context:CREATE TABLE player (Points INTEGER) |
###question:how many different positions are there?###answer:SELECT COUNT(DISTINCT POSITION) FROM player###context:CREATE TABLE player (POSITION VARCHAR) |
###question:what are the name of players who get more than the average points.###answer:SELECT name FROM player WHERE points > (SELECT AVG(points) FROM player)###context:CREATE TABLE player (name VARCHAR, points INTEGER) |
###question:find the number of players whose points are lower than 30 in each position.###answer:SELECT COUNT(*), POSITION FROM player WHERE points < 30 GROUP BY POSITION###context:CREATE TABLE player (POSITION VARCHAR, points INTEGER) |
###question:which country did participated in the most number of Tournament competitions?###answer:SELECT country FROM competition WHERE competition_type = 'Tournament' GROUP BY country ORDER BY COUNT(*) DESC LIMIT 1###context:CREATE TABLE competition (country VARCHAR, competition_type VARCHAR) |
###question:which countries did participated in both Friendly and Tournament type competitions.###answer:SELECT country FROM competition WHERE competition_type = 'Friendly' INTERSECT SELECT country FROM competition WHERE competition_type = 'Tournament'###context:CREATE TABLE competition (country VARCHAR, competition_type VARCHAR) |
###question:Find the countries that have never participated in any competition with Friendly type.###answer:SELECT country FROM competition EXCEPT SELECT country FROM competition WHERE competition_type = 'Friendly'###context:CREATE TABLE competition (country VARCHAR, competition_type VARCHAR) |
###question:How many furniture components are there in total?###answer:SELECT SUM(num_of_component) FROM furniture###context:CREATE TABLE furniture (num_of_component INTEGER) |
###question:Return the name and id of the furniture with the highest market rate.###answer:SELECT name, furniture_id FROM furniture ORDER BY market_rate DESC LIMIT 1###context:CREATE TABLE furniture (name VARCHAR, furniture_id VARCHAR, market_rate VARCHAR) |
###question:find the total market rate of the furnitures that have the top 2 market shares.###answer:SELECT SUM(market_rate) FROM furniture ORDER BY market_rate DESC LIMIT 2###context:CREATE TABLE furniture (market_rate INTEGER) |
###question:Find the component amounts and names of all furnitures that have more than 10 components.###answer:SELECT Num_of_Component, name FROM furniture WHERE Num_of_Component > 10###context:CREATE TABLE furniture (Num_of_Component INTEGER, name VARCHAR) |
###question:Find the name and component amount of the least popular furniture.###answer:SELECT name, Num_of_Component FROM furniture ORDER BY market_rate LIMIT 1###context:CREATE TABLE furniture (name VARCHAR, Num_of_Component VARCHAR, market_rate VARCHAR) |
###question:Find the names of furnitures whose prices are lower than the highest price.###answer:SELECT t1.name FROM furniture AS t1 JOIN furniture_manufacte AS t2 ON t1.Furniture_ID = t2.Furniture_ID WHERE t2.Price_in_Dollar < (SELECT MAX(Price_in_Dollar) FROM furniture_manufacte)###context:CREATE TABLE furniture_manufacte (Furniture_ID VARCHAR, Price_in_Dollar INTEGER); CREATE TABLE furniture (name VARCHAR, Furniture_ID VARCHAR); CREATE TABLE furniture_manufacte (Price_in_Dollar INTEGER) |
###question:Which manufacturer has the most number of shops? List its name and year of opening.###answer:SELECT open_year, name FROM manufacturer ORDER BY num_of_shops DESC LIMIT 1###context:CREATE TABLE manufacturer (open_year VARCHAR, name VARCHAR, num_of_shops VARCHAR) |
###question:Find the average number of factories for the manufacturers that have more than 20 shops.###answer:SELECT AVG(Num_of_Factories) FROM manufacturer WHERE num_of_shops > 20###context:CREATE TABLE manufacturer (Num_of_Factories INTEGER, num_of_shops INTEGER) |
###question:List all manufacturer names and ids ordered by their opening year.###answer:SELECT name, manufacturer_id FROM manufacturer ORDER BY open_year###context:CREATE TABLE manufacturer (name VARCHAR, manufacturer_id VARCHAR, open_year VARCHAR) |
###question:Give me the name and year of opening of the manufacturers that have either less than 10 factories or more than 10 shops.###answer:SELECT name, open_year FROM manufacturer WHERE num_of_shops > 10 OR Num_of_Factories < 10###context:CREATE TABLE manufacturer (name VARCHAR, open_year VARCHAR, num_of_shops VARCHAR, Num_of_Factories VARCHAR) |
###question:what is the average number of factories and maximum number of shops for manufacturers that opened before 1990.###answer:SELECT MAX(num_of_shops), AVG(Num_of_Factories) FROM manufacturer WHERE open_year < 1990###context:CREATE TABLE manufacturer (num_of_shops INTEGER, Num_of_Factories INTEGER, open_year INTEGER) |
###question:Find the id and number of shops for the company that produces the most expensive furniture.###answer:SELECT t1.manufacturer_id, t1.num_of_shops FROM manufacturer AS t1 JOIN furniture_manufacte AS t2 ON t1.manufacturer_id = t2.manufacturer_id ORDER BY t2.Price_in_Dollar DESC LIMIT 1###context:CREATE TABLE manufacturer (manufacturer_id VARCHAR, num_of_shops VARCHAR); CREATE TABLE furniture_manufacte (manufacturer_id VARCHAR, Price_in_Dollar VARCHAR) |
###question:Find the number of funiture types produced by each manufacturer as well as the company names.###answer:SELECT COUNT(*), t1.name FROM manufacturer AS t1 JOIN furniture_manufacte AS t2 ON t1.manufacturer_id = t2.manufacturer_id GROUP BY t1.manufacturer_id###context:CREATE TABLE furniture_manufacte (manufacturer_id VARCHAR); CREATE TABLE manufacturer (name VARCHAR, manufacturer_id VARCHAR) |
###question:Give me the names and prices of furnitures which some companies are manufacturing.###answer:SELECT t1.name, t2.price_in_dollar FROM furniture AS t1 JOIN furniture_manufacte AS t2 ON t1.Furniture_ID = t2.Furniture_ID###context:CREATE TABLE furniture_manufacte (price_in_dollar VARCHAR, Furniture_ID VARCHAR); CREATE TABLE furniture (name VARCHAR, Furniture_ID VARCHAR) |
###question:Find the market shares and names of furnitures which no any company is producing in our records.###answer:SELECT Market_Rate, name FROM furniture WHERE NOT Furniture_ID IN (SELECT Furniture_ID FROM furniture_manufacte)###context:CREATE TABLE furniture (Market_Rate VARCHAR, name VARCHAR, Furniture_ID VARCHAR); CREATE TABLE furniture_manufacte (Market_Rate VARCHAR, name VARCHAR, Furniture_ID VARCHAR) |
###question:Find the name of the company that produces both furnitures with less than 6 components and furnitures with more than 10 components.###answer:SELECT t3.name FROM furniture AS t1 JOIN furniture_manufacte AS t2 ON t1.Furniture_ID = t2.Furniture_ID JOIN manufacturer AS t3 ON t2.manufacturer_id = t3.manufacturer_id WHERE t1.num_of_component < 6 INTERSECT SELECT t3.name FROM furniture AS t1 JOIN furniture_manufacte AS t2 ON t1.Furniture_ID = t2.Furniture_ID JOIN manufacturer AS t3 ON t2.manufacturer_id = t3.manufacturer_id WHERE t1.num_of_component > 10###context:CREATE TABLE furniture_manufacte (Furniture_ID VARCHAR, manufacturer_id VARCHAR); CREATE TABLE manufacturer (name VARCHAR, manufacturer_id VARCHAR); CREATE TABLE furniture (Furniture_ID VARCHAR, num_of_component INTEGER) |
###question:Display the first name and department name for each employee.###answer:SELECT T1.first_name, T2.department_name FROM employees AS T1 JOIN departments AS T2 ON T1.department_id = T2.department_id###context:CREATE TABLE departments (department_name VARCHAR, department_id VARCHAR); CREATE TABLE employees (first_name VARCHAR, department_id VARCHAR) |
###question:List the full name (first and last name), and salary for those employees who earn below 6000.###answer:SELECT first_name, last_name, salary FROM employees WHERE salary < 6000###context:CREATE TABLE employees (first_name VARCHAR, last_name VARCHAR, salary INTEGER) |
###question:Display the first name, and department number for all employees whose last name is "McEwen".###answer:SELECT first_name, department_id FROM employees WHERE last_name = 'McEwen'###context:CREATE TABLE employees (first_name VARCHAR, department_id VARCHAR, last_name VARCHAR) |
###question:Return all the information for all employees without any department number.###answer:SELECT * FROM employees WHERE department_id = "null"###context:CREATE TABLE employees (department_id VARCHAR) |
###question:Display all the information about the department Marketing.###answer:SELECT * FROM departments WHERE department_name = 'Marketing'###context:CREATE TABLE departments (department_name VARCHAR) |
###question:when is the hire date for those employees whose first name does not containing the letter M?###answer:SELECT hire_date FROM employees WHERE NOT first_name LIKE '%M%'###context:CREATE TABLE employees (hire_date VARCHAR, first_name VARCHAR) |
###question:display the full name (first and last), hire date, salary, and department number for those employees whose first name does not containing the letter M.###answer:SELECT first_name, last_name, hire_date, salary, department_id FROM employees WHERE NOT first_name LIKE '%M%'###context:CREATE TABLE employees (first_name VARCHAR, last_name VARCHAR, hire_date VARCHAR, salary VARCHAR, department_id VARCHAR) |
###question:display the full name (first and last), hire date, salary, and department number for those employees whose first name does not containing the letter M and make the result set in ascending order by department number.###answer:SELECT first_name, last_name, hire_date, salary, department_id FROM employees WHERE NOT first_name LIKE '%M%' ORDER BY department_id###context:CREATE TABLE employees (first_name VARCHAR, last_name VARCHAR, hire_date VARCHAR, salary VARCHAR, department_id VARCHAR) |
###question:what is the phone number of employees whose salary is in the range of 8000 and 12000?###answer:SELECT phone_number FROM employees WHERE salary BETWEEN 8000 AND 12000###context:CREATE TABLE employees (phone_number VARCHAR, salary INTEGER) |
###question:display all the information of employees whose salary is in the range of 8000 and 12000 and commission is not null or department number does not equal to 40.###answer:SELECT * FROM employees WHERE salary BETWEEN 8000 AND 12000 AND commission_pct <> "null" OR department_id <> 40###context:CREATE TABLE employees (department_id VARCHAR, salary VARCHAR, commission_pct VARCHAR) |
###question:What are the full name (first and last name) and salary for all employees who does not have any value for commission?###answer:SELECT first_name, last_name, salary FROM employees WHERE commission_pct = "null"###context:CREATE TABLE employees (first_name VARCHAR, last_name VARCHAR, salary VARCHAR, commission_pct VARCHAR) |
###question:Display the first and last name, and salary for those employees whose first name is ending with the letter m.###answer:SELECT first_name, last_name, salary FROM employees WHERE first_name LIKE '%m'###context:CREATE TABLE employees (first_name VARCHAR, last_name VARCHAR, salary VARCHAR) |
###question:Find job id and date of hire for those employees who was hired between November 5th, 2007 and July 5th, 2009.###answer:SELECT job_id, hire_date FROM employees WHERE hire_date BETWEEN '2007-11-05' AND '2009-07-05'###context:CREATE TABLE employees (job_id VARCHAR, hire_date INTEGER) |
###question:What are the first and last name for those employees who works either in department 70 or 90?###answer:SELECT first_name, last_name FROM employees WHERE department_id = 70 OR department_id = 90###context:CREATE TABLE employees (first_name VARCHAR, last_name VARCHAR, department_id VARCHAR) |
###question:Find the salary and manager number for those employees who is working under a manager.###answer:SELECT salary, manager_id FROM employees WHERE manager_id <> "null"###context:CREATE TABLE employees (salary VARCHAR, manager_id VARCHAR) |
###question:display all the details from Employees table for those employees who was hired before 2002-06-21.###answer:SELECT * FROM employees WHERE hire_date < '2002-06-21'###context:CREATE TABLE employees (hire_date INTEGER) |
###question:display all the information for all employees who have the letters D or S in their first name and also arrange the result in descending order by salary.###answer:SELECT * FROM employees WHERE first_name LIKE '%D%' OR first_name LIKE '%S%' ORDER BY salary DESC###context:CREATE TABLE employees (salary VARCHAR, first_name VARCHAR) |
###question:display those employees who joined after 7th September, 1987.###answer:SELECT * FROM employees WHERE hire_date > '1987-09-07'###context:CREATE TABLE employees (hire_date INTEGER) |
###question:display the job title of jobs which minimum salary is greater than 9000.###answer:SELECT job_title FROM jobs WHERE min_salary > 9000###context:CREATE TABLE jobs (job_title VARCHAR, min_salary INTEGER) |
###question:display job Title, the difference between minimum and maximum salaries for those jobs which max salary within the range 12000 to 18000.###answer:SELECT job_title, max_salary - min_salary FROM jobs WHERE max_salary BETWEEN 12000 AND 18000###context:CREATE TABLE jobs (job_title VARCHAR, max_salary INTEGER, min_salary VARCHAR) |
###question:display the emails of the employees who have no commission percentage and salary within the range 7000 to 12000 and works in that department which number is 50.###answer:SELECT email FROM employees WHERE commission_pct = "null" AND salary BETWEEN 7000 AND 12000 AND department_id = 50###context:CREATE TABLE employees (email VARCHAR, department_id VARCHAR, commission_pct VARCHAR, salary VARCHAR) |
###question:display the employee ID for each employee and the date on which he ended his previous job.###answer:SELECT employee_id, MAX(end_date) FROM job_history GROUP BY employee_id###context:CREATE TABLE job_history (employee_id VARCHAR, end_date INTEGER) |
###question:display those departments where more than ten employees work who got a commission percentage.###answer:SELECT department_id FROM employees GROUP BY department_id HAVING COUNT(commission_pct) > 10###context:CREATE TABLE employees (department_id VARCHAR, commission_pct VARCHAR) |
###question:Find the ids of the departments where any manager is managing 4 or more employees.###answer:SELECT DISTINCT department_id FROM employees GROUP BY department_id, manager_id HAVING COUNT(employee_id) >= 4###context:CREATE TABLE employees (department_id VARCHAR, manager_id VARCHAR, employee_id VARCHAR) |
###question:display the average salary of employees for each department who gets a commission percentage.###answer:SELECT department_id, AVG(salary) FROM employees WHERE commission_pct <> "null" GROUP BY department_id###context:CREATE TABLE employees (department_id VARCHAR, salary INTEGER, commission_pct VARCHAR) |
###question:display the country ID and number of cities for each country.###answer:SELECT country_id, COUNT(*) FROM locations GROUP BY country_id###context:CREATE TABLE locations (country_id VARCHAR) |
###question:display job ID for those jobs that were done by two or more for more than 300 days.###answer:SELECT job_id FROM job_history WHERE end_date - start_date > 300 GROUP BY job_id HAVING COUNT(*) >= 2###context:CREATE TABLE job_history (job_id VARCHAR, end_date VARCHAR, start_date VARCHAR) |
###question:display the ID for those employees who did two or more jobs in the past.###answer:SELECT employee_id FROM job_history GROUP BY employee_id HAVING COUNT(*) >= 2###context:CREATE TABLE job_history (employee_id VARCHAR) |
###question:Find employee with ID and name of the country presently where (s)he is working.###answer:SELECT T1.employee_id, T4.country_name FROM employees AS T1 JOIN departments AS T2 ON T1.department_id = T2.department_id JOIN locations AS T3 ON T2.location_id = T3.location_id JOIN countries AS T4 ON T3.country_id = T4.country_id###context:CREATE TABLE countries (country_name VARCHAR, country_id VARCHAR); CREATE TABLE departments (department_id VARCHAR, location_id VARCHAR); CREATE TABLE locations (location_id VARCHAR, country_id VARCHAR); CREATE TABLE employees (employee_id VARCHAR, department_id VARCHAR) |
###question:display the department name and number of employees in each of the department.###answer:SELECT T2.department_name, COUNT(*) FROM employees AS T1 JOIN departments AS T2 ON T1.department_id = T2.department_id GROUP BY T2.department_name###context:CREATE TABLE departments (department_name VARCHAR, department_id VARCHAR); CREATE TABLE employees (department_id VARCHAR) |
###question:Can you return all detailed info of jobs which was done by any of the employees who is presently earning a salary on and above 12000?###answer:SELECT * FROM job_history AS T1 JOIN employees AS T2 ON T1.employee_id = T2.employee_id WHERE T2.salary >= 12000###context:CREATE TABLE job_history (employee_id VARCHAR); CREATE TABLE employees (employee_id VARCHAR, salary VARCHAR) |
###question:display job title and average salary of employees.###answer:SELECT job_title, AVG(salary) FROM employees AS T1 JOIN jobs AS T2 ON T1.job_id = T2.job_id GROUP BY T2.job_title###context:CREATE TABLE jobs (job_title VARCHAR, job_id VARCHAR); CREATE TABLE employees (job_id VARCHAR) |
###question:What is the full name ( first name and last name ) for those employees who gets more salary than the employee whose id is 163?###answer:SELECT first_name, last_name FROM employees WHERE salary > (SELECT salary FROM employees WHERE employee_id = 163)###context:CREATE TABLE employees (first_name VARCHAR, last_name VARCHAR, salary INTEGER, employee_id VARCHAR) |
###question:return the smallest salary for every departments.###answer:SELECT MIN(salary), department_id FROM employees GROUP BY department_id###context:CREATE TABLE employees (department_id VARCHAR, salary INTEGER) |
###question:Find the first name and last name and department id for those employees who earn such amount of salary which is the smallest salary of any of the departments.###answer:SELECT first_name, last_name, department_id FROM employees WHERE salary IN (SELECT MIN(salary) FROM employees GROUP BY department_id)###context:CREATE TABLE employees (first_name VARCHAR, last_name VARCHAR, department_id VARCHAR, salary INTEGER) |
###question:Find the employee id for all employees who earn more than the average salary.###answer:SELECT employee_id FROM employees WHERE salary > (SELECT AVG(salary) FROM employees)###context:CREATE TABLE employees (employee_id VARCHAR, salary INTEGER) |
###question:display the employee id and salary of all employees who report to Payam (first name).###answer:SELECT employee_id, salary FROM employees WHERE manager_id = (SELECT employee_id FROM employees WHERE first_name = 'Payam')###context:CREATE TABLE employees (employee_id VARCHAR, salary VARCHAR, manager_id VARCHAR, first_name VARCHAR) |
###question:find the name of all departments that do actually have one or more employees assigned to them.###answer:SELECT DISTINCT T2.department_name FROM employees AS T1 JOIN departments AS T2 ON T1.department_id = T2.department_id###context:CREATE TABLE departments (department_name VARCHAR, department_id VARCHAR); CREATE TABLE employees (department_id VARCHAR) |
###question:get the details of employees who manage a department.###answer:SELECT DISTINCT * FROM employees AS T1 JOIN departments AS T2 ON T1.department_id = T2.department_id WHERE T1.employee_id = T2.manager_id###context:CREATE TABLE departments (department_id VARCHAR, manager_id VARCHAR); CREATE TABLE employees (department_id VARCHAR, employee_id VARCHAR) |
###question:Find the job ID for those jobs which average salary is above 8000.###answer:SELECT job_id FROM employees GROUP BY job_id HAVING AVG(salary) > 8000###context:CREATE TABLE employees (job_id VARCHAR, salary INTEGER) |
###question:display the employee ID and job name for all those jobs in department 80.###answer:SELECT T1.employee_id, T2.job_title FROM employees AS T1 JOIN jobs AS T2 ON T1.job_id = T2.job_id WHERE T1.department_id = 80###context:CREATE TABLE jobs (job_title VARCHAR, job_id VARCHAR); CREATE TABLE employees (employee_id VARCHAR, job_id VARCHAR, department_id VARCHAR) |
###question:What is the first name and job id for all employees in the Finance department?###answer:SELECT T1.first_name, T1.job_id FROM employees AS T1 JOIN departments AS T2 ON T1.department_id = T2.department_id WHERE T2.department_name = 'Finance'###context:CREATE TABLE departments (department_id VARCHAR, department_name VARCHAR); CREATE TABLE employees (first_name VARCHAR, job_id VARCHAR, department_id VARCHAR) |
###question:display all the information of the employees whose salary if within the range of smallest salary and 2500.###answer:SELECT * FROM employees WHERE salary BETWEEN (SELECT MIN(salary) FROM employees) AND 2500###context:CREATE TABLE employees (salary INTEGER) |
###question:Find the ids of the employees who does not work in those departments where some employees works whose manager id within the range 100 and 200.###answer:SELECT * FROM employees WHERE NOT department_id IN (SELECT department_id FROM departments WHERE manager_id BETWEEN 100 AND 200)###context:CREATE TABLE departments (department_id VARCHAR, manager_id INTEGER); CREATE TABLE employees (department_id VARCHAR, manager_id INTEGER) |
###question:display the employee name ( first name and last name ) and hire date for all employees in the same department as Clara.###answer:SELECT first_name, last_name, hire_date FROM employees WHERE department_id = (SELECT department_id FROM employees WHERE first_name = "Clara")###context:CREATE TABLE employees (first_name VARCHAR, last_name VARCHAR, hire_date VARCHAR, department_id VARCHAR) |
###question:display the employee name ( first name and last name ) and hire date for all employees in the same department as Clara excluding Clara.###answer:SELECT first_name, last_name, hire_date FROM employees WHERE department_id = (SELECT department_id FROM employees WHERE first_name = "Clara") AND first_name <> "Clara"###context:CREATE TABLE employees (first_name VARCHAR, last_name VARCHAR, hire_date VARCHAR, department_id VARCHAR) |
###question:display the employee number and name( first name and last name ) for all employees who work in a department with any employee whose name contains a ’T’.###answer:SELECT employee_id, first_name, last_name FROM employees WHERE department_id IN (SELECT department_id FROM employees WHERE first_name LIKE '%T%')###context:CREATE TABLE employees (employee_id VARCHAR, first_name VARCHAR, last_name VARCHAR, department_id VARCHAR) |
###question:display the employee number, name( first name and last name ), and salary for all employees who earn more than the average salary and who work in a department with any employee with a 'J' in their first name.###answer:SELECT employee_id, first_name, last_name, salary FROM employees WHERE salary > (SELECT AVG(salary) FROM employees) AND department_id IN (SELECT department_id FROM employees WHERE first_name LIKE '%J%')###context:CREATE TABLE employees (employee_id VARCHAR, first_name VARCHAR, last_name VARCHAR, salary INTEGER, department_id VARCHAR) |
###question:display the employee number and job id for all employees whose salary is smaller than any salary of those employees whose job title is MK_MAN.###answer:SELECT employee_id, job_id FROM employees WHERE salary < (SELECT MIN(salary) FROM employees WHERE job_id = 'MK_MAN')###context:CREATE TABLE employees (employee_id VARCHAR, job_id VARCHAR, salary INTEGER) |
###question:display the employee number, name( first name and last name ) and job title for all employees whose salary is more than any salary of those employees whose job title is PU_MAN.###answer:SELECT employee_id, first_name, last_name, job_id FROM employees WHERE salary > (SELECT MAX(salary) FROM employees WHERE job_id = 'PU_MAN')###context:CREATE TABLE employees (employee_id VARCHAR, first_name VARCHAR, last_name VARCHAR, job_id VARCHAR, salary INTEGER) |
###question:display the department id and the total salary for those departments which contains at least two employees.###answer:SELECT department_id, SUM(salary) FROM employees GROUP BY department_id HAVING COUNT(*) >= 2###context:CREATE TABLE employees (department_id VARCHAR, salary INTEGER) |
###question:display all the information of those employees who did not have any job in the past.###answer:SELECT * FROM employees WHERE NOT employee_id IN (SELECT employee_id FROM job_history)###context:CREATE TABLE job_history (employee_id VARCHAR); CREATE TABLE employees (employee_id VARCHAR) |
###question:display the department ID, full name (first and last name), salary for those employees who is highest salary in every department.###answer:SELECT first_name, last_name, salary, department_id, MAX(salary) FROM employees GROUP BY department_id###context:CREATE TABLE employees (first_name VARCHAR, last_name VARCHAR, salary INTEGER, department_id VARCHAR) |
###question:display the first and last name, department, city, and state province for each employee.###answer:SELECT T1.first_name, T1.last_name, T2.department_name, T3.city, T3.state_province FROM employees AS T1 JOIN departments AS T2 ON T1.department_id = T2.department_id JOIN locations AS T3 ON T2.location_id = T3.location_id###context:CREATE TABLE departments (department_name VARCHAR, department_id VARCHAR, location_id VARCHAR); CREATE TABLE employees (first_name VARCHAR, last_name VARCHAR, department_id VARCHAR); CREATE TABLE locations (city VARCHAR, state_province VARCHAR, location_id VARCHAR) |
###question:display those employees who contain a letter z to their first name and also display their last name, city.###answer:SELECT T1.first_name, T1.last_name, T3.city FROM employees AS T1 JOIN departments AS T2 ON T1.department_id = T2.department_id JOIN locations AS T3 ON T2.location_id = T3.location_id WHERE T1.first_name LIKE '%z%'###context:CREATE TABLE locations (city VARCHAR, location_id VARCHAR); CREATE TABLE employees (first_name VARCHAR, last_name VARCHAR, department_id VARCHAR); CREATE TABLE departments (department_id VARCHAR, location_id VARCHAR) |
###question:display the department name, city, and state province for each department.###answer:SELECT T1.department_name, T2.city, T2.state_province FROM departments AS T1 JOIN locations AS T2 ON T2.location_id = T1.location_id###context:CREATE TABLE locations (city VARCHAR, state_province VARCHAR, location_id VARCHAR); CREATE TABLE departments (department_name VARCHAR, location_id VARCHAR) |
###question:display the full name (first and last name ) of employee with ID and name of the country presently where (s)he is working.###answer:SELECT T1.first_name, T1.last_name, T1.employee_id, T4.country_name FROM employees AS T1 JOIN departments AS T2 ON T1.department_id = T2.department_id JOIN locations AS T3 ON T2.location_id = T3.location_id JOIN countries AS T4 ON T3.country_id = T4.country_id###context:CREATE TABLE countries (country_name VARCHAR, country_id VARCHAR); CREATE TABLE departments (department_id VARCHAR, location_id VARCHAR); CREATE TABLE locations (location_id VARCHAR, country_id VARCHAR); CREATE TABLE employees (first_name VARCHAR, last_name VARCHAR, employee_id VARCHAR, department_id VARCHAR) |
###question:display the department name and number of employees in each of the department.###answer:SELECT department_name, COUNT(*) FROM employees AS T1 JOIN departments AS T2 ON T1.department_id = T2.department_id GROUP BY department_name###context:CREATE TABLE employees (department_id VARCHAR); CREATE TABLE departments (department_id VARCHAR) |
###question:display the full name (first and last name), and salary of those employees who working in any department located in London.###answer:SELECT first_name, last_name, salary FROM employees AS T1 JOIN departments AS T2 ON T1.department_id = T2.department_id JOIN locations AS T3 ON T2.location_id = T3.location_id WHERE T3.city = 'London'###context:CREATE TABLE locations (location_id VARCHAR, city VARCHAR); CREATE TABLE employees (department_id VARCHAR); CREATE TABLE departments (department_id VARCHAR, location_id VARCHAR) |
###question:What is the name of the song that was released in the most recent year?###answer:SELECT song_name, releasedate FROM song ORDER BY releasedate DESC LIMIT 1###context:CREATE TABLE song (song_name VARCHAR, releasedate VARCHAR) |
###question:What is the id of the longest song?###answer:SELECT f_id FROM files ORDER BY duration DESC LIMIT 1###context:CREATE TABLE files (f_id VARCHAR, duration VARCHAR) |
###question:Find the names of all English songs.###answer:SELECT song_name FROM song WHERE languages = "english"###context:CREATE TABLE song (song_name VARCHAR, languages VARCHAR) |
###question:What are the id of songs whose format is mp3.###answer:SELECT f_id FROM files WHERE formats = "mp3"###context:CREATE TABLE files (f_id VARCHAR, formats VARCHAR) |
###question:List the name and country of origin for all singers who have produced songs with rating above 9.###answer:SELECT DISTINCT T1.artist_name, T1.country FROM artist AS T1 JOIN song AS T2 ON T1.artist_name = T2.artist_name WHERE T2.rating > 9###context:CREATE TABLE song (artist_name VARCHAR, rating INTEGER); CREATE TABLE artist (artist_name VARCHAR, country VARCHAR) |
###question:List the file size and format for all songs that have resolution lower than 800.###answer:SELECT DISTINCT T1.file_size, T1.formats FROM files AS T1 JOIN song AS T2 ON T1.f_id = T2.f_id WHERE T2.resolution < 800###context:CREATE TABLE song (f_id VARCHAR, resolution INTEGER); CREATE TABLE files (file_size VARCHAR, formats VARCHAR, f_id VARCHAR) |
###question:What is the name of the artist who produced the shortest song?###answer:SELECT T1.artist_name FROM song AS T1 JOIN files AS T2 ON T1.f_id = T2.f_id ORDER BY T2.duration LIMIT 1###context:CREATE TABLE files (f_id VARCHAR, duration VARCHAR); CREATE TABLE song (artist_name VARCHAR, f_id VARCHAR) |
###question:What are the names and countries of origin for the artists who produced the top three highly rated songs.###answer:SELECT T1.artist_name, T1.country FROM artist AS T1 JOIN song AS T2 ON T1.artist_name = T2.artist_name ORDER BY T2.rating DESC LIMIT 3###context:CREATE TABLE song (artist_name VARCHAR, rating VARCHAR); CREATE TABLE artist (artist_name VARCHAR, country VARCHAR) |
###question:How many songs have 4 minute duration?###answer:SELECT COUNT(*) FROM files WHERE duration LIKE "4:%"###context:CREATE TABLE files (duration VARCHAR) |
###question:How many artists are from Bangladesh?###answer:SELECT COUNT(*) FROM artist WHERE country = "Bangladesh"###context:CREATE TABLE artist (country VARCHAR) |
###question:What is the average rating of songs produced by female artists?###answer:SELECT AVG(T2.rating) FROM artist AS T1 JOIN song AS T2 ON T1.artist_name = T2.artist_name WHERE T1.gender = "Female"###context:CREATE TABLE song (rating INTEGER, artist_name VARCHAR); CREATE TABLE artist (artist_name VARCHAR, gender VARCHAR) |
###question:What is the most popular file format?###answer:SELECT formats FROM files GROUP BY formats ORDER BY COUNT(*) DESC LIMIT 1###context:CREATE TABLE files (formats VARCHAR) |
###question:Find the names of the artists who are from UK and have produced English songs.###answer:SELECT artist_name FROM artist WHERE country = "UK" INTERSECT SELECT artist_name FROM song WHERE languages = "english"###context:CREATE TABLE artist (artist_name VARCHAR, country VARCHAR, languages VARCHAR); CREATE TABLE song (artist_name VARCHAR, country VARCHAR, languages VARCHAR) |
###question:Find the id of songs that are available in mp4 format and have resolution lower than 1000.###answer:SELECT f_id FROM files WHERE formats = "mp4" INTERSECT SELECT f_id FROM song WHERE resolution < 1000###context:CREATE TABLE song (f_id VARCHAR, formats VARCHAR, resolution INTEGER); CREATE TABLE files (f_id VARCHAR, formats VARCHAR, resolution INTEGER) |
###question:What is the country of origin of the artist who is female and produced a song in Bangla?###answer:SELECT T1.country FROM artist AS T1 JOIN song AS T2 ON T1.artist_name = T2.artist_name WHERE T1.gender = "Female" AND T2.languages = "bangla"###context:CREATE TABLE artist (country VARCHAR, artist_name VARCHAR, gender VARCHAR); CREATE TABLE song (artist_name VARCHAR, languages VARCHAR) |
###question:What is the average duration of songs that have mp3 format and resolution below 800?###answer:SELECT AVG(T1.duration) FROM files AS T1 JOIN song AS T2 ON T1.f_id = T2.f_id WHERE T1.formats = "mp3" AND T2.resolution < 800###context:CREATE TABLE files (duration INTEGER, f_id VARCHAR, formats VARCHAR); CREATE TABLE song (f_id VARCHAR, resolution VARCHAR) |
###question:What is the number of artists for each gender?###answer:SELECT COUNT(*), gender FROM artist GROUP BY gender###context:CREATE TABLE artist (gender VARCHAR) |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.