w3resource
SQL exercises

SQL Subquery Exercises: Display the first name and last name of employees working for the department which allotment amount is more than Rs.50000

SQL SUBQUERY: Exercise-36 with Solution

36. Write a query in SQL to display the first name and last name of employees working for the department which allotment amount is more than Rs.50000.

Sample table: emp_department


Sample table: emp_details


Sample Solution:

SELECT emp_fname, emp_lname 
 FROM emp_details
  WHERE emp_dept IN
  (SELECT dpt_code 
     FROM emp_department 
       WHERE dpt_allotment > 50000);

Output:

SQL Subqueries: Display the first name and last name of employees working for the department which allotment amount is more than Rs.50000

Practice Online


Sample Database:

Model Database

Query Visualization:

Duration:

Query visualization of Display the first name and last name of employees working for the department which allotment amount is more than Rs.50000 - Duration

Rows:

Query visualization of Display the first name and last name of employees working for the department which allotment amount is more than Rs.50000 - Rows

Cost:

Query visualization of Display the first name and last name of employees working for the department which allotment amount is more than Rs.50000 - Cost

Contribute your code and comments through Disqus.

Previous: Write a query in SQL to display all the details of employees who works in department 89 or 63.
Next: Write a query in SQL to find the departments which sanction amount is larger than the average sanction amount of all the departments.

What is the difficulty level of this exercise?



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