Create a sequence to be used with the primary key column of a DEPARTMENT table (
ID: 638266 • Letter: C
Question
Create a sequence to be used with the primary key column of a DEPARTMENT table (may not exist on your schema). The sequence should start at 60 and have a maximum value of 200. Have the sequence increment by 10 numbers and name the sequence DEPT_ID_SEQ.
Copy and paste the details table along with the SQL used to create the sequence into your answers document.
Write a SQL statement (not a DESCRIBE) to list the sequence owner and name for all of the sequence objects available to you.
Create a non-unique index named EMP_DEPTNO_IDX on the foreign key column (deptno) of the EMP table.
Write a select statement to display the index_name, table_name, table_owner and uniqueness that exist in the data dictionary for the EMP table user indexes.
Write a SQL statement to create a synonym for the PRODUCT table named
Explanation / Answer
1.
CREATE SEQUENCE DEPT_ID_SEQ
START WITH 60
INCREMENT BY 10
MAXVALUE 200;
2.
SELECT sequence_name, max_value, increment_by, last_number
FROM user_sequences;
3.
CREATE INDEX EMP_DEPNO_IDX ON EMP(depno);
4.
SELECT index_name, table_name, table_owner, uniquenesss
FROM user_indexes
WHERE table_name = "EMP";
5.
CREATE SYNONYM PROD FOR PRODUCT;
6.
SELECT * FROM PROD;
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.