leatherback wrote:I think that
1) Every database system has a need for normalization
2) If there is no relation between the tables, there is not need for relations
3) If you have repeated information in any of your tables, there may be the need for splitting into multiple tables
4) Independent of whether 1,2, 3, .. n persons are adding data to the database, normalization is required
5) A flat file could work, but if you have a lot of different ways to present the data, a database would make sense.
[FONT="Verdana"]
Here is the layout for one of my tables (sorry for the bad formatting):
RecNum int(255) unsigned (NULL) NO PRI (NULL) auto_increment select,insert,update,references
CompanyName varchar(25) latin1_swedish_ci YES (NULL) select,insert,update,references
CompanyCode varchar(20) latin1_swedish_ci YES (NULL) select,insert,update,references
EventDate date (NULL) YES (NULL) select,insert,update,references
StartTime time (NULL) YES (NULL) select,insert,update,references
EndTime time (NULL) YES (NULL) select,insert,update,references
EventAbbr varchar(15) latin1_swedish_ci YES (NULL) select,insert,update,references
EventDescription varchar(120) latin1_swedish_ci YES (NULL) select,insert,update,references
AddedText varchar(120) latin1_swedish_ci YES (NULL) select,insert,update,references
FontColor varchar(35) latin1_swedish_ci YES 0 select,insert,update,references
Priority tinyint(1) unsigned (NULL) YES 3 select,insert,update,references
isSpecialEvent tinyint(1) (NULL) YES 0 select,insert,update,references
SpecialEventTitle varchar(60) latin1_swedish_ci YES (NULL) select,insert,update,references
isLink tinyint(1) (NULL) YES 0 select,insert,update,references
LinkPage varchar(40) latin1_swedish_ci YES (NULL) select,insert,update,references
ArtWork varchar(40) latin1_swedish_ci YES (NULL) select,insert,update,references
MapLink tinyint(1) unsigned (NULL) YES 0 select,insert,update,references
Street varchar(30) latin1_swedish_ci YES (NULL) select,insert,update,references
ZipCode varchar(10) latin1_swedish_ci YES (NULL) select,insert,update,references
DateAdded datetime (NULL) YES (NULL) select,insert,update,references
DateEdited datetime (NULL) YES (NULL) select,insert,update,references
The above table describes a typical calendar event for a given company.
And here is a typical query for getting all the calendar events for "Ajax Co." for, say June, where $date_1 == 2008-06-01 and $date_2 == 2008-06-30:
$sql = "SELECT * FROM $table_name
WHERE CompanyCode = \"$CompanyCode\"
AND EventDate >= \"$date_1\"
AND EventDate <= \"$date_2\"
ORDER BY EventDate, StartTime, EventAbbr";
A typical result set may contain around 100 records, depending upon how many events that company has for the month. The EventAbbr (shorthand description of the event) is displayed on the calendar as a link. The user can click the link for more detailed information for that event (EventDescription and AddedText fields).
Again, nothing too fancy here. Just a straight forward, single table query, with the RecNum field serving as the primary key. Perhaps the only redundant data is the CompanyName field. Now that I am looking at it, this should be placed in a separate table, using the CompanyCode as the PK.
[/FONT]