创建名为测试的数据库

create anyun ceshi;

查看创建的数据库

show anyun;

使用此数据库

use ceshi;

创建一个表

create table world(

id int not null auto_increment,

name varchar(100) not null,

parent_id int not null,

primary key (id)

)engine = innoDB default charset  = utf8;

 

查看新建的表

desc world;

插入数

insert into world (name,parent_id,level)values  ('上海市',0,1),('北京市',0,1),('湖北省',0,2),('江苏省',0,1),('重庆市',0,2);

查询world数据

select * from world;

删除一条id为1的数据

delete from world id=1;

查询

select * from (文件名)where (条件  xxx='xxx');

查询总条数

select count(1)from anyun_tbl;

查询名字为上海的数据

select count(1) as 'number' from anyun_tbl where anyun_name ='上海';

 

posted on 2018-04-17 13:14  super阿水  阅读(91)  评论(0)    收藏  举报