1.MySQL数据库有哪些内置函数?
1.数学函数 2.字符串函数 3.日期和时间函数 4.条件判断函数
5.系统信息函数 6.加密和压缩函数 7.聚合函数
8.格式或类型转化函数。
2.如何返回一张表的数据条数?
Select count(1) from tablename;
3.数据库基本操作,
增加:insert into tablename (要添加的列名称) values (要插入的数据);
删除:delete from tablename where ...;
查询:select * from tablename where ...
更新:update tablename set 列名=values where ...
更改表结构
alter table tablename add 列名称 数据类型 位置(一般为after)
4.如何去除重复元素,
select * from tablename having count(*)=1 or count(*)>1;
5.根据专业排名
select * from tablename group by id having count(*)>1 or count(*)=1;
6.判断 是否为数字?
可以用正则表达式,str.match("[0-9]+")判断。但有个缺点,如果包含数字和字符,他返回的还是true.
还可以用for循环一个一个的判断。
7.截取字符串
用字符串自带的subString(begin,end) 方法。
比如abcd,截取ab就是subString(0,2).
转载于:https://www.cnblogs.com/javalisong/p/10135121.html