Back to questions

SQL WHERE Practice Exercise SQL Interview Question

SQL WHERE Practice Exercise

SQL Interview Question

Given the reviews table, write a query to retrieve all 3-star reviews using the SQL clause. Only display the user_id and stars columns.

Table:

Column NameType
review_idinteger
user_idinteger
submit_datedatetime
product_idinteger
starsinteger (1-5)

Example Input:

review_iduser_idsubmit_dateproduct_idstars
617112306/08/2022 00:00:00500014
780226506/10/2022 00:00:00698524
529336206/18/2022 00:00:00500013
635219207/26/2022 00:00:00698523
451798107/05/2022 00:00:00698522

Example Output:

user_idstars
3623
1923

Explanation

user_id 362 gave a 3-star review, and so did user_id 192.

Difficulty

Easy

Input

Output