Jun 26, 2024
**DELETE: **
**TRUNCATE: **
SELECT GETDATE();
SELECT COUNT(*) FROM table_name;
SELECT rows FROM sysindexes WHERE id = OBJECT_ID('table_name') AND indid < 2;
SELECT * FROM employees WHERE name LIKE 'A%';
SELECT TOP 1 salary
FROM (
SELECT TOP 3 salary
FROM employee_table
ORDER BY salary DESC
) AS emp
ORDER BY salary ASC;
SELECT student_id FROM (SELECT ROW_NUMBER() OVER (ORDER BY roll_no) AS row_num, student_id FROM students) WHERE row_num % 2 = 0;
SELECT student_id FROM (SELECT ROW_NUMBER() OVER (ORDER BY roll_no) AS row_num, student_id FROM students) WHERE row_num % 2 = 1;
SELECT * FROM students WHERE name LIKE 'A%';
SELECT SUBSTRING(student_name, 1, 5) FROM students;