Reputation: 635
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?
Upvotes: 3
Views: 1006
Reputation: 191729
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.
Upvotes: 3