MySQL客户端命令

发布时间 2023-10-08 15:52:30作者: 普里莫

MySQL客户端命令

优化命令提示符

[client]包含[mysql][mysqladmin][mysqldunp]

# /etc/my.cnf
[mysql]
prompt = \u@\h [\d] >

# 示例:
root@localhost [(none)] >

# 报错
[root@db04 ~]# mysqladmin drop hhh
mysqladmin: [ERROR] unknown variable 'prompt=\u@\h [\d] >'
# 原因,mysqladmin读取到这一行了,但是读取不了,下面是错误示范:
[client]
prompt = \u@\h [\d] >

mysql

-u:指定用户
-p:指定密码
-h:指定主机域
-S:指定socket
-P:指定端口
-e:指定SQL语句

status|\s 查看MySQL服务端状态

退出
## mysql5.6
quit|exit|\q|Ctrl+c
## mysql5.7
quit|exit|\q

help|?|\?|\h 查看帮助信息

中止命令
## mysql5.6
clear|\c
## mysql5.7
clear|\c|Ctrl+c

use|\u 切换数据库

ego|\G 格式化输出数据

source|\. 库内恢复数据(导入数据)

system|\! 在数据库内执行系统命令

tee|\T 记录SQL语句以及所有结果到指定文件中
	# 开始记录,(文件系统可以直接创建,目录需要有)
	root@localhost [(none)] >tee /root/mysql.txt
	 Logging to file '/root/mysql.txt'
	 # 停止
	root@localhost [(none)] >notee;
	 Outfile disabled.

mysqladmin

##### 想使用mysqladmin前提:服务端必须开启

# 1.修改密码
[root@db03 ~]# mysqladmin -uroot -p123 password '123'

# 2.检测MySQL是否存活
[root@db03 ~]# mysqladmin -uroot -p123 ping

# 3.库外创建数据库
[root@db03 ~]# mysqladmin -uroot -p123 create 库名

# 4.删除数据库
[root@db03 ~]# mysqladmin -uroot -p123 drop 库名

# 5.查看MySQL默认配置
[root@db03 ~]# mysqladmin -uroot -p123 variables

# 6.库外刷新授权表
[root@db03 ~]# mysqladmin -uroot -p123 flush-host
[root@db03 ~]# mysqladmin -uroot -p123 reload

# 7.刷新日志
[root@db03 ~]# mysqladmin -uroot -p123 flush-log

# 8.任何方式停库
[root@db03 ~]# mysqladmin -uroot -p123 shutdown

mysqldump

跳转入口

SQL层 SQL语句

DDL(Database Definition Language)数据定义语言

针对库、表的操作

### DDL含义:
Database Definition Language
数据       定义       语言

数据库

create增:建库
# create database 库名;

## 语法
root@localhost [world] >help create database
Name: 'CREATE DATABASE'
Description:
Syntax:
CREATE {DATABASE | SCHEMA} [IF NOT EXISTS] db_name
    [create_option] ...

create_option: [DEFAULT] {
    CHARACTER SET [=] charset_name
  | COLLATE [=] collation_name
}

CREATE DATABASE creates a database with the given name. To use this
statement, you need the CREATE privilege for the database. CREATE
SCHEMA is a synonym for CREATE DATABASE.

URL: https://dev.mysql.com/doc/refman/5.7/en/create-database.html

# 添加zls1库
root@localhost [(none)] >create schema zls1;
root@localhost [(none)] >create database zls1;

## 数据库已存在情况下
root@localhost [(none)] >create schema if not exists zls1;
root@localhost [(none)] >create database if not exists zls1;
Query OK, 1 row affected, 1 warning (0.00 sec)

## 指定字符集和校验规则
root@localhost [(none)] >create database if not exists zls3 charset utf8 collate utf8_bin;
## 修改默认字符集
vim /etc/my.cnf
[mysqld]
character_set_server=utf8
drop删: 删库
root@localhost [mysql] >drop database zls5;
## 没有这个库的话会报错

## 确认有这个库了在进行删除,(不会报错)
root@localhost [mysql] >drop database if exists zls5;
alter改
# alter database 库名 修改内容;

root@localhost [(none)] >alter database zls charset utf8;
Query OK, 1 row affected (0.00 sec)

# 修改库的字符集
root@localhost [(none)] >show create database zls;
+----------+--------------------------------------------------------------+
| Database | Create Database                                              |
+----------+--------------------------------------------------------------+
| zls      | CREATE DATABASE `zls` /*!40100 DEFAULT CHARACTER SET utf8 */ |
+----------+--------------------------------------------------------------+
1 row in set (0.00 sec)
# 修改库的排序规则
root@localhost [(none)] >alter database zls collate utf8_bin;
Query OK, 1 row affected (0.01 sec)

## 把字符集和排序规则改为拉丁字母集
root@localhost [(none)] >alter database zls charset latin1 collate latin1_general_ci;

表操作

create增:建表

建表操作跳转点

# create table 表名;

## 用法
root@localhost [(none)] >help create table
::略::
URL: https://dev.mysql.com/doc/refman/5.7/en/create-table.html
数据类型
数字类型
int:整形           -2^31 ~ 2^31-1
tinyint:最小整形   -128 ~ 127

TINYINT:1 字节大小,范围为 -128 到 127(有符号)或 0 到 255(无符号)。
SMALLINT:2 字节大小,范围为 -32,768 到 32,767(有符号)或 0 到 65,535(无符号)。
INT(INTEGER):4 字节大小,范围为 -2,147,483,648 到 2,147,483,647(有符号)或 0 到 4,294,967,295(无符号)。
BIGINT:8 字节大小,范围为 -9,223,372,036,854,775,808 到 9,223,372,036,854,775,807(有符号)或 0 到 18,446,744,073,709,551,615(无符号)。
字符串类型
name
# 设置存放10个字符,放了俩字符就占俩字符的位置
varchar(10)      // 可变长类型 张三
# 设置存放10个字符,放了俩字符占了10个字符的位置
char(10)         // 定长类型 张三

# 能确认需要占用几个字符,用char占用更小
# 存放相同的字服时char占用量小。
char(11)         // 手机号
char(18)         // 身份证号
枚举类型
# 枚举类型是一种数据类型,用于定义一个固定的取值范围。枚举类型在编程中常用于表示一组相关的命名常量。

enum('f','m')
male female
enum('A','B','C','D')
浮点型
# float  单精度

也被称为浮点数或float类型。在大多数编程语言中,单精度浮点型使用32位二进制格式来存储数据。

# double 双精度

也被称为双精度数或double类型。双精度浮点型使用64位二进制格式来存储数据,提供更高的精度。

# 具体来说,(4,1) 的含义如下:
- 总长度为 4 位:这意味着该字段可以容纳的最大数字长度为 4 位,包括小数位和整数位。
- 小数位为 1 位:这表示该字段只能保存一个小数位。

浮点型变量可以存储小数和整数,并支持各种数学运算,如加法、减法、乘法和除法。但由于浮点数的内部表示方式的特性,它们可能会涉及到舍入误差等精度问题。
时间戳类型
timestamp 1970-1-1
datetime 1000-1-1

timestamp:
1970-01-01 00:00:00到2038-01-19 03:14:07
字段属性(约束)
not null:          非空
primary key:       主键 唯一且不能为空(一张表中只能创建一个主键)
auto_increment:     自增
unique key:         唯一键 唯一可以为空
default:            默认值
unsigned:           无符号(非负)
comment:            注释

zerofill             001

主键=唯一键+not null

## 在mysql里创建表的用法
root@localhost [(none)] >create table zls.stu10(name varchar(10),age tinyint);
drop删
# drop table 表名;

root@localhost [(none)] >drop table zls;
root@localhost [(none)] >drop table zls.zls;
alter改
# alter table 表名;

### 修改表结构
# 添加字段,添加字段到第一个,添加字段到某个字段的后面
alter table 表名 add 字段名 数据类型 属性约束;
alter table 表名 add 字段名 数据类型 属性约束 first;
alter table 表名 add 字段名 数据类型 属性约束 after 字段名;

## 修改表名
mysql> alter table test rename test3;
## 添加字段
mysql> alter table test1 add yuanli varchar(1) not null;
## 添加字段(放到指定字段的后面)
mysql> alter table test1 add hht int after yuanli;
## 添加字段(将字段放到最前面)
mysql> alter table test1 add hhh int first;
## 一次性添加多个字段
mysql> alter table test1 add hht int,add yx int;
mysql> alter table test1 add hht1 int first,add yx1 int after yuanli;
## 删除字段
mysql> alter table test1 drop hht;

## 字段修改
- change
- modify

alter table 表名 modify 字段名 数据类型 约束属性;
mysql> alter table test1 modify yx1 varchar(10) comment 'xxx';

alter table 表名 change 旧字段名 新字段名 数据类型 约束属性;
mysql> alter table test1 change yx1 yaoxin char(10) comment 'yyy';

DML

### DML含义:所有的DML都是操作表内容的
Data Manipulation Language
数据     操作       语言

insert增

insert
# insert into 表名('字段1','字段2') 值('值1','值2');

## NOW()是mysql内置变量是当前的时间

# 插入单条数据
NOW()是mysql内置变量是当前的时间
insert into stu(name,gender,age,date,phone,bir,id) value('wyk','f',255,'2022-08-10','133',NOW(),1);

# 插入多条数据
mysql> insert student(sname,sage,sbirthday,class) values('yuanli',3,NOW(),'L5'),('wyd',2,'2021-11-12 00:00:00','L6');

# 插入全量数据
mysql> insert student values(5,'yuanli',3,'1',NOW(),'L5'),(6,'wyd',2,'0','2021-11-12 00:00:00','L6');

delete删

delete
# delete from 库名.表名;

##### 规范写法,一定要加where判断,免得误删。
delete from 库名.表名 where;

## 删除的时候可以使用多条件判断。
mysql> delete from linux50.student where sno=7 or sno=10;
mysql> delete from linux50.student where sname='wyd';

## 删除所有内容,依然要写判断,要养成习惯,写一个恒等式就行。
mysql> delete from linux50.student where 1=1;

强力删除表TRUNCATE

TRUNCATE 
是一个用于删除表中所有数据的 SQL 命令。与 DELETE 命令不同,TRUNCATE 命令会快速删除表中的所有行,并重置表的计数器,释放存储空间,而不是逐行删除。
TRUNCATE 命令的语法如下:
# TRUNCATE TABLE table_name;
将 table_name 替换为要清空数据的实际表名。执行 TRUNCATE 命令后,表中的所有数据将被删除,但表的结构和定义保持不变。

需要注意的是,TRUNCATE 命令是一个 DDL(数据定义语言)操作,因此它会自动提交事务。另外,由于 TRUNCATE 是直接删除所有数据,无法通过回滚操作恢复被删除的数据,请谨慎使用。

update伪删除

# 1.给表中添加状态列
mysql> alter table student add status enum('0','1') default '1';

# 2.使用update代替delete删除
mysql> update student set status='0' where sno=5;

# 3.使用select查询时,加上条件
mysql> select * from student where status='1';

update改

update
# update 库.表 set 字段='值';

mysql> update student set ssex='0';
mysql> update student set ssex='1' where sno=10;
mysql> update student set ssex='1' where sname='wyd';
mysql> update student set ssex='1' where 1=1;

DCL

### DCL含义: 控制用户的操作
Database Control Language
数据      控制    语言

grant授权

# 授权(可以创建用户) 5.6和5.7区别:5.7老版本,grant赋予权限,如果该用户不存在,不会创建用户,5.6和5.7新版本会直接创建用户

grant

# grant 权限 on 库.表 to 用户@'主机域' identified by '密码';

grant 权限 on 库.表 to 用户@'主机域' identified by '密码' with grant option;
## 登录后能查询一次,(登录也算一次查询)
grant select,update,insert on *.* to dev1@'%' identified by '123' with max_queries_per_hour 2;
## 登录后可查询一次,在更新一下数据,(登录算查询一次,更新数据算查询一次)
grant select,update,insert on *.* to dev3@'%' identified by '123' with max_queries_per_hour 3 max_updates_per_hour 1;
## 权限和上一条一样,多了个一个小说只能登录一次的约束
grant select,update,insert on *.* to dev4@'%' identified by '123' with max_queries_per_hour 3 max_updates_per_hour 1 max_connections_per_hour 1;
## 这个账号每次只能一个人连接
grant select,update,insert on *.* to dev5@'%' identified by '123' with max_user_connections 1;
##### 授权root的最大权限
mysql> grant all on *.* to root@'localhost' identified by '123' with grant option;

## 权限
max_queries_per_hour:一个用户每小时可发出的查询数量
max_updates_per_hour:一个用户每小时可发出的更新数量
max_connections_per_hour:一个用户每小时可连接到服务器的次数
max_user_connections:允许同时连接数量
grant option:授权权限

revoke回收权限

revoke

mysql> grant all on *.* to test1@'%' identified by '123';
## 回收select查询命令的权限
mysql> revoke select on *.* from test1@'%';

## 回收全部的权限
REVOKE ALL PRIVILEGES ON *.* FROM test1@'%';

DQL

### DQL含义: 所有的查都是DQL
Database Query Language
数据     查询   语言

show

show databases;		            # 查看数据库
show tables;		            # 查看表
show tables from 库名;           # 查看指定数据库下的表,不用切换数据库

show create database 库名;       # 查看建库语句
show create table 表名;          # 查看建表语句,也是为了查看注释
show create table 库名.表名;	 # 查看建表语句,也是为了查看注释(不用切换数据库)

show grants for 用户名@'主机域';  # 查看用户授权语句,也是为了查看该用户的权限
show variables;                  # 查看所有的内置变量(默认配置)

show variables like '%server';   # 模糊查询(过滤)
show variables like '%server%';  # 用 % 去模糊匹配
show variables like 'server%';   # % 表示匹配指定方位的内容多次或0次

show processlist;                # 查看后台执行的sql语句
show full processlist;           # 查看完整的后台执行的sql语句

show collation;                  # 查看所有校验规则
show charset;                    # 查看所有字符集以及该字符集的默认校验规则

show table status '表名';        # 查看表的详细信息

desc

desc 库.表                       # 查看表结构

select

执行顺序
select 聚合运算 from   where  group_by  having  order by limit
        4        1       2       3       5         6      7
普通查询
## select 常用简单查询

# 查看该表中所有的字段的记录(所有数据)
select * from 库名.表名;
root@localhost:world> select * from city;
# 查看指定字段的所有数据
select 字段1,字段5,字段... from 表名;
root@localhost:world> select id,name,countrycode from city;
limit 行
## select 行级查询(翻页功能) (默认为  <=指定的数 )
select 字段1,字段5,字段... from 表名 limit 指定行数;
# 翻页功能,从1开始查到60 查60行
select id,name,countrycode from city limit 60;
# 翻页功能,从121开始查到180 查60行
select id,name,countrycode from city limit 120,60;		
# 翻页功能,从181开始查到241 查60行
select id,name,countrycode from city limit 180,60;         
= 精准查询
## select 条件查询(精确)
select * from 表名 where 字段='记录';
select * from city where countrycode='CHN';
# 多条件查询 or and
select * from city where countrycode='CHN' or countrycode='USA';
select * from city where countrycode='CHN' and district='heilongjiang';
# 条件查询结合行级查询
select * from city where countrycode='CHN' and district='heilongjiang' limit 10;
in 多条精准查询
# 多条件查询用 in 的方法:
select * from 表名 where 字段 in ('要查询的内容一','要查询内容二');
select * from city where countrycode in ('CHN','USA');
like 模糊查询
## select 模糊查询
select * from 表名 where like '%记录%';
select * from city where countrycode like '%HN';
select * from city where countrycode like '%HN%';
select * from city where countrycode like 'HN%';

# 条件查询结合行级查询(模糊查询可以接精确查询)
select * from city where countrycode like '%HN%' or countrycode='JPN' limit 10;
order by 排序查询
## select 排序查询 order by
# 顺序排序
select * from 表名 order by 要排序的记录;
# 不加条件 顺序排序
select * from city order by population;
# 加条件 顺序排序
select * from city where countrycode='CHN' order by population;

# 倒序排序
select * from 表名 order by 要排序的记录 desc;
# 不加条件 倒序排序
select * from city order by population desc; 
# 加条件 倒序排序
select * from city where countrycode='CHN' order by population desc;

## 多列排序
root@localhost [linux50] >select * from score order by cno asc, mark desc;
范围查询
## select 范围查询
select * from 表名 where 要比较的字段 > 指定对比的值;
可用符号:  >  <  >=  <=  <>  !=
select * from city where population < 10000;
group by 函数
# 函数
distinct()       // 去重函数
count()          // 统计(用于,查询出来的结果,统计有多少行)
sum()            // 求和
avg()            // 求平均值函数
max()            // 求最大值函数
min()            // 求最小值函数

as
# 查询后输出行数,并赋值给student_count.
select count(*) as student_count from student where class='2';

# 更改标题头
root@localhost [world] >select count(*)'aaa' from city;
+------+
| aaa  |
+------+
| 4079 |
+------+

# 口诀
1.遇到统计想函数
2.形容词前groupby   (要查的数据按group by后面的形容词分组)
3.函数中央是名词
4.列名select后添加

## 练习题:
# 题一:统计世界上每个国家的总人口数
# 先想口诀该怎么写
遇到统计想函数:sum()
形容词前groupby:group by countrycode
函数中央是名词:sum(population)
列名select后添加:国家  人口数 countycode,population

mysql[world]> select countrycode,sum(population) from city group by countrycode;

# 题二:统计中国各个省的人口数量(练习)
# 先想口诀该怎么写
遇到统计想函数:sum()
形容词前groupby:group by district
函数中央是名词:sum(population)
名select后添加:省 人口数 district,population

select district,sum(population) from city where countrycode='CHN' group by district;

# 题三:统每个国家的城市数量,排序并取前10行(练习)
# 先想口诀该怎么写
遇到统计想函数:count()
形容词前groupby:group by countrycode
函数中央是名词:count(name)
名select后添加:国家,城市数量 countrycode,count(name)

select countrycode,count(name) from city group by countrycode order by count(name) limit 10;

## 可以用as来指定输出结果时字段的别名
select 字段1 as 要指定的别名,聚合函数(字段2) as 要指定的别名 from 表名 group by 形容词;
select countrycode as 国家,count(name) as 城市数量 from city group by countrycode;

select 高级用法 (连表查询)

通过共同的内容来关联俩表内的数据
传统连接
# 世界上小于100人的人口城市是哪个国家的?(双表联查)
国家名 城市名 人口数量

select country.name,city.name,city.population
from city,country
where city.countrycode=country.code
and city.population < 100;
+----------+-----------+------------+
| name     | name      | population |
+----------+-----------+------------+
| Pitcairn | Adamstown |         42 |
+----------+-----------+------------+

# 世界上小于100人的人口城市是哪个国家的,说什么语言?(三表联查)
国家名 城市名 人口数量 语言

select country.name,city.name,city.population,countrylanguage.language
from country,city,countrylanguage
where city.countrycode=country.code
and city.countrycode=countrylanguage.countrycode
and city.population < 100;
+----------+-----------+------------+-------------+
| name     | name      | population | language    |
+----------+-----------+------------+-------------+
| Pitcairn | Adamstown |         42 | Pitcairnese |
+----------+-----------+------------+-------------+
1 row in set (0.00 sec)
内连接 join on
# join on

### 比传统连接数度要快,公司常用的就是这个。

# 世界上小于100人的人口城市是哪个国家的?
select country.name,city.name,city.population
from city join country
on city.countrycode=country.code
where city.population<100;

## 小表在前,大表在后,字段

# 传统用法
# 世界上小于100人的人口城市是哪个国家的,说什么语言?
select country.name,city.name,city.population,countrylanguage.language
from country,city,countrylanguage
where city.countrycode=country.code
and city.countrycode=countrylanguage.countrycode
and city.population < 100;

## 使用内连接的两种方法
# A join B on 1 join C on 2
select country.name,city.name,city.population,countrylanguage.language
from city join country
on city.countrycode=country.code
join countrylanguage
on city.countrycode=countrylanguage.countrycode
where city.population < 100;

# A join B join c on 1 and 2 
select country.name,city.name,city.population,countrylanguage.language
from city join country
join countrylanguage
on city.countrycode=country.code
and city.countrycode=countrylanguage.countrycode
where city.population < 100;
自连接
# 自动找到等价条件 natural join

条件:
## 1.等价条件的列名
## 2.数据值必须一致

# 世界上小于100人的人口城市说什么语言?
select city.name,countrylanguage.language
from city natural join countrylanguage
where city.population<100;

# 世界上小于100人的人口城市是哪个国家的,说什么语言?
select city.countrycode,city.name,countrylanguage.language
from city natural join countrylanguage
where city.population<100;
外连接
- 左外连接 left join
- 右外连接 right join

select city.name,city.countrycode,country.name
from city left join country
on city.countrycode=country.code
and city.population<100;

A left join B on 1 left join C on 2

select city.name,country.code,country.name
from city right join country
on city.countrycode=country.code
and city.population<100;

select查所有的表

## 直接查表的元数据,通过过滤来找
root@localhost [zls] >select * from information_schema.tables where table_schema='zls'\G

root@localhost [(none)] >select * from information_schema.tables\G
.....
*************************** 341. row ***************************
  TABLE_CATALOG: def            // 表示表所属于默认数据库目录
   TABLE_SCHEMA: zls            // 表所属的数据库名称
     TABLE_NAME: student        // 表的名称
     TABLE_TYPE: BASE TABLE     // 表的类型,这里是基本表(BASE TABLE)
         ENGINE: InnoDB         // 表所使用的存储引擎
        VERSION: 10             // 表的版本号为 10
     ROW_FORMAT: Dynamic        // 行的格式为动态行格式
     TABLE_ROWS: 4              // 表中的数据行数为 4
 AVG_ROW_LENGTH: 4096           // 平均每行的长度为 4096 字节
    DATA_LENGTH: 16384          // 数据部分的长度为 16384 字节
MAX_DATA_LENGTH: 0              // 数据部分的最大长度为 0,通常用于动态行格式
   INDEX_LENGTH: 16384          // 索引部分的长度为 16384 字节
      DATA_FREE: 0              // 表中未使用的空间大小为 0 字节
 AUTO_INCREMENT: NULL           // 无自增列
    CREATE_TIME: 2023-07-30 12:10:05     //表的创建时间为 2023 年 7 月 30 日 12:10:05
    UPDATE_TIME: 2023-07-30 12:08:29     // 表的最后更新时间为 2023 年 7 月 30 日 12:08:29
     CHECK_TIME: NULL           // 无校验时间
TABLE_COLLATION: utf8_general_ci         // 表的字符集校对规则为 utf8_general_ci
       CHECKSUM: NULL           // 无校验和值
 CREATE_OPTIONS:                // 创建表时附加的选项为空
  TABLE_COMMENT:                // 表的注释为空
341 rows in set (0.01 sec)

.sql文件导入数据库

# 数据库内导入数据
source filename.sql;

# 数据库外导入数据
mysql -uroot -p123 < /tmp/ttt.sql

建表语句,企业级

CREATE TABLE `test_table` (
			`ID` bigint(20) NOT NULL AUTO_INCREMENT COMMENT '主键',
			`DOMAIN_CODE` varchar(20) NOT NULL COMMENT '考试单位编号',
			`EXAM_NAME` varchar(300) NOT NULL COMMENT '考试名称',
			`EXAM_TYPE` int(1) NOT NULL COMMENT '考试类型(正式考试,补考)',
			`TARGET_EXAM_ID` bigint(20) DEFAULT NULL COMMENT '关联正式考试的ID(如果是补考,该处是必填)',
			`EXAM_PICTURE_PATH` varchar(100) DEFAULT NULL COMMENT '图示路径',
			`EXAM_BEGIN_TIME` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '考试开始时间',
			`EXAM_END_TIME` timestamp NOT NULL DEFAULT '0000-00-00 00:00:00' COMMENT '考试结束时间',
			`EXAM_TIME` int(3) NOT NULL COMMENT '考试时长',
			`EXAM_NEED_SCORE` int(5) NOT NULL COMMENT '考试所需积分',
			`EXAM_PAPER_TYPE` int(1) DEFAULT NULL COMMENT '考试试卷类型(0固定、1随机)',
			`EXAM_SCORE` double(6,2) DEFAULT NULL COMMENT '考试总分(关联试卷后回填)',
			`EXAM_PASS_SCORE` double(6,2) NOT NULL COMMENT '考试及格分',
			`EXAM_COMMIT_NUM` int(2) NOT NULL COMMENT '参考最大次数',
			`EXAM_STATUS` int(1) NOT NULL COMMENT '发布状态0未发布,1已发布',
			`EXAM_YEAR` varchar(5) NOT NULL COMMENT '年份',
			`EXAM_PAPER_ID` bigint(20) DEFAULT NULL COMMENT '关联试卷ID',
			`EXAM_DISCRIPTION` varchar(1000) DEFAULT NULL COMMENT '考试备注',
			`OPERATOR_USER_ACCOUNT` varchar(20) NOT NULL COMMENT '修改人',
			`OPERATOR_TIME` timestamp NOT NULL DEFAULT '0000-00-00 00:00:00' COMMENT '修改时间',
			`TARGET_DOMAIN_CODE` varchar(20) DEFAULT NULL COMMENT '发布目标单位编号(发布时回填)',
			`RANK` varchar(100) DEFAULT NULL COMMENT '职务级别(发布时回填)',
			`EXAM_DIPLOMA_ID` bigint(20) DEFAULT NULL COMMENT '关联证书',
			`DIPLOMA_NAME` varchar(200) DEFAULT NULL COMMENT '证书标题(关联证书后回填',
			`DIPLOMA_PICTURE_PATH` varchar(200) DEFAULT NULL COMMENT '证书背景图片保存位置(关联证书后回填)',
			`INDUSTRY_CODES` varchar(1000) DEFAULT NULL,
			`LANGUAGE` int(2) NOT NULL DEFAULT '1' COMMENT '语言(0:全部,1:汉语,2:维语,3:è’语,4:哈语)',
			`EXT1` int(1) NOT NULL DEFAULT '1' COMMENT '成绩计入学分的字段标识(0 是,1否)',
			`EXT2` int(3) DEFAULT NULL COMMENT '成绩所占比例',
			`EXT3` varchar(1) DEFAULT NULL,
			`EXT4` varchar(1) DEFAULT NULL,
			`EXT5` varchar(1) DEFAULT NULL,
			PRIMARY KEY (`ID`),
			KEY `DOMAIN_CODE` (`DOMAIN_CODE`),
			KEY `EXAM_PAPER_ID` (`EXAM_PAPER_ID`)
			) ENGINE=InnoDB AUTO_INCREMENT=365 DEFAULT CHARSET=utf8;
			
## 主键 唯一键可以写最底下 主键是主序列 KEY `DOMAIN_CODE`,KEY `EXAM_PAPER_ID`是普通序列
## '语言(0:全部,1:汉语,2:维语,3:è’语,4:哈语)',是乱码 本来是少数民族语