If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

 
Go Back  dBforums > Database Server Software > PostgreSQL > Design Question

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 11-30-10, 07:02
amateur99 amateur99 is offline
Registered User
 
Join Date: Nov 2010
Posts: 2
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.
Reply With Quote
  #2 (permalink)  
Old 12-04-10, 01:52
loquin loquin is offline
Super Moderator
 
Join Date: Jun 2004
Location: Arizona, USA
Posts: 1,797
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

Reply With Quote
  #3 (permalink)  
Old 12-10-10, 06:45
amateur99 amateur99 is offline
Registered User
 
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.
Reply With Quote
Reply

Tags
design, linking, lists, relationships

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On