Home » SQL & PL/SQL » SQL & PL/SQL » Sql 10% data only.. (oracle 9i)
Sql 10% data only.. [message #329643] Thu, 26 June 2008 02:28 Go to next message
tannad
Messages: 43
Registered: January 2008
Location: mumbai
Member
I have one table with 6 millons of data
But for checking I want the data suppose only 10% of the records.
supose I run this query
select * from VA_FINAL_2JUNE
where DATA_SOURCE in('PO','1358_Misc_Obligation','Pcard','NPPD','High_Tech_Medical_equipment')
and TOTALCOST >100000

I will get all the records.. But I want only 10 or 12 % of the data
what change I will do in the query?
Re: Sql 10% data only.. [message #329649 is a reply to message #329643] Thu, 26 June 2008 02:35 Go to previous messageGo to next message
Michel Cadot
Messages: 68737
Registered: March 2007
Location: Saint-Maur, France, https...
Senior Member
Account Moderator
Maybe "from VA_FINAL_2JUNE sample (10)"

Regards
Michel

Re: Sql 10% data only.. [message #329693 is a reply to message #329643] Thu, 26 June 2008 04:47 Go to previous messageGo to next message
JRowbottom
Messages: 5933
Registered: June 2006
Location: Sunny North Yorkshire, ho...
Senior Member
Do you care which 10%?
Re: Sql 10% data only.. [message #329789 is a reply to message #329643] Thu, 26 June 2008 09:40 Go to previous messageGo to next message
durgadas.menon
Messages: 365
Registered: December 2007
Location: Nowhere
Senior Member
As already mentioned

Quote:
'do you know which 10%'



if it is random then row_number() might help
Re: Sql 10% data only.. [message #329808 is a reply to message #329789] Thu, 26 June 2008 10:50 Go to previous messageGo to next message
Michel Cadot
Messages: 68737
Registered: March 2007
Location: Saint-Maur, France, https...
Senior Member
Account Moderator
durgadas.menon wrote on Thu, 26 June 2008 16:40
As already mentioned

Quote:
'do you know which 10%'



if it is random then row_number() might help

row_number implies order, do you call this random?
What about my sample clause? It is already a random set, why searching for something more complex?

Regards
Michel

Re: Sql 10% data only.. [message #329921 is a reply to message #329808] Fri, 27 June 2008 01:26 Go to previous messageGo to next message
durgadas.menon
Messages: 365
Registered: December 2007
Location: Nowhere
Senior Member
Correct me if I am wrong but the sample clause does not seem to give consistent answers. Attached is the spool file.

I am missing something in this

  • Attachment: sample.txt
    (Size: 6.55KB, Downloaded 581 times)
Re: Sql 10% data only.. [message #329931 is a reply to message #329921] Fri, 27 June 2008 01:44 Go to previous message
Michel Cadot
Messages: 68737
Registered: March 2007
Location: Saint-Maur, France, https...
Senior Member
Account Moderator
It is the expected behaviour but do it with million rows table and not just 12 rows one.

Regards
Michel
Previous Topic: How to convert row into columns
Next Topic: insert from remote server to client table
Goto Forum:
  


Current Time: Sat Feb 15 07:42:55 CST 2025