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

What subschema expresses, What subschema expresses ? A subschema expres...

What subschema expresses ? A subschema expresses the external view. (External schemas are called also called as subschemas)

Implementation of integrity rules, Question 1 Describe the following- ...

Question 1 Describe the following- Clustering Indexing Question 2 Explain the following with suitable real time examples- Implementation of Integrity rules

What is relational algebra, What is Relational Algebra? Relational algebr...

What is Relational Algebra? Relational algebra is a Procedural query Language?

Key, Q.   Explain the terms key constraints participation constraints and m...

Q.   Explain the terms key constraints participation constraints and mapping caradinalities in ER model.  Participation Constraints :   The participation of an entity set E i

Importance of file organisation in database, Importance Of File Organisatio...

Importance Of File Organisation In Database To execute a database efficiently, there are various design tradeoffs needed. One of the most vital ones is the file Organisation. F

Database errors, Database Errors: An error is said to have occurred if the ...

Database Errors: An error is said to have occurred if the implementation of a command to manipulate the database cannot be successfully finished either due to inconsistent data or

Write a query to find name from the relational algebra, Consider the relati...

Consider the relations City (city_name, state) Hotel (name, address) City_hotel (hotel_name, city_name, owner) Answer the following queries in relational algebra (i) Find

Data Relation diagram, Can you assist me in Database management system? I n...

Can you assist me in Database management system? I need help in my courses, please email me at and get back me soon...

What is identity, What is Identity? Identity (or AutoNumber) is a colum...

What is Identity? Identity (or AutoNumber) is a column that automatically produces numeric values. A start and increment value can be set, but most DBA leave these at 1. A GUID

What is oracle databse structure, What is Oracle databse structure? Or...

What is Oracle databse structure? Oracle database structure: The relational model has three main aspects: Structures: Structures are well-defined objects which store th

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