Database questionin mysql tables

Discussion in 'Software' started by Bone, Dec 29, 2007.

  1. Bone

    Bone Private E-2

    Hello guys, I am currently trying to create a database for my website and have run into a snag. I am fairly new to database programming so bear with me. I created two tables, one called state and the other college,

    the state one contains 51 fields which are ID, statename and abbrev. The ID is a primary field.

    The college one contains two fileds, one being ID which connects the masterdetail relationship back to states and the other being links. Basically when someone clicks a state button on the page im building I want a vertical list to appear down the center of the apge with all the colleges in that state in link form. How do I fix the structure of the second table to do this. I assume i need more then one college links fields?

    Thanks in advance
     
  2. Bone

    Bone Private E-2

    this is where im lost. how do i set up the college table so each url is connected to the correct id. im lost. the state tables primary key is ID whivh is th relationship to the college table. im lost
     
  3. Bone

    Bone Private E-2

    I think I might be wording this wrong. Inside the database I am trying to figure out how to create the college table. I need an ID that is a foreign key, and I need to put in about 20 college names per state. How would I create this table?
     
  4. Wookie

    Wookie Sergeant Major

    This is going to be a 1:M ratio, (one to many)

    Sounds like the second table would just need two fields, state(foreign key) and a college name. Then you can select from that table based on the state name to pull back all of the colleges
     

MajorGeeks.Com Menu

Downloads All In One Tweaks \ Android \ Anti-Malware \ Anti-Virus \ Appearance \ Backup \ Browsers \ CD\DVD\Blu-Ray \ Covert Ops \ Drive Utilities \ Drivers \ Graphics \ Internet Tools \ Multimedia \ Networking \ Office Tools \ PC Games \ System Tools \ Mac/Apple/Ipad Downloads

Other News: Top Downloads \ News (Tech) \ Off Base (Other Websites News) \ Way Off Base (Offbeat Stories and Pics)

Social: Facebook \ YouTube \ Twitter \ Tumblr \ Pintrest \ RSS Feeds