SQLize Online / PHPize Online  /  SQLtest Online

A A A
Share      Blog   Popular
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 ChatGPT!
Copy Clear