Last active
May 19, 2024 16:38
-
-
Save egenedy97/4fee753724efd5c4dd916ccf35a955e4 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Write a SQL query to search for all products with the word "camera" in either the | |
# product name or description: | |
Select * from product | |
where product_name like '%camera%' | |
or product_description like '%camera%' | |
# Can you design a query to suggest popular products in the | |
# same category for the same author, | |
# excluding the Purchsed product from the recommendations? | |
select * from product | |
where category_id in ( | |
select product.category_id from orders o join order_details od on o.order_id = | |
od.order_id | |
join product p on od.product_id = p.product_id where o.order_id = 1 ) and | |
product_id not in ( select p.product_id from orders o join order_details od on o.order_id = od.order_id | |
join product p on od.product_id = p.product_id where o.order_id = 1); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment