The following SQL statements have been executed:
What will the output be of the last select statement?
The following SQL statements have been executed:
What will the output be of the last select statement?
The sequence seq_01 is created to start at 1 and increment by 2 each time. The first select statement for seq_01.nextval will return 1. The second select statement will return 3. The value inserted into the table will use the next value of the sequence, which is 5. Therefore, the last select statement will return the next value in the sequence, which is 7.
C 7 is the answer, 1, 3, 5 and last select query will return 7
Correct ans is 7
C - 7 (1..3..5..7)
"A sequence does not necessarily produce a gap-free sequence. Values increase (until the limit is reached) and are unique, but are not necessarily contiguous." This is poor question design as the query doesn't have ORDER in it. If we use ORDER, then sequence would go 1..3..5..7. If NOORDER_SEQUENCE_AS_DEFAULT=TRUE (like in my trial account), it could go 1..101..3..301 for example. Check ORDER in: https://docs.snowflake.com/en/sql-reference/sql/create-sequence
7 for sure
https://docs.snowflake.com/en/sql-reference/sql/create-sequence.html