一:数据库创建,增删改查
- 数据库操作
create database db_name;
drop database db_name;
create database db_name if not exists db_name;
show databases;
show create database db_name;
alteratabase db_name character set 编码方式;
- 表操作
use db_name;
select database();
desc tb_name;
create table user(id int [primary key,auto_increment],name varchar(10),age tinyint default 19);
insert into user(id,name)values(1,'alex');
insert into user(id,name)values(1,'alex'),(2,'tom');
insert into user set id=3,name='xxx';
update user set name='lanfei' where id=3;
delete from user where id=1;
delete user;
truncate table tb-name;
二:数据库信息查询