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
Define Deadlock avoidance These protocols as well ensure that the system will never enter a deadlock state although the way it is done is different from deadlock prevention. I

#ques Define a job scheduling strategy that will meet business requirement of reporting availability by 6am CST for the following cubes? Show the job scheduling dependencies in a p

Define Two phase commit Two phase commit: To make sure atomicity, all the sites where a transaction is being executed must agree on the final outcome of the execution. The tran

This project will involve designing and creating a database for an organization.  In the design of a database, there is no single "perfect" design.  So your database design may not

Define canonical cover? A canonical cover Fc for F is a set of dependencies like F logically implies all dependencies in FC and Fc logically shows all dependencies in F.


Hello.I have database access assignment which consist of creation Form, Subform, Calculation, Macros

What are the different strategies of implementation of the Statecharts?  There are two strategies for implementation of state charts: i)   Basic Implementation Strategy

A distributed database is defined as "a collection of multiple logically interrelated database which are physically distributed over a computer network" (a) Give any three advan

what are the reasons having variable length records