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;
相关推荐
Databend8 分钟前
从湖仓升级为 Agent 时代的数据控制面,Snowflake 和 Databricks 有哪些布局
大数据·数据库·agent
ClouGence3 小时前
SQL Server CDC 能放到 Always On 备库读吗?一文讲透原理与实践
数据库·sql server
先吃饱再说21 小时前
存储的进化:从 MySQL 到浏览器缓存,数据到底住在哪?
数据库
Nturmoils21 小时前
字段太多看不全,ksql 的展开模式和输出控制怎么用
数据库·后端
Databend1 天前
Agent 轨迹分析与归因的数据工程实践
大数据·数据库·agent
这个DBA有点耶1 天前
SQL改写进阶:标量子查询的“隐形代价”与消除实战
数据库·mysql·架构
smallyoung1 天前
数据库乐观锁深度解析:MySQL、PostgreSQL 实战 + Spring Boot 集成指南
数据库·mysql·postgresql
parade岁月1 天前
MySQL JOIN解析:朴实无华但食之有味
数据库·后端
用户3169353811831 天前
MySQL服务无法启动问题解决全记录
数据库
vivo互联网技术1 天前
从 10 分钟到 1 秒:ES 深度分页任意跳页的三轮优化实战
服务器·数据库·redis·elasticsearch·深度分页