MYSQL对数据库和表的基本操作

CREATE DATABASE testdb CHARSET=UTF8
创建一个数据库 名字叫做testdb
USE testdb;
选择数据库
 CREATE TABLE testTable1(
    -> id int(11) not null primary key auto_increment,
    -> username char(16) not null,
    -> password char(16) not null);

创建一个表 名字为testTable1

第一个字段名字为 id 最大11个字符 not null 不允许为空 Primary key 设置主键 auro_increment,自动增长

第二个字段名字为username char型最大16个字符 不允许为空

第二个字段名字为password char型最大16个字符 不允许为空

DROP TABLE testTable1;
DROP DATABASE testdb;

删除一个表 

删除一个数据库

posted @ 2020-03-01 17:29  hack747  阅读(334)  评论(0编辑  收藏  举报