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
Do the 11.1 11.1 Credit Card Use. Consider the following hypothetical bank data on consumers’ use of credit card credit facilities in Table 11.3. Create a small worksheet in Exce

Describe integrity constraints? Integrity Constraints - A database is just as excellent as the information stored in it, and a DBMS must therefore help avoid the entry of inc

Use Access 2007 to create a database called UniLib.mdb. - this file should be created on your personal drive at the university (or C: if you're using Access 2007 at home) and t

What is system catalog or catalog relation? How is better known as? A RDBMS maintains a explanation of all the data that it contains, information about every relation and index

Evaluate, compare and contrast the two methods of relational database design namely top down method and Bottom up method. What will be your choice if you are asked to select a meth

Explain about primary key Primary Key: It is one of the candidate keys that are taken to be the recognizing key for the entire table. E.g. although there are two candidate ke

Explain concurrency control? Concurrency control Oracles multiversion concurrency control varies from the concurrency mechanism used by some other data base vendors. Read


define normalisation and functional dependency

What does data dictionary is a special file contains ? The data dictionary is a special file contain The name of all fields in all files.The width of all fields in all files an