Home All Groups Group Topic Archive Search About
Author
1 Sep 2005 9:02 PM
rodchar
hey 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

Author
1 Sep 2005 9:17 PM
--CELKO--
>> 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.
Author
1 Sep 2005 11:11 PM
rodchar
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.
>
>
Author
1 Sep 2005 11:23 PM
David Gugick
rodchar wrote:
> what's the [sic] mean?

http://www.freesearch.co.uk/dictionary/sic

--
David Gugick
Quest Software
www.imceda.com
www.quest.com

AddThis Social Bookmark Button