MySQL USING Clause

The USING clause is used in join operations to specify the column(s) on which the tables should be joined when the columns have the same name in both tables.

Example: Using USING Clause

SELECT tamil_kings.king_name, kingdoms.kingdom_name
FROM tamil_kings
INNER JOIN kingdoms USING (kingdom_id);

Code Explanation: This query performs an inner join on kingdom_id using the USING clause, simplifying the join syntax.

Key Takeaways

  • The USING clause is a cleaner way to join tables when columns have the same name.
  • It helps make the SQL query more readable and concise.