create database mydb;
create database mydb character set gbk;
show databases;
drop database mydb
use database mydb
create table tablename()
show tables;
desc tablename 描述
alter TABLE tablename ADD liename 增加一列
alter TABLE tablename DROP liename 删除一列
rename TABLE T1 TO t1 修改表名
alter TABLE tablename CHANGE lie1 newlie varchar(100); 修改表的列名
drop TABLE user 删除表
表中列操作、
create table emp(
id int,
name varchar(100),
birthday date,
)
insert into tablename () values() 插入数据
update tablename SET liename =500 where name= ‘’ 跟新表中某一列的值
delect from tablename where name = ‘’
查询
Select 列 from tablename where group by having order by
where 条件
=、!=、<>、<、<=、>、>=;
BETWEEN…AND;两头都包含
IN(set);
IS NULL;
AND;
OR;
NOT;
between 20 and 40 为两头包含
_ 任意一个字母
%:任意0~n个字母
去重复记录 distinct
子查询
位置:1.where后为条件
select * from emp whera