SQL仓库

  1. 查表中数据个数
sql 复制代码
select count(*) from table_name where condition 
  1. 删除表中数据
sql 复制代码
delete from table_name where condition

3.筛选符合条件数据并且将结果根据条件公式求和

sql 复制代码
SELECT
   sum(case 
   	   when transaction_state ='B' then transaction_amount
   	   when transaction_state ='s' then -transaction_amount 
   end
   )as result
FROM 
    stocktransactiondetail_april 
WHERE 
    stock_symbol ='sz300347' AND (transaction_date ='2024-04-19' or transaction_date ='2024-04-22' or transaction_date ='2024-04-23') AND transaction_amount >1000000;
相关推荐
代码不停29 分钟前
Redis基本数据类型
数据库·redis
aifannihao35 分钟前
ON CONFLICT 冲突后返回空:sqlite3 实测 get-or-create
数据库·python·postgresql·sqlite3·标准库
两点王爷1 小时前
面试 | 索引是什么?有哪些分类?索引为什么会失效?
sql·面试
得物技术1 小时前
Computer Use与Browser Use:揭秘Agent如何操作电脑和浏览器|得物技术
数据库·github·ai编程
小小程序员.¥1 小时前
mysql备份以及数据恢复实战
数据库·mysql
wno7041 小时前
Nginx代理MySQL或PG连接
运维·mysql·nginx
AllData公司负责人2 小时前
实战一:AllData大模型与AI数据底座-数据传输平台-DBSyncer,搭建 File 到 Doris 高效数据同步链路,批量文件离线入仓
数据库·人工智能·分布式·大模型·数据传输·数据同步·连接器
FungLeo3 小时前
FengCMS · PHP+MySQL 升级实录· PHP Session 锁:什么时候释放能救活并发
android·mysql·php·session·fengcms
黄俊懿3 小时前
【架构师从入门到进阶】第七章:缓存和存储的优化思路——第六节:数据库更新和缓存更新的组合方案
数据库·缓存·性能优化·架构·系统架构
小马过河R16 小时前
真实场景:用户自建定时任务与推送提醒Agent-架构设计与可靠性实践
数据库·人工智能·agent·vibe coding·ai coding