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
how the string works as keyword?

Waterfall model is the linear model. The process is completed by step by step. We couldn't stop in between of the process. Prototype model: after get the model by low cost budget o

A database to track your progress in your college program will track your progress towards graduation! A database that has information containing the classes that you have taken, c

Explain P command in the respect of QBE? P: It is the command in which is used to print (logically display) the value of the attribute in whose cell it is writ

Update or Modify operation alters the existing values. If these operations alter the value that is the foreign key also, the only check need is the similar as that of the Insert op

Consider the subsequent relations for a database which keeps track of business trips of salespersons in a sales office: SALESPERSON (SSN, Name, start_year, Dept_no) TRIP (SSN, Fr

What is called a query -execution engine? The query implementation engine takes a query evaluation plan, implements that plan, and returns the answers to the query.

Determine object representation As a designer, we must choose properly that when to use primitive types in representing objects and when to combine groups of related objects,

Process-oriented decompositions Process-oriented decompositions divide complex process, task or function into simpler sub processes until they get simple enough to be deal

which component of DBMS can be embedded in a program? The data manipulation language (DML) is a component which is embedded in a program.