Professional Documents
Culture Documents
Bank of Question in One Files PDF
Bank of Question in One Files PDF
a. Serial schedule
b. Nonserial schedule
c. non-serial,
d. serializable
e. schedules
f. lost updates
g. uncommitted data
h. Transaction
i. ACID properties ( Atomicity- Consistency - Isolation - Durability
j. Partially committed
k. Aborted
l. Committed
m. Terminated
n. Serial execution
o. Conflict of operations
p. Conflict serializability
4. transfer the following table to BCNF
1. Consider money is transferred from (1)account-A to account-B and (2)
account-B to account-A. Which of the following ? form a transaction
a) Only 1
b) Only 2
c) Both 1 and 2 individually
d) Either 1 or 2
2. Identify the characteristics of transactions .
a) Atomicity
b) Durability
c) Isolation
d) All of the mentioned
3. Which of the following has “all-or-none” property?
a) Atomicity
b) Durability
c) Isolation
d) All of the
4. The database system must take special actions to ensure that
transactions operate .
a) Atomicity
b) Durability
c) Isolation
d) All of the mentioned
5. The property of a transaction that persists all the crashes is
a) Atomicity
b) Durability
c) Isolation
d) All of the mentioned
6. states that only valid data will be written to the database ……………….
a) Consistency
b) Atomicity
c) Durability
d) Isolation
7. A transaction may not always complete its execution successfully. Such
a transaction is termed
a) Aborted
b) Terminated
c) Closed
d) All of the mentioned
8. second transaction until the first one is completed
a) Consistency
b) Atomicity
c) Durability
d) Isolation
9. If a transaction is performed in a database and committed, the changes
are taken to the. previous state of transaction by
a) Flashback
b) Rollback
c) Both Flashback and Rollback
d) Cannot be done
10. When the transaction finishes the final statement, the transaction enters
into
a) Active state
b) Committed state
c) Partially committed state
d) Abort state
11. Which of the following is an atomic sequence of database actions?
a) Transaction
b) Concurrency
c) Relations
d) All of the mentioned
12. means that data used during the execution of a transaction cannot be
used by a _______ second transaction until the first one is completed
a) Serializability
b) Atomicity
c) Isolation
d) Time stamping
13. Which of the following is not a state in transaction?
a) Active
b) Terminated
c) Aborted
d) Partially committed
14. In the __________ normal form, a composite attribute is converted to
individual attributes .
a) First
b) Second
c) Third
d) Fourth
15. Functional Dependencies are the types of constraints that are based on .
a) Key
b) Key revisited
c) Superset key
d) None of the mentioned
16. Which is a bottom-up approach to database design that design by
examining the relationship between attributes
a) Functional dependency
b) Database modeling
c) Normalization
d) Decomposition
Bank of Questions
Database Management system
No Question Answer
all the following are Databases Properties except
a) Persistence
1 b) Sharing d) Hashing
c) Interrelated
d) Hashing
Relations produced from an E-R model will always be in …………
a) 1 NF
2 b) 2 NF c) 3 NF
c) 3 NF
a) BCNF
The natural join is equal to: d)
a) Cartesian Product Combination
3 b) Combination of Union and Cartesian product of projection
c) Combination of selection and Cartesian product and Cartesian
d) Combination of projection and Cartesian product product
Given the basic ER and relational models, which of the following is c) In a row of
INCORRECT? a relational
a) An attribute of an entity can has more than one value table, an
b) An attribute of an entity can be composite attribute can
4
c) In a row of a relational table, an attribute can have more than one have more
value than one
d) In a row of a relational table, an attribute can have exactly one value
value or a NULL value
d) None of
A logical schema
these
a) Is the entire database
b) Is a standard way of organizing information into a accessible
5
part
c) Describe how data is actually stored on disk
d) None of these
d) All the
The result of the UNION operation between R1 and R2 is a relation
tuples of R1
that includes ………. ?
and R2
a) All the tuples of R1
6 which have
b) All the tuples of R2
common
c) All the tuples of R1 and R2
columns
d) All the tuples of R1 and R2 which have common columns
A function Dependency is a relationship between or among
a) Table
7 b) Rows d) Attributes
c) Relations
d) Attributes
In the relational model, cardinality is termed as:
a) A number of tuples
a) A number
8 b) A number of attributes
of tuples
c) A number of tables
d) A number of constraints
Which of the following statement is not correct? d) Candidate
a) Non-key attributes are attributes other than candidate key key which
attributes are not
9 b) Non-prime Attributes are attributes other than Primary attribute selected for
c) Super Key is a superset of Candidate key primary key
d) Candidate key which are not selected for primary key are are known as
known as Foreign key. Foreign key
Which database level is closest to the users?
a) External
10 b) Internal a) External
c) Physical
d) Conceptual
In case of entity integrity, the primary key may be…..…….
a) Not Null
11 b) Null a) Not Null
c) Both Null & not Null
d) Any value
Which of the following is TRUE?
c) Every
a) Every relation in 3NF is also in BCNF
relation in
b) A relation R is in 3NF if every non-prime attribute of R is fully
12 BCNF is
functionally dependent on every key of R
also in
c) Every relation in BCNF is also in 3NF
3NF
d) No relation can be in both BCNF and 3NF
d) independe
The conceptual model is ……..….. nt of both
a) dependent on hardware hardware
13 b) dependent on software and
c) dependent on both hardware and software software
d) independent of both hardware and software.
Which key is used to relate two different table?
a) Primary key
d) Both a
14 b) Foreign key
and b
c) Candidate key
d) Both a and b
The Systems Development Life Cycle (SDLC) consist of
a) Planning
d) All of
15 b) Analysis
these
c) Implementation
d) All of these
…………… is a special type of integrity constraint that relates two
relations & maintains consistency across the relations
b) Referential
a) Entity Integrity Constraints
16 Integrity
b) Referential Integrity Constraints
Constraints
c) Domain Integrity Constraints
d) Domain Constraints
DBMS helps achieve
a) Data independence d) both (a)
17 b) Centralized control of data and (b)
c) Neither (a) nor (b)
d) both (a) and (b)
A set of possible data values is called
a) Attribute
18 b) Degree d) Domain
c) Tuple
d) Domain
a) that there
must not
Second Normal form requires ………….
be any
a) that there must not be any partial dependency of any column on
partial
primary key
dependen
19 b) that every non-prime attribute of table must be dependent on
cy of any
primary key
column
c) that each column must have a unique value
on
d) None of the above
primary
key
The Database System Environment consists of
a) Hardware
20 b) DBMS software b) a and b
c) a and b
d) None of these
In a relation
a) Ordering of rows is unimportant c) a and b
21 b) No two rows are identical both are
c) a and b both are true true
d) None of these.
................... are defined as the set of fields from which primary key
can be selected.
a) Super Key b) Candidate
22
b) Candidate key key
c) Secondary Key
d) Composite Key
In the relational modes, cardinality is termed as
a) Number of tuples
a) Number
23 a) Number of attributes
of tuples
b) Number of tables
b) Number of constraints
Database is collection of………….
a) None of these
c) Data
25 b) Programs
c) Data
d) Information
The attribute name could be structured as an attribute consisting of
first name, middle initial, and last name. This type of attribute is
called
b) Composite
26 a) Simple attribute
attribute
b) Composite attribute
c) Multivalued attribute
d) Derived attribute
The attribute AGE is calculated from DATE_OF_BIRTH. The
attribute AGE is
a) Single valued
28 d) Derived
b) Multi valued
c) Composite
d) Derived
Not applicable condition can be represented in relation entry as
a) NA
b) 0
29 c) NULL
c) NULL
d) Blank Space
Which of the following can be a multivalued attribute?
a) Phone number a) Phone
30 b) Name number
c) Date of birth
d) All of the mentioned
An entity in A is associated with at most one entity in B, and an
entity in B is associated with at most one entity in A. This is called
as
b) One-to-
31 a) One-to-many
one
b) One-to-one
c) Many-to-many
d) Many-to-one
An entity in A is associated with at most one entity in B. An entity
in B, however, can be associated with any number (zero or more) of
entities in A.
d) Many-to-
32 a) One-to-many
one
b) One-to-one
c) Many-to-many
d) Many-to-one
DBMS stands for…………...
d) Database
a) Database Basic Management System
Managem
33 b) None of these
ent
c) Database Administrator System
System
d) Database Management System
A relational database developer refers to a record as
a) a criteria
34 b) a relation c) a tuple
c) a tuple
d) an attribute
A file manipulation command that extracts some of the records from
a file is called
a) Select a) Select
35
b) Project
c) Join
d) Product
Which of the following is not basic element of a part of ER
modeling?
a) Entities d) Primary
36
b) Attributes key
c) Relationships
d) Primary key
a) column
containing
Foreign key is:
the
a) Column containing the primary key of another table
primary
37 b) Used to define data types
key of
c) Used to define null status
another
d) All of the above are above correct
table.
• Unary relationship
• Ternary relationship
Draw an E-R diagram for each of the following situations (if you believe that you
need to make additional assumptions, clearly state them for each situation):
a. A company has a number of employees. The attributes of EMPLOYEE include
Employee-ID (identifier), Name, Address, and Birth date. The company also has
several projects. Attributes of PROJECT include Project-ID (identifier), Project-
Name, and Start - Date. Each employee may be assigned to one or more projects,
or may not be assigned to a project. A project must have at least one employee
assigned, and may have any number of employees assigned. An employee's
billing rate may vary by project, and the company wishes to record the applicable
billing rate (Billing-Rate) for each employee when assigned to a particular
project.
b. A university has a large number of courses in its catalog. Attributes of COURSE
include Course-Number (identifier), Course Name, and Units. Each course may
have one or more different courses as prerequisites, or may have no
prerequisites. Similarly, a particular course may be a prerequisite for any number
of courses, or may not be prerequisite for any other course.
c. A college course may have one or more scheduled sections, or may not have a
scheduled section. Attributes of COURSE include Course ID, Course Name, and
Units. Attributes of SECTION include Section-Number and Semester-ID.
Semester-ID is composed of two parts: Semester, and Year. Section-Number is
an integer (such as "1" or "2") that distinguishes one section from another for
the same course but does not uniquely identify a section.
d. The entity type STUDENT has the following attributes: Student-Name, Address,
Phone, Age, Activity, and No-of-Years. Activity represents some campus-based
student activity, while No-of-Years represents the number of years the student
has engaged in this activity. A given student may engage in more than one
activity Draw an F-R diagram for this situation.
Introduction to Databases
PWSP CLASS
DATABASE MANAGEMENT
Books M Written By
N Authors
N 1
Published By Is A
1 1
Publishers Contributor
PubName ConType
N N
ConRate Consulting ProdQty Product ProdPrice
ConHours ProdName
Title Requests
Buys CustID
N N ProdID
Purchase
Date
Quantity
ConRate Consulting ProdQty Product
SupStreet ProdName
1
SupID Supplier N Supplies
SupName SupPhone
SupCity SupPhone
SupZip
Address
N
Has ProdType
SupPhone ProdName
1
N M
SupID Supplier Supplies Items ProdDesc
SupName ProdID
Purchase
ssn Admission
fname
PatientSSN DepartmentId id
lname
location
1 M N
Patients Admitted To Departments
M name
sex M 1
PatientSSN N head
Insurance
Pat/Treatment Get Occupy has A
TreatmentID name
N
id
duration N N N
Description
id
Equipment
1
N
N EquipmentNo
Get Rental
starttime length N MeetingId
Date MeetingId
M
number Meeting 1
name
GroupNumber RoomId id
ContactPhone
Capacity
1 M N
Group Rents Room
id
M 1
head
Get has A
id
N
Building type
1
Assignment
id StartDate EndDate
id
name
M N
Employee Rents Project Name
Address
StartDate
DateOfBirth
1
Project/Chemist
id
id
name
M N
Chemist Works on Project Name
Address M N
StartDate
Phone
Assigned to
N
Equipment
SerialNo Cost
3/4/2007 Sanjay Goel, School of Business, University at Albany 64
E-R Diagrams
Video Rental Store
• You were hired by Blockywood Video to design a database for their video rental system. Luckily, you have
had some experience renting videos (every Saturday night!) and you know that the video store needs to be
able to information about customers, movies, and distributors.
• A movie title (e.g. Lord Voldemort of the Rings) has an ID number generated by the store. In addition,
there is a title, release date, rating (G, PG-13, etc.), and price category (a newly released movie tends to be
more expensive). Other movie related information saved is the director, producer, principal actor, and
principal actress.
• Jane Doe is a customer and to rent movies, she is the owner of a Blockywood Video card which is scanned
every time she makes a purchase. To obtain a card the owner needs to be above 18 (checked during
application). The account associated with the card has a specific ID number (generated by the store), as
well as the owner name (Jane Doe), her address, phone number, credit card information (optional), and
amount credited/debited to the account. Additionally, she has both her husband (John Doe) and her son
Jimmy Doe listed as other authorized users on the account and a rating for Jimmy of PG-13, which means
that the video rental store is not allowed to let him have access to a higher rating video. Her husband also
owns a Blockywood Video card in which Jane and Jimmy are listed as authorized users.
• Distributors have organizational names, an address, representative, and phone number. Videos are
purchased from distributors on a specific date for a specific price. There can be multiple videos with the
same movie title. Videos are also given a unique id number.
• The video rental system allows for a video rental history, which maintains the video rented, rental date, card
that it was rented with, return date, and amount paid. This information helps the recommendation of new
videos and to maintain accounts. The video rental system should also be able to specify the maximum
number of videos a customer can rent and the amount of time a movie can be late until the account is
frozen.
3/4/2007 Sanjay Goel, School of Business, University at Albany 65
Price Date
E-R Diagrams
Credit/Debit Amount AccountId MovieId
Video Rental Store
CreditCardNumber
Rental
N N
MaxMoviesAllowed
1 1
PrimaryMemberId
Account Admitted By Video Is of a
N M N
AccountId
M 1
VideoId Type
FreezeLimit
PriceCategory
MemberId MovieId Director
Get N
Membership
PrincipalActor
AccountId Title
N N 1
PrincipalActress
1 Producer
Member
ReleaseDate Rating
name MemberId
Movie MovieId
MovieId 1
rating M
N
Type
Invoice Sold By
Assumptions:
1. Multiple distributors can sell same movie Number N
2. Each member can be many accounts and the same account
N
can have many members 1
Distributor phone
3. Video rental store does not track the origin of a specific video Price
from the distributor
4. Media type was added as additional attribute to the video name RepName
(VHS or DVD)
Zip_Code
Address
City State
Employee_Id
1
8
Assigned To SalesOffice Lists
1
Office_Number 8
8
Property_ID
ManagerID
8
City
1
8
8
Employee_Lname
1 Address
Employee Manages Property
Employee_Fname State
1
8
Office_Number
Zip_Code
8
Employee_Id
Owner_Id
8
Owner Owns Property_ID
Owner_Lname
8
Percent_Owned
3/4/2007 Owner_Id
Sanjay Owner_Fname
Goel, School of Business, University at Albany 68
E-R Diagrams
Concerts
• After completing a course in database management, you have been asked to
develop an E-R diagram for a symphony orchestra. The symphony orchestra
has the following characteristics
• A concert season schedules one or more concerts. A particular concert is
scheduled for only one concert season.
• A concert includes the performance of one or more compositions. A
composition may be performed at one or more concerts, or may not be
performed.
• For each concert there is one conductor. A conductor may conduct any
number of concerts, or may not conduct any concerts.
• Each composition may require one or more soloists, or may not require a
soloist. A soloist may perform one or more compositions at a given concert,
or may not perform any composition. The symphony orchestra wishes to
record the date when a soloist last performed a given composition.
• Some other attributes of interest are the names and contact information of the
soloist, composer and the location of the concert. The following entities are
evident from the above discussion, i.e. ConcertSeason, Concert, Composition,
Conductor, Soloist. Based on the above observations define what the
appropriate relationships and attributes in the schema and construct an E-R
diagram.
3/4/2007 Sanjay Goel, School of Business, University at Albany 69
E-R Diagrams
Concerts location date
time
1 time
ConcertSeason Schedules
duration
N
N
Concert Conducts
season 1
N
N
1 lname
concert/composition Includes
SoloId Conductor
N
N
fname
1
Composition phone email
1
N
N ComId
Played
soloist/composition By
N
N
lname
1
Soloist
fname
phone email
SoloId
3/4/2007 Sanjay Goel, School of Business, University at Albany 70
E-R Diagrams
Quick Oil
• Design the database and show an E-R Diagram for the case below. For
many-to-many entities, show the additional tables that you would create.
• Quick Oil Company is in the business of changing engine oil for its
customers. In addition to changing oil, the company also performs
other services such as changing wipers, light bulbs etc. There are several
technicians assigned to a car as it comes in for an oil change. They
maintain the name, address, social security number, phone, and
email address of the customer. In addition, the services that the
customers purchase at different times are tracked. For each service, they
store the name of the service, the cost of the service, description of
the service, and number of hours of labor for the service. They
maintain employee information including name, phone, social
security number, address, date-of-birth, date-of-hire, and their
hourly salary in the database. They also sell parts and the name,
manufacturer, cost, weight and number of items of each part is stored.
A list of parts is maintained in the database and customers that bought
each part are tracked.
3/4/2007 Sanjay Goel, School of Business, University at Albany 71
E-R Diagrams Count
Weight
PartName
Date EmployeeSSN Buys Part/Customers
SSN
labor name CustomerSSN
name N
M
Description Service Work N Customer
Cost street
city SSN
state Name
zip email
N phone
1 Employee name
street
phone
city
SSN
state
DateOfBirth
zip
DateOfHire
Salary
1
CR_Id
Interviewer_Id
Street
Held In
Interviewer_Lname Interviewer_Fname Interview_Date
State Interviewer_Id Interview_Id
Posting_Id
8
Interview_Id
Zip_Code
8
8
Assigned CR_Id
Interviewer Interview
1 To 1
8
8
City Interview_Time
8
Student_Id
Interviewer_Id
Address Interview_Duration
Works
Conducted
For
For
State Company_Id std_lname std_fname
std_id Phone
8
Zip_Code
1 1 Posts 1
8
8
Email
8
Company Posts Job_Posting Student
For
8
8
City
Major
Job_Description Salary_Range City
Address Name
Posting_Id Street
Posting_ID
Zip_Code
Email Posting_Title
Street Student_Id State
3/4/2007 Sanjay Goel, School of Business, University at AlbanyApply_Date 74
Phone Posting_Date Posting_Time
Company_Id Apply_Time
E-R Diagrams
Handy Man
With a busy work life, home owners have difficulty in finding
help for chores around the house and garden. Different jobs
require different skills, such as, carpentry, plumbing, electrical
wiring, etc. Several people have these skills and spare time to
work on projects but are unable to find places for part time
employment. This business entails connecting people who have
jobs with workers willing to work on those jobs in their spare
time. The workers should be able to list their contact information
and skills. The employers should be able to list the jobs and the
skills required for each job. The business model of the company is
to get an enrollment fee for joining the network for both the
home owners and the workers. Please design a database and
create an E-R Diagram for the database
fname
lname
workerid Grade
semester city
memberId 1
1
N N
Job Accepts Worker street
1 1 zip
memberid
Provides N phone
N Takes
Gets Acceptance
firstname
email
lastname 1 Salary
JobID gender
Home Owner WorkerID
Homephone
workphone
semester
StudentId
Enrollment CourseID
section
studentid
semester
firstname
M N
Student Take Offering year
lastname
N time
DateOfBirth
Results in daysofweek
room
1
CourseID
Course
CreditHours
description
3/4/2007 Sanjay Goel, School of Business, University at Albany 78
E-R Diagrams
Conference Center Bookings
Instructions: Draw an entity relationship diagram for the case, stating any
assumptions you deem necessary.
Case: A conference centre takes bookings from clients who wish to hold
courses or conferences at the centre. When clients make bookings they specify
how many people are included in the booking, and of these, how many will be
resident during the booking, and how many will require catered or non-catered
accommodation at the centre. The centre contains a number of facilities which
may be required by clients making bookings as follows:
A. There are 400 bedrooms for clients who will be resident during the Course
or conference.
B. A maximum of 250 catered people can be handled at any one time.
C. Six main lecture theatres providing seating for 200 people.
D. Twenty seminar rooms each able to accommodate 25 people.
E. Video conference facilities. The video conference facilities consist of four
separate video conference networks. Each video conference network has a
large screen based in one of the main lecture theatres, along with 3 satellite
screens each of which is based in one of the seminar rooms.
Index
• Review of Relational Algebra
o Set Theoretic Operations
o Union, Intersection and Difference
o Union Compatible Relations
o Cartesian Product
o Selection and Projection
Selection Operator
Selection Examples
Projection Operator
Projection Examples
Combining Selection and Projection
o Aggregate Functions
o Join Operations
Join Examples
Natural Join
Outer Join
o Outer Union
• Recall, the Relational Model consists of the elements: relations, which are made
up of attributes.
• A relation is a set of attributes with values for each attribute such that:
1. Each attribute value must be a single value only (atomic).
2. All values for a given attribute must be of the same type (or domain).
3. Each attribute name must be unique.
4. The order of attributes is insignificant
5. No two rows (tuples) in a relation can be identical.
6. The order of the rows (tuples) is insignificant.
• Relational Algebra is a collection of operations on Relations.
• Relations are operands and the result of an operation is another relation.
• Two main collections of relational operators:
1. Set theory operations:
Union, Intersection, Difference and Cartesian product.
2. Specific Relational Operations:
Selection, Projection, Join, Division
• Union: R S
Result: Relation with tuples from R and S with duplicates removed.
• Difference: R - S
Result: Relation with tuples from R but not from S
• Intersection: R S
Result: Relation with tuples that appear in both R and S.
R S
R-S
R S
Exercises
• Assume relation T
fName lName Score
William Smith 44
Sally Green 28
Mary Kontrary 27
• Compute R T
Compute R T
Show that R - T is not equal to T - R
Cartesian Product
• Produce all combinations of tuples from two relations.
Dinner Dessert
Steak Ice Cream
Lobster Cheesecake
RXS
T F T F
T F
T T F T T T
F T
F F F F T F
Selection Examples
• Select only those Employees with last name Smith who are assistant professors:
Name = 'Smith' Rank = 'Assistant' (EMP)
Result:
• Select only those Employees who are either Assistant Professors or in the
Economics department:
Rank = 'Assistant' Dept = 'Econ' (EMP)
Result:
• Select only those Employees who are not in the CS department or Adjuncts:
(Rank = 'Adjunct' Dept = 'CS') (EMP)
Result:
Exercises
For this expression, use R and S from the Set Theoretic Operations section
above.
Projection Operator
Projection Examples
Name Dept
Smith CS
Jones Econ
Green Econ
Brown CS
Smith Fin
Name
Smith
Brown
• Show the name and rank of those Employees who are not in the CS department or
Adjuncts:
name, rank ( (Rank = 'Adjunct' Dept = 'CS') (EMP) )
Result:
Name Rank
Green Assistant
Smith Associate
Exercises
For this expression, use R and S from the Set Theoretic Operations section
above.
Aggregate Functions
MIN(salary)
35000
AVG(salary)
51000
• Count the number of employees in the CS department: COUNT (name) ( Dept = 'CS'
(EMP) )
Results:
COUNT(name)
• Find the total payroll for the Economics department: SUM (salary) ( Dept = 'Econ'
(EMP) )
Results:
SUM(salary)
85000
Join Operation
• Join operations bring together two relations and combine their attributes and
tuples in a specific fashion.
Join Examples
555-
Jones 220 Econ 35000 Econ 200
1234
555-
Green 160 Econ 50000 Econ 200
1234
555-
Brown 420 CS 65000 CS 404
1212
555-
Smith 500 Fin 60000 Fin 501
4321
• Find all information on every employee including their department info where the
employee works in an office numbered less than the department main office:
EMP (emp.office < depart.mainoffice) (emp.dept = depart.dept) DEPART
Results:
Natural Join
• Notice in the generic (Theta) join operation, any attributes in common (such as
dept above) are repeated.
• The Natural Join operation removes these duplicate attributes.
• The natural join operator is: *
• We can also assume using * that the join condition will be = on the two attributes
in common.
• Example: EMP * DEPART
Results:
Outer Join
• In the Join operations so far, only those tuples from both relations that satisfy the
join condition are included in the output relation.
• The Outer join includes other tuples as well according to a few rules.
• Three types of outer joins:
1. Left Outer Join includes all tuples in the left hand relation and
includes only those matching tuples from the right hand relation.
2. Right Outer Join includes all tuples in the right hand relation and
includes ony those matching tuples from the left hand relation.
3. Full Outer Join includes all tuples in the left hand relation and from
the right hand relation.
• Examples:
PEOPLE: MENU:
Name Age Food Food Day
Tacos Friday
Outer Union
• The Outer Union operation is applied to partially union compatible relations.
• Operator is: *
• Example: PEOPLE * MENU