I Did Not Give or Receive Any Unauthorized Help in Doing This Exam. The Exam Is My Own Work
I Did Not Give or Receive Any Unauthorized Help in Doing This Exam. The Exam Is My Own Work
Directions:
You may use your textbook, notes, course assignments and internet resources. Submit your
file as a word DOCX or PDF file. Check iLearn course page for deadline date and time.
You do not have a time limit for this exam. If you are well prepared it should take about 2
hours. You may use resources such as your computer, textbook and notes from the
class. But do not get help from other people or give help to other students. Sign the honor
pledge below.
I did not give or receive any unauthorized help in doing this exam. The exam is my own work.
5. Dirty read is
a. Reading data that was previously changed in the same transaction.
b. Reading data that been committed by another transaction but has not been written to the log
yet.
c. Reading data that was modified by another transaction before it was rolled back.
6. Nonrepeatable read is
a. Reading data and then later in the same transaction finds that the record has changed.
b. Two requests read the same record and get different values.
c. A request reads a record and then commits. It later reads the record again and finds that it has
changed.
7. The names of the ANSI isolation levels, in order from least to most restrictive are
a. dirty read, non repeatable read, phantom read
b. serializable, repeatable read, read committed
c. read committed, repeatable read, serializable
d. auto commit, read commit, repeatable read, serializable
8. The payroll department accidentally runs the wrong payroll database update program on Friday
at 2:00pm The error is caught a few minutes after the program has terminated normally. The best way
to recover from this error is
a. restore the database to the last backup
b. restore the database to the last backup and apply all log records since the backup
c. restore the database to the last backup and apply all log records between the last backup and
Friday 1:59pm just before the erroneous updates.
d. tell the payroll department that it is too bad and nothing can be done.
9. You attempt to recover a database using the latest backup but find the backup file is
corrupted. What can do you?
a. Nothing. The data is lost.
b. Use the next latest backup and use all logs since that backup.
c. Don’t worry. The DBMS will automatically use the logs to repair the corrupted backup.
10. On Friday at 2:46pm there is an power failure and the database server stops. When power is
restored what should you do?
a. Restore all database to the last backup and apply logs.
b. Do nothing. The DBMS will automatically recovery all committed transactions and undo any
uncommitted transactions.
c. You need to use the logs to undo any uncommitted changes to the data.
d. You need to use the log to redo committed changes that were buffered in RAM and not written
to the hard drive.
e. You need to do both C and D using the appropriate command.
12. If I want to allow user1 to read and update the jrj.customer table I would do the following sql
a. grant update on jrj.customer to ‘user1’@’%’
b. give read, write on jrj.customer to ‘user1’@’%’
c. grant select, update on jrj.customer to ‘user1’@’%’
d. give select, update on jrj.customer to ‘user1’@’%’
13. What does the “WITH GRANT” keyword do on an SQL DCL statement
a. give all privileges owned by the user to another user
b. give specified privileges to another user and allow that user to give them to other users
c. give DBA administrator privileges to the user
d. gives administrator privileges to another user but only for the specified table
The DBMS uses MVCC (multi version concurrency control). The program occasionally receives an SQL error
from the update statement when another concurrent request for the same partno is executing. What
could be done to avoid this error?
a. The way to avoid this error would be setting the isolation level to read uncommitted. This allows
all the four concurrency problems to occur. This isolation level performs the select queries without
setting any locks and without honoring any existing locks. This will allow the select statements to be
executed immediately and also allows the best performance. It would allow the user to run the web
program without running into any errors.
16. Atomic.
i.What does the term “atomic” mean in database processing?
i.An atomic data is the lowest level of detail within the data warehouse. It
provides data for all data transformations. An atomic transaction is an
irreducible series of data operations that all operations happen or nothing
happens.
ii.Why is it important that program work in an “atomic” manner?
.The importance of having the program work in an atomic manner is that it
guarantees the prevention of updates to the database occurring only partially.
This can cause problems but those problems are not as great as rejecting the
whole series outright.
iii.What is the php statement that is used to start a transaction in mysql?
.The php statement that is used to start a transaction in mysql is
PDO::beginTransaction.
iv.What is the php statement that will terminate a successful transaction in mysql?
.The php statement that will terminate a successful transaction in mysql is
PDO::commitTranaction.
18. Specify the SQL CREATE TABLE statements that would be used to implement the following E-R
model . Specify primary and foreign keys constraints. Specify appropriate data types and NULL or NOT
NULL properties for each attribute.
If you need to create (or recreate) the Art Course tables for questions 20 - 29, use the file from iLearn
FinalExam Art Course Tables.sql
20. What are the names of the tables created in the art course database?
a. Course
b. Customer
c. Enrollment
21. What are the names of the columns in the enrollment table?
a. CustomerNumber
b. CourseNumber
c. AmountPaid
23. Describe the type and cardinality of the relationships among the Course, Customer and
Enrollment tables.
a. One to Many from Customer to Enrollment.
b. One to Many from Course to Enrollment.
c. There is no cardinality from course to customer.
24. What are the primary and foreign keys in the enrollment table?
a. The Foreign Keys enroll_course_fk.
b. The Primary customernumber and coursenumber
25. If Course with CourseNumber 1 was deleted from the Course table, would this delete be
successful?
a. The deletion of course number one would be success.
26. What changes would occur in the Enrollment table when courseNumber 1 was deleted?
a. It would be successful because the data would be represented with a null value.
27. If I wanted to prevent the deletion of a course that had active enrollments, what changes would
I make to table definitions?
a. Make data not null values or create a view with the needed data.
28. Is it possible to change the value of a primary key with an update statement? What effect does
this have on the foreign key values in other tables?
a. Yes, it is possible to update unless there is an integrity constraint. If we look back at the art
database the primary key can be switch on table course from course id to course name. The effect that
this change would have on other foreign key values would be eliminating the connection between the
tables.
MySQL supports date-time arithmetic. You can do arithmetic on dates and intervals. Examples are
select curdate();
select curdate() + interval 1 week;
select curdate() – interval 3 day;
More information can be found at
https://dev.mysql.com/doc/refman/5.5/en/date-and-time-functions.html
Study the add_date and date_diff functions. Also see
http://www.mysqltutorial.org/mysql-interval/
update the start dates of all courses with the sql statement
update course
set course date = coursedate + interval 3 year - interval 3 week;
The completion message should indicate that 5 rows were changed.
29. Write an sql SELECT that return courses that start within the next 6 weeks from now. [ The
answer should be courseNumber 3].
a. SELECT courseNumber
b. FROM course
c. WHERE coursedate <= CURDATE() + interval 6 week;
Given a table of biology facts about animals and their habits (the following table shows a portion of data
from the table)
Key CommonName Class Eats LifeExpectancy
1 Cat Mammal mice 15
2 Cat Mammal milk 15
3 Bear Mammal fish 30
1 Cat 15
2 Beer 30
31. Given the table of biological facts above, write a select statement for
a. Find all animals that eat fish.
i.SELECT a.CommonName
ii.FROM animals a
iii.WHERE a.eats LIKE ‘%fish%’
b. Bears only eat fish. What is the select statement and what would be the expected answer be to
show this statement is TRUE?
.SELECT a.CommonName
i.FROM animals a
ii.WHERE a.eats LIKE ‘%fish%’
d. What select statement and result would show that no animal eats sharks is true?
i.Select a.CommonName
ii.FROM animals a
iii.WHERE a.eats LIKE ‘%sharks%’
Essay
32. Describe in a few well written paragraphs recent trends in databases. Include in your answer
what the terms Data Warehouse, ETL, Star-Schema, NoSQL, Hadoop, Distributed Databases, and how
they are used on real world applications.
a. The current trends involving databases consist of four main topics. The first topic is bridging SQL
and NoSQL. SQL also known as Sequel follows the path of the relational model. This offers a very
mathematically adaptive way of structuring the database by keeping and using data. It also benefits the
group-keeping data by constraining the collections as data-tables. This puts the data in a structured way
that relates the user input by allocating values to attributes. The NoSQL doesn’t have a structural model
that it follows, however, there are countless implementations that work differently from each other but
serve a specific need. This type of database is a schema-less solution that allows for an unlimited
amount of entries that are simple but efficient.
b. The second topic is databases in the cloud which is a major move for most companies. Normally
databases are stored on servers, but with them moving to the cloud it allows accessing and managing
them easier for the administration. Also, depending on the company that is offering their services to
store the database they will aid with your goals. I would see where during this transition to cloud-based
database storage that Hadoop would be beneficial. Hadoop is a framework that supports the processing
and storage of extremely large datasets. This would be beneficial to large companies with their
transitions to the cloud to manage their databases.
c. The third topic is an increased focus on the security of databases. Creating a database is a great
way to manage important information and shape it to show trends. The larger company usually have
multiple databases that can correlate with each other using an ETL method. I would understand where
security measures need to be increased as data transfers between databases. Another way to increase
security would be following the star schema design. If each corner contained databases and the middle
was the security it would mean that as the data passes to the next database it would be secure.
d. The last topic is Auto Management. This process is to simplify maintenance, provisioning, patching,
upgrades, updates, and project workflow. This would allow being agile with managing
databases. Having this automatic database management would be beneficial for a data
warehouse. All the data would need to be shaped to present important information to
management and aid them in their future decisions.
Feedback
You are given many surveys during this course to give feedback. Here is one more. But please do take a few minutes to
do this one.
Any other comments you want to make: either positive or negative about anything in this
course? Your feedback will help me to improve the course.