|
|
|
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
#1
|
|||
|
|||
|
mysql setting up good tables (design help)
Hello all,
I wanted to ask for some help. I'm taking a giant step. My goal is to learn about stored procedures, PEAR in php, OOP in php and good DB Design. The project that i choose for myself has all this. I was hoping if the community here can tell me if im' doing a good job or not or what i should change or consider addign... so here it is. My Project: I want to create a MYSPACE.COM, FRIENDSTER.COM type of site. I have created over 44 tables, and the most important is below. The table below was designed to encompass all attributes of other table.. a table of foreign keys... I figured that when a person signs in, and they perform a search to find people in there area, or people with similar interest, or back ground.. it would access this table. Would this be a good setup.. Is the table too big and can it slow down my search ? Waht about creating indexes ( i dont know waht this is .. still researching..) Code:
CREATE TABLE TblMemberProfiles ( TblMember_member_id int(11) NOT NULL default '0', gender int(1) NOT NULL default '0', birthday int(8) NOT NULL default '0', zip_code int(5) NOT NULL default '0', TblCountries_id int(11) NOT NULL default '0', TblPhotos_id int(11) NOT NULL default '0', AboutMe blob NOT NULL, WhoYouWanttoMeet blob NOT NULL, ReceiveNewslettersandSpecialUpdates int(1) NOT NULL default '0', ReceiveFriendUpdates int(1) NOT NULL default '0', DisplayMyBirthdaytoFriends int(1) NOT NULL default '0', block_list varchar(255) NOT NULL default '', TblActivityLevel_id int(11) NOT NULL default '0', TblAppearance_id int(11) NOT NULL default '0', TblAttractiveFeatures_id int(11) NOT NULL default '0', TblComplexion_id int(11) NOT NULL default '0', TblEyeColor_id int(11) NOT NULL default '0', TblEyeSight_id int(11) NOT NULL default '0', TblHairColor_id int(11) NOT NULL default '0', TblUSZipCodes_id int(11) NOT NULL default '0', TblBody_id int(11) NOT NULL default '0', TblHeight_id int(11) NOT NULL default '0', TblExercise_id int(11) NOT NULL default '0', TblDiet_id int(11) NOT NULL default '0', TblCareer_id int(11) NOT NULL default '0', TblOccupation_id int(11) NOT NULL default '0', TblEducation_id int(11) NOT NULL default '0', TblIncome_id int(11) NOT NULL default '0', TblLanguage_id int(11) NOT NULL default '0', TblMaritalStatus_id int(11) NOT NULL default '0', TblChildren_id int(11) NOT NULL default '0', TblFavouriteActivities_id int(11) NOT NULL default '0', TblFavouriteCuisines_id int(11) NOT NULL default '0', TblFavouriteMusic_id int(11) NOT NULL default '0', TblFavouritePlaces_id int(11) NOT NULL default '0', TblFavouriteReading_id int(11) NOT NULL default '0', TblPersonalityTraits_id int(11) NOT NULL default '0', TblPhysicalActivites_id int(11) NOT NULL default '0', TblOutgoing_id int(11) NOT NULL default '0', TblPreferTo_id int(11) NOT NULL default '0', TblPolitics_id int(11) NOT NULL default '0', TblPreference_id int(11) NOT NULL default '0', TblReligiousBelief_id int(11) NOT NULL default '0', TblDrinking_id int(11) NOT NULL default '0', TblSmoking_id int(11) NOT NULL default '0', TblWeight_id int(11) NOT NULL default '0', PRIMARY KEY (TblMember_member_id) ) TYPE=MyISAM; |
|
#2
|
|||
|
|||
|
hi
see normalization on google and DBDebunk. and create index and query optimization for indexes. Chagh |
|
#3
|
||||
|
||||
|
I'd also look to use a smaller data type than blob, unless you really think you want folks writing 64K worth of material about themselves in these two fields.
You would also probably want to look at a full text index on those two fields regardless of what data type you use for them. Also I'm not sure exactly what info you would have in your int(11) fields and whether or not you would be able to get away with using tinyint or smallint in those places. If it is just to designate smoker as 1 and non smoker as 0 for instance I'd use tinyint. You will save vastly on storage space. The (11) after the int btw just shows how many characters you are going to display, it doesn't limit the size of the variable it can hold.
__________________
MySQL - reformat varchar dates to proper date type || MySQL - room vacancies || output results with column names with mysql only Latest row per group || Deleting duplicates || Gaps in auto increment column My site: sql help articles Last edited by Guelphdad : August 9th, 2005 at 07:24 AM. |
![]() |
| Viewing: Dev Shed Forums > Databases > MySQL Help > mysql setting up good tables (design help) |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|