I am in the process of teaching myself SQL queries. My question arrives from w3resource.com sql exercise 6 in the sub-query set of questions. To summarize the question, we want a query that displays the commission of the salesmen serving customers in Paris. Here are the two tables with their columns given:
Salesman(salesman_id, name, city, commission)
Customer(customer_id, cust_name, city, grade, salesman_id)
Below are two queries that I wrote that achieve the solution in different ways. My question is if there is a more 'correct' one out of the two? With 'correct' taking into account performance, standards, etc. Or are both equally fine? I ask because I imagine as I continue with more complex queries, should I be sticking to one for performance/versatility reasons? Thanks
select commission from Salesman
where salesman_id IN
(select salesman_id from Customer
where city = 'Paris')
select commission from Salesman
join Customer on (Salesman.salesman_id = Customer.salesman_id)
where Customer.city = 'Paris'