SnowFlake University - Code Flashcards

1
Q

What symbol would look for characters in each cell, regardles sof where they are (beginning, ending or in middle of a cell)?

A

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%’;

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

What is the syntax of REPLACE function? and define each of the parameters.

A

REPLACE(subject, pattern [,replacement])

Subject - where to look
Pattern - What to look for
Replacement - what to replace it with (optional)

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

What to use to assign a name to a column?

A

AS

Not permanent

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

Replace function change the table permanently?

A

No

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

What to use to permanently change a table?

A

UPDATE and SET functions

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

Syntax of the UPDATE and SET functions:

A

UPDATE

SET column = REPLACE(subject, pattern [,replacement])

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

What to put in front of a comment?

A

// or –

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

What are the two ways of CONCATENATION

A

CONCAT function - linking only two values at a time

DOUBLE-PIPE - using a double-pipe symbol

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

Syntax of CONCAT function:

A

CONCAT(pattern, subject)

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

Nest a CONCAT function to…

A

concate mare than two values.

Basically one inside another

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

Double-pipe syntax:

A

pattern || subject || pattern

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

VARCHAR mean:

A

Alphanumeric data

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

How to define a CET

A

with a WITH clause

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

What does a CET clause do?

A

Precedes the body of the SELECT statement, and defines one or more CTEs the can be used later in the statement.

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

What does SELECT as a statement do?

A

It queries the database and retrieves a set of rows (most used statement)

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

What does SELECT as a clause do?

A

it defines the set of columns returned by a query

17
Q

What does the COPY INTO command do?

A

Like LIST command, it is not actually SQL, and it is used to move data from an External Stage file into a Snowflake table

18
Q

What database objects need to be defined to use a COPY INTO command?

A
  1. A table
  2. A stage
  3. File Format - structure of the file we want to load
  4. Identify the file you want to upload
19
Q

What is the LIST command used for?

A

It is used to explore the data within a stage

20
Q

To select files by directory, and down into any number of sub-directory levels, when using the LIST command, you can…

A

simply add the path

ex. LIST @MY_S3_BUCKET/load/d..

21
Q

Is the LIST command SQL?

A

No

It is a lot more like a LINUX directory command

22
Q

What does this symbol mean:

::

A

Data type conversion
ex:
select ‘2016-12-25’::date as christmas