Home Page for the TeradataForum
 

Archives of the TeradataForum

Message Posted: Fri, 26 Mar 2004 @ 22:53:03 GMT


     
  <Prev Next>   <<First <Prev
Next>
Last>>
 


Subj:   Re: SAMPLE syntax
 
From:   Victor Sokovin

  closed interval is correct...  


  simple example: dbc.infotble has 2 rows...  


  select * from dbc.dbcinfotbl sample 0; works fine
select * from dbc.dbcinfotbl sample 2; works fine
 


We must have been unclear in our formulations but we have discussed something different: SAMPLE with the so called "fraction description". There are two syntax forms with SAMPLE: number of rows (like in your example) and the fraction of all rows. The latter is given as a number between 0 and 1. For example,

select *
from A
SAMPLE 0.1

gives 10% of the rows in A.

With this syntax form "closed interval" is not correct. With the "number of rows" syntax there is no such interval so ...


  so you could have your application get a count for the table and then use that number in your select/sample statement to get all the rows.  


That's right, that would be a good workaround, except that you will have to spend extra time on the count and change the syntax form. Not an issue for a quick ad hoc query but might be a problem for code generators.


Victor



     
  <Prev Next>   <<First <Prev
Next>
Last>>
 
 
 
 
 
 
 
 
 
  
  Top Home Privacy Feedback  
 
 
Copyright for the TeradataForum (TDATA-L), Manta BlueSky    
Copyright 2016 - All Rights Reserved    
Last Modified: 23 Jun 2019