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
Illustrate different types of Locks in SQL Server. There are three kinds of locks in SQL Server i.) Shared locks - These are used for operations which don't allow any update

Describe Query evaluation engine? Query Evaluation engine: Vehicle executes low-level instructions obtained through the DML compiler. The Storage Manager Components gives in

In the first unit of this block, you have been given with the details of the Database Management System, its structure, advantages etc. This unit is an attempt to give you informat

What is Nested Trigger? A trigger can also having INSERT, UPDATE and DELETE logic within itself, so when the trigger is fired because of data modification it can also cause ano

Package classes and associations into models  Programs are made of separate physical units which could be edited, imported, complied or otherwise manipulated. The careful part

Advantages of Observation  Methods: Bailey has pointed  out four  advantages of observation: 1. Superior in Data  Collection  on Non Verbal Behavior: When  a person  a opi

Develop C# schoolproject ASAP Helping me with schoolproject. The project is prepared in C# and haves a database connection. We have some small issues asking up data from t

What are the features of embedded SQL? Explain. Embedded SQL - SQL could be implemented within two ways. It can be used interactively or embedded in a host language or throu

List the drawbacks of relational database system A) Repetition of data B) Inability to s certain information.

In tuple relational calculus P1 → P2 is equivalent to ? A In tuple relational calculus P1→  P2 is equivalent to ¬P1 V P2. (The logical implication expression A  B, meaning