Search code examples
sqlmysqlinner-joinusing

Why is the ( ) mandatory in the SQL statement "select * from gifts INNER JOIN sentgifts using (giftID);"?


Why is the ( ) mandatory in the SQL statement

select * from gifts INNER JOIN sentgifts using (giftID); 

? The ( ) usually is for specifying grouping of something. But in this case, are we supposed to be able to use 2 or more field names...? in the example above, it can be all clear that it is 1 field, is it just that the parser is not made to bypass the ( ) when it is all clear? (such as in the language Ruby).


Solution

  • Yes you can specify multiple columns inside of the using clause like below.

    using(col_1,col_2,col_3)