Docsity
Docsity

Prepare for your exams
Prepare for your exams

Study with the several resources on Docsity


Earn points to download
Earn points to download

Earn points by helping other students or get them with a premium plan


Guidelines and tips
Guidelines and tips

Database Management System: Understanding Views and Their Uses, Slides of Introduction to Database Management Systems

An in-depth exploration of views in database management systems. It covers the creation of views using different attribute names and computed attributes, as well as the nesting of views. The document also explains how views can include data from multiple tables through joins. Additionally, it discusses the rules for updating data in views.

Typology: Slides

2011/2012

Uploaded on 11/03/2012

dharmaraaj
dharmaraaj 🇮🇳

4.4

(65)

153 documents

1 / 22

Toggle sidebar

This page cannot be seen from the preview

Don't miss anything!

bg1
Database
Management
System
Lecture - 40
Docsity.com
pf3
pf4
pf5
pf8
pf9
pfa
pfd
pfe
pff
pf12
pf13
pf14
pf15
pf16

Partial preview of the text

Download Database Management System: Understanding Views and Their Uses and more Slides Introduction to Database Management Systems in PDF only on Docsity!

Database

Management

System

Lecture - 40

Dynamic Views Example

CREATE VIEW st_view1 AS (select stName, stFname, prName from student WHERE prName = 'MCS') View can be referred in SQL statements like tables

With Check Option

CREATE VIEW st_view2 AS (select stName, stFname, prName from student WHERE prName = ‘BCS') WITH CHECK OPTION

SELECT * FROM ST_VIEW

Update ST_VIEW2 set prName = ‘MCS’ Where stFname = ‘Loving’

Characteristics of Views

Different attribute names

CREATE VIEW st_view3 (name, abbaG, pata) as (select stname, stfname, stadres from student)

Characteristics of Views

Computed attributes Nesting of views CREATE VIEW enr_view AS (select * from enroll) CREATE VIEW enr_view1 as (select stId, crcode, smrks, mterm, smrks + mterm sessional from enr_view)

CREATE VIEW st_pr_view AS (select stName, stFname, student.prName, prcredits FROM student, program WHERE student.prname = program.prname)

SELEC * FROM st_pr_view

  • SELECT * FROM st_view
  • SELECT * FROM ST_VIEW
  • SELECT * FROM ST_VIEW
  • Select * from enr_view
  • SELECT * FROM st_cr_enr_view

Updating Data

If single table, updation piece of cake (with check option) We can even insert data, BUT  Not through computed attribute  Cannot miss “Not NULL” attributes  One of the multiple tables  Not in case of aggregate functions

 ALTER VIEW st_view1 as (SELECT stId, stName, stFname, prName from student where prName = 'MCS’) WITH CHECK OPTION

 INSERT INTO st_view values ('S1044', ‘Ali Raza', ‘M. Raza ', 'BCS')