Excel/SQL functions Flashcards

(36 cards)

1
Q

CAST

A

SQL: changes datatype (string to float)

CAST (revenue AS Float)
or
CAST (date AS date) AS date only

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

CONCAT (in excel/ databases)

CONCATENATE (in sheets)

A

SQL: joins 2 or more text strings

_____ (1,2) AS ___name it____ OR
Concatenate (A1, “:”, B1) if you want to add something

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

COALESCE

A

SQL: accounts for null values
SELECT
COALESCE (column1, column2, column3)

____ (1. 2, 3,0(backup if 1 isn’t available, try this field, then this field, then this field, then zero))

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

TRIM

A

SQL: to eliminate leading or trailing spaces

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

CASE

A

Change value/spelling of something (like Find/Replace)

SELECT
WHEN customer_name = “Johno” THEN “John”
ELSE customer_name
END AS updated_customer_name

OR

SELECT
 WHEN quantity >30 THEN 'above 30'
WHEN quantity = 30 THEN 'Is 30'
ELSE 'under 30'
END AS QuantityText
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q

SORT (sheets/excel syntax)

A

=SORT(range, sort column, is ascending (true or false))

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
7
Q

ORDER BY

A

SELECT, FROM, ______column like Release_date DESC

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
8
Q

SORT (databases/SQL)

A

ORDER BY

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
9
Q

CONVERT (sheets)

A

Converts fareinheight to celcius

=CONVERT(B2, “F”, “C”)

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
10
Q

SPLIT

A

=SPLIT (A2, “ “) (text, delimiter)(For ex: Ann Jones)

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
11
Q

=TO_PURE_NUMBER(A2)

A

Converts to number without text ($ sign gone)

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
12
Q

DATA VALIDATION

A

create checkboxes, lists to choose from

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
13
Q

SAFE_CAST

how to make a date a string

A

SAFE_CAST (MyDate AS STRING) FROM MyTable

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
14
Q

COUNT (3 types)

A

COUNT (column_name) - returns number of values in colum - doesn’t count nulls

COUNT(*) - counts the number of records in a table

COUNT (DISTINCT column_name) - returns number of distinct values of specified column

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
15
Q

GROUP BY

A

I think all of them together = 1 entry

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
16
Q

VALUE

A

converts string to number

17
Q

COUNT DISTINCT

A

sql COUNT (DISTINCT column)

18
Q

IF

A

IF (quantity>10, more, less)

IF (condition, value if true, value if false)

19
Q

HAVING

A
Group by:  Last Name
HAVING COUNT (orders.orderID) > 10
20
Q

COUNTIF

A

sheets
=COUNTIF(range, “value”)
=COUNTIF (B2-B50, “=1”)

21
Q

SUMIF

A

=SUMIF (range, criteria, (sum_range))

=SUMIF (B2-B50, “=1”, C2-C50)

22
Q

SUMIFS

A

=SUMIFS(sum_range, criteria_range1, criterion1, [criteria_range2, criterion2,…])
=SUMIFS (B1:B9, A1:A9, “Fuel”, C1:C9, “12/15/2020”)

23
Q

SUMPRODUCT

A

=SUMPRODUCT(array1, array2…)

= (multiplication of corresponding values, then adding them all together)

24
Q

The value we’re calculating should NOT be equal to the value we specify

A
< >  4
< >  0
or
! = 0
! = 4
25
EXTRACT
SQL - let's us pull one part of a given date to use EXTRACT (YEAR from starttime_run) AS Year
26
Returns the remainder of a division calculation
% Modulo operator
27
ROUND
sql ROUND (number, # decimals) ROUND(MAX(UnitPrice), 2)
28
WITH
sql a type of temporary table that you can query from multiple times WITH (new name) AS (select,from,where table)
29
Tells query t's part of description and not part of the code
##
30
INNER,OUTER,LEFT, RIGHT JOIN
FROM _____table1_____ INNER JOIN ____table2____ ON table1.column1 = table2.column1
31
SELECT INTO
``` (temporary table) SELECT * INTO AfricaSales FROM GlobalSales WHERE Region=Africa ```
32
CREATE TABLE
``` CREATE TABLE AfricaSales AS ( SELECT* FROM GlobalSales WHERE Region= "Africa" ) ```
33
IF
sql SELECT IF (genre=`horror`, 'will not watch', 'will watch') AS watch_category,
34
how to delete a table
DROP TABLE IF EXISTS table1
35
Create tables (2 ways)
``` CREATE TABLE IF NOT EXISTS CREATE OR REPLACE TABLE (tablename1) AS SELECT FROM WHERE ```
36
create temporary table
``` CREATE TEMP TABLE ExampleTable AS SELECT colors FROM favorite_colors ```