w3resource
SQL exercises

SQL SORTING and FILTERING on HR Database: Display all those employees whose first name or last name starts with the letter D

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

36. Write a query in SQL to display all those employees whose first name or last name starts with the letter D.

Sample table : employees


Sample Solution:

SELECT first_name, last_name 
	FROM employees 
		WHERE  first_name  LIKE 'D%' 
			OR last_name LIKE 'D%';

Sample Output:

 first_name | last_name
------------+-----------
 Lex        | De Haan
 David      | Austin
 Diana      | Lorentz
 Daniel     | Faviet
 Den        | Raphaely
 Curtis     | Davies
 David      | Bernstein
 Louise     | Doran
 Danielle   | Greene
 David      | Lee
 Julia      | Dellinger
 Jennifer   | Dilly
 Donald     | OConnell
 Douglas    | Grant
(14 rows)

Practice Online


HR database model

Query Visualization:

Duration:

Query visualization of Display all those employees whose first name or last name starts with the letter D - Duration

Rows:

Query visualization of Display all those employees whose first name or last name starts with the letter D - Rows

Cost:

Query visualization of Display all those employees whose first name or last name starts with the letter D - Cost

Contribute your code and comments through Disqus.

Previous: Write a query in SQL to display job Title, the difference between minimum and maximum salaries for those jobs which max salary within the range 12000 to 18000.
Next: Write a query in SQL to display the details of jobs which minimum salary is greater than 9000.

What is the difficulty level of this exercise?



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