Get the App
SLTechnology News&Howtos  ›  Database  › 

Mysql column subquery

Shulou Source: shulou.com Published: 2022-06-01 22:33:16 10月03日 Update

# case: returns all employees in a department whose location_id is 1400 or 1700

SELECT last_nameFROM employees WHERE department_id IN (SELECT DISTINCT department_id FROM departments WHERE location_id IN (1400, 1700))

# case: returns the employee number, name, job_id and salary of employees in other jobs who are paid less than any of the employees in the job_id 'IT_PROG' department

SELECT DISTINCT employee_id,last_name,job_id,salaryFROM employeesWHERE salary

Tags: Employee case department name type of work salary medium ratio any one Liezi inquiry Apple Docker Huawei Linux macOS MariaDB Microsoft MySQL NVidia OPPO Reno Linux NVidia Shulou Information macOS MySQL