Select Flashcards
(3 cards)
1
Q
List ways to get count or records in a table
A
SELECT * FROM table1
SELECT COUNT(*) FROM table1
SELECT rows FROM sysindexes WHERE id = OBJECT_ID(table1) AND indid < 2
2
Q
Write a query to find the names of employees that begin with ‘A’
A
SELECT * FROM Table_name WHERE EmpName like ‘A%’
3
Q
Write a query to get the third-highest salary of an employee from an employee table
A
SELECT TOP 1 salary FROM( SELECT TOP 3 salary FROM employee_table ORDER BY salary DESC) AS emp ORDER BY salary ASC;