w3resource
SQL exercises

SQL SORTING and FILTERING on HR Database: Display the first and last name, and department number for all employees whose last name is "McEwen"

SQL SORTING and FILTERING on HR Database: Exercise-3 with Solution

3. Write a query in SQL to display the first and last name, and department number for all employees whose last name is "McEwen".

Sample table: employees


Sample Solution:

SELECT first_name, last_name, department_id
 FROM employees
  WHERE last_name = 'McEwen';

Sample Output:

 first_name | last_name | department_id
------------+-----------+---------------
 Allan      | McEwen    |            80
(1 row)

Practice Online


HR database model

Query Visualization:

Duration:

Query visualization of Display the first and last name, and department number for all employees whose last name is

Rows:

Query visualization of Display the first and last name, and department number for all employees whose last name is

Cost:

Query visualization of Display the first and last name, and department number for all employees whose last name is

Contribute your code and comments through Disqus.

Previous: Write a query in SQL to display the first and last_name, department number and salary for those employees who earn more than 8000.
Next: Write a query in SQL to display all the information for all employees without any department number.

What is the difficulty level of this exercise?



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