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

Explain the concepts of relational data model? Relational Data Model - The relational model was first introduced through Prof. E.F. Codd of the IBM Research in the year 1970

Using a labelled diagram explain the operation of the Data Warehouse, define the basic architectural components and outline the main functionalities. Briefly explain the role an op

A super key is an attribute or set of attributes used to recognize the records uniquely in a relation. For instance, in the Relation PERSON defines earlier PERSON_ID is a super

What are the difference between clustered and a non-clustered index? A clustered index is a special type of index that reorders the way records in the table are physically stor

what are the reasons having variable length records

Question 1 Explain the 10 reasons to use MySQL Question 2 Write the SQL statements to demonstrate the following using SELECT command Expression Evaluation ORDER BY

A customer places orders for parts and belongs to a particular industry group. An individual order is taken by a particular sales representative on a specific date and the sales re

we need example of 2phase locking

Advantages of Data Distribution The primary benefit of distributed database systems is the ability to access and share data in a reliable and efficient manner.