Filtering Data in SQL
18. WHERE: Filter Rows Based On Specified Conditions
SELECT * FROM employees
WHERE department = 'IT';
This query will retrieve all employees who work in the IT department.
19. LIKE: Match A Pattern In A Column
SELECT * FROM employees
WHERE first_name LIKE 'J%';
This query will retrieve all employees whose first name starts with ‘J’.
20. IN: Match Any Value In A List
SELECT * FROM employees
WHERE department IN ('HR', 'Finance');
This query will retrieve all employees who work in the HR or Finance departments.
21. BETWEEN: Match Values Within A Specified Range
SELECT * FROM employees
WHERE salary BETWEEN 50000 AND 60000;
This query will retrieve all employees whose salary is between 50000 and 60000.
22. IS NULL: Match NULL Values
SELECT * FROM employees
WHERE department IS NULL;
This query will retrieve all employees where the department is not assigned (NULL).
23. ORDER BY: Sort The Result Set
SELECT * FROM employees
ORDER BY salary DESC;
This query will retrieve all employees sorted by salary in descending order.
SQL Cheat Sheet
In this article, we will explore the ultimate SQL cheat sheet with the PDF, covering a wide range of SQL commands, Joins in SQL, CRUD Operations, SQL Trigger, SQL Transactions, and advanced topics to help master SQL effectively.
SQL (Structured Query Language) is a Query language used for managing and manipulating relational databases databases. It allows users to interact with databases. SQL allows users to perform various tasks such as querying data, updating data, inserting new records, deleting records, creating and modifying database schemas, and managing permissions.
Table of Content
- Create a Database in SQL
- Creating Data in SQL
- Reading/Querying Data in SQL
- Updating/Manipulating Data in SQL
- Deleting Data in SQL
- Filtering Data in SQL
- SQL Operator
- Aggregation Data in SQL
- Constraints in SQL
- Joins in SQL
- SQL Functions
- Subqueries in SQL
- Views in SQL
- Indexes in SQL
- Transactions in SQL
- Advanced Mixed Data in SQL
- SQL Cheat Sheet PDF