Pulling a random sample is Teradata SQL is very easy-- after your code, simply put "sample 1000" if you want to sample 1000 records. Alternatively, you can put a number less than 1 to pull a percentage sample. For example, "sample .5" will give you a 50% sample of the results.
If you are using this to query a large dataset and really just need a sample to see what the data looks like, you can use the top command. Top will return to you the top records in your query-- the advantage over sample is that it is much faster; the disadvantage is that it is not random. The syntax for top is "sel top 10 * from table_x". That will quickly return the top 10 rows from that table.
Thursday, November 19, 2009
Subscribe to:
Posts (Atom)