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
Question: Consider the following database relations for a textbook ordering system used by a college bookshop: Book (b-copy#, bname, ISBN#, author, price, subject) Order (s#

The primary key is selected from the

What is Identity? Identity (or AutoNumber) is a column that automatically produces numeric values. A start and increment value can be set, but most DBA leave these at 1. A GUID

Write a short note on oracle Instance? Oracle Instances: An instance is the (executed) Oracle software and the memory they use. It is the instance which manipulates the data s


Differentiate between B-tree and B + tree    Ans:  A B-tree (or Balanced Tree) is a search tree along with additional constraints that makes sure that the tree is all the time

What is called query processing? Query processing refers to the range of activities included in extracting data from a database.

Which file organization provides very fast access to any arbitrary record of a file? Hashed file organization provides very fast access to any arbitrary record of a file.

Table Handling  In RDBMS more than one table can be tackled at a time by using join operation. Join operation is a relational operation that causes 2 tables with a common domai

List the internal controls that should be in effect solely because a EDP system is employed, classifing them as (1) Those controls pertaining to input of information and (2) All ot