But there are some subtle (might be major in some applications) differences between "Truncate Table" and "Delete From" that one must be aware of.Truncate resets the Auto_Increment value to zero in contrast to Delete that keeps the last value and continues from there for new records. And depending on the database used (maybe not in MySql) a Truncate is not possible to Rollback in a transaction. This might be a non-issue for most users, but the in the applications I've been developing the last few years things would sooner or later go ape-s**t if I used Truncate instead of Delete in some places.
Though he does have a point. SQL isn't the most elegant of languages...it's downright awful in a lot of cases - it has to be one of the most inconsistent computer languages ever devised. On top of that the whole thing is very context-sensitive. It's supposed to read sort of like English, and in the end it accomplishes that much reasonably, but it's still quirky and could be greatly improved.And MySQL's backticks. Ugh. Ditch MySQL and use Postgres.
lexbabyMay 18, 2006
Right, because the syntax for Oracle and SQLServer are SOOOOO different. :-P
bubbagumpMay 18, 2006
A little 'light' -- but great for newbies.FLUSH PRIVILEGES is missing too...I can't tell yhou how long it took me to figure that one out :)
rajivshankarMay 18, 2006
That will be very helpful. Thanks.
matsengMay 18, 2006
But there are some subtle (might be major in some applications) differences between "Truncate Table" and "Delete From" that one must be aware of.Truncate resets the Auto_Increment value to zero in contrast to Delete that keeps the last value and continues from there for new records. And depending on the database used (maybe not in MySql) a Truncate is not possible to Rollback in a transaction. This might be a non-issue for most users, but the in the applications I've been developing the last few years things would sooner or later go ape-s**t if I used Truncate instead of Delete in some places.
merrebornMay 18, 2006
mysql by and large conforms to the ANSI SQL standard.<a class="user" href="http://en.wikipedia.org/wiki/SQL#Standardization">http://en.wikipedia.org/wiki/SQL#Standardization</a>Kinda hard to blame Jeremy Zwodny for playing by the same rules everyone else does.
error401May 18, 2006
Though he does have a point. SQL isn't the most elegant of languages...it's downright awful in a lot of cases - it has to be one of the most inconsistent computer languages ever devised. On top of that the whole thing is very context-sensitive. It's supposed to read sort of like English, and in the end it accomplishes that much reasonably, but it's still quirky and could be greatly improved.And MySQL's backticks. Ugh. Ditch MySQL and use Postgres.
v3xt0rMay 18, 2006
this is great for n00b's, which is obviously all this fanboy site seems to attract anymore. =/
jondavisApr 13, 2007
Or now there's this one:<a class="user" href="http://insites.ingenesis.net/2007/04/11/mysql-reference-cheat-sheet/">http://insites.ingenesis.net/2007/04/11/mysql-reference-cheat-sheet/</a>
sandraprinsloo1Apr 18, 2009
Fantastic resource, thanks.<a class="user" href="http://youfantastic.com/">http://youfantastic.com/</a>