/* select max(A.ViewCount), min(A.ViewCount) from ( sele...

0

Please login or register to vote for this query.

(click on this box to dismiss)

Stack Overflow

Q&A for professional and enthusiast programmers

--*********FIRST 50K RECORDS***********
--Max 10062790
--Min 127754

/*
select max(A.ViewCount), min(A.ViewCount)
from 
(
  select top 50000 *
  from Posts
  order by Posts.ViewCount desc
)A
*/

/*
select *
from Posts
where Posts.ViewCount >= 127754
order by Posts.ViewCount desc
*/

--Min 74785
/*
select  min(A.ViewCount) 
from 
(
  select top 50000 *
  from Posts
  where Posts.ViewCount < 127754
  order by Posts.ViewCount desc
)A
*/

/*
select *
from Posts
where Posts.ViewCount >= 74785 and Posts.ViewCount < 127754
order by Posts.ViewCount desc
*/

--Min 53347

/*
select  min(A.ViewCount) 
from 
(
  select top 50000 *
  from Posts
  where Posts.ViewCount < 74785
  order by Posts.ViewCount desc
)A
*/
--44274 
/*
select *
from Posts
where Posts.ViewCount >= 53347 and Posts.ViewCount < 74785
order by Posts.ViewCount desc
*/

--Min 41425
/*
select  min(A.ViewCount) 
from 
(
  select top 50000 *
  from Posts
  where Posts.ViewCount < 53347
  order by Posts.ViewCount desc
)A
*/

/*
select *
from Posts
where Posts.ViewCount >= 41425 and Posts.ViewCount < 53347
order by Posts.ViewCount desc
*/



/*
with cte1 as 
(
select *, row_number() over(order by ViewCount) rn
  from Posts
)

select *
from cte1
where rn = 1 and rn <= 50000
*/

select Table_name, column_name, data_type 
from information_schema.columns
where table_name = 'Posts'

Enter Parameters

Options:
Switch to meta site
loading Hold tight while we fetch your results