Richard Ferrers posted response on 2001-04-12 03:05:37:
Hi Wallace,
Here's how I think about it.
Object/tables
1.Employees
2.Classes
3.Comments
4.Bio/Resume
5.Class Subsection
...........
Hi Richard & Wallace:
Just one thought about Richard's proprosed table structure. If each employee has only one resume, and the table strucuture for employees is otherwise fairly simple (consisting of less than 10 fields), then you may want to consider the optionof combining the employees and the resume table together.
Since the relationship is essentially a one-to-one relationship. This will make your mySQL queries to display the employees resume easier.
Structure wise, I thought Richard's overview was great, and that would have been my design schematic if I was developing the database in a client-database system (Access, 4th Dimension, FileMaker, Omnis, etc,)
But as I've been playing around with PHP, I've noticed a certain inefficiency in creating one-to-one relationship tables in mySQL. This seems especially true, when the tables are fairly simple. This of course could just be because my PHP skills aren't strong enough, but...
Think of the final output options of employee info:
1.) employee by name: query just name field
2.) employee brief: name, contact, brief descript.
3.) employee resume: name, contact, bio
These are all one-to-one relationships and it's more efficient to send a mySQL query, that says:
$results=mysql_query ("SELECT * FROM employees");
then define the fields to be used in display ($address = $row["address"]😉, then it is to send multiple queries ...
$results=mysql_query ("SELECT FROM employees");
$results2=mysql_query ("SELECT FROM resumes WHERE employeeid='$id'");
then attempt to join the results in one display.
There's a great article on data normalization at this site, probably one of the easiest to understand explanations that I've seen...
http://www.phpbuilder.com/columns/barry20000731.php3
But sometimes even though the objects are different (employee vs resume) a structure can be reduced by combining tables, when this causes no other discernible inefficiencies. Meaning if the resume table will most likely always be related just to the employee table. The likelihood of you creating a comment system where people ca comment on the resume independently of commenting on the employee is thin, and the employee table is fairly simple...then combining the two tables into one may be benificial.
Alnisa