Results 1 to 4 of 4
  1. #1
    Join Date
    Sep 2009
    Posts
    2

    Unanswered: database design...?

    Hi,
    I wanna extend an existing tool. The tool employs a small database. Both the database and the tool were created by somebody else. I am at odds with the database design.

    The tables are linked with each other in a linear fashion. Foreign key relationships are not used at all.

    One field say index_l is used as primary key. And another table contains a field index_to which stores index_l from table it wants to link with.

    I have these concerns about the database...
    • No foreign key relationships means DBMS can't enforce its own integrity
    • index_l and index_to belong to two different tables but they store the same value which is confusing
    • It will compromise the extensibility


    I am not a database guru, just an application developer. I would like to get input from database people. Some sample tables are give below. Is it okay to go ahead with this kind of relationships. what are the pros and cons.

    thanks
    --------------------------------------------------------------------------------------

    CREATE TABLE `ip` (
    `index_I` bigint unsigned NOT NULL auto_increment,
    `index_L` int NOT NULL,
    `index_to` int default NULL,

    UNIQUE KEY `index_I` (`index_I`),
    KEY `index_to` (`index_to`),
    PRIMARY KEY `index_L` (`index_L`)
    )

    CREATE TABLE `llc` (
    `index_I` bigint unsigned NOT NULL auto_increment,
    `index_L` int NOT NULL,
    `index_to` int default NULL,

    UNIQUE KEY `index_I` (`index_I`),
    KEY `index_to` (`index_to`),
    PRIMARY KEY `index_L` (`index_L`),

    )

    CREATE TABLE `wlan_mgt` (
    `index_I` bigint unsigned NOT NULL auto_increment,
    `index_L` int NOT NULL,
    `index_to` int default NULL,

    UNIQUE KEY `index_I` (`index_I`),
    KEY `index_to` (`index_to`),
    PRIMARY KEY `index_L` (`index_L`),
    )

  2. #2
    Join Date
    Jul 2003
    Posts
    2,296
    why are column names named after the index? very confusing!
    How is someone supposed to look at your database and figure out what each field represents?
    - The_Duck
    you can lead someone to something but they will never learn anything ...

  3. #3
    Join Date
    Sep 2009
    Posts
    2
    Yea you are right. The names should be more meaningful. The tables above just contain a subset of the columns. I posted those fields which are confusing to me.
    The guy created some tables to store information about network traces. He assigned IDs in the form of index_x to identify packets. And he created more columns starting with 'index' to correlate records across tables.

  4. #4
    Join Date
    Jul 2003
    Posts
    2,296
    well, since all the tables have the same exact column names and in the same
    order I find it very difficult to determine which is the parent, what data each
    holds, etc.
    Not to mention that is not even proper syntax.

    just looking at it gives me a headache.
    - The_Duck
    you can lead someone to something but they will never learn anything ...

Posting Permissions

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