MySql(三)数据操作

1添加信息:

//添加一个国家:中国;

insert into table_name(name) values ('china');


2.修改表内数据

update table_name set item1=value1 where condition;


3.删除表中数据:

delete from table_name where condition;

4.1查询表内所有数据:

select * from table_name;

4.2查询指定条件数据:

select * from country where condition;

4.3查询前n条数据:

select * from table_name limit n;

4.4跳过前m条,查询后面的n条数据:

select * from table_name limit m,n;

4.5查找不包含condition的数据:

select * from table_name where id <> 1;

4.6查找既满足条件A,又满足条件B的数据:

select * from table_name where id between A and B;

4.7查找满足条件A或者满足条件B的0数据:

select * from table_name where condition1 or condition 2;

4.8查找数据在条件(a->b之间)的数据:

select * from table_name where id in(a,b);

4.9模糊查询:

select * from table_name where name like 'A%';

select * from table_name where name like 'A_';

5.1.表内数据倒序排序

select * from country order by id desc;


5.1.表内数据正序排序

select * from country order by id ;



2018.4.24

TonyChen

一个人熬过了所有苦难,也就不在期待一定要和谁在一起了。努力过,但结局我不想说。

猜你喜欢

转载自blog.csdn.net/u013284706/article/details/80054452