3 ms·
>Mysql certainly has some syntactic warts, [...] UPDATE and INSERT both support the "assignment_list" syntax. So they are perfectly consistent. (I was making g
by jasode 7y ago
>Mysql certainly has some syntactic warts, [...] UPDATE and INSERT both support the "assignment_list" syntax. So they are perfectly consistent.
(I was making generic comments about SQL so not sure why you interpreted my post as criticizing MySQL.)
Anyways an FYI for any readers not aware... MySQL has non-standard extensions[0] to the reference SQL language. Other databases like Oracle, MS SQL Server, and SQLite do not have INSERT with optional "assignment_list" syntax.
>Well "INTO" is an odd case, it is completely optional
Another example where MySQL is a special case because its proprietary extensions makes "INTO" optional. In other databases like SQLite, the "INTO" is absolutely required because omitting it in "INSERT customer" returns a syntax error.
>I would point out that only SELECT (not INSERT, UPDATE, DELETE) can be run without providing a table reference.
Yes, the ability for SELECT to leave out the table name is handy for functions like "SELECT date();" but its optionality would not have violated consistency with table-then-column ordering of INSERT & UPDATE. In cases where SELECT needs to specify table(s), it would have been more consistent grammar by putting the table names before the columns like INSERT & UPDATE. (This would have also greatly simplified editors with intellisense since putting the table first would let the parser know which columns to list as autocomplete suggestions. E.g. in Navicat SQL text editor, to get a list of autocomplete column names, I have to first type out "SELECT FROM customer" then move the cursor backwards to the left of "FROM" and then start typing "mem" to see "membership_plan" as an autocomplete suggestion.)
[0] https://dev.mysql.com/doc/refman/8.0/en/extensions-to-ansi.html https://dev.mysql.com/doc/refman/8.0/en/extensions-to-ansi.h...
- shkkmo 7y agoHmm, I obviously failed at researching my post properly. When looking for a page listing the differences and found this: https://dev.mysql.com/doc/refman/8.0/en/differences-from-ansi.html https://dev.mysql.com/doc/refman/8.0/en/differences-from-ans... I completely missed the extensions page you listed.