sql语句优化(查询的艺术)

版权声明:本文为博主原创文章,未经博主允许不得转载。 https://blog.csdn.net/sj349781478/article/details/86478725

一、查询的艺术

保证不查询多余的列与行

SELECT  date ,count , trade
FROM   order
WHERE order_status ='SUCCESS' and trade_type='1'
 

​​​​​​​SELECT  date ,count , trade

  • 尽量避免select * 的存在,使用具体的列代替*,避免多余的列

WHERE order_status ='SUCCESS' and trade_type='1'

  • 使用where限定具体要查询的数据,避免多余的行

猜你喜欢

转载自blog.csdn.net/sj349781478/article/details/86478725