1、创建数据库:creata database if not exists db1;
2、查询数据:show databases;
3、删除数据库:drop database if exists db1;
4、查看当前使用数据库:select database();
5、使用数据库:use testdb; --- testdb为数据库名称;
操作表
1、查询数据库下表信息:show tables;
2、查看表结构信息:desc +表名称;
3、创建表: create table tb_user
(
id int,
username varchar(20),
password varchar(32)
);
例:create table student(
-> id int,
-> name varchar(10),
-> gender char(1),
-> brithday date,
-> score double(5,2),
-> email varchar(64),
-> tel varchar(15),
-> status tinyint);
数据类型:
4、删除表:drop table if exists tb_user;
5、修改表: