1.回顾
建库建表应该注意的问题
1)首先建立数据库
2)使用数据库
3)建表
4) 插入数据

2.讲解常用查询语句
1)全字段查询
   select * from sanguo;  

2)单字段查询
   #查询三国表里的名字和地址
   select name,address from sanguo;

3)简单条件查询
   #查询三国表里hp为1200的数据
   select * from sanguo where hp='1200';
  
   #为空查询
   select * from sanguo where mp is null;

   #去掉重复行 关键字distinct
   select distinct name from sanguo where name='典韦';
   
   #把三国表里名字包含z的信息全部显示出来 
   select * from sanguo where name like %z%;

   #计算总行数,计算出当前表里面的有多少行数据
   select count(*) from sanguo;

3.插入语句的讲解
  1)建立一张新表
  create table person(
  id int(6) not null primary key,
  name varchar(10) not null,
  age int(3),
  address varchar(20),
  sex varchar(4) not null
  );

  2)全字段插入
 insert into person values(3,'王武',22,'武大','男');
 
  3)选择字段插入
   insert into person(id,name,sex) values(2,'李四','女');

4.简单的修改数据
  update 表名 set 字段名=值 where 条件
  例如:
  update person set sex='女' where name='王武';
  update person set age=50 where id=1;
  
  例如让年龄小于23的人年龄长两岁
  update person set age=age+2 where age<23;

5.简单的删除数据
  delete from 表名;  #把表表里的所有数据都删除
  drop table 表名; #把表从数据库里删除

  delete from 表名 where 条件
  例如:
delete from sanguo where name='dw';