2020年2月27日

PostgreSQL数据库-抽奖sql

摘要: select * from users order by random();--会进行随机排序,每次运行都会返回不同的结果 select * from users order by random() limit 1;--会进行随机排序,每次运行都会返回一条记录,用来模拟抽奖 阅读全文

posted @ 2020-02-27 22:33 ~码铃薯~ 阅读(272) 评论(0) 推荐(0) 编辑

PostgreSQL数据库-分页sql--offset

摘要: select * from users order by score desc limit 3;--取成绩的前3名 select * from users order by score desc limit 3 offset 0;--取成绩的前3名 select * from users order 阅读全文

posted @ 2020-02-27 21:00 ~码铃薯~ 阅读(2478) 评论(0) 推荐(0) 编辑

MySQL-----循环结构练习题以及总结

摘要: 经典案例: 一、已知表stringcontent 其中字段:id 自增长content varchar(20)向该表中插入指定个数的,随机的字符串 首先,先创建表 drop table if EXISTS stringcontent$ create table stringcontent( id i 阅读全文

posted @ 2020-02-27 17:58 ~码铃薯~ 阅读(296) 评论(0) 推荐(0) 编辑

MySQL---循环结构演练

摘要: 演示案例: 1.没有添加循环控制语句案例:批量插入,根据次数,插入到admin表中多条记录 create PROCEDURE pro_while1(in insertCount int) begin DECLARE i int DEFAULT 1; while i<insertCount DO in 阅读全文

posted @ 2020-02-27 10:15 ~码铃薯~ 阅读(200) 评论(0) 推荐(0) 编辑

导航