Re: is there an equivavlent to auto_increment in ingres ?



--CELKO-- wrote:

auto incrementing primary keys .<<


A contradiction in terms!  You never learned RDBMS, did you?  Back to
foundations!

I'm not sure that auto incrementing keys are always a bad thing, though your argument is quite solid on theoretical grounds. Consider the following situation.


System A drops a request for SYSTEM B to do something into a table. The requests consists of a customer ID, a site ID, some action flags, and a date/time stamp.

System A doesn't care how to identify the request; it's done its job.

System B comes along and starts doing its job. It spawns information out into other tables, sends letters, does other stuff.

Now, while it is true that the combined information in the original request is unique and constitutes a valid primary key, it is not a very usable key. It may consist of several columns and it's a perishing nuisance to have to replicate all these columns into tables where their only usefulness is to act as the primary key. Developers make mistakes when they forget to add the n-th part of the join, and the QEP goes spare with the apparent multiplicity of join conditions. A short snappy reference number is also useful for customers and administrators.

In this instance, an autoincrement field can be very useful, especially since you can use it in set based operations when you are inserting a hundred or thousand such request en masse.

Personally, I prefer to add a randomly generated ID to such a record (rather than sequential) (there are several reasons for this), but then you have to do your own checks that the ID is unique.
.




Relevant Pages

  • Re: mySQL, Best Way to Increment Records
    ... if the User Table has a UserID field as the ... Primary key should be an autoincrement field, ... "REPLACE" posssibility of MySQL. ... If a request from a client requires a certain primary field, ...
    (alt.php)
  • Re: Relationship Problem
    ... Are the numbers in the Test Results.RequestID matching numbers in the ... You can only have one Primary key in a table, ... What are the field types of Test Results.RequestID and Request.RequestID; ... I have connected the Request Table.Request ID to Test ...
    (microsoft.public.access.gettingstarted)
  • Sql Mobile 3.0 uses the wrong index
    ... Two of these columns compose the primary key. ... This request is very slow to execute. ... We used the Query Analyser tool on the device to genereate a .sqlplan file. ...
    (microsoft.public.sqlserver.ce)
  • Relationship Problem
    ... its a relationship problem. ... Request ID (Primary Key) ... So each Request will have multiple problems. ...
    (microsoft.public.access.gettingstarted)