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

Advantages of Observation Methods, Advantages of Observation  Methods: ...

Advantages of Observation  Methods: Bailey has pointed  out four  advantages of observation: 1. Superior in Data  Collection  on Non Verbal Behavior: When  a person  a opi

Er diagram, Draw an ER diagram for company''s database schema

Draw an ER diagram for company''s database schema

Which components of the schema architecture proposed by ansi, What are thre...

What are three components of the schema architecture proposed by ANSI/SPARC? The three component schema architecture proposed by ANSI/SPARC is as given below: External sche

Misuse of data or a database, As with other software, databases can potenti...

As with other software, databases can potentially be used for unethical purposes. As a database developer, and a consumer, you should recognize database misuse, and how it may affe

State the component diagram, State the Component Diagram A component d...

State the Component Diagram A component diagram represents a set of component and relationships among them. In a dynamic model, component diagram is used to model physical com

Create a database schema, Consider a database schema consisting of four rel...

Consider a database schema consisting of four relations, whose schemas are: Product (maker, model, type) PC (model, speed, ram, hd, price) Laptop (model, speed, ram, hd, s

Structure of client server systems, Structure of Client Server Systems: In ...

Structure of Client Server Systems: In client/server architecture, clients show users who require services while servers give services. Both client and server are a combination of

Normalization, in case of functional dependencies how we get the higher nor...

in case of functional dependencies how we get the higher normal form.

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