0
0
Snowflakecloud~10 mins

Sequences and auto-increment in Snowflake - Interactive Code Practice

Choose your learning style9 modes available
Practice - 5 Tasks
Answer the questions below
1fill in blank
easy

Complete the code to create a sequence named 'order_seq' starting from 1.

Snowflake
CREATE SEQUENCE order_seq START WITH [1];
Drag options to blanks, or click blank then click option'
A10
B100
C0
D1
Attempts:
3 left
💡 Hint
Common Mistakes
Starting the sequence at 0 or a higher number when 1 is expected.
2fill in blank
medium

Complete the code to get the next value from the sequence 'order_seq'.

Snowflake
SELECT [1];
Drag options to blanks, or click blank then click option'
Aorder_seq.NEXTVAL
Border_seq.VALUE
Corder_seq.PREVVAL
Dorder_seq.CURRVAL
Attempts:
3 left
💡 Hint
Common Mistakes
Using CURRVAL instead of NEXTVAL to get the next sequence number.
3fill in blank
hard

Fix the error in the code to create a sequence that increments by 5.

Snowflake
CREATE SEQUENCE seq_increment INCREMENT BY [1];
Drag options to blanks, or click blank then click option'
A1
B0
C5
D-5
Attempts:
3 left
💡 Hint
Common Mistakes
Using 0 or negative numbers for increment which causes errors.
4fill in blank
hard

Fill both blanks to create a sequence 'user_seq' starting at 100 and incrementing by 10.

Snowflake
CREATE SEQUENCE user_seq START WITH [1] INCREMENT BY [2];
Drag options to blanks, or click blank then click option'
A100
B1
C10
D5
Attempts:
3 left
💡 Hint
Common Mistakes
Mixing up start and increment values.
5fill in blank
hard

Fill all three blanks to select the next value from 'invoice_seq' and alias it as 'next_invoice_id'.

Snowflake
SELECT [1] AS [2] FROM [3];
Drag options to blanks, or click blank then click option'
Ainvoice_seq.NEXTVAL
Bnext_invoice_id
Cdual
Dinvoice_seq.CURRVAL
Attempts:
3 left
💡 Hint
Common Mistakes
Using CURRVAL instead of NEXTVAL.
Not aliasing the column properly.
Selecting from wrong table.