Tuesday, October 21, 2008

Data Samples

SAMPLE [ BLOCK ] (sample_percent)  [ SEED (seed_value) ]
See the Select statement in the Oracle® SQL Reference for exceptions, refinements, and cautions regarding 'Block', 'Seed', etc.
SQL> Select Count(*) From Employees;

COUNT(*)
----------
107

1 Select Employee_Id, First_Name, Last_Name
2* From Employees Sample(10);

EMPLOYEE_ID FIRST_NAME LAST_NAME
----------- -------------------- --------------
109 Daniel Faviet
112 Jose Manuel Urman
118 Guy Himuro
119 Karen Colmenares
128 Steven Markle
136 Hazel Philtanker
148 Gerald Cambrault
170 Tayler Fox
Since this is just an estimate, unless you specify a 'seed,' you will get a variation of counts returned:
  1* Select Count(*) From Employees Sample(10)
SQL> /
15
SQL> /
10
SQL> /
11
SQL> /
10
SQL> /
9

No comments:

Post a Comment