A
Exercise Solutions
Chapter 1
Exercise 1 Solution
The following list summarizes how the book provides (or doesn’t) database goals:
❑ CRUD: This book doesn’t let you easily CREATE information. You could write in new
information but there isn’t much room for that and that’s not really its purpose. The book
lets you READ information, although it’s hard for you to find a particular piece of infor-
mation (unless it is listed in the table of contents or the index). You can UPDATE informa-
tion by crossing out the old information and entering the new. You can also highlight key
ideas by underlining, by using a highlighter, and by putting bookmarks on key pages.
Finally, you can DELETE data by crossing it out.
❑ Retrieval: The book’s mission in life is to let you retrieve its data, although it can be hard
to find specific pieces of information unless you have bookmarked them, or they are in the
table of contents or the index.
❑ Consistency: I’ve tried hard to make the book’s information consistent. If you start making
changes, however, it will be extremely hard to ensure that you make related changes to
other parts of the book.
❑ Validity: The book provides no data validation. If you write in new information, the book
cannot validate your data. (If you write, ‘‘Normalization rocks!’’ the book cannot verify
that it indeed rocks.)
❑ Easy Error Correction: Correcting one error is easy; simply cross out the incorrect data
and write in the new data. Correcting systematic errors (for example, if I’ve methodically
misspelled ‘‘the’’ as ‘‘thue’’ and the editors didn’t catch it) would be difficult and time con-
suming.
www.it-ebooks.info
,Appendix A: Exercise Solutions
❑ Speed: The book’s structure will hopefully help you learn database design relatively efficiently
but a lot relies on your reading ability.
❑ Atomic Transactions: The book doesn’t really support transactions of any kind, much less
atomic ones.
❑ ACID: Because it doesn’t support transactions, the book doesn’t provide ACID.
❑ Persistence and Backups: The book’s information is non-volatile so you won’t lose it if the book
‘‘crashes.’’ If you lose the book or it is destroyed (my dog ate it), you can buy another one but
you’ll lose any updates you have written into it. You can buy a second copy and backup your
notes into it but the chances of a tornado destroying your book are low and the consequences
aren’t all that earth-shattering, so I’m guessing you’ll just take your chances.
❑ Low Cost and Extensibility: Let’s face it, books are pretty expensive these days, although not as
expensive as even a cheap computer. You can easily buy more copies of the book but that isn’t
really extending the amount of data. The closest thing you’ll get to extensibility is buying a dif-
ferent database-related book or perhaps buying a notebook to improve your note taking.
❑ Ease of Use: This book is fairly easy to use. You’ve probably been using books for years and are
familiar with its user interface.
❑ Portability: It’s a fairly large book but you can reasonably carry it around. You can’t read it
remotely the way you can a computerized database, but you can carry it on a bus.
❑ Security: The book isn’t password protected but it doesn’t contain any top-secret material, so if it
is lost or stolen you probably won’t be as upset by the loss of its data as by the loss of the concert
tickets that you were using as a bookmark. It’ll also cost you a bit to buy a new copy if you can’t
borrow someone else’s.
❑ Sharing: After you lose your copy, you could read over the shoulder of a friend and you could
borrow someone else’s book. Sharing isn’t as easy as it would be for a computerized database,
however, so you might just want to splurge and get a new copy.
❑ Ability to Perform Complex Calculations: Sorry, not in this edition.
Overall the book is a reasonably efficient read-only database with limited search and correction capa-
bilities. As long as you don’t need to make too many corrections, it’s a pretty useful tool. The fact that
instructional books have been around for a long time should indicate that they work pretty well.
Exercise 2 Solution
This book provides a table of contents to help you find information about general topics and an index to
help you find more specific information if you know the name of the concept that you want to study.
Features that help you find information in less obvious ways include the introductory chapter that
describes each chapter’s concepts in more detail than the table of contents does, and references within
the text.
Exercise 3 Solution
CRUD stands for the four fundamental database operations: Create (add new data), Read (retrieve data),
Update (modify data), and Delete (remove data from the database).
404
www.it-ebooks.info
, Appendix A: Exercise Solutions
Exercise 4 Solution
A chalkboard provides:
❑ Create: Use chalk to write on the board.
❑ Read: Look at the board.
❑ Update: Simply erase old data and write new data.
❑ Delete: Just erase the old data.
A chalkboard has the following advantages over a book:
❑ CRUD: It’s easier to create, read, update, and delete data.
❑ Retrieval: Though a chalkboard doesn’t provide an index, it usually contains much less data
than a book so it’s easier to find what you need.
❑ Consistency: Keeping the data consistent isn’t trivial but again, because there’s less data than in
a book, you can find and correct any occurrences of a problem more easily.
❑ Easy Error Correction: Correcting one error is trivial; just erase and write in the new data. Cor-
recting systematic errors is harder but a chalkboard contains a lot less data than a book so fixing
all of the mistakes is easier.
❑ Backups: You can easily backup a chalkboard by taking a digital picture of it. (This is actually
more important than it may seem in a research environment where chalkboard discussions can
contain crucial data.)
❑ Ease of Use: A chalkboard is even easier to use than a book. Toddlers who can’t read can still
scribble on a chalkboard.
❑ Security: It’s relatively hard to steal a chalkboard nailed to a wall.
❑ Sharing: Usually everyone in the room can see what’s on a chalkboard at the same time. This is
one of the main purposes of chalkboards.
A book has the following advantages over a chalkboard:
❑ Persistence: A chalkboard is less persistent. For example, someone brushing against the chalk-
board may erase data. (I once had a professor who did that regularly and always ended the
lecture with a stomach covered in chalk.)
❑ Low Cost and Extensibility: Typically books are cheaper than chalkboards, at least large ones.
❑ Portability: Books typically aren’t nailed to a wall.
The following database properties are roughly equivalent for books and chalkboards:
❑ Validity: Neither provides features for validating new or modified data against other data in the
database.
❑ Speed: Both are limited by your reading (and writing) speed.
❑ Atomic Transactions: Neither provides transactions.
405
www.it-ebooks.info
, Appendix A: Exercise Solutions
❑ ACID: Neither provides transactions so neither provides ACID.
❑ Ability to Perform Complex Calculations: Neither can do this (unless you have some sort of
fancy interactive computerized book or chalkboard).
In the final analysis, books contain a lot of information and are intended for use by one person, whereas
chalkboards hold less information and are tools for group interaction. Which you use depends on which
of these features you need.
Exercise 5 Solution
A recipe card file has the following advantages over a book:
❑ CRUD: It’s easier to create, read, update, and delete data in a recipe file. Updating and deleting
data is also more aesthetically pleasing. In a book, these changes require you to cross out old data
and optionally write in new data in a place where it probably won’t fit too well. In a recipe file,
you can replace the card containing the old data with a completely new card.
❑ Consistency: Recipes tend to be self-contained so this usually isn’t an issue.
❑ Easy Error Correction: Correcting one error in the recipe file is trivial; just replace the card that
holds the error with one that is correct. Correcting systematic errors is harder but less likely to be
a problem. (What are the odds that you’ll mistakenly confuse metric and English units and mix
up liters and tablespoons? Although NASA and Lockheed managed to mix metric and English
to crash a $125 million Mars orbiter. See www.cnn.com/TECH/space/9909/30/mars.metric .)
❑ Backups: You could back up a recipe file fairly easily. In particular, it would be easy to make
copies of any new or modified cards. I don’t know if anyone (except perhaps Martha Stewart)
does this.
❑ Low Cost and Extensibility: It’s extremely cheap and easy to add a new card to a recipe file.
❑ Security: You could lose a recipe file but it will probably stay in your kitchen most of the time.
Someone could break into your house and steal your recipes but you’d probably give copies to
anyone who asked (except for your top-secret Death-by-Chocolate Brownies recipe).
A book has the following advantages over a recipe file:
❑ Retrieval: A recipe file’s cards are sorted, essentially giving it an index, but a book also provides
a table of contents. With this kind of recipe file, it would be hard to simultaneously sort cards
alphabetically and group them by type (entrée, dessert, aperitif, midnight snack).
❑ Persistence: The structure of a recipe file is slightly less persistent than that of a book. If you drop
your card file down the stairs, the cards will be all mixed up. (Although that may be a useful way
to pick a random recipe if you can’t decide what you want to eat.)
The following database properties are roughly equivalent for books and recipe files:
❑ Validity: Neither provides features for validating new or modified data against other data in the
database.
❑ Speed: Both are limited by your reading (and writing) speed.
❑ Atomic Transactions: Neither provides transactions.
❑ ACID: Neither provides transactions so neither provides ACID.
406
www.it-ebooks.info
Exercise Solutions
Chapter 1
Exercise 1 Solution
The following list summarizes how the book provides (or doesn’t) database goals:
❑ CRUD: This book doesn’t let you easily CREATE information. You could write in new
information but there isn’t much room for that and that’s not really its purpose. The book
lets you READ information, although it’s hard for you to find a particular piece of infor-
mation (unless it is listed in the table of contents or the index). You can UPDATE informa-
tion by crossing out the old information and entering the new. You can also highlight key
ideas by underlining, by using a highlighter, and by putting bookmarks on key pages.
Finally, you can DELETE data by crossing it out.
❑ Retrieval: The book’s mission in life is to let you retrieve its data, although it can be hard
to find specific pieces of information unless you have bookmarked them, or they are in the
table of contents or the index.
❑ Consistency: I’ve tried hard to make the book’s information consistent. If you start making
changes, however, it will be extremely hard to ensure that you make related changes to
other parts of the book.
❑ Validity: The book provides no data validation. If you write in new information, the book
cannot validate your data. (If you write, ‘‘Normalization rocks!’’ the book cannot verify
that it indeed rocks.)
❑ Easy Error Correction: Correcting one error is easy; simply cross out the incorrect data
and write in the new data. Correcting systematic errors (for example, if I’ve methodically
misspelled ‘‘the’’ as ‘‘thue’’ and the editors didn’t catch it) would be difficult and time con-
suming.
www.it-ebooks.info
,Appendix A: Exercise Solutions
❑ Speed: The book’s structure will hopefully help you learn database design relatively efficiently
but a lot relies on your reading ability.
❑ Atomic Transactions: The book doesn’t really support transactions of any kind, much less
atomic ones.
❑ ACID: Because it doesn’t support transactions, the book doesn’t provide ACID.
❑ Persistence and Backups: The book’s information is non-volatile so you won’t lose it if the book
‘‘crashes.’’ If you lose the book or it is destroyed (my dog ate it), you can buy another one but
you’ll lose any updates you have written into it. You can buy a second copy and backup your
notes into it but the chances of a tornado destroying your book are low and the consequences
aren’t all that earth-shattering, so I’m guessing you’ll just take your chances.
❑ Low Cost and Extensibility: Let’s face it, books are pretty expensive these days, although not as
expensive as even a cheap computer. You can easily buy more copies of the book but that isn’t
really extending the amount of data. The closest thing you’ll get to extensibility is buying a dif-
ferent database-related book or perhaps buying a notebook to improve your note taking.
❑ Ease of Use: This book is fairly easy to use. You’ve probably been using books for years and are
familiar with its user interface.
❑ Portability: It’s a fairly large book but you can reasonably carry it around. You can’t read it
remotely the way you can a computerized database, but you can carry it on a bus.
❑ Security: The book isn’t password protected but it doesn’t contain any top-secret material, so if it
is lost or stolen you probably won’t be as upset by the loss of its data as by the loss of the concert
tickets that you were using as a bookmark. It’ll also cost you a bit to buy a new copy if you can’t
borrow someone else’s.
❑ Sharing: After you lose your copy, you could read over the shoulder of a friend and you could
borrow someone else’s book. Sharing isn’t as easy as it would be for a computerized database,
however, so you might just want to splurge and get a new copy.
❑ Ability to Perform Complex Calculations: Sorry, not in this edition.
Overall the book is a reasonably efficient read-only database with limited search and correction capa-
bilities. As long as you don’t need to make too many corrections, it’s a pretty useful tool. The fact that
instructional books have been around for a long time should indicate that they work pretty well.
Exercise 2 Solution
This book provides a table of contents to help you find information about general topics and an index to
help you find more specific information if you know the name of the concept that you want to study.
Features that help you find information in less obvious ways include the introductory chapter that
describes each chapter’s concepts in more detail than the table of contents does, and references within
the text.
Exercise 3 Solution
CRUD stands for the four fundamental database operations: Create (add new data), Read (retrieve data),
Update (modify data), and Delete (remove data from the database).
404
www.it-ebooks.info
, Appendix A: Exercise Solutions
Exercise 4 Solution
A chalkboard provides:
❑ Create: Use chalk to write on the board.
❑ Read: Look at the board.
❑ Update: Simply erase old data and write new data.
❑ Delete: Just erase the old data.
A chalkboard has the following advantages over a book:
❑ CRUD: It’s easier to create, read, update, and delete data.
❑ Retrieval: Though a chalkboard doesn’t provide an index, it usually contains much less data
than a book so it’s easier to find what you need.
❑ Consistency: Keeping the data consistent isn’t trivial but again, because there’s less data than in
a book, you can find and correct any occurrences of a problem more easily.
❑ Easy Error Correction: Correcting one error is trivial; just erase and write in the new data. Cor-
recting systematic errors is harder but a chalkboard contains a lot less data than a book so fixing
all of the mistakes is easier.
❑ Backups: You can easily backup a chalkboard by taking a digital picture of it. (This is actually
more important than it may seem in a research environment where chalkboard discussions can
contain crucial data.)
❑ Ease of Use: A chalkboard is even easier to use than a book. Toddlers who can’t read can still
scribble on a chalkboard.
❑ Security: It’s relatively hard to steal a chalkboard nailed to a wall.
❑ Sharing: Usually everyone in the room can see what’s on a chalkboard at the same time. This is
one of the main purposes of chalkboards.
A book has the following advantages over a chalkboard:
❑ Persistence: A chalkboard is less persistent. For example, someone brushing against the chalk-
board may erase data. (I once had a professor who did that regularly and always ended the
lecture with a stomach covered in chalk.)
❑ Low Cost and Extensibility: Typically books are cheaper than chalkboards, at least large ones.
❑ Portability: Books typically aren’t nailed to a wall.
The following database properties are roughly equivalent for books and chalkboards:
❑ Validity: Neither provides features for validating new or modified data against other data in the
database.
❑ Speed: Both are limited by your reading (and writing) speed.
❑ Atomic Transactions: Neither provides transactions.
405
www.it-ebooks.info
, Appendix A: Exercise Solutions
❑ ACID: Neither provides transactions so neither provides ACID.
❑ Ability to Perform Complex Calculations: Neither can do this (unless you have some sort of
fancy interactive computerized book or chalkboard).
In the final analysis, books contain a lot of information and are intended for use by one person, whereas
chalkboards hold less information and are tools for group interaction. Which you use depends on which
of these features you need.
Exercise 5 Solution
A recipe card file has the following advantages over a book:
❑ CRUD: It’s easier to create, read, update, and delete data in a recipe file. Updating and deleting
data is also more aesthetically pleasing. In a book, these changes require you to cross out old data
and optionally write in new data in a place where it probably won’t fit too well. In a recipe file,
you can replace the card containing the old data with a completely new card.
❑ Consistency: Recipes tend to be self-contained so this usually isn’t an issue.
❑ Easy Error Correction: Correcting one error in the recipe file is trivial; just replace the card that
holds the error with one that is correct. Correcting systematic errors is harder but less likely to be
a problem. (What are the odds that you’ll mistakenly confuse metric and English units and mix
up liters and tablespoons? Although NASA and Lockheed managed to mix metric and English
to crash a $125 million Mars orbiter. See www.cnn.com/TECH/space/9909/30/mars.metric .)
❑ Backups: You could back up a recipe file fairly easily. In particular, it would be easy to make
copies of any new or modified cards. I don’t know if anyone (except perhaps Martha Stewart)
does this.
❑ Low Cost and Extensibility: It’s extremely cheap and easy to add a new card to a recipe file.
❑ Security: You could lose a recipe file but it will probably stay in your kitchen most of the time.
Someone could break into your house and steal your recipes but you’d probably give copies to
anyone who asked (except for your top-secret Death-by-Chocolate Brownies recipe).
A book has the following advantages over a recipe file:
❑ Retrieval: A recipe file’s cards are sorted, essentially giving it an index, but a book also provides
a table of contents. With this kind of recipe file, it would be hard to simultaneously sort cards
alphabetically and group them by type (entrée, dessert, aperitif, midnight snack).
❑ Persistence: The structure of a recipe file is slightly less persistent than that of a book. If you drop
your card file down the stairs, the cards will be all mixed up. (Although that may be a useful way
to pick a random recipe if you can’t decide what you want to eat.)
The following database properties are roughly equivalent for books and recipe files:
❑ Validity: Neither provides features for validating new or modified data against other data in the
database.
❑ Speed: Both are limited by your reading (and writing) speed.
❑ Atomic Transactions: Neither provides transactions.
❑ ACID: Neither provides transactions so neither provides ACID.
406
www.it-ebooks.info