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
Using Literal Character String Example: To print IS A as one string with column name employee SELECT ENAME || ' IS A ' || JOB AS "EMPLOYEE" FROM EMP;

Differentiate OO development from structured development. Structured approach of problem solving is based upon the idea of decomposition of system into subsystem. In this appro

Every School has many teachers and many students. Each student is assigned to one school and each teacher works for one school only. Each teacher teaches more than one subject but

Which types of data supported by MySQL for Time and Date formats?  MySQL supports a number of time and date column formats: Some of them are 1) DATE 2) DATETIME 3) TIM

What are the two approaches to store relations in distributed database? a) Replication b) Fragmentation

Describe Parameteric end users? Parametric end users might be given update access, but are commonly not permitted to change the structure of data.

What are the causes of bucket overflow in a hash file organization? What can be done to reduce the occurrence of bucket overflow? When a record is inserted, the bucket to that

What are the uses of functional dependencies? To test relations to see whether they are legal under a given set of functional dependencies. To state constraints on the set

What are the uses of ODBC? Under what circumstances we use this technology? ODBC expose database capabilities within a standardized way to the application programmer by an ap

What do you mean by atomicity and aggregation? Atomicity : Either all actions are carried out or none are. Users should not have to worry about the effect of incomplete trans