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 is de-normalization, What is De-normalization? De-normalization is...

What is De-normalization? De-normalization is the method of attempting to optimize the performance of a database by adding redundant data. It is sometimes essential because cur

How to create a table from existing table, How to create a table from exist...

How to create a table from existing table? Create table as e.g, To create a new table ‘N_emp' with employee names and their identification numbers only from employee ta

Sql, find the name of supplier who supply some red part

find the name of supplier who supply some red part

Product adder required for ecommerce website, Product adder required for Ec...

Product adder required for Ecommerce website Project Description: Want a product adder for 500 products I have a magento website and need products pulled from site A to my si

Which operation is used if we are interested certain columns, Which operati...

Which operation is used if we are interested in only certain columns of a table? PROJECTION operation is used if we are interested in only certain columns of a table.

What are the concurrency issues, Concurrency issues Data integrity...

Concurrency issues Data integrity: Threads accessing same object need to be synchronized, such as: banking account. Deadlock: One or more threads in system are perman

Explain the 10 reasons to use mysql, Question 1 Explain the 10 reasons to ...

Question 1 Explain the 10 reasons to use MySQL Question 2 Write the SQL statements to demonstrate the following using SELECT command Expression Evaluation ORDER BY

State the terms designing the database and normalization, State the terms D...

State the terms Designing the database and Normalization Designing the database: Out of the ERD we have formed, it is very easy to verify the tables, the attributes which the

Method of analyzing association traversal, Analyzing Association Traversal ...

Analyzing Association Traversal Till now, we have supposed that associations are bi-directional. But in the case of traversal, it is in only one direction in any application,

Ans the following, discuss the array implementation of a stack.

discuss the array implementation of a stack.

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