Создаем таблицу и заполняем
CREATE TABLE a_movies (
id SERIAL PRIMARY KEY,
title VARCHAR(255) NOT NULL,
release_year INT,
genre VARCHAR(100),
rating DECIMAL(3, 1)
);
INSERT INTO a_movies (title, release_year, genre, rating) VALUES
('The Shawshank Redemption', 1994, 'Drama', 9.3),
('The Godfather', 1972, 'Crime', 9.2),
('The Dark Knight', 2008, 'Action', 9.0),
('Schindler''s List', 1993, 'Biography', 8.9),
('Pulp Fiction', 1994, 'Crime', 8.9),
('The Lord of the Rings: The Return of the King', 2003, 'Adventure', 8.9),
('Forrest Gump', 1994, 'Drama', 8.8),
('Inception', 2010, 'Action', 8.8),
('Fight Club', 1999, 'Drama', 8.8),
('The Matrix', 1999, 'Action', 8.7);
Делаем запрос:
SELECT *
FROM a_movies
WHERE release_year BETWEEN 1990 AND 1999
AND title NOT LIKE 'The%'
AND rating <> 9;
Для решения данной задачи необходимо использовать NOT LIKE и BETWEEN
мое решение
SELECT id, title,release_year, genre, rating
FROM movies
WHERE title NOT LIKE 'The%' and release_year between 1990 and 2000
BETWEEN rating <> 9