SQLize Online / PHPize Online  /  SQLtest Online

A A A
Share      Blog   Popular
Copy Format Clear
DROP TABLE IF EXISTS Directors; CREATE TABLE Directors ( id INT PRIMARY KEY AUTO_INCREMENT, name VARCHAR(40), surname VARCHAR(40), country VARCHAR(40), rating INT ); INSERT INTO Directors (name, surname, country, rating) VALUES ('Christopher', 'Nolan', 'England', 90), ('Steven', 'Spielberg', 'USA', 79), ('Quentin', 'Tarantino', 'USA', NULL), ('Martin', 'Scorsese', 'USA', NULL), ('David', 'Fincher', 'USA', 100), ('Ridley', 'Scott', 'England', NULL), ('Stanley', 'Kubrick', 'USA', 9), ('Clint', 'Eastwood', 'USA', 74), ('James', 'Cameron', 'Canada', 8), ('Tim', 'Burton', 'USA', NULL); SELECT name, surname, IFNULL(rating, 0) AS rating FROM Directors --WHERE car_brand = 'BMW' --TIME(order_time) = GREATEST(TIME_TO_SEC(order_time))days_spent ORDER BY rating, name --LIMIT 1

Stuck with a problem? Got Error? Ask ChatGPT!

Copy Clear