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
A table joined with itself is called ? A table joined with itself is known as self join table. Normal 0 false false false EN-IN X-NONE X-NONE

Explain the Weak Entity Set An Entity set which does not have sufficient attribute to make a primay key is known as weak entity set. For instance, dependents of an employee in

Explain weak and strong entity type ? Weak and Strong entity type: An entity set which does not have a primary key is referred to as a weak entity set. The existence of a wea

Mention the several levels in security measures. A) Database system B) Operating system C) Network D) Physical Human

Control as Concurrent Tasks The expression control as simultaneous task means applying control for those events of object which can happen simultaneously. An object can be imp

What should be declared explicitly in the corresponding ABAP/4 Statements to access internal tables without header lines & why? Work Area. This is needed as the Work Area is

What are the several forms of identity? a) Value b) Name c) Built-in

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

1. A company wants a report containing a breakdown of payroll by department. Input, which should be stored in 3 parallel arrays, includes each employee's department number, hourly

(1)     Insert into PERSON Violated constraint: - Key constraint Reason: - Primary key 1 already exists in PERSON. Dealing: - DBMS could ask the user to provide valid PER