0% found this document useful (0 votes)
3 views3 pages

SQL_Beginner_CheatSheet

This document is a beginner cheat sheet for SQL focusing on core functions, aggregation functions, joining tables, and other useful keywords. It provides examples for each SQL command, including SELECT, WHERE, JOIN types, and aggregation functions like COUNT and SUM. The cheat sheet serves as a quick reference for essential SQL operations in data analytics.

Uploaded by

motadoremon
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
3 views3 pages

SQL_Beginner_CheatSheet

This document is a beginner cheat sheet for SQL focusing on core functions, aggregation functions, joining tables, and other useful keywords. It provides examples for each SQL command, including SELECT, WHERE, JOIN types, and aggregation functions like COUNT and SUM. The cheat sheet serves as a quick reference for essential SQL operations in data analytics.

Uploaded by

motadoremon
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 3

SQL for Data Analytics - Beginner Cheat Sheet

Core SQL Functions (Select & Filter)

1. SELECT - Choose the columns you want to see.


Example: SELECT name FROM students;

2. FROM - Choose the table to take data from.


Example: SELECT * FROM students;

3. WHERE - Filter the rows based on a condition.


Example: SELECT * FROM students WHERE age > 21;

4. AND - Combine multiple conditions.


Example: WHERE age > 21 AND city = 'Delhi'

5. OR - At least one of the conditions must match.


Example: WHERE age = 22 OR city = 'Kolkata'

6. ORDER BY - Sort the result.


Example: ORDER BY age DESC

7. LIMIT - Limit how many rows are shown.


Example: LIMIT 5

8. AS - Rename a column temporarily.


Example: SELECT name AS student_name

9. DISTINCT - Show only unique values.


Example: SELECT DISTINCT city FROM students

10. IN - Match values from a list.


Example: WHERE city IN ('Delhi', 'Mumbai')

Aggregation Functions (Summarizing Data)

1. COUNT() - Count the number of rows.


Example: SELECT COUNT(*) FROM students;

2. SUM() - Add all the values.


SQL for Data Analytics - Beginner Cheat Sheet

Example: SELECT SUM(salary) FROM employees;

3. AVG() - Find the average value.


Example: SELECT AVG(age) FROM students;

4. MAX() - Highest value.


Example: SELECT MAX(age) FROM students;

5. MIN() - Lowest value.


Example: SELECT MIN(age) FROM students;

6. GROUP BY - Group rows before using functions.


Example: GROUP BY city

7. HAVING - Filter grouped results.


Example: HAVING COUNT(*) > 2

Joining Tables (Combining Data)

1. INNER JOIN - Get only matching rows from both tables.

2. LEFT JOIN - All rows from the left + matching ones from the right.

3. RIGHT JOIN - All rows from the right + matching ones from the left.

4. FULL JOIN - All rows from both tables.

Other Useful SQL Keywords

1. LIKE - Search for patterns.


Example: WHERE name LIKE 'A%'

2. BETWEEN - Filter values in a range.


Example: WHERE age BETWEEN 20 AND 25

3. IS NULL / IS NOT NULL - Check if data is missing.


SQL for Data Analytics - Beginner Cheat Sheet

4. CASE - If-else logic inside SQL.

You might also like