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

Describe relational model, Describe relational model? Structure of rela...

Describe relational model? Structure of relational data base Basic structure Database schema Keys Schema diagram Query languages

What is a super key, What is a super key? A super key is a set of one o...

What is a super key? A super key is a set of one or more attributes that collectively permits us to recognize uniquely an entity in the entity set.

Which two files are used during operation of the dbms, Which two files are ...

Which two files are used during operation of the DBMS? Data dictionary and transaction log are two files used during operation of the DBMS.

Extended star schema, Northwind Pty Ltd sells a variety of food products th...

Northwind Pty Ltd sells a variety of food products throughout the world.  They want to use the reporting features of SAP's Business Information Warehouse to better understand their

The second normal form (2nf), The Second Normal Form (2NF) Definition: ...

The Second Normal Form (2NF) Definition: A relation is in 2NF if it is in 1NF and each non-key attribute is fully dependent on each candidate key of the relation. Some of th

Explain the exec statement in sql, Explain the EXEC statement in SQL  A...

Explain the EXEC statement in SQL  Ans: All statements which start with EXEC SQL are embedded SQL database statements. High level languages such as C can be employed to write a

Give the forms of triggers, Give the forms of triggers? The triggering ...

Give the forms of triggers? The triggering event can be insert or delete. For updated the trigger can state columns. The referencing old row as clause The referencing

What is a dataset, What is a dataset? A dataset is an in-memory databas...

What is a dataset? A dataset is an in-memory database that is disconnected from any regular database, but has all the significant characteristics of a regular database. Dataset

Which method is used to key transformation, Which method is used to key tra...

Which method is used to key transformation ? A hash method is used to key transformation.

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