Just a few SQL problems
Student Name:__________________ Date:_________
ECET450 Practice Exercise #7
Sequences
Short-answer questions (write your answers on this sheet to be turned in):
1. What is a sequence?
2. Which clause of a sequence cannot be changed with an alter statement?
3. List four (4) clauses that can be included when creating a sequence and give a brief description of each.
4. Which is the minimum you must include when creating a sequence?
(continued on back)
Coding:
Log on to your user schema for this exercise. You will need to create a script file, execute the script file into a spool session, and then print out the spooled file to be turned in along with this lab sheet.
1. Select all records from the BOOK_CUSTOMER table to show the current contents.
2. Create a sequence named CUST_NUM_SEQ that will start with 700 and increment by 10.
3. Insert two records into the customer table containing the customer number and first and last names. Use the sequence for the customer number and names of your own choosing.
4. Alter the sequence to increment by 15 and add two more records.
5. Select all records from the customer table to show the results of the four insert statements.
Before running your script file for the final time to create the spooled output, issue the following two commands:
DELETE BOOK_CUSTOMER
WHERE CUSTOMER# > 699;
DROP SEQUENCE CUST_NUM_SEQ;
This completes this exercise.