In the highly competitive world of e-commerce, customer social proof is one of the strongest drivers of new sales. Highlighting positive customer experiences on your website's homepage can significantly increase conversion rates and build trust with new visitors. The marketing team wants to create a new 'Top Testimonials' carousel on the main landing page. However, they only want to feature the absolute best feedback. While a 5-star rating is great, a rating without any written context doesn't help prospective buyers understand exactly why the product is so good. You have been granted access to the product_reviews table in the company database. This table tracks all user ratings and comments. The key columns include review_id (the unique identifier for the review), product_id (the identifier for the item being reviewed), rating (an integer from 1 to 5), review_text (the actual written comment, which may be empty), and created_at (the timestamp of when the review was submitted). Your task is to write a SQL query to extract the most recent, perfect reviews that actually include written feedback. Follow the exact requirements below to ensure the marketing team gets exactly the data they need for their new carousel. Return only the review_id , product_id , and review_text columns. Filter the records so that only reviews with a rating of exactly 5 are included. Exclude any reviews where the review_text is missing (i.e., it must not be NULL). Order the final result set by the created_at timestamp in descending order so the newest reviews appear first. Common Pitfall: Remember that in SQL, checking for missing values requires the IS NOT NULL operator. Using a standard equality or inequality operator like != NULL will not work and will result in an empty dataset. Hint: You will need to combine multiple conditions in your WHERE clause using the AND keyword to satisfy both the rating and the text requirements.
Table Setup (SQL Schema)
CREATE TABLE product_reviews (review_id SERIAL PRIMARY KEY, product_id INT, user_id INT, rating INT, review_text TEXT, created_at TIMESTAMP);
INSERT INTO product_reviews (product_id, user_id, rating, review_text, created_at) VALUES
(101, 501, 5, 'Absolutely love this product! Highly recommend.', '2026-04-10 10:00:00'),
(102, 502, 4, 'Good, but could be better.', '2026-04-11 14:30:00'),
(101, 503, 5, NULL, '2026-04-12 09:15:00'),
(103, 504, 5, 'Exceeded my expectations, very durable.', '2026-04-09 16:45:00'),
(104, 505, 3, 'Average quality.', '2026-04-08 11:20:00'),
(102, 506, 5, 'Perfect fit and fast shipping!', '2026-04-11 18:00:00');