w3resource
SQL exercises

SQL Exercises: Display all the data of employees including their department

SQL JOINS: Exercise-26 with Solution

Write a query in SQL to display all the data of employees including their department.

Sample table:emp_department


Sample table: emp_details


Sample Solution:

SELECT emp_idno, A.emp_fname AS "First Name", emp_lname AS "Last Name",
    B.dpt_name AS "Department", emp_dept, dpt_code,  dpt_allotment
     FROM emp_details A 
      INNER JOIN emp_department B
        ON A.emp_dept = B.dpt_code;

Output:

Display all the data of employees including their department

Query Visualization:

Duration:

Query visualization of Display all the data of employees including their department - Duration

Rows:

Query visualization of Display all the data of employees including their department - Rows

Cost:

Query visualization of Display all the data of employees including their department - Cost

Practice Online


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

Previous: Write a SQL query to display the name of each company along with the ID and price for their most expensive product.
Next: 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.

What is the difficulty level of this exercise?



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