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
What are the advantages and disadvantages of using a database system. Sol. Advantages of Database System (DBMS) :  (1) Data Redundancy and Inconsistency: Since differen

Can you help me with the following: Drop statements for all objects in the lab project. Create statements for all objects of the lab project Create indexes for foreign keys Cre

Define null values. In some cases a certain entity may not have an applicable value for an attribute or if we do not know the value of an attribute for a certain entity. In the

Need an expert in ER database theoretical and modeling database system Project Description: Need an expert in ER database theoretical and modeling database systems? Skills

Question 1: Define the term business intelligence tools? Briefly explain how the data from one end gets transformed into information at the other end? Definition Exp

Explain the integrity constraints: Not Null,  Unique, Primary Key with an example each. Is the combination 'Not Null, Primary Key' a valid combination. Justify. Not Null - Shou

A well-maintained relational DBMS has a high level of data integrity. What features of a relational DBMS contribute towards this level of integrity? Relational DBMS gives high

What are the advantages of DBMS ? 1. Centralized Management and Control - One of the major advantages of using a database system is in which the organization could exert, thr

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

Submit the table creation statements (including constraints) for the Database Model. Submit them all in a single script file. Also submit a document explaining what test data yo