Re: QueryBrowser 1.1.1 - edit fields

Adam Majer <[email protected]>
Newsgroups gmane.comp.db.mysql.mycc
Organization Galactica Software Corporation
Message-ID <[email protected]>
Raphael Matthias Krug wrote:

>Hi Adam,
>
>one stupid question. What difference does it make in your example, if 
>this one columne has a primary key?
>  
>
You cannot have a primary key in this table. You would need another
column, for example,

Key  | Data1  |
-----|--------+
  1      1
  2      1
  3      2
  4      1

Then if Key is the primary key, then row two is updated UPDATE table SET
Data1=X WHERE Key=2

There is no ambiguity anymore. Key can be an NOT NULL AUTO_INCREMENT
column (for example) so you don't even need to specify it during INSERTs.

>I my opinion it would make sense to update all fields, which contain 1. 
>But I am only a user, not a programmer :-)
>  
>
Well, no. What about if you want the table to look like 1, 5, 2, 1 ? The
only way possible is to use LIMIT in UPDATE or DELETE, but with no
primary key, you don't know which "row" you are updating or deleting.


>>Without a primary key it is not possible to determine that a given row
>>is unique. For example,
>>
>>Data1   |
>>--------+
>>1
>>1
>>2
>>1
>>    
>>

- Adam


-- 
MySQL GUI Tools Mailing List
For list archives: http://lists.mysql.com/gui-tools
To unsubscribe:    http://lists.mysql.com/[email protected]
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.