MySQL Help
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me
Go Back   Dev Shed ForumsDatabasesMySQL Help

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread Dev Shed Forums Sponsor:
  #1  
Old August 8th, 2005, 02:27 PM
lucilue2003 lucilue2003 is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Jan 2004
Posts: 30 lucilue2003 User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 5 h 36 m 14 sec
Reputation Power: 5
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;

Reply With Quote
  #2  
Old August 9th, 2005, 12:30 AM
Chagh Chagh is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: May 2005
Posts: 118 Chagh User rank is Lance Corporal (50 - 100 Reputation Level)Chagh User rank is Lance Corporal (50 - 100 Reputation Level)Chagh User rank is Lance Corporal (50 - 100 Reputation Level) 
Time spent in forums: 2 Days 11 h 45 m 35 sec
Reputation Power: 4
hi
see normalization on google and DBDebunk.
and create index and query optimization for indexes.

Chagh

Reply With Quote
  #3  
Old August 9th, 2005, 07:11 AM
Guelphdad's Avatar
Guelphdad Guelphdad is offline
Headed to unemployment
Dev Shed God 5th Plane (7000 - 7499 posts)
 
Join Date: Nov 2001
Location: Guelph Canada
Posts: 7,137 Guelphdad User rank is Brigadier General (60000 - 70000 Reputation Level)Guelphdad User rank is Brigadier General (60000 - 70000 Reputation Level)Guelphdad User rank is Brigadier General (60000 - 70000 Reputation Level)Guelphdad User rank is Brigadier General (60000 - 70000 Reputation Level)Guelphdad User rank is Brigadier General (60000 - 70000 Reputation Level)Guelphdad User rank is Brigadier General (60000 - 70000 Reputation Level)Guelphdad User rank is Brigadier General (60000 - 70000 Reputation Level)Guelphdad User rank is Brigadier General (60000 - 70000 Reputation Level)Guelphdad User rank is Brigadier General (60000 - 70000 Reputation Level)Guelphdad User rank is Brigadier General (60000 - 70000 Reputation Level)Guelphdad User rank is Brigadier General (60000 - 70000 Reputation Level)Guelphdad User rank is Brigadier General (60000 - 70000 Reputation Level)Guelphdad User rank is Brigadier General (60000 - 70000 Reputation Level) 
Time spent in forums: 2 Months 1 Week 6 Days 12 h 49 m 51 sec
Reputation Power: 623
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.

Last edited by Guelphdad : August 9th, 2005 at 07:24 AM.

Reply With Quote
Reply

Viewing: Dev Shed ForumsDatabasesMySQL Help > mysql setting up good tables (design help)


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump


Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 6 hosted by Hostway