Results 1 to 2 of 2

Thread: How to query the names of subclasses

Threaded View

  1. #2
    Join Date
    Mar 2007
    Posts
    16
    You need to tell us more about the relations between your tables, what columns they have (including types) and then we may be able to help you out.

    Going by what you have said already I would guess that you're modelling the products as a table and the product_types as a table.

    e.g.

    CREATE TABLE Products(
    ID INT UNSIGNED NOT NULL,
    Product_Name VARCHAR(100),
    Description VARCHAR(255),
    Product_Type INT UNSIGNED NOT NULL
    )

    Product_Types(
    ID INT UNSIGNED NOT NULL,
    Type VARCHAR(100)
    )

    Also as a recommendation I would use InnoDB table types to enforce foreign key constraints on the product_type. Thus :
    ALTER TABLE Products ADD FOREIGN KEY (Product_Type) REFERENCES Product_Types(ID) ON UPDATE CASCADE ON DELETE CASCADE


    ... Aside form my advice. I need to know roughly what it is your achieveing. Are they choosing a sub type (i.e. hard drive type) and then choosing the relevant products from a list or what is it you're expecting the user to be able to do.
    Last edited by aschk; 03-23-2007 at 10:08 AM.

Posting Permissions

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