【悠然】mysql简单指令笔记
来源:互联网 发布:h3c acl 端口 编辑:程序博客网 时间:2024/03/29 00:29
**按照安装步骤安装mysql之后,学习一下指令:
打开MySQL: mysql -u root -p
创建一个名为“mydb1”的数据库: create database 数据库名;
show databases;
在当前数据库中创建一张表: create table 表格名
(
id int,
name varchar(40),
sex varchar(4),
birthday date,
entry_date date,
job varchar(40),
salary decimal(8,2),
resume text
);
在当前表中写入一条数据: insert into
employee(id,username,birthday,entry_date,job,salary,resume)
values(1,'aaa','1980-09-09','1980-09-09','bbb',90,'aaaaa');
查看数据库: use 数据库名;
查看当前数据库中的一条表格: select * from 表格名;
向当前数据库中导入.sql脚本: source 脚本所在路径
改变输出编码: set character_set_results=gb2312;
修改当前数据库中一表格的部分内容: update 表格名 set 需修改元素=修改值 where id=1;
查找: select count(*) from 表格名 ;
select count(*) from 表格名 where 属性条件 ;
select * from 表格名 where name like '李%';
*关于 count的函数的细节 (count只统有值的行)----------支持数学统筹
统计一个班级数学总成绩?
select sum(math) from student;
统计一个班级语文、英语、数学各科的总成绩
select sum(chinese),sum(english),sum(math) from student;
统计一个班级语文、英语、数学的成绩总和
select sum(chinese+english+math) from student;
统计一个班级语文成绩平均分
select sum(chinese)/count(*) from student;
统计一个班级语文成绩平均分
select avg(chinese) from student;
求一个班级总分平均分
select avg(chinese+math+english) from student;
求班级最高分和最低分
select max(chinese+math+english),min(chinese+math+english) from student;
*控制台上部分执行内容:
C:\Users\ch>mysql -u root -p
Enter password: ****
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 9
Server version: 5.5.30 MySQL Community Server (GPL)
Copyright (c) 2000, 2013, Oracle and/or its affiliates. All rights reserved.
Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners.
Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.
mysql> select * from person;
ERROR 1046 (3D000): No database selected
mysql> use sanguo;
Database changed
mysql> select * from person;
+----+-------------------+------+----------------------------------------+------
---+
| id | name | age | address | dept_
id |
+----+-------------------+------+----------------------------------------+------
---+
| 1 | 寮犻(缈煎痉) | 23 | 娌冲寳瑗夸埂(骞藉窞娑块儭)
| 1 |
| 2 | 鍏崇窘(浜戦暱) | 24 | 灞辫タ杩愬煄(骞跺窞娌充笢瑙e幙)
| 1 |
| 3 | 鍒樺(鐜勫痉) | 25 | 娌冲寳娑垮窞(骞藉窞娑块儭娑垮幙)
| 1 |
| 4 | 鏇规搷(瀛熷痉) | 26 | 瀹夊窘浜冲窞(鍏栧窞娌涘浗璋幙)
| 2 |
| 5 | 璧典簯(瀛愰緳) | 18 | 娌冲寳姝e畾(鍐€宸炲父灞辩湡瀹?
| 1 |
| 6 | 榛勫繝(姹夊崌) | 45 | 娌冲崡鍗楅槼(鑽嗗窞鍗楅槼)
| 1 |
| 7 | 榄忓欢(鏂囬暱) | 20 | 娌冲崡妗愭煆(鑽嗗窞鐩婇槼閮?
| 1 |
| 8 | 璨傝潐(鏃? | 18 | 涓嶈 |
4 |
| 9 | 榛勭洊(鍏) | 36 | 婀栧崡闆堕櫟(鑽嗗窞闆堕櫟娉夐櫟)
| 3 |
| 10 | 瀛欐潈(浠茶皨) | 21 | 娴欐睙瀵岄槼(鎵窞鍚撮儭瀵屾槬)
| 3 |
| 11 | 璇歌憶浜?瀛旀槑) | 17 | 灞变笢娌傚崡鍘垮崡(寰愬窞鐞呴偑閮?
| 1 |
| 12 | 澶т箶(鏃? | 18 | 瀹夊窘娼滃北(鎵窞搴愭睙鐨栧幙)
| 3 |
| 13 | 椹秴(瀛熻捣) | 19 | 闄曡タ鍏村钩(鍙稿窞鎵堕鑼傞櫟)
| 1 |
| 14 | 寮犺窘(鏂囪繙) | 28 | 闆侀棬椹倯 (灞辫タ鏈斿幙)
| 2 |
| 15 | 鍚曞竷(濂夊厛) | 27 | 鍐呰挋鍙ゅ寘澶?骞跺窞浜斿師閮′節鍘?
| 4 |
| 16 | 钁e崜(浠查) | 30 | 鐢樿們涓存串(鍑夊窞闄囪タ涓存串)
| 4 |
| 17 | 璐捐(鏂囧拰) | 29 | 鐢樿們姝﹀▉(鍑夊窞姝﹀▉濮戣嚙)
| 2 |
| 18 | 灏忎箶(鏃? | 17 | 瀹夊窘娼滃北(鎵窞搴愭睙鐨栧幙)
| 3 |
| 19 | 琚佺粛(鏈垵) | 32 | 娌冲崡姹濋槼(璞窞姹濆崡姹濋槼)
| 4 |
| 20 | 澶彶鎱?瀛愪箟) | 38 | 涓滆幈榛勫幙 (浠婂北涓滈緳鍙?
| 3 |
| 21 | 鍙搁┈鎳?浠茶揪) | 28 | 娌冲崡娓╁幙(鍙稿窞娌冲唴娓╁幙)
| 2 |
| 22 | 鐢樺畞(鍏撮湼) | 16 | 閲嶅簡蹇犲幙(鐩婂窞宸撮儭涓存睙)
| 4 |
| 23 | 寮犻儍(淇婁箓) | 24 | 娌冲寳浠讳笜鍖?鍐€宸炴渤闂撮剼鍘?
| 2 |
| 24 | 搴炲痉(浠ゆ槑) | 20 | 鐢樿們闄囪タ涓滃崡(闆嶅窞鍗楀畨鐙勯亾)
| 2 |
| 25 | 鍛ㄦ嘲(骞煎钩) | 21 | 瀹夊窘鍑ゅ彴(鎵窞涔濇睙涓嬭敗)
| 3 |
| 26 | 娉曟(瀛濈洿) | 20 | 闄曡タ鐪夊幙(闆嶅窞鎵堕閮垮幙)
| 1 |
| 27 | 璁歌(浠插悍) | 21 | 瀹夊窘姣窞(璞窞璋浗璋幙)
| 2 |
| 28 | 闄嗛€?浼█) | 18 | 涓婃捣鏉炬睙(鎵窞鍚撮儭鍚村幙鍗庝涵)
| 3 |
| 29 | 寰愬憾(鍏冪洿) | 22 | 娌冲崡璁告槍涓€甯?璞窞棰嶅窛閮?
| 2 |
| 30 | 瀛旇瀺(鏂囦妇) | 24 | 灞变笢鏇查槣(椴佸浗)
| 2 |
| 31 | 閮槈(濂夊瓭) | 31 | 娌冲崡绂瑰窞(璞窞棰栧窛闃崇繜)
| 2 |
| 32 | 涔愯繘(鏂囪唉) | 37 | 闃冲钩鍗浗(娌冲崡娓呬赴)
| 2 |
| 33 | 澶忎警娓?濡欐墠) | 32 | 瀹夊窘浜冲窞(鍏栧窞娌涘浗璋幙)
| 2 |
| 34 | 澶忎警鎯?鍏冭) | 34 | 瀹夊窘浜冲窞(鍏栧窞娌涘浗璋幙)
| 2 |
+----+-------------------+------+----------------------------------------+------
---+
34 rows in set (0.00 sec)
mysql> set character_set_results=gb2312;
Query OK, 0 rows affected (0.00 sec)
mysql> select * from person;
+----+--------------+------+----------------------------+---------+
| id | name | age | address | dept_id |
+----+--------------+------+----------------------------+---------+
| 1 | 张飞(翼德) | 23 | 河北西乡(幽州涿郡) |
1 |
| 2 | 关羽(云长) | 24 | 山西运城(并州河东解县) |
1 |
| 3 | 刘备(玄德) | 25 | 河北涿州(幽州涿郡涿县)
| 1 |
| 4 | 曹操(孟德) | 26 | 安徽亳州(兖州沛国谯县)
| 2 |
| 5 | 赵云(子龙) | 18 | 河北正定(冀州常山真定) |
1 |
| 6 | 黄忠(汉升) | 45 | 河南南阳(荆州南阳)
| 1 |
| 7 | 魏延(文长) | 20 | 河南桐柏(荆州益阳郡) |
1 |
| 8 | 貂蝉(无) | 18 | 不详 | 4 |
| 9 | 黄盖(公覆) | 36 | 湖南零陵(荆州零陵泉陵)
| 3 |
| 10 | 孙权(仲谋) | 21 | 浙江富阳(扬州吴郡富春) |
3 |
| 11 | 诸葛亮(孔明) | 17 | 山东沂南县南(徐州琅邪都)
| 1 |
| 12 | 大乔(无) | 18 | 安徽潜山(扬州庐江皖县) |
3 |
| 13 | 马超(孟起) | 19 | 陕西兴平(司州扶风茂陵) |
1 |
| 14 | 张辽(文远) | 28 | 雁门马邑 (山西朔县) |
2 |
| 15 | 吕布(奉先) | 27 | 内蒙古包头(并州五原郡九原)
| 4 |
| 16 | 董卓(仲颖) | 30 | 甘肃临洮(凉州陇西临洮)
| 4 |
| 17 | 贾诩(文和) | 29 | 甘肃武威(凉州武威姑臧)
| 2 |
| 18 | 小乔(无) | 17 | 安徽潜山(扬州庐江皖县) |
3 |
| 19 | 袁绍(本初) | 32 | 河南汝阳(豫州汝南汝阳)
| 4 |
| 20 | 太史慈(子义) | 38 | 东莱黄县 (今山东龙口)
| 3 |
| 21 | 司马懿(仲达) | 28 | 河南温县(司州河内温县)
| 2 |
| 22 | 甘宁(兴霸) | 16 | 重庆忠县(益州巴郡临江)
| 4 |
| 23 | 张?(俊?) | 24 | 河北任丘北(冀州河间?县) |
2 |
| 24 | 庞德(令明) | 20 | 甘肃陇西东南(雍州南安狄道)
| 2 |
| 25 | 周泰(幼平) | 21 | 安徽凤台(扬州九江下蔡) |
3 |
| 26 | 法正(孝直) | 20 | 陕西眉县(雍州扶风?县) |
1 |
| 27 | 许褚(仲康) | 21 | 安徽毫州(豫州谯国谯县)
| 2 |
| 28 | 陆逊(伯言) | 18 | 上海松江(扬州吴郡吴县华亭)
| 3 |
| 29 | 徐庶(元直) | 22 | 河南许昌一带(豫州颍川郡)
| 2 |
| 30 | 孔融(文举) | 24 | 山东曲阜(鲁国) |
2 |
| 31 | 郭嘉(奉孝) | 31 | 河南禹州(豫州颖川阳翟)
| 2 |
| 32 | 乐进(文谦) | 37 | 阳平卫国(河南清丰) |
2 |
| 33 | 夏侯渊(妙才) | 32 | 安徽亳州(兖州沛国谯县)
| 2 |
| 34 | 夏侯?(元让) | 34 | 安徽亳州(兖州沛国谯县)
| 2 |
+----+--------------+------+----------------------------+---------+
34 rows in set (0.00 sec)
mysql> use mydb1;
Database changed
mysql> select * from employee;
+------+------+------+------------+------------+------+--------+--------+
| id | name | sex | birthday | entry_date | job | salary | resume |
+------+------+------+------------+------------+------+--------+--------+
| 1 | aaa | NULL | 1980-09-09 | 1980-09-09 | bbb | 90.00 | aaaaa |
| 2 | bbbb | NULL | 1994-02-08 | 2014-08-08 | cccc | 90.00 | aaaaa |
+------+------+------+------------+------------+------+--------+--------+
2 rows in set (0.00 sec)
mysql> update employee set salary=3000 where id=1;
Query OK, 1 row affected (0.11 sec)
Rows matched: 1 Changed: 1 Warnings: 0
mysql> select * from employee;
+------+------+------+------------+------------+------+---------+--------+
| id | name | sex | birthday | entry_date | job | salary | resume |
+------+------+------+------------+------------+------+---------+--------+
| 1 | aaa | NULL | 1980-09-09 | 1980-09-09 | bbb | 3000.00 | aaaaa |
| 2 | bbbb | NULL | 1994-02-08 | 2014-08-08 | cccc | 90.00 | aaaaa |
+------+------+------+------------+------------+------+---------+--------+
2 rows in set (0.00 sec)
mysql> delete employee set salary=3000 where id=1;
ERROR 1064 (42000): You have an error in your SQL syntax; check the manual that
corresponds to your MySQL server version for the right syntax to use near 'set s
alary=3000 where id=1' at line 1
mysql> delete from employee where id=1;
Query OK, 1 row affected (0.08 sec)
mysql> select * from employee;
+------+------+------+------------+------------+------+--------+--------+
| id | name | sex | birthday | entry_date | job | salary | resume |
+------+------+------+------------+------------+------+--------+--------+
| 2 | bbbb | NULL | 1994-02-08 | 2014-08-08 | cccc | 90.00 | aaaaa |
+------+------+------+------------+------------+------+--------+--------+
1 row in set (0.00 sec)
mysql> selete count(*) from employee;
ERROR 1064 (42000): You have an error in your SQL syntax; check the manual that
corresponds to your MySQL server version for the right syntax to use near 'selet
e count(*) from employee' at line 1
mysql> select count(*) from employee;
+----------+
| count(*) |
+----------+
| 1 |
+----------+
1 row in set (0.00 sec)
mysql> select count(*) from employee where salary>10;
+----------+
| count(*) |
+----------+
| 1 |
+----------+
1 row in set (0.00 sec)
mysql> bye;
ERROR 1064 (42000): You have an error in your SQL syntax; check the manual that
corresponds to your MySQL server version for the right syntax to use near 'bye'
at line 1
mysql> bye:
->
-> ;
ERROR 1064 (42000): You have an error in your SQL syntax; check the manual that
corresponds to your MySQL server version for the right syntax to use near 'bye:'
at line 1
mysql> exit;
Bye
C:\Users\ch>
**按照安装步骤安装mysql之后,学习一下指令:
打开MySQL: mysql -u root -p
创建一个名为“mydb1”的数据库: create database 数据库名;
show databases;
在当前数据库中创建一张表: create table 表格名
(
id int,
name varchar(40),
sex varchar(4),
birthday date,
entry_date date,
job varchar(40),
salary decimal(8,2),
resume text
);
在当前表中写入一条数据: insert into
employee(id,username,birthday,entry_date,job,salary,resume)
values(1,'aaa','1980-09-09','1980-09-09','bbb',90,'aaaaa');
查看数据库: use 数据库名;
查看当前数据库中的一条表格: select * from 表格名;
向当前数据库中导入.sql脚本: source 脚本所在路径
改变输出编码: set character_set_results=gb2312;
修改当前数据库中一表格的部分内容: update 表格名 set 需修改元素=修改值 where id=1;
查找: select count(*) from 表格名 ;
select count(*) from 表格名 where 属性条件 ;
select * from 表格名 where name like '李%';
*关于 count的函数的细节 (count只统有值的行)----------支持数学统筹
统计一个班级数学总成绩?
select sum(math) from student;
统计一个班级语文、英语、数学各科的总成绩
select sum(chinese),sum(english),sum(math) from student;
统计一个班级语文、英语、数学的成绩总和
select sum(chinese+english+math) from student;
统计一个班级语文成绩平均分
select sum(chinese)/count(*) from student;
统计一个班级语文成绩平均分
select avg(chinese) from student;
求一个班级总分平均分
select avg(chinese+math+english) from student;
求班级最高分和最低分
select max(chinese+math+english),min(chinese+math+english) from student;
*控制台上部分执行内容:
C:\Users\曹辉>mysql -u root -p
Enter password: ****
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 9
Server version: 5.5.30 MySQL Community Server (GPL)
Copyright (c) 2000, 2013, Oracle and/or its affiliates. All rights reserved.
Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners.
Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.
mysql> select * from person;
ERROR 1046 (3D000): No database selected
mysql> use sanguo;
Database changed
mysql> select * from person;
+----+-------------------+------+----------------------------------------+------
---+
| id | name | age | address | dept_
id |
+----+-------------------+------+----------------------------------------+------
---+
| 1 | 寮犻(缈煎痉) | 23 | 娌冲寳瑗夸埂(骞藉窞娑块儭)
| 1 |
| 2 | 鍏崇窘(浜戦暱) | 24 | 灞辫タ杩愬煄(骞跺窞娌充笢瑙e幙)
| 1 |
| 3 | 鍒樺(鐜勫痉) | 25 | 娌冲寳娑垮窞(骞藉窞娑块儭娑垮幙)
| 1 |
| 4 | 鏇规搷(瀛熷痉) | 26 | 瀹夊窘浜冲窞(鍏栧窞娌涘浗璋幙)
| 2 |
| 5 | 璧典簯(瀛愰緳) | 18 | 娌冲寳姝e畾(鍐€宸炲父灞辩湡瀹?
| 1 |
| 6 | 榛勫繝(姹夊崌) | 45 | 娌冲崡鍗楅槼(鑽嗗窞鍗楅槼)
| 1 |
| 7 | 榄忓欢(鏂囬暱) | 20 | 娌冲崡妗愭煆(鑽嗗窞鐩婇槼閮?
| 1 |
| 8 | 璨傝潐(鏃? | 18 | 涓嶈 |
4 |
| 9 | 榛勭洊(鍏) | 36 | 婀栧崡闆堕櫟(鑽嗗窞闆堕櫟娉夐櫟)
| 3 |
| 10 | 瀛欐潈(浠茶皨) | 21 | 娴欐睙瀵岄槼(鎵窞鍚撮儭瀵屾槬)
| 3 |
| 11 | 璇歌憶浜?瀛旀槑) | 17 | 灞变笢娌傚崡鍘垮崡(寰愬窞鐞呴偑閮?
| 1 |
| 12 | 澶т箶(鏃? | 18 | 瀹夊窘娼滃北(鎵窞搴愭睙鐨栧幙)
| 3 |
| 13 | 椹秴(瀛熻捣) | 19 | 闄曡タ鍏村钩(鍙稿窞鎵堕鑼傞櫟)
| 1 |
| 14 | 寮犺窘(鏂囪繙) | 28 | 闆侀棬椹倯 (灞辫タ鏈斿幙)
| 2 |
| 15 | 鍚曞竷(濂夊厛) | 27 | 鍐呰挋鍙ゅ寘澶?骞跺窞浜斿師閮′節鍘?
| 4 |
| 16 | 钁e崜(浠查) | 30 | 鐢樿們涓存串(鍑夊窞闄囪タ涓存串)
| 4 |
| 17 | 璐捐(鏂囧拰) | 29 | 鐢樿們姝﹀▉(鍑夊窞姝﹀▉濮戣嚙)
| 2 |
| 18 | 灏忎箶(鏃? | 17 | 瀹夊窘娼滃北(鎵窞搴愭睙鐨栧幙)
| 3 |
| 19 | 琚佺粛(鏈垵) | 32 | 娌冲崡姹濋槼(璞窞姹濆崡姹濋槼)
| 4 |
| 20 | 澶彶鎱?瀛愪箟) | 38 | 涓滆幈榛勫幙 (浠婂北涓滈緳鍙?
| 3 |
| 21 | 鍙搁┈鎳?浠茶揪) | 28 | 娌冲崡娓╁幙(鍙稿窞娌冲唴娓╁幙)
| 2 |
| 22 | 鐢樺畞(鍏撮湼) | 16 | 閲嶅簡蹇犲幙(鐩婂窞宸撮儭涓存睙)
| 4 |
| 23 | 寮犻儍(淇婁箓) | 24 | 娌冲寳浠讳笜鍖?鍐€宸炴渤闂撮剼鍘?
| 2 |
| 24 | 搴炲痉(浠ゆ槑) | 20 | 鐢樿們闄囪タ涓滃崡(闆嶅窞鍗楀畨鐙勯亾)
| 2 |
| 25 | 鍛ㄦ嘲(骞煎钩) | 21 | 瀹夊窘鍑ゅ彴(鎵窞涔濇睙涓嬭敗)
| 3 |
| 26 | 娉曟(瀛濈洿) | 20 | 闄曡タ鐪夊幙(闆嶅窞鎵堕閮垮幙)
| 1 |
| 27 | 璁歌(浠插悍) | 21 | 瀹夊窘姣窞(璞窞璋浗璋幙)
| 2 |
| 28 | 闄嗛€?浼█) | 18 | 涓婃捣鏉炬睙(鎵窞鍚撮儭鍚村幙鍗庝涵)
| 3 |
| 29 | 寰愬憾(鍏冪洿) | 22 | 娌冲崡璁告槍涓€甯?璞窞棰嶅窛閮?
| 2 |
| 30 | 瀛旇瀺(鏂囦妇) | 24 | 灞变笢鏇查槣(椴佸浗)
| 2 |
| 31 | 閮槈(濂夊瓭) | 31 | 娌冲崡绂瑰窞(璞窞棰栧窛闃崇繜)
| 2 |
| 32 | 涔愯繘(鏂囪唉) | 37 | 闃冲钩鍗浗(娌冲崡娓呬赴)
| 2 |
| 33 | 澶忎警娓?濡欐墠) | 32 | 瀹夊窘浜冲窞(鍏栧窞娌涘浗璋幙)
| 2 |
| 34 | 澶忎警鎯?鍏冭) | 34 | 瀹夊窘浜冲窞(鍏栧窞娌涘浗璋幙)
| 2 |
+----+-------------------+------+----------------------------------------+------
---+
34 rows in set (0.00 sec)
mysql> set character_set_results=gb2312;
Query OK, 0 rows affected (0.00 sec)
mysql> select * from person;
+----+--------------+------+----------------------------+---------+
| id | name | age | address | dept_id |
+----+--------------+------+----------------------------+---------+
| 1 | 张飞(翼德) | 23 | 河北西乡(幽州涿郡) |
1 |
| 2 | 关羽(云长) | 24 | 山西运城(并州河东解县) |
1 |
| 3 | 刘备(玄德) | 25 | 河北涿州(幽州涿郡涿县)
| 1 |
| 4 | 曹操(孟德) | 26 | 安徽亳州(兖州沛国谯县)
| 2 |
| 5 | 赵云(子龙) | 18 | 河北正定(冀州常山真定) |
1 |
| 6 | 黄忠(汉升) | 45 | 河南南阳(荆州南阳)
| 1 |
| 7 | 魏延(文长) | 20 | 河南桐柏(荆州益阳郡) |
1 |
| 8 | 貂蝉(无) | 18 | 不详 | 4 |
| 9 | 黄盖(公覆) | 36 | 湖南零陵(荆州零陵泉陵)
| 3 |
| 10 | 孙权(仲谋) | 21 | 浙江富阳(扬州吴郡富春) |
3 |
| 11 | 诸葛亮(孔明) | 17 | 山东沂南县南(徐州琅邪都)
| 1 |
| 12 | 大乔(无) | 18 | 安徽潜山(扬州庐江皖县) |
3 |
| 13 | 马超(孟起) | 19 | 陕西兴平(司州扶风茂陵) |
1 |
| 14 | 张辽(文远) | 28 | 雁门马邑 (山西朔县) |
2 |
| 15 | 吕布(奉先) | 27 | 内蒙古包头(并州五原郡九原)
| 4 |
| 16 | 董卓(仲颖) | 30 | 甘肃临洮(凉州陇西临洮)
| 4 |
| 17 | 贾诩(文和) | 29 | 甘肃武威(凉州武威姑臧)
| 2 |
| 18 | 小乔(无) | 17 | 安徽潜山(扬州庐江皖县) |
3 |
| 19 | 袁绍(本初) | 32 | 河南汝阳(豫州汝南汝阳)
| 4 |
| 20 | 太史慈(子义) | 38 | 东莱黄县 (今山东龙口)
| 3 |
| 21 | 司马懿(仲达) | 28 | 河南温县(司州河内温县)
| 2 |
| 22 | 甘宁(兴霸) | 16 | 重庆忠县(益州巴郡临江)
| 4 |
| 23 | 张?(俊?) | 24 | 河北任丘北(冀州河间?县) |
2 |
| 24 | 庞德(令明) | 20 | 甘肃陇西东南(雍州南安狄道)
| 2 |
| 25 | 周泰(幼平) | 21 | 安徽凤台(扬州九江下蔡) |
3 |
| 26 | 法正(孝直) | 20 | 陕西眉县(雍州扶风?县) |
1 |
| 27 | 许褚(仲康) | 21 | 安徽毫州(豫州谯国谯县)
| 2 |
| 28 | 陆逊(伯言) | 18 | 上海松江(扬州吴郡吴县华亭)
| 3 |
| 29 | 徐庶(元直) | 22 | 河南许昌一带(豫州颍川郡)
| 2 |
| 30 | 孔融(文举) | 24 | 山东曲阜(鲁国) |
2 |
| 31 | 郭嘉(奉孝) | 31 | 河南禹州(豫州颖川阳翟)
| 2 |
| 32 | 乐进(文谦) | 37 | 阳平卫国(河南清丰) |
2 |
| 33 | 夏侯渊(妙才) | 32 | 安徽亳州(兖州沛国谯县)
| 2 |
| 34 | 夏侯?(元让) | 34 | 安徽亳州(兖州沛国谯县)
| 2 |
+----+--------------+------+----------------------------+---------+
34 rows in set (0.00 sec)
mysql> use mydb1;
Database changed
mysql> select * from employee;
+------+------+------+------------+------------+------+--------+--------+
| id | name | sex | birthday | entry_date | job | salary | resume |
+------+------+------+------------+------------+------+--------+--------+
| 1 | aaa | NULL | 1980-09-09 | 1980-09-09 | bbb | 90.00 | aaaaa |
| 2 | bbbb | NULL | 1994-02-08 | 2014-08-08 | cccc | 90.00 | aaaaa |
+------+------+------+------------+------------+------+--------+--------+
2 rows in set (0.00 sec)
mysql> update employee set salary=3000 where id=1;
Query OK, 1 row affected (0.11 sec)
Rows matched: 1 Changed: 1 Warnings: 0
mysql> select * from employee;
+------+------+------+------------+------------+------+---------+--------+
| id | name | sex | birthday | entry_date | job | salary | resume |
+------+------+------+------------+------------+------+---------+--------+
| 1 | aaa | NULL | 1980-09-09 | 1980-09-09 | bbb | 3000.00 | aaaaa |
| 2 | bbbb | NULL | 1994-02-08 | 2014-08-08 | cccc | 90.00 | aaaaa |
+------+------+------+------------+------------+------+---------+--------+
2 rows in set (0.00 sec)
mysql> delete employee set salary=3000 where id=1;
ERROR 1064 (42000): You have an error in your SQL syntax; check the manual that
corresponds to your MySQL server version for the right syntax to use near 'set s
alary=3000 where id=1' at line 1
mysql> delete from employee where id=1;
Query OK, 1 row affected (0.08 sec)
mysql> select * from employee;
+------+------+------+------------+------------+------+--------+--------+
| id | name | sex | birthday | entry_date | job | salary | resume |
+------+------+------+------------+------------+------+--------+--------+
| 2 | bbbb | NULL | 1994-02-08 | 2014-08-08 | cccc | 90.00 | aaaaa |
+------+------+------+------------+------------+------+--------+--------+
1 row in set (0.00 sec)
mysql> selete count(*) from employee;
ERROR 1064 (42000): You have an error in your SQL syntax; check the manual that
corresponds to your MySQL server version for the right syntax to use near 'selet
e count(*) from employee' at line 1
mysql> select count(*) from employee;
+----------+
| count(*) |
+----------+
| 1 |
+----------+
1 row in set (0.00 sec)
mysql> select count(*) from employee where salary>10;
+----------+
| count(*) |
+----------+
| 1 |
+----------+
1 row in set (0.00 sec)
mysql> bye;
ERROR 1064 (42000): You have an error in your SQL syntax; check the manual that
corresponds to your MySQL server version for the right syntax to use near 'bye'
at line 1
mysql> bye:
->
-> ;
ERROR 1064 (42000): You have an error in your SQL syntax; check the manual that
corresponds to your MySQL server version for the right syntax to use near 'bye:'
at line 1
mysql> exit;
Bye
C:\Users\曹辉>
0 0
- 【悠然】mysql简单指令笔记
- 【悠然】JSP笔记
- mysql简单指令
- mysql 指令笔记
- MySQL常用指令(笔记)
- MySql 简单指令、小问题等
- MySQL 基础指令及其简单应用
- 悠然夏日
- MySQL简单笔记
- MySQL简单笔记
- MySQL GTID简单笔记
- <笔记>Mysql简单使用
- mysql笔记一 ----mysql数据库的安装和基础指令
- MySql学习笔记----简单命令
- MySQL指令
- mysql指令
- mysql指令
- MySQL指令
- 使用javascript脚本 在跳转页面中刷新源页面
- 【悠然】JSP笔记
- 条件注释判断IE浏览器,<!--[if IE]>条件注释区分非IE浏览器
- Oracle命令(一):Oracle登录命令
- node.js环境搭建
- 【悠然】mysql简单指令笔记
- 采用数据流而非CCUserdefault来读取数据,从而确保数据安全性
- vc ++ 实现检测变速齿轮,变速精灵, 变速类辅助工具
- 适配器设计模式
- vpn原理及实现--虚拟网卡构建vpn
- CAS学习笔记(一)--认识CAS
- Android 处理简单单击事件的监听方法
- silicon labs 的网站
- uva10887Concatenation of Languages