Description | Query | |
---|---|---|
SQL WHERE Clause | Syntax |
SELECT column_list FROM table_name WHERE condition; SELECT * FROM table_name WHERE condition; |
SQL WHERE Clause | Filter Records with WHERE Clause |
SELECT * FROM employees WHERE salary > 7000; |
SQL AND & OR Operators | The AND Operator |
SELECT * FROM employees WHERE salary > 7000 AND dept_id = 5; |
SQL AND & OR Operators | The OR Operator |
SELECT * FROM employees WHERE salary > 7000 OR dept_id = 5; SELECT * FROM employees WHERE salary > 5000 AND (dept_id = 1 OR dept_id = 5); |
SQL IN & BETWEEN Operators | The IN Operator |
SELECT * FROM employees WHERE dept_id IN (1, 3); SELECT * FROM employees WHERE dept_id NOT IN (1, 3); |
SQL IN & BETWEEN Operators | The BETWEEN Operator |
SELECT * FROM employees WHERE salary BETWEEN 7000 AND 9000; SELECT * FROM employees WHERE hire_date BETWEEN CAST('2006-01-01' AS DATE) AND CAST('2016-12-31' AS DATE); SELECT * FROM employees WHERE emp_name BETWEEN 'O' AND 'Z'; |
SQL ORDER BY Clause | ORDER BY |
SELECT * FROM employees ORDER BY emp_name; SELECT * FROM trainees ORDER BY first_name, last_name; |
SQL TOP / MySQL LIMIT Clause | SQL TOP Syntax |
SELECT TOP 3 * FROM employees ORDER BY salary DESC; SELECT TOP 30 PERCENT * FROM employees ORDER BY salary DESC; |
SQL TOP / MySQL LIMIT Clause | SQL LIMIT Syntax |
SELECT * FROM employees ORDER BY salary DESC LIMIT 3; SELECT * FROM employees ORDER BY salary DESC LIMIT 2, 1; |
SQL DISTINCT Clause | SQL LIMIT Syntax |
SELECT DISTINCT column_list FROM table_name; SELECT DISTINCT city FROM customers; |
SQL TRUNCATE TABLE Statement | TRUNCATE TABLE statement drop and re-create the table in such a way that any auto-increment value is reset to its start value which is generally 1. |
TRUNCATE TABLE employees; |
Total : 26654
Today :3
Today Visit Country :