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 exhausitively the problems associated with er diagrams with ellustrations

Use again the GE Flight Quest Data and build on the work done for homework 1 and 2. The goal is to create a classification model which classifies flights into "on-time" (you can de

Mappings between Levels and Data Independence The 3 levels of abstraction in the database do not exist separately of each other. There must be some correspondence, or mapping

With the help of a suitable diagram gives module wise explanation of system architecture of DBMS.on..

Describe the functions and features of foreign key? Foreign Key : The primary key of one file or table that is implanted in another file or table to implement the relationships

What is relationship? Give examples A relationship is an association between several entities. Example: A depositor relationship associates a customer with every account tha

What are the three data anomalies that are similarly to take place as a result of data redundancy?  Can data redundancy be completely eliminated in database approach?  Why or why n

You want to implement following relationships when designing tables. How would you do it? a.) One-to-one b.) One-to-many c.) Many-to-many a.) One-to-One relationship -

Define the Third Normal Form: The third normal form (3NF) is a normal form employed in database normalization. 3NF was initially defined by E.F. Codd in 1971. Codd's definitio

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 VA