declare @boloney table (column_1 int, column_2 int);insert into @boloneyselect 1, 1unionselect 2, nullunionselect 3, 2unionselect 4, 2unionselect 5, 3unionselect null, null;select count_big(*) option_1, count_big(column_2) option_2, count_big(all column_2) option_3, count_big(distinct column_2) option_4 from @boloney;go

opt_1 opt_2 opt_3 opt_4----- ----- ----- ----- 6 4 4 3

with cte (RecordNumber, a, b) as( select row_number() over (order by a) RecordNumber, * from t2) delete from cte where RecordNumber = 3;

insert into t2 values (2,1);insert into t2 values (2,1);insert into t2 values (3,1);

with cte (PartitionedNumber, a, b) as( select row_number() over (partition by a order by a) PartitionedNumber, * from t2) delete from cte where PartitionedNumber > 1;