一.Create(新增)
一>单行数据全列插入
insert into __(表) values ((插入的值));
二>单行数据指定插入
insert into __(表)(__ (要插入的列) )values ( 插入的值 );
三>多行数据指定插入
insert into __(表) (__ (要插入的列) )values ( 插入的值 ),( 插入的值 );
二.Retrieve(读取)
一>全列查询
select * from __(表);
二>指定列查询
select __(查询的列) from __(表);
三>查询字段为表达式
select __(查询的列) ,__(表达式) from __(表);
四>为查询结果指定别名
select __(查询的列) , __(表达式) as __(别名) from __(表);
五>结果去重查询
select distinct __(查询的列) from __(表);
三.Where条件查询
一>基本查询
select * from where __(判断条件);
二>AND和OR
select * from __(表) where __(判断值);
三>范围查询
1.select * from __(表) where __(列) between __(判断条件);
2.select * from __(表) where __(判断条件);
四>模糊查询
1.select * from __(表) where __(列) like '_(要查询的信息中的一个字)%';
2.select * from __(表) where __(列) like '_(要查询的信息中的一个字)_';
四.Order by 排序
一>从低到⾼排序(升序)
select * from__(表) order by __(列) asc;
二>按从⾼到低排序(降序)
select * from__(表) order by __(列) desc;
五.分页查询
一>语法一
select * from __(表) limit ,__(输出多少个值);
二>语法二
select * from __(表) limit __(头),__(输出多少个值);
六.Update修改
一>修改数值
update __(表) set __(修改的信息) where __(选择修改的相关信息);
七.Delete删除
一>删除列
delete from __(表) where__(列);