Aggregation Data in SQL
Get an hands in aggregation data in SQL. Here you will find cheat sheet for how to count numbers, sum of numbers and more.
33. COUNT: Count The Number Of Rows In A Result Set
SELECT COUNT(*) FROM employees;
This query will count the total number of employees.
34. SUM: Calculate The Sum Of Values In A Column
SELECT SUM(salary) FROM employees;
This query will calculate the total salary of all employees.
35. AVG: Calculate The Average Value Of A Column
SELECT AVG(salary) FROM employees;
This query will calculate the average salary of all employees.
36. MIN: Find the Minimum Value in a Column
SELECT MIN(salary) FROM employees;
This query will find the minimum salary among all employees.
37. MAX: Find the Maximum Value in a Column
SELECT MAX(salary) FROM employees;
This query will find the maximum salary among all employees.
38. GROUP BY: Group Rows Based on a Specified Column
SELECT department, COUNT(*) AS employee_count
FROM employees
GROUP BY department;
This query will group employees by department and count the number of employees in each department.
39. HAVING: Filter Groups Based on Specified Conditions
SELECT department, AVG(salary) AS avg_salary
FROM employees
GROUP BY department
HAVING AVG(salary) > 55000;
This query will calculate the average salary for each department and return only those departments where the average salary is greater than 55000.
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
Contact Us