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;
相关推荐
极客先躯23 分钟前
高级java每日一道面试题-2024年9月15日-架构篇[分布式篇]-如何在分布式系统中实现事务?
java·数据库·分布式·面试·架构·事务·分布式篇
脑子不好真君28 分钟前
使用cmd命令窗口操作mongodb
数据库·mongodb
椅子哥1 小时前
MyBatis操作数据库-XML实现
xml·java·数据库·spring boot·mybatis
青碧凝霜1 小时前
redis单点、主从、哨兵、集群的不同
数据库·redis·缓存
老哥不老2 小时前
MySQL安装教程
android·mysql·adb
小马爱打代码2 小时前
MongoDB的安装和使用
数据库·mongodb
完球了2 小时前
【Day03-MySQL单表】
数据库·笔记·学习·mysql·sql8.0
小李飞刀李寻欢2 小时前
mongoDB 读取数据python版本实现
数据库·python·mongodb·数据
To-sz352 小时前
mongodb 主从集群,分片集群
数据库·mysql·mongodb
DieSnowK2 小时前
[Redis][Set]详细讲解
数据库·redis·分布式·缓存·set·数据类型·新手向