- 查表中数据个数
sql
select count(*) from table_name where condition
- 删除表中数据
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;