Input:
[INST] Here is a database schema:
club :
Club_ID [ INT ] primary_key
name [ TEXT ]
Region [ TEXT ]
Start_year [ TEXT ]

club_rank :
Rank [ INT ] primary_key
Club_ID [ INT ] club_rank.Club_ID = club.Club_ID
Gold [ INT ]
Silver [ INT ]
Bronze [ INT ]
Total [ INT ]

player :
Player_ID [ INT ] primary_key
name [ TEXT ]
Position [ TEXT ]
Club_ID [ INT ] player.Club_ID = club.Club_ID
Apps [ INT ]
Tries [ INT ]
Goals [ TEXT ]
Points [ INT ]

competition :
Competition_ID [ INT ] primary_key
Year [ INT ]
Competition_type [ TEXT ]
Country [ TEXT ]

competition_result :
Competition_ID [ INT ] primary_key competition_result.Competition_ID = competition.Competition_ID
Club_ID_1 [ INT ] competition_result.Club_ID_1 = club.Club_ID
Club_ID_2 [ INT ] competition_result.Club_ID_2 = club.Club_ID
Score [ TEXT ]

Please write me a SQL statement that answers the following question: find the number of players whose points are lower than 30 in each position. [/INST]

Output: SELECT count(*) ,  POSITION FROM player WHERE points  <  30 GROUP BY POSITION;


Input:
[INST] Here is a database schema:
club :
Club_ID [ INT ] primary_key
name [ TEXT ]
Region [ TEXT ]
Start_year [ TEXT ]

club_rank :
Rank [ INT ] primary_key
Club_ID [ INT ] club_rank.Club_ID = club.Club_ID
Gold [ INT ]
Silver [ INT ]
Bronze [ INT ]
Total [ INT ]

player :
Player_ID [ INT ] primary_key
name [ TEXT ]
Position [ TEXT ]
Club_ID [ INT ] player.Club_ID = club.Club_ID
Apps [ INT ]
Tries [ INT ]
Goals [ TEXT ]
Points [ INT ]

competition :
Competition_ID [ INT ] primary_key
Year [ INT ]
Competition_type [ TEXT ]
Country [ TEXT ]

competition_result :
Competition_ID [ INT ] primary_key competition_result.Competition_ID = competition.Competition_ID
Club_ID_1 [ INT ] competition_result.Club_ID_1 = club.Club_ID
Club_ID_2 [ INT ] competition_result.Club_ID_2 = club.Club_ID
Score [ TEXT ]

Please write me a SQL statement that answers the following question: What is the number of players who have points less than 30 for each position? [/INST]

Output: SELECT count(*) ,  POSITION FROM player WHERE points  <  30 GROUP BY POSITION;


Input:
[INST] Here is a database schema:
club :
Club_ID [ INT ] primary_key
name [ TEXT ]
Region [ TEXT ]
Start_year [ TEXT ]

club_rank :
Rank [ INT ] primary_key
Club_ID [ INT ] club_rank.Club_ID = club.Club_ID
Gold [ INT ]
Silver [ INT ]
Bronze [ INT ]
Total [ INT ]

player :
Player_ID [ INT ] primary_key
name [ TEXT ]
Position [ TEXT ]
Club_ID [ INT ] player.Club_ID = club.Club_ID
Apps [ INT ]
Tries [ INT ]
Goals [ TEXT ]
Points [ INT ]

competition :
Competition_ID [ INT ] primary_key
Year [ INT ]
Competition_type [ TEXT ]
Country [ TEXT ]

competition_result :
Competition_ID [ INT ] primary_key competition_result.Competition_ID = competition.Competition_ID
Club_ID_1 [ INT ] competition_result.Club_ID_1 = club.Club_ID
Club_ID_2 [ INT ] competition_result.Club_ID_2 = club.Club_ID
Score [ TEXT ]

Please write me a SQL statement that answers the following question: which country did participated in the most number of Tournament competitions? [/INST]

Output: SELECT country FROM competition WHERE competition_type  =  'Tournament' GROUP BY country ORDER BY count(*) DESC LIMIT 1;


Input:
[INST] Here is a database schema:
club :
Club_ID [ INT ] primary_key
name [ TEXT ]
Region [ TEXT ]
Start_year [ TEXT ]

club_rank :
Rank [ INT ] primary_key
Club_ID [ INT ] club_rank.Club_ID = club.Club_ID
Gold [ INT ]
Silver [ INT ]
Bronze [ INT ]
Total [ INT ]

player :
Player_ID [ INT ] primary_key
name [ TEXT ]
Position [ TEXT ]
Club_ID [ INT ] player.Club_ID = club.Club_ID
Apps [ INT ]
Tries [ INT ]
Goals [ TEXT ]
Points [ INT ]

competition :
Competition_ID [ INT ] primary_key
Year [ INT ]
Competition_type [ TEXT ]
Country [ TEXT ]

competition_result :
Competition_ID [ INT ] primary_key competition_result.Competition_ID = competition.Competition_ID
Club_ID_1 [ INT ] competition_result.Club_ID_1 = club.Club_ID
Club_ID_2 [ INT ] competition_result.Club_ID_2 = club.Club_ID
Score [ TEXT ]

Please write me a SQL statement that answers the following question: what is the name of the country that participated in the most tournament competitions? [/INST]

Output: SELECT country FROM competition WHERE competition_type  =  'Tournament' GROUP BY country ORDER BY count(*) DESC LIMIT 1;


Input:
[INST] Here is a database schema:
club :
Club_ID [ INT ] primary_key
name [ TEXT ]
Region [ TEXT ]
Start_year [ TEXT ]

club_rank :
Rank [ INT ] primary_key
Club_ID [ INT ] club_rank.Club_ID = club.Club_ID
Gold [ INT ]
Silver [ INT ]
Bronze [ INT ]
Total [ INT ]

player :
Player_ID [ INT ] primary_key
name [ TEXT ]
Position [ TEXT ]
Club_ID [ INT ] player.Club_ID = club.Club_ID
Apps [ INT ]
Tries [ INT ]
Goals [ TEXT ]
Points [ INT ]

competition :
Competition_ID [ INT ] primary_key
Year [ INT ]
Competition_type [ TEXT ]
Country [ TEXT ]

competition_result :
Competition_ID [ INT ] primary_key competition_result.Competition_ID = competition.Competition_ID
Club_ID_1 [ INT ] competition_result.Club_ID_1 = club.Club_ID
Club_ID_2 [ INT ] competition_result.Club_ID_2 = club.Club_ID
Score [ TEXT ]

Please write me a SQL statement that answers the following question: which countries did participated in both Friendly and Tournament type competitions. [/INST]

Output: SELECT country FROM competition WHERE competition_type  =  'Friendly' INTERSECT SELECT country FROM competition WHERE competition_type  =  'Tournament';


Input:
[INST] Here is a database schema:
club :
Club_ID [ INT ] primary_key
name [ TEXT ]
Region [ TEXT ]
Start_year [ TEXT ]

club_rank :
Rank [ INT ] primary_key
Club_ID [ INT ] club_rank.Club_ID = club.Club_ID
Gold [ INT ]
Silver [ INT ]
Bronze [ INT ]
Total [ INT ]

player :
Player_ID [ INT ] primary_key
name [ TEXT ]
Position [ TEXT ]
Club_ID [ INT ] player.Club_ID = club.Club_ID
Apps [ INT ]
Tries [ INT ]
Goals [ TEXT ]
Points [ INT ]

competition :
Competition_ID [ INT ] primary_key
Year [ INT ]
Competition_type [ TEXT ]
Country [ TEXT ]

competition_result :
Competition_ID [ INT ] primary_key competition_result.Competition_ID = competition.Competition_ID
Club_ID_1 [ INT ] competition_result.Club_ID_1 = club.Club_ID
Club_ID_2 [ INT ] competition_result.Club_ID_2 = club.Club_ID
Score [ TEXT ]

Please write me a SQL statement that answers the following question: What are the countries that participated in both friendly and tournament type competitions? [/INST]

Output: SELECT country FROM competition WHERE competition_type  =  'Friendly' INTERSECT SELECT country FROM competition WHERE competition_type  =  'Tournament';


Input:
[INST] Here is a database schema:
club :
Club_ID [ INT ] primary_key
name [ TEXT ]
Region [ TEXT ]
Start_year [ TEXT ]

club_rank :
Rank [ INT ] primary_key
Club_ID [ INT ] club_rank.Club_ID = club.Club_ID
Gold [ INT ]
Silver [ INT ]
Bronze [ INT ]
Total [ INT ]

player :
Player_ID [ INT ] primary_key
name [ TEXT ]
Position [ TEXT ]
Club_ID [ INT ] player.Club_ID = club.Club_ID
Apps [ INT ]
Tries [ INT ]
Goals [ TEXT ]
Points [ INT ]

competition :
Competition_ID [ INT ] primary_key
Year [ INT ]
Competition_type [ TEXT ]
Country [ TEXT ]

competition_result :
Competition_ID [ INT ] primary_key competition_result.Competition_ID = competition.Competition_ID
Club_ID_1 [ INT ] competition_result.Club_ID_1 = club.Club_ID
Club_ID_2 [ INT ] competition_result.Club_ID_2 = club.Club_ID
Score [ TEXT ]

Please write me a SQL statement that answers the following question: Find the countries that have never participated in any competition with Friendly type. [/INST]

Output: SELECT country FROM competition EXCEPT SELECT country FROM competition WHERE competition_type  =  'Friendly';


Input:
[INST] Here is a database schema:
club :
Club_ID [ INT ] primary_key
name [ TEXT ]
Region [ TEXT ]
Start_year [ TEXT ]

club_rank :
Rank [ INT ] primary_key
Club_ID [ INT ] club_rank.Club_ID = club.Club_ID
Gold [ INT ]
Silver [ INT ]
Bronze [ INT ]
Total [ INT ]

player :
Player_ID [ INT ] primary_key
name [ TEXT ]
Position [ TEXT ]
Club_ID [ INT ] player.Club_ID = club.Club_ID
Apps [ INT ]
Tries [ INT ]
Goals [ TEXT ]
Points [ INT ]

competition :
Competition_ID [ INT ] primary_key
Year [ INT ]
Competition_type [ TEXT ]
Country [ TEXT ]

competition_result :
Competition_ID [ INT ] primary_key competition_result.Competition_ID = competition.Competition_ID
Club_ID_1 [ INT ] competition_result.Club_ID_1 = club.Club_ID
Club_ID_2 [ INT ] competition_result.Club_ID_2 = club.Club_ID
Score [ TEXT ]

Please write me a SQL statement that answers the following question: What are the countries that have never participated in any friendly-type competitions? [/INST]

Output: SELECT country FROM competition EXCEPT SELECT country FROM competition WHERE competition_type  =  'Friendly';


Input:
[INST] Here is a database schema:
manufacturer :
Manufacturer_ID [ INT ] primary_key
Open_Year [ INT ]
Name [ TEXT ]
Num_of_Factories [ INT ]
Num_of_Shops [ INT ]

furniture :
Furniture_ID [ INT ] primary_key
Name [ TEXT ]
Num_of_Component [ INT ]
Market_Rate [ INT ]

furniture_manufacte :
Manufacturer_ID [ INT ] primary_key furniture_manufacte.Manufacturer_ID = manufacturer.Manufacturer_ID
Furniture_ID [ INT ] furniture_manufacte.Furniture_ID = furniture.Furniture_ID
Price_in_Dollar [ INT ]

Please write me a SQL statement that answers the following question: How many furniture components are there in total? [/INST]

Output: SELECT sum(num_of_component) FROM furniture;


Input:
[INST] Here is a database schema:
manufacturer :
Manufacturer_ID [ INT ] primary_key
Open_Year [ INT ]
Name [ TEXT ]
Num_of_Factories [ INT ]
Num_of_Shops [ INT ]

furniture :
Furniture_ID [ INT ] primary_key
Name [ TEXT ]
Num_of_Component [ INT ]
Market_Rate [ INT ]

furniture_manufacte :
Manufacturer_ID [ INT ] primary_key furniture_manufacte.Manufacturer_ID = manufacturer.Manufacturer_ID
Furniture_ID [ INT ] furniture_manufacte.Furniture_ID = furniture.Furniture_ID
Price_in_Dollar [ INT ]

Please write me a SQL statement that answers the following question: Return the name and id of the furniture with the highest market rate. [/INST]

Output: SELECT name ,  furniture_id FROM furniture ORDER BY market_rate DESC LIMIT 1;


Input:
[INST] Here is a database schema:
manufacturer :
Manufacturer_ID [ INT ] primary_key
Open_Year [ INT ]
Name [ TEXT ]
Num_of_Factories [ INT ]
Num_of_Shops [ INT ]

furniture :
Furniture_ID [ INT ] primary_key
Name [ TEXT ]
Num_of_Component [ INT ]
Market_Rate [ INT ]

furniture_manufacte :
Manufacturer_ID [ INT ] primary_key furniture_manufacte.Manufacturer_ID = manufacturer.Manufacturer_ID
Furniture_ID [ INT ] furniture_manufacte.Furniture_ID = furniture.Furniture_ID
Price_in_Dollar [ INT ]

Please write me a SQL statement that answers the following question: find the total market rate of the furnitures that have the top 2 market shares. [/INST]

Output: SELECT sum(market_rate) FROM furniture ORDER BY market_rate DESC LIMIT 2;


Input:
[INST] Here is a database schema:
manufacturer :
Manufacturer_ID [ INT ] primary_key
Open_Year [ INT ]
Name [ TEXT ]
Num_of_Factories [ INT ]
Num_of_Shops [ INT ]

furniture :
Furniture_ID [ INT ] primary_key
Name [ TEXT ]
Num_of_Component [ INT ]
Market_Rate [ INT ]

furniture_manufacte :
Manufacturer_ID [ INT ] primary_key furniture_manufacte.Manufacturer_ID = manufacturer.Manufacturer_ID
Furniture_ID [ INT ] furniture_manufacte.Furniture_ID = furniture.Furniture_ID
Price_in_Dollar [ INT ]

Please write me a SQL statement that answers the following question: Find the component amounts and names of all furnitures that have more than 10 components. [/INST]

Output: SELECT Num_of_Component ,  name FROM furniture WHERE Num_of_Component  >  10;


Input:
[INST] Here is a database schema:
manufacturer :
Manufacturer_ID [ INT ] primary_key
Open_Year [ INT ]
Name [ TEXT ]
Num_of_Factories [ INT ]
Num_of_Shops [ INT ]

furniture :
Furniture_ID [ INT ] primary_key
Name [ TEXT ]
Num_of_Component [ INT ]
Market_Rate [ INT ]

furniture_manufacte :
Manufacturer_ID [ INT ] primary_key furniture_manufacte.Manufacturer_ID = manufacturer.Manufacturer_ID
Furniture_ID [ INT ] furniture_manufacte.Furniture_ID = furniture.Furniture_ID
Price_in_Dollar [ INT ]

Please write me a SQL statement that answers the following question: Find the name and component amount of the least popular furniture. [/INST]

Output: SELECT name ,  Num_of_Component FROM furniture ORDER BY market_rate LIMIT 1;


Input:
[INST] Here is a database schema:
manufacturer :
Manufacturer_ID [ INT ] primary_key
Open_Year [ INT ]
Name [ TEXT ]
Num_of_Factories [ INT ]
Num_of_Shops [ INT ]

furniture :
Furniture_ID [ INT ] primary_key
Name [ TEXT ]
Num_of_Component [ INT ]
Market_Rate [ INT ]

furniture_manufacte :
Manufacturer_ID [ INT ] primary_key furniture_manufacte.Manufacturer_ID = manufacturer.Manufacturer_ID
Furniture_ID [ INT ] furniture_manufacte.Furniture_ID = furniture.Furniture_ID
Price_in_Dollar [ INT ]

Please write me a SQL statement that answers the following question: Find the names of furnitures whose prices are lower than the highest price. [/INST]

Output: 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);


Input:
[INST] Here is a database schema:
manufacturer :
Manufacturer_ID [ INT ] primary_key
Open_Year [ INT ]
Name [ TEXT ]
Num_of_Factories [ INT ]
Num_of_Shops [ INT ]

furniture :
Furniture_ID [ INT ] primary_key
Name [ TEXT ]
Num_of_Component [ INT ]
Market_Rate [ INT ]

furniture_manufacte :
Manufacturer_ID [ INT ] primary_key furniture_manufacte.Manufacturer_ID = manufacturer.Manufacturer_ID
Furniture_ID [ INT ] furniture_manufacte.Furniture_ID = furniture.Furniture_ID
Price_in_Dollar [ INT ]

Please write me a SQL statement that answers the following question: Which manufacturer has the most number of shops? List its name and year of opening. [/INST]

Output: SELECT open_year ,  name FROM manufacturer ORDER BY num_of_shops DESC LIMIT 1;


Input:
[INST] Here is a database schema:
manufacturer :
Manufacturer_ID [ INT ] primary_key
Open_Year [ INT ]
Name [ TEXT ]
Num_of_Factories [ INT ]
Num_of_Shops [ INT ]

furniture :
Furniture_ID [ INT ] primary_key
Name [ TEXT ]
Num_of_Component [ INT ]
Market_Rate [ INT ]

furniture_manufacte :
Manufacturer_ID [ INT ] primary_key furniture_manufacte.Manufacturer_ID = manufacturer.Manufacturer_ID
Furniture_ID [ INT ] furniture_manufacte.Furniture_ID = furniture.Furniture_ID
Price_in_Dollar [ INT ]

Please write me a SQL statement that answers the following question: Find the average number of factories for the manufacturers that have more than 20 shops. [/INST]

Output: SELECT avg(Num_of_Factories) FROM manufacturer WHERE num_of_shops  >  20;


Input:
[INST] Here is a database schema:
manufacturer :
Manufacturer_ID [ INT ] primary_key
Open_Year [ INT ]
Name [ TEXT ]
Num_of_Factories [ INT ]
Num_of_Shops [ INT ]

furniture :
Furniture_ID [ INT ] primary_key
Name [ TEXT ]
Num_of_Component [ INT ]
Market_Rate [ INT ]

furniture_manufacte :
Manufacturer_ID [ INT ] primary_key furniture_manufacte.Manufacturer_ID = manufacturer.Manufacturer_ID
Furniture_ID [ INT ] furniture_manufacte.Furniture_ID = furniture.Furniture_ID
Price_in_Dollar [ INT ]

Please write me a SQL statement that answers the following question: List all manufacturer names and ids ordered by their opening year. [/INST]

Output: SELECT name ,  manufacturer_id FROM manufacturer ORDER BY open_year;


Input:
[INST] Here is a database schema:
manufacturer :
Manufacturer_ID [ INT ] primary_key
Open_Year [ INT ]
Name [ TEXT ]
Num_of_Factories [ INT ]
Num_of_Shops [ INT ]

furniture :
Furniture_ID [ INT ] primary_key
Name [ TEXT ]
Num_of_Component [ INT ]
Market_Rate [ INT ]

furniture_manufacte :
Manufacturer_ID [ INT ] primary_key furniture_manufacte.Manufacturer_ID = manufacturer.Manufacturer_ID
Furniture_ID [ INT ] furniture_manufacte.Furniture_ID = furniture.Furniture_ID
Price_in_Dollar [ INT ]

Please write me a SQL statement that answers the following question: Give me the name and year of opening of the manufacturers that have either less than 10 factories or more than 10 shops. [/INST]

Output: SELECT name ,  open_year FROM manufacturer WHERE num_of_shops  >  10 OR Num_of_Factories  <  10;


Input:
[INST] Here is a database schema:
manufacturer :
Manufacturer_ID [ INT ] primary_key
Open_Year [ INT ]
Name [ TEXT ]
Num_of_Factories [ INT ]
Num_of_Shops [ INT ]

furniture :
Furniture_ID [ INT ] primary_key
Name [ TEXT ]
Num_of_Component [ INT ]
Market_Rate [ INT ]

furniture_manufacte :
Manufacturer_ID [ INT ] primary_key furniture_manufacte.Manufacturer_ID = manufacturer.Manufacturer_ID
Furniture_ID [ INT ] furniture_manufacte.Furniture_ID = furniture.Furniture_ID
Price_in_Dollar [ INT ]

Please write me a SQL statement that answers the following question: what is the average number of factories and maximum number of shops for manufacturers that opened before 1990. [/INST]

Output: SELECT max(num_of_shops) ,  avg(Num_of_Factories) FROM manufacturer WHERE open_year  <  1990;


Input:
[INST] Here is a database schema:
manufacturer :
Manufacturer_ID [ INT ] primary_key
Open_Year [ INT ]
Name [ TEXT ]
Num_of_Factories [ INT ]
Num_of_Shops [ INT ]

furniture :
Furniture_ID [ INT ] primary_key
Name [ TEXT ]
Num_of_Component [ INT ]
Market_Rate [ INT ]

furniture_manufacte :
Manufacturer_ID [ INT ] primary_key furniture_manufacte.Manufacturer_ID = manufacturer.Manufacturer_ID
Furniture_ID [ INT ] furniture_manufacte.Furniture_ID = furniture.Furniture_ID
Price_in_Dollar [ INT ]

Please write me a SQL statement that answers the following question: Find the id and number of shops for the company that produces the most expensive furniture. [/INST]

Output: 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;


Input:
[INST] Here is a database schema:
manufacturer :
Manufacturer_ID [ INT ] primary_key
Open_Year [ INT ]
Name [ TEXT ]
Num_of_Factories [ INT ]
Num_of_Shops [ INT ]

furniture :
Furniture_ID [ INT ] primary_key
Name [ TEXT ]
Num_of_Component [ INT ]
Market_Rate [ INT ]

furniture_manufacte :
Manufacturer_ID [ INT ] primary_key furniture_manufacte.Manufacturer_ID = manufacturer.Manufacturer_ID
Furniture_ID [ INT ] furniture_manufacte.Furniture_ID = furniture.Furniture_ID
Price_in_Dollar [ INT ]

Please write me a SQL statement that answers the following question: Find the number of funiture types produced by each manufacturer as well as the company names. [/INST]

Output: 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;


Input:
[INST] Here is a database schema:
manufacturer :
Manufacturer_ID [ INT ] primary_key
Open_Year [ INT ]
Name [ TEXT ]
Num_of_Factories [ INT ]
Num_of_Shops [ INT ]

furniture :
Furniture_ID [ INT ] primary_key
Name [ TEXT ]
Num_of_Component [ INT ]
Market_Rate [ INT ]

furniture_manufacte :
Manufacturer_ID [ INT ] primary_key furniture_manufacte.Manufacturer_ID = manufacturer.Manufacturer_ID
Furniture_ID [ INT ] furniture_manufacte.Furniture_ID = furniture.Furniture_ID
Price_in_Dollar [ INT ]

Please write me a SQL statement that answers the following question: Give me the names and prices of furnitures which some companies are manufacturing. [/INST]

Output: SELECT t1.name ,  t2.price_in_dollar FROM furniture AS t1 JOIN furniture_manufacte AS t2 ON t1.Furniture_ID  =  t2.Furniture_ID;


Input:
[INST] Here is a database schema:
manufacturer :
Manufacturer_ID [ INT ] primary_key
Open_Year [ INT ]
Name [ TEXT ]
Num_of_Factories [ INT ]
Num_of_Shops [ INT ]

furniture :
Furniture_ID [ INT ] primary_key
Name [ TEXT ]
Num_of_Component [ INT ]
Market_Rate [ INT ]

furniture_manufacte :
Manufacturer_ID [ INT ] primary_key furniture_manufacte.Manufacturer_ID = manufacturer.Manufacturer_ID
Furniture_ID [ INT ] furniture_manufacte.Furniture_ID = furniture.Furniture_ID
Price_in_Dollar [ INT ]

Please write me a SQL statement that answers the following question: Find the market shares and names of furnitures which no any company is producing in our records. [/INST]

Output: SELECT Market_Rate ,  name FROM furniture WHERE Furniture_ID NOT IN (SELECT Furniture_ID FROM furniture_manufacte);


Input:
[INST] Here is a database schema:
manufacturer :
Manufacturer_ID [ INT ] primary_key
Open_Year [ INT ]
Name [ TEXT ]
Num_of_Factories [ INT ]
Num_of_Shops [ INT ]

furniture :
Furniture_ID [ INT ] primary_key
Name [ TEXT ]
Num_of_Component [ INT ]
Market_Rate [ INT ]

furniture_manufacte :
Manufacturer_ID [ INT ] primary_key furniture_manufacte.Manufacturer_ID = manufacturer.Manufacturer_ID
Furniture_ID [ INT ] furniture_manufacte.Furniture_ID = furniture.Furniture_ID
Price_in_Dollar [ INT ]

Please write me a SQL statement that answers the following question: Find the name of the company that produces both furnitures with less than 6 components and furnitures with more than 10 components. [/INST]

Output: 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;


Input:
[INST] Here is a database schema:
regions :
REGION_ID [ INT ] primary_key
REGION_NAME [ TEXT ]

countries :
COUNTRY_ID [ TEXT ] primary_key
COUNTRY_NAME [ TEXT ]
REGION_ID [ INT ] countries.REGION_ID = regions.REGION_ID

departments :
DEPARTMENT_ID [ INT ] primary_key
DEPARTMENT_NAME [ TEXT ]
MANAGER_ID [ INT ]
LOCATION_ID [ INT ]

jobs :
JOB_ID [ TEXT ] primary_key
JOB_TITLE [ TEXT ]
MIN_SALARY [ INT ]
MAX_SALARY [ INT ]

employees :
EMPLOYEE_ID [ INT ] primary_key
FIRST_NAME [ TEXT ]
LAST_NAME [ TEXT ]
EMAIL [ TEXT ]
PHONE_NUMBER [ TEXT ]
HIRE_DATE [ TEXT ]
JOB_ID [ TEXT ] employees.JOB_ID = jobs.JOB_ID
SALARY [ INT ]
COMMISSION_PCT [ INT ]
MANAGER_ID [ INT ]
DEPARTMENT_ID [ INT ] employees.DEPARTMENT_ID = departments.DEPARTMENT_ID

job_history :
EMPLOYEE_ID [ INT ] primary_key job_history.EMPLOYEE_ID = employees.EMPLOYEE_ID
START_DATE [ TEXT ]
END_DATE [ TEXT ]
JOB_ID [ TEXT ] job_history.JOB_ID = jobs.JOB_ID
DEPARTMENT_ID [ INT ] job_history.DEPARTMENT_ID = departments.DEPARTMENT_ID

locations :
LOCATION_ID [ INT ] primary_key
STREET_ADDRESS [ TEXT ]
POSTAL_CODE [ TEXT ]
CITY [ TEXT ]
STATE_PROVINCE [ TEXT ]
COUNTRY_ID [ TEXT ] locations.COUNTRY_ID = countries.COUNTRY_ID

Please write me a SQL statement that answers the following question: Display the first name and department name for each employee. [/INST]

Output: SELECT T1.first_name ,  T2.department_name FROM employees AS T1 JOIN departments AS T2 ON T1.department_id  =  T2.department_id;


Input:
[INST] Here is a database schema:
regions :
REGION_ID [ INT ] primary_key
REGION_NAME [ TEXT ]

countries :
COUNTRY_ID [ TEXT ] primary_key
COUNTRY_NAME [ TEXT ]
REGION_ID [ INT ] countries.REGION_ID = regions.REGION_ID

departments :
DEPARTMENT_ID [ INT ] primary_key
DEPARTMENT_NAME [ TEXT ]
MANAGER_ID [ INT ]
LOCATION_ID [ INT ]

jobs :
JOB_ID [ TEXT ] primary_key
JOB_TITLE [ TEXT ]
MIN_SALARY [ INT ]
MAX_SALARY [ INT ]

employees :
EMPLOYEE_ID [ INT ] primary_key
FIRST_NAME [ TEXT ]
LAST_NAME [ TEXT ]
EMAIL [ TEXT ]
PHONE_NUMBER [ TEXT ]
HIRE_DATE [ TEXT ]
JOB_ID [ TEXT ] employees.JOB_ID = jobs.JOB_ID
SALARY [ INT ]
COMMISSION_PCT [ INT ]
MANAGER_ID [ INT ]
DEPARTMENT_ID [ INT ] employees.DEPARTMENT_ID = departments.DEPARTMENT_ID

job_history :
EMPLOYEE_ID [ INT ] primary_key job_history.EMPLOYEE_ID = employees.EMPLOYEE_ID
START_DATE [ TEXT ]
END_DATE [ TEXT ]
JOB_ID [ TEXT ] job_history.JOB_ID = jobs.JOB_ID
DEPARTMENT_ID [ INT ] job_history.DEPARTMENT_ID = departments.DEPARTMENT_ID

locations :
LOCATION_ID [ INT ] primary_key
STREET_ADDRESS [ TEXT ]
POSTAL_CODE [ TEXT ]
CITY [ TEXT ]
STATE_PROVINCE [ TEXT ]
COUNTRY_ID [ TEXT ] locations.COUNTRY_ID = countries.COUNTRY_ID

Please write me a SQL statement that answers the following question: What are the first name and department name of all employees? [/INST]

Output: SELECT T1.first_name ,  T2.department_name FROM employees AS T1 JOIN departments AS T2 ON T1.department_id  =  T2.department_id;


Input:
[INST] Here is a database schema:
regions :
REGION_ID [ INT ] primary_key
REGION_NAME [ TEXT ]

countries :
COUNTRY_ID [ TEXT ] primary_key
COUNTRY_NAME [ TEXT ]
REGION_ID [ INT ] countries.REGION_ID = regions.REGION_ID

departments :
DEPARTMENT_ID [ INT ] primary_key
DEPARTMENT_NAME [ TEXT ]
MANAGER_ID [ INT ]
LOCATION_ID [ INT ]

jobs :
JOB_ID [ TEXT ] primary_key
JOB_TITLE [ TEXT ]
MIN_SALARY [ INT ]
MAX_SALARY [ INT ]

employees :
EMPLOYEE_ID [ INT ] primary_key
FIRST_NAME [ TEXT ]
LAST_NAME [ TEXT ]
EMAIL [ TEXT ]
PHONE_NUMBER [ TEXT ]
HIRE_DATE [ TEXT ]
JOB_ID [ TEXT ] employees.JOB_ID = jobs.JOB_ID
SALARY [ INT ]
COMMISSION_PCT [ INT ]
MANAGER_ID [ INT ]
DEPARTMENT_ID [ INT ] employees.DEPARTMENT_ID = departments.DEPARTMENT_ID

job_history :
EMPLOYEE_ID [ INT ] primary_key job_history.EMPLOYEE_ID = employees.EMPLOYEE_ID
START_DATE [ TEXT ]
END_DATE [ TEXT ]
JOB_ID [ TEXT ] job_history.JOB_ID = jobs.JOB_ID
DEPARTMENT_ID [ INT ] job_history.DEPARTMENT_ID = departments.DEPARTMENT_ID

locations :
LOCATION_ID [ INT ] primary_key
STREET_ADDRESS [ TEXT ]
POSTAL_CODE [ TEXT ]
CITY [ TEXT ]
STATE_PROVINCE [ TEXT ]
COUNTRY_ID [ TEXT ] locations.COUNTRY_ID = countries.COUNTRY_ID

Please write me a SQL statement that answers the following question: List the full name (first and last name), and salary for those employees who earn below 6000. [/INST]

Output: SELECT first_name ,  last_name ,  salary FROM employees WHERE salary  <  6000;


Input:
[INST] Here is a database schema:
regions :
REGION_ID [ INT ] primary_key
REGION_NAME [ TEXT ]

countries :
COUNTRY_ID [ TEXT ] primary_key
COUNTRY_NAME [ TEXT ]
REGION_ID [ INT ] countries.REGION_ID = regions.REGION_ID

departments :
DEPARTMENT_ID [ INT ] primary_key
DEPARTMENT_NAME [ TEXT ]
MANAGER_ID [ INT ]
LOCATION_ID [ INT ]

jobs :
JOB_ID [ TEXT ] primary_key
JOB_TITLE [ TEXT ]
MIN_SALARY [ INT ]
MAX_SALARY [ INT ]

employees :
EMPLOYEE_ID [ INT ] primary_key
FIRST_NAME [ TEXT ]
LAST_NAME [ TEXT ]
EMAIL [ TEXT ]
PHONE_NUMBER [ TEXT ]
HIRE_DATE [ TEXT ]
JOB_ID [ TEXT ] employees.JOB_ID = jobs.JOB_ID
SALARY [ INT ]
COMMISSION_PCT [ INT ]
MANAGER_ID [ INT ]
DEPARTMENT_ID [ INT ] employees.DEPARTMENT_ID = departments.DEPARTMENT_ID

job_history :
EMPLOYEE_ID [ INT ] primary_key job_history.EMPLOYEE_ID = employees.EMPLOYEE_ID
START_DATE [ TEXT ]
END_DATE [ TEXT ]
JOB_ID [ TEXT ] job_history.JOB_ID = jobs.JOB_ID
DEPARTMENT_ID [ INT ] job_history.DEPARTMENT_ID = departments.DEPARTMENT_ID

locations :
LOCATION_ID [ INT ] primary_key
STREET_ADDRESS [ TEXT ]
POSTAL_CODE [ TEXT ]
CITY [ TEXT ]
STATE_PROVINCE [ TEXT ]
COUNTRY_ID [ TEXT ] locations.COUNTRY_ID = countries.COUNTRY_ID

Please write me a SQL statement that answers the following question: What are the full names and salaries for any employees earning less than 6000? [/INST]

Output: SELECT first_name ,  last_name ,  salary FROM employees WHERE salary  <  6000;


Input:
[INST] Here is a database schema:
regions :
REGION_ID [ INT ] primary_key
REGION_NAME [ TEXT ]

countries :
COUNTRY_ID [ TEXT ] primary_key
COUNTRY_NAME [ TEXT ]
REGION_ID [ INT ] countries.REGION_ID = regions.REGION_ID

departments :
DEPARTMENT_ID [ INT ] primary_key
DEPARTMENT_NAME [ TEXT ]
MANAGER_ID [ INT ]
LOCATION_ID [ INT ]

jobs :
JOB_ID [ TEXT ] primary_key
JOB_TITLE [ TEXT ]
MIN_SALARY [ INT ]
MAX_SALARY [ INT ]

employees :
EMPLOYEE_ID [ INT ] primary_key
FIRST_NAME [ TEXT ]
LAST_NAME [ TEXT ]
EMAIL [ TEXT ]
PHONE_NUMBER [ TEXT ]
HIRE_DATE [ TEXT ]
JOB_ID [ TEXT ] employees.JOB_ID = jobs.JOB_ID
SALARY [ INT ]
COMMISSION_PCT [ INT ]
MANAGER_ID [ INT ]
DEPARTMENT_ID [ INT ] employees.DEPARTMENT_ID = departments.DEPARTMENT_ID

job_history :
EMPLOYEE_ID [ INT ] primary_key job_history.EMPLOYEE_ID = employees.EMPLOYEE_ID
START_DATE [ TEXT ]
END_DATE [ TEXT ]
JOB_ID [ TEXT ] job_history.JOB_ID = jobs.JOB_ID
DEPARTMENT_ID [ INT ] job_history.DEPARTMENT_ID = departments.DEPARTMENT_ID

locations :
LOCATION_ID [ INT ] primary_key
STREET_ADDRESS [ TEXT ]
POSTAL_CODE [ TEXT ]
CITY [ TEXT ]
STATE_PROVINCE [ TEXT ]
COUNTRY_ID [ TEXT ] locations.COUNTRY_ID = countries.COUNTRY_ID

Please write me a SQL statement that answers the following question: Display the first name, and department number for all employees whose last name is "McEwen". [/INST]

Output: SELECT first_name ,  department_id FROM employees WHERE last_name  =  'McEwen';


Input:
[INST] Here is a database schema:
regions :
REGION_ID [ INT ] primary_key
REGION_NAME [ TEXT ]

countries :
COUNTRY_ID [ TEXT ] primary_key
COUNTRY_NAME [ TEXT ]
REGION_ID [ INT ] countries.REGION_ID = regions.REGION_ID

departments :
DEPARTMENT_ID [ INT ] primary_key
DEPARTMENT_NAME [ TEXT ]
MANAGER_ID [ INT ]
LOCATION_ID [ INT ]

jobs :
JOB_ID [ TEXT ] primary_key
JOB_TITLE [ TEXT ]
MIN_SALARY [ INT ]
MAX_SALARY [ INT ]

employees :
EMPLOYEE_ID [ INT ] primary_key
FIRST_NAME [ TEXT ]
LAST_NAME [ TEXT ]
EMAIL [ TEXT ]
PHONE_NUMBER [ TEXT ]
HIRE_DATE [ TEXT ]
JOB_ID [ TEXT ] employees.JOB_ID = jobs.JOB_ID
SALARY [ INT ]
COMMISSION_PCT [ INT ]
MANAGER_ID [ INT ]
DEPARTMENT_ID [ INT ] employees.DEPARTMENT_ID = departments.DEPARTMENT_ID

job_history :
EMPLOYEE_ID [ INT ] primary_key job_history.EMPLOYEE_ID = employees.EMPLOYEE_ID
START_DATE [ TEXT ]
END_DATE [ TEXT ]
JOB_ID [ TEXT ] job_history.JOB_ID = jobs.JOB_ID
DEPARTMENT_ID [ INT ] job_history.DEPARTMENT_ID = departments.DEPARTMENT_ID

locations :
LOCATION_ID [ INT ] primary_key
STREET_ADDRESS [ TEXT ]
POSTAL_CODE [ TEXT ]
CITY [ TEXT ]
STATE_PROVINCE [ TEXT ]
COUNTRY_ID [ TEXT ] locations.COUNTRY_ID = countries.COUNTRY_ID

Please write me a SQL statement that answers the following question: What are the first names and department numbers for employees with last name McEwen? [/INST]

Output: SELECT first_name ,  department_id FROM employees WHERE last_name  =  'McEwen';


Input:
[INST] Here is a database schema:
regions :
REGION_ID [ INT ] primary_key
REGION_NAME [ TEXT ]

countries :
COUNTRY_ID [ TEXT ] primary_key
COUNTRY_NAME [ TEXT ]
REGION_ID [ INT ] countries.REGION_ID = regions.REGION_ID

departments :
DEPARTMENT_ID [ INT ] primary_key
DEPARTMENT_NAME [ TEXT ]
MANAGER_ID [ INT ]
LOCATION_ID [ INT ]

jobs :
JOB_ID [ TEXT ] primary_key
JOB_TITLE [ TEXT ]
MIN_SALARY [ INT ]
MAX_SALARY [ INT ]

employees :
EMPLOYEE_ID [ INT ] primary_key
FIRST_NAME [ TEXT ]
LAST_NAME [ TEXT ]
EMAIL [ TEXT ]
PHONE_NUMBER [ TEXT ]
HIRE_DATE [ TEXT ]
JOB_ID [ TEXT ] employees.JOB_ID = jobs.JOB_ID
SALARY [ INT ]
COMMISSION_PCT [ INT ]
MANAGER_ID [ INT ]
DEPARTMENT_ID [ INT ] employees.DEPARTMENT_ID = departments.DEPARTMENT_ID

job_history :
EMPLOYEE_ID [ INT ] primary_key job_history.EMPLOYEE_ID = employees.EMPLOYEE_ID
START_DATE [ TEXT ]
END_DATE [ TEXT ]
JOB_ID [ TEXT ] job_history.JOB_ID = jobs.JOB_ID
DEPARTMENT_ID [ INT ] job_history.DEPARTMENT_ID = departments.DEPARTMENT_ID

locations :
LOCATION_ID [ INT ] primary_key
STREET_ADDRESS [ TEXT ]
POSTAL_CODE [ TEXT ]
CITY [ TEXT ]
STATE_PROVINCE [ TEXT ]
COUNTRY_ID [ TEXT ] locations.COUNTRY_ID = countries.COUNTRY_ID

Please write me a SQL statement that answers the following question: Return all the information for all employees without any department number. [/INST]

Output: SELECT * FROM employees WHERE department_id  =  "null";


Input:
[INST] Here is a database schema:
regions :
REGION_ID [ INT ] primary_key
REGION_NAME [ TEXT ]

countries :
COUNTRY_ID [ TEXT ] primary_key
COUNTRY_NAME [ TEXT ]
REGION_ID [ INT ] countries.REGION_ID = regions.REGION_ID

departments :
DEPARTMENT_ID [ INT ] primary_key
DEPARTMENT_NAME [ TEXT ]
MANAGER_ID [ INT ]
LOCATION_ID [ INT ]

jobs :
JOB_ID [ TEXT ] primary_key
JOB_TITLE [ TEXT ]
MIN_SALARY [ INT ]
MAX_SALARY [ INT ]

employees :
EMPLOYEE_ID [ INT ] primary_key
FIRST_NAME [ TEXT ]
LAST_NAME [ TEXT ]
EMAIL [ TEXT ]
PHONE_NUMBER [ TEXT ]
HIRE_DATE [ TEXT ]
JOB_ID [ TEXT ] employees.JOB_ID = jobs.JOB_ID
SALARY [ INT ]
COMMISSION_PCT [ INT ]
MANAGER_ID [ INT ]
DEPARTMENT_ID [ INT ] employees.DEPARTMENT_ID = departments.DEPARTMENT_ID

job_history :
EMPLOYEE_ID [ INT ] primary_key job_history.EMPLOYEE_ID = employees.EMPLOYEE_ID
START_DATE [ TEXT ]
END_DATE [ TEXT ]
JOB_ID [ TEXT ] job_history.JOB_ID = jobs.JOB_ID
DEPARTMENT_ID [ INT ] job_history.DEPARTMENT_ID = departments.DEPARTMENT_ID

locations :
LOCATION_ID [ INT ] primary_key
STREET_ADDRESS [ TEXT ]
POSTAL_CODE [ TEXT ]
CITY [ TEXT ]
STATE_PROVINCE [ TEXT ]
COUNTRY_ID [ TEXT ] locations.COUNTRY_ID = countries.COUNTRY_ID

Please write me a SQL statement that answers the following question: What are all the employees without a department number? [/INST]

Output: SELECT * FROM employees WHERE department_id  =  "null";


Input:
[INST] Here is a database schema:
regions :
REGION_ID [ INT ] primary_key
REGION_NAME [ TEXT ]

countries :
COUNTRY_ID [ TEXT ] primary_key
COUNTRY_NAME [ TEXT ]
REGION_ID [ INT ] countries.REGION_ID = regions.REGION_ID

departments :
DEPARTMENT_ID [ INT ] primary_key
DEPARTMENT_NAME [ TEXT ]
MANAGER_ID [ INT ]
LOCATION_ID [ INT ]

jobs :
JOB_ID [ TEXT ] primary_key
JOB_TITLE [ TEXT ]
MIN_SALARY [ INT ]
MAX_SALARY [ INT ]

employees :
EMPLOYEE_ID [ INT ] primary_key
FIRST_NAME [ TEXT ]
LAST_NAME [ TEXT ]
EMAIL [ TEXT ]
PHONE_NUMBER [ TEXT ]
HIRE_DATE [ TEXT ]
JOB_ID [ TEXT ] employees.JOB_ID = jobs.JOB_ID
SALARY [ INT ]
COMMISSION_PCT [ INT ]
MANAGER_ID [ INT ]
DEPARTMENT_ID [ INT ] employees.DEPARTMENT_ID = departments.DEPARTMENT_ID

job_history :
EMPLOYEE_ID [ INT ] primary_key job_history.EMPLOYEE_ID = employees.EMPLOYEE_ID
START_DATE [ TEXT ]
END_DATE [ TEXT ]
JOB_ID [ TEXT ] job_history.JOB_ID = jobs.JOB_ID
DEPARTMENT_ID [ INT ] job_history.DEPARTMENT_ID = departments.DEPARTMENT_ID

locations :
LOCATION_ID [ INT ] primary_key
STREET_ADDRESS [ TEXT ]
POSTAL_CODE [ TEXT ]
CITY [ TEXT ]
STATE_PROVINCE [ TEXT ]
COUNTRY_ID [ TEXT ] locations.COUNTRY_ID = countries.COUNTRY_ID

Please write me a SQL statement that answers the following question: Display all the information about the department Marketing. [/INST]

Output: SELECT * FROM  departments WHERE department_name  =  'Marketing';


Input:
[INST] Here is a database schema:
regions :
REGION_ID [ INT ] primary_key
REGION_NAME [ TEXT ]

countries :
COUNTRY_ID [ TEXT ] primary_key
COUNTRY_NAME [ TEXT ]
REGION_ID [ INT ] countries.REGION_ID = regions.REGION_ID

departments :
DEPARTMENT_ID [ INT ] primary_key
DEPARTMENT_NAME [ TEXT ]
MANAGER_ID [ INT ]
LOCATION_ID [ INT ]

jobs :
JOB_ID [ TEXT ] primary_key
JOB_TITLE [ TEXT ]
MIN_SALARY [ INT ]
MAX_SALARY [ INT ]

employees :
EMPLOYEE_ID [ INT ] primary_key
FIRST_NAME [ TEXT ]
LAST_NAME [ TEXT ]
EMAIL [ TEXT ]
PHONE_NUMBER [ TEXT ]
HIRE_DATE [ TEXT ]
JOB_ID [ TEXT ] employees.JOB_ID = jobs.JOB_ID
SALARY [ INT ]
COMMISSION_PCT [ INT ]
MANAGER_ID [ INT ]
DEPARTMENT_ID [ INT ] employees.DEPARTMENT_ID = departments.DEPARTMENT_ID

job_history :
EMPLOYEE_ID [ INT ] primary_key job_history.EMPLOYEE_ID = employees.EMPLOYEE_ID
START_DATE [ TEXT ]
END_DATE [ TEXT ]
JOB_ID [ TEXT ] job_history.JOB_ID = jobs.JOB_ID
DEPARTMENT_ID [ INT ] job_history.DEPARTMENT_ID = departments.DEPARTMENT_ID

locations :
LOCATION_ID [ INT ] primary_key
STREET_ADDRESS [ TEXT ]
POSTAL_CODE [ TEXT ]
CITY [ TEXT ]
STATE_PROVINCE [ TEXT ]
COUNTRY_ID [ TEXT ] locations.COUNTRY_ID = countries.COUNTRY_ID

Please write me a SQL statement that answers the following question: What is all the information about the Marketing department? [/INST]

Output: SELECT * FROM  departments WHERE department_name  =  'Marketing';


Input:
[INST] Here is a database schema:
regions :
REGION_ID [ INT ] primary_key
REGION_NAME [ TEXT ]

countries :
COUNTRY_ID [ TEXT ] primary_key
COUNTRY_NAME [ TEXT ]
REGION_ID [ INT ] countries.REGION_ID = regions.REGION_ID

departments :
DEPARTMENT_ID [ INT ] primary_key
DEPARTMENT_NAME [ TEXT ]
MANAGER_ID [ INT ]
LOCATION_ID [ INT ]

jobs :
JOB_ID [ TEXT ] primary_key
JOB_TITLE [ TEXT ]
MIN_SALARY [ INT ]
MAX_SALARY [ INT ]

employees :
EMPLOYEE_ID [ INT ] primary_key
FIRST_NAME [ TEXT ]
LAST_NAME [ TEXT ]
EMAIL [ TEXT ]
PHONE_NUMBER [ TEXT ]
HIRE_DATE [ TEXT ]
JOB_ID [ TEXT ] employees.JOB_ID = jobs.JOB_ID
SALARY [ INT ]
COMMISSION_PCT [ INT ]
MANAGER_ID [ INT ]
DEPARTMENT_ID [ INT ] employees.DEPARTMENT_ID = departments.DEPARTMENT_ID

job_history :
EMPLOYEE_ID [ INT ] primary_key job_history.EMPLOYEE_ID = employees.EMPLOYEE_ID
START_DATE [ TEXT ]
END_DATE [ TEXT ]
JOB_ID [ TEXT ] job_history.JOB_ID = jobs.JOB_ID
DEPARTMENT_ID [ INT ] job_history.DEPARTMENT_ID = departments.DEPARTMENT_ID

locations :
LOCATION_ID [ INT ] primary_key
STREET_ADDRESS [ TEXT ]
POSTAL_CODE [ TEXT ]
CITY [ TEXT ]
STATE_PROVINCE [ TEXT ]
COUNTRY_ID [ TEXT ] locations.COUNTRY_ID = countries.COUNTRY_ID

Please write me a SQL statement that answers the following question: when is the hire date for those employees whose first name does not containing the letter M? [/INST]

Output: SELECT hire_date FROM employees WHERE first_name NOT LIKE '%M%';


Input:
[INST] Here is a database schema:
regions :
REGION_ID [ INT ] primary_key
REGION_NAME [ TEXT ]

countries :
COUNTRY_ID [ TEXT ] primary_key
COUNTRY_NAME [ TEXT ]
REGION_ID [ INT ] countries.REGION_ID = regions.REGION_ID

departments :
DEPARTMENT_ID [ INT ] primary_key
DEPARTMENT_NAME [ TEXT ]
MANAGER_ID [ INT ]
LOCATION_ID [ INT ]

jobs :
JOB_ID [ TEXT ] primary_key
JOB_TITLE [ TEXT ]
MIN_SALARY [ INT ]
MAX_SALARY [ INT ]

employees :
EMPLOYEE_ID [ INT ] primary_key
FIRST_NAME [ TEXT ]
LAST_NAME [ TEXT ]
EMAIL [ TEXT ]
PHONE_NUMBER [ TEXT ]
HIRE_DATE [ TEXT ]
JOB_ID [ TEXT ] employees.JOB_ID = jobs.JOB_ID
SALARY [ INT ]
COMMISSION_PCT [ INT ]
MANAGER_ID [ INT ]
DEPARTMENT_ID [ INT ] employees.DEPARTMENT_ID = departments.DEPARTMENT_ID

job_history :
EMPLOYEE_ID [ INT ] primary_key job_history.EMPLOYEE_ID = employees.EMPLOYEE_ID
START_DATE [ TEXT ]
END_DATE [ TEXT ]
JOB_ID [ TEXT ] job_history.JOB_ID = jobs.JOB_ID
DEPARTMENT_ID [ INT ] job_history.DEPARTMENT_ID = departments.DEPARTMENT_ID

locations :
LOCATION_ID [ INT ] primary_key
STREET_ADDRESS [ TEXT ]
POSTAL_CODE [ TEXT ]
CITY [ TEXT ]
STATE_PROVINCE [ TEXT ]
COUNTRY_ID [ TEXT ] locations.COUNTRY_ID = countries.COUNTRY_ID

Please write me a SQL statement that answers the following question: On what dates were employees without the letter M in their first names hired? [/INST]

Output: SELECT hire_date FROM employees WHERE first_name NOT LIKE '%M%';


Input:
[INST] Here is a database schema:
regions :
REGION_ID [ INT ] primary_key
REGION_NAME [ TEXT ]

countries :
COUNTRY_ID [ TEXT ] primary_key
COUNTRY_NAME [ TEXT ]
REGION_ID [ INT ] countries.REGION_ID = regions.REGION_ID

departments :
DEPARTMENT_ID [ INT ] primary_key
DEPARTMENT_NAME [ TEXT ]
MANAGER_ID [ INT ]
LOCATION_ID [ INT ]

jobs :
JOB_ID [ TEXT ] primary_key
JOB_TITLE [ TEXT ]
MIN_SALARY [ INT ]
MAX_SALARY [ INT ]

employees :
EMPLOYEE_ID [ INT ] primary_key
FIRST_NAME [ TEXT ]
LAST_NAME [ TEXT ]
EMAIL [ TEXT ]
PHONE_NUMBER [ TEXT ]
HIRE_DATE [ TEXT ]
JOB_ID [ TEXT ] employees.JOB_ID = jobs.JOB_ID
SALARY [ INT ]
COMMISSION_PCT [ INT ]
MANAGER_ID [ INT ]
DEPARTMENT_ID [ INT ] employees.DEPARTMENT_ID = departments.DEPARTMENT_ID

job_history :
EMPLOYEE_ID [ INT ] primary_key job_history.EMPLOYEE_ID = employees.EMPLOYEE_ID
START_DATE [ TEXT ]
END_DATE [ TEXT ]
JOB_ID [ TEXT ] job_history.JOB_ID = jobs.JOB_ID
DEPARTMENT_ID [ INT ] job_history.DEPARTMENT_ID = departments.DEPARTMENT_ID

locations :
LOCATION_ID [ INT ] primary_key
STREET_ADDRESS [ TEXT ]
POSTAL_CODE [ TEXT ]
CITY [ TEXT ]
STATE_PROVINCE [ TEXT ]
COUNTRY_ID [ TEXT ] locations.COUNTRY_ID = countries.COUNTRY_ID

Please write me a SQL statement that answers the following 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. [/INST]

Output: SELECT first_name ,  last_name ,  hire_date ,  salary ,  department_id FROM employees WHERE first_name NOT LIKE '%M%';


Input:
[INST] Here is a database schema:
regions :
REGION_ID [ INT ] primary_key
REGION_NAME [ TEXT ]

countries :
COUNTRY_ID [ TEXT ] primary_key
COUNTRY_NAME [ TEXT ]
REGION_ID [ INT ] countries.REGION_ID = regions.REGION_ID

departments :
DEPARTMENT_ID [ INT ] primary_key
DEPARTMENT_NAME [ TEXT ]
MANAGER_ID [ INT ]
LOCATION_ID [ INT ]

jobs :
JOB_ID [ TEXT ] primary_key
JOB_TITLE [ TEXT ]
MIN_SALARY [ INT ]
MAX_SALARY [ INT ]

employees :
EMPLOYEE_ID [ INT ] primary_key
FIRST_NAME [ TEXT ]
LAST_NAME [ TEXT ]
EMAIL [ TEXT ]
PHONE_NUMBER [ TEXT ]
HIRE_DATE [ TEXT ]
JOB_ID [ TEXT ] employees.JOB_ID = jobs.JOB_ID
SALARY [ INT ]
COMMISSION_PCT [ INT ]
MANAGER_ID [ INT ]
DEPARTMENT_ID [ INT ] employees.DEPARTMENT_ID = departments.DEPARTMENT_ID

job_history :
EMPLOYEE_ID [ INT ] primary_key job_history.EMPLOYEE_ID = employees.EMPLOYEE_ID
START_DATE [ TEXT ]
END_DATE [ TEXT ]
JOB_ID [ TEXT ] job_history.JOB_ID = jobs.JOB_ID
DEPARTMENT_ID [ INT ] job_history.DEPARTMENT_ID = departments.DEPARTMENT_ID

locations :
LOCATION_ID [ INT ] primary_key
STREET_ADDRESS [ TEXT ]
POSTAL_CODE [ TEXT ]
CITY [ TEXT ]
STATE_PROVINCE [ TEXT ]
COUNTRY_ID [ TEXT ] locations.COUNTRY_ID = countries.COUNTRY_ID

Please write me a SQL statement that answers the following question: What are the full name, hire date, salary, and department id for employees without the letter M in their first name? [/INST]

Output: SELECT first_name ,  last_name ,  hire_date ,  salary ,  department_id FROM employees WHERE first_name NOT LIKE '%M%';


Input:
[INST] Here is a database schema:
regions :
REGION_ID [ INT ] primary_key
REGION_NAME [ TEXT ]

countries :
COUNTRY_ID [ TEXT ] primary_key
COUNTRY_NAME [ TEXT ]
REGION_ID [ INT ] countries.REGION_ID = regions.REGION_ID

departments :
DEPARTMENT_ID [ INT ] primary_key
DEPARTMENT_NAME [ TEXT ]
MANAGER_ID [ INT ]
LOCATION_ID [ INT ]

jobs :
JOB_ID [ TEXT ] primary_key
JOB_TITLE [ TEXT ]
MIN_SALARY [ INT ]
MAX_SALARY [ INT ]

employees :
EMPLOYEE_ID [ INT ] primary_key
FIRST_NAME [ TEXT ]
LAST_NAME [ TEXT ]
EMAIL [ TEXT ]
PHONE_NUMBER [ TEXT ]
HIRE_DATE [ TEXT ]
JOB_ID [ TEXT ] employees.JOB_ID = jobs.JOB_ID
SALARY [ INT ]
COMMISSION_PCT [ INT ]
MANAGER_ID [ INT ]
DEPARTMENT_ID [ INT ] employees.DEPARTMENT_ID = departments.DEPARTMENT_ID

job_history :
EMPLOYEE_ID [ INT ] primary_key job_history.EMPLOYEE_ID = employees.EMPLOYEE_ID
START_DATE [ TEXT ]
END_DATE [ TEXT ]
JOB_ID [ TEXT ] job_history.JOB_ID = jobs.JOB_ID
DEPARTMENT_ID [ INT ] job_history.DEPARTMENT_ID = departments.DEPARTMENT_ID

locations :
LOCATION_ID [ INT ] primary_key
STREET_ADDRESS [ TEXT ]
POSTAL_CODE [ TEXT ]
CITY [ TEXT ]
STATE_PROVINCE [ TEXT ]
COUNTRY_ID [ TEXT ] locations.COUNTRY_ID = countries.COUNTRY_ID

Please write me a SQL statement that answers the following 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. [/INST]

Output: SELECT first_name ,  last_name ,  hire_date ,  salary ,  department_id FROM employees WHERE first_name NOT LIKE '%M%' ORDER BY department_id;


Input:
[INST] Here is a database schema:
regions :
REGION_ID [ INT ] primary_key
REGION_NAME [ TEXT ]

countries :
COUNTRY_ID [ TEXT ] primary_key
COUNTRY_NAME [ TEXT ]
REGION_ID [ INT ] countries.REGION_ID = regions.REGION_ID

departments :
DEPARTMENT_ID [ INT ] primary_key
DEPARTMENT_NAME [ TEXT ]
MANAGER_ID [ INT ]
LOCATION_ID [ INT ]

jobs :
JOB_ID [ TEXT ] primary_key
JOB_TITLE [ TEXT ]
MIN_SALARY [ INT ]
MAX_SALARY [ INT ]

employees :
EMPLOYEE_ID [ INT ] primary_key
FIRST_NAME [ TEXT ]
LAST_NAME [ TEXT ]
EMAIL [ TEXT ]
PHONE_NUMBER [ TEXT ]
HIRE_DATE [ TEXT ]
JOB_ID [ TEXT ] employees.JOB_ID = jobs.JOB_ID
SALARY [ INT ]
COMMISSION_PCT [ INT ]
MANAGER_ID [ INT ]
DEPARTMENT_ID [ INT ] employees.DEPARTMENT_ID = departments.DEPARTMENT_ID

job_history :
EMPLOYEE_ID [ INT ] primary_key job_history.EMPLOYEE_ID = employees.EMPLOYEE_ID
START_DATE [ TEXT ]
END_DATE [ TEXT ]
JOB_ID [ TEXT ] job_history.JOB_ID = jobs.JOB_ID
DEPARTMENT_ID [ INT ] job_history.DEPARTMENT_ID = departments.DEPARTMENT_ID

locations :
LOCATION_ID [ INT ] primary_key
STREET_ADDRESS [ TEXT ]
POSTAL_CODE [ TEXT ]
CITY [ TEXT ]
STATE_PROVINCE [ TEXT ]
COUNTRY_ID [ TEXT ] locations.COUNTRY_ID = countries.COUNTRY_ID

Please write me a SQL statement that answers the following question: What are the full name, hire data, salary and department id for employees without the letter M in their first name, ordered by ascending department id? [/INST]

Output: SELECT first_name ,  last_name ,  hire_date ,  salary ,  department_id FROM employees WHERE first_name NOT LIKE '%M%' ORDER BY department_id;


Input:
[INST] Here is a database schema:
regions :
REGION_ID [ INT ] primary_key
REGION_NAME [ TEXT ]

countries :
COUNTRY_ID [ TEXT ] primary_key
COUNTRY_NAME [ TEXT ]
REGION_ID [ INT ] countries.REGION_ID = regions.REGION_ID

departments :
DEPARTMENT_ID [ INT ] primary_key
DEPARTMENT_NAME [ TEXT ]
MANAGER_ID [ INT ]
LOCATION_ID [ INT ]

jobs :
JOB_ID [ TEXT ] primary_key
JOB_TITLE [ TEXT ]
MIN_SALARY [ INT ]
MAX_SALARY [ INT ]

employees :
EMPLOYEE_ID [ INT ] primary_key
FIRST_NAME [ TEXT ]
LAST_NAME [ TEXT ]
EMAIL [ TEXT ]
PHONE_NUMBER [ TEXT ]
HIRE_DATE [ TEXT ]
JOB_ID [ TEXT ] employees.JOB_ID = jobs.JOB_ID
SALARY [ INT ]
COMMISSION_PCT [ INT ]
MANAGER_ID [ INT ]
DEPARTMENT_ID [ INT ] employees.DEPARTMENT_ID = departments.DEPARTMENT_ID

job_history :
EMPLOYEE_ID [ INT ] primary_key job_history.EMPLOYEE_ID = employees.EMPLOYEE_ID
START_DATE [ TEXT ]
END_DATE [ TEXT ]
JOB_ID [ TEXT ] job_history.JOB_ID = jobs.JOB_ID
DEPARTMENT_ID [ INT ] job_history.DEPARTMENT_ID = departments.DEPARTMENT_ID

locations :
LOCATION_ID [ INT ] primary_key
STREET_ADDRESS [ TEXT ]
POSTAL_CODE [ TEXT ]
CITY [ TEXT ]
STATE_PROVINCE [ TEXT ]
COUNTRY_ID [ TEXT ] locations.COUNTRY_ID = countries.COUNTRY_ID

Please write me a SQL statement that answers the following question: what is the phone number of employees whose salary is in the range of 8000 and 12000? [/INST]

Output: SELECT phone_number FROM employees WHERE salary BETWEEN 8000 AND 12000;


Input:
[INST] Here is a database schema:
regions :
REGION_ID [ INT ] primary_key
REGION_NAME [ TEXT ]

countries :
COUNTRY_ID [ TEXT ] primary_key
COUNTRY_NAME [ TEXT ]
REGION_ID [ INT ] countries.REGION_ID = regions.REGION_ID

departments :
DEPARTMENT_ID [ INT ] primary_key
DEPARTMENT_NAME [ TEXT ]
MANAGER_ID [ INT ]
LOCATION_ID [ INT ]

jobs :
JOB_ID [ TEXT ] primary_key
JOB_TITLE [ TEXT ]
MIN_SALARY [ INT ]
MAX_SALARY [ INT ]

employees :
EMPLOYEE_ID [ INT ] primary_key
FIRST_NAME [ TEXT ]
LAST_NAME [ TEXT ]
EMAIL [ TEXT ]
PHONE_NUMBER [ TEXT ]
HIRE_DATE [ TEXT ]
JOB_ID [ TEXT ] employees.JOB_ID = jobs.JOB_ID
SALARY [ INT ]
COMMISSION_PCT [ INT ]
MANAGER_ID [ INT ]
DEPARTMENT_ID [ INT ] employees.DEPARTMENT_ID = departments.DEPARTMENT_ID

job_history :
EMPLOYEE_ID [ INT ] primary_key job_history.EMPLOYEE_ID = employees.EMPLOYEE_ID
START_DATE [ TEXT ]
END_DATE [ TEXT ]
JOB_ID [ TEXT ] job_history.JOB_ID = jobs.JOB_ID
DEPARTMENT_ID [ INT ] job_history.DEPARTMENT_ID = departments.DEPARTMENT_ID

locations :
LOCATION_ID [ INT ] primary_key
STREET_ADDRESS [ TEXT ]
POSTAL_CODE [ TEXT ]
CITY [ TEXT ]
STATE_PROVINCE [ TEXT ]
COUNTRY_ID [ TEXT ] locations.COUNTRY_ID = countries.COUNTRY_ID

Please write me a SQL statement that answers the following question: Return the phone numbers of employees with salaries between 8000 and 12000. [/INST]

Output: SELECT phone_number FROM employees WHERE salary BETWEEN 8000 AND 12000;


Input:
[INST] Here is a database schema:
regions :
REGION_ID [ INT ] primary_key
REGION_NAME [ TEXT ]

countries :
COUNTRY_ID [ TEXT ] primary_key
COUNTRY_NAME [ TEXT ]
REGION_ID [ INT ] countries.REGION_ID = regions.REGION_ID

departments :
DEPARTMENT_ID [ INT ] primary_key
DEPARTMENT_NAME [ TEXT ]
MANAGER_ID [ INT ]
LOCATION_ID [ INT ]

jobs :
JOB_ID [ TEXT ] primary_key
JOB_TITLE [ TEXT ]
MIN_SALARY [ INT ]
MAX_SALARY [ INT ]

employees :
EMPLOYEE_ID [ INT ] primary_key
FIRST_NAME [ TEXT ]
LAST_NAME [ TEXT ]
EMAIL [ TEXT ]
PHONE_NUMBER [ TEXT ]
HIRE_DATE [ TEXT ]
JOB_ID [ TEXT ] employees.JOB_ID = jobs.JOB_ID
SALARY [ INT ]
COMMISSION_PCT [ INT ]
MANAGER_ID [ INT ]
DEPARTMENT_ID [ INT ] employees.DEPARTMENT_ID = departments.DEPARTMENT_ID

job_history :
EMPLOYEE_ID [ INT ] primary_key job_history.EMPLOYEE_ID = employees.EMPLOYEE_ID
START_DATE [ TEXT ]
END_DATE [ TEXT ]
JOB_ID [ TEXT ] job_history.JOB_ID = jobs.JOB_ID
DEPARTMENT_ID [ INT ] job_history.DEPARTMENT_ID = departments.DEPARTMENT_ID

locations :
LOCATION_ID [ INT ] primary_key
STREET_ADDRESS [ TEXT ]
POSTAL_CODE [ TEXT ]
CITY [ TEXT ]
STATE_PROVINCE [ TEXT ]
COUNTRY_ID [ TEXT ] locations.COUNTRY_ID = countries.COUNTRY_ID

Please write me a SQL statement that answers the following 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. [/INST]

Output: SELECT * FROM employees WHERE salary BETWEEN 8000 AND 12000 AND commission_pct != "null" OR  department_id != 40;


Input:
[INST] Here is a database schema:
regions :
REGION_ID [ INT ] primary_key
REGION_NAME [ TEXT ]

countries :
COUNTRY_ID [ TEXT ] primary_key
COUNTRY_NAME [ TEXT ]
REGION_ID [ INT ] countries.REGION_ID = regions.REGION_ID

departments :
DEPARTMENT_ID [ INT ] primary_key
DEPARTMENT_NAME [ TEXT ]
MANAGER_ID [ INT ]
LOCATION_ID [ INT ]

jobs :
JOB_ID [ TEXT ] primary_key
JOB_TITLE [ TEXT ]
MIN_SALARY [ INT ]
MAX_SALARY [ INT ]

employees :
EMPLOYEE_ID [ INT ] primary_key
FIRST_NAME [ TEXT ]
LAST_NAME [ TEXT ]
EMAIL [ TEXT ]
PHONE_NUMBER [ TEXT ]
HIRE_DATE [ TEXT ]
JOB_ID [ TEXT ] employees.JOB_ID = jobs.JOB_ID
SALARY [ INT ]
COMMISSION_PCT [ INT ]
MANAGER_ID [ INT ]
DEPARTMENT_ID [ INT ] employees.DEPARTMENT_ID = departments.DEPARTMENT_ID

job_history :
EMPLOYEE_ID [ INT ] primary_key job_history.EMPLOYEE_ID = employees.EMPLOYEE_ID
START_DATE [ TEXT ]
END_DATE [ TEXT ]
JOB_ID [ TEXT ] job_history.JOB_ID = jobs.JOB_ID
DEPARTMENT_ID [ INT ] job_history.DEPARTMENT_ID = departments.DEPARTMENT_ID

locations :
LOCATION_ID [ INT ] primary_key
STREET_ADDRESS [ TEXT ]
POSTAL_CODE [ TEXT ]
CITY [ TEXT ]
STATE_PROVINCE [ TEXT ]
COUNTRY_ID [ TEXT ] locations.COUNTRY_ID = countries.COUNTRY_ID

Please write me a SQL statement that answers the following question: Return all information about employees with salaries between 8000 and 12000 for which commission is not null or where their department id is not 40. [/INST]

Output: SELECT * FROM employees WHERE salary BETWEEN 8000 AND 12000 AND commission_pct != "null" OR  department_id != 40;


Input:
[INST] Here is a database schema:
regions :
REGION_ID [ INT ] primary_key
REGION_NAME [ TEXT ]

countries :
COUNTRY_ID [ TEXT ] primary_key
COUNTRY_NAME [ TEXT ]
REGION_ID [ INT ] countries.REGION_ID = regions.REGION_ID

departments :
DEPARTMENT_ID [ INT ] primary_key
DEPARTMENT_NAME [ TEXT ]
MANAGER_ID [ INT ]
LOCATION_ID [ INT ]

jobs :
JOB_ID [ TEXT ] primary_key
JOB_TITLE [ TEXT ]
MIN_SALARY [ INT ]
MAX_SALARY [ INT ]

employees :
EMPLOYEE_ID [ INT ] primary_key
FIRST_NAME [ TEXT ]
LAST_NAME [ TEXT ]
EMAIL [ TEXT ]
PHONE_NUMBER [ TEXT ]
HIRE_DATE [ TEXT ]
JOB_ID [ TEXT ] employees.JOB_ID = jobs.JOB_ID
SALARY [ INT ]
COMMISSION_PCT [ INT ]
MANAGER_ID [ INT ]
DEPARTMENT_ID [ INT ] employees.DEPARTMENT_ID = departments.DEPARTMENT_ID

job_history :
EMPLOYEE_ID [ INT ] primary_key job_history.EMPLOYEE_ID = employees.EMPLOYEE_ID
START_DATE [ TEXT ]
END_DATE [ TEXT ]
JOB_ID [ TEXT ] job_history.JOB_ID = jobs.JOB_ID
DEPARTMENT_ID [ INT ] job_history.DEPARTMENT_ID = departments.DEPARTMENT_ID

locations :
LOCATION_ID [ INT ] primary_key
STREET_ADDRESS [ TEXT ]
POSTAL_CODE [ TEXT ]
CITY [ TEXT ]
STATE_PROVINCE [ TEXT ]
COUNTRY_ID [ TEXT ] locations.COUNTRY_ID = countries.COUNTRY_ID

Please write me a SQL statement that answers the following question: What are the full name (first and last name) and salary for all employees who does not have any value for commission? [/INST]

Output: SELECT first_name ,  last_name ,  salary FROM  employees WHERE commission_pct  =  "null";


Input:
[INST] Here is a database schema:
regions :
REGION_ID [ INT ] primary_key
REGION_NAME [ TEXT ]

countries :
COUNTRY_ID [ TEXT ] primary_key
COUNTRY_NAME [ TEXT ]
REGION_ID [ INT ] countries.REGION_ID = regions.REGION_ID

departments :
DEPARTMENT_ID [ INT ] primary_key
DEPARTMENT_NAME [ TEXT ]
MANAGER_ID [ INT ]
LOCATION_ID [ INT ]

jobs :
JOB_ID [ TEXT ] primary_key
JOB_TITLE [ TEXT ]
MIN_SALARY [ INT ]
MAX_SALARY [ INT ]

employees :
EMPLOYEE_ID [ INT ] primary_key
FIRST_NAME [ TEXT ]
LAST_NAME [ TEXT ]
EMAIL [ TEXT ]
PHONE_NUMBER [ TEXT ]
HIRE_DATE [ TEXT ]
JOB_ID [ TEXT ] employees.JOB_ID = jobs.JOB_ID
SALARY [ INT ]
COMMISSION_PCT [ INT ]
MANAGER_ID [ INT ]
DEPARTMENT_ID [ INT ] employees.DEPARTMENT_ID = departments.DEPARTMENT_ID

job_history :
EMPLOYEE_ID [ INT ] primary_key job_history.EMPLOYEE_ID = employees.EMPLOYEE_ID
START_DATE [ TEXT ]
END_DATE [ TEXT ]
JOB_ID [ TEXT ] job_history.JOB_ID = jobs.JOB_ID
DEPARTMENT_ID [ INT ] job_history.DEPARTMENT_ID = departments.DEPARTMENT_ID

locations :
LOCATION_ID [ INT ] primary_key
STREET_ADDRESS [ TEXT ]
POSTAL_CODE [ TEXT ]
CITY [ TEXT ]
STATE_PROVINCE [ TEXT ]
COUNTRY_ID [ TEXT ] locations.COUNTRY_ID = countries.COUNTRY_ID

Please write me a SQL statement that answers the following question: Return the full names and salaries of employees with null commissions. [/INST]

Output: SELECT first_name ,  last_name ,  salary FROM  employees WHERE commission_pct  =  "null";


Input:
[INST] Here is a database schema:
regions :
REGION_ID [ INT ] primary_key
REGION_NAME [ TEXT ]

countries :
COUNTRY_ID [ TEXT ] primary_key
COUNTRY_NAME [ TEXT ]
REGION_ID [ INT ] countries.REGION_ID = regions.REGION_ID

departments :
DEPARTMENT_ID [ INT ] primary_key
DEPARTMENT_NAME [ TEXT ]
MANAGER_ID [ INT ]
LOCATION_ID [ INT ]

jobs :
JOB_ID [ TEXT ] primary_key
JOB_TITLE [ TEXT ]
MIN_SALARY [ INT ]
MAX_SALARY [ INT ]

employees :
EMPLOYEE_ID [ INT ] primary_key
FIRST_NAME [ TEXT ]
LAST_NAME [ TEXT ]
EMAIL [ TEXT ]
PHONE_NUMBER [ TEXT ]
HIRE_DATE [ TEXT ]
JOB_ID [ TEXT ] employees.JOB_ID = jobs.JOB_ID
SALARY [ INT ]
COMMISSION_PCT [ INT ]
MANAGER_ID [ INT ]
DEPARTMENT_ID [ INT ] employees.DEPARTMENT_ID = departments.DEPARTMENT_ID

job_history :
EMPLOYEE_ID [ INT ] primary_key job_history.EMPLOYEE_ID = employees.EMPLOYEE_ID
START_DATE [ TEXT ]
END_DATE [ TEXT ]
JOB_ID [ TEXT ] job_history.JOB_ID = jobs.JOB_ID
DEPARTMENT_ID [ INT ] job_history.DEPARTMENT_ID = departments.DEPARTMENT_ID

locations :
LOCATION_ID [ INT ] primary_key
STREET_ADDRESS [ TEXT ]
POSTAL_CODE [ TEXT ]
CITY [ TEXT ]
STATE_PROVINCE [ TEXT ]
COUNTRY_ID [ TEXT ] locations.COUNTRY_ID = countries.COUNTRY_ID

Please write me a SQL statement that answers the following question: Display the first and last name, and salary for those employees whose first name is ending with the letter m. [/INST]

Output: SELECT first_name ,  last_name ,  salary FROM employees WHERE first_name LIKE '%m';


Input:
[INST] Here is a database schema:
regions :
REGION_ID [ INT ] primary_key
REGION_NAME [ TEXT ]

countries :
COUNTRY_ID [ TEXT ] primary_key
COUNTRY_NAME [ TEXT ]
REGION_ID [ INT ] countries.REGION_ID = regions.REGION_ID

departments :
DEPARTMENT_ID [ INT ] primary_key
DEPARTMENT_NAME [ TEXT ]
MANAGER_ID [ INT ]
LOCATION_ID [ INT ]

jobs :
JOB_ID [ TEXT ] primary_key
JOB_TITLE [ TEXT ]
MIN_SALARY [ INT ]
MAX_SALARY [ INT ]

employees :
EMPLOYEE_ID [ INT ] primary_key
FIRST_NAME [ TEXT ]
LAST_NAME [ TEXT ]
EMAIL [ TEXT ]
PHONE_NUMBER [ TEXT ]
HIRE_DATE [ TEXT ]
JOB_ID [ TEXT ] employees.JOB_ID = jobs.JOB_ID
SALARY [ INT ]
COMMISSION_PCT [ INT ]
MANAGER_ID [ INT ]
DEPARTMENT_ID [ INT ] employees.DEPARTMENT_ID = departments.DEPARTMENT_ID

job_history :
EMPLOYEE_ID [ INT ] primary_key job_history.EMPLOYEE_ID = employees.EMPLOYEE_ID
START_DATE [ TEXT ]
END_DATE [ TEXT ]
JOB_ID [ TEXT ] job_history.JOB_ID = jobs.JOB_ID
DEPARTMENT_ID [ INT ] job_history.DEPARTMENT_ID = departments.DEPARTMENT_ID

locations :
LOCATION_ID [ INT ] primary_key
STREET_ADDRESS [ TEXT ]
POSTAL_CODE [ TEXT ]
CITY [ TEXT ]
STATE_PROVINCE [ TEXT ]
COUNTRY_ID [ TEXT ] locations.COUNTRY_ID = countries.COUNTRY_ID

Please write me a SQL statement that answers the following question: Return the full names and salaries for employees with first names that end with the letter m. [/INST]

Output: SELECT first_name ,  last_name ,  salary FROM employees WHERE first_name LIKE '%m';


Input:
[INST] Here is a database schema:
regions :
REGION_ID [ INT ] primary_key
REGION_NAME [ TEXT ]

countries :
COUNTRY_ID [ TEXT ] primary_key
COUNTRY_NAME [ TEXT ]
REGION_ID [ INT ] countries.REGION_ID = regions.REGION_ID

departments :
DEPARTMENT_ID [ INT ] primary_key
DEPARTMENT_NAME [ TEXT ]
MANAGER_ID [ INT ]
LOCATION_ID [ INT ]

jobs :
JOB_ID [ TEXT ] primary_key
JOB_TITLE [ TEXT ]
MIN_SALARY [ INT ]
MAX_SALARY [ INT ]

employees :
EMPLOYEE_ID [ INT ] primary_key
FIRST_NAME [ TEXT ]
LAST_NAME [ TEXT ]
EMAIL [ TEXT ]
PHONE_NUMBER [ TEXT ]
HIRE_DATE [ TEXT ]
JOB_ID [ TEXT ] employees.JOB_ID = jobs.JOB_ID
SALARY [ INT ]
COMMISSION_PCT [ INT ]
MANAGER_ID [ INT ]
DEPARTMENT_ID [ INT ] employees.DEPARTMENT_ID = departments.DEPARTMENT_ID

job_history :
EMPLOYEE_ID [ INT ] primary_key job_history.EMPLOYEE_ID = employees.EMPLOYEE_ID
START_DATE [ TEXT ]
END_DATE [ TEXT ]
JOB_ID [ TEXT ] job_history.JOB_ID = jobs.JOB_ID
DEPARTMENT_ID [ INT ] job_history.DEPARTMENT_ID = departments.DEPARTMENT_ID

locations :
LOCATION_ID [ INT ] primary_key
STREET_ADDRESS [ TEXT ]
POSTAL_CODE [ TEXT ]
CITY [ TEXT ]
STATE_PROVINCE [ TEXT ]
COUNTRY_ID [ TEXT ] locations.COUNTRY_ID = countries.COUNTRY_ID

Please write me a SQL statement that answers the following question: Find job id and date of hire for those employees who was hired between November 5th, 2007 and July 5th, 2009. [/INST]

Output: SELECT job_id ,  hire_date FROM employees WHERE hire_date BETWEEN '2007-11-05' AND '2009-07-05';


Input:
[INST] Here is a database schema:
regions :
REGION_ID [ INT ] primary_key
REGION_NAME [ TEXT ]

countries :
COUNTRY_ID [ TEXT ] primary_key
COUNTRY_NAME [ TEXT ]
REGION_ID [ INT ] countries.REGION_ID = regions.REGION_ID

departments :
DEPARTMENT_ID [ INT ] primary_key
DEPARTMENT_NAME [ TEXT ]
MANAGER_ID [ INT ]
LOCATION_ID [ INT ]

jobs :
JOB_ID [ TEXT ] primary_key
JOB_TITLE [ TEXT ]
MIN_SALARY [ INT ]
MAX_SALARY [ INT ]

employees :
EMPLOYEE_ID [ INT ] primary_key
FIRST_NAME [ TEXT ]
LAST_NAME [ TEXT ]
EMAIL [ TEXT ]
PHONE_NUMBER [ TEXT ]
HIRE_DATE [ TEXT ]
JOB_ID [ TEXT ] employees.JOB_ID = jobs.JOB_ID
SALARY [ INT ]
COMMISSION_PCT [ INT ]
MANAGER_ID [ INT ]
DEPARTMENT_ID [ INT ] employees.DEPARTMENT_ID = departments.DEPARTMENT_ID

job_history :
EMPLOYEE_ID [ INT ] primary_key job_history.EMPLOYEE_ID = employees.EMPLOYEE_ID
START_DATE [ TEXT ]
END_DATE [ TEXT ]
JOB_ID [ TEXT ] job_history.JOB_ID = jobs.JOB_ID
DEPARTMENT_ID [ INT ] job_history.DEPARTMENT_ID = departments.DEPARTMENT_ID

locations :
LOCATION_ID [ INT ] primary_key
STREET_ADDRESS [ TEXT ]
POSTAL_CODE [ TEXT ]
CITY [ TEXT ]
STATE_PROVINCE [ TEXT ]
COUNTRY_ID [ TEXT ] locations.COUNTRY_ID = countries.COUNTRY_ID

Please write me a SQL statement that answers the following question: What are the job ids and dates of hire for employees hired after November 5th, 2007 and before July 5th, 2009? [/INST]

Output: SELECT job_id ,  hire_date FROM employees WHERE hire_date BETWEEN '2007-11-05' AND '2009-07-05';


Input:
[INST] Here is a database schema:
regions :
REGION_ID [ INT ] primary_key
REGION_NAME [ TEXT ]

countries :
COUNTRY_ID [ TEXT ] primary_key
COUNTRY_NAME [ TEXT ]
REGION_ID [ INT ] countries.REGION_ID = regions.REGION_ID

departments :
DEPARTMENT_ID [ INT ] primary_key
DEPARTMENT_NAME [ TEXT ]
MANAGER_ID [ INT ]
LOCATION_ID [ INT ]

jobs :
JOB_ID [ TEXT ] primary_key
JOB_TITLE [ TEXT ]
MIN_SALARY [ INT ]
MAX_SALARY [ INT ]

employees :
EMPLOYEE_ID [ INT ] primary_key
FIRST_NAME [ TEXT ]
LAST_NAME [ TEXT ]
EMAIL [ TEXT ]
PHONE_NUMBER [ TEXT ]
HIRE_DATE [ TEXT ]
JOB_ID [ TEXT ] employees.JOB_ID = jobs.JOB_ID
SALARY [ INT ]
COMMISSION_PCT [ INT ]
MANAGER_ID [ INT ]
DEPARTMENT_ID [ INT ] employees.DEPARTMENT_ID = departments.DEPARTMENT_ID

job_history :
EMPLOYEE_ID [ INT ] primary_key job_history.EMPLOYEE_ID = employees.EMPLOYEE_ID
START_DATE [ TEXT ]
END_DATE [ TEXT ]
JOB_ID [ TEXT ] job_history.JOB_ID = jobs.JOB_ID
DEPARTMENT_ID [ INT ] job_history.DEPARTMENT_ID = departments.DEPARTMENT_ID

locations :
LOCATION_ID [ INT ] primary_key
STREET_ADDRESS [ TEXT ]
POSTAL_CODE [ TEXT ]
CITY [ TEXT ]
STATE_PROVINCE [ TEXT ]
COUNTRY_ID [ TEXT ] locations.COUNTRY_ID = countries.COUNTRY_ID

Please write me a SQL statement that answers the following question: What are the first and last name for those employees who works either in department 70 or 90? [/INST]

Output: SELECT first_name ,  last_name FROM employees WHERE department_id  =  70 OR department_id  =  90;


Input:
[INST] Here is a database schema:
regions :
REGION_ID [ INT ] primary_key
REGION_NAME [ TEXT ]

countries :
COUNTRY_ID [ TEXT ] primary_key
COUNTRY_NAME [ TEXT ]
REGION_ID [ INT ] countries.REGION_ID = regions.REGION_ID

departments :
DEPARTMENT_ID [ INT ] primary_key
DEPARTMENT_NAME [ TEXT ]
MANAGER_ID [ INT ]
LOCATION_ID [ INT ]

jobs :
JOB_ID [ TEXT ] primary_key
JOB_TITLE [ TEXT ]
MIN_SALARY [ INT ]
MAX_SALARY [ INT ]

employees :
EMPLOYEE_ID [ INT ] primary_key
FIRST_NAME [ TEXT ]
LAST_NAME [ TEXT ]
EMAIL [ TEXT ]
PHONE_NUMBER [ TEXT ]
HIRE_DATE [ TEXT ]
JOB_ID [ TEXT ] employees.JOB_ID = jobs.JOB_ID
SALARY [ INT ]
COMMISSION_PCT [ INT ]
MANAGER_ID [ INT ]
DEPARTMENT_ID [ INT ] employees.DEPARTMENT_ID = departments.DEPARTMENT_ID

job_history :
EMPLOYEE_ID [ INT ] primary_key job_history.EMPLOYEE_ID = employees.EMPLOYEE_ID
START_DATE [ TEXT ]
END_DATE [ TEXT ]
JOB_ID [ TEXT ] job_history.JOB_ID = jobs.JOB_ID
DEPARTMENT_ID [ INT ] job_history.DEPARTMENT_ID = departments.DEPARTMENT_ID

locations :
LOCATION_ID [ INT ] primary_key
STREET_ADDRESS [ TEXT ]
POSTAL_CODE [ TEXT ]
CITY [ TEXT ]
STATE_PROVINCE [ TEXT ]
COUNTRY_ID [ TEXT ] locations.COUNTRY_ID = countries.COUNTRY_ID

Please write me a SQL statement that answers the following question: What are the full names of employees who with in department 70 or 90? [/INST]

Output: SELECT first_name ,  last_name FROM employees WHERE department_id  =  70 OR department_id  =  90;


Input:
[INST] Here is a database schema:
regions :
REGION_ID [ INT ] primary_key
REGION_NAME [ TEXT ]

countries :
COUNTRY_ID [ TEXT ] primary_key
COUNTRY_NAME [ TEXT ]
REGION_ID [ INT ] countries.REGION_ID = regions.REGION_ID

departments :
DEPARTMENT_ID [ INT ] primary_key
DEPARTMENT_NAME [ TEXT ]
MANAGER_ID [ INT ]
LOCATION_ID [ INT ]

jobs :
JOB_ID [ TEXT ] primary_key
JOB_TITLE [ TEXT ]
MIN_SALARY [ INT ]
MAX_SALARY [ INT ]

employees :
EMPLOYEE_ID [ INT ] primary_key
FIRST_NAME [ TEXT ]
LAST_NAME [ TEXT ]
EMAIL [ TEXT ]
PHONE_NUMBER [ TEXT ]
HIRE_DATE [ TEXT ]
JOB_ID [ TEXT ] employees.JOB_ID = jobs.JOB_ID
SALARY [ INT ]
COMMISSION_PCT [ INT ]
MANAGER_ID [ INT ]
DEPARTMENT_ID [ INT ] employees.DEPARTMENT_ID = departments.DEPARTMENT_ID

job_history :
EMPLOYEE_ID [ INT ] primary_key job_history.EMPLOYEE_ID = employees.EMPLOYEE_ID
START_DATE [ TEXT ]
END_DATE [ TEXT ]
JOB_ID [ TEXT ] job_history.JOB_ID = jobs.JOB_ID
DEPARTMENT_ID [ INT ] job_history.DEPARTMENT_ID = departments.DEPARTMENT_ID

locations :
LOCATION_ID [ INT ] primary_key
STREET_ADDRESS [ TEXT ]
POSTAL_CODE [ TEXT ]
CITY [ TEXT ]
STATE_PROVINCE [ TEXT ]
COUNTRY_ID [ TEXT ] locations.COUNTRY_ID = countries.COUNTRY_ID

Please write me a SQL statement that answers the following question: Find the salary and manager number for those employees who is working under a manager. [/INST]

Output: SELECT salary ,  manager_id FROM employees WHERE manager_id != "null";


Input:
[INST] Here is a database schema:
regions :
REGION_ID [ INT ] primary_key
REGION_NAME [ TEXT ]

countries :
COUNTRY_ID [ TEXT ] primary_key
COUNTRY_NAME [ TEXT ]
REGION_ID [ INT ] countries.REGION_ID = regions.REGION_ID

departments :
DEPARTMENT_ID [ INT ] primary_key
DEPARTMENT_NAME [ TEXT ]
MANAGER_ID [ INT ]
LOCATION_ID [ INT ]

jobs :
JOB_ID [ TEXT ] primary_key
JOB_TITLE [ TEXT ]
MIN_SALARY [ INT ]
MAX_SALARY [ INT ]

employees :
EMPLOYEE_ID [ INT ] primary_key
FIRST_NAME [ TEXT ]
LAST_NAME [ TEXT ]
EMAIL [ TEXT ]
PHONE_NUMBER [ TEXT ]
HIRE_DATE [ TEXT ]
JOB_ID [ TEXT ] employees.JOB_ID = jobs.JOB_ID
SALARY [ INT ]
COMMISSION_PCT [ INT ]
MANAGER_ID [ INT ]
DEPARTMENT_ID [ INT ] employees.DEPARTMENT_ID = departments.DEPARTMENT_ID

job_history :
EMPLOYEE_ID [ INT ] primary_key job_history.EMPLOYEE_ID = employees.EMPLOYEE_ID
START_DATE [ TEXT ]
END_DATE [ TEXT ]
JOB_ID [ TEXT ] job_history.JOB_ID = jobs.JOB_ID
DEPARTMENT_ID [ INT ] job_history.DEPARTMENT_ID = departments.DEPARTMENT_ID

locations :
LOCATION_ID [ INT ] primary_key
STREET_ADDRESS [ TEXT ]
POSTAL_CODE [ TEXT ]
CITY [ TEXT ]
STATE_PROVINCE [ TEXT ]
COUNTRY_ID [ TEXT ] locations.COUNTRY_ID = countries.COUNTRY_ID

Please write me a SQL statement that answers the following question: What are the salaries and manager ids for employees who have managers? [/INST]

Output: SELECT salary ,  manager_id FROM employees WHERE manager_id != "null";


Input:
[INST] Here is a database schema:
regions :
REGION_ID [ INT ] primary_key
REGION_NAME [ TEXT ]

countries :
COUNTRY_ID [ TEXT ] primary_key
COUNTRY_NAME [ TEXT ]
REGION_ID [ INT ] countries.REGION_ID = regions.REGION_ID

departments :
DEPARTMENT_ID [ INT ] primary_key
DEPARTMENT_NAME [ TEXT ]
MANAGER_ID [ INT ]
LOCATION_ID [ INT ]

jobs :
JOB_ID [ TEXT ] primary_key
JOB_TITLE [ TEXT ]
MIN_SALARY [ INT ]
MAX_SALARY [ INT ]

employees :
EMPLOYEE_ID [ INT ] primary_key
FIRST_NAME [ TEXT ]
LAST_NAME [ TEXT ]
EMAIL [ TEXT ]
PHONE_NUMBER [ TEXT ]
HIRE_DATE [ TEXT ]
JOB_ID [ TEXT ] employees.JOB_ID = jobs.JOB_ID
SALARY [ INT ]
COMMISSION_PCT [ INT ]
MANAGER_ID [ INT ]
DEPARTMENT_ID [ INT ] employees.DEPARTMENT_ID = departments.DEPARTMENT_ID

job_history :
EMPLOYEE_ID [ INT ] primary_key job_history.EMPLOYEE_ID = employees.EMPLOYEE_ID
START_DATE [ TEXT ]
END_DATE [ TEXT ]
JOB_ID [ TEXT ] job_history.JOB_ID = jobs.JOB_ID
DEPARTMENT_ID [ INT ] job_history.DEPARTMENT_ID = departments.DEPARTMENT_ID

locations :
LOCATION_ID [ INT ] primary_key
STREET_ADDRESS [ TEXT ]
POSTAL_CODE [ TEXT ]
CITY [ TEXT ]
STATE_PROVINCE [ TEXT ]
COUNTRY_ID [ TEXT ] locations.COUNTRY_ID = countries.COUNTRY_ID

Please write me a SQL statement that answers the following question: display all the details from Employees table for those employees who was hired before 2002-06-21. [/INST]

Output: SELECT * FROM employees WHERE hire_date  <  '2002-06-21';


Input:
[INST] Here is a database schema:
regions :
REGION_ID [ INT ] primary_key
REGION_NAME [ TEXT ]

countries :
COUNTRY_ID [ TEXT ] primary_key
COUNTRY_NAME [ TEXT ]
REGION_ID [ INT ] countries.REGION_ID = regions.REGION_ID

departments :
DEPARTMENT_ID [ INT ] primary_key
DEPARTMENT_NAME [ TEXT ]
MANAGER_ID [ INT ]
LOCATION_ID [ INT ]

jobs :
JOB_ID [ TEXT ] primary_key
JOB_TITLE [ TEXT ]
MIN_SALARY [ INT ]
MAX_SALARY [ INT ]

employees :
EMPLOYEE_ID [ INT ] primary_key
FIRST_NAME [ TEXT ]
LAST_NAME [ TEXT ]
EMAIL [ TEXT ]
PHONE_NUMBER [ TEXT ]
HIRE_DATE [ TEXT ]
JOB_ID [ TEXT ] employees.JOB_ID = jobs.JOB_ID
SALARY [ INT ]
COMMISSION_PCT [ INT ]
MANAGER_ID [ INT ]
DEPARTMENT_ID [ INT ] employees.DEPARTMENT_ID = departments.DEPARTMENT_ID

job_history :
EMPLOYEE_ID [ INT ] primary_key job_history.EMPLOYEE_ID = employees.EMPLOYEE_ID
START_DATE [ TEXT ]
END_DATE [ TEXT ]
JOB_ID [ TEXT ] job_history.JOB_ID = jobs.JOB_ID
DEPARTMENT_ID [ INT ] job_history.DEPARTMENT_ID = departments.DEPARTMENT_ID

locations :
LOCATION_ID [ INT ] primary_key
STREET_ADDRESS [ TEXT ]
POSTAL_CODE [ TEXT ]
CITY [ TEXT ]
STATE_PROVINCE [ TEXT ]
COUNTRY_ID [ TEXT ] locations.COUNTRY_ID = countries.COUNTRY_ID

Please write me a SQL statement that answers the following question: What is all the information about employees hired before June 21, 2002? [/INST]

Output: SELECT * FROM employees WHERE hire_date  <  '2002-06-21';


Input:
[INST] Here is a database schema:
regions :
REGION_ID [ INT ] primary_key
REGION_NAME [ TEXT ]

countries :
COUNTRY_ID [ TEXT ] primary_key
COUNTRY_NAME [ TEXT ]
REGION_ID [ INT ] countries.REGION_ID = regions.REGION_ID

departments :
DEPARTMENT_ID [ INT ] primary_key
DEPARTMENT_NAME [ TEXT ]
MANAGER_ID [ INT ]
LOCATION_ID [ INT ]

jobs :
JOB_ID [ TEXT ] primary_key
JOB_TITLE [ TEXT ]
MIN_SALARY [ INT ]
MAX_SALARY [ INT ]

employees :
EMPLOYEE_ID [ INT ] primary_key
FIRST_NAME [ TEXT ]
LAST_NAME [ TEXT ]
EMAIL [ TEXT ]
PHONE_NUMBER [ TEXT ]
HIRE_DATE [ TEXT ]
JOB_ID [ TEXT ] employees.JOB_ID = jobs.JOB_ID
SALARY [ INT ]
COMMISSION_PCT [ INT ]
MANAGER_ID [ INT ]
DEPARTMENT_ID [ INT ] employees.DEPARTMENT_ID = departments.DEPARTMENT_ID

job_history :
EMPLOYEE_ID [ INT ] primary_key job_history.EMPLOYEE_ID = employees.EMPLOYEE_ID
START_DATE [ TEXT ]
END_DATE [ TEXT ]
JOB_ID [ TEXT ] job_history.JOB_ID = jobs.JOB_ID
DEPARTMENT_ID [ INT ] job_history.DEPARTMENT_ID = departments.DEPARTMENT_ID

locations :
LOCATION_ID [ INT ] primary_key
STREET_ADDRESS [ TEXT ]
POSTAL_CODE [ TEXT ]
CITY [ TEXT ]
STATE_PROVINCE [ TEXT ]
COUNTRY_ID [ TEXT ] locations.COUNTRY_ID = countries.COUNTRY_ID

Please write me a SQL statement that answers the following 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. [/INST]

Output: SELECT * FROM employees WHERE first_name LIKE '%D%' OR first_name LIKE '%S%' ORDER BY salary DESC;


Input:
[INST] Here is a database schema:
regions :
REGION_ID [ INT ] primary_key
REGION_NAME [ TEXT ]

countries :
COUNTRY_ID [ TEXT ] primary_key
COUNTRY_NAME [ TEXT ]
REGION_ID [ INT ] countries.REGION_ID = regions.REGION_ID

departments :
DEPARTMENT_ID [ INT ] primary_key
DEPARTMENT_NAME [ TEXT ]
MANAGER_ID [ INT ]
LOCATION_ID [ INT ]

jobs :
JOB_ID [ TEXT ] primary_key
JOB_TITLE [ TEXT ]
MIN_SALARY [ INT ]
MAX_SALARY [ INT ]

employees :
EMPLOYEE_ID [ INT ] primary_key
FIRST_NAME [ TEXT ]
LAST_NAME [ TEXT ]
EMAIL [ TEXT ]
PHONE_NUMBER [ TEXT ]
HIRE_DATE [ TEXT ]
JOB_ID [ TEXT ] employees.JOB_ID = jobs.JOB_ID
SALARY [ INT ]
COMMISSION_PCT [ INT ]
MANAGER_ID [ INT ]
DEPARTMENT_ID [ INT ] employees.DEPARTMENT_ID = departments.DEPARTMENT_ID

job_history :
EMPLOYEE_ID [ INT ] primary_key job_history.EMPLOYEE_ID = employees.EMPLOYEE_ID
START_DATE [ TEXT ]
END_DATE [ TEXT ]
JOB_ID [ TEXT ] job_history.JOB_ID = jobs.JOB_ID
DEPARTMENT_ID [ INT ] job_history.DEPARTMENT_ID = departments.DEPARTMENT_ID

locations :
LOCATION_ID [ INT ] primary_key
STREET_ADDRESS [ TEXT ]
POSTAL_CODE [ TEXT ]
CITY [ TEXT ]
STATE_PROVINCE [ TEXT ]
COUNTRY_ID [ TEXT ] locations.COUNTRY_ID = countries.COUNTRY_ID

Please write me a SQL statement that answers the following question: What is all the information about employees with D or S in their first name, ordered by salary descending? [/INST]

Output: SELECT * FROM employees WHERE first_name LIKE '%D%' OR first_name LIKE '%S%' ORDER BY salary DESC;


Input:
[INST] Here is a database schema:
regions :
REGION_ID [ INT ] primary_key
REGION_NAME [ TEXT ]

countries :
COUNTRY_ID [ TEXT ] primary_key
COUNTRY_NAME [ TEXT ]
REGION_ID [ INT ] countries.REGION_ID = regions.REGION_ID

departments :
DEPARTMENT_ID [ INT ] primary_key
DEPARTMENT_NAME [ TEXT ]
MANAGER_ID [ INT ]
LOCATION_ID [ INT ]

jobs :
JOB_ID [ TEXT ] primary_key
JOB_TITLE [ TEXT ]
MIN_SALARY [ INT ]
MAX_SALARY [ INT ]

employees :
EMPLOYEE_ID [ INT ] primary_key
FIRST_NAME [ TEXT ]
LAST_NAME [ TEXT ]
EMAIL [ TEXT ]
PHONE_NUMBER [ TEXT ]
HIRE_DATE [ TEXT ]
JOB_ID [ TEXT ] employees.JOB_ID = jobs.JOB_ID
SALARY [ INT ]
COMMISSION_PCT [ INT ]
MANAGER_ID [ INT ]
DEPARTMENT_ID [ INT ] employees.DEPARTMENT_ID = departments.DEPARTMENT_ID

job_history :
EMPLOYEE_ID [ INT ] primary_key job_history.EMPLOYEE_ID = employees.EMPLOYEE_ID
START_DATE [ TEXT ]
END_DATE [ TEXT ]
JOB_ID [ TEXT ] job_history.JOB_ID = jobs.JOB_ID
DEPARTMENT_ID [ INT ] job_history.DEPARTMENT_ID = departments.DEPARTMENT_ID

locations :
LOCATION_ID [ INT ] primary_key
STREET_ADDRESS [ TEXT ]
POSTAL_CODE [ TEXT ]
CITY [ TEXT ]
STATE_PROVINCE [ TEXT ]
COUNTRY_ID [ TEXT ] locations.COUNTRY_ID = countries.COUNTRY_ID

Please write me a SQL statement that answers the following question: display those employees who joined after 7th September, 1987. [/INST]

Output: SELECT * FROM employees WHERE hire_date  >  '1987-09-07';


Input:
[INST] Here is a database schema:
regions :
REGION_ID [ INT ] primary_key
REGION_NAME [ TEXT ]

countries :
COUNTRY_ID [ TEXT ] primary_key
COUNTRY_NAME [ TEXT ]
REGION_ID [ INT ] countries.REGION_ID = regions.REGION_ID

departments :
DEPARTMENT_ID [ INT ] primary_key
DEPARTMENT_NAME [ TEXT ]
MANAGER_ID [ INT ]
LOCATION_ID [ INT ]

jobs :
JOB_ID [ TEXT ] primary_key
JOB_TITLE [ TEXT ]
MIN_SALARY [ INT ]
MAX_SALARY [ INT ]

employees :
EMPLOYEE_ID [ INT ] primary_key
FIRST_NAME [ TEXT ]
LAST_NAME [ TEXT ]
EMAIL [ TEXT ]
PHONE_NUMBER [ TEXT ]
HIRE_DATE [ TEXT ]
JOB_ID [ TEXT ] employees.JOB_ID = jobs.JOB_ID
SALARY [ INT ]
COMMISSION_PCT [ INT ]
MANAGER_ID [ INT ]
DEPARTMENT_ID [ INT ] employees.DEPARTMENT_ID = departments.DEPARTMENT_ID

job_history :
EMPLOYEE_ID [ INT ] primary_key job_history.EMPLOYEE_ID = employees.EMPLOYEE_ID
START_DATE [ TEXT ]
END_DATE [ TEXT ]
JOB_ID [ TEXT ] job_history.JOB_ID = jobs.JOB_ID
DEPARTMENT_ID [ INT ] job_history.DEPARTMENT_ID = departments.DEPARTMENT_ID

locations :
LOCATION_ID [ INT ] primary_key
STREET_ADDRESS [ TEXT ]
POSTAL_CODE [ TEXT ]
CITY [ TEXT ]
STATE_PROVINCE [ TEXT ]
COUNTRY_ID [ TEXT ] locations.COUNTRY_ID = countries.COUNTRY_ID

Please write me a SQL statement that answers the following question: Which employees were hired after September 7th, 1987? [/INST]

Output: SELECT * FROM employees WHERE hire_date  >  '1987-09-07';


Input:
[INST] Here is a database schema:
regions :
REGION_ID [ INT ] primary_key
REGION_NAME [ TEXT ]

countries :
COUNTRY_ID [ TEXT ] primary_key
COUNTRY_NAME [ TEXT ]
REGION_ID [ INT ] countries.REGION_ID = regions.REGION_ID

departments :
DEPARTMENT_ID [ INT ] primary_key
DEPARTMENT_NAME [ TEXT ]
MANAGER_ID [ INT ]
LOCATION_ID [ INT ]

jobs :
JOB_ID [ TEXT ] primary_key
JOB_TITLE [ TEXT ]
MIN_SALARY [ INT ]
MAX_SALARY [ INT ]

employees :
EMPLOYEE_ID [ INT ] primary_key
FIRST_NAME [ TEXT ]
LAST_NAME [ TEXT ]
EMAIL [ TEXT ]
PHONE_NUMBER [ TEXT ]
HIRE_DATE [ TEXT ]
JOB_ID [ TEXT ] employees.JOB_ID = jobs.JOB_ID
SALARY [ INT ]
COMMISSION_PCT [ INT ]
MANAGER_ID [ INT ]
DEPARTMENT_ID [ INT ] employees.DEPARTMENT_ID = departments.DEPARTMENT_ID

job_history :
EMPLOYEE_ID [ INT ] primary_key job_history.EMPLOYEE_ID = employees.EMPLOYEE_ID
START_DATE [ TEXT ]
END_DATE [ TEXT ]
JOB_ID [ TEXT ] job_history.JOB_ID = jobs.JOB_ID
DEPARTMENT_ID [ INT ] job_history.DEPARTMENT_ID = departments.DEPARTMENT_ID

locations :
LOCATION_ID [ INT ] primary_key
STREET_ADDRESS [ TEXT ]
POSTAL_CODE [ TEXT ]
CITY [ TEXT ]
STATE_PROVINCE [ TEXT ]
COUNTRY_ID [ TEXT ] locations.COUNTRY_ID = countries.COUNTRY_ID

Please write me a SQL statement that answers the following question: display the job title of jobs which minimum salary is greater than 9000. [/INST]

Output: SELECT job_title FROM jobs WHERE min_salary  >  9000;


Input:
[INST] Here is a database schema:
regions :
REGION_ID [ INT ] primary_key
REGION_NAME [ TEXT ]

countries :
COUNTRY_ID [ TEXT ] primary_key
COUNTRY_NAME [ TEXT ]
REGION_ID [ INT ] countries.REGION_ID = regions.REGION_ID

departments :
DEPARTMENT_ID [ INT ] primary_key
DEPARTMENT_NAME [ TEXT ]
MANAGER_ID [ INT ]
LOCATION_ID [ INT ]

jobs :
JOB_ID [ TEXT ] primary_key
JOB_TITLE [ TEXT ]
MIN_SALARY [ INT ]
MAX_SALARY [ INT ]

employees :
EMPLOYEE_ID [ INT ] primary_key
FIRST_NAME [ TEXT ]
LAST_NAME [ TEXT ]
EMAIL [ TEXT ]
PHONE_NUMBER [ TEXT ]
HIRE_DATE [ TEXT ]
JOB_ID [ TEXT ] employees.JOB_ID = jobs.JOB_ID
SALARY [ INT ]
COMMISSION_PCT [ INT ]
MANAGER_ID [ INT ]
DEPARTMENT_ID [ INT ] employees.DEPARTMENT_ID = departments.DEPARTMENT_ID

job_history :
EMPLOYEE_ID [ INT ] primary_key job_history.EMPLOYEE_ID = employees.EMPLOYEE_ID
START_DATE [ TEXT ]
END_DATE [ TEXT ]
JOB_ID [ TEXT ] job_history.JOB_ID = jobs.JOB_ID
DEPARTMENT_ID [ INT ] job_history.DEPARTMENT_ID = departments.DEPARTMENT_ID

locations :
LOCATION_ID [ INT ] primary_key
STREET_ADDRESS [ TEXT ]
POSTAL_CODE [ TEXT ]
CITY [ TEXT ]
STATE_PROVINCE [ TEXT ]
COUNTRY_ID [ TEXT ] locations.COUNTRY_ID = countries.COUNTRY_ID

Please write me a SQL statement that answers the following question: Which job titles correspond to jobs with salaries over 9000? [/INST]

Output: SELECT job_title FROM jobs WHERE min_salary  >  9000;


Input:
[INST] Here is a database schema:
regions :
REGION_ID [ INT ] primary_key
REGION_NAME [ TEXT ]

countries :
COUNTRY_ID [ TEXT ] primary_key
COUNTRY_NAME [ TEXT ]
REGION_ID [ INT ] countries.REGION_ID = regions.REGION_ID

departments :
DEPARTMENT_ID [ INT ] primary_key
DEPARTMENT_NAME [ TEXT ]
MANAGER_ID [ INT ]
LOCATION_ID [ INT ]

jobs :
JOB_ID [ TEXT ] primary_key
JOB_TITLE [ TEXT ]
MIN_SALARY [ INT ]
MAX_SALARY [ INT ]

employees :
EMPLOYEE_ID [ INT ] primary_key
FIRST_NAME [ TEXT ]
LAST_NAME [ TEXT ]
EMAIL [ TEXT ]
PHONE_NUMBER [ TEXT ]
HIRE_DATE [ TEXT ]
JOB_ID [ TEXT ] employees.JOB_ID = jobs.JOB_ID
SALARY [ INT ]
COMMISSION_PCT [ INT ]
MANAGER_ID [ INT ]
DEPARTMENT_ID [ INT ] employees.DEPARTMENT_ID = departments.DEPARTMENT_ID

job_history :
EMPLOYEE_ID [ INT ] primary_key job_history.EMPLOYEE_ID = employees.EMPLOYEE_ID
START_DATE [ TEXT ]
END_DATE [ TEXT ]
JOB_ID [ TEXT ] job_history.JOB_ID = jobs.JOB_ID
DEPARTMENT_ID [ INT ] job_history.DEPARTMENT_ID = departments.DEPARTMENT_ID

locations :
LOCATION_ID [ INT ] primary_key
STREET_ADDRESS [ TEXT ]
POSTAL_CODE [ TEXT ]
CITY [ TEXT ]
STATE_PROVINCE [ TEXT ]
COUNTRY_ID [ TEXT ] locations.COUNTRY_ID = countries.COUNTRY_ID

Please write me a SQL statement that answers the following question: display job Title, the difference between minimum and maximum salaries for those jobs which max salary within the range 12000 to 18000. [/INST]

Output: SELECT job_title ,  max_salary - min_salary FROM jobs WHERE max_salary BETWEEN 12000 AND 18000;


Input:
[INST] Here is a database schema:
regions :
REGION_ID [ INT ] primary_key
REGION_NAME [ TEXT ]

countries :
COUNTRY_ID [ TEXT ] primary_key
COUNTRY_NAME [ TEXT ]
REGION_ID [ INT ] countries.REGION_ID = regions.REGION_ID

departments :
DEPARTMENT_ID [ INT ] primary_key
DEPARTMENT_NAME [ TEXT ]
MANAGER_ID [ INT ]
LOCATION_ID [ INT ]

jobs :
JOB_ID [ TEXT ] primary_key
JOB_TITLE [ TEXT ]
MIN_SALARY [ INT ]
MAX_SALARY [ INT ]

employees :
EMPLOYEE_ID [ INT ] primary_key
FIRST_NAME [ TEXT ]
LAST_NAME [ TEXT ]
EMAIL [ TEXT ]
PHONE_NUMBER [ TEXT ]
HIRE_DATE [ TEXT ]
JOB_ID [ TEXT ] employees.JOB_ID = jobs.JOB_ID
SALARY [ INT ]
COMMISSION_PCT [ INT ]
MANAGER_ID [ INT ]
DEPARTMENT_ID [ INT ] employees.DEPARTMENT_ID = departments.DEPARTMENT_ID

job_history :
EMPLOYEE_ID [ INT ] primary_key job_history.EMPLOYEE_ID = employees.EMPLOYEE_ID
START_DATE [ TEXT ]
END_DATE [ TEXT ]
JOB_ID [ TEXT ] job_history.JOB_ID = jobs.JOB_ID
DEPARTMENT_ID [ INT ] job_history.DEPARTMENT_ID = departments.DEPARTMENT_ID

locations :
LOCATION_ID [ INT ] primary_key
STREET_ADDRESS [ TEXT ]
POSTAL_CODE [ TEXT ]
CITY [ TEXT ]
STATE_PROVINCE [ TEXT ]
COUNTRY_ID [ TEXT ] locations.COUNTRY_ID = countries.COUNTRY_ID

Please write me a SQL statement that answers the following question: What are the job titles, and range of salaries for jobs with maximum salary between 12000 and 18000? [/INST]

Output: SELECT job_title ,  max_salary - min_salary FROM jobs WHERE max_salary BETWEEN 12000 AND 18000;


Input:
[INST] Here is a database schema:
regions :
REGION_ID [ INT ] primary_key
REGION_NAME [ TEXT ]

countries :
COUNTRY_ID [ TEXT ] primary_key
COUNTRY_NAME [ TEXT ]
REGION_ID [ INT ] countries.REGION_ID = regions.REGION_ID

departments :
DEPARTMENT_ID [ INT ] primary_key
DEPARTMENT_NAME [ TEXT ]
MANAGER_ID [ INT ]
LOCATION_ID [ INT ]

jobs :
JOB_ID [ TEXT ] primary_key
JOB_TITLE [ TEXT ]
MIN_SALARY [ INT ]
MAX_SALARY [ INT ]

employees :
EMPLOYEE_ID [ INT ] primary_key
FIRST_NAME [ TEXT ]
LAST_NAME [ TEXT ]
EMAIL [ TEXT ]
PHONE_NUMBER [ TEXT ]
HIRE_DATE [ TEXT ]
JOB_ID [ TEXT ] employees.JOB_ID = jobs.JOB_ID
SALARY [ INT ]
COMMISSION_PCT [ INT ]
MANAGER_ID [ INT ]
DEPARTMENT_ID [ INT ] employees.DEPARTMENT_ID = departments.DEPARTMENT_ID

job_history :
EMPLOYEE_ID [ INT ] primary_key job_history.EMPLOYEE_ID = employees.EMPLOYEE_ID
START_DATE [ TEXT ]
END_DATE [ TEXT ]
JOB_ID [ TEXT ] job_history.JOB_ID = jobs.JOB_ID
DEPARTMENT_ID [ INT ] job_history.DEPARTMENT_ID = departments.DEPARTMENT_ID

locations :
LOCATION_ID [ INT ] primary_key
STREET_ADDRESS [ TEXT ]
POSTAL_CODE [ TEXT ]
CITY [ TEXT ]
STATE_PROVINCE [ TEXT ]
COUNTRY_ID [ TEXT ] locations.COUNTRY_ID = countries.COUNTRY_ID

Please write me a SQL statement that answers the following 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. [/INST]

Output: SELECT email FROM employees WHERE commission_pct  =  "null" AND salary BETWEEN 7000 AND 12000 AND department_id = 50;


Input:
[INST] Here is a database schema:
regions :
REGION_ID [ INT ] primary_key
REGION_NAME [ TEXT ]

countries :
COUNTRY_ID [ TEXT ] primary_key
COUNTRY_NAME [ TEXT ]
REGION_ID [ INT ] countries.REGION_ID = regions.REGION_ID

departments :
DEPARTMENT_ID [ INT ] primary_key
DEPARTMENT_NAME [ TEXT ]
MANAGER_ID [ INT ]
LOCATION_ID [ INT ]

jobs :
JOB_ID [ TEXT ] primary_key
JOB_TITLE [ TEXT ]
MIN_SALARY [ INT ]
MAX_SALARY [ INT ]

employees :
EMPLOYEE_ID [ INT ] primary_key
FIRST_NAME [ TEXT ]
LAST_NAME [ TEXT ]
EMAIL [ TEXT ]
PHONE_NUMBER [ TEXT ]
HIRE_DATE [ TEXT ]
JOB_ID [ TEXT ] employees.JOB_ID = jobs.JOB_ID
SALARY [ INT ]
COMMISSION_PCT [ INT ]
MANAGER_ID [ INT ]
DEPARTMENT_ID [ INT ] employees.DEPARTMENT_ID = departments.DEPARTMENT_ID

job_history :
EMPLOYEE_ID [ INT ] primary_key job_history.EMPLOYEE_ID = employees.EMPLOYEE_ID
START_DATE [ TEXT ]
END_DATE [ TEXT ]
JOB_ID [ TEXT ] job_history.JOB_ID = jobs.JOB_ID
DEPARTMENT_ID [ INT ] job_history.DEPARTMENT_ID = departments.DEPARTMENT_ID

locations :
LOCATION_ID [ INT ] primary_key
STREET_ADDRESS [ TEXT ]
POSTAL_CODE [ TEXT ]
CITY [ TEXT ]
STATE_PROVINCE [ TEXT ]
COUNTRY_ID [ TEXT ] locations.COUNTRY_ID = countries.COUNTRY_ID

Please write me a SQL statement that answers the following question: What are the emails of employees with null commission, salary between 7000 and 12000, and who work in department 50? [/INST]

Output: SELECT email FROM employees WHERE commission_pct  =  "null" AND salary BETWEEN 7000 AND 12000 AND department_id = 50;


Input:
[INST] Here is a database schema:
regions :
REGION_ID [ INT ] primary_key
REGION_NAME [ TEXT ]

countries :
COUNTRY_ID [ TEXT ] primary_key
COUNTRY_NAME [ TEXT ]
REGION_ID [ INT ] countries.REGION_ID = regions.REGION_ID

departments :
DEPARTMENT_ID [ INT ] primary_key
DEPARTMENT_NAME [ TEXT ]
MANAGER_ID [ INT ]
LOCATION_ID [ INT ]

jobs :
JOB_ID [ TEXT ] primary_key
JOB_TITLE [ TEXT ]
MIN_SALARY [ INT ]
MAX_SALARY [ INT ]

employees :
EMPLOYEE_ID [ INT ] primary_key
FIRST_NAME [ TEXT ]
LAST_NAME [ TEXT ]
EMAIL [ TEXT ]
PHONE_NUMBER [ TEXT ]
HIRE_DATE [ TEXT ]
JOB_ID [ TEXT ] employees.JOB_ID = jobs.JOB_ID
SALARY [ INT ]
COMMISSION_PCT [ INT ]
MANAGER_ID [ INT ]
DEPARTMENT_ID [ INT ] employees.DEPARTMENT_ID = departments.DEPARTMENT_ID

job_history :
EMPLOYEE_ID [ INT ] primary_key job_history.EMPLOYEE_ID = employees.EMPLOYEE_ID
START_DATE [ TEXT ]
END_DATE [ TEXT ]
JOB_ID [ TEXT ] job_history.JOB_ID = jobs.JOB_ID
DEPARTMENT_ID [ INT ] job_history.DEPARTMENT_ID = departments.DEPARTMENT_ID

locations :
LOCATION_ID [ INT ] primary_key
STREET_ADDRESS [ TEXT ]
POSTAL_CODE [ TEXT ]
CITY [ TEXT ]
STATE_PROVINCE [ TEXT ]
COUNTRY_ID [ TEXT ] locations.COUNTRY_ID = countries.COUNTRY_ID

Please write me a SQL statement that answers the following question: display the employee ID for each employee and the date on which he ended his previous job. [/INST]

Output: SELECT employee_id ,  MAX(end_date) FROM job_history GROUP BY employee_id;


Input:
[INST] Here is a database schema:
regions :
REGION_ID [ INT ] primary_key
REGION_NAME [ TEXT ]

countries :
COUNTRY_ID [ TEXT ] primary_key
COUNTRY_NAME [ TEXT ]
REGION_ID [ INT ] countries.REGION_ID = regions.REGION_ID

departments :
DEPARTMENT_ID [ INT ] primary_key
DEPARTMENT_NAME [ TEXT ]
MANAGER_ID [ INT ]
LOCATION_ID [ INT ]

jobs :
JOB_ID [ TEXT ] primary_key
JOB_TITLE [ TEXT ]
MIN_SALARY [ INT ]
MAX_SALARY [ INT ]

employees :
EMPLOYEE_ID [ INT ] primary_key
FIRST_NAME [ TEXT ]
LAST_NAME [ TEXT ]
EMAIL [ TEXT ]
PHONE_NUMBER [ TEXT ]
HIRE_DATE [ TEXT ]
JOB_ID [ TEXT ] employees.JOB_ID = jobs.JOB_ID
SALARY [ INT ]
COMMISSION_PCT [ INT ]
MANAGER_ID [ INT ]
DEPARTMENT_ID [ INT ] employees.DEPARTMENT_ID = departments.DEPARTMENT_ID

job_history :
EMPLOYEE_ID [ INT ] primary_key job_history.EMPLOYEE_ID = employees.EMPLOYEE_ID
START_DATE [ TEXT ]
END_DATE [ TEXT ]
JOB_ID [ TEXT ] job_history.JOB_ID = jobs.JOB_ID
DEPARTMENT_ID [ INT ] job_history.DEPARTMENT_ID = departments.DEPARTMENT_ID

locations :
LOCATION_ID [ INT ] primary_key
STREET_ADDRESS [ TEXT ]
POSTAL_CODE [ TEXT ]
CITY [ TEXT ]
STATE_PROVINCE [ TEXT ]
COUNTRY_ID [ TEXT ] locations.COUNTRY_ID = countries.COUNTRY_ID

Please write me a SQL statement that answers the following question: What are the employee ids for each employee and final dates of employment at their last job? [/INST]

Output: SELECT employee_id ,  MAX(end_date) FROM job_history GROUP BY employee_id;


Input:
[INST] Here is a database schema:
regions :
REGION_ID [ INT ] primary_key
REGION_NAME [ TEXT ]

countries :
COUNTRY_ID [ TEXT ] primary_key
COUNTRY_NAME [ TEXT ]
REGION_ID [ INT ] countries.REGION_ID = regions.REGION_ID

departments :
DEPARTMENT_ID [ INT ] primary_key
DEPARTMENT_NAME [ TEXT ]
MANAGER_ID [ INT ]
LOCATION_ID [ INT ]

jobs :
JOB_ID [ TEXT ] primary_key
JOB_TITLE [ TEXT ]
MIN_SALARY [ INT ]
MAX_SALARY [ INT ]

employees :
EMPLOYEE_ID [ INT ] primary_key
FIRST_NAME [ TEXT ]
LAST_NAME [ TEXT ]
EMAIL [ TEXT ]
PHONE_NUMBER [ TEXT ]
HIRE_DATE [ TEXT ]
JOB_ID [ TEXT ] employees.JOB_ID = jobs.JOB_ID
SALARY [ INT ]
COMMISSION_PCT [ INT ]
MANAGER_ID [ INT ]
DEPARTMENT_ID [ INT ] employees.DEPARTMENT_ID = departments.DEPARTMENT_ID

job_history :
EMPLOYEE_ID [ INT ] primary_key job_history.EMPLOYEE_ID = employees.EMPLOYEE_ID
START_DATE [ TEXT ]
END_DATE [ TEXT ]
JOB_ID [ TEXT ] job_history.JOB_ID = jobs.JOB_ID
DEPARTMENT_ID [ INT ] job_history.DEPARTMENT_ID = departments.DEPARTMENT_ID

locations :
LOCATION_ID [ INT ] primary_key
STREET_ADDRESS [ TEXT ]
POSTAL_CODE [ TEXT ]
CITY [ TEXT ]
STATE_PROVINCE [ TEXT ]
COUNTRY_ID [ TEXT ] locations.COUNTRY_ID = countries.COUNTRY_ID

Please write me a SQL statement that answers the following question: display those departments where more than ten employees work who got a commission percentage. [/INST]

Output: SELECT department_id FROM employees GROUP BY department_id HAVING COUNT(commission_pct) > 10;


Input:
[INST] Here is a database schema:
regions :
REGION_ID [ INT ] primary_key
REGION_NAME [ TEXT ]

countries :
COUNTRY_ID [ TEXT ] primary_key
COUNTRY_NAME [ TEXT ]
REGION_ID [ INT ] countries.REGION_ID = regions.REGION_ID

departments :
DEPARTMENT_ID [ INT ] primary_key
DEPARTMENT_NAME [ TEXT ]
MANAGER_ID [ INT ]
LOCATION_ID [ INT ]

jobs :
JOB_ID [ TEXT ] primary_key
JOB_TITLE [ TEXT ]
MIN_SALARY [ INT ]
MAX_SALARY [ INT ]

employees :
EMPLOYEE_ID [ INT ] primary_key
FIRST_NAME [ TEXT ]
LAST_NAME [ TEXT ]
EMAIL [ TEXT ]
PHONE_NUMBER [ TEXT ]
HIRE_DATE [ TEXT ]
JOB_ID [ TEXT ] employees.JOB_ID = jobs.JOB_ID
SALARY [ INT ]
COMMISSION_PCT [ INT ]
MANAGER_ID [ INT ]
DEPARTMENT_ID [ INT ] employees.DEPARTMENT_ID = departments.DEPARTMENT_ID

job_history :
EMPLOYEE_ID [ INT ] primary_key job_history.EMPLOYEE_ID = employees.EMPLOYEE_ID
START_DATE [ TEXT ]
END_DATE [ TEXT ]
JOB_ID [ TEXT ] job_history.JOB_ID = jobs.JOB_ID
DEPARTMENT_ID [ INT ] job_history.DEPARTMENT_ID = departments.DEPARTMENT_ID

locations :
LOCATION_ID [ INT ] primary_key
STREET_ADDRESS [ TEXT ]
POSTAL_CODE [ TEXT ]
CITY [ TEXT ]
STATE_PROVINCE [ TEXT ]
COUNTRY_ID [ TEXT ] locations.COUNTRY_ID = countries.COUNTRY_ID

Please write me a SQL statement that answers the following question: What are the department ids for which more than 10 employees had a commission? [/INST]

Output: SELECT department_id FROM employees GROUP BY department_id HAVING COUNT(commission_pct) > 10;


Input:
[INST] Here is a database schema:
regions :
REGION_ID [ INT ] primary_key
REGION_NAME [ TEXT ]

countries :
COUNTRY_ID [ TEXT ] primary_key
COUNTRY_NAME [ TEXT ]
REGION_ID [ INT ] countries.REGION_ID = regions.REGION_ID

departments :
DEPARTMENT_ID [ INT ] primary_key
DEPARTMENT_NAME [ TEXT ]
MANAGER_ID [ INT ]
LOCATION_ID [ INT ]

jobs :
JOB_ID [ TEXT ] primary_key
JOB_TITLE [ TEXT ]
MIN_SALARY [ INT ]
MAX_SALARY [ INT ]

employees :
EMPLOYEE_ID [ INT ] primary_key
FIRST_NAME [ TEXT ]
LAST_NAME [ TEXT ]
EMAIL [ TEXT ]
PHONE_NUMBER [ TEXT ]
HIRE_DATE [ TEXT ]
JOB_ID [ TEXT ] employees.JOB_ID = jobs.JOB_ID
SALARY [ INT ]
COMMISSION_PCT [ INT ]
MANAGER_ID [ INT ]
DEPARTMENT_ID [ INT ] employees.DEPARTMENT_ID = departments.DEPARTMENT_ID

job_history :
EMPLOYEE_ID [ INT ] primary_key job_history.EMPLOYEE_ID = employees.EMPLOYEE_ID
START_DATE [ TEXT ]
END_DATE [ TEXT ]
JOB_ID [ TEXT ] job_history.JOB_ID = jobs.JOB_ID
DEPARTMENT_ID [ INT ] job_history.DEPARTMENT_ID = departments.DEPARTMENT_ID

locations :
LOCATION_ID [ INT ] primary_key
STREET_ADDRESS [ TEXT ]
POSTAL_CODE [ TEXT ]
CITY [ TEXT ]
STATE_PROVINCE [ TEXT ]
COUNTRY_ID [ TEXT ] locations.COUNTRY_ID = countries.COUNTRY_ID

Please write me a SQL statement that answers the following question: Find the ids of the departments where any manager is managing 4 or more employees. [/INST]

Output: SELECT DISTINCT department_id FROM employees GROUP BY department_id ,  manager_id HAVING COUNT(employee_id)  >= 4;


Input:
[INST] Here is a database schema:
regions :
REGION_ID [ INT ] primary_key
REGION_NAME [ TEXT ]

countries :
COUNTRY_ID [ TEXT ] primary_key
COUNTRY_NAME [ TEXT ]
REGION_ID [ INT ] countries.REGION_ID = regions.REGION_ID

departments :
DEPARTMENT_ID [ INT ] primary_key
DEPARTMENT_NAME [ TEXT ]
MANAGER_ID [ INT ]
LOCATION_ID [ INT ]

jobs :
JOB_ID [ TEXT ] primary_key
JOB_TITLE [ TEXT ]
MIN_SALARY [ INT ]
MAX_SALARY [ INT ]

employees :
EMPLOYEE_ID [ INT ] primary_key
FIRST_NAME [ TEXT ]
LAST_NAME [ TEXT ]
EMAIL [ TEXT ]
PHONE_NUMBER [ TEXT ]
HIRE_DATE [ TEXT ]
JOB_ID [ TEXT ] employees.JOB_ID = jobs.JOB_ID
SALARY [ INT ]
COMMISSION_PCT [ INT ]
MANAGER_ID [ INT ]
DEPARTMENT_ID [ INT ] employees.DEPARTMENT_ID = departments.DEPARTMENT_ID

job_history :
EMPLOYEE_ID [ INT ] primary_key job_history.EMPLOYEE_ID = employees.EMPLOYEE_ID
START_DATE [ TEXT ]
END_DATE [ TEXT ]
JOB_ID [ TEXT ] job_history.JOB_ID = jobs.JOB_ID
DEPARTMENT_ID [ INT ] job_history.DEPARTMENT_ID = departments.DEPARTMENT_ID

locations :
LOCATION_ID [ INT ] primary_key
STREET_ADDRESS [ TEXT ]
POSTAL_CODE [ TEXT ]
CITY [ TEXT ]
STATE_PROVINCE [ TEXT ]
COUNTRY_ID [ TEXT ] locations.COUNTRY_ID = countries.COUNTRY_ID

Please write me a SQL statement that answers the following question: What are department ids for departments with managers managing more than 3 employees? [/INST]

Output: SELECT DISTINCT department_id FROM employees GROUP BY department_id ,  manager_id HAVING COUNT(employee_id)  >= 4;


Input:
[INST] Here is a database schema:
regions :
REGION_ID [ INT ] primary_key
REGION_NAME [ TEXT ]

countries :
COUNTRY_ID [ TEXT ] primary_key
COUNTRY_NAME [ TEXT ]
REGION_ID [ INT ] countries.REGION_ID = regions.REGION_ID

departments :
DEPARTMENT_ID [ INT ] primary_key
DEPARTMENT_NAME [ TEXT ]
MANAGER_ID [ INT ]
LOCATION_ID [ INT ]

jobs :
JOB_ID [ TEXT ] primary_key
JOB_TITLE [ TEXT ]
MIN_SALARY [ INT ]
MAX_SALARY [ INT ]

employees :
EMPLOYEE_ID [ INT ] primary_key
FIRST_NAME [ TEXT ]
LAST_NAME [ TEXT ]
EMAIL [ TEXT ]
PHONE_NUMBER [ TEXT ]
HIRE_DATE [ TEXT ]
JOB_ID [ TEXT ] employees.JOB_ID = jobs.JOB_ID
SALARY [ INT ]
COMMISSION_PCT [ INT ]
MANAGER_ID [ INT ]
DEPARTMENT_ID [ INT ] employees.DEPARTMENT_ID = departments.DEPARTMENT_ID

job_history :
EMPLOYEE_ID [ INT ] primary_key job_history.EMPLOYEE_ID = employees.EMPLOYEE_ID
START_DATE [ TEXT ]
END_DATE [ TEXT ]
JOB_ID [ TEXT ] job_history.JOB_ID = jobs.JOB_ID
DEPARTMENT_ID [ INT ] job_history.DEPARTMENT_ID = departments.DEPARTMENT_ID

locations :
LOCATION_ID [ INT ] primary_key
STREET_ADDRESS [ TEXT ]
POSTAL_CODE [ TEXT ]
CITY [ TEXT ]
STATE_PROVINCE [ TEXT ]
COUNTRY_ID [ TEXT ] locations.COUNTRY_ID = countries.COUNTRY_ID

Please write me a SQL statement that answers the following question: display the average salary of employees for each department who gets a commission percentage. [/INST]

Output: SELECT department_id ,  AVG(salary) FROM employees WHERE commission_pct != "null" GROUP BY department_id;


Input:
[INST] Here is a database schema:
regions :
REGION_ID [ INT ] primary_key
REGION_NAME [ TEXT ]

countries :
COUNTRY_ID [ TEXT ] primary_key
COUNTRY_NAME [ TEXT ]
REGION_ID [ INT ] countries.REGION_ID = regions.REGION_ID

departments :
DEPARTMENT_ID [ INT ] primary_key
DEPARTMENT_NAME [ TEXT ]
MANAGER_ID [ INT ]
LOCATION_ID [ INT ]

jobs :
JOB_ID [ TEXT ] primary_key
JOB_TITLE [ TEXT ]
MIN_SALARY [ INT ]
MAX_SALARY [ INT ]

employees :
EMPLOYEE_ID [ INT ] primary_key
FIRST_NAME [ TEXT ]
LAST_NAME [ TEXT ]
EMAIL [ TEXT ]
PHONE_NUMBER [ TEXT ]
HIRE_DATE [ TEXT ]
JOB_ID [ TEXT ] employees.JOB_ID = jobs.JOB_ID
SALARY [ INT ]
COMMISSION_PCT [ INT ]
MANAGER_ID [ INT ]
DEPARTMENT_ID [ INT ] employees.DEPARTMENT_ID = departments.DEPARTMENT_ID

job_history :
EMPLOYEE_ID [ INT ] primary_key job_history.EMPLOYEE_ID = employees.EMPLOYEE_ID
START_DATE [ TEXT ]
END_DATE [ TEXT ]
JOB_ID [ TEXT ] job_history.JOB_ID = jobs.JOB_ID
DEPARTMENT_ID [ INT ] job_history.DEPARTMENT_ID = departments.DEPARTMENT_ID

locations :
LOCATION_ID [ INT ] primary_key
STREET_ADDRESS [ TEXT ]
POSTAL_CODE [ TEXT ]
CITY [ TEXT ]
STATE_PROVINCE [ TEXT ]
COUNTRY_ID [ TEXT ] locations.COUNTRY_ID = countries.COUNTRY_ID

Please write me a SQL statement that answers the following question: What is the average salary of employees who have a commission percentage that is not null? [/INST]

Output: SELECT department_id ,  AVG(salary) FROM employees WHERE commission_pct != "null" GROUP BY department_id;


Input:
[INST] Here is a database schema:
regions :
REGION_ID [ INT ] primary_key
REGION_NAME [ TEXT ]

countries :
COUNTRY_ID [ TEXT ] primary_key
COUNTRY_NAME [ TEXT ]
REGION_ID [ INT ] countries.REGION_ID = regions.REGION_ID

departments :
DEPARTMENT_ID [ INT ] primary_key
DEPARTMENT_NAME [ TEXT ]
MANAGER_ID [ INT ]
LOCATION_ID [ INT ]

jobs :
JOB_ID [ TEXT ] primary_key
JOB_TITLE [ TEXT ]
MIN_SALARY [ INT ]
MAX_SALARY [ INT ]

employees :
EMPLOYEE_ID [ INT ] primary_key
FIRST_NAME [ TEXT ]
LAST_NAME [ TEXT ]
EMAIL [ TEXT ]
PHONE_NUMBER [ TEXT ]
HIRE_DATE [ TEXT ]
JOB_ID [ TEXT ] employees.JOB_ID = jobs.JOB_ID
SALARY [ INT ]
COMMISSION_PCT [ INT ]
MANAGER_ID [ INT ]
DEPARTMENT_ID [ INT ] employees.DEPARTMENT_ID = departments.DEPARTMENT_ID

job_history :
EMPLOYEE_ID [ INT ] primary_key job_history.EMPLOYEE_ID = employees.EMPLOYEE_ID
START_DATE [ TEXT ]
END_DATE [ TEXT ]
JOB_ID [ TEXT ] job_history.JOB_ID = jobs.JOB_ID
DEPARTMENT_ID [ INT ] job_history.DEPARTMENT_ID = departments.DEPARTMENT_ID

locations :
LOCATION_ID [ INT ] primary_key
STREET_ADDRESS [ TEXT ]
POSTAL_CODE [ TEXT ]
CITY [ TEXT ]
STATE_PROVINCE [ TEXT ]
COUNTRY_ID [ TEXT ] locations.COUNTRY_ID = countries.COUNTRY_ID

Please write me a SQL statement that answers the following question: display the country ID and number of cities for each country. [/INST]

Output: SELECT country_id ,  COUNT(*) FROM locations GROUP BY country_id;


Input:
[INST] Here is a database schema:
regions :
REGION_ID [ INT ] primary_key
REGION_NAME [ TEXT ]

countries :
COUNTRY_ID [ TEXT ] primary_key
COUNTRY_NAME [ TEXT ]
REGION_ID [ INT ] countries.REGION_ID = regions.REGION_ID

departments :
DEPARTMENT_ID [ INT ] primary_key
DEPARTMENT_NAME [ TEXT ]
MANAGER_ID [ INT ]
LOCATION_ID [ INT ]

jobs :
JOB_ID [ TEXT ] primary_key
JOB_TITLE [ TEXT ]
MIN_SALARY [ INT ]
MAX_SALARY [ INT ]

employees :
EMPLOYEE_ID [ INT ] primary_key
FIRST_NAME [ TEXT ]
LAST_NAME [ TEXT ]
EMAIL [ TEXT ]
PHONE_NUMBER [ TEXT ]
HIRE_DATE [ TEXT ]
JOB_ID [ TEXT ] employees.JOB_ID = jobs.JOB_ID
SALARY [ INT ]
COMMISSION_PCT [ INT ]
MANAGER_ID [ INT ]
DEPARTMENT_ID [ INT ] employees.DEPARTMENT_ID = departments.DEPARTMENT_ID

job_history :
EMPLOYEE_ID [ INT ] primary_key job_history.EMPLOYEE_ID = employees.EMPLOYEE_ID
START_DATE [ TEXT ]
END_DATE [ TEXT ]
JOB_ID [ TEXT ] job_history.JOB_ID = jobs.JOB_ID
DEPARTMENT_ID [ INT ] job_history.DEPARTMENT_ID = departments.DEPARTMENT_ID

locations :
LOCATION_ID [ INT ] primary_key
STREET_ADDRESS [ TEXT ]
POSTAL_CODE [ TEXT ]
CITY [ TEXT ]
STATE_PROVINCE [ TEXT ]
COUNTRY_ID [ TEXT ] locations.COUNTRY_ID = countries.COUNTRY_ID

Please write me a SQL statement that answers the following question: Give the country id and corresponding count of cities in each country. [/INST]

Output: SELECT country_id ,  COUNT(*) FROM locations GROUP BY country_id;


Input:
[INST] Here is a database schema:
regions :
REGION_ID [ INT ] primary_key
REGION_NAME [ TEXT ]

countries :
COUNTRY_ID [ TEXT ] primary_key
COUNTRY_NAME [ TEXT ]
REGION_ID [ INT ] countries.REGION_ID = regions.REGION_ID

departments :
DEPARTMENT_ID [ INT ] primary_key
DEPARTMENT_NAME [ TEXT ]
MANAGER_ID [ INT ]
LOCATION_ID [ INT ]

jobs :
JOB_ID [ TEXT ] primary_key
JOB_TITLE [ TEXT ]
MIN_SALARY [ INT ]
MAX_SALARY [ INT ]

employees :
EMPLOYEE_ID [ INT ] primary_key
FIRST_NAME [ TEXT ]
LAST_NAME [ TEXT ]
EMAIL [ TEXT ]
PHONE_NUMBER [ TEXT ]
HIRE_DATE [ TEXT ]
JOB_ID [ TEXT ] employees.JOB_ID = jobs.JOB_ID
SALARY [ INT ]
COMMISSION_PCT [ INT ]
MANAGER_ID [ INT ]
DEPARTMENT_ID [ INT ] employees.DEPARTMENT_ID = departments.DEPARTMENT_ID

job_history :
EMPLOYEE_ID [ INT ] primary_key job_history.EMPLOYEE_ID = employees.EMPLOYEE_ID
START_DATE [ TEXT ]
END_DATE [ TEXT ]
JOB_ID [ TEXT ] job_history.JOB_ID = jobs.JOB_ID
DEPARTMENT_ID [ INT ] job_history.DEPARTMENT_ID = departments.DEPARTMENT_ID

locations :
LOCATION_ID [ INT ] primary_key
STREET_ADDRESS [ TEXT ]
POSTAL_CODE [ TEXT ]
CITY [ TEXT ]
STATE_PROVINCE [ TEXT ]
COUNTRY_ID [ TEXT ] locations.COUNTRY_ID = countries.COUNTRY_ID

Please write me a SQL statement that answers the following question: display job ID for those jobs that were done by two or more for more than 300 days. [/INST]

Output: SELECT job_id FROM job_history WHERE end_date - start_date  > 300 GROUP BY job_id HAVING COUNT(*) >= 2;