Retrieve a uniform data sample from a table

2019-09-11 02:07发布

问题:

I'm trying to do some analysis on data stored in a SQL table in an external application. However, there is simply too much data to retrieve all of the relevant rows.

I'm trying to get around this by only fetching a small, uniform sample of the data.

Is there a straightforward way to accomplish this?

回答1:

You can use TABLESAMPLE, e.g.

select * from [yourtable] tablesample(10 percent)