Views Quiz (Variation 2) - Stanford Online

You might also like

Download as pdf or txt
Download as pdf or txt
You are on page 1of 2

20/03/13 Views Quiz (Variation 2) | Stanford Online

Welcome LUIS ICHAICOTO BONCANCA ! Logout

Stanford
Home Course Info University
Course Materials Videos Quizzes Interactive Exercises Exams

Surveys Forum

Views Quiz (Variation 2)


1 of 3
INTRODUCTION
Question 1
Consider the following base tables. Capitalized attributes are primary
RELATIONAL
keys. All non-key attributes are permitted to be NULL.
DATABASES

XML DATA MovieStar(NAME, address, gender, birthdate)


MovieExecutive(LICENSE#, name, address, netWorth)
Studio(NAME, address, presidentLicense#)
JSON DATA

Each of the choices describes, in English, a view that could be created


RELATIONAL with a query on these tables. Which one can be written as a SQL view that
ALGEBRA is updatable according to the SQL standard?

SQL A view "RichExecNums" containing the license number and net worth of
all executives with a net worth of at least $10,000,000.
A view "Birthdays" containing a list of birthdates (no duplicates)
RELATIONAL
belonging to at least one movie star.
DESIGN THEORY
A view "SameBirthday" containing pairs of movie star names where the
movie stars have the same birthdate.
QUERYING XML
A view "StudioPresInfo" containing the studio name, executive name, and
license number for all executives who are studio presidents.
UNIFIED
MODELING
LANGUAGE

2 of 3
INDEXES
Question 2
TRANSACTIONS Consider the following schema:

CONSTRAINTS Book(ISBN, title, year) // ISBN and title cannot be NULL


AND TRIGGERS Author(ISBN, name) // ISBN and name cannot be NULL

and the following view definition over this schema:


VIEWS
Prerequisite: SQL, Create View V as
Constraints and Triggers Select Book.ISBN, count(*)
From Book, Author
 Defining and
Where Book.ISBN = Author.ISBN
Using Views
And Author.name Like 'A%'
 View And Book.year > 2000
Modifications Group By Book.ISBN
Introduction
 View This view is not updatable according to the SQL standard, for a number of
Modifications reasons. Which of the following is a valid reason for the view being non-
Using Triggers updatable according to the standard?

 Automatic View
Book.year is omitted from the view
Modifications
The condition Book.year > 2000
 Materialized
NULL values are not permitted in Book.title
Views
The condition Author.name Like 'A%'
 Views Quiz
 SQL Movie-
Rating View
Modification
class2go.stanford.edu/db/Winter2013/problemsets/ViewsQuizVariation2 1/2
20/03/13 Views Quiz (Variation 2) | Stanford Online
Exercises (core 3 of 3
Question 3
set)
Suppose a table T(A,B,C) has the following tuples: (1,1,3), (1,2,3), (2,1,4),
 SQL Movie-
Rating View (2,3,5), (2,4,1), (3,2,4), and (3,3,6). Consider the following view definition:
Modification
Exercises Create View V as
(challenge- Select A+B as D, C
level) From T
 SQL Movie-
Rating View
Modification Consider the following query over view V:
Exercises
(extra practice)
Select D, sum(C)
AUTHORIZATION From V
Group By D
Having Count(*) <> 1
RECURSION

Which of the following tuples is in the query result?


ON-LINE
ANALYTICAL (4,6)
PROCESSING
(5,7)
(5,9)
NOSQL SYSTEMS
(3,5)

EXAMS

MATERIALS
Save Answers Submit Answers

SOFTWARE
GUIDES

EXTRA
PROBLEMS

Help/FAQs
Contact
My profile

Pow ered by Class2Go

Stanford University Home Maps & Directions Search Stanford Terms of Use
Copyright Complaints Technical Support
© Stanford University, Stanford, California 94305

class2go.stanford.edu/db/Winter2013/problemsets/ViewsQuizVariation2 2/2

You might also like