03-MySQL表操作
MySQL表操作
1.介绍
表就相当于文件,表中的一条记录就相当与文件的一行内容,不同的是,表中的一条记录有对应的标题,成为表的字段。
2.创建表
2.1语法
create table 表名(
字段名1 类型[(宽度) 约束条件],
字段名2 类型[(宽度) 约束条件],
字段名3 类型[(宽度) 约束条件],
); 注意:
1. 必须进入数据库中才能创建表
2. 标点符号均为英文标点符号
3. 在同一张表中,字段名是不能相同的
4. 宽度和约束条件为可选项
5. 字段名和类型是必须的
2.2范例
1-使用默认格式创建表
mysql> use python25;
Database changed
mysql> show tables;
Empty set (0.00 sec) mysql> create table test1(id int,
-> name char(11),
-> sex enum('male', 'female'),
-> hobby set('swiming', 'running', 'basketball'));
Query OK, 0 rows affected (0.02 sec) mysql> desc test1;
+-------+---------------------------------------+------+-----+---------+-------+
| Field | Type | Null | Key | Default | Extra |
+-------+---------------------------------------+------+-----+---------+-------+
| id | int(11) | YES | | NULL | |
| name | char(11) | YES | | NULL | |
| sex | enum('male','female') | YES | | NULL | |
| hobby | set('swiming','running','basketball') | YES | | NULL | |
+-------+---------------------------------------+------+-----+---------+-------+
4 rows in set (0.00 sec)
2-自定义格式创建表
# 指定字符编码
mysql> create table test3 (
-> id int,
-> name char(10),
-> age int,
-> sex enum('male', 'female'),
-> phone char(11),
-> job char(10)
-> ) charset=utf8;
Query OK, 0 rows affected (0.03 sec) #指定存储引擎
mysql> create table test4 (
-> id int,
-> name char(10),
-> age int,
-> sex enum('male', 'female'),
-> phone char(11),
-> job char(10)
-> ) ENGINE=MyISAM;
Query OK, 0 rows affected (0.01 sec)
3-查看表结构、创建表的语句
# 查看表结构
mysql> show columns from test1;
+-------+---------------------------------------+------+-----+---------+-------+
| Field | Type | Null | Key | Default | Extra |
+-------+---------------------------------------+------+-----+---------+-------+
| id | int(11) | YES | | NULL | |
| name | char(11) | YES | | NULL | |
| sex | enum('male','female') | YES | | NULL | |
| hobby | set('swiming','running','basketball') | YES | | NULL | |
+-------+---------------------------------------+------+-----+---------+-------+
4 rows in set (0.00 sec) mysql> desc test1;
+-------+---------------------------------------+------+-----+---------+-------+
| Field | Type | Null | Key | Default | Extra |
+-------+---------------------------------------+------+-----+---------+-------+
| id | int(11) | YES | | NULL | |
| name | char(11) | YES | | NULL | |
| sex | enum('male','female') | YES | | NULL | |
| hobby | set('swiming','running','basketball') | YES | | NULL | |
+-------+---------------------------------------+------+-----+---------+-------+
4 rows in set (0.00 sec) # 查看创建表的语句
mysql> show create table test1 \G;
*************************** 1. row ***************************
Table: test1
Create Table: CREATE TABLE `test1` (
`id` int(11) DEFAULT NULL,
`name` char(11) DEFAULT NULL,
`sex` enum('male','female') DEFAULT NULL,
`hobby` set('swiming','running','basketball') DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8
1 row in set (0.00 sec)
2.删除表
语法:
DROP TABLE 表名;
注意:删表要谨慎
mysql> show tables;
+--------------------+
| Tables_in_python25 |
+--------------------+
| test1 |
| test2 |
| test3 |
| test4 |
+--------------------+
4 rows in set (0.00 sec) mysql> drop table test1;
Query OK, 0 rows affected (0.01 sec) mysql> drop table test2;
Query OK, 0 rows affected (0.01 sec) mysql> show tables;
+--------------------+
| Tables_in_python25 |
+--------------------+
| test3 |
| test4 |
+--------------------+
2 rows in set (0.00 sec)
3.修改表
3.1 修改表名
语法
ALTER TABLE 表名 RENAME 新表名;
范例
mysql> show tables;
+--------------------+
| Tables_in_python25 |
+--------------------+
| test3 |
| test4 |
+--------------------+
2 rows in set (0.00 sec) mysql> alter table test3 rename test1;
Query OK, 0 rows affected (0.02 sec) mysql> show tables;
+--------------------+
| Tables_in_python25 |
+--------------------+
| test1 |
| test4 |
+--------------------+
2 rows in set (0.00 sec)
3.2 增加字段
语法
ALTER TABLE 表名 ADD 字段名 数据类型[(宽度) 约束条件], ADD 字段名 数据类型[(宽度) 约束条件];
范例
mysql> desc test1;
+-------+-----------------------+------+-----+---------+-------+
| Field | Type | Null | Key | Default | Extra |
+-------+-----------------------+------+-----+---------+-------+
| id | int(11) | YES | | NULL | |
| name | char(10) | YES | | NULL | |
| age | int(11) | YES | | NULL | |
| sex | enum('male','female') | YES | | NULL | |
| phone | char(11) | YES | | NULL | |
| job | char(10) | YES | | NULL | |
+-------+-----------------------+------+-----+---------+-------+
6 rows in set (0.01 sec) # 增加hobby、home两个字段
mysql> alter table test1 add hobby set('football', 'running'), add home char(10);
Query OK, 0 rows affected (0.04 sec)
Records: 0 Duplicates: 0 Warnings: 0 mysql> desc test1;
+-------+---------------------------+------+-----+---------+-------+
| Field | Type | Null | Key | Default | Extra |
+-------+---------------------------+------+-----+---------+-------+
| id | int(11) | YES | | NULL | |
| name | char(10) | YES | | NULL | |
| age | int(11) | YES | | NULL | |
| sex | enum('male','female') | YES | | NULL | |
| phone | char(11) | YES | | NULL | |
| job | char(10) | YES | | NULL | |
| hobby | set('football','running') | YES | | NULL | |
| home | char(10) | YES | | NULL | |
+-------+---------------------------+------+-----+---------+-------+
8 rows in set (0.00 sec)
3.3 删除字段
语法
ALTER TABLE 表名 DROP 字段名;
范例
mysql> desc test1;
+-------+-----------------------+------+-----+---------+-------+
| Field | Type | Null | Key | Default | Extra |
+-------+-----------------------+------+-----+---------+-------+
| id | int(11) | YES | | NULL | |
| name | char(10) | YES | | NULL | |
| age | int(11) | YES | | NULL | |
| sex | enum('male','female') | YES | | NULL | |
| phone | char(11) | YES | | NULL | |
| job | char(10) | YES | | NULL | |
+-------+-----------------------+------+-----+---------+-------+
6 rows in set (0.01 sec) # 删除hobby、home字段
mysql> alter table test1 add hobby set('football', 'running'), add home char(10);
Query OK, 0 rows affected (0.04 sec)
Records: 0 Duplicates: 0 Warnings: 0 mysql> desc test1;
+-------+---------------------------+------+-----+---------+-------+
| Field | Type | Null | Key | Default | Extra |
+-------+---------------------------+------+-----+---------+-------+
| id | int(11) | YES | | NULL | |
| name | char(10) | YES | | NULL | |
| age | int(11) | YES | | NULL | |
| sex | enum('male','female') | YES | | NULL | |
| phone | char(11) | YES | | NULL | |
| job | char(10) | YES | | NULL | |
| hobby | set('football','running') | YES | | NULL | |
| home | char(10) | YES | | NULL | |
+-------+---------------------------+------+-----+---------+-------+
8 rows in set (0.00 sec)
3.4 修改字段
语法
ALTER TABLE 表名 MODIFY 字段名 数据类型[(宽度) 约束条件];
ALTER TABLE 表名 CHANGE 旧字段名 新字段名 旧数据类型[(宽度) 约束条件];
ALTER TABLE 表名 CHANGE 旧字段名 新字段名 新数据类型[(宽度) 约束条件];
范例
mysql> desc test1;
+-------+-----------------------+------+-----+---------+-------+
| Field | Type | Null | Key | Default | Extra |
+-------+-----------------------+------+-----+---------+-------+
| id | int(11) | YES | | NULL | |
| name | char(10) | YES | | NULL | |
| age | int(11) | YES | | NULL | |
| sex | enum('male','female') | YES | | NULL | |
| phone | char(11) | YES | | NULL | |
| job | char(10) | YES | | NULL | |
+-------+-----------------------+------+-----+---------+-------+
6 rows in set (0.00 sec) # 修改job字段的数据类型
mysql> alter table test1 modify job varchar(11);
Query OK, 0 rows affected (0.06 sec)
Records: 0 Duplicates: 0 Warnings: 0 mysql> desc test1;
+-------+-----------------------+------+-----+---------+-------+
| Field | Type | Null | Key | Default | Extra |
+-------+-----------------------+------+-----+---------+-------+
| id | int(11) | YES | | NULL | |
| name | char(10) | YES | | NULL | |
| age | int(11) | YES | | NULL | |
| sex | enum('male','female') | YES | | NULL | |
| phone | char(11) | YES | | NULL | |
| job | varchar(11) | YES | | NULL | |
+-------+-----------------------+------+-----+---------+-------+
6 rows in set (0.01 sec) # 修改job字段为hobby字段
mysql> alter table test1 change job hobby varchar(11);
Query OK, 0 rows affected (0.02 sec)
Records: 0 Duplicates: 0 Warnings: 0 mysql> desc test1;
+-------+-----------------------+------+-----+---------+-------+
| Field | Type | Null | Key | Default | Extra |
+-------+-----------------------+------+-----+---------+-------+
| id | int(11) | YES | | NULL | |
| name | char(10) | YES | | NULL | |
| age | int(11) | YES | | NULL | |
| sex | enum('male','female') | YES | | NULL | |
| phone | char(11) | YES | | NULL | |
| hobby | varchar(11) | YES | | NULL | |
+-------+-----------------------+------+-----+---------+-------+
6 rows in set (0.00 sec) # 修改hobby字段为job字段,且数据类型改为char
mysql> alter table test1 change hobby job char(11);
Query OK, 0 rows affected (0.06 sec)
Records: 0 Duplicates: 0 Warnings: 0 mysql> desc test1;
+-------+-----------------------+------+-----+---------+-------+
| Field | Type | Null | Key | Default | Extra |
+-------+-----------------------+------+-----+---------+-------+
| id | int(11) | YES | | NULL | |
| name | char(10) | YES | | NULL | |
| age | int(11) | YES | | NULL | |
| sex | enum('male','female') | YES | | NULL | |
| phone | char(11) | YES | | NULL | |
| job | char(11) | YES | | NULL | |
+-------+-----------------------+------+-----+---------+-------+
6 rows in set (0.01 sec)
3.5 修改字段排列顺序、在增加的时候指定字段位置
语法
ALTER TABLE 表名 ADD 字段名 数据类型 [(宽度) 约束条件] FIRST;
ALTER TABLE 表名 ADD 字段名 数据类型 [(宽度) 约束条件] AFTER 字段名;
ALTER TABLE 表名 CHANGE 字段名 旧字段名 新字段名 新数据类型 [(宽度) 约束条件] FIRST;
ALTER TABLE 表名 MODIFY 字段名 数据类型 [(宽度) 约束条件] AFTER 字段名;
范例
mysql> desc test1;
+-------+-----------------------+------+-----+---------+-------+
| Field | Type | Null | Key | Default | Extra |
+-------+-----------------------+------+-----+---------+-------+
| id | int(11) | YES | | NULL | |
| name | char(10) | YES | | NULL | |
| age | int(11) | YES | | NULL | |
| sex | enum('male','female') | YES | | NULL | |
| phone | char(11) | YES | | NULL | |
| job | char(11) | YES | | NULL | |
+-------+-----------------------+------+-----+---------+-------+
6 rows in set (0.01 sec) # 在表的开头添加hobby字段
mysql> alter table test1 add hobby char(10) first;
Query OK, 0 rows affected (0.05 sec)
Records: 0 Duplicates: 0 Warnings: 0 mysql> desc test1;
+-------+-----------------------+------+-----+---------+-------+
| Field | Type | Null | Key | Default | Extra |
+-------+-----------------------+------+-----+---------+-------+
| hobby | char(10) | YES | | NULL | |
| id | int(11) | YES | | NULL | |
| name | char(10) | YES | | NULL | |
| age | int(11) | YES | | NULL | |
| sex | enum('male','female') | YES | | NULL | |
| phone | char(11) | YES | | NULL | |
| job | char(11) | YES | | NULL | |
+-------+-----------------------+------+-----+---------+-------+
7 rows in set (0.00 sec) # 在job字段后面添加salary字段
mysql> alter table test1 add salary int after job;
Query OK, 0 rows affected (0.05 sec)
Records: 0 Duplicates: 0 Warnings: 0 mysql> desc test1;
+--------+-----------------------+------+-----+---------+-------+
| Field | Type | Null | Key | Default | Extra |
+--------+-----------------------+------+-----+---------+-------+
| hobby | char(10) | YES | | NULL | |
| id | int(11) | YES | | NULL | |
| name | char(10) | YES | | NULL | |
| age | int(11) | YES | | NULL | |
| sex | enum('male','female') | YES | | NULL | |
| phone | char(11) | YES | | NULL | |
| job | char(11) | YES | | NULL | |
| salary | int(11) | YES | | NULL | |
+--------+-----------------------+------+-----+---------+-------+
8 rows in set (0.00 sec) # 修改hobby字段名为aihao
mysql> alter table test1 change hobby aihao char(10) first;
Query OK, 0 rows affected (0.02 sec)
Records: 0 Duplicates: 0 Warnings: 0 mysql> desc test1;
+--------+-----------------------+------+-----+---------+-------+
| Field | Type | Null | Key | Default | Extra |
+--------+-----------------------+------+-----+---------+-------+
| aihao | char(10) | YES | | NULL | |
| id | int(11) | YES | | NULL | |
| name | char(10) | YES | | NULL | |
| age | int(11) | YES | | NULL | |
| sex | enum('male','female') | YES | | NULL | |
| phone | char(11) | YES | | NULL | |
| job | char(11) | YES | | NULL | |
| salary | int(11) | YES | | NULL | |
+--------+-----------------------+------+-----+---------+-------+
8 rows in set (0.00 sec) # 把aihao字段放到salary字段后面
mysql> alter table test1 modify aihao char(10) after salary;
Query OK, 0 rows affected (0.04 sec)
Records: 0 Duplicates: 0 Warnings: 0 mysql> desc test1;
+--------+-----------------------+------+-----+---------+-------+
| Field | Type | Null | Key | Default | Extra |
+--------+-----------------------+------+-----+---------+-------+
| id | int(11) | YES | | NULL | |
| name | char(10) | YES | | NULL | |
| age | int(11) | YES | | NULL | |
| sex | enum('male','female') | YES | | NULL | |
| phone | char(11) | YES | | NULL | |
| job | char(11) | YES | | NULL | |
| salary | int(11) | YES | | NULL | |
| aihao | char(10) | YES | | NULL | |
+--------+-----------------------+------+-----+---------+-------+
8 rows in set (0.00 sec)
4.数据操作
创建表
# 创建语句
create table teacher(
id int primary key,
name char(10) not null,
age int,
hire_date datetime,
sex enum('male', 'female') not null default 'male',
phone char(11) unique,
salary float(8, 2),
hobby set('running', 'football', 'basketball'),
comment varchar(255)
); # 查看表结构
mysql> desc teacher;
+-----------+----------------------------------------+------+-----+---------+-------+
| Field | Type | Null | Key | Default | Extra |
+-----------+----------------------------------------+------+-----+---------+-------+
| id | int(11) | NO | PRI | NULL | |
| name | char(10) | NO | | NULL | |
| age | int(11) | YES | | NULL | |
| hire_date | datetime | YES | | NULL | |
| sex | enum('male','female') | NO | | male | |
| phone | char(11) | YES | UNI | NULL | |
| salary | float(8,2) | YES | | NULL | |
| hobby | set('running','football','basketball') | YES | | NULL | |
| comment | varchar(255) | YES | | NULL | |
+-----------+----------------------------------------+------+-----+---------+-------+
9 rows in set (0.00 sec)
4.1 插入数据
语法
插入单行数据,
INSERT INTO 表名 (字段1, 字段2, 字段3...) value (值1, 值2, 值3);
如果不添加字段名称,插入的数据需要与表里的字段一一对应
INSERT INTO 表名 value (值1, 值2, 值3);
插入多行数据
INSERT INTO 表名 values (值1, 值2, 值3),(值1, 值2, 值3),(值1, 值2, 值3);
范例
# 插入单条数据,注意float类型会进行四舍五入
mysql> insert into teacher (id, name, hobby) value (1, 'zhangsan', 'running');
Query OK, 1 row affected (0.42 sec) mysql> select * from teacher;
+----+----------+------+-----------+------+-------+--------+---------+---------+
| id | name | age | hire_date | sex | phone | salary | hobby | comment |
+----+----------+------+-----------+------+-------+--------+---------+---------+
| 1 | zhangsan | NULL | NULL | male | NULL | NULL | running | NULL |
+----+----------+------+-----------+------+-------+--------+---------+---------+
1 row in set (0.00 sec) mysql> insert into teacher value (2, 'lisi', 30, '2017-10-20', 'male', '13069948980', 2000, 'basketball', 'haha');
Query OK, 1 row affected (0.15 sec) mysql> select * from teacher;
+----+----------+------+---------------------+------+-------------+---------+------------+---------+
| id | name | age | hire_date | sex | phone | salary | hobby | comment |
+----+----------+------+---------------------+------+-------------+---------+------------+---------+
| 1 | zhangsan | NULL | NULL | male | NULL | NULL | running | NULL |
| 2 | lisi | 30 | 2017-10-20 00:00:00 | male | 13069948980 | 2000.00 | basketball | haha |
+----+----------+------+---------------------+------+-------------+---------+------------+---------+
2 rows in set (0.03 sec) # 插入多条数据
mysql> insert into teacher values (3, 'wangwu', 28, '2016-11-20', 'male', '1382333333', 20000, 'football', 'wowo'),
-> (4, 'xiaoli', 28, '2015-11-20', 'female', '13823333333', 20000, 'football', 'wowo');
Query OK, 2 rows affected (0.40 sec)
Records: 2 Duplicates: 0 Warnings: 0 mysql> select * from teacher;
+----+----------+------+---------------------+--------+-------------+----------+------------+---------+
| id | name | age | hire_date | sex | phone | salary | hobby | comment |
+----+----------+------+---------------------+--------+-------------+----------+------------+---------+
| 1 | zhangsan | NULL | NULL | male | NULL | NULL | running | NULL |
| 2 | lisi | 30 | 2017-10-20 00:00:00 | male | 13069948980 | 2000.00 | basketball | haha |
| 3 | wangwu | 28 | 2016-11-20 00:00:00 | male | 1382333333 | 20000.00 | football | wowo |
| 4 | xiaoli | 28 | 2015-11-20 00:00:00 | female | 13823333333 | 20000.00 | football | wowo |
+----+----------+------+---------------------+--------+-------------+----------+------------+---------+
4 rows in set (0.00 sec)
4.2 删除数据
语法
DELETE FROM 表名 WHERE ....;
范例
mysql> select * from teacher;
+----+----------+------+---------------------+--------+-------------+----------+------------+---------+
| id | name | age | hire_date | sex | phone | salary | hobby | comment |
+----+----------+------+---------------------+--------+-------------+----------+------------+---------+
| 1 | zhangsan | NULL | NULL | male | NULL | NULL | running | NULL |
| 2 | lisi | 30 | 2017-10-20 00:00:00 | male | 13069948980 | 2000.00 | basketball | haha |
| 3 | wangwu | 28 | 2016-11-20 00:00:00 | male | 1382333333 | 20000.00 | football | wowo |
| 4 | xiaoli | 28 | 2015-11-20 00:00:00 | female | 13823333333 | 20000.00 | football | wowo |
+----+----------+------+---------------------+--------+-------------+----------+------------+---------+
4 rows in set (0.00 sec) mysql> delete from teacher where id=1;
Query OK, 1 row affected (0.48 sec) mysql> select * from teacher;
+----+--------+------+---------------------+--------+-------------+----------+------------+---------+
| id | name | age | hire_date | sex | phone | salary | hobby | comment |
+----+--------+------+---------------------+--------+-------------+----------+------------+---------+
| 2 | lisi | 30 | 2017-10-20 00:00:00 | male | 13069948980 | 2000.00 | basketball | haha |
| 3 | wangwu | 28 | 2016-11-20 00:00:00 | male | 1382333333 | 20000.00 | football | wowo |
| 4 | xiaoli | 28 | 2015-11-20 00:00:00 | female | 13823333333 | 20000.00 | football | wowo |
+----+--------+------+---------------------+--------+-------------+----------+------------+---------+
3 rows in set (0.00 sec)
4.3 更新数据
语法
UPDATE 表名 SET 字段1=值1, 字段2=值2 WHERE ...;
范例
mysql> select * from teacher;
+----+--------+------+---------------------+--------+-------------+----------+------------+---------+
| id | name | age | hire_date | sex | phone | salary | hobby | comment |
+----+--------+------+---------------------+--------+-------------+----------+------------+---------+
| 2 | lisi | 30 | 2017-10-20 00:00:00 | male | 13069948980 | 2000.00 | basketball | haha |
| 3 | wangwu | 28 | 2016-11-20 00:00:00 | male | 1382333333 | 20000.00 | football | wowo |
| 4 | xiaoli | 28 | 2015-11-20 00:00:00 | female | 13823333333 | 20000.00 | football | wowo |
+----+--------+------+---------------------+--------+-------------+----------+------------+---------+
3 rows in set (0.00 sec) mysql> update teacher set age=40 where id=2;
Query OK, 1 row affected (0.46 sec)
Rows matched: 1 Changed: 1 Warnings: 0 mysql> select * from teacher;
+----+--------+------+---------------------+--------+-------------+----------+------------+---------+
| id | name | age | hire_date | sex | phone | salary | hobby | comment |
+----+--------+------+---------------------+--------+-------------+----------+------------+---------+
| 2 | lisi | 40 | 2017-10-20 00:00:00 | male | 13069948980 | 2000.00 | basketball | haha |
| 3 | wangwu | 28 | 2016-11-20 00:00:00 | male | 1382333333 | 20000.00 | football | wowo |
| 4 | xiaoli | 28 | 2015-11-20 00:00:00 | female | 13823333333 | 20000.00 | football | wowo |
+----+--------+------+---------------------+--------+-------------+----------+------------+---------+
3 rows in set (0.00 sec)
4.4 查询数据
03-MySQL表操作的更多相关文章
- Python 3 mysql 表操作
Python 3 mysql 表操作 表相当于文件,表中的一条记录就相当于文件的一行内容,不同的是,表中的一条记录有对应的标题,称为表的字段 id,name,qq,age称为字段,其余的,一行内容称为 ...
- 8.3 mysql 表操作
库操作 一 系统数据库 information_schema: 虚拟库,不占用磁盘空间,存储的是数据库启动后的一些参数,如用户表信息.列信息.权限信息.字符信息等 performance_sch ...
- 数据库 -- mysql表操作
一,存储引擎介绍 存储引擎即表类型,mysql根据不同的表类型会有不同的处理机制 详见:https://www.cnblogs.com/peng104/p/9751738.html 二,表介绍 表相当 ...
- MySQL表操作及数据操作
表操作 表相当于一个文件,其形式与现实中的表格相同.表中的每条记录都有相应的字段,字段就类似于表格的表头. 表操作详细: #对表进行操作(文件) #首先要切换到指定库(即文件夹)下:use db1; ...
- 细说MySQL表操作
目录 语法 查看表结构 查看所有的表 删除表 查看创建表的语句 修改表的字符集和校验规则 修改表名 在表中添加新字段 修改表的字段名 修改表中字段的属性 删除表中的某个字段 设置某个字段为主键 把某个 ...
- mysql表操作与权限操作
修改表ALTER TABLE 语法: . 修改表名 ALTER TABLE 表名 RENAME 新表名; . 增加字段 ALTER TABLE 表名 ADD 字段名 数据类型 [完整性约束条件…], ...
- mysql数据库从删库到跑路之mysql表操作
表介绍 表相当于文件,表中的一条记录就相当于文件的一行内容,不同的是,表中的一条记录有对应的标题,称为表的字段 id,name,qq,age称为字段,其余的,一行内容称为一条记录 内容: 1 创建表 ...
- MySQL 表操作 (Day40)
阅读目录 一.表介绍 二.创建表 三.查看表 四.修改表 五.删除表 六.操作表中的记录 一.表介绍 表相当于文件,表中的一条记录就相当于文件的一行内容,不同的是,表中的一条记录有对应的标题,则称为表 ...
- Mysql表操作
查看表结构: 可以使用describe或show create table语句查看表的结构: describe表名; Show create table 表名; 修改表名: Alter table 旧 ...
- mysql 表操作
创建表 简单的方式 CREATE TABLE person ( number INT(11), name VARCHAR(255), birthday DATE ); 或者是 CREATE TABLE ...
随机推荐
- 将Python 程序打包成 .exe格式入门
PyInstaller PyInstaller 是一个十分有用的第三方库,可以用来打包 python 应用程序,打包完的程序就可以在没有安装 Python 解释器的机器上运行了. 它能够在 Windo ...
- [Vue] karme/jasmine/webpack/vue搭建测试环境
karma 和 jasmine karma 是 google 开源的一个基于 Node.js 的 JavaScript 前端测试运行框架,前身叫 Testacular. jasmine 是一个 jav ...
- PMBook - 6.项目进度管理
6.3 排列活动顺序 6.3.1 排列活动顺序:输入 6.3.1.1 项目管理计划 6.3.1.2 项目文件 6.3.1.3 事业环境因素 6.3.1.4 组织过程资产 6.3.2 排列活动顺序: ...
- ASP.NET Core Web API 版本控制
在nuget.org上,您可以找到 Microsoft.AspNetCore.Mvc.Versioning包,它提供了有关如何对Web API端点进行版本化的更多选项.这个包的好处是允许你直接在控制 ...
- 带着新人简单看看servlet到springmvc
好久都没有写博客了,不是因为自己懒了,而是总感觉自己知道的只是太少了,每次想写博客的时候都不知道怎么下手,不过最近看到一篇博客说的是springmvc,给了我比较大的兴趣,感觉一下子对整个spring ...
- Python3+unitest自动化测试初探(下篇)
目录 9.用例结果校验 10.跳过用例 11.Test Discovery 12.加载用例 unittest官方文档 本篇随笔承接: Python3+unitest自动化测试初探(中篇) Python ...
- C++与Lua交互之配置&交互原理&示例
|Lua 简介 Lua 是一种轻量小巧的脚本语言,也是号称性能最高的脚本语言,它用C语言编写并以源代码形式开放. 某些程序常常需要修改内容,而修改的内容不仅仅是数据,更要修改很多函数的行为. 而修改函 ...
- SQLServer低版本附加高版本的数据库常用处理方法
SqlServer低版本数据库不能直接还原或附加Sql高版本数据库或备份文件,我们常用DTS互导的方式,如果不同版本数据库不可访问,可以使用高版本数据库的DTS导出整个库的相应低版本建库脚本与数据,然 ...
- [翻译]Mock 在 Python 中的使用介绍
目录 Mock 在 Python 中的使用介绍 原文链接与说明 恐惧系统调用 一个简单的删除函数 使用 Mock 重构 潜在陷阱 向 'rm' 中加入验证 将文件删除作为服务 方法 1:模拟实例的方法 ...
- cocos creator主程入门教程(六)—— 消息分发
五邑隐侠,本名关健昌,10年游戏生涯,现隐居五邑.本系列文章以TypeScript为介绍语言. 本篇开始介绍游戏业务架构相关的内容.在游戏业务层,所有需要隔离的系统和模块间通信都可以通过消息分发解耦. ...