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)

    create table help plz

    Hi,

    I am trying to create a table for listing events in a club. Some events are three day events and others are daily events. I am struglging to work out how to differentiate between the two types and ask for your help.

    here is my table so far

    Code mysql:
    create table if not exists events
    ( event_id int not null
    , event_name varchar(32) not null
    , description varchar (255) not null
    , start_date date not null
    , end_date date not null
    , opening_time time not null
    , closing_time time not null
    , primary key (event_id)
    key (start_date,end_date)
    key (event_name)
    ) engine=innodb default chartset=latin1;

    If I were to keep it like this, would adding a daily event which lasts for a week be quite tedious because each would have to be added as if separate events?

    bazz

  2. #2
    SQL Consultant gold trophysilver trophybronze trophy
    r937's Avatar
    Join Date
    Jul 2002
    Location
    Toronto, Canada
    Posts
    39,347
    Mentioned
    63 Post(s)
    Tagged
    3 Thread(s)
    you have 2 columns for start and end dates, and 2 columns for opening and closing times

    so i assume that this is intended to allow things like "Todd's Fabulous Band", this week from Tuesday thru Saturday, each night from 5 p.m. until 1 a.m.

    i would imagine you could differentiate a 3-day event from a 1-day event by checking to see if start_date was equal to end_date, but as you have anticipated, this means if you have 5 consecutive one-day events, you'd have 5 rows, but if you had a 5-day event, you'd have only one row

    i'm not sure i understand your problem, because this seems fairly simple to me

    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)
    Thanks rudy I think you have cleared up my mind.

    If adding an event which lasts for five days eg motor show, there would then be five rows and I (now), expect my processing script should be used to input five rows based on a form entry saving the admin from inputting 5 different entries.

    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
  •