SQL count(1)

  • If you are ever unsure what to put inside a COUNT() aggregation, you can do COUNT(1) to count the rows in each group. Most people find it especially readable, because we know it's not focusing on other columns. It also scans less data than if supplied column names (making it faster and using less of your data access quota).
  • 如果不知道判定什么,可以用 COUNT(1) 来count each group
-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- focus on what you want to be
原文地址:https://www.cnblogs.com/bamboozone/p/10645288.html