Results 1 to 4 of 4

Thread: am I right?

  1. #1
    Join Date
    Jun 2005
    Location
    coronado
    Posts
    76

    am I right?

    OK, heres what I'm trying to do,
    I want to be able to keep track of activities along with companies.
    So (I think) I need to have 2 MySQL tables. The first being a Company Table whose fields would be;
    Company_Number (Primary Key),
    Company_name,
    Company_city,
    Company_state,
    Company_description,
    Rationale,
    Contact_name,
    Contact_title,
    Contact_phone,
    Contact_email,
    Medivas_pos.

    The second (Activity) table would only have 5 fields;
    Activity_number (Primary Key),
    Company_Number (Foreign Key so each activity will have one company)
    Activity_date,
    Next_step.

    I want to know if I have the logic figured out in making sure each activity would have a coresponding company attached to it, so I can perform a search by Company_name, as well as by Activity_date.
    Thanks.

  2. #2
    Join Date
    Dec 2002
    Location
    Cape Town, South Africa
    Posts
    75
    More info is always useful regarding the other fields, but yes, if you want to link an activity to a single company, that would be the way to do it.

  3. #3
    Join Date
    Jun 2005
    Location
    coronado
    Posts
    76

    k

    Thanks for the input.
    So, i'm trying to create the table, is the syntax and logic correct?
    CREATE TABLE COMPANY
    (
    C_ID INT NOT NULL AUTO_INCREMENT,
    C_NAME VARCHAR(20),
    C_CITY VARCHAR(20),
    C_STATE VARCHAR(10),
    C_DESC TEXT,
    RATIONALE TEXT,
    contact_NAME VARCHAR(20),
    contact_PHONE VARCHAR(15),
    contact_EMAIL VARCHAR(20),
    MEDIVAS VARCHAR(20),
    PRIMARY KEY (C_ID)
    );

    CREATE TABLE ACTIVITY
    (
    A_ID INT NOT NULL AUTO_INCREMENT,
    C_NUMBER INT NOT NULL,
    A_DATE VARCHAR(20),
    A_DESC TEXT,
    FOREIGN_KEY (C_NUMBER)
    REFRENCES COMPANY(C_ID),
    PRIMARY KEY (A_ID)
    );

  4. #4
    Join Date
    Jun 2005
    Location
    coronado
    Posts
    76
    Thank you, now i've been trying to seach 2 ways, by company name which works, I'm also trying to search by activity date which should daa from each tables The activity info and the coresponding company info...Can you help me!!
    Thanks

Posting Permissions

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