For creating tables and utilizing sequences in Oracle 12c SQL, certain rules apply:
Option A: This statement is valid. It creates a table with a primary key and dates, where the default value for end_date is SYSDATE. There are no constraints on sequences, and all syntax is correct.
Option B: This option is invalid because it attempts to use CURRVAL of a sequence as a default value for a primary key. CURRVAL cannot be used until the sequence's NEXTVAL has been called in the session.
Option C: Invalid syntax because 'start date' is not a recognized default expression in Oracle SQL. If the intention was to use 'start_date' as a reference, it still would not work correctly without proper syntax for conditional default values.
Option D: This syntax is invalid in Oracle SQL because the DEFAULT clause does not support relational conditions directly within the table definition.
Option E: Valid. It correctly uses NEXTVAL for a sequence in the DEFAULT clause for the primary key, ensuring that each new record has a unique primary key generated from the sequence. The start_date and end_date are assigned defaults of SYSDATE, which is syntactically correct.
Contribute your Thoughts:
Chosen Answer:
This is a voting comment (?). You can switch to a simple comment. It is better to Upvote an existing comment if you don't have anything to add.
Submit