I have two tables. One is user. user has two columns.

  • user_id
  • user_name

The other table is product. product has two columns.

  • product_type
  • seller_id

seller_id is a foreign key of user.user_id.

An example of product_type is "laptop". I want to list all the names of users who are selling laptops. (SQL Query)

closed as off-topic by MDCCL, Max Vernon, Colin 't Hart, Md Haidar Ali Khan, mustaccio Sep 6 '18 at 12:36

This question appears to be off-topic. The users who voted to close gave this specific reason:

  • "Too localized - this could be because your code has a typo, basic error, or is not relevant to most of our audience. Consider revising your question so that it appeals to a broader audience. As it stands, the question is unlikely to help other users (regarding typo questions, see this meta question for background)." – MDCCL, Max Vernon, Colin 't Hart, Md Haidar Ali Khan, mustaccio
If this question can be reworded to fit the rules in the help center, please edit the question.

  • The only thing you need is to upbuild the task's words in correct order and form - you need to SELECT user.user_name FROM user, products WHERE products.seller_id = user.user_id AND products.product_type = 'laptop'. – Akina Sep 4 '18 at 17:15
SELECT user_name FROM user u
                WHERE product_type = 'laptop'
                AND p.seller_id = u.user_id)

Not the answer you're looking for? Browse other questions tagged or ask your own question.