Hi! Could we please enable some services and cookies to improve your experience and our website?

SQLize | PHPize | SQLtest

Online Sandbox for SQL and PHP: Write, Run, Test, and Share SQL Queries and PHP Code

A A A
Login    Share code      Blog   FAQ
Copy Format Clear
CREATE TABLE IF NOT EXISTS `category` ( `id` int(6) unsigned NOT NULL, `orderNum` int(6) NULL, `name` varchar(200) NOT NULL, PRIMARY KEY (`id`) ) DEFAULT CHARSET=utf8; INSERT INTO `category` (`id`, `orderNum`, `name`) VALUES ('1', '17', 'test 4'), ('2', null, 'test 3'), ('3', '35', 'test 6'), ('4', null, 'test 2'), ('5', '22', 'test 1'), ('6', '24', 'test 5'); SELECT * FROM `category` ORDER BY COALESCE(`orderNum`, `name`)

Stuck with a problem? Got Error? Ask AI support!

Copy Clear