Results 1 to 3 of 3

Thread: Design Question

  1. #1
    Join Date
    Nov 2010
    Posts
    2

    Unanswered: Design Question

    Hello all,

    I wonder if you can help, I would like to set up a database that collects lists, each list has a title. When a title of a list appears in another list I want that to be detected somehow.

    What is a good way of doing this? I'm planning on using postgres.

    Thanks very much.

  2. #2
    Join Date
    Jun 2004
    Location
    Arizona, USA
    Posts
    1,848
    We could use some more information...
    Quote Originally Posted by amateur99 View Post
    ...set up a database that collects lists...
    do you mean, "set up a database that is used to store lists" ?

    Quote Originally Posted by amateur99 View Post
    each list has a title. When a title of a list appears in another list I want that to be detected somehow.
    What is the structure of the lists you are considering? I've entered an example below; are you considering something similar?

    List Title A
    1: this is list item 1 for List Title A
    2: This is list item 2 for List Title A
    ...
    N: This is list item N for List Title A

    List Title B
    1: this is list item 1 for List Title B
    2: This is list item 2 for List Title B
    ...
    N: This is list item N for List Title B

    If this is the structure for your lists, create two tables; one for titles (serial title_id field, and varchar title), and one for items (int title_id, int display_sequence and varchar list_item.) Add foreign key constraints on the items.title_id, to titles.title_id.

    Finally, do you want to disallow duplicate list titles? i.e. Do you want the titles to be unique? Or, do you just want to be notified if there is a duplicate title? If you want unique titles, just add a unique constraint on the title field.

    The database server isn't going to notify you that a duplicate title already exists, but your front end application could.
    Lou
    使大吃一惊
    "Lisa, in this house, we obey the laws of thermodynamics!" - Homer Simpson
    "I have my standards. They may be low, but I have them!" - Bette Middler
    "It's a book about a Spanish guy named Manual. You should read it." - Dilbert


  3. #3
    Join Date
    Nov 2010
    Posts
    2
    Hi, yes, the database will store lists.

    I'm looking at something like this -

    List names - 001 002 003
    -------- --------- ---------
    List items 004 005 008
    003 007 006
    009 012 018

    As you can see, the name of list 003 appears in list 001. I think the solution you describe should fit.

    The idea is that I'll be able to notify the owner of list 003 that the name of his list appears in list 001 also.

Tags for this Thread

Posting Permissions

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