Creating a view-data control, Database Management System

Assignment Help:

Creating a view:

  • A query can be embedded within the CREATE VIEW STATEMENT
  • A query can have complex select statements containing join, groups and sub- queries
  • A query that describes the view cannot contain an order by clause.
  • DML operation (delete/ add / modify) cannot be applied if the view have any of the following:

 

Delete (You can't delete if view contains following)

Modify (you cannot modify if view contains following)

Insert (you cannot insert if view contains following)

  • Group functions
  • A group by clause
  • A distinct keyword
  • Group functions
  • A group by clause
  • A distinct keyword
  • Columns defined by

Expressions

  • Group functions
  • A group by clause
  • A distinct keyword
  • Columns defined by

Expressions

  • There are Not Null Columns in the base tables that are not selected by view.

Example:  Create a view named employee salary having minimum, maximum and average salary for every department.

CREATE VIEW EMPSAL (NAME, MINSAL, MAXSAL, AVGSAL) AS

SELECT D.DNAME, MIN(E.SAL),MAX(E.SAL),AVG(E.SAL)

 FROM EMP E, DEPT D

WHERE E.DEPTNO=D.DEPTNO GROUP BY D.DNAME;

To view the result of the command above you can give the following command:

SELECT * FROM EMPSAL;

You may get some sample output like:

NAME   MINSAL          MAXSA                 AVG                    SAL

--------------         ---------                ---------         -------------

ACCOUNTING            1300                      5000           2916.6667

RESEARCH                 800                      3000               2175

SALES                      950                      2850           1566.6667

To view the structure of the view so created, the command is given below:

DESCRIBE EMPSAL;

Name                                                 Null?                   Type

---------------                                   ------------   ---------------------

NAME                                                VARCHAR2           (14)

MINSAL                                               NUMBER

MAXSAL                                              NUMBER

AVGSAL                                              NUMBER

 


Related Discussions:- Creating a view-data control

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

In the architecture of a database system which external leve, In the archit...

In the architecture of a database system which external level used? In the architecture of a database system view external level used.

Design of distributed databases, Design Of Distributed Databases: The dist...

Design Of Distributed Databases: The distributed databases are mainly relational at local level. So a local database schema is the similar as that of a centralised database design

Key constraint - relational constraints, This constraint shows that the key...

This constraint shows that the key attribute value in each tuple must be unique, i.e., no two tuples have the similar value for the key attribute. This is because the value of the

Describe different steps of object-oriented design process, Describe differ...

Describe different steps of the object-oriented design process.  The broad steps of the object-oriented design process are: a. Define context and modes of use of the system

Sql queries, find a name whose address is erode from student table

find a name whose address is erode from student table

Oracle, Extend your CREATE TABLE statement from problem 3 with referential ...

Extend your CREATE TABLE statement from problem 3 with referential integrity constraints. Updates and deletes on related rows are restricted. 6. From examination of the sample data

Create an entity relationship diagram, Cyber Transit Ltd keeps up-to-date i...

Cyber Transit Ltd keeps up-to-date information on the processing and current position of each dispatched item. Dispatched items are the main concern of the Cyber Transit product tr

What is system r, What is System R? What are its two major subsystems? ...

What is System R? What are its two major subsystems? System R was intended and developed over a period of 1974-79 at IBM San Jose Research Center. It is a prototype and its pur

Organize the clients from email marketing, Function requirement as given: ...

Function requirement as given: 1> manage fans and likes and followings those information from facebook. twitter. google+ and linkedin etc 2> Organize the clients from email m

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