[LIP] which is the primary key

Kenneth Gonsalves <[email protected]>
Newsgroups gmane.user-groups.linux.india.programmers
Message-ID <[email protected]>
hi,
i have had occasion to interact with two rdbms gurus over the past 
week and they have challenged one of my most precious assumptions. 
Say we have two tables like so:

create table states
	(id	serial unique,
        name varchar(50)
	);
and
create table towns
	(
	id serial unique,
	name varchar(50)
	state integer references states(id)
	);

i put the name field as the primary key in each case, but they argue 
that the id key is to be the primary key. I always thought that the 
primary key was the one that uniquely defined a row. Of course, 
making the 'id' field the primary key would also uniquely define the 
row, but then the possibility arises of having rows that *only* 
differ in the 'id' field which doesnt sound like a good practice to 
me. This becomes more apparent when considering the case where the 
primary key has more than one field. 

comments anyone?
 
-- 
regards
kg

http://www.livejournal.com/users/lawgon
tally ho! http://avsap.org.in
ಇಂಡ್ಲಿನಕ್ಸ வாழ்க!


-------------------------------------------------------
SF.Net email is Sponsored by the Better Software Conference & EXPO
September 19-22, 2005 * San Francisco, CA * Development Lifecycle Practices
Agile & Plan-Driven Development * Managing Projects & Teams * Testing & QA
Security * Process Improvement & Measurement * http://www.sqe.com/bsce5sf
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.