SQL - Subqueries
You want to list all products and their category names. The
Options:
A) Use a JOIN to combine
B) Use a subquery in SELECT to get category name for each product.
C) Use a subquery in WHERE to filter products by category name.
D) Use UNION to combine products and categories.
products table has category_id, and the categories table has id and name. Which approach is better for performance and why?Options:
A) Use a JOIN to combine
products and categories.B) Use a subquery in SELECT to get category name for each product.
C) Use a subquery in WHERE to filter products by category name.
D) Use UNION to combine products and categories.
