Skip navigation links
Showing entries 1 to 1

Tags Filter: comma join (reset)

Articles
Add to Favourites +0 Vote Up -0Vote Down
By "Good SQL Querying", I am not referring to "how to make your queries more perfomant." I am about to go on a mini-rant about how to make readable and self-documenting SQL queries.One practice that will get me instantly going on a rant is using a comma join. There is NO reason to do the following:-- uses the sakila sample databaseSELECT first_name, last_name, addressFROM customer,address;What kind of join did the original author intend? A CROSS JOIN? Or did they really want an INNER JOIN and forget the WHERE clause?The answer: you do not know for sure; you can only guess. Had the query beenSELECT first_name,last_name,addressFROM customer INNER JOIN address;you would know that the author intended an INNER JOIN; had the query beenSELECT first_name,last_name,addressFROM customer CROSS JOIN address;you would know that the author intended a CROSS JOIN. I advocate using INNER JOIN instead of JOIN because like  []
Showing entries 1 to 1