python中的p dml sel_python 笔记 之 表操作 DML语句

'''

表操作 DML语句

'''

'''

select 列名 from 表名 where 条件判断

select * from sutdent where id > 1000

select * from test group by name having count(*)>1;

select * from test group by name having count(*)>1 order by name; # 排序

select * from test group by name having count(*)>1 order by id desc; # 反序

多表查询

select * from a,b, where a.id = c.组id

select a.id,a.name,b.id from a join c on c.组id = a.id and ...

'''

'''

insert into table_name (id,name,age ) values (i,'aa',22)

delete from table_name where 条件

update table_name set 列名=xx where 条件

truncate # 只清除数据,不删表结构

drop #删表结构

desc table_name ;

show create table;

#查10行

select * from table_name limite 10;

'''

'''

#建索引

create index 库名_表名_列名1_列名2(列名1,列名2)

show index from test;

#创建索引

alter table test add index

#查看是否有索引,有索引就快

explain select * from test where name="aaa";

'''

'''

ORM思想

'''

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值