In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-01-28 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Database >
Share
Shulou(Shulou.com)05/31 Report--
This article shows you the details of the SQL sentence Count, which is concise and easy to understand, which will definitely brighten your eyes. I hope you can get something through the detailed introduction of this article.
The count statement supports *, column names, constants, variables, and can be modified with the distinct keyword, and count (column names) does not accumulate null records. Here are some random examples to demonstrate the rules of count:
For example, to do statistics on the following table, all the columns are represented by the sql_variant type.
The code is as follows:
If (object_id ('sql_variant') > 0) drop table t_test go create table t_test (a sql_variant, b sql_variant, c sql_variant) insert into t_test select 1, 1,'a 'insert into t_test select 1, getdate (), null insert into t_test select 'a', null, 1 insert into t_test select 3, null, null insert into t_test select null, null, null go select * from t_test go select count (*)-Total
Count (nullif (1,1))-always returns 0
Count (a)-a quantity
Count (b)-- b quantity
Count (distinct a)-a does not repeat the quantity
Count (isnull (b, c))-b or c is not the number of null
Count (Coalesce (a, b, c))-an or b or c is not the number of null
Count (nullif (a, b))-an is not equal to the number of b
Count (nullif (isnumeric (cast (an as varchar (38)), 0))-an is the number of numbers from t_test
What are the details of the SQL statement Count? have you learned any knowledge or skills? If you want to learn more skills or enrich your knowledge reserve, you are welcome to follow the industry information channel.
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.