char(round((rand())*25)+97),
char(round((rand())*25)+65),
char(round((rand())*25)+65),
char(round((rand())*25)+65),
char(round((rand())*25)+65)
)
---------
+97就是产生小写字母a-z
+65就是产生大写字母A-Z
insert into user (username) value (concat(char(floor(rand()*26)+97), char(floor(rand()*26)+97), char(floor(rand()*26)+97), char(floor(rand()*26)+97), char(floor(rand()*26)+97)))这是一条的。
insert into user (username) value (concat(char(floor(rand()*26)+97), char(floor(rand()*26)+97), char(floor(rand()*26)+97), char(floor(rand()*26)+97), char(floor(rand()*26)+97)))
insert into user (username) value (concat(char(floor(rand()*26)+97), char(floor(rand()*26)+97), char(floor(rand()*26)+97), char(floor(rand()*26)+97), char(floor(rand()*26)+97)))
insert into user (username) value (concat(char(floor(rand()*26)+97), char(floor(rand()*26)+97), char(floor(rand()*26)+97), char(floor(rand()*26)+97), char(floor(rand()*26)+97)))
insert into user (username) value (concat(char(floor(rand()*26)+97), char(floor(rand()*26)+97), char(floor(rand()*26)+97), char(floor(rand()*26)+97), char(floor(rand()*26)+97)))
insert into user (username) value (concat(char(floor(rand()*26)+97), char(floor(rand()*26)+97), char(floor(rand()*26)+97), char(floor(rand()*26)+97), char(floor(rand()*26)+97)))
insert into user (username) value (concat(char(floor(rand()*26)+97), char(floor(rand()*26)+97), char(floor(rand()*26)+97), char(floor(rand()*26)+97), char(floor(rand()*26)+97)))
insert into user (username) value (concat(char(floor(rand()*26)+97), char(floor(rand()*26)+97), char(floor(rand()*26)+97), char(floor(rand()*26)+97), char(floor(rand()*26)+97)))
insert into user (username) value (concat(char(floor(rand()*26)+97), char(floor(rand()*26)+97), char(floor(rand()*26)+97), char(floor(rand()*26)+97), char(floor(rand()*26)+97)))
insert into user (username) value (concat(char(floor(rand()*26)+97), char(floor(rand()*26)+97), char(floor(rand()*26)+97), char(floor(rand()*26)+97), char(floor(rand()*26)+97)))
insert into user (username) value (concat(char(floor(rand()*26)+97), char(floor(rand()*26)+97), char(floor(rand()*26)+97), char(floor(rand()*26)+97), char(floor(rand()*26)+97)))
把一条的复制十次,这就是十条的。
按长度排序的方法:select *,len(id) len_id from image where title like '%XXXX%' order by len_id desc
union不能使用order,你这样的需求应该是把两次查询的结果保存到临时表里面,然后从临时表里面获数据。使用临时表的方法能方便的实现去除重复。
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)