[GENERAL] I often have to do update if exist, else insert, is my database design wrong?

2008-07-25 Thread A B
Hi. This is just some thoughts about database design. I often find my self having to do this update table_XY set x=..., y=... where x=... AND y=; if not found then insert into table_XY (x,y) values (...,...); end if; Is this normal or are there something else I could do so I don't have

Re: [GENERAL] I often have to do update if exist, else insert, is my database design wrong?

2008-07-25 Thread Richard Huxton
A B wrote: Or is there some more general problem with the table design? table_XY is in this case (and most cases) a table like this create table table_XY ( x int references table_X, y int references table_Y ); Without knowing what XY are and what you are using table_XY for it's

Re: [GENERAL] I often have to do update if exist, else insert, is my database design wrong?

2008-07-25 Thread Francisco Reyes
Is this normal or are there something else I could do so I don't have to check if it exists? I would say that it is normal. For the developers: a combined insert/update command would be nice :-) Mysql has such a beast along a some other non SQL compliant extensions. One possible approach

Re: [GENERAL] I often have to do update if exist, else insert, is my database design wrong?

2008-07-25 Thread Steve Atkins
On Jul 25, 2008, at 11:46 AM, Francisco Reyes wrote: Is this normal or are there something else I could do so I don't have to check if it exists? I would say that it is normal. For the developers: a combined insert/update command would be nice :-) Mysql has such a beast along a some