0
点赞
收藏
分享

微信扫一扫

python(五)-常用sql语句


1.创建新表
create table tabname(col1 type1 [not null] [primary key],col2 type2 [not null],..)

2.删除表
drop table tabname

3.查询:select * from table1 where 范围

4.插入:insert into 表名(字段名1,字段名2) values(值1,值2)

5.删除:delete from table1 where 范围

6.修改:update 表名 set 修改的字段名=修改的字段值 where 范围

7.查找:select * from table1 where field1 like ’%value1%’ N%匹配以N开头 %N匹配以N结尾 %N%匹配包含N
[a,b]% 以a或b开头 %[a,b]以a或b结尾

select * from table1 where field1 like 'z_'以z开头且匹配之后一个字符

升序输出数据记录
select * from table_name order by field asc
降序输出数据记录
select * from table_name order by field desc

9.总数:select count (*) from table_name;


举报

相关推荐

0 条评论