标签:rda ring mit time alt curd substr 不用 lower
别名不用加单引号,as可省略
select t.id ID,
t.name 名称
from grade t;
concat(a,b):不能用||
select concat(‘姓名:‘, t.name) 新名字
from student t;
select distinct t.name
from student t;
select 100 * 3 - 1 计算结果;
select @@AUTO_INCREMENT_INCREMENT 自增步长;
select t.id, t.name
from student t
where not t.id = 1;
把一张表拆分成两张表
select a.categoryName, b.categoryName
from category a
inner join category b
on a.categoryID = b.parentID;
curPage是当前第几页;pageSize是一页多少条记录
limit (curPage - 1) * pageSize,pageSize
totalRecord是总记录数;pageSize是一页分多少条记录
int totalPageNum = (totalRecord + pageSize - 1) / pageSize;
select *
from category
limit 0,5;
select abs(-8);
select ceiling(9.4);
select floor(9.4);
0-1之间
select rand();
0返回0,正数返回1,负数返回-1
select sign(-10);
select char_length(‘廖航‘);
select concat(‘廖航‘, ‘爱‘, ‘蒋焱琨‘);
待插入字符串, 插入位置, 替换几个字符, 替换的字符串
select insert(‘廖航爱蒋焱琨‘, 3, 1, ‘超级爱‘);
select lower(‘LiaoHang‘);
select upper(‘LiaoHang‘);
select instr(‘LiaoHang‘, ‘H‘);
待替换字符串, 要替换的字符串, 替换的字符串
select replace(‘廖航爱蒋焱琨‘, ‘爱‘, ‘超级爱‘);
待截取字符串, 截取的位置, 截取的字符数
select substr(‘LiaoHang‘, 5, 4);select substring(‘LiaoHang‘, 5, 4);
select reverse(‘廖航爱蒋焱琨‘);
select curdate();select current_date();
select curtime();select current_time();
select now();
select localtime();
select sysdate();
select year(now());
select month(now());
select day(now());
select hour(now());
select minute(now());
select second(now());
select version();
select user();
select system_user();
select avg(t.categoryID)
from category t;
select md5(t.pwd)
from student t;
标签:rda ring mit time alt curd substr 不用 lower
原文地址:https://www.cnblogs.com/codesail/p/14831156.html