create table
drop table if exists user;
create table user(
id int primary key not null,
birday date,
name varchar(30) not null,
phone int,
address varchar(255),
sex char
);
最后一列不要","号,varchar要指定长度。
insert into
insert into user values
(1382,'2000-10-10','jack',123,'sdf','M' ),
(1823,'2000-10-10','jack',123,'sdf' ,'M' ),
(1673,'2000-10-10','sfdfs',123,'sdf' ,'M' ),
(1453,'2000-10-10','jack',123,'sdf','F' );
多条数据同时插入,mysql有效其他未知;
limit:
select * from user limit 0 ,2;
limit参数用","隔开
alter add
alter table user
add type char(1)
alter drop
alter table user
drop column sex;
指定 column
alter modify
alter table
modify sex char(2)
modify 对mysql有效,另有
alter table user
alter column sex char(2)
create index:
create index name_index on user (name);
name_index 不要单引号。
drop index
drop index name_index
不能修改index,只能删除在添加