0

I was using w3resource (heres the link: https://www.w3resource.com/sql-exercises/subqueries/sql-subqueries-inventory-exercise-10.php) and came across this exercise.

Anyways, the solution they gave for this exercise was

SELECT b.*, a.cust_name
FROM orders b, customer a
WHERE a.customer_id=b.customer_id
AND b.ord_date='2012-08-17';

Is a join happening here? Everytime I used joins it would be like

SELECT b.*, a.cust_name
FROM orders b 
JOIN customer a ON b.customer_id = a.customer_id

Also the topic of the exercise was subqueries and I'm not how there was a subquery used in this solution

Boba Evans
  • 11
  • 2
  • it’s equivalent to an inner join, yes. and there is no subquery at all so far. you could add one to a select of the first table to „join“ the second one – Psi Aug 26 '22 at 21:02
  • 4
    Both do the same, but doing an explict join is preferrable. – Kosh Aug 26 '22 at 21:02
  • The join is implicit because the condition to join the two tables is contained in the `WHERE` clause. It's a very old style of joining tables that predates `JOIN` keyword in the sql standard and it's generally frowned upon. – JNevill Aug 26 '22 at 21:08
  • SQL has evolved a lot since we began using it in the 1970s. You are looking at the original syntax for creating a join; its an inner join because originally that was the only kind. Oracle and Ingres extended it to Left and Right joins by adding a plus sign (+) after the table name. Then the standards committee got involved and everything got more verbose. – Chris Maurer Aug 26 '22 at 21:10
  • *we began using it in the 1970* i doubt that many will be include in that statement, as you would be in a university at that time, and than you would be older than 70 – nbk Aug 26 '22 at 21:49

0 Answers0