Home » DBMS

Views in Database Management System (DBMS)

DBMS Views: Here, we are going to learn about the views in Database Management Systems. What are the view, how views are helpful to see the data and how to create views in DBMS?
Submitted by Anushree Goswami, on May 29, 2019

DBMS College professor once realized that students feel sad when they see their friend's marks higher than them and it creates a negative impact on them. It gave the Professor an idea to create a view table in his student academic result database.

In the database, View is a virtual table that combines the result set of a stored query. It is very important when we want to restrict a certain user from accessing the entire database. View is dynamic and can be computed from the data in the database. Changing the data in a table alters the data shown in the view as well.

When the Professor applies this technique, the student got to see their marks only and thus create a positive impact on the students as they are now competing with the one person only, themselves.

In a relational database, a view is not the part of a relational schema.

1. Create view

Syntax to create a view:

    create or replace
    view view_name
    as
    select column_name1, column_name2,...
    from table_name
    where condition;

Example:

Suppose, we have to create a student view table of view10.

create
view view10
select marks from student
where rollno = 10;

2. Drop View

Syntax to drop a view:

    drop view viewname;

Example:

If view10 table has to be dropped, the command looks like:

drop view view10;

Advantages of a view in DBMS

  1. Views can subset the data in a table.
  2. Views can join and simplify the tables in a virtual table.
  3. Views do not require additional storage.
  4. Views can hide the complexity of the database and the data the user must hide that.
  5. Views can act as aggregated tables where aggregated data (sum, average, etc.) are calculated and presented as part of data.
  6. Views can provide additional security from unauthorized users and unauthorized access.

Disadvantages of a view in DBMS

Database view may be slow if it is approved from a view table that is generated from another view.






Comments and Discussions

Ad: Are you a blogger? Join our Blogging forum.
Learn PCB Designing: PCB DESIGNING TUTORIAL







Languages: » C » C++ » C++ STL » Java » Data Structure » C#.Net » Android » Kotlin » SQL
Web Technologies: » PHP » Python » JavaScript » CSS » Ajax » Node.js » Web programming/HTML
Solved programs: » C » C++ » DS » Java » C#
Aptitude que. & ans.: » C » C++ » Java » DBMS
Interview que. & ans.: » C » Embedded C » Java » SEO » HR
CS Subjects: » CS Basics » O.S. » Networks » DBMS » Embedded Systems » Cloud Computing » Machine learning » CS Organizations » Linux » DOS
More: » Articles » Puzzles » News/Updates

© https://www.includehelp.com some rights reserved.