COMPSCI 186 Study Guide - Midterm Guide: Timeflies

14 views12 pages
8 Jan 2019
School
Professor
Midterm2:CS186,Spring2015
Prof.J.Hellerstein

You should receive a double-sided answer sheet and an 8-page exam.
Mark your name and login on both sides of the answer sheet, and in the blanks above.
For each question, place only your final answer on the answer sheet—do not show work or
formulas there.
You may use the backs of the questions for scratch paper, but do not tear off any pages.
We will ask you to turn in your question sheets as well as your answers.
 
1
Unlock document

This preview shows pages 1-3 of the document.
Unlock all 12 pages and 3 million more documents.

Already have an account? Log in
I.ERDiagrams[18points]
1.[4points]TrueorFalse:
a. ERdiagramsareusedtomodelthephysicalschemaofadatabase.
False,theyareusedtomodelthelogicalschema.Physicalschemareferstothings
likefileandindexlayout.
b. AnentitysetEcanbeassociatedwitharelationshipsetRmorethanonce.
True,forexamplearelationshipReports_TowhichhastheentityEmployees
participatingtwice,sinceManagersarealsoEmployees.
c. Atmost2distinctentitysetscanbeassociatedwithanyrelationshipsetR.
False,forexample,aternaryrelationship“Covers”withparticipatingentities
Employees,Dependents,andPolicies.
d. Aweakentitysetmusthavetotalparticipationinitsidentifyingrelationshipset.
True,bydefinition.
ChancellorDirkswantsyoutoexplainhowarelationaldatabasemanagementsystem,
(e.g.Postgres)works.DirksisfamiliarwithreadingERdiagrams,sowe'vecreatedthe
diagrambelow,butitismissingafewedges.
Answerquestions2to5choosingthebestoptionfromthefollowingmultiplechoiceoptions:
A.partialparticipation,nonkey 
B.partialparticipation,key 
C.totalparticipation,nonkey
D.totalparticipation,key
E.noneoftheabove
2.[2point]WhatisthecorrectedgebetweenTableRowandTable?
Aatablehas0ormorerows
2
Unlock document

This preview shows pages 1-3 of the document.
Unlock all 12 pages and 3 million more documents.

Already have an account? Log in
3.[2point]WhatisthecorrectedgebetweenTableColumnandTable?
Catablehas1ormorecolumns
4.[2point]WhatisthecorrectedgebetweenColumnandPrimaryKey?
BEachcolumnparticipatesinatmostoneprimarykey.Thereisatmostoneprimarykey,
theremaybenone,andevenifthereisonenoteverycolumnwillbeinit.
5.[2point]WhatisthecorrectedgebetweenTableandPrimaryKey?
AAtablemayhaveaprimarykeywith0columns(meaningitdoesn’thaveaprimarykey),1
column,ormanycolumns,sothetablecanparticipateinthePrimaryKeyrelationship0or
moretimes.
ERtoSQL
6.[6points]Onyouranswersheet,fillintheblankstoconverttheRowentityset,andthe
TableColumnrelationshipsetintheERdiagramaboveintoSQLtables.Youmaynotneed
alltheblanks.
CREATE TABLE Row (
rid INTEGER
PRIMARY KEY (rid)
);
CREATE TABLE TableColumn (
tname STRING,
cname STRING,
col_position INTEGER,
FOREIGN KEY (tname)
REFERENCES Table
FOREIGN KEY (cname)
REFERENCES Column
PRIMARY KEY (tname, cname)
);
 
3
Unlock document

This preview shows pages 1-3 of the document.
Unlock all 12 pages and 3 million more documents.

Already have an account? Log in

Document Summary

You should receive a double-sided answer sheet and an 8-page exam. Mark your name and login on both sides of the answer sheet, and in the blanks above. For each question, place only your final answer on the answer sheet do not show work or formulas there. You may use the backs of the questions for scratch paper, but do not tear off any pages. We will ask you to turn in your question sheets as well as your answers. Create table tablecolumn ( tname string, cname string, col_position integer, [5 points] which of the following changes to the above schedule will result in a schedule that is possible using strict two phase locking? ( mark all that apply : make t1 abort instead of commit, make t2 abort instead of commit, remove r(a) from t1 and t3, remove t2 from the schedule, make t3 write to a page d instead of page b.