Click here to monitor SSC
SQLServerCentral is supported by Redgate
 
Log in  ::  Register  ::  Not logged in
 
 
 


COUNT_BIG


COUNT_BIG

Author
Message
Avaneesh -388582
Avaneesh -388582
Old Hand
Old Hand (356 reputation)Old Hand (356 reputation)Old Hand (356 reputation)Old Hand (356 reputation)Old Hand (356 reputation)Old Hand (356 reputation)Old Hand (356 reputation)Old Hand (356 reputation)

Group: General Forum Members
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.
Paul White
Paul White
SSChampion
SSChampion (10K reputation)SSChampion (10K reputation)SSChampion (10K reputation)SSChampion (10K reputation)SSChampion (10K reputation)SSChampion (10K reputation)SSChampion (10K reputation)SSChampion (10K reputation)

Group: General Forum Members
Points: 10338 Visits: 11350
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. Laugh



Paul White
SQLPerformance.com
SQLblog.com
@SQL_Kiwi
Dhruvesh Shah
Dhruvesh Shah
SSChasing Mays
SSChasing Mays (635 reputation)SSChasing Mays (635 reputation)SSChasing Mays (635 reputation)SSChasing Mays (635 reputation)SSChasing Mays (635 reputation)SSChasing Mays (635 reputation)SSChasing Mays (635 reputation)SSChasing Mays (635 reputation)

Group: General Forum Members
Points: 635 Visits: 237
All is by default so II & III are same expressions
terrykzncs
terrykzncs
Say Hey Kid
Say Hey Kid (666 reputation)Say Hey Kid (666 reputation)Say Hey Kid (666 reputation)Say Hey Kid (666 reputation)Say Hey Kid (666 reputation)Say Hey Kid (666 reputation)Say Hey Kid (666 reputation)Say Hey Kid (666 reputation)

Group: General Forum Members
Points: 666 Visits: 134
I think this question could have been worded better and is incomplete.
shemu1990
shemu1990
Grasshopper
Grasshopper (15 reputation)Grasshopper (15 reputation)Grasshopper (15 reputation)Grasshopper (15 reputation)Grasshopper (15 reputation)Grasshopper (15 reputation)Grasshopper (15 reputation)Grasshopper (15 reputation)

Group: General Forum Members
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.

Discuss
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).
shemu1990
shemu1990
Grasshopper
Grasshopper (15 reputation)Grasshopper (15 reputation)Grasshopper (15 reputation)Grasshopper (15 reputation)Grasshopper (15 reputation)Grasshopper (15 reputation)Grasshopper (15 reputation)Grasshopper (15 reputation)

Group: General Forum Members
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.

Discuss
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).
Go


Permissions

You can't post new topics.
You can't post topic replies.
You can't post new polls.
You can't post replies to polls.
You can't edit your own topics.
You can't delete your own topics.
You can't edit other topics.
You can't delete other topics.
You can't edit your own posts.
You can't edit other posts.
You can't delete your own posts.
You can't delete other posts.
You can't post events.
You can't edit your own events.
You can't edit other events.
You can't delete your own events.
You can't delete other events.
You can't send private messages.
You can't send emails.
You can read topics.
You can't vote in polls.
You can't upload attachments.
You can download attachments.
You can't post HTML code.
You can't edit HTML code.
You can't post IFCode.
You can't post JavaScript.
You can post emoticons.
You can't post or upload images.

Select a forum

































































































































































SQLServerCentral


Search