order by 例句
-
SELECT * FROM customers ORDER BY last_name ASC; This query will select all rows from the "customers" table and order them by the "last_name" column in ascending order.
-
SELECT * FROM products ORDER BY price DESC; This query will select all rows from the "products" table and order them by the "price" column in descending order.
-
SELECT * FROM employees ORDER BY hire_date ASC, last_name ASC; This query will select all rows from the "employees" table and order them first by the "hire_date" column in ascending order, and then by the "last_name" column in ascending order.
-
SELECT * FROM orders ORDER BY order_date DESC, customer_id ASC; This query will select all rows from the "orders" table and order them first by the "order_date" column in descending order, and then by the "customer_id" column in ascending order.
-
SELECT * FROM books ORDER BY author ASC, title ASC; This query will select all rows from the "books" table and order them first by the "author" column in ascending order, and then by the "title" column in ascending order
原文地址: https://www.cveoy.top/t/topic/fFnj 著作权归作者所有。请勿转载和采集!