Example of sequences, Database Management System

Assignment Help:

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.


Related Discussions:- Example of sequences

Entity integrity, Before defines the second type of integrity constraint, v...

Before defines the second type of integrity constraint, viz., Entity Integrity, we should be well-known with the concept of NULL. Mostly, NULL is intended as a basis for dealing

Normalization, a project based on normalization with first, second and thir...

a project based on normalization with first, second and third normalization. There need to be a diagram also

Define specialisation and generalization in brief, Define Specialisation an...

Define Specialisation and generalization in brief? Specialisation / generalization: Generalization or Specialization represents the is a relationship set, an necessary element

Differentiate between logical database design and physical, Differentiate b...

Differentiate between logical database design and physical database design. Show how this separation leads to data independence? Basis Logical Databas

Differentiate between static hashing and dynamic hashing, Differentiate bet...

Differentiate between static hashing and dynamic hashing.  Ans: Static Hashing comprises the number of primary pages in the directory fixed. So, while a bucket is full, we requ

What are the three data anomalies, What are the three data anomalies that a...

What are the three data anomalies that are likely to occur as a result of data redundancy?  Can data redundancy be completely eliminated in database approach?  Why or why not? A

Describe identifying relationship, Describe identifying relationship? ...

Describe identifying relationship? Identifying relationship: It is relationship among strong entity and a weak entity it is represented through a doubly outlined diamond in C

Basic set operation, These are the binary operations; i.e., each is applied...

These are the binary operations; i.e., each is applied to two relations or sets. These two relations can be union compatible excluding in case of Cartesian product. Two relations R

Php optimization on iis 8, Project Description: We have purchased facebo...

Project Description: We have purchased facebook style chat software which we are using with our site. It is prepared in PHP but the rest of the site is developed asp.net. Iss

Data model in DBMS, how many types of data model in DBMS? explain data abst...

how many types of data model in DBMS? explain data abstraction with its different level

Write Your Message!

Captcha
Free Assignment Quote

Assured A++ Grade

Get guaranteed satisfaction & time on delivery in every assignment order you paid with us! We ensure premium quality solution document along with free turntin report!

All rights reserved! Copyrights ©2019-2020 ExpertsMind IT Educational Pvt Ltd