w3resource
SQL exercises

SQL Subquery Exercises: Display all the information of the employees whose salary if within the range of smallest salary and 2500

SQL SUBQUERY: Exercise-10 with Solution

Write a query to display all the information of the employees whose salary if within the range of smallest salary and 2500.

Sample table: employees


Sample Solution:

SELECT * 
FROM employees 
WHERE salary BETWEEN  
(SELECT MIN(salary) 
FROM employees) AND 2500;

Sample Output:

employee_id	first_name	last_name	email	phone_number	hire_date	job_id	salary	commission_pct	manager_id	department_id
119		Karen		Colmenares	KCOLMENA515.127.4566	2007-08-10	PU_CLERK	2500.00	0.00	114		30
127		James		Landry		JLANDRY	650.124.1334	2007-01-14	ST_CLERK	2400.00	0.00	120		50
128		Steven		Markle		SMARKLE	650.124.1434	2008-03-08	ST_CLERK	2200.00	0.00	120		50
131		James		Marlow		JAMRLOW	650.124.7234	2005-02-16	ST_CLERK	2500.00	0.00	121		50
132		TJ		Olson		TJOLSON	650.124.8234	2007-04-10	ST_CLERK	2100.00	0.00	121		50
135		Ki		Gee		KGEE	650.127.1734	2007-12-12	ST_CLERK	2400.00	0.00	122		50
136		Hazel		Philtanker	HPHILTAN650.127.1634	2008-02-06	ST_CLERK	2200.00	0.00	122		50
140		Joshua		Patel		JPATEL	650.121.1834	2006-04-06	ST_CLERK	2500.00	0.00	123		50
144		Peter		Vargas		PVARGAS	650.121.2004	2006-07-09	ST_CLERK	2500.00	0.00	124		50
182		Martha		Sullivan	MSULLIVA650.507.9878	2007-06-21	SH_CLERK	2500.00	0.00	120		50
191		Randall		Perkins		RPERKINS650.505.4876	2007-12-19	SH_CLERK	2500.00	0.00	122		50

Practice Online


Query Visualization:

Duration:

Query visualization of Display all the information of the employees whose salary if within the range of smallest salary and 2500 - Duration

Rows:

Query visualization of Display all the information of the employees whose salary if within the range of smallest salary and 2500 - Rows

Cost:

Query visualization of Display all the information of the employees whose salary if within the range of smallest salary and 2500 - Cost

Contribute your code and comments through Disqus.

Previous: Write a query to display all the information of the employees whose salary is within the range 1000 and 3000.
Next: Write a query to display all the information of the employees who does not work in those departments where some employees works whose manager id within the range 100 and 200.

What is the difficulty level of this exercise?



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