创建表
create table employee (employee_id char(6) primary key,name char(8),sex char(2),birthday
date);
create table products (product_id char(2) primary key, name char(20));
察看表结构
describe employ-ee;
describe products;
修改表结构
alter table employee modify name char(10);
alter table products modiry name char(30);
向表中添加数据
insert into employee values ('200301','zhangsan','m','1978/5/8');
insert into employee values ('200302','lisi','f','1973/3/20');
insert into employee values ('200303','wangwu','f','1970/10/9');
insert into employee values ('200304','zhaoliu','m','1975/1/18');
修改表内容
update employee set employee_id="200310" where name="zhaoliu";
创建索引
建表时创建带索引的表
create table test1 (test1_id char(4),name char(20), index idx_test1(name(10)));
create index idx_employee on employee(name); 用create为name列创建索引
alter table products add index idx_products(name); 用alter为name列创建索引
察看索引
show index from employee;
show index from products;
删除索引
drop index idx_employee on employee;
alter table products drop index idx_products;