时间:2021-07-01 10:21:17 帮助过:36人阅读
本文用实例一点一点告诉你,MySQL order by的用法
先按照下面的表结构创建mysql_order_by_test数据表,我们用实例一点一点告诉你,MySQL order by的用法。
CREATE TABLE IF NOT EXISTS mysql_order_by_test (
uid int(10) NOT NULL AUTO_INCREMENT,
name char(80) NOT NULL,
sex tinyint(1) NOT NULL,
KEY uid (uid)
) ENGINE=MyISAM DEFAULT CHARSET=utf8 AUTO_INCREMENT=4 ;
INSERT INTO mysql_order_by_test (uid, name, sex) VALUES(1, '张三', 1);
INSERT INTO mysql_order_by_test (uid, name, sex) VALUES(2, '李四', 2);
INSERT INTO mysql_order_by_test (uid, name, sex) VALUES(3, '王二麻子', 1);