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 a database design approach of your choice, produce a logical design for Pharma. 1) Your answer must consist of ONE the following: An entity-relationship (ER) diagra

Concatenation operator Example : Printing name and job as one string as column name employees: SELECT ENAME||JOB "EMPLOYEES" FROM EMP;

Define hot swapping? Hot swapping permits the removal of faulty disks and changes it by new ones without turning power off. Hot swapping decreases the mean time to repair.

What are the advantages and disadvantages of merging an association into a class?  Advantages: i)  Less number of tables ii) Faster performance due to the fewer tables

Explain the concept of a data model ? Data Model - Model is an abstraction procedure which hides irrelevant details although highlighting details relevant to the application

Example RELATION SCHEMA for STUDENT: STUDENT (Roll No: string, name: string, login: string, age: integer) RELATION INSTANCE

The Proliferation of Object-Oriented Methods The first few years of the 1990s saw blossoming of around fifty various object oriented methods. This proliferation is a sign of g

In this exercise you will create ten records, each containing the following fields: student name, class:  Freshman, Sophomore, Junior or Senior, Major:  Liberal Arts or General Sci

In order to keep pace with competitors, Space Ltd has decided to implement an ERP system in order to replace its old legacy and manual systems. Management does not have much knowle

Normalize the following table upto and including the 3NF. Submit a 1 page printout of only the final set of normalized tables in Data Architect. Just use Data Architect to do the t