Click here to monitor SSC
SQLServerCentral is supported by Red Gate Software Ltd.
 
Log in  ::  Register  ::  Not logged in
 
 
 
        
Home       Members    Calendar    Who's On


Add to briefcase «««12345

COUNT_BIG Expand / Collapse
Author
Message
Posted Thursday, May 20, 2010 12:52 AM
Old Hand

Old HandOld HandOld HandOld HandOld HandOld HandOld HandOld Hand

Group: General Forum Members
Last Login: Saturday, November 27, 2010 11:14 PM
Points: 356, Visits: 99
Hi,

I. SELECT COUNT_BIG(*)

II. SELECT COUNT_BIG(column_2)

III. SELECT COUNT_BIG(ALL column_2)

IV. SELECT COUNT_BIG(DISTINCT column_2)

I Answered this question selecting II,III and IV (which actually is a correct answer) guess what i was indicated as INCORRECT! Pls let me know if I am so.
coz all the three (2,3,4) have same output.
Post #924850
Posted Thursday, May 20, 2010 3:09 AM


SSChampion

SSChampionSSChampionSSChampionSSChampionSSChampionSSChampionSSChampionSSChampionSSChampionSSChampion

Group: General Forum Members
Last Login: 2 days ago @ 6:35 PM
Points: 11,192, Visits: 11,094
Avaneesh -388582 (5/20/2010)
Hi,

I. SELECT COUNT_BIG(*)

II. SELECT COUNT_BIG(column_2)

III. SELECT COUNT_BIG(ALL column_2)

IV. SELECT COUNT_BIG(DISTINCT column_2)

I Answered this question selecting II,III and IV (which actually is a correct answer) guess what i was indicated as INCORRECT! Pls let me know if I am so.
coz all the three (2,3,4) have same output.

Wow! That's amazing! What code did you use to come to that conclusion? I used this:

DECLARE @QotD
TABLE (
Column_1 TINYINT NOT NULL,
Column_2 TINYINT NULL
);

INSERT @QotD VALUES (1, 1);
INSERT @QotD VALUES (2, NULL);
INSERT @QotD VALUES (3, 2);
INSERT @QotD VALUES (4, 2);
INSERT @QotD VALUES (5, NULL);
INSERT @QotD VALUES (6, 3);
INSERT @QotD VALUES (7, 4);
INSERT @QotD VALUES (8, 5);
INSERT @QotD VALUES (9, 6);
INSERT @QotD VALUES (10, 7);

--I.
SELECT COUNT_BIG(*) FROM @QotD;

--II.
SELECT COUNT_BIG(Column_2) FROM @QotD;

--III.
SELECT COUNT_BIG(ALL Column_2) FROM @QotD;

--IV.
SELECT COUNT_BIG(DISTINCT Column_2) FROM @QotD;

I Answered this question selecting II,III (which actually is a correct answer) guess what i was indicated as CORRECT! Pls let me know if I am so. coz all the two (2,3) have same output.




Paul White
SQL Server MVP
SQLblog.com
@SQL_Kiwi
Post #924926
Posted Monday, September 27, 2010 5:22 PM
SSChasing Mays

SSChasing MaysSSChasing MaysSSChasing MaysSSChasing MaysSSChasing MaysSSChasing MaysSSChasing MaysSSChasing Mays

Group: General Forum Members
Last Login: Sunday, November 17, 2013 11:53 AM
Points: 623, Visits: 237
All is by default so II & III are same expressions
Post #994119
Posted Friday, April 29, 2011 7:52 AM
SSChasing Mays

SSChasing MaysSSChasing MaysSSChasing MaysSSChasing MaysSSChasing MaysSSChasing MaysSSChasing MaysSSChasing Mays

Group: General Forum Members
Last Login: Sunday, March 4, 2012 4:02 AM
Points: 660, Visits: 134
I think this question could have been worded better and is incomplete.
Post #1100880
Posted Thursday, August 30, 2012 1:24 AM
Grasshopper

GrasshopperGrasshopperGrasshopperGrasshopperGrasshopperGrasshopperGrasshopperGrasshopper

Group: General Forum Members
Last Login: Friday, June 14, 2013 7:31 AM
Points: 15, Visits: 14
explination given here is not fully correct-->"SELECT COUNT_BIG(ALL COlumn_2) and SELECT COUNT_BIG(column_2). COUNT_BIG(all column_2) will count all rows from the table (including duplicate & null rows). COUNT_BIG(DISTINCT column_2) will evaluate distinct non-null values.


because --->
"COUNT_BIG(all column_2) will count all rows from the table including duplicate & Excluding null rows).

and
COUNT_BIG(*) will count all rows from the table (including duplicate & null rows).
Post #1352036
Posted Thursday, August 30, 2012 1:29 AM
Grasshopper

GrasshopperGrasshopperGrasshopperGrasshopperGrasshopperGrasshopperGrasshopperGrasshopper

Group: General Forum Members
Last Login: Friday, June 14, 2013 7:31 AM
Points: 15, Visits: 14
explanation given here is not fully correct-->"SELECT COUNT_BIG(ALL COlumn_2) and SELECT COUNT_BIG(column_2). COUNT_BIG(all column_2) will count all rows from the table (including duplicate & null rows). COUNT_BIG(DISTINCT column_2) will evaluate distinct non-null values.


because --->
"COUNT_BIG(all column_2) will count all rows from the table including duplicate & Excluding null rows).

and
COUNT_BIG(*) will count all rows from the table (including duplicate & null rows).
Post #1352038
« Prev Topic | Next Topic »

Add to briefcase «««12345

Permissions Expand / Collapse