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
The domain that you will model in this assignment is that of courses and students at a university. So as not to make the task too large and unspecified, you will here get a descrip

What is a value? A data value is used for identity. This form of identity is used in relational systems.eg: The primary key value of a tuple recognize the tuple.

Describe the two types of methods for retrieving rows in Python? Fetchone()- Returns the next row as a sequence Fetch all()- Returns the entire result set like a strin

What is Primary key? Primary Key - Primary key is one of the candidate keys which uniquely identifies each row in the relation.

Define tuple variable? Tuple variables are used for comparing two tuples in the same relation. The tuple variables are explained in the from clause by way of the as clause.


How many types of users works on database? Users are differentiated through the way they expect to interact along with the system (i) Application programmers-interact with

What are the two methods for dealing deadlock problem? The two procedures for dealing deadlock problem is deadlock detection and deadlock recovery.

What is a data dictionary? Data Dictionary is a main source of data in a data management system.  Its major function is to carry the creation and management of data definition

Gaps in sequence values can happen when: -     A rollback happens that is when a statement changes are not accepted. -     When the system crashes -     When a sequence i