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;
相关推荐
linchare34 分钟前
linux debian上只装mysql的客户端步骤
linux·mysql·debian
w***4242 小时前
【MySQL】复合查询
数据库·mysql
q***01772 小时前
【MySQL】表的基本操作
数据库·mysql·oracle
budingxiaomoli2 小时前
存储过程和触发器
数据库
q***12532 小时前
PostgreSQL_安装部署
数据库·postgresql
q***48253 小时前
mysql用户名怎么看
数据库·mysql
夏日玲子3 小时前
【Redis】Redis常用命令合集
数据库·redis·缓存
r***12383 小时前
若依微服务中配置 MySQL + DM 多数据源
android·mysql·微服务
万邦科技Lafite3 小时前
1688图片搜索商品API接口(item_search_img)使用指南
java·前端·数据库·开放api·电商开放平台
自在极意功。3 小时前
SQL查询语句深度解析:从基础到进阶,写出高效优雅的SQL!
数据库·sql