1. 程式人生 > 實用技巧 >第五章 SQL語句

第五章 SQL語句

一、sql語句的語義

DDL:Data Definition Language   #資料定義語言 (create、alter)
DCL:Data Control Language	   #資料控制語言 (grant、revoke、commit、rollback)
DML:Data Manipulate	Language   #資料操作語言 (insert、delete、update)
DQL:Data Query Language		   #資料查詢語言 (select、desc)

二、DDL --資料定義語言

1. create 操作庫

1)檢視語法

mysql> help create database;
Syntax:
CREATE {DATABASE | SCHEMA} [IF NOT EXISTS] db_name [create_specification] ...

create_specification:
    [DEFAULT] CHARACTER SET [=] charset_name | [DEFAULT] COLLATE [=] collation_name

2)建立庫

#1.建庫
mysql> create database db01;
Query OK, 1 row affected (0.00 sec)

#2.建庫2
mysql> create schema db02;
Query OK, 1 row affected (0.00 sec)

#3.建立已存在的庫不報錯
mysql> create database db01;
ERROR 1007 (HY000): Can't create database 'db01'; database exists

mysql> create database IF NOT EXISTS db01;
Query OK, 1 row affected, 1 warning (0.00 sec)

3)檢視建庫語句

mysql> show create database db01;
+----------+-----------------------------------------------------------------+
| Database | Create Database                                                 |
+----------+-----------------------------------------------------------------+
| db01     | CREATE DATABASE `db01` /*!40100 DEFAULT CHARACTER SET latin1 */ |
+----------+-----------------------------------------------------------------+
1 row in set (0.00 sec)

4)建立庫指定字符集和校驗規則

#1.指定字符集建庫
mysql> create database db03 character set utf8;
Query OK, 1 row affected (0.00 sec)

#2.指定字符集和校驗規則建庫
mysql> create database db04 character set utf8 collate utf8_general_ci;
Query OK, 1 row affected (0.00 sec)

mysql> create database db06 charset utf8 collate utf8_general_ci;
Query OK, 1 row affected (0.00 sec)

5)修改庫

#只需要修改字符集和校驗規則
mysql> alter database db05 character set utf8mb4 collate utf8mb4_general_ci;
Query OK, 1 row affected (0.00 sec)

mysql> show create database db05;
+----------+------------------------------------------------------------------+
| Database | Create Database                                                  |
+----------+------------------------------------------------------------------+
| db05     | CREATE DATABASE `db05` /*!40100 DEFAULT CHARACTER SET utf8mb4 */ |
+----------+------------------------------------------------------------------+
1 row in set (0.00 sec)

6)刪庫

mysql> drop database db05;
Query OK, 0 rows affected (0.00 sec)

2. create 操作表

1)檢視語法

mysql> help create table;
Syntax:
CREATE [TEMPORARY] TABLE [IF NOT EXISTS] tbl_name
    (create_definition,...)
    [table_options]
    [partition_options]

CREATE [TEMPORARY] TABLE [IF NOT EXISTS] tbl_name
    [(create_definition,...)]
    [table_options]
    [partition_options]
    [IGNORE | REPLACE]
    [AS] query_expression

CREATE [TEMPORARY] TABLE [IF NOT EXISTS] tbl_name
    { LIKE old_tbl_name | (LIKE old_tbl_name) }

2)建表

#1.進入庫
mysql> use test;
Database changed

#2.檢視所在庫
mysql> select database();
+------------+
| database() |
+------------+
| test      |
+------------+
1 row in set (0.00 sec)

#3.建表
mysql> create table tb1(id int);
Query OK, 0 rows affected (0.01 sec)

3)資料型別

int			整數			-2^31 --- 2^31-1   (-2147483648 - 2147483647)
tinyint		最小整數	    -128 --- 127	  #一般用在定義年齡
varchar		字元型別(變長)	#身份證或者名字
char		字元型別(定長)
enum		列舉型別		  #性別
datetime	時間型別

4)測試int資料型別

#1.建表
mysql> create table tb1(id int);
Query OK, 0 rows affected (0.01 sec)

#2.指定字符集建表
mysql> create table tb2(id int) charset utf8;
Query OK, 0 rows affected (0.01 sec)

#3.檢視建表語句
mysql> show create table tb2;
+-------+---------------------------------------------------------------------------------------+
| Table | Create Table                                                                          |
+-------+---------------------------------------------------------------------------------------+
| tb2   | CREATE TABLE `tb2` (
  `id` int(11) DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8 |
+-------+---------------------------------------------------------------------------------------+
1 row in set (0.01 sec)

#4.查看錶結構
mysql> desc tb1;
+-------+---------+------+-----+---------+-------+
| Field | Type    | Null | Key | Default | Extra |
+-------+---------+------+-----+---------+-------+
| id    | int(11) | YES  |     | NULL    |       |
+-------+---------+------+-----+---------+-------+
1 row in set (0.00 sec)

#5.插入資料
mysql> insert tb1 values('11111111111');
ERROR 1264 (22003): Out of range value for column 'id' at row 1

mysql> insert tb1 values('-2147483648');
Query OK, 1 row affected (0.00 sec)

mysql> insert tb1 values('2147483648');
ERROR 1264 (22003): Out of range value for column 'id' at row 1

mysql> insert tb1 values('-2147483649');
ERROR 1264 (22003): Out of range value for column 'id' at row 1

mysql> insert tb1 values('2147483647');
Query OK, 1 row affected (0.00 sec)
#原因:插入的資料超過資料型別的長度

5)測試char和varchar型別

#1.建表
mysql> create table tb1(id int,name varchar(12));
Query OK, 0 rows affected (0.06 sec)

#2.插入資料
mysql> insert into tb1 values('1','邱導');
Query OK, 1 row affected (0.00 sec)

mysql> insert into tb1 values('1','zengzhigaoxiang');
ERROR 1136 (21S01): Column count doesn't match value count at row 1
#字元超過資料型別的限制值

6)測試enum型別

#1.建表
mysql> create table tb4(id int,name varchar(10),sex enum('man','woman'));
Query OK, 0 rows affected (0.03 sec)

#2.插入資料
mysql> insert into tb4 values('1','邱導','man');
Query OK, 1 row affected (0.00 sec)

mysql> insert into tb4 values('2','劉大維','nan');
ERROR 1265 (01000): Data truncated for column 'sex' at row 1
#如果是列舉型別,必須插入型別指定的值,不能插入額外的值

7)建表測試

#建學生表
id
name
sex
age
cometime

#1.建表
mysql> create table student(id int,name varchar(10),sex enum('男','nv'),age tinyint,cometime datetime);
Query OK, 0 rows affected (0.03 sec)

#2.插入資料
mysql> insert into student values('-12573','邱導','男','-18',now());
Query OK, 1 row affected (0.00 sec)

#3.檢視資料
mysql> select * from student;
+--------+--------+------+------+---------------------+
| id     | name   | sex  | age  | cometime            |
+--------+--------+------+------+---------------------+
| -12573 | 邱導   | 男   |  -18 | 2020-10-23 18:40:15 |
+--------+--------+------+------+---------------------+
1 row in set (0.00 sec)

8)建表的資料屬性

not null: 			非空
primary key: 		主鍵(唯一且非空的)
auto_increment: 	自增(此列必須是:primary key或者unique key)
unique key: 		唯一鍵(單獨的唯一的)
default: 			預設值
unsigned: 			非負數
comment:			註釋

9)加上資料屬性建表

#1.建表
mysql> create table student(
    -> id int unsigned primary key auto_increment comment '學生id',
    -> name varchar(10) not null comment '學生姓名',
    -> sex enum('男','女') default '男' comment '學生性別',
    -> age tinyint unsigned comment '學生年齡',
    -> cometime datetime default now() comment '入學時間',
    -> class varchar(12) not null comment '學生班級',
    -> status enum('0','1') default 1 comment '學生狀態');
Query OK, 0 rows affected (0.01 sec)

#2.檢視建表語句
mysql> show create table student;
                                                                         
| student | CREATE TABLE `student` (
  `id` int(10) unsigned NOT NULL AUTO_INCREMENT COMMENT '學生id',
  `name` varchar(10) NOT NULL COMMENT '學生姓名',
  `sex` enum('男','女') DEFAULT '男' COMMENT '學生性別',
  `age` tinyint(3) unsigned DEFAULT NULL COMMENT '學生年齡',
  `cometime` datetime DEFAULT CURRENT_TIMESTAMP COMMENT '入學時間',
  `class` varchar(12) NOT NULL COMMENT '學生班級',
  `status` enum('0','1') DEFAULT '0' COMMENT '學生狀態',
  PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8                              |

1 row in set (0.00 sec)

#3.插入資料
mysql> insert into student(name,class) values('邱導','Linux10期');
Query OK, 1 row affected (0.00 sec)
mysql> insert into student(name,class) values('劉大維','Linux10期');
Query OK, 1 row affected (0.00 sec)
mysql> insert into student(name,class) values('虞陳宇','Linux10期');
Query OK, 1 row affected (0.00 sec)
mysql> insert into student(name,age,class) values('周昊','18','Linux10期');
Query OK, 1 row affected (0.00 sec)

#4.檢視資料
mysql> select * from student;
+----+-----------+------+------+---------------------+------------+--------+
| id | name      | sex  | age  | cometime            | class      | status |
+----+-----------+------+------+---------------------+------------+--------+
|  1 | 邱導      | 男   | NULL | 2020-10-23 19:06:25 | Linux10期  | 0      |
|  2 | 邱導      | 男   | NULL | 2020-10-23 19:07:31 | Linux10期  | 0      |
|  3 | 劉大維    | 男   | NULL | 2020-10-23 19:07:57 | Linux10期  | 0      |
|  4 | 虞陳宇    | 男   | NULL | 2020-10-23 19:08:17 | Linux10期  | 0      |
|  5 | 周昊      | 男   |   18 | 2020-10-23 19:09:44 | Linux10期  | 0      |
+----+-----------+------+------+---------------------+------------+--------+
5 rows in set (0.00 sec)

10)刪除表

mysql> drop table student;
Query OK, 0 rows affected (0.00 sec)

11)修改表

#1.修改表字符集
mysql> alter table play charset utf8mb4;
Query OK, 0 rows affected (0.03 sec)
Records: 0  Duplicates: 0  Warnings: 0

#2.修改表名
mysql> alter table play rename student;
Query OK, 0 rows affected (0.01 sec)

#3.給表插入欄位
mysql> alter table student add name varchar(10);

#4.給表插入多個欄位
mysql> alter table student add sex enum('男','女'),add age tinyint;

#5.插入欄位到第一列
mysql> alter table student add id int first;

#6.插入欄位到指定欄位後面
mysql> alter table student add class varchar(12) after id;

#7.刪除欄位
mysql> alter table student drop qiudao;

#8.修改列屬性
mysql> alter table student modify name varchar(20);

#9.修改列的名字和屬性
mysql> alter table student change sex xingbie enum('男','女');

三、DCL--資料控制語言

1.授權命令 grant

#1.授權
grant all on *.* to root@'172.16.1.%' identified by '123';
#應該授權低一點的許可權
grant select,update,insert on database.* to dev@'172.16.1.%' identified by 'Lhd@123456'

#2.檢視使用者許可權
mysql> show grants for root@'localhost';

#3.特殊許可權授權
max_queries_per_hour:一個使用者每小時可發出的查詢數量
max_updates_per_hour:一個使用者每小時可發出的更新數量

max_connections_per_hour:一個使用者每小時可連線到伺服器的次數
mysql> grant all on *.* to lhd@'localhost' identified by '123' with max_connections_per_hour 1;

max_user_connections:允許同時連線數量
mysql> grant all on *.* to test@'localhost' identified by '123' with max_user_connections 2;

2.回收許可權 revoke

#1.回收許可權
mysql> revoke drop on *.* from test@'localhost';

#2.檢視許可權
mysql> show grants for test@'localhost';

#3.所有許可權
SELECT, INSERT, UPDATE, DELETE, CREATE, DROP, GRANT, RELOAD, SHUTDOWN, PROCESS, FILE, REFERENCES, INDEX, ALTER, SHOW DATABASES, SUPER, CREATE TEMPORARY TABLES, LOCK TABLES, EXECUTE, REPLICATION SLAVE, REPLICATION CLIENT, CREATE VIEW, SHOW VIEW, CREATE ROUTINE, ALTER ROUTINE, CREATE USER, EVENT, TRIGGER, CREATE TABLESPACE

3.授權一個超級管理員

mysql> grant all on *.* to superuser@'localhost' identified by 'Lhd@123456' with grant option;

四、DML--資料操作語言

1.insert命令

#1.插入資料之前先看錶結構
mysql> desc student;
+----------+---------------------+------+-----+-------------------+----------------+
| Field    | Type                | Null | Key | Default           | Extra          |
+----------+---------------------+------+-----+-------------------+----------------+
| id       | int(10) unsigned    | NO   | PRI | NULL              | auto_increment |
| name     | varchar(10)         | NO   |     | NULL              |                |
| sex      | enum('男','女')     | YES  |     | 男                |                |
| age      | tinyint(3) unsigned | YES  |     | NULL              |                |
| cometime | datetime            | YES  |     | CURRENT_TIMESTAMP |                |
| class    | varchar(12)         | NO   |     | NULL              |                |
| status   | enum('0','1')       | YES  |     | 0                 |                |
+----------+---------------------+------+-----+-------------------+----------------+
7 rows in set (0.00 sec)

#2.insert不規範寫法
mysql> insert student values('4','周昊','男','20','2020-10-23','Linux10','0');
#一個欄位都不能少

#3.規範的寫法(只插入需要的值)
mysql> insert student(name,class) values('邱導','linux10');
mysql> insert student(name,class,age) values('邱導','linux10',20);

#4.規範寫法插入多條資料
mysql> insert student(name,class,age) values('增加','linux10',20),('減少','linux10',30);

2.update語句

#1.修改資料之前一定要確認資料
mysql> select * from student;

#2.修改資料,錯誤寫法
mysql> update student set age='16';

#3.修改資料,正確寫法
mysql> update student set age='18' where id=1;

#4.如果說就是修改表中所有資料
mysql> update student set age='18' where 1=1;

3.delete語句

#1.錯誤語法
mysql> delete from student;

#2.正確寫法
mysql> delete from student where id=1;

#3.刪除
mysql> delete from student where name='增加' and cometime='2020-10-23 20:16:57';

#4.使用狀態列表示已刪除
mysql> update student set status='1' where id=9;
mysql> select * from student where status='0';

4.注意

1.操作資料時一定要檢視資料
2.修改和刪除資料時一定要加條件
3.使用條件時儘量使用主鍵欄位
4.如果沒有主鍵欄位,使用多條件的方式
5.如果有狀態列,使用狀態列表示資料已刪除

五、作業:

1.需求:

1.恢復快照,使用二進位制的方式搭建三臺資料庫
2.建立資料庫
3.建立學生表(使用資料型別和資料屬性)
4.將自己組的同學插入學生表

2.環境準備

主機名 IP地址 角色
db01 10.0.0.51 資料庫伺服器
db02 10.0.0.52 資料庫伺服器
db03 10.0.0.53 資料庫伺服器

3.db01配置

1.上傳包
[root@db01 ~]# rz

2.安裝依賴
[root@db01 ~]# yum install -y ncurses-devel libaio-devel cmake glibc autoconf gcc-c++

3.解壓
[root@db01 ~]# tar xf mysql-5.6.42-linux-glibc2.12-x86_64.tar.gz

4.建立自定義目錄
[root@db03 ~]# mkdir /service

5.移動並改名
[root@db01 ~]# mv mysql-5.6.42-linux-glibc2.12-x86_64 /service/mysql-5.6.42

6.做軟連線
[root@db01 ~]# ln -s /service/mysql-5.6.42 /service/mysql

7.建立使用者
[root@db01 ~]# useradd mysql -s /sbin/nologin -M

8.拷貝啟動檔案和配置檔案
[root@db01 ~]# cd /service/mysql/support-files/
[root@db01 /service/mysql/support-files]# cp my-default.cnf /etc/my.cnf
cp: overwrite '/etc/my.cnf'? y
[root@db01 /service/mysql/support-files]# cp mysql.server /etc/init.d/mysqld
​```

9.初始化
[root@db01 ~]# cd /service/mysql/scripts/
[root@db01 /service/mysql/scripts]# ./mysql_install_db --user=mysql --basedir=/service/mysql --datadir=/service/mysql/data

10.配置system管理啟動MySQL
[root@db01 ~]# vim /usr/lib/systemd/system/mysqld.service
[Unit]
Description=MySQL Server
Documentation=man:mysqld(8)
Documentation=https://dev.mysql.com/doc/refman/en/using-systemd.html
After=network.target
After=syslog.target
[Install]
WantedBy=multi-user.target
[Service]
User=mysql
Group=mysql
ExecStart=/service/mysql/bin/mysqld_safe --defaults-file=/etc/my.cnf
LimitNOFILE = 5000

[root@db01 ~]# systemctl daemon-reload
	
11.修改啟動檔案
[root@db01 ~]# vim /etc/init.d/mysqld 
basedir=/service/mysql
datadir=/service/mysql/data
	
12.啟動s資料庫
[root@db01 ~]# systemctl start mysqld

13.設定環境變數
[root@db01 ~]# vim /etc/profile.d/mysql.sh
export PATH=/service/mysql/bin:$PATH

[root@db01 ~]# source /etc/profile

14.設定資料庫密碼
[root@db02 ~]# mysqladmin -uroot password
New password: 
Confirm new password: 

4.db02配置

配置1.上傳包
[root@db02 ~]# rz

2.安裝依賴
[root@db02 ~]# yum install -y ncurses-devel libaio-devel cmake glibc autoconf gcc-c++

3.解壓
[root@db02 ~]# tar xf mysql-5.6.42-linux-glibc2.12-x86_64.tar.gz

4.建立自定義目錄
[root@db03 ~]# mkdir /service

5.移動並改名
[root@db02 ~]# mv mysql-5.6.42-linux-glibc2.12-x86_64 /service/mysql-5.6.42

6.做軟連線
[root@db02 ~]# ln -s /service/mysql-5.6.42 /service/mysql

7.建立使用者
[root@db02 ~]# useradd mysql -s /sbin/nologin -M

8.拷貝啟動檔案和配置檔案
[root@db02 ~]# cd /service/mysql/support-files/
[root@db02 /service/mysql/support-files]# cp my-default.cnf /etc/my.cnf
cp: overwrite '/etc/my.cnf'? y
[root@db02 /service/mysql/support-files]# cp mysql.server /etc/init.d/mysqld
​```

9.初始化
[root@db02 ~]# cd /service/mysql/scripts/
[root@db02 /service/mysql/scripts]# ./mysql_install_db --user=mysql --basedir=/service/mysql --datadir=/service/mysql/data

10.配置system管理啟動MySQL
[root@db02 ~]# vim /usr/lib/systemd/system/mysqld.service
[Unit]
Description=MySQL Server
Documentation=man:mysqld(8)
Documentation=https://dev.mysql.com/doc/refman/en/using-systemd.html
After=network.target
After=syslog.target
[Install]
WantedBy=multi-user.target
[Service]
User=mysql
Group=mysql
ExecStart=/service/mysql/bin/mysqld_safe --defaults-file=/etc/my.cnf
LimitNOFILE = 5000

[root@db02 ~]# systemctl daemon-reload
	
11.修改啟動檔案
[root@db02 ~]# vim /etc/init.d/mysqld 
basedir=/service/mysql
datadir=/service/mysql/data
	
12.啟動s資料庫
[root@db02 ~]# systemctl start mysqld

13.設定環境變數
[root@db02 ~]# vim /etc/profile.d/mysql.sh
export PATH=/service/mysql/bin:$PATH

[root@db02 ~]# source /etc/profile

14.設定資料庫密碼
[root@db02 ~]# mysqladmin -uroot password
New password: 
Confirm new password: 

5.db03配置

配置1.上傳包
[root@db03 ~]# rz

2.安裝依賴
[root@db03 ~]# yum install -y ncurses-devel libaio-devel cmake glibc autoconf gcc-c++

3.解壓
[root@db03 ~]# tar xf mysql-5.6.42-linux-glibc2.12-x86_64.tar.gz

4.建立自定義目錄
[root@db03 ~]# mkdir /service

5.移動並改名
[root@db03 ~]# mv mysql-5.6.42-linux-glibc2.12-x86_64 /service/mysql-5.6.42

6.做軟連線
[root@db03 ~]# ln -s /service/mysql-5.6.42 /service/mysql

7.建立使用者
[root@db03 ~]# useradd mysql -s /sbin/nologin -M

8.拷貝啟動檔案和配置檔案
[root@db03 ~]# cd /service/mysql/support-files/
[root@db03 /service/mysql/support-files]# cp my-default.cnf /etc/my.cnf
cp: overwrite '/etc/my.cnf'? y
[root@db03 /service/mysql/support-files]# cp mysql.server /etc/init.d/mysqld
​```

9.初始化
[root@db03 ~]# cd /service/mysql/scripts/
[root@db03 /service/mysql/scripts]# ./mysql_install_db --user=mysql --basedir=/service/mysql --datadir=/service/mysql/data

10.配置system管理啟動MySQL
[root@db03 ~]# vim /usr/lib/systemd/system/mysqld.service
[Unit]
Description=MySQL Server
Documentation=man:mysqld(8)
Documentation=https://dev.mysql.com/doc/refman/en/using-systemd.html
After=network.target
After=syslog.target
[Install]
WantedBy=multi-user.target
[Service]
User=mysql
Group=mysql
ExecStart=/service/mysql/bin/mysqld_safe --defaults-file=/etc/my.cnf
LimitNOFILE = 5000

[root@db03 ~]# systemctl daemon-reload
	
11.修改啟動檔案
[root@db03 ~]# vim /etc/init.d/mysqld 
basedir=/service/mysql
datadir=/service/mysql/data
	
12.啟動s資料庫
[root@db03 ~]# systemctl start mysqld

13.設定環境變數
[root@db03 ~]# vim /etc/profile.d/mysql.sh
export PATH=/service/mysql/bin:$PATH

[root@db03 ~]# source /etc/profile

14.設定資料庫密碼
[root@db03 ~]# mysqladmin -uroot password
New password: 
Confirm new password: 

5.db01配置想關需求

1.建立資料庫
mysql> create database jh charset utf8;
Query OK, 1 row affected (0.00 sec)

2.使用資料庫
mysql> use jh;
Database changed

3.建立資料表
mysql> create table student(
    -> id int unsigned primary key auto_increment comment '學生id',
    -> name varchar(10) not null comment '學生姓名',
    -> sex enum('male','female') default 'male' comment '學生性別',
    -> age tinyint unsigned comment '學生年齡',
    -> writer_time datetime default now() comment '錄入時間',
    -> class varchar(12) not null comment '學生班級',
    -> status enum('0','1') default '1' comment '學生狀態'
    -> );
Query OK, 0 rows affected (0.14 sec)

4.將資料錄入資料表
mysql>  insert into student
    -> (id,name,age,class)
    -> values
    -> ('1','金輝','24','Linux10期');
Query OK, 1 row affected (0.00 sec)

mysql> select * from student;
+----+--------+------+------+---------------------+------------+--------+
| id | name   | sex  | age  | writer_time         | class      | status |
+----+--------+------+------+---------------------+------------+--------+
|  1 | 金輝   | male |   24 | 2020-10-23 19:15:03 | Linux10期  | 1      |
+----+--------+------+------+---------------------+------------+--------+
1 row in set (0.00 sec)

mysql>   insert into student
    ->   (name,class,age)
    ->   values
    ->   ('高峰','Linux10期','28'),
    ->   ('馬冸東','Linux10期','26'),
    ->   ('虞陳宇','Linux10期','22'),
    ->   ('王安峰','Linux10期','24'),
    ->   ('李錚林','Linux10期','22'),
    ->   ('李富豪','Linux10期','24'),
    ->   ('劉永華','Linux10期','26'),
    ->   ('陳立帆','Linux10期','21'),
    ->   ('劉大維','Linux10期','22'),
    ->   ('崔鵬','Linux10期','22'),
    ->   ('張智晨','Linux10期','23'),
    ->   ('李子龍','Linux10期','25')
    ->   ;

mysql> select * from student;
+----+-----------+------+------+---------------------+------------+--------+
| id | name      | sex  | age  | writer_time         | class      | status |
+----+-----------+------+------+---------------------+------------+--------+
|  1 | 金輝      | male |   24 | 2020-10-23 19:15:03 | Linux10期  | 1      |
|  2 | 高峰      | male |   28 | 2020-10-23 19:29:15 | Linux10期  | 1      |
|  3 | 馬冸東    | male |   26 | 2020-10-23 19:29:15 | Linux10期  | 1      |
|  4 | 虞陳宇    | male |   22 | 2020-10-23 19:29:15 | Linux10期  | 1      |
|  5 | 王安峰    | male |   24 | 2020-10-23 19:29:15 | Linux10期  | 1      |
|  6 | 李錚林    | male |   22 | 2020-10-23 19:29:15 | Linux10期  | 1      |
|  7 | 李富豪    | male |   24 | 2020-10-23 19:29:15 | Linux10期  | 1      |
|  8 | 劉永華    | male |   26 | 2020-10-23 19:29:15 | Linux10期  | 1      |
|  9 | 陳立帆    | male |   21 | 2020-10-23 19:29:15 | Linux10期  | 1      |
| 10 | 劉大維    | male |   22 | 2020-10-23 19:29:15 | Linux10期  | 1      |
| 11 | 崔鵬      | male |   22 | 2020-10-23 19:29:15 | Linux10期  | 1      |
| 12 | 張智晨    | male |   23 | 2020-10-23 19:29:15 | Linux10期  | 1      |
| 13 | 李子龍    | male |   25 | 2020-10-23 19:29:15 | Linux10期  | 1      |
+----+-----------+------+------+---------------------+------------+--------+
13 rows in set (0.00 sec)