SitePoint Sponsor

User Tag List

Results 1 to 3 of 3
  1. #1
    SitePoint Guru
    Join Date
    Sep 2008
    Posts
    977
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    table structure question

    Hi,

    Making a few tables for a picture gallery. just ask for clarification that this is the best way to construct the tables. I am not sure about the hierarchical table structure that rudy has referred to before. I can't quite get the input to it, of data, sorted in my noggin so if it would be a better way, please try to point me to a tutorial or somewhere that I can work out its workings.

    here is my thought so far

    Code MySQL:
    create table images
    ( image varchar (32) not null primary key
    ) engine=innodb default charset=latin1;
     
    create table gallery_categories
    ( category varchar(32) not null primary key
    ) engine=innodb default charset=latin1;
     
    create table categories_images
    ( category varchar(32) not null
    , image varchar(32) not null
    , primary key (category,image)
    ) engine=innodb default charset=latin1;

    bazz

  2. #2
    SQL Consultant gold trophysilver trophybronze trophy
    r937's Avatar
    Join Date
    Jul 2002
    Location
    Toronto, Canada
    Posts
    39,267
    Mentioned
    60 Post(s)
    Tagged
    3 Thread(s)
    is it the best way?

    if an image can be in more than one category, then yes

    rudy.ca | @rudydotca
    Buy my SitePoint book: Simply SQL
    "giving out my real stuffs"

  3. #3
    SitePoint Guru
    Join Date
    Sep 2008
    Posts
    977
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    great rudy, thanks.

    bazz


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •