1.添加字段(mysql)
ALTER TABLE `mydb`.`sys_user`
ADD COLUMN `create_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间' AFTER `user_name`;
2.修改字段(mysql)
ALTER TABLE `mydb`.`sys_user`
CHANGE COLUMN `u_sex` `u_gender` char(1) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '性别' AFTER `pass_word`;
3.获取某张表中的所有字段
select t.column_name field from user_col_comments t where t.table_name = 'sys_user'
show full columns from sys_user
4.分页
select * from sys_user limit 0,15
select * from sys_user limit 15 offset 0
select * from(
SELECT t.*,ROWNUM rn from sys_user t where rownum <= 20
) tt where tt.rn >10
5 判断空
SELECT IFNULL(t.phone,'110') from sys_user t
SELECT COALESCE(t.phone,'110') from sys_user
select NVL(t.phone,'110') from sys_user t
6.查看数据库版本信息
select * from v$version;
SELECT version()