|
database
newsgroups
|
|||||||||||||||||||||||
|
|||||||||||||||||||||||
find uniquehey all,
i have a table which i would like to determine what fields make each record unique? Unfortunately there is not a tableid. thanks, rodchar >> i have a table which i would like to determine what fields [sic] make each record [sic] unique? Unfortunately there is not a tableid [sic]. << Let's get back to the basics of an RDBMS. Rows are not records; fieldsare not columns; tables are not files. This is a pain to do after the fact. 1) Remove redundant dupicate rows by inserting a "SELECT DISTINCT * "query to a working table. This kindof crappy non-table probably has accumulated garbage. 2) Pick the columns that should be keys from the data model. The data model which you probably do not have. 3) Test this subset of columns with SELECT 'Bad Choice' FROM Foobar GROUP BY <<list of columns>> HAVING COUNT(*) > 1; 4) reduce the number of test columns when you get a winner. what's the [sic] mean?
Show quote "--CELKO--" wrote: > >> i have a table which i would like to determine what fields [sic] make each record [sic] unique? Unfortunately there is not a tableid [sic]. << > > Let's get back to the basics of an RDBMS. Rows are not records; fields > are not columns; tables are not files. This is a pain to do after the > fact. > > 1) Remove redundant dupicate rows by inserting a "SELECT DISTINCT * > "query to a working table. This kindof crappy non-table probably has > accumulated garbage. > > 2) Pick the columns that should be keys from the data model. The data > model which you probably do not have. > > 3) Test this subset of columns with > > SELECT 'Bad Choice' > FROM Foobar > GROUP BY <<list of columns>> > HAVING COUNT(*) > 1; > > 4) reduce the number of test columns when you get a winner. > > |
|||||||||||||||||||||||