Section 1

Preview this deck

Aggregate function setup

Front

Star 0%
Star 0%
Star 0%
Star 0%
Star 0%

0.0

0 reviews

5
0
4
0
3
0
2
0
1
0

Active users

0

All-time users

0

Favorites

0

Last updated

6 years ago

Date created

Mar 1, 2020

Cards (22)

Section 1

(22 cards)

Aggregate function setup

Front

SELECT AGG(column) FROM table;

Back

LIMIT Statement

Front

SELECT * FROM table_name LIMIT num_rows

Back

WHERE Statements with Text - sales status shipped -case sensitive

Front

SELECT * FROM sales WHERE status LIKE '%Shipped%'

Back

Creating Derived Columns

Front

SELECT (operations) AS new_name from table;

Back

Creating derived columns for a specific person or client (customer 17 in this case)

Front

SELECT (operations) AS new_name FROM table WHERE customer = '17';

Back

filter text NOT function: -ILIKE Shipped -Sales<50

Front

SELECT * FROM table WHERE status NOT ILIKE '%Shipped%' or WHERE NOT sales < 50;

Back

SELECT Statement

Front

SELECT * FROM table;

Back

filter text IN function

Front

SELECT * FROM table WHERE column IN value1, value2, value3...

Back

NEED GROUP BY

Front

Back

SELECT DISTINCT Statement

Front

SELECT DISTINCT columns FROM table;

Back

If you want to use a filter that contains an aggregate function (SUM, COUNT, MIN, MAX, AVG, etc), you cannot use ---- You have to use ---- instead.

Front

WHERE, HAVING

Back

Selecting Specific Columns and Creating Column Aliases

Front

SELECT column1, column2 AS alias1, column3... FROM table_name;

Back

Wildcard placeholder for text used with LIKE or ILIKE statements

Front

%

Back

All text for where statements should be in _____

Front

single quotes

Back

1: WHERE Statements with Numbers 2: where price is greater than 870 or sales is greater than 4000

Front

1. SELECT * FROM table_name WHERE boolean condition 2. SELECT * FROM sales WHERE price >= 80 OR sales > 4000

Back

Order of ops

Front

SELECT • FROM • JOIN • WHERE • GROUP BY • HAVING • ORDER BY • LIMIT

Back

Comments in SQL 1. line 2.whole section

Front

- -, / /

Back

To express values to a certain number of digits, a, b

Front

CAST(X) AS NUMERIC(A,B), max digits, decimal places

Back

Creating derived columns for a specific status (canceled in this case)

Front

SELECT (operations) AS new_name FROM table WHERE status ILIKE '%Canceled%'

Back

same as LIKE statement but not sensitive to capitalization

Front

ILIKE

Back

ORDER BY

Front

SELECT column1 AS alias1 FROM table_name [ORDER BY column1 [DESC], [LIMIT n]

Back

filter text BETWEEN function

Front

SELECT * FROM table WHERE column BETWEEN low AND high

Back