I see your point, it is ok to have a unique key constraint on the Name column, but bare in mind as others pointed out that you must handle the problem when there are two same names that point to a different entity. You may want the user to enter a unique number behind the name.
On Mon, Aug 15, 2011 at 11:53 PM, W O <[email protected]>wrote: > Lester and Mark, thank you for your answers. > > I have a Primary Key on the ID column of those tables and a Unique Key on > the Name column. > > I want to avoid duplicates forcing the names being different. If a user > want > to save a duplicate name then he/she will have a a message of advice. So, > he/she will take the appropiate means. > > Greetings. > > Walter. > > > > On Mon, Aug 15, 2011 at 4:06 AM, Mark Rotteveel <[email protected] > >wrote: > > > ** > > > > > > On Mon, 15 Aug 2011 00:03:28 -0300, Alexandre Benson Smith > > > > <[email protected]> wrote: > > > Em 14/8/2011 23:43, W O escreveu: > > >> Hello everybody > > >> > > >> I had unique key restrictions on the column "Name" of tables like: > > >> Countries, States, Banks, etc. > > > > Not sure if it is wise to do that; it really depends on the business > rules. > > > > A politically controversial example: two countries claim to be China > (where > > at least one denies the existence/independence of the other). > > In The Netherlands and Belgium we both have a province called 'Limburg'. > > Different banks in different countries can have the same name (for > example > > in the last century both The Netherlands and Germany had a > > 'Rafeissenbank'); or the branches of a single bank in different countries > > are actually two distinct legal entities and need to be recorded as such; > > there are cooperative banks where each bank is independent, but they do > > share the same name (and some of the marketing and backoffice stuff). > > > > On the other hand, not enforcing some type of rules could mean actual > > duplicated data. > > > > > > >> So, I can avoid duplicates. > > >> > > >> What do you think, is it correct to use unique keys for that job? > > >> > > >> Greetings. > > >> > > >> Walter. > > >> > > > > > > It depends on the business rules... > > > > > > I don't think that a unique constraint on the Field Name of a table of > > > people is ok. > > > > > > We al lknow that there is more than one John Smith in the world. > > > > Agreed. It can lead to some nice problems if you would enforce that. > > > > > > > > > [Non-text portions of this message have been removed] > > > > ------------------------------------ > > ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ > > Visit http://www.firebirdsql.org and click the Resources item > on the main (top) menu. Try Knowledgebase and FAQ links ! > > Also search the knowledgebases at http://www.ibphoenix.com > > ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ > Yahoo! Groups Links > > > > -- Iwan Cahyadi Sugeng [Non-text portions of this message have been removed]
