1 show databases;
2 create database first;
3 drop database first;
4 use example;
5 create table example0(
6 id int primary key auto_increment,
7 name varchar(20)
8 );
9 show tables;
10 describe example0;
11 show create table example1 \G
12 primary key,
13
14 constraint c_fk foreign key(stu_id,course_id) references exma2(stu_id,course_id)
15
16 unique
17 math float default 0
18
19 alter table ex0 rename ex1;
20 alter table ex0 modify sex int(4);
21 alter table ex0 change id stu_id int;
22 alter table ex0 add age int not null;
23 alter table ex0 add id int primary key first;
24 alter table ex0 add address varchar(30) not null after name;
25 alter table ex0 drop sex;
26 alter table ex0 modify address varchar(30) after name;
27 alter table ex0 modify address varchar(30) first;
28 alter table ex0 drop foreign key c_fk;
29 drop table ex0;
30
31 insert into 表名 values(, , , );
32
33 select * from 表名;
34 select * from 表名 where id in(1000,1001);
35 select * from 表名 where age between 18 and 20;
36 select * from biao where name like "李明";
37 select * from biao where name like "李%";
38 select * from biao where name like "%李%";
39 select * from b where name like "李_";
40 select * from b where name not like "李%";
41 select * from ex0 order by id asc;
42 select * from ex0 order by age desc;
43 select avg(math),avg(English),avg(sum) from a1;
44 select id,name,max(sum) from a1;
45 select id,name,sex,max(sum) from a1 group by sex;
46
47 update tab_name set col_name1="",col_name2=" " where name="" order by
48 update tab_name set sum=math+English;
49
50 delete tab_name from tab_name where id=1005;