Practice - 5 Tasks
Answer the questions below
1fill in blank
easyComplete 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'
Attempts:
3 left
💡 Hint
Common Mistakes
Starting the sequence at 0 or a higher number when 1 is expected.
✗ Incorrect
The sequence should start at 1 to auto-increment from the first number.
2fill in blank
mediumComplete 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'
Attempts:
3 left
💡 Hint
Common Mistakes
Using CURRVAL instead of NEXTVAL to get the next sequence number.
✗ Incorrect
Using NEXTVAL gets the next number in the sequence.
3fill in blank
hardFix 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'
Attempts:
3 left
💡 Hint
Common Mistakes
Using 0 or negative numbers for increment which causes errors.
✗ Incorrect
The increment value should be 5 to increase the sequence by 5 each time.
4fill in blank
hardFill 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'
Attempts:
3 left
💡 Hint
Common Mistakes
Mixing up start and increment values.
✗ Incorrect
The sequence starts at 100 and increments by 10 each time.
5fill in blank
hardFill 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'
Attempts:
3 left
💡 Hint
Common Mistakes
Using CURRVAL instead of NEXTVAL.
Not aliasing the column properly.
Selecting from wrong table.
✗ Incorrect
Use NEXTVAL to get the next sequence value, alias it as 'next_invoice_id', and select from 'dual'.