发现有错误:数据太长了。
//查看数据库的所有编码:
show variables like 'character%';
-----+
| character_set_client     | utf8    设置客户端的字符集
     |
| character_set_connection | utf8    设置连接的字符集
     |
| character_set_database   | utf8 设置数据库的字符集
     |
| character_set_filesystem | binary    设置文件系统的字符集
     |
| character_set_results    | utf8 设置显示结果是使用的编码
     |
| character_set_server     | utf8 设置配置MySQL时设置的字符集
     |
| character_set_system     | utf8
     |
| character_sets_dir       | C:\Program Files\MySQL\MySQL Server 5.0\share\chars
ets\ |
+--------------------------+----------------------------------------------------
解决乱码的问题:
1、设置客户端的结果集
2、设置显示结果的字符集

1,set character_set_client=gbk;   使用的客户端编码
2,set character_set_results=gbk; 结果集的编码

创建一张a表
create table a
(
 id int,
 name varchar(20)
);

insert into a values(1,'aaa');
insert into a values('bbbb');//只想添加name时,要把a(name)写上。
insert into a(name) values('bbbb');
+------+------+
| id   | name |
+------+------+
|    1 | aaa  |
| NULL | bbbb |
+------+------+
实际上into也可以不写。
insert a values(2,'cccc');
insert a values(3,'dddd');

上面的等价下面的:
insert a value(4,'cccc'),(5,'dddd');

select * from employee;

将所有的员工的薪水修改为5000元
update employee set salary=5000;
将姓名为  zhangsan 的员工的薪水修改为3000元
update employee set salary=3000 where name='zhangsan';
将姓名为 lisi 的员工薪水修改为4000元,sex修改为female
update employee set salary=4000,gender='female' where name='lisi';
将xiaohong的薪水在原有的基础上增加1000元。
update employee set salary=salary+1000 where name='xiaohong';

set character_set_results=gbk;

3delete语句 删除数据
删除表中name为zhangsan 的记录
delete from employee where name='zhangsan';
删除表中的所有数据
delete from employee;

insert into employee
 (id,name,gender,birthday,salary,entry_date,resume)
 values(1,'zhangsan','male','1980-1-1',1000,'2000-3-16','good boy');

insert into employee
 (id,name,gender,birthday,salary,entry_date,resume)
 values(2,'lisi','male','1934-4-1',1000,'2010-3-16','good boy');

insert into employee
 (id,name,gender,birthday,salary,entry_date,resume)
 values(3,'xiaohong','female','1984-1-1',1000,'2008-3-16','good girl');

使用truncate删除表中的记录
truncate employee;  删除表中的记录。删除表在创建表
select * from employee;

insert into employee
 (id,name,gender,birthday,salary,entry_date,resume)
 values(1,'zhangsan','male','1980-1-1',1000,'2000-3-16','good boy');

insert into employee
 (id,name,gender,birthday,salary,entry_date,resume)
 values(2,'lisi','male','1934-4-1',1000,'2010-3-16','good boy');

insert into employee
 (id,name,gender,birthday,salary,entry_date,resume)
 values(3,'xiaohong','female','1984-1-1',1000,'2008-3-16','good girl');

select * from employee;
mysql> select * from employee;
+------+----------+--------+------------+--------+------------+-----------+
| id   | name     | gender | birthday   | salary | entry_date | resume    |
+------+----------+--------+------------+--------+------------+-----------+
|    1 | zhangsan | male   | 1980-01-01 |   1000 | 2000-03-16 | good boy  |
|    2 | lisi     | male   | 1934-04-01 |   1000 | 2010-03-16 | good boy  |
|    3 | xiaohong | female | 1984-01-01 |   1000 | 2008-03-16 | good girl |
+------+----------+--------+------------+--------+------------+-----------+

4、select 语句
column 指定列名
* 号代表查询所有列
From 指定查询哪张表
DISTINCT可选,值显示结果时,是否剔除重复数据。

student.sql
create table student
(
 id int,
 name varchar(20),
 chinese float,
 english float,
 math float
);
insert into student(id,name,chinese,english,math) values(1,'张小明',89,78,90);
insert into student(id,name,chinese,english,math) values(2,'李菁',67,53,95);
insert into student(id,name,chinese,english,math) values(3,'王五',87,78,77);
insert into student(id,name,chinese,english,math) values(4,'李一',82,98,92);
insert into student(id,name,chinese,english,math) values(5,'李来才',82,84,67);
insert into student(id,name,chinese,english,math) values(6,'张警报',55,85,45);
insert into student(id,name,chinese,english,math) values(1,'黄蓉',75,65,30);

//查询所有的学生的信息
select * from student;

mysql字符集,insert,update,delete,select的更多相关文章

  1. mysql数据恢复 insert\update\delete 工具MyFlash

    一.简介MyFlash是由美团点评公司技术工程部开发维护的一个回滚DML操作的工具.该工具通过解析v4版本的binlog,完成回滚操作.相对已有的回滚工具,其增加了更多的过滤选项,让回滚更加容易. 该 ...

  2. mysql 事务是专门用来管理insert,update,delete语句的,和select语句一点不相干

    1.mysql 事务是专门用来管理insert,update,delete语句的,和select语句一点不相干 2.一般来说,事务是必须满足4个条件(ACID): Atomicity(原子性).Con ...

  3. mybatis select/insert/update/delete

    这里做了比较清晰的解释: http://mybatis.github.io/mybatis-3/java-api.html SqlSession As mentioned above, the Sql ...

  4. JDBC基础篇(MYSQL)——使用statement执行DML语句(insert/update/delete)

    注意:其中的JdbcUtil是我自定义的连接工具类:代码例子链接: package day02_statement; import java.sql.Connection; import java.s ...

  5. PHP5: mysqli 插入, 查询, 更新和删除 Insert Update Delete Using mysqli (CRUD)

    原文: PHP5: mysqli 插入, 查询, 更新和删除  Insert Update Delete Using mysqli (CRUD) PHP 5 及以上版本建议使用以下方式连接 MySQL ...

  6. 关于MyBatis mapper的insert, update, delete返回值

    这里做了比较清晰的解释: http://mybatis.github.io/mybatis-3/java-api.html SqlSession As mentioned above, the Sql ...

  7. [Hive - LanguageManual] DML: Load, Insert, Update, Delete

    LanguageManual DML Hive Data Manipulation Language Hive Data Manipulation Language Loading files int ...

  8. sql中同一个Trigger里同时包含Insert,Update,Delete

    sql中同一个Trigger里同时包含Insert,Update,Delete SQLServer是靠Inserted表和Deleted表来处理的,判断一下就可以了,只不过比ORACLE麻烦一点 cr ...

  9. LINQ体验(9)——LINQ to SQL语句之Insert/Update/Delete操作

    我们继续讲解LINQ to SQL语句,这篇我们来讨论Insert/Update/Delete操作.这个在我们的程序中最为常用了.我们直接看例子. Insert/Update/Delete操作 插入( ...

随机推荐

  1. C++ 前期准备

    在线编译网站: http://www.dooccn.com/cpp/ 刷题: https://leetcode.com/ https://leetcode-cn.com/

  2. [LeetCode] Maximum Sum of 3 Non-Overlapping Subarrays 三个非重叠子数组的最大和

    In a given array nums of positive integers, find three non-overlapping subarrays with maximum sum. E ...

  3. cogs 619. [金陵中学2007] 传话

    提交地址:http://cojs.tk/cogs/problem/problem.php?pid=619 619. [金陵中学2007] 传话 ★☆   输入文件:messagez.in   输出文件 ...

  4. Hdu2680 最短路

    给定一个有向图,多个起点,一个终点,求起点到终点的最短路. 1.可以加一个点,使其与那些起点的距离为0 2.将图反着来建,然后在所有点找出最小的 方案一: #include <iostream& ...

  5. Codeforces Round #411 (Div. 1) D. Expected diameter of a tree

    题目大意:给出一个森林,每次询问给出u,v,问从u所在连通块中随机选出一个点与v所在连通块中随机选出一个点相连,连出的树的直径期望(不是树输出-1).(n,q<=10^5) 解法:预处理出各连通 ...

  6. ●POJ 1329 Circle Through Three Points

    题链: http://poj.org/problem?id=1329 题解: 计算几何,求过不共线的三点的圆 就是用向量暴力算出来的东西... (设出外心M的坐标,由于$|\vec{MA}|=|\ve ...

  7. [bzoj3668][Noi2014]起床困难综合症/[洛谷3613]睡觉困难综合症

    来自FallDream的博客,未经允许,请勿转载,谢谢. 21 世纪,许多人得了一种奇怪的病:起床困难综合症,其临床表现为:起床难,起床后精神不佳.作为一名青春阳光好少年,atm 一直坚持与起床困难综 ...

  8. python常用命令(持续) | Commonly used Python command list (con't)

    ---------------------------------------------------------------------------------------------------- ...

  9. Linux学习之CentOS(四)----Linux文件属性、所有者、群组、其他组及文件权限操作简要总结

    Linux文件属性.所有者.群组.其他组及文件权限操作简要总结 首先介绍一个重要的知识点:文件属性控制权限 [root@www ~]# ls -al total 156 drwxr-x--- 4 ro ...

  10. 读书笔记-《Maven实战》-关于Maven依赖传递的思考 2018/4/26

    上次读书笔记中,提到了依赖传递.看着依赖传递表,一直在思考为什么会是这样. 先看传递表: compile test provided runtime compile test provided run ...