You are invited to Log in or Register a free Frihost Account!

mysql database table structure

I have done some searching on the web for information on mysql database structure, optimization and such but am not coming up with very good sources. Anyone know of any good sites to investigate or could answer any of my questions below? Any and all help appreciated:)

Setting: I am working on a database scheme for a church website, there are users, varous groups of people, a forum and so forth.

Is there such thing as too many fields in a table?
The user table appears like it is going to have quite a few fields.

Is it more effeciant to have a few more fields in the user table then make a seperate table for a few details on a specific group. For instance: There are what we call 'home_groups' which is just a small group. I have a table of the groups (id, name, location, time) Should I make a table of members (id, group_id, leader?, contact_person?) or should I just add into the users table (group_id, leader?, contact_person?) Each group could have multiple leaders and people to contact.

I am just trying to figure out what's easiest on the system.
Fire Boar
Right, for what you're doing, I'd recommend you just add the extra bits into the users table. Try the field type "bool" for the "is_leader" and "is_contact_person" fields - they take up almost no space.

It's alright, you can normally get away with having quite a few fields in a table on the database without impacting performance. The thing you should watch more than anything is the field type you use. It's very bad form to use "text" for everything, since this takes up a lot of space. Varchar should be used for textual input - with 255 being the maximum length it's ideal for titles, names and so on. Text is good for articles. Bool is good for "yes/no" input and tinyint/smallint/mediumint/int/longint should be used for numerical input.

If you follow the above guidelines, you should have a pretty good database structure.
Related topics
Help importing CSV file into MySQL database
MySQL Set-up Structure - Help!!!
Inserting PHP multidimensional arrays into a mySQL database
Optimizing a mySQL database
PHP MYSQL sorted table
Cron Job to Backup MySQL Database
Mysql database problem
PHPBB MYSQL Database Question.
MySQL database for a forum
Working with Excel, PHP & MySQL. Any Ideas
Mysql database size?
Connect to MySql database
[MySQL database] Password and username
insert data to mySQL database problem
Reply to topic    Frihost Forum Index -> Scripting -> Php and MySQL

© 2005-2011 Frihost, forums powered by phpBB.