## **mysql入门基本语句**
```sql
# 创建表
create table student(
id int(8),
name varchar(20),
sex char(2),
birthday date,
sal double(7,2)
);
#改变表
alter table student add (address varchar(20));
#删除表
drop table student;
#修改字段的长度
alter table student modify id int(4);
#删除一个字段
alter table student drop address;
#修改表名
rename table student to STUDENT;
insert into student(id, name, sex, birthday, sal) VALUES (1001,'李华','男',now(),10000.00);
select * from STUDENT;
update student set sal=1000.01 where id=1001;
/*DML*/
#插入数据 不指定字段
insert into STUDENT values (1002,'王刚','男','2000-01-21 02:33:20',12000);
#插入数据 指定字段
insert into STUDENT(id, name, sex, birthday, sal) VALUES (1001,'李华','男',now(),10000.00);
#插入多条
insert into STUDENT values (1001,'大乔','女','200-07-11 02:33:20',14100),
(1002,'小乔','女','200-07-11 02:33:20',13300);
#修改数据
update STUDENT set sal=15000.00,sex='女' where id=1001 or id=1003 and sal=14100;
#根据条件删除数据,条件不写全删除
delete from STUDENT where name='王刚';
#查询数据,条件不写查询所有
select * from STUDENT where id=1002 or id=1001;
#截断表
truncate table STUDENT;