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;
相关推荐
NineData4 小时前
数据库迁移总踩坑?用 NineData 迁移评估,提前识别所有兼容性风险
数据库·程序员·云计算
阿里云大数据AI技术5 小时前
用 SQL 调大模型?Hologres + 百炼,让数据开发直接“对话”AI
sql·llm
赵渝强老师7 小时前
【赵渝强老师】PostgreSQL中表的碎片
数据库·postgresql
全栈老石11 小时前
拆解低代码引擎核心:元数据驱动的"万能表"架构
数据库·低代码
倔强的石头_1 天前
kingbase备份与恢复实战(二)—— sys_dump库级逻辑备份与恢复(Windows详细步骤)
数据库
jiayou642 天前
KingbaseES 实战:深度解析数据库对象访问权限管理
数据库
于眠牧北3 天前
MySQL的锁类型,表锁,行锁,MVCC中所使用的临键锁
mysql
李广坤3 天前
MySQL 大表字段变更实践(改名 + 改类型 + 改长度)
数据库
Turnip12024 天前
深度解析:为什么简单的数据库"写操作"会在 MySQL 中卡住?
后端·mysql
爱可生开源社区4 天前
2026 年,优秀的 DBA 需要具备哪些素质?
数据库·人工智能·dba