Interview Preparation mode beta
Funny Facebook Status Funny Facebook Status
Enter your email address

What is NTILE(), in MS SQL Server?

Nice?Vote!
asked 1 year ago in SQL Server Interview Questions and Answers by R (19,530 points) edited 1 year ago by R

1 Answer

Nice?Vote!
Oh, it is simple!

NTILE() can be used to split the set into equal groups.

SELECT Ratings
                ,NTILE(2) OVER(ORDER BY Ratings) AS NTILE
    FROM  RatingsTable

Ratings NTILE
----------- --------------------
1           1
1           1
2           1
2           1
3           1
3           2
3           2
3           2
3           2
3           2
answered 1 year ago by anonymous

Related questions