Chemically-motivated/SQL_Generation
1
1-- Create the 'employees' table with appropriate data types2CREATE TABLE employees (3 employee_id INT PRIMARY KEY,4 first_name VARCHAR(20),5 last_name VARCHAR(25),6 email VARCHAR(25),7 phone_number VARCHAR(20),8 hire_date DATE,9 job_id VARCHAR(10),10 salary DECIMAL(8,2),11 commission_pct DECIMAL(2,2),12 manager_id INT,13 department_id INT14);15 16-- Create the 'job_history' table with appropriate data types17CREATE TABLE job_history (18 employee_id INT,19 start_date DATE,20 end_date DATE,21 job_id VARCHAR(10),22 department_id INT,23 PRIMARY KEY (employee_id, start_date)24);25 26-- Query to find employees without any job history and count occurrences of each job_id27SELECT e.job_id, COUNT(e.job_id) AS job_count28FROM employees e29LEFT JOIN job_history jh ON e.employee_id = jh.employee_id30WHERE jh.job_id IS NULL31GROUP BY e.job_id32ORDER BY e.job_id;33 