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
sir we want er diagram of bank management system in this main menu option as new account,deposit amount,withdraw amount,all acount holder list,modify account,close account

What are the basic objects of the data dictionary? Tables Domains Data elements Structures Foreign Keys

SELECT Statement This statement is used for retrieving information from the databases. It can be coupled with many clauses. Let us talk about these clauses in more detail:

The following data are required to be stored by a family physician. Family#, FamilyAddress, Patient#, PatientName, ServiceCode, ServiceFee, ServiceDate A family can have seve

The entity type STUDENT has the following attributes: Student Name, Address, Phone, Age, Activity, and No of Years. Activity represents some campus-based student activity, and No o


Explain the concept of QBE? Query-by-example represents a visual/graphical approach for accessing information in a database by the use of query templates called as skeleton tab

What does Aggregation mean?

What is a primary key? Primary key is chosen by the database designer as the principal means of identifying an entity in the entity set.

The Second Normal Form (2NF) Definition: A relation is in 2NF if it is in 1NF and each non-key attribute is fully dependent on each candidate key of the relation. Some of th