-- 可以用类似三元运算符的写法
select 12>10 ? 'desc':'asc' as x;
+----+
|x |
+----+
|desc|
+----+
select 12<10 ? 'desc':'asc' as x;
+---+
|x |
+---+
|asc|
+---+
--常规写法
select if(12>10,'desc','asc') as x;
+----+
|x |
+----+
|desc|
+----+
2024-01-01 14:16:58
-- 可以用类似三元运算符的写法
select 12>10 ? 'desc':'asc' as x;
+----+
|x |
+----+
|desc|
+----+
select 12<10 ? 'desc':'asc' as x;
+---+
|x |
+---+
|asc|
+---+
--常规写法
select if(12>10,'desc','asc') as x;
+----+
|x |
+----+
|desc|
+----+