Evaluate these commands which execute successfully:
Which two statements are true about the ORD_ITEMS table and the ORD_SEQ sequence? (Choose two.)
Evaluate these commands which execute successfully:
Which two statements are true about the ORD_ITEMS table and the ORD_SEQ sequence? (Choose two.)
Any user inserting rows into the ORD_ITEMS table must have been granted access to the ORD_SEQ sequence because the sequence generates the default values. Column ORD_NO gets the next number from the ORD_SEQ sequence whenever a row is inserted into the ORD_ITEMS table and no explicit value is provided for ORD_NO, ensuring that each new row has a unique sequence number unless an explicit value is given. Both options B and C are consistent with the behavior of sequences and default values in Oracle databases.
i double checked this Question again. i am sure B,C are correct
yes, agree
BC are correct.
BC are correct ADE are wrong
Wrong, A C are correct.. B is wrong, i tested it
A is wrong dropping the sequence lead to ORA-02289 : sequence does not exists
BC 100%
A. If sequence ORD_SEQ is dropped then the default value for column ORD_NO will be NULL for rows inserted into ORD_ITEMS --> False, the column is NOT NULL. B. Any user inserting rows into table ORD_ITEMS must have been granted access to sequence ORD_SEQ --> True C. Column ORD_NO gets the next number from sequence ORD_SEQ whenever a row is inserted into ORD_ITEMS and no explicit value is given for ORD_NO --> True D. Sequence ORD_SEQ cycles back to 1 after every 5000 numbers and can cycle 20 times --> False, it goes back to 1 after 1.000.000... E. Sequence ORD_SEQ is guaranteed not to generate duplicate numbers --> False, having CYCLE in the create statement, duplicates will arrive after the first cycle.
For me B is false. You can insert into the table without having been granted access by not using the column's default value
BC, Correct answers.
There is only one correct answer which is C. B is incorrect because you can insert into the table without using the default value of ord_no i.e. INSERT INTO ord_items (ord_no,item_no, qty, expiry_date) VALUES (3,25,11, sysdate +10) ;
B&C are true.
B,C checked
BE I tired to run the sequence again starting from one and giving max value 10 to check if duplicate value is inserted , But it complains as below insert into ord_items (ITEM_NO,QTY,EXPIRY_DATE,ORD_NO)values (1,12,'03-MAR-23',ord_seq.NEXTVAL) * ERROR at line 1: ORA-00001: unique constraint (SYS.IT_PK) violated So bC OF THE CONSTRAINY ,iT WILL NEVER BE DUPLICATED
You are getting Unique constraint because on ord_no has been specified as one of the primary key. But answer E was specific state about the sequence to guarantee no duplicate. Once CYCLE has been defined on the sequence means once reach the maximum Val it will start again at 1.
BC is corrent
B: GRANT SELECT ON my_user.my_seq TO another_user; —to give access to others For E create sequence and table with smaller values: CREATE sequence ord_seq INCREMENT BY 1 START WITH 1 MAXVALUE 1000 CYCLE CACHE 500; CREATE TABLE ord_items (ord_no number(1) DEFAULT ord_seq.NEXTVAL NOT NULL, item_no number(3), PRIMARY KEY (ord_no, item_no)); select * from ord_items; insert into ord_items values(default,1); — keep entering until it will not take any more, keep going after few errors After getting values from 1 to 9 it will give this error “value larger than specified precision allowed for this column” Sequence never get the chance to CYCLE so E is correct in this scenario only.
B,C is correct
B, C for sure.
B and C
Is there any possibility D is right...Hence C and D are correct