TGViewer
Data Analytics Data Analytics @sqlspecialist ยท 111K subscribers
Post #3144 3.69K
๐Ÿš€ SQL & Python Quick Cheatsheet for Beginners

๐Ÿ—„๏ธ SQL Programming

1. What is SQL?

SQL stands for Structured Query Language. It is used to communicate with databases and work with stored data.

You can use SQL to:

โœ… Retrieve data

โœ… Filter data

โœ… Analyze data

โœ… Insert data

โœ… Update data

โœ… Delete data

2. SELECT

Used to retrieve data from a table.

SELECT name, salary
FROM employees;


SELECT โ†’ columns you want

FROM โ†’ table you want data from

To get all columns:

SELECT *
FROM employees;


3. WHERE

Used to filter rows.

SELECT *
FROM employees
WHERE salary > 50000;


Common operators:

= Equal



Greater than

< Less than

= Greater than or equal

<= Less than or equal

<> Not equal



4. AND, OR, NOT

Used to combine conditions.

SELECT *
FROM employees
WHERE salary > 50000
AND department = 'IT';


AND โ†’ both conditions must be true.

SELECT *
FROM employees
WHERE department = 'IT'
OR department = 'HR';


OR โ†’ at least one condition must be true.

5. ORDER BY

Used to sort your results.

SELECT *
FROM employees
ORDER BY salary DESC;


ASC โ†’ Lowest to highest

DESC โ†’ Highest to lowest

6. DISTINCT

Used to remove duplicate values.

SELECT DISTINCT department
FROM employees;


7. LIMIT

Used to restrict the number of rows returned.

SELECT *
FROM employees
LIMIT 10;


Note: Some databases use TOP or FETCH.

8. Aggregate Functions

Used to perform calculations on multiple rows.

COUNT() -- Count

SUM() -- Total

AVG() -- Average

MIN() -- Minimum

MAX() -- Maximum

Example:

SELECT AVG(salary)
FROM employees;


9. GROUP BY

Used to create groups and calculate results for each group.

SELECT
department,
AVG(salary) AS average_salary
FROM employees
GROUP BY department;


10. HAVING

Used to filter grouped results.

SELECT
department,
AVG(salary) AS average_salary
FROM employees
GROUP BY department
HAVING AVG(salary) > 70000;


WHERE โ†’ filters rows

HAVING โ†’ filters groups

๐Ÿ Python โ€” Beginner Fundamentals

1. What is Python?

Python is a general-purpose programming language used for:

โœ… Data Analytics

โœ… Automation

โœ… AI & Machine Learning

โœ… Data Engineering

โœ… Web Development

2. Variables

Variables store values.

name = "Alex"
age = 25
salary = 50000


3. Data Types

Important beginner data types:

name = "Alex" # str
age = 25 # int
salary = 50000.5 # float
active = True # bool

type(age)


4. Strings

Strings represent text.

name = "Python"

name.upper() # PYTHON
name.lower() # python
name.strip() # removes spaces


5. Numbers

Python supports integers and floating-point numbers.

age = 25
price = 99.50

10 + 5 # Addition
10 - 5 # Subtraction
10 * 5 # Multiplication
10 / 5 # Division
10 % 3 # Remainder
10 ** 2 # Power


6. Boolean

Boolean values represent True or False.

is_logged_in = True


7. Lists

Lists store multiple values in an ordered collection.

numbers = [10, 20, 30, 40]

numbers[0] # Output: 10


Python indexing starts from 0.

8. Dictionaries

Dictionaries store data as key-value pairs.
  • โค 10
More from @sqlspecialist
  1. Oct 4, 20269๏ธโƒฃ How would you calculate month-over-month growth? Sample Answer: โ€œI would first retrievโ€ฆ
  2. Oct 4, 2026๐Ÿ“Š Data Analyst Interview Series โ€” Part 3 Guys, let's continue our Data Analyst Interviewโ€ฆ
  3. Sep 29, 2026๐Ÿ”Ÿ How would you find duplicate records in SQL? Sample Answer: "I would first identify theโ€ฆ
  4. Sep 29, 2026๐Ÿ“Š Data Analyst Interview Series โ€” Part 2 Guys, let's continue our Data Analyst Interviewโ€ฆ
  5. Sep 29, 2026๐—™๐—ฅ๐—˜๐—˜ ๐—ฅ๐—ฒ๐˜€๐—ผ๐˜‚๐—ฟ๐—ฐ๐—ฒ๐˜€ ๐—ง๐—ผ ๐—Ÿ๐—ฒ๐—ฎ๐—ฟ๐—ป ๐—”๐—œ ๐—ถ๐—ป ๐Ÿฎ๐Ÿฌ๐Ÿฎ๐Ÿฒ๐Ÿš€ โ€‹ Explore 6 free resourceโ€ฆ
  6. Sep 29, 2026"After identifying duplicates, I investigate whether they are genuine duplicate records orโ€ฆ
Threads Profile ViewerView any public Threads profile without an account.Open ThreadLook โ†’Writing with AI? Make it sound human.Metric37 rewrites AI drafts so they read naturally. Free AI detector, 1,500 words free.Try Metric37 โ†’