Example of sequences, Database Management System

Example: Create a sequence named SEQSS that starts at 105, has a step of 1 and can take maximum value as 2000.

 CREATE SEQUENCE SEQSS START WITH 105

INCREMENT BY 1

MAX VALUE 2000;

How the sequence so formed is used? The following sequence of commands try to illustrate the use of the sequence SEQSS.

Suppose a table person exists as: SELECT * FROM PERSON;

Output:             CODE      NAME         ADDRESS

------                      -------    --------         ---------------

                               104       RAMESH    MUMBAI

Now, if we give the command:

INSERT INTO PERSON

VALUES (SEQSS.NEXTVAL, &NAME, &ADDRESS) 

On implementation of statement above do the following input:

Enter value for name: 'Rakhi'

Enter value for address: 'New Delhi'

Now, here is the following command to see the output:

SELECT * FROM PERSON;

CODE        NAME           ADDRESS

--------- --------------- -----------------

104        RAMESH         MUMBAI

105        Rakhi             NEW DELHI

 

The explanations of sequences such as minimum value, maximum value, increment or step are stored in the data dictionary.  For instance, in oracle it is stored in the table user_sequences. You can see the explanation of sequences by giving the SELECT command.

Posted Date: 3/11/2013 1:29:07 AM | Location : United States







Related Discussions:- Example of sequences, Assignment Help, Ask Question on Example of sequences, Get Answer, Expert's Help, Example of sequences Discussions

Write discussion on Example of sequences
Your posts are moderated
Related Questions
What is data independence? Data Independence: Techniques which permit data to be changed without affecting the applications in which procedure it. There are two types of data

What Count function return in SQL? Count function within SQL returns the number of values. (Count function counts all the not null values in the exact column. If we need to cou

Project Description: My VBulletin forum was hacked, and soon after my server machine died. So, I'm now on a new machine, and I think that I've taken care of 99% of the hacking..

What is transaction? Transaction is a unit of program implementation that accesses and possibly updated several data items.

Define weak and strong entity sets? Weak entity set: entity set that do not have key attribute of their own are known as weak entity sets. Strong entity set: Entity set that

What is a Built-in A notation of identity is built-into the data model or programming language and no user-supplied identifier is needed. This form of identity is used in objec

A database to track your progress in your college program will track your progress towards graduation! A database that has information containing the classes that you have taken, c

How to define a job scheduling strategy that will meet business requirement of reporting availability by 6am CST for the following cubes? Show the job scheduling dependencies in a

Failure Controlling Methods: Failures can be handled using different recovery methods that are talk about later in the unit. But the first question is doing we really require recov

This project requires you to perform a systems analysis and then design a system solution using database software. Ace Auto Dealers specializes in selling new vehicles from Subaru.