Laboratory: Sequences and Indexes
- To practice creating sequences and indexes for an Oracle database.
- Create a new table called MY_CUSTOMER . The table should have
the following structure.
Column Null? Type Key
ID NO NUMBER(7) Primary
NAME NO VARCHAR2(50)
- Confirm the structure of the MY_CUSTOMER table.
- Create a sequence generator named "S_MY_CUSTOMER_ID"
for the MY_CUSTOEMR table column ID, starting with 300 and incrementing
by 1 Do not cache sequence values.
- Display information about your sequence.
- Write a SQL statement to add more rows to the MY_CUSTOMER table.
This statement should prompt your for the customer name, country,
phone, and credit rating. The customer ID for a new customer should
be supplied automatically by the statement. Save the SQL scrip
under the name insert.customers.
- Execute insert.customers twice to add two rows of sample data
to the MY_CUSTOMER table.
- Confirm your additions to the table by a query to the table.
- Display the sequence name and last_number of the S_MY_CUSTOMER_ID
- Create an index named "MY_CUSTOMER_NAME_I" on the
NAME column of the MY_CUSTOMER table.
- Display information on your index.
- Drop the index created in the previous step.
Turn in a hard copy of SQL commands and their corresponding outputs
for each step in the lab first thing during the next class meeting.
Computer Science Department NSU.
Permission granted for non-commercial use only.