Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Good mnemonic for when to use the word "table"?

Tags:

syntax

sql

mysql

My MySQL class (now transitioning to SQL Server) has finished all the basics of creating, dropping, updating, and querying tables. It seems that some commands require the word "table" in them (like ALTER TABLE niftytable), while others don't work if you do that (you can't say INSERT INTO TABLE niftytable, right?).

What is the principle determining which is which? I assume it's whether or not the command can apply to something other than tables, but as a beginner I don't know what can or can't affect non-tables, and don't want to get into that yet. So is there a simple mnemonic I can use?

like image 847
Lenoxus Avatar asked Dec 05 '25 05:12

Lenoxus


1 Answers

Use of TABLE generally has to do with DDL (creation or altering of tables) or displaying of table contents or do other administrative work (as in SHOW TABLE STATUS). Any query that does not change the structure of the table (e.g. INSERT INTO) will not require the keyword TABLE.

MySQL syntax reference: http://dev.mysql.com/doc/refman/5.0/en/sql-syntax.html

You should also note that all different types statements tend to have unique syntax so you should probably learn them individually rather than have a general mnemonic for two different categories of queries.

like image 169
Explosion Pills Avatar answered Dec 07 '25 15:12

Explosion Pills



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!