mysql語句以及實(shí)例

數(shù)據(jù)庫操作

數(shù)據(jù)庫備份與恢復(fù)

備份mydb數(shù)據(jù)庫肆饶,使用mydb.sql文件存儲
[root@localhost bin]# mysqldump -u root -p mydb > mydb.sql
備份mydb數(shù)據(jù)庫中的stu表驯镊,使用mydb.sql文件存儲
[root@localhost bin]# mysqldump -u root -p mydb stu > mydb_stu.sql
恢復(fù)mydb數(shù)據(jù)信息(條件是mydb庫存在)
[root@localhost bin]# mysql -u root -p mydb < mydb.sql
查看當(dāng)前MySQL下的所有數(shù)據(jù)庫
mysql> show databases;
+--------------------+
| Database           |
+--------------------+
| information_schema |
| mysql              |
| performance_schema |
| test               |
+--------------------+
4 rows in set (0.00 sec)

創(chuàng)建一個mydb2的數(shù)據(jù)庫

mysql> create database mydb2;
Query OK, 1 row affected (0.01 sec)

mysql> show databases;
+--------------------+
| Database           |
+--------------------+
| information_schema |
| mydb2              |
| mysql              |
| performance_schema |
| test               |
+--------------------+
5 rows in set (0.00 sec)

刪除數(shù)據(jù)庫mydb2

mysql> drop database mydb2;
Query OK, 0 rows affected (0.04 sec)

mysql> show databases;
+--------------------+
| Database           |
+--------------------+
| information_schema |
| mysql              |
| performance_schema |
| test               |
+--------------------+
4 rows in set (0.00 sec)
創(chuàng)建一個mydb數(shù)據(jù)庫
mysql> create database mydb;
Query OK, 1 row affected (0.00 sec)
再次常見mydb數(shù)據(jù)庫會報(bào)錯
mysql> create database mydb;
ERROR 1007 (HY000): Can''t create database 'mydb'; database exists
嘗試創(chuàng)建mydb數(shù)據(jù)庫(若已存在則會報(bào)一個警告候衍,不會報(bào)Error錯誤)
mysql> create database if not exists  mydb;
Query OK, 1 row affected, 1 warning (0.00 sec)
查看mydb的建庫語句
mysql> show create database mydb;
+----------+---------------------------------------------------------------+
| Database | Create Database                                               |
+----------+---------------------------------------------------------------+
| mydb     | CREATE DATABASE `mydb` /*!40100 DEFAULT CHARACTER SET utf8 */ |
+----------+---------------------------------------------------------------+
1 row in set (0.00 sec)

mysql> show create database mydb\G
*************************** 1. row ***************************
       Database: mydb
Create Database: CREATE DATABASE `mydb` /*!40100 DEFAULT CHARACTER SET utf8 */
1 row in set (0.00 sec)
查看當(dāng)前所在數(shù)據(jù)庫位置:NULL表示沒有在任何數(shù)據(jù)庫中
mysql> select database();
+------------+
| database() |
+------------+
| NULL       |
+------------+
1 row in set (0.00 sec)
選擇進(jìn)入mydb數(shù)據(jù)庫
mysql> use mydb;
Database changed
查看當(dāng)前所在數(shù)據(jù)庫的位置
mysql> select database();
+------------+
| database() |
+------------+
| mydb       |
+------------+
1 row in set (0.00 sec)
查看當(dāng)前數(shù)據(jù)庫中的所有表
mysql> show tables;
Empty set (0.00 sec)
創(chuàng)建一個uu表,內(nèi)有三個字段id惋戏,name和age
mysql> create table uu(id int,name varchar(16),age int);
Query OK, 0 rows affected (0.09 sec)
查看uu表的建表語句
mysql> show create table uu\G
*************************** 1. row ***************************
       Table: uu
Create Table: CREATE TABLE `uu` (
  `id` int(11) DEFAULT NULL,
  `name` varchar(16) DEFAULT NULL,
  `age` int(11) DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8
1 row in set (0.00 sec)
刪除uu表
mysql> drop table uu;
Query OK, 0 rows affected (0.02 sec)
添加一個數(shù)據(jù)响逢,給定所有字段,所有的值
mysql> insert into uu(id,name,age) values(1,'zhangsan',20);
Query OK, 1 row affected (0.01 sec)

mysql> insert into uu(id,name,age) values(2,'lisi',22);
Query OK, 1 row affected (0.02 sec)
不指定字段募胃,添加值,值按默認(rèn)順序?qū)?/h5>
mysql> insert into uu values(3,'wangwu',25);
Query OK, 1 row affected (0.01 sec)
批量添加值
mysql> insert into uu values(4,'zhaoliu',21),
    -> (5,'xiaoli',22),
    -> (6,'xiaozhang',19);
Query OK, 3 rows affected (0.05 sec)
Records: 3  Duplicates: 0  Warnings: 0
將id值為4的信息age改為30(修改)
mysql> update uu set age=30 where id=4;
Query OK, 1 row affected (0.02 sec)
Rows matched: 1  Changed: 1  Warnings: 0

mysql> select * from uu;
+------+-----------+------+
| id   | name      | age  |
+------+-----------+------+
|    1 | zhangsan  |   20 |
|    2 | lisi      |   22 |
|    3 | wangwu    |   25 |
|    4 | zhaoliu   |   30 |
|    5 | xiaoli    |   22 |
|    6 | xiaozhang |   19 |
+------+-----------+------+
6 rows in set (0.00 sec)
刪除id為5的所有信息
mysql> delete from uu where id=5;
Query OK, 1 row affected (0.01 sec)

修改表結(jié)構(gòu)實(shí)例

mysql> show create table tt\G
*************************** 1. row ***************************
       Table: tt
Create Table: CREATE TABLE `tt` (
  `id` int(11) DEFAULT NULL,
  `name` varchar(16) DEFAULT NULL,
  `age` int(11) DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8
1 row in set (0.00 sec)

mysql> desc tt;
+-------+-------------+------+-----+---------+-------+
| Field | Type        | Null | Key | Default | Extra |
+-------+-------------+------+-----+---------+-------+
| id    | int(11)     | YES  |     | NULL    |       |
| name  | varchar(16) | YES  |     | NULL    |       |
| age   | int(11)     | YES  |     | NULL    |       |
+-------+-------------+------+-----+---------+-------+
3 rows in set (0.00 sec)
1. 在tt表末尾添加一個phone字段让簿,類型varchar(11)抽兆,無其他約束
mysql> alter table tt add phone varchar(11);
2. 在tt表中age字段后添加一個address字段,類型varchar(100) 导盅,無其他約束
mysql> alter table tt add address varchar(100) after age;
3. 在tt表首位插入一個mm字段白翻,類型int
mysql> alter table tt add mm int first;
mysql> desc tt;
+---------+--------------+------+-----+---------+-------+
| Field   | Type         | Null | Key | Default | Extra |
+---------+--------------+------+-----+---------+-------+
| mm      | int(11)      | YES  |     | NULL    |       |
| id      | int(11)      | YES  |     | NULL    |       |
| name    | varchar(16)  | YES  |     | NULL    |       |
| age     | int(11)      | YES  |     | NULL    |       |
| address | varchar(100) | YES  |     | NULL    |       |
| phone   | varchar(11)  | YES  |     | NULL    |       |
+---------+--------------+------+-----+---------+-------+
6 rows in set (0.01 sec)
4. 刪除tt表的mm字段
mysql> alter table tt drop mm;
5. 修改字段:tt表age字段類型改為tinyint類型岛琼,unsigned not null default 20
mysql> alter table tt modify age tinyint unsigned not null default 20; 
6. 修改name字段名為username
mysql> alter table tt change name username varchar(16);
Query OK, 0 rows affected (0.11 sec)
Records: 0  Duplicates: 0  Warnings: 0

mysql> desc tt;
+----------+---------------------+------+-----+---------+-------+
| Field    | Type                | Null | Key | Default | Extra |
+----------+---------------------+------+-----+---------+-------+
| id       | int(11)             | YES  |     | NULL    |       |
| username | varchar(16)         | YES  |     | NULL    |       |
| age      | tinyint(3) unsigned | NO   |     | 20      |       |
| address  | varchar(100)        | YES  |     | NULL    |       |
| phone    | varchar(11)         | YES  |     | NULL    |       |
+----------+---------------------+------+-----+---------+-------+
5 rows in set (0.00 sec)

數(shù)據(jù)的增熙涤、刪祠挫、改,查

=============

mysql> desc stu;
+---------+---------------------+------+-----+---------+----------------+
| Field   | Type                | Null | Key | Default | Extra          |
+---------+---------------------+------+-----+---------+----------------+
| id      | int(10) unsigned    | NO   | PRI | NULL    | auto_increment |
| name    | varchar(8)          | NO   | UNI | NULL    |                |
| age     | tinyint(3) unsigned | YES  |     | NULL    |                |
| sex     | enum('w','m')       | NO   |     | m       |                |
| classid | char(8)             | YES  |     | NULL    |                |
+---------+---------------------+------+-----+---------+----------------+
5 rows in set (0.03 sec)

1. 添加:

格式:insert into 表名[(字段列表)] values(值列表)[,(值列表)...]

標(biāo)準(zhǔn)添加sql慌植,指定所有字段,給定所有的值

mysql> insert into stu(id,name,age,sex,classid) values(1,'zhangsan',20,'m','python03');

指定部分字段只锭,給定部分值添加

mysql> insert into stu(name,age,classid) values('lisi',22,'python02');
Query OK, 1 row affected (0.02 sec)

不指定字段添加值(注意順序和個數(shù))

mysql> insert into stu values(null,'wangwu',25,'w','python03');
Query OK, 1 row affected (0.01 sec)

mysql> select * from stu;
+----+----------+------+-----+----------+
| id | name     | age  | sex | classid  |
+----+----------+------+-----+----------+
|  1 | zhangsan |   20 | m   | python03 |
|  2 | lisi     |   22 | m   | python02 |
|  3 | wangwu   |   25 | w   | python03 |
+----+----------+------+-----+----------+
3 rows in set (0.00 sec)

批量添加值

mysql> insert into stu values
    -> (null,'xiaoli',28,'m','python02'),
    -> (null,'xiaozhang',21,'w','python01'),
    -> (null,'xiaozhao',27,'m','python03'),
    -> (null,'uu01',18,'m','python03');
Query OK, 4 rows affected, 1 warning (0.02 sec)
Records: 4  Duplicates: 0  Warnings: 1

mysql> select * from stu;
+----+----------+------+-----+----------+
| id | name     | age  | sex | classid  |
+----+----------+------+-----+----------+
|  1 | zhangsan |   20 | m   | python03 |
|  2 | lisi     |   22 | m   | python02 |
|  3 | wangwu   |   25 | w   | python03 |
|  4 | xiaoli   |   28 | m   | python02 |
|  5 | xiaozhan |   21 | w   | python01 |
|  6 | xiaozhao |   27 | m   | python03 |
|  7 | uu01     |   18 | m   | python03 |
|  8 | uu02     | NULL | m   | NULL     |
|  9 | uu03     | NULL | m   | NULL     |
| 10 | uu04     | NULL | m   | NULL     |
| 11 | uu06     | NULL | m   | NULL     |
| 12 | uu08     | NULL | m   | NULL     |
+----+----------+------+-----+----------+
12 rows in set (0.00 sec)

2. 刪除數(shù)據(jù)

格式: delete from 表名 [where 條件 [分組、排序纵顾、limit]]

刪除id為20的信息
mysql> delete from stu where id=20;
Query OK, 0 rows affected (0.00 sec)
刪除id大于100的所有信息
mysql> delete from stu where id>100;
Query OK, 0 rows affected (0.00 sec)
刪除id是100~200的所有信息
mysql> delete from stu where id between 100 and 200;
等價(jià)于
mysql> delete from stu where id>=100 and id<=200;
Query OK, 0 rows affected (0.00 sec)
刪除性別為w,年齡大于25的所有信息
mysql> delete from stu where sex='w' and age>25;
Query OK, 0 rows affected (0.00 sec)

3. 修改數(shù)據(jù)

格式:update 表名 set 字段名1=值1[,字段名2=值2,...] [where 條件...]

將id為9和11 的年齡age改為23汉额,班級classid改為python03
 mysql> update stu set age=23,classid='python03' where id in(9,11);
Query OK, 2 rows affected (0.08 sec)
Rows matched: 2  Changed: 2  Warnings: 0

mysql> select * from stu;
+----+----------+------+-----+----------+
| id | name     | age  | sex | classid  |
+----+----------+------+-----+----------+
|  1 | zhangsan |   20 | m   | python03 |
|  2 | lisi     |   22 | m   | python02 |
|  3 | wangwu   |   25 | w   | python03 |
|  4 | xiaoli   |   28 | m   | python02 |
|  5 | xiaozhan |   21 | w   | python01 |
|  6 | xiaozhao |   27 | m   | python03 |
|  7 | uu01     |   18 | m   | python03 |
|  8 | uu02     | NULL | m   | NULL     |
|  9 | uu03     |   23 | m   | python03 |
| 10 | uu04     | NULL | m   | NULL     |
| 11 | uu06     |   23 | m   | python03 |
| 12 | uu08     | NULL | m   | NULL     |
+----+----------+------+-----+----------+
12 rows in set (0.00 sec)
將id為8,10和12 的年齡age改為26,班級classid改為python02
mysql> update stu set age=26,classid='python02' where id in(8,10,12);
Query OK, 3 rows affected (0.02 sec)
Rows matched: 3  Changed: 3  Warnings: 0

mysql> select * from stu;
+----+----------+------+-----+----------+
| id | name     | age  | sex | classid  |
+----+----------+------+-----+----------+
|  1 | zhangsan |   20 | m   | python03 |
|  2 | lisi     |   22 | m   | python02 |
|  3 | wangwu   |   25 | w   | python03 |
|  4 | xiaoli   |   28 | m   | python02 |
|  5 | xiaozhan |   21 | w   | python01 |
|  6 | xiaozhao |   27 | m   | python03 |
|  7 | uu01     |   18 | m   | python03 |
|  8 | uu02     |   26 | m   | python02 |
|  9 | uu03     |   23 | m   | python03 |
| 10 | uu04     |   26 | m   | python02 |
| 11 | uu06     |   23 | m   | python03 |
| 12 | uu08     |   26 | m   | python02 |
+----+----------+------+-----+----------+
12 rows in set (0.00 sec)

mysql> update stu set sex='w' where id in(8,11,12);
Query OK, 3 rows affected (0.05 sec)
Rows matched: 3  Changed: 3  Warnings: 0

mysql> select * from stu;
+----+----------+------+-----+----------+
| id | name     | age  | sex | classid  |
+----+----------+------+-----+----------+
|  1 | zhangsan |   20 | m   | python03 |
|  2 | lisi     |   22 | m   | python02 |
|  3 | wangwu   |   25 | w   | python03 |
|  4 | xiaoli   |   28 | m   | python02 |
|  5 | xiaozhan |   21 | w   | python01 |
|  6 | xiaozhao |   27 | m   | python03 |
|  7 | uu01     |   18 | m   | python03 |
|  8 | uu02     |   26 | w   | python02 |
|  9 | uu03     |   23 | m   | python03 |
| 10 | uu04     |   26 | m   | python02 |
| 11 | uu06     |   23 | w   | python03 |
| 12 | uu08     |   26 | w   | python02 |
+----+----------+------+-----+----------+
12 rows in set (0.00 sec)

mysql>
mysql> update stu set age=age-2 where id=15;
Query OK, 1 row affected (0.05 sec)
Rows matched: 1  Changed: 1  Warnings: 0

4. 查詢

mysql> select * from stu;
+----+----------+------+-----+----------+
| id | name     | age  | sex | classid  |
+----+----------+------+-----+----------+
|  1 | zhangsan |   20 | m   | python03 |
|  2 | lisi     |   22 | m   | python02 |
|  3 | wangwu   |   25 | w   | python03 |
|  4 | xiaoli   |   28 | m   | python02 |
|  5 | xiaozhan |   21 | w   | python01 |
|  6 | xiaozhao |   27 | m   | python03 |
|  7 | uu01     |   18 | m   | python03 |
|  8 | uu02     |   26 | w   | python02 |
|  9 | uu03     |   23 | m   | python03 |
| 10 | uu04     |   26 | m   | python02 |
| 11 | uu06     |   23 | w   | python03 |
| 12 | uu08     |   26 | w   | python02 |
| 13 | qq06     | NULL | m   | NULL     |
| 14 | qq01     |   31 | m   | python01 |
| 15 | qq03     |   33 | m   | python01 |
+----+----------+------+-----+----------+
15 rows in set (0.00 sec)

mysql> select id,name,age from stu;
+----+----------+------+
| id | name     | age  |
+----+----------+------+
|  1 | zhangsan |   20 |
|  2 | lisi     |   22 |
|  3 | wangwu   |   25 |
|  4 | xiaoli   |   28 |
|  5 | xiaozhan |   21 |
|  6 | xiaozhao |   27 |
|  7 | uu01     |   18 |
|  8 | uu02     |   26 |
|  9 | uu03     |   23 |
| 10 | uu04     |   26 |
| 11 | uu06     |   23 |
| 12 | uu08     |   26 |
| 13 | qq06     | NULL |
| 14 | qq01     |   31 |
| 15 | qq03     |   33 |
+----+----------+------+
15 rows in set (0.00 sec)

mysql> select id,name as username,age from stu;
+----+----------+------+
| id | username | age  |
+----+----------+------+
|  1 | zhangsan |   20 |
|  2 | lisi     |   22 |
|  3 | wangwu   |   25 |
|  4 | xiaoli   |   28 |
|  5 | xiaozhan |   21 |
|  6 | xiaozhao |   27 |
|  7 | uu01     |   18 |
|  8 | uu02     |   26 |
|  9 | uu03     |   23 |
| 10 | uu04     |   26 |
| 11 | uu06     |   23 |
| 12 | uu08     |   26 |
| 13 | qq06     | NULL |
| 14 | qq01     |   31 |
| 15 | qq03     |   33 |
+----+----------+------+
15 rows in set (0.01 sec)

mysql> select id,name username,age from stu;
+----+----------+------+
| id | username | age  |
+----+----------+------+
|  1 | zhangsan |   20 |
|  2 | lisi     |   22 |
|  3 | wangwu   |   25 |
|  4 | xiaoli   |   28 |
|  5 | xiaozhan |   21 |
|  6 | xiaozhao |   27 |
|  7 | uu01     |   18 |
|  8 | uu02     |   26 |
|  9 | uu03     |   23 |
| 10 | uu04     |   26 |
| 11 | uu06     |   23 |
| 12 | uu08     |   26 |
| 13 | qq06     | NULL |
| 14 | qq01     |   31 |
| 15 | qq03     |   33 |
+----+----------+------+
15 rows in set (0.00 sec)

mysql> select *,age+5 age5 from stu;
+----+----------+------+-----+----------+------+
| id | name     | age  | sex | classid  | age5 |
+----+----------+------+-----+----------+------+
|  1 | zhangsan |   20 | m   | python03 |   25 |
|  2 | lisi     |   22 | m   | python02 |   27 |
|  3 | wangwu   |   25 | w   | python03 |   30 |
|  4 | xiaoli   |   28 | m   | python02 |   33 |
|  5 | xiaozhan |   21 | w   | python01 |   26 |
|  6 | xiaozhao |   27 | m   | python03 |   32 |
|  7 | uu01     |   18 | m   | python03 |   23 |
|  8 | uu02     |   26 | w   | python02 |   31 |
|  9 | uu03     |   23 | m   | python03 |   28 |
| 10 | uu04     |   26 | m   | python02 |   31 |
| 11 | uu06     |   23 | w   | python03 |   28 |
| 12 | uu08     |   26 | w   | python02 |   31 |
| 13 | qq06     | NULL | m   | NULL     | NULL |
| 14 | qq01     |   31 | m   | python01 |   36 |
| 15 | qq03     |   33 | m   | python01 |   38 |
+----+----------+------+-----+----------+------+
15 rows in set (0.01 sec)

mysql> select *,'beijing' as city from stu;
+----+----------+------+-----+----------+---------+
| id | name     | age  | sex | classid  | city    |
+----+----------+------+-----+----------+---------+
|  1 | zhangsan |   20 | m   | python03 | beijing |
|  2 | lisi     |   22 | m   | python02 | beijing |
|  3 | wangwu   |   25 | w   | python03 | beijing |
|  4 | xiaoli   |   28 | m   | python02 | beijing |
|  5 | xiaozhan |   21 | w   | python01 | beijing |
|  6 | xiaozhao |   27 | m   | python03 | beijing |
|  7 | uu01     |   18 | m   | python03 | beijing |
|  8 | uu02     |   26 | w   | python02 | beijing |
|  9 | uu03     |   23 | m   | python03 | beijing |
| 10 | uu04     |   26 | m   | python02 | beijing |
| 11 | uu06     |   23 | w   | python03 | beijing |
| 12 | uu08     |   26 | w   | python02 | beijing |
| 13 | qq06     | NULL | m   | NULL     | beijing |
| 14 | qq01     |   31 | m   | python01 | beijing |
| 15 | qq03     |   33 | m   | python01 | beijing |
+----+----------+------+-----+----------+---------+
15 rows in set (0.00 sec)

mysql> select *,'beijing' city from stu;
+----+----------+------+-----+----------+---------+
| id | name     | age  | sex | classid  | city    |
+----+----------+------+-----+----------+---------+
|  1 | zhangsan |   20 | m   | python03 | beijing |
|  2 | lisi     |   22 | m   | python02 | beijing |
|  3 | wangwu   |   25 | w   | python03 | beijing |
|  4 | xiaoli   |   28 | m   | python02 | beijing |
|  5 | xiaozhan |   21 | w   | python01 | beijing |
|  6 | xiaozhao |   27 | m   | python03 | beijing |
|  7 | uu01     |   18 | m   | python03 | beijing |
|  8 | uu02     |   26 | w   | python02 | beijing |
|  9 | uu03     |   23 | m   | python03 | beijing |
| 10 | uu04     |   26 | m   | python02 | beijing |
| 11 | uu06     |   23 | w   | python03 | beijing |
| 12 | uu08     |   26 | w   | python02 | beijing |
| 13 | qq06     | NULL | m   | NULL     | beijing |
| 14 | qq01     |   31 | m   | python01 | beijing |
| 15 | qq03     |   33 | m   | python01 | beijing |
+----+----------+------+-----+----------+---------+
15 rows in set (0.01 sec)

mysql> select concat(classid,":",name) from stu;
+--------------------------+
| concat(classid,":",name) |
+--------------------------+
| python03:zhangsan        |
| python02:lisi            |
| python03:wangwu          |
| python02:xiaoli          |
| python01:xiaozhan        |
| python03:xiaozhao        |
| python03:uu01            |
| python02:uu02            |
| python03:uu03            |
| python02:uu04            |
| python03:uu06            |
| python02:uu08            |
| NULL                     |
| python01:qq01            |
| python01:qq03            |
+--------------------------+
15 rows in set (0.00 sec)

where條件查詢

1. 查詢班級為python03期的所有學(xué)生信息
mysql> select * from stu where classid='python03';
2. 查詢班級為python03期掉伏,并且性別為m的所有學(xué)生信息
mysql> select * from stu where classid='python03' and sex="m";
3. 查詢年齡大于20岖免,性別為w的所有信息
mysql> select * from stu where age>20 and sex='w';
4. 查詢年齡是20~25的所有信息
mysql> select * from stu where age>=20 and age<=25;
mysql> select * from stu where age between 20 and 25;
5. 查詢年齡不在20~25的學(xué)生信息
mysql> select * from stu where age<20 or age>25;
mysql> select * from stu where age not between 20 and 25;
6. 查詢id號為1,3,5,7,9的學(xué)生信息
mysql> select * from stu where id in(1,3,5,7,9);
7. 查詢classid不為null所有信息
mysql> select * from stu where classid is not null;
8. 查詢班級為python01和python02期所有男生(sex='m')信息
mysql> select * from stu where (classid='python01' or classid='python02') and sex='m';
mysql> select * from stu where classid in('python01','python02') and sex='m';
9. 查詢姓名中含有an子串的所有信息
like 模糊查詢话侧,支持倆個特殊符號:'%'和'_' %表示任意數(shù)量的任意字符瞻鹏, _表示任意一位字符
mysql> select * from stu where name like '%an%';
mysql> select * from stu where name regexp 'an';
10. 查詢姓名是有4位任意小寫字符或數(shù)字構(gòu)成的信息
mysql> select * from stu where name like '____';
mysql> select * from stu where name regexp '^[a-z0-9]{4}$';

統(tǒng)計(jì)函數(shù)(聚合函數(shù))max() min() sum() avg() count()

獲取最大年齡新博,最小年齡,年齡總和埂淮,平均年齡倔撞,總計(jì)條數(shù)

mysql> select max(age),min(age),sum(age),avg(age),count(id) from stu;
+----------+----------+----------+----------+-----------+
| max(age) | min(age) | sum(age) | avg(age) | count(id) |
+----------+----------+----------+----------+-----------+
|       33 |       18 |      371 |  24.7333 |        15 |
+----------+----------+----------+----------+-----------+
1 row in set (0.01 sec)

group by 字段名 分組

按性別sex分組痪蝇,并統(tǒng)計(jì)人數(shù)
mysql> select sex,count(*) from stu group by sex;
+-----+----------+
| sex | count(*) |
+-----+----------+
| w   |        5 |
| m   |       10 |
+-----+----------+
2 rows in set (0.00 sec)
按班級分組統(tǒng)計(jì)每個班級的人數(shù)(排除班級信息為null的數(shù)據(jù))
mysql> select classid,count(*) from stu where classid is not null  group by classid;
+----------+----------+
| classid  | count(*) |
+----------+----------+
| python01 |        3 |
| python02 |        5 |
| python03 |        6 |
+----------+----------+
3 rows in set (0.00 sec)
按班級分組,并統(tǒng)計(jì)每個班級的男生和女生人數(shù)(排除班級信息為null的數(shù)據(jù))
mysql> select classid,sex,count(*) from stu where classid is not null  group by classid,sex;
+----------+-----+----------+
| classid  | sex | count(*) |
+----------+-----+----------+
| python01 | w   |        1 |
| python01 | m   |        2 |
| python02 | w   |        2 |
| python02 | m   |        3 |
| python03 | w   |        2 |
| python03 | m   |        4 |
+----------+-----+----------+
6 rows in set (0.00 sec)
在上面的查詢中给僵,加入過濾條件(人數(shù)大于等于3的信息)
mysql> select classid,sex,count(*) num from stu where classid is not null  group by classid,sex having num>=3;
+----------+-----+-----+
| classid  | sex | num |
+----------+-----+-----+
| python02 | m   |   3 |
| python03 | m   |   4 |
+----------+-----+-----+
2 rows in set (0.00 sec)
排序:order by 字段名 asc(默認(rèn)升序)|desc(降序)
-------------------------------------------------------------
mysql> select * from stu order by age;
+----+----------+------+-----+----------+
| id | name     | age  | sex | classid  |
+----+----------+------+-----+----------+
|  7 | uu01     |   18 | m   | python03 |
|  1 | zhangsan |   20 | m   | python03 |
|  5 | xiaozhan |   21 | w   | python01 |
|  2 | lisi     |   22 | m   | python02 |
| 13 | qq06     |   22 | m   | NULL     |
| 11 | uu06     |   23 | w   | python03 |
|  9 | uu03     |   23 | m   | python03 |
|  3 | wangwu   |   25 | w   | python03 |
| 12 | uu08     |   26 | w   | python02 |
| 10 | uu04     |   26 | m   | python02 |
|  8 | uu02     |   26 | w   | python02 |
|  6 | xiaozhao |   27 | m   | python03 |
|  4 | xiaoli   |   28 | m   | python02 |
| 14 | qq01     |   31 | m   | python01 |
| 15 | qq03     |   33 | m   | python01 |
+----+----------+------+-----+----------+
15 rows in set (0.00 sec)

mysql> select * from stu order by age asc;
+----+----------+------+-----+----------+
| id | name     | age  | sex | classid  |
+----+----------+------+-----+----------+
|  7 | uu01     |   18 | m   | python03 |
|  1 | zhangsan |   20 | m   | python03 |
|  5 | xiaozhan |   21 | w   | python01 |
|  2 | lisi     |   22 | m   | python02 |
| 13 | qq06     |   22 | m   | NULL     |
| 11 | uu06     |   23 | w   | python03 |
|  9 | uu03     |   23 | m   | python03 |
|  3 | wangwu   |   25 | w   | python03 |
| 12 | uu08     |   26 | w   | python02 |
| 10 | uu04     |   26 | m   | python02 |
|  8 | uu02     |   26 | w   | python02 |
|  6 | xiaozhao |   27 | m   | python03 |
|  4 | xiaoli   |   28 | m   | python02 |
| 14 | qq01     |   31 | m   | python01 |
| 15 | qq03     |   33 | m   | python01 |
+----+----------+------+-----+----------+
15 rows in set (0.00 sec)

mysql> select * from stu order by age desc;
+----+----------+------+-----+----------+
| id | name     | age  | sex | classid  |
+----+----------+------+-----+----------+
| 15 | qq03     |   33 | m   | python01 |
| 14 | qq01     |   31 | m   | python01 |
|  4 | xiaoli   |   28 | m   | python02 |
|  6 | xiaozhao |   27 | m   | python03 |
| 12 | uu08     |   26 | w   | python02 |
| 10 | uu04     |   26 | m   | python02 |
|  8 | uu02     |   26 | w   | python02 |
|  3 | wangwu   |   25 | w   | python03 |
|  9 | uu03     |   23 | m   | python03 |
| 11 | uu06     |   23 | w   | python03 |
| 13 | qq06     |   22 | m   | NULL     |
|  2 | lisi     |   22 | m   | python02 |
|  5 | xiaozhan |   21 | w   | python01 |
|  1 | zhangsan |   20 | m   | python03 |
|  7 | uu01     |   18 | m   | python03 |
+----+----------+------+-----+----------+
15 rows in set (0.00 sec)

mysql> select * from stu order by classid desc;
+----+----------+------+-----+----------+
| id | name     | age  | sex | classid  |
+----+----------+------+-----+----------+
|  1 | zhangsan |   20 | m   | python03 |
|  3 | wangwu   |   25 | w   | python03 |
| 11 | uu06     |   23 | w   | python03 |
|  6 | xiaozhao |   27 | m   | python03 |
|  7 | uu01     |   18 | m   | python03 |
|  9 | uu03     |   23 | m   | python03 |
| 12 | uu08     |   26 | w   | python02 |
| 10 | uu04     |   26 | m   | python02 |
|  8 | uu02     |   26 | w   | python02 |
|  4 | xiaoli   |   28 | m   | python02 |
|  2 | lisi     |   22 | m   | python02 |
|  5 | xiaozhan |   21 | w   | python01 |
| 14 | qq01     |   31 | m   | python01 |
| 15 | qq03     |   33 | m   | python01 |
| 13 | qq06     |   22 | m   | NULL     |
+----+----------+------+-----+----------+
15 rows in set (0.00 sec)

mysql> select * from stu order by classid asc;
+----+----------+------+-----+----------+
| id | name     | age  | sex | classid  |
+----+----------+------+-----+----------+
| 13 | qq06     |   22 | m   | NULL     |
| 15 | qq03     |   33 | m   | python01 |
| 14 | qq01     |   31 | m   | python01 |
|  5 | xiaozhan |   21 | w   | python01 |
| 12 | uu08     |   26 | w   | python02 |
| 10 | uu04     |   26 | m   | python02 |
|  8 | uu02     |   26 | w   | python02 |
|  4 | xiaoli   |   28 | m   | python02 |
|  2 | lisi     |   22 | m   | python02 |
|  7 | uu01     |   18 | m   | python03 |
|  9 | uu03     |   23 | m   | python03 |
|  6 | xiaozhao |   27 | m   | python03 |
| 11 | uu06     |   23 | w   | python03 |
|  3 | wangwu   |   25 | w   | python03 |
|  1 | zhangsan |   20 | m   | python03 |
+----+----------+------+-----+----------+
15 rows in set (0.01 sec)

mysql> select * from stu order by classid asc,age desc;
+----+----------+------+-----+----------+
| id | name     | age  | sex | classid  |
+----+----------+------+-----+----------+
| 13 | qq06     |   22 | m   | NULL     |
| 15 | qq03     |   33 | m   | python01 |
| 14 | qq01     |   31 | m   | python01 |
|  5 | xiaozhan |   21 | w   | python01 |
|  4 | xiaoli   |   28 | m   | python02 |
| 12 | uu08     |   26 | w   | python02 |
| 10 | uu04     |   26 | m   | python02 |
|  8 | uu02     |   26 | w   | python02 |
|  2 | lisi     |   22 | m   | python02 |
|  6 | xiaozhao |   27 | m   | python03 |
|  3 | wangwu   |   25 | w   | python03 |
|  9 | uu03     |   23 | m   | python03 |
| 11 | uu06     |   23 | w   | python03 |
|  1 | zhangsan |   20 | m   | python03 |
|  7 | uu01     |   18 | m   | python03 |
+----+----------+------+-----+----------+
15 rows in set (0.00 sec)

mysql>

獲取部分?jǐn)?shù)據(jù):limit

-- 分頁公式: limit (頁號-1)*頁大小,頁大小

--------------------------------------------------
mysql> select * from stu limit 0,3;
+----+----------+------+-----+----------+
| id | name     | age  | sex | classid  |
+----+----------+------+-----+----------+
|  1 | zhangsan |   20 | m   | python03 |
|  2 | lisi     |   22 | m   | python02 |
|  3 | wangwu   |   25 | w   | python03 |
+----+----------+------+-----+----------+
3 rows in set (0.00 sec)

mysql> select * from stu limit 3,3;
+----+----------+------+-----+----------+
| id | name     | age  | sex | classid  |
+----+----------+------+-----+----------+
|  4 | xiaoli   |   28 | m   | python02 |
|  5 | xiaozhan |   21 | w   | python01 |
|  6 | xiaozhao |   27 | m   | python03 |
+----+----------+------+-----+----------+
3 rows in set (0.01 sec)

mysql> select * from stu limit 6,3;
+----+------+------+-----+----------+
| id | name | age  | sex | classid  |
+----+------+------+-----+----------+
|  7 | uu01 |   18 | m   | python03 |
|  8 | uu02 |   26 | w   | python02 |
|  9 | uu03 |   23 | m   | python03 |
+----+------+------+-----+----------+
3 rows in set (0.00 sec)

mysql> select * from stu limit 9,3;
+----+------+------+-----+----------+
| id | name | age  | sex | classid  |
+----+------+------+-----+----------+
| 10 | uu04 |   26 | m   | python02 |
| 11 | uu06 |   23 | w   | python03 |
| 12 | uu08 |   26 | w   | python02 |
+----+------+------+-----+----------+
3 rows in set (0.00 sec)

綜合查詢練習(xí)

1. 查詢python03期所有學(xué)員侧甫,按年齡降序排序
mysql> select * from stu where classid='python03' order by age desc;
2. 查詢python03期披粟,年齡最大的3位學(xué)員信息
mysql> select * from stu where classid='python03' order by age desc limit 3;
3. 統(tǒng)計(jì)每個班級人數(shù)守屉,并按人數(shù)降序排序(排除班級信息為null的數(shù)據(jù))
mysql> select classid,count(*) m from stu where classid is not null group by classid order by m desc;
4. 統(tǒng)計(jì)每個班級年齡在20~30的學(xué)員人數(shù)信息拇泛,并按人數(shù)降序排序(排除班級信息為null的數(shù)據(jù))
mysql> select classid,count(*) m from stu where classid is not null and age between 20 and 30
    -> group by classid order by m desc
5. 統(tǒng)計(jì)每個班級男女生人數(shù)最多3條記錄信息。(排除班級信息為null的數(shù)據(jù))
mysql> select classid,sex,count(*) m from stu where classid is not null
    -> group by classid,sex order by m desc limit 3;

多表查詢:

1. 嵌套查詢 (一個查詢的結(jié)果是另外查詢的條件)
2. where關(guān)聯(lián)查詢
3. join連接查詢:內(nèi)聯(lián)inner join熄守,左聯(lián) left join裕照,右聯(lián)right join

1. 嵌套查詢:


-- 查詢年齡最大的學(xué)生信息
mysql> select * from stu where age=(select max(age) from stu);
+----+------+------+-----+----------+
| id | name | age  | sex | classid  |
+----+------+------+-----+----------+
| 15 | qq03 |   33 | m   | python01 |
+----+------+------+-----+----------+
1 row in set (0.00 sec)
查詢帖子標(biāo)題為'工作十年'的發(fā)帖人信息
mysql> select * from users where id in(select uid from topic where title='工作十年');
+----+---------------+----------------------------------+--------+-------------+
| id | email         | password                         | name   | phone       |
+----+---------------+----------------------------------+--------+-------------+
|  2 | lisi@sohu.com | e10adc3949ba59abbe56e057f20f883e | 李四   | 13466587533 |
+----+---------------+----------------------------------+--------+-------------+
1 row in set (0.00 sec)

2. where關(guān)聯(lián)查詢


查詢帖子信息,并關(guān)聯(lián)發(fā)帖人姓名信息
mysql> select t.id,t.title,t.addtime,u.name from topic t,users u where t.uid=u.id;
+----+-----------------------------------------------+---------------------+-----------+
| id | title                                         | addtime             | name      |
+----+-----------------------------------------------+---------------------+-----------+
|  1 | 工作十年                                      | 2017-09-10 12:23:45 | 李四      |
|  2 | 畢業(yè)一年搬俊,大家過著怎樣的生活                  | 2017-09-11 18:23:45 | 張三豐    |
|  3 | 英語四級真的很重要嗎唉擂?                        | 2017-09-12 08:03:45 | 王月      |
|  4 | 為什么工資一直漲不了玩祟?速度進(jìn)來                | 2017-09-13 15:43:23 | 王五      |
|  5 | 現(xiàn)在創(chuàng)業(yè)好難啊                                | 2017-09-14 16:23:45 | 李四      |
|  6 | 現(xiàn)在學(xué)什么技術(shù)好一些空扎?                        | 2017-09-14 18:23:25 | 王五      |
+----+-----------------------------------------------+---------------------+-----------+
6 rows in set (0.00 sec)

使用where管理盘寡,統(tǒng)計(jì)每個用戶的發(fā)帖量信息

mysql> select u.id,u.name,count(*)  from users u,topic t where u.id=t.uid group by u.id;
+----+-----------+----------+
| id | name      | count(*) |
+----+-----------+----------+
|  1 | 張三豐    |        1 |
|  2 | 李四      |        2 |
|  3 | 王五      |        2 |
|  5 | 王月      |        1 |
+----+-----------+----------+
4 rows in set (0.00 sec)

mysql> select u.id,u.name,count(*) num  from users u,topic t where u.id=t.uid group by u.id order by num desc limit 10;
+----+-----------+-----+
| id | name      | num |
+----+-----------+-----+
|  2 | 李四      |   2 |
|  3 | 王五      |   2 |
|  5 | 王月      |   1 |
|  1 | 張三豐    |   1 |
+----+-----------+-----+
4 rows in set (0.01 sec)

mysql> 

join 連接查詢


以左聯(lián)為主竿痰,user信息為主影涉,右側(cè)topic表信息沒有的補(bǔ)null
mysql> select u.id,u.name,t.id,t.title from users u left join topic t on u.id=t.uid;
+----+-----------+------+-----------------------------------------------+
| id | name      | id   | title                                         |
+----+-----------+------+-----------------------------------------------+
|  1 | 張三豐    |    2 | 畢業(yè)一年,大家過著怎樣的生活                  |
|  2 | 李四      |    1 | 工作十年                                      |
|  2 | 李四      |    5 | 現(xiàn)在創(chuàng)業(yè)好難啊                                |
|  3 | 王五      |    4 | 為什么工資一直漲不了喊式?速度進(jìn)來                |
|  3 | 王五      |    6 | 現(xiàn)在學(xué)什么技術(shù)好一些岔留?                        |
|  4 | 趙六      | NULL | NULL                                          |
|  5 | 王月      |    3 | 英語四級真的很重要嗎献联?                        |
|  6 | 陸玲      | NULL | NULL                                          |
+----+-----------+------+-----------------------------------------------+
8 rows in set (0.00 sec)
右聯(lián)查詢,以topic為主原押,左側(cè)users沒有對應(yīng)信息的補(bǔ)null
mysql> select u.id,u.name,t.id,t.title from users u right join topic t on u.id=t.uid;
+------+-----------+----+-----------------------------------------------+
| id   | name      | id | title                                         |
+------+-----------+----+-----------------------------------------------+
|    2 | 李四      |  1 | 工作十年                                      |
|    1 | 張三豐    |  2 | 畢業(yè)一年诸衔,大家過著怎樣的生活                  |
|    5 | 王月      |  3 | 英語四級真的很重要嗎?                        |
|    3 | 王五      |  4 | 為什么工資一直漲不了谒亦?速度進(jìn)來                |
|    2 | 李四      |  5 | 現(xiàn)在創(chuàng)業(yè)好難啊                                |
|    3 | 王五      |  6 | 現(xiàn)在學(xué)什么技術(shù)好一些份招?                        |
| NULL | NULL      |  8 | aaaaaaaa                                      |
+------+-----------+----+-----------------------------------------------+
7 rows in set (0.00 sec)
內(nèi)聯(lián)(等價(jià)于where管理)锁摔,求的是兩側(cè)交集的數(shù)據(jù)
mysql> select u.id,u.name,t.id,t.title from users u inner join topic t on u.id=t.uid;
+----+-----------+----+-----------------------------------------------+
| id | name      | id | title                                         |
+----+-----------+----+-----------------------------------------------+
|  1 | 張三豐    |  2 | 畢業(yè)一年,大家過著怎樣的生活                  |
|  2 | 李四      |  1 | 工作十年                                      |
|  2 | 李四      |  5 | 現(xiàn)在創(chuàng)業(yè)好難啊                                |
|  3 | 王五      |  4 | 為什么工資一直漲不了怔蚌?速度進(jìn)來                |
|  3 | 王五      |  6 | 現(xiàn)在學(xué)什么技術(shù)好一些桦踊?                        |
|  5 | 王月      |  3 | 英語四級真的很重要嗎籍胯?                        |
+----+-----------+----+-----------------------------------------------+
6 rows in set (0.00 sec)
統(tǒng)計(jì)每個用戶的發(fā)帖量信息杖狼,包含沒有發(fā)帖的用戶統(tǒng)計(jì)
mysql> select u.id,u.name,count(t.id) num from users u left join  topic t on u.id=t.uid  group by u.id order by num desc limit 10;
+----+-----------+-----+
| id | name      | num |
+----+-----------+-----+
|  3 | 王五      |   2 |
|  2 | 李四      |   2 |
|  5 | 王月      |   1 |
|  1 | 張三豐    |   1 |
|  6 | 陸玲      |   0 |
|  4 | 趙六      |   0 |
+----+-----------+-----+
6 rows in set (0.01 sec)

查詢實(shí)戰(zhàn)

1. 查詢帖子id號為1的所有評論信息妖爷,要求管理評論人信
顯示字段:評論id蝶涩,帖子id,評論人id絮识,評論人姓名绿聘,評論內(nèi)容
要求使用:where關(guān)聯(lián),inner jion和left join各執(zhí)行一次
mysql> select r.id,r.tid,r.uid,u.name,r.content from reply r,users u where r.uid = u.id and r.tid=1;

mysql> select r.id,r.tid,r.uid,u.name,r.content from reply r inner join users u on r.uid = u.id where r.tid=1;

mysql> select r.id,r.tid,r.uid,u.name,r.content from reply r left join users u on r.uid = u.id where r.tid=1;
2. 查詢帖子信息次舌,并關(guān)聯(lián)輸出發(fā)帖人信息
顯示字段:帖子id熄攘,帖子標(biāo)題彼念,發(fā)帖時間挪圾,發(fā)帖人id,發(fā)帖人姓名
要求使用:where關(guān)聯(lián)国拇,inner jion和left join各執(zhí)行一次
mysql> select t.id,t.title,t.addtime,t.uid,u.name from topic t,users u where t.uid=u.id;

mysql> select t.id,t.title,t.addtime,t.uid,u.name from topic t inner join users u on t.uid=u.id;

mysql> select t.id,t.title,t.addtime,t.uid,u.name from topic t left join users u on t.uid=u.id;
3. 查詢id號為3的單條評論信息洛史,關(guān)聯(lián)帖子和用戶信息
顯示字段:評論id,帖子id酱吝,帖子標(biāo)題也殖,評論人id,評論人姓名,評論內(nèi)容忆嗜,評論時間
mysql> select r.id,r.tid,t.title,r.uid,u.name,r.content,r.addtime from reply r,topic t,users u where r.tid=t.id and r.uid=u.id and r.id=3;
--左聯(lián)查
mysql> select r.id,r.tid,t.title,r.uid,u.name,r.content,r.addtime 
    -> from reply r left join topic t on r.tid=t.id 
    -> left join users u on r.uid=u.id where r.id=3\G
?著作權(quán)歸作者所有,轉(zhuǎn)載或內(nèi)容合作請聯(lián)系作者
  • 序言:七十年代末己儒,一起剝皮案震驚了整個濱河市,隨后出現(xiàn)的幾起案子捆毫,更是在濱河造成了極大的恐慌闪湾,老刑警劉巖,帶你破解...
    沈念sama閱讀 212,454評論 6 493
  • 序言:濱河連續(xù)發(fā)生了三起死亡事件绩卤,死亡現(xiàn)場離奇詭異途样,居然都是意外死亡,警方通過查閱死者的電腦和手機(jī)濒憋,發(fā)現(xiàn)死者居然都...
    沈念sama閱讀 90,553評論 3 385
  • 文/潘曉璐 我一進(jìn)店門何暇,熙熙樓的掌柜王于貴愁眉苦臉地迎上來,“玉大人凛驮,你說我怎么就攤上這事裆站。” “怎么了黔夭?”我有些...
    開封第一講書人閱讀 157,921評論 0 348
  • 文/不壞的土叔 我叫張陵宏胯,是天一觀的道長。 經(jīng)常有香客問我本姥,道長肩袍,這世上最難降的妖魔是什么? 我笑而不...
    開封第一講書人閱讀 56,648評論 1 284
  • 正文 為了忘掉前任婚惫,我火速辦了婚禮了牛,結(jié)果婚禮上,老公的妹妹穿的比我還像新娘辰妙。我一直安慰自己鹰祸,他們只是感情好,可當(dāng)我...
    茶點(diǎn)故事閱讀 65,770評論 6 386
  • 文/花漫 我一把揭開白布密浑。 她就那樣靜靜地躺著蛙婴,像睡著了一般。 火紅的嫁衣襯著肌膚如雪尔破。 梳的紋絲不亂的頭發(fā)上街图,一...
    開封第一講書人閱讀 49,950評論 1 291
  • 那天,我揣著相機(jī)與錄音懒构,去河邊找鬼餐济。 笑死,一個胖子當(dāng)著我的面吹牛胆剧,可吹牛的內(nèi)容都是我干的絮姆。 我是一名探鬼主播醉冤,決...
    沈念sama閱讀 39,090評論 3 410
  • 文/蒼蘭香墨 我猛地睜開眼,長吁一口氣:“原來是場噩夢啊……” “哼篙悯!你這毒婦竟也來了蚁阳?” 一聲冷哼從身側(cè)響起,我...
    開封第一講書人閱讀 37,817評論 0 268
  • 序言:老撾萬榮一對情侶失蹤鸽照,失蹤者是張志新(化名)和其女友劉穎螺捐,沒想到半個月后,有當(dāng)?shù)厝嗽跇淞掷锇l(fā)現(xiàn)了一具尸體矮燎,經(jīng)...
    沈念sama閱讀 44,275評論 1 303
  • 正文 獨(dú)居荒郊野嶺守林人離奇死亡定血,尸身上長有42處帶血的膿包…… 初始之章·張勛 以下內(nèi)容為張勛視角 年9月15日...
    茶點(diǎn)故事閱讀 36,592評論 2 327
  • 正文 我和宋清朗相戀三年,在試婚紗的時候發(fā)現(xiàn)自己被綠了诞外。 大學(xué)時的朋友給我發(fā)了我未婚夫和他白月光在一起吃飯的照片糠悼。...
    茶點(diǎn)故事閱讀 38,724評論 1 341
  • 序言:一個原本活蹦亂跳的男人離奇死亡,死狀恐怖浅乔,靈堂內(nèi)的尸體忽然破棺而出,到底是詐尸還是另有隱情铝条,我是刑警寧澤靖苇,帶...
    沈念sama閱讀 34,409評論 4 333
  • 正文 年R本政府宣布,位于F島的核電站班缰,受9級特大地震影響贤壁,放射性物質(zhì)發(fā)生泄漏。R本人自食惡果不足惜埠忘,卻給世界環(huán)境...
    茶點(diǎn)故事閱讀 40,052評論 3 316
  • 文/蒙蒙 一脾拆、第九天 我趴在偏房一處隱蔽的房頂上張望。 院中可真熱鬧莹妒,春花似錦名船、人聲如沸。這莊子的主人今日做“春日...
    開封第一講書人閱讀 30,815評論 0 21
  • 文/蒼蘭香墨 我抬頭看了看天上的太陽。三九已至鉴腻,卻和暖如春迷扇,著一層夾襖步出監(jiān)牢的瞬間,已是汗流浹背爽哎。 一陣腳步聲響...
    開封第一講書人閱讀 32,043評論 1 266
  • 我被黑心中介騙來泰國打工蜓席, 沒想到剛下飛機(jī)就差點(diǎn)兒被人妖公主榨干…… 1. 我叫王不留,地道東北人课锌。 一個月前我還...
    沈念sama閱讀 46,503評論 2 361
  • 正文 我出身青樓厨内,卻偏偏與公主長得像,于是被迫代替她去往敵國和親。 傳聞我的和親對象是個殘疾皇子隘庄,可洞房花燭夜當(dāng)晚...
    茶點(diǎn)故事閱讀 43,627評論 2 350

推薦閱讀更多精彩內(nèi)容

  • 一. Java基礎(chǔ)部分.................................................
    wy_sure閱讀 3,805評論 0 11
  • MySQL 數(shù)據(jù)庫常用命令 1踢步、MySQL常用命令 create database name; 創(chuàng)建數(shù)據(jù)庫 use...
    55lover閱讀 4,781評論 1 57
  • 1. Java基礎(chǔ)部分 基礎(chǔ)部分的順序:基本語法,類相關(guān)的語法丑掺,內(nèi)部類的語法获印,繼承相關(guān)的語法,異常的語法街州,線程的語...
    子非魚_t_閱讀 31,599評論 18 399
  • Spring Cloud為開發(fā)人員提供了快速構(gòu)建分布式系統(tǒng)中一些常見模式的工具(例如配置管理兼丰,服務(wù)發(fā)現(xiàn),斷路器唆缴,智...
    卡卡羅2017閱讀 134,637評論 18 139
  • 看過了太多太多的雞湯鳍征,永遠(yuǎn)都在說著:“我在你身上看不到希望,所以我們走不下去了面徽⊙薮裕”其實(shí)女生最初并沒有這樣的想法,而...
    矯情先生閱讀 868評論 0 0