w3resource
SQL exercises

SQL Exercises: Find the first name and last name of employees working for departments with a budget more than Rs. 50000

SQL JOINS: Exercise-28 with Solution

Write a query in SQL to find the first name and last name of employees working for departments with a budget more than Rs.50000.

Sample table:emp_department


Sample table: emp_details


Sample Solution:

SELECT emp_details.emp_fname AS "First Name", emp_lname AS "Last Name"
  FROM emp_details 
    INNER JOIN emp_department
        ON emp_details.emp_dept = emp_department.dpt_code
    AND emp_department.dpt_allotment > 50000;

Output:

Find the first name of employees working for departments with a budget more than Rs. 50000

Query Visualization:

Duration:

Query visualization of Find the first name and last name of employees working for departments with a budget more than Rs. 50000 - Duration

Rows:

Query visualization of Find the first name and last name of employees working for departments with a budget more than Rs. 50000 - Rows

Cost:

Query visualization of Find the first name and last name of employees working for departments with a budget more than Rs. 50000 - Cost

Practice Online


Have another way to solve this solution? Contribute your code (and comments) through Disqus.

Previous: Write a query in SQL to display the first name and last name of each employee, along with the name and sacntion amount for their department.
Next: Write a query in SQL to find the names of departments where more than two employees are working.

What is the difficulty level of this exercise?



New Content: Composer: Dependency manager for PHP, R Programming