SOL-C01 · Question #59
SOL-C01 Question #59: Real Exam Question with Answer & Explanation
The correct answer is A: CREATE SEQUENCE CUSTOMER SEQ START WITH 1000 INCREMENT BY 10 MAXVALUE. The correct SQL statement is 'CREATE SEQUENCE CUSTOMER_SEQ START WITH 1000 INCREMENT BY 10 MAXVALUE 2000 CYCLE;'. This statement creates a sequence named CUSTOMER SEQ, starts it at 1000, increments it by 10 for each new value, sets the maximum value to 2000, and specifies that th
Question
A table 'CUSTOMER DATA' exists within the 'PUBLIC" schema of the database 'CUSTOMER DB'. The table contains a column named 'CUSTOMER ID. You need to create a sequence named 'CUSTOMER SEQ and configure it to automatically increment by 10 for each new customer inserted into the 'CUSTOMER DATA' table. The sequence should start at 1000 and cycle back to the beginning after reaching 2000. What is the correct SQL statement to create and configure this sequence?
Options
- ACREATE SEQUENCE CUSTOMER SEQ START WITH 1000 INCREMENT BY 10 MAXVALUE
- BCREATE SEQUENCE CUSTOMER SEQ START WITH 1000 INCREMENT BY 10 MINVALUE
- CCREATE SEQUENCE CUSTOMER SEQ START WITH 1000 INCREMENT BY 10 MAXVALUE
- DCREATE SEQUENCE CUSTOMER SEQ START WITH 1000 INCREMENT BY 10 CYCLE;
- ECREATE SEQUENCE CUSTOMER SEQ START WITH 1000 INCREMENT BY 10 MAXVALUE
Explanation
The correct SQL statement is 'CREATE SEQUENCE CUSTOMER_SEQ START WITH 1000 INCREMENT BY 10 MAXVALUE 2000 CYCLE;'. This statement creates a sequence named CUSTOMER SEQ, starts it at 1000, increments it by 10 for each new value, sets the maximum value to 2000, and specifies that the sequence should cycle back to the beginning (the MINVALUE, which defaults to the starting value) after reaching the maximum value. Without CYCLE, the sequence stops at the maximum value. Defining MINVALUE is unnecessary when CYCLE is used, as the sequence automatically restarts at the starting value.
Topics
Community Discussion
No community discussion yet for this question.