Warning: Attempt to read property "ID" on bool in /www/wwwroot/129.28.78.18/wp-content/themes/storeys-pro/wbc/components/og_schema/wb_og_schema.php on line 471

Warning: Attempt to read property "display_name" on bool in /www/wwwroot/129.28.78.18/wp-content/themes/storeys-pro/wbc/components/og_schema/wb_og_schema.php on line 480

Warning: Attempt to read property "display_name" on bool in /www/wwwroot/129.28.78.18/wp-content/themes/storeys-pro/wbc/components/og_schema/wb_og_schema.php on line 487

Warning: Attempt to read property "description" on bool in /www/wwwroot/129.28.78.18/wp-content/themes/storeys-pro/wbc/components/og_schema/wb_og_schema.php on line 489

Warning: Attempt to read property "ID" on bool in /www/wwwroot/129.28.78.18/wp-content/themes/storeys-pro/wbc/components/og_schema/wb_og_schema.php on line 493

邹瑞20201014

总结

数据库

create database if not exists db_name//建库

use db_name //用库

drop database db_name//删库

create table tab_name(

col_name datatype default null/number comment '注释',

col_name datatype

)CHARACTER set 编码格式;

使用create table关键词创建数据表

tab_name是数据表的名称

col_name是列名称

datatype是列的数据类型

default是默认值

comment是注释

数据类型

查看表结构 DESCRIBE dept;

创建和dept结构一样的表 CREATE TABLE d LIKE dept;

删表drop table table_name;

添加列 ALTER TABLE d ADD id int

修改列 ALTER TABLE d MODIFY id VARCHAR(20);

修改列名 ALTER TABLE d CHANGE id ss VARCHAR(20);

删除列 ALTER TABLE d DROP ss

重命名表 RENAME TABLE d to dd

CRUD操作

评论留言