In the last episode (Feb 01), Michael Griffith said:
> CREATE TABLE test(
> userID int, # (non-unique)
> testID int, # (non-unique)
> PRIMARY key(testid,userid)
> );
>
> Suppose this table is populated with 1,000,000 rows. Then do this:
>
> DELETE FROM test WHERE userID= AND
> Shouldn't the first query have parenthesis? As in:
> DELETE FROM test WHERE userID=X AND (testID<20 OR
> testID>80);
> Even if it works the other way, parenthesis make it more clear what
> you're trying to accomplish.
> -Angela
Actually, yes. Sorry about the poor example. My point
Shouldn't the first query have parenthesis? As in:
DELETE FROM test WHERE userID=X AND (testID<20 OR
testID>80);
Even if it works the other way, parenthesis make it more clear what
you're trying to accomplish.
-Angela
Michael Griffith wrote:
>
> When using mySQL I've learned to avoid
When using mySQL I've learned to avoid OR in any queries as much as possible
. Almost always this causes a major speed decrease. Consider this table:
CREATE TABLE test(
userID int, # (non-unique)
testID int, # (non-unique)
PRIMARY key(testid,userid)
);
Suppose this table is popul