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 (NULL, 'Nolan', 'England', 90), ('Steven', 'Spielberg', 'USA', 79), ('Quentin', NULL, 'USA', 95), ('Martin', 'Scorsese', 'USA', 68), (NULL, NULL, 'USA', 100), ('Ridley', 'Scott', 'England', 54), (NULL, NULL, 'USA', 9), ('Clint', 'Eastwood', 'USA', 74), (NULL, 'Cameron', 'Canada', 8), ('Tim', 'Burton', 'USA', 41); SELECT COALESCE(name, surname, 'unknown') AS director, rating FROM Directors --WHERE car_brand = 'BMW' --TIME(order_time) = GREATEST(TIME_TO_SEC(order_time))days_spent ORDER BY rating DESC --LIMIT 1

Stuck with a problem? Got Error? Ask ChatGPT!

Copy Clear