查看表的字符集编码
show create table tbname;
查看系统默认字符集
SHOW VARIABLES LIKE 'character_set_database';
显示所有可用的字符集
SHOW CHARACTER SET;
修改系统默认字符集
①在 /etc/my.cnf 文件中的 [mysqld] 下添加:
②重启数据服务
systemctl restart mysqld
一、练习
创建表emp,表结构和需要插入的内容如下
任务要求
1、 select * from emp where deptno=30;
2、select empno,ename,deptno from emp where job='销售员';
3、select ename,sai,comm from emp where comm>sai;
4、select * from emp where comm>sai*0.6;
5、select * from emp where (deptno=10 and job='经理') or (deptno=20 and job='销售员');
6、select * from emp where (deptno=10 and job='经理') or (deptno=20 and job='销售员') or (job not in('经理','销售员') and sai>=20000);
7、select * from emp where comm is NULL or comm<1000;
8、select * from emp where ename like "___";
9、select * from emp where year(hiredate)=2000;
10、 select * from emp order by empno;
11、select * from emp order by sai desc,hiredate;
12、select deptno,round(avg(sai),2) from emp group by deptno;
13、select deptno,count(*) from emp group by deptno;
14、select job,max(sai),min(sai),count(*) from emp group by job;