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:28:57 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
Using your cache simulator and using smalltex.din as your memory trace determine the total miss rate, compulsory miss rate, capacity miss rate, and conflict miss rate for the follo

Eliminate Columns Not Dependent On Key The Employee Relation satisfies - First normal form - As it has no repeating groups. Second normal form - As it do not have multi-a

Question: In a multi-user database environment, locking mechanisms can be used to solve the three basic problems of concurrency. On the other hand, however, locking may also le

Defining Internal Classes and Operations When we enlarge algorithms, new classes can be added to the store intermediate results. A complex operation could be looked at, as a c


What it creates while a primary key is combined with a foreign key? It creates Parent-Child relation ship between the tables that connect them while a primary key is combined w

You have a friend that runs a motor bike club that holds racing events at various venues on weekends, on a monthly basis. Some venues are private race tracks and some are dirt trac

What is the difference between internal tables and extract datasets? The lines of an internal table always have the similar structure. By using extract datasets, you can ha

Breaking into Subsystems Decomposition is a significant technique for coping with complexity based on idea of divide and conquers. In dividing a problem into sub problems, the

Give the Introduction of OBJECT DESIGN Strategies which are selected during system design are carried out in object-oriented design. In this procedure, objects which are identi