0% found this document useful (0 votes)
15 views12 pages

Basic SQL

This document provides a summary of essential SQL clauses and functions for data analysis. It explains common clauses such as SELECT, FROM, WHERE, GROUP BY, ORDER BY, HAVING, and functions including COUNT, SUM, AVG, MIN, MAX. Additional clauses and functions covered include DISTINCT, BETWEEN/AND, LIKE, IN, NULL, and LIMIT/TOP. The document uses examples to demonstrate how each clause or function is structured and what it is used for in a SQL query.

Uploaded by

almarayyan0926
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)
15 views12 pages

Basic SQL

This document provides a summary of essential SQL clauses and functions for data analysis. It explains common clauses such as SELECT, FROM, WHERE, GROUP BY, ORDER BY, HAVING, and functions including COUNT, SUM, AVG, MIN, MAX. Additional clauses and functions covered include DISTINCT, BETWEEN/AND, LIKE, IN, NULL, and LIMIT/TOP. The document uses examples to demonstrate how each clause or function is structured and what it is used for in a SQL query.

Uploaded by

almarayyan0926
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/ 12

SQL ESSENTIALS

FOR DATA
ANALYTICS

CHRIS FRENCH

A SQL GUIDE FOR DATA PROFESSIONALS


SELECT/FROM

Query:

Result:

SELECT is used to retrieve


specific data or columns from a
database table.

FROM is used to specify the


source table from which the
data should be selected in a
query.
WHERE

Query:

Result:

WHERE allows you to filter data


based on specific conditions,
such as selecting rows where a
certain column meets a
particular criteria
GROUP BY

Query:

Result:

GROUP BY is used to group rows


with similar values in one or
more columns together, often in
combination with aggregate
functions like SUM, AVG, COUNT,
etc
ORDER BY

Query:

Result:

ORDER BY sorts the result set


by one or more columns in
ascending or descending order
HAVING

Query:

Result:

HAVING works with GROUP BY to


filter grouped data based on
conditions, similar to WHERE but
for grouped data
AGGREGATE
FUNCTIONS

Query:

Result:

Aggregate functions allow you


to perform calculations on
groups of data, such as finding
the sum, average, count,
minimum, or maximum value of a
column
DISTINCT

Query:

Result:

DISTINCT removes duplicate


rows from the result set,
showing only unique values.
BETWEEN/AND

Query:

Result:

BETWEEN filters data within a


range of values.

AND is used to combine multiple


conditions in a WHERE clause to
filter rows from a table
LIKE/IN

Query:

Result:

LIKE is used for pattern


matching in text data, often
with wildcard characters.

IN specifies a list of values to


check against in a WHERE
clause.
NULL

Query:

Result:

NULL is used to filter or check


for null values in columns.
LIMIT/TOP

Query:

Result:

LIMIT/TOP limits the number of


rows returned by a query, useful
for sampling data or controlling
the size of the result set.

You might also like