CREATE TABLE regions (
    REGION_ID NUMBER PRIMARY KEY,
    REGION_NAME TEXT
);
CREATE TABLE countries (
    COUNTRY_ID TEXT PRIMARY KEY,
    COUNTRY_NAME TEXT,
    REGION_ID NUMBER,
    FOREIGN KEY ("REGION_ID") REFERENCES regions("REGION_ID")
);
CREATE TABLE departments (
    DEPARTMENT_ID NUMBER PRIMARY KEY,
    DEPARTMENT_NAME TEXT,
    MANAGER_ID NUMBER,
    LOCATION_ID NUMBER
);
CREATE TABLE jobs (
    JOB_ID TEXT PRIMARY KEY,
    JOB_TITLE TEXT,
    MIN_SALARY NUMBER,
    MAX_SALARY NUMBER
);
CREATE TABLE employees (
    EMPLOYEE_ID NUMBER PRIMARY KEY,
    FIRST_NAME TEXT,
    LAST_NAME TEXT,
    EMAIL TEXT,
    PHONE_NUMBER TEXT,
    HIRE_DATE TIME,
    JOB_ID TEXT,
    SALARY NUMBER,
    COMMISSION_PCT NUMBER,
    MANAGER_ID NUMBER,
    DEPARTMENT_ID NUMBER,
    FOREIGN KEY ("JOB_ID") REFERENCES jobs("JOB_ID"),
    FOREIGN KEY ("DEPARTMENT_ID") REFERENCES departments("DEPARTMENT_ID")
);
CREATE TABLE job_history (
    EMPLOYEE_ID NUMBER PRIMARY KEY,
    START_DATE TIME,
    END_DATE TIME,
    JOB_ID TEXT,
    DEPARTMENT_ID NUMBER,
    FOREIGN KEY ("JOB_ID") REFERENCES jobs("JOB_ID"),
    FOREIGN KEY ("DEPARTMENT_ID") REFERENCES departments("DEPARTMENT_ID"),
    FOREIGN KEY ("EMPLOYEE_ID") REFERENCES employees("EMPLOYEE_ID")
);
CREATE TABLE locations (
    LOCATION_ID NUMBER PRIMARY KEY,
    STREET_ADDRESS TEXT,
    POSTAL_CODE TEXT,
    CITY TEXT,
    STATE_PROVINCE TEXT,
    COUNTRY_ID TEXT,
    FOREIGN KEY ("COUNTRY_ID") REFERENCES countries("COUNTRY_ID")
);

Question: Display the first name and department name for each employee.
SQL: SELECT T1.first_name ,  T2.department_name FROM employees AS T1 JOIN departments AS T2 ON T1.department_id  =  T2.department_id

Question: What are the first name and department name of all employees?
SQL: SELECT T1.first_name ,  T2.department_name FROM employees AS T1 JOIN departments AS T2 ON T1.department_id  =  T2.department_id

Question: List the full name (first and last name), and salary for those employees who earn below 6000.
SQL: SELECT first_name ,  last_name ,  salary FROM employees WHERE salary  <  6000

Question: What are the full names and salaries for any employees earning less than 6000?
SQL: SELECT first_name ,  last_name ,  salary FROM employees WHERE salary  <  6000

Question: Display the first name, and department number for all employees whose last name is "McEwen".
SQL: SELECT first_name ,  department_id FROM employees WHERE last_name  =  'McEwen'

Question: What are the first names and department numbers for employees with last name McEwen?
SQL: SELECT first_name ,  department_id FROM employees WHERE last_name  =  'McEwen'

Question: Return all the information for all employees without any department number.
SQL: SELECT * FROM employees WHERE department_id  =  "null"

Question: What are all the employees without a department number?
SQL: SELECT * FROM employees WHERE department_id  =  "null"

Question: Display all the information about the department Marketing.
SQL: SELECT * FROM  departments WHERE department_name  =  'Marketing'

Question: What is all the information about the Marketing department?
SQL: SELECT * FROM  departments WHERE department_name  =  'Marketing'

Question: when is the hire date for those employees whose first name does not containing the letter M?
SQL: SELECT hire_date FROM employees WHERE first_name NOT LIKE '%M%'

Question: On what dates were employees without the letter M in their first names hired?
SQL: SELECT hire_date FROM employees WHERE first_name NOT LIKE '%M%'

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.
SQL: SELECT first_name ,  last_name ,  hire_date ,  salary ,  department_id FROM employees WHERE first_name NOT LIKE '%M%'

Question: What are the full name, hire date, salary, and department id for employees without the letter M in their first name?
SQL: SELECT first_name ,  last_name ,  hire_date ,  salary ,  department_id FROM employees WHERE first_name NOT LIKE '%M%'

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.
SQL: SELECT first_name ,  last_name ,  hire_date ,  salary ,  department_id FROM employees WHERE first_name NOT LIKE '%M%' ORDER BY department_id

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?
SQL: SELECT first_name ,  last_name ,  hire_date ,  salary ,  department_id FROM employees WHERE first_name NOT LIKE '%M%' ORDER BY department_id

Question: what is the phone number of employees whose salary is in the range of 8000 and 12000?
SQL: SELECT phone_number FROM employees WHERE salary BETWEEN 8000 AND 12000

Question: Return the phone numbers of employees with salaries between 8000 and 12000.
SQL: SELECT phone_number FROM employees WHERE salary BETWEEN 8000 AND 12000

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.
SQL: SELECT * FROM employees WHERE salary BETWEEN 8000 AND 12000 AND commission_pct != "null" OR  department_id != 40

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.
SQL: SELECT * FROM employees WHERE salary BETWEEN 8000 AND 12000 AND commission_pct != "null" OR  department_id != 40

Question: What are the full name (first and last name) and salary for all employees who does not have any value for commission?
SQL: SELECT first_name ,  last_name ,  salary FROM  employees WHERE commission_pct  =  "null"

Question: Return the full names and salaries of employees with null commissions.
SQL: SELECT first_name ,  last_name ,  salary FROM  employees WHERE commission_pct  =  "null"

Question: Display the first and last name, and salary for those employees whose first name is ending with the letter m.
SQL: SELECT first_name ,  last_name ,  salary FROM employees WHERE first_name LIKE '%m'

Question: Return the full names and salaries for employees with first names that end with the letter m.
SQL: SELECT first_name ,  last_name ,  salary FROM employees WHERE first_name LIKE '%m'

Question: Find job id and date of hire for those employees who was hired between November 5th, 2007 and July 5th, 2009.
SQL: SELECT job_id ,  hire_date FROM employees WHERE hire_date BETWEEN '2007-11-05' AND '2009-07-05'

Question: What are the job ids and dates of hire for employees hired after November 5th, 2007 and before July 5th, 2009?
SQL: SELECT job_id ,  hire_date FROM employees WHERE hire_date BETWEEN '2007-11-05' AND '2009-07-05'

Question: What are the first and last name for those employees who works either in department 70 or 90?
SQL: SELECT first_name ,  last_name FROM employees WHERE department_id  =  70 OR department_id  =  90

Question: What are the full names of employees who with in department 70 or 90?
SQL: SELECT first_name ,  last_name FROM employees WHERE department_id  =  70 OR department_id  =  90

Question: Find the salary and manager number for those employees who is working under a manager.
SQL: SELECT salary ,  manager_id FROM employees WHERE manager_id != "null"

Question: What are the salaries and manager ids for employees who have managers?
SQL: SELECT salary ,  manager_id FROM employees WHERE manager_id != "null"

Question: display all the details from Employees table for those employees who was hired before 2002-06-21.
SQL: SELECT * FROM employees WHERE hire_date  <  '2002-06-21'

Question: What is all the information about employees hired before June 21, 2002?
SQL: SELECT * FROM employees WHERE hire_date  <  '2002-06-21'