Google Answers Logo
View Question
 
Q: Physical database design ( Answered,   0 Comments )
Question  
Subject: Physical database design
Category: Computers > Programming
Asked by: kbourneuf-ga
List Price: $5.00
Posted: 09 Jun 2002 14:13 PDT
Expires: 16 Jun 2002 14:13 PDT
Question ID: 24007
Two questions:
1.)Assume that you have a hard disk file designated to accommodate a
maximum of 1,000 records of 240 bytes each.  Assume that a page is
4,000 bytes in length and that records may not span the pages.  How
many bytes will be needed for this file?
2.)When a student has not chosen a major at a university, the
university often enters a value of "undecided" for the major field. 
Is "undecided" a default value or a way to represent the null value?
Answer  
Subject: Re: Physical database design
Answered By: skermit-ga on 09 Jun 2002 14:40 PDT
 
Hello,

This looks like homework for an OS course (just finished one for my
major).

Question 1)
4000 bytes / 240 bytes = 16.67 records meaning you can store a maximum
of 16 records in each page file without going over. 1000 records / 16
records = 62.5 pages meaning you'll need 63 pages to store all the
records of your database, leaving you with 63 pages * 4000 bytes =
252,000 bytes needed to store the records, compared with the ideal
storage of 240,000 bytes (240 bytes * 1000 records).

Question 2)
"Undecided" is NOT a way to represent the null value because by
definition the null value is a placeholder for the lack of
information. Microsoft's Access (database program) support site
(linked below) states the definition as this:

"In Microsoft Access, a Null value indicates missing data in a field.
A field could contain a Null value because the information is not
known, or because the field doesn't apply to the record. A Null value
is not the same as a value of 0 (zero) or a zero-length string ("")
because those values are defined - you know what they are."

So "undecided" is not a null value because it represents the "choice"
of no major chosen instead of having the null value representing the
college having no data on the "choice" of the student's major whether
or not it is "undecided". Now from a programming standpoint, you can
define the null value in your head as whatever you choose, so if you
are in charge of designing a database you may wish to have the null
value represent "undecided" but it would be a bad choice in
programming because then you would have no way to discern the
"undecided"s from students you have not collected major data from.


Additional Links:

Microsoft Access 97/2000: What Is a Null Value?:
http://office.microsoft.com/assistance/2000/AcWhatIsNull.aspx


Search Strategy:

"null value" on google:
://www.google.com/search?q=%22null+value%22


Thank you for the opportunity to answer your question, if you require
more information, please clarify the question, or if you find this
answer satisfactory, please feel free to rate it. Thank you!

skermit-ga

Request for Answer Clarification by kbourneuf-ga on 09 Jun 2002 15:21 PDT
Hi
Thanks a lot for your quick response.  I'm actually taking a database
management
course.  I reviewed your answer for #1 and I can't for the life of me
figure out where the text covers this material. The chapter is about
"Physical Database Design".  The one part of your answer that confuses
me is if the hard disk file is designated to accomodate a MAXIMUM of
1,000 records of 240 bytes each.  The answer of 252,000 bytes exceeds
the maximum amount.  How can this be?

Clarification of Answer by skermit-ga on 09 Jun 2002 19:24 PDT
"...if hard disk file is designated to accomodate a MAXIMUM of
1,000 records of 240 bytes each.  The answer of 252,000 bytes exceeds
the maximum amount.  How can this be?"

What is confusing is that you're not reading that the maximum file
size is 1,000 records at 240 bytes, you're reading you need a paging
system that can accomodate at a maximum, 1,000 records at 240 bytes.
Due to something called internal fragmentation (see link below) you're
going to need a storage structure (here a file structure, in OS, a
memory structure) which is bigger than the best case scenario (using
240,000 bytes to store the entire database = 1,000 records * 240
bytes). You're "wasting" 160 bytes (4,000 bytes - (16 records * 240))
every page you use due to this memory fragmentation. Because of that,
you'll need 63 pages (see calculations above) and the total file size
will be 63 pages * 4,000 bytes = 252,000 bytes. One more thing, since
you need 63 pages due to the internal fragmentation you can really
store 63 pages * 16 records = 1,008 records in your file, more than
the 1,000 "maximum" you have to work with. But since there's no way to
design a structure system with half a page in a fixed size
partitioning scheme, you have that little wasted space in each page,
and in the last page you're wasting more than half of the page. (2080
bytes = 4000 bytes - (((1000 bytes - (62 pages * 16 records)) * 240
bytes)) Add up all the wasted spaces, 12,000 bytes = 2080 bytes + (62
pages * 160 bytes), and you see why your file's 252,000 bytes, not
240,000 bytes. Sorry if this clarification is a little confusing, I
tried to write everything out step by step.


Additional Links:

Powerpoint slideshow on memory management systems in operating systems
(only concern yourself with slide #9 (substitute memory for file, it's
the same principle):
http://www.utdallas.edu/~janet/CS4348/CLASSNOTES/Chap7.ppt


skermit-ga

Clarification of Answer by skermit-ga on 11 Jul 2002 23:46 PDT
Was my answer satisfactory for your needs? Please take the time to
rate this answer as I have not received a rating for it yet and am
curious as to how well you feel I've answered your question. Thank you
for your question, it was a pleasure answering it.

skermit-ga
Comments  
There are no comments at this time.

Important Disclaimer: Answers and comments provided on Google Answers are general information, and are not intended to substitute for informed professional medical, psychiatric, psychological, tax, legal, investment, accounting, or other professional advice. Google does not endorse, and expressly disclaims liability for any product, manufacturer, distributor, service or service provider mentioned or any opinion expressed in answers or comments. Please read carefully the Google Answers Terms of Service.

If you feel that you have found inappropriate content, please let us know by emailing us at answers-support@google.com with the question ID listed above. Thank you.
Search Google Answers for
Google Answers  


Google Home - Answers FAQ - Terms of Service - Privacy Policy