Re: [SQL] Delete duplicates

2003-06-25 Thread Dani Oderbolz
Denis Arh wrote:

How to delete "real" duplicates?

id | somthing
---
1 | aaa
1 | aaa
2 | bbb
2 | bbb
(an accident with backup recovery...)

In these cases, its certainly the best to rebuild your table
using a
CREATE TABLE new AS
SELECT col1,col1..
FROM old
GROUPY BY col1,col2...
If you have got many duplicates, recreating a new table
semms better to me than deleteing.
(Another advantage is that you still have the "bad" table as a record).
Cheers,
Dani




---(end of broadcast)---
TIP 2: you can get off all lists at once with the unregister command
   (send "unregister YourEmailAddressHere" to [EMAIL PROTECTED])


Re: [SQL] TR: Like and =

2003-06-25 Thread Dani Oderbolz
Nicolas JOUANIN wrote:

Hi,

Thanks for your help. In fact that means 2 solutions for this:

1) select * from pdi where rtrim(pdi) = '100058' 

or

2) Use VARCHAR instead of CHAR

I don't which is the best , but both are working.

Nicolas.
 

Do you have a specific reason why to use CHAR?
I use CHAR only for certain one-byte flags, and even there its use is 
debatable.
I would use VARCHAR; if I was you.

Cheers,
Dani


---(end of broadcast)---
TIP 8: explain analyze is your friend


Re: [SQL] Database design - AGAIN

2003-06-25 Thread Josh Berkus
Rudi,

> I'll be using smaller tables with appropriate join tables and PHP.
> Just for interests sake I'll be using Dia to plan the schema.
> I prefer to use the UML drawing tools instead of the ER ones.

  I still use a simple flowcharting program to plan my databases.  Never 
saw the value in UML, mainly because of the confusing terminology.

But if it works for you, go for it.

-- 
Josh Berkus
Aglio Database Solutions
San Francisco

---(end of broadcast)---
TIP 4: Don't 'kill -9' the postmaster