[go: up one dir, main page]

0% found this document useful (0 votes)
2 views2 pages

Basic SQL Queries for Data Analysts

The document provides a list of basic SQL queries commonly used by data analysts. It includes examples of SELECT, WHERE, ORDER BY, GROUP BY, HAVING, JOIN, LIMIT, IN, BETWEEN, and aggregate functions. Each query demonstrates how to retrieve and manipulate data from an 'employees' table.

Uploaded by

khuranasimar15
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)
2 views2 pages

Basic SQL Queries for Data Analysts

The document provides a list of basic SQL queries commonly used by data analysts. It includes examples of SELECT, WHERE, ORDER BY, GROUP BY, HAVING, JOIN, LIMIT, IN, BETWEEN, and aggregate functions. Each query demonstrates how to retrieve and manipulate data from an 'employees' table.

Uploaded by

khuranasimar15
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/ 2

Basic SQL Queries for Data Analysts

1. SELECT

SELECT name, age FROM employees;

2. WHERE

SELECT * FROM employees WHERE age > 30;

3. ORDER BY

SELECT * FROM employees ORDER BY salary DESC;

4. GROUP BY

SELECT department, COUNT(*) FROM employees GROUP BY department;

5. HAVING

SELECT department, AVG(salary) FROM employees

GROUP BY department HAVING AVG(salary) > 50000;

6. JOIN

SELECT e.name, d.dept_name

FROM employees e

JOIN departments d ON e.dept_id = d.id;

7. LIMIT

SELECT * FROM employees LIMIT 5;

8. IN

SELECT * FROM employees WHERE department IN ('HR', 'IT');

9. BETWEEN
Basic SQL Queries for Data Analysts

SELECT * FROM employees WHERE salary BETWEEN 40000 AND 60000;

10. AGGREGATE FUNCTIONS

SELECT COUNT(*) FROM employees;

SELECT AVG(salary) FROM employees;

You might also like