Excel/SQL functions Flashcards
CAST
SQL: changes datatype (string to float)
CAST (revenue AS Float)
or
CAST (date AS date) AS date only
CONCAT (in excel/ databases)
CONCATENATE (in sheets)
SQL: joins 2 or more text strings
_____ (1,2) AS ___name it____ OR
Concatenate (A1, “:”, B1) if you want to add something
COALESCE
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))
TRIM
SQL: to eliminate leading or trailing spaces
CASE
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
SORT (sheets/excel syntax)
=SORT(range, sort column, is ascending (true or false))
ORDER BY
SELECT, FROM, ______column like Release_date DESC
SORT (databases/SQL)
ORDER BY
CONVERT (sheets)
Converts fareinheight to celcius
=CONVERT(B2, “F”, “C”)
SPLIT
=SPLIT (A2, “ “) (text, delimiter)(For ex: Ann Jones)
=TO_PURE_NUMBER(A2)
Converts to number without text ($ sign gone)
DATA VALIDATION
create checkboxes, lists to choose from
SAFE_CAST
how to make a date a string
SAFE_CAST (MyDate AS STRING) FROM MyTable
COUNT (3 types)
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
GROUP BY
I think all of them together = 1 entry