SnowFlake University - Code Flashcards
What symbol would look for characters in each cell, regardles sof where they are (beginning, ending or in middle of a cell)?
But % before and after the characters you are looking for.
EX:
SELECT R_REASON_DESC
FROM “SNOWFLAKE_SAMPLE_DATA”.”TPCDS_SF100TCL”.”REASON”
WHERE R_REASON_DESC LIKE ‘%it%’;
What is the syntax of REPLACE function? and define each of the parameters.
REPLACE(subject, pattern [,replacement])
Subject - where to look
Pattern - What to look for
Replacement - what to replace it with (optional)
What to use to assign a name to a column?
AS
Not permanent
Replace function change the table permanently?
No
What to use to permanently change a table?
UPDATE and SET functions
Syntax of the UPDATE and SET functions:
UPDATE
SET column = REPLACE(subject, pattern [,replacement])
What to put in front of a comment?
// or –
What are the two ways of CONCATENATION
CONCAT function - linking only two values at a time
DOUBLE-PIPE - using a double-pipe symbol
Syntax of CONCAT function:
CONCAT(pattern, subject)
Nest a CONCAT function to…
concate mare than two values.
Basically one inside another
Double-pipe syntax:
pattern || subject || pattern
VARCHAR mean:
Alphanumeric data
How to define a CET
with a WITH clause
What does a CET clause do?
Precedes the body of the SELECT statement, and defines one or more CTEs the can be used later in the statement.
What does SELECT as a statement do?
It queries the database and retrieves a set of rows (most used statement)