MariaDB root@(none):dyw> select * from tbl order by id asc; +----+-------+--------+-----------------+ | id | title | author | submission_date | +----+-------+--------+-----------------+ | 1 | c++ | peter | 2023-03-30 | | 2 | Linux | linux | 2023-01-30 | +----+-------+--------+-----------------+ 2 rows in set Time: 0.064s
MariaDB root@(none):dyw> select * from tbl order by id desc; +----+-------+--------+-----------------+ | id | title | author | submission_date | +----+-------+--------+-----------------+ | 2 | Linux | linux | 2023-01-30 | | 1 | c++ | peter | 2023-03-30 | +----+-------+--------+-----------------+ 2 rows in set Time: 0.045s
MariaDB root@(none):dyw> insert into tbl (title,author,submission_date) values("a -> nsible","dywang","2023-04-30"); Query OK, 1 row affected Time: 0.077s MariaDB root@(none):dyw> insert into tbl (title,author,submission_date) values( -> "ansible","ben","2023-05-02"); Query OK, 1 row affected Time: 0.047s
MariaDB root@(none):dyw> select * from tbl; +----+---------+--------+-----------------+ | id | title | author | submission_date | +----+---------+--------+-----------------+ | 1 | c++ | peter | 2023-03-30 | | 2 | Linux | linux | 2023-01-30 | | 4 | ansible | dywang | 2023-04-30 | | 5 | ansible | ben | 2023-05-02 | +----+---------+--------+-----------------+ 4 rows in set Time: 0.040s
MariaDB root@(none):dyw> select * from tbl order by title desc, author asc; +----+---------+--------+-----------------+ | id | title | author | submission_date | +----+---------+--------+-----------------+ | 2 | Linux | linux | 2023-01-30 | | 1 | c++ | peter | 2023-03-30 | | 5 | ansible | ben | 2023-05-02 | | 4 | ansible | dywang | 2023-04-30 | +----+---------+--------+-----------------+ 4 rows in set Time: 0.031s
MariaDB root@(none):dyw> select * from tbl order by title desc, author desc; +----+---------+--------+-----------------+ | id | title | author | submission_date | +----+---------+--------+-----------------+ | 2 | Linux | linux | 2023-01-30 | | 1 | c++ | peter | 2023-03-30 | | 4 | ansible | dywang | 2023-04-30 | | 5 | ansible | ben | 2023-05-02 | +----+---------+--------+-----------------+ 4 rows in set Time: 0.049s