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
Implementation of association as an object Implement as a separate association object, independent of either class, as in Figure. An association object is a group of pairs

Types of data independence Data independence can be classified into the following two types: Physical Data Independence: This means that for any change made in the physi

4. Describe three ways to handle missing field values

Explain the ISA relationship Answer: ISA relationship - ISA notation is employed in generalization/ specialization to depict relationship among lower and higer level entity s

Show a centralised schema to support the operation of the system you have chosen, including in particular: the product catalogue; the outlets and respective stocks; customer record

The participation Constraints shows whether the existence of an entity depends on its being associated to another entity by the relationship type. There are two kinds of participat

How does a query tree represent a relational algebra expression?  Discuss any three rules for query optimisation, giving example as to when should each rule be applied.     Ans

What is Oracle Process? Explain any four processes started by Oracle. Oracle Process is as follows: SMON: The System Monitor carries out a crash recovery while a crashed in

First Normal Form and second normal form First Normal Form (1NF) A relation is said to be in 1NF if it having no non-atomic values and each row can give a unique combinat

a method named WonGame that checks each letter in the word is matched by its label