SQL basic -> Query with user defined parameters

Select 3 top paid employees above the level defined by user:

/* MS-Access query */
PARAMETERS [set salary level] DOUBLE;
SELECT TOP 3 [EmpNo], [FirstName], [LastName], [Salary]
FROM Employees
WHERE Salary > [set salary level]
ORDER BY [Salary] DESC;

/* TSQL does not support Parameters as is, but general logics can looks as following: */
DECLARE @level FLOAT;
SET @level = 105000;

SELECT TOP 3 [EmpNo], [FirstName], [LastName], [Salary]
FROM Employees
WHERE Salary > @level
ORDER BY [Salary] DESC;



sqlexamples.info