title: How to calculate TF-IDF in OracleSQL?
body: <p>This is a text mining project. The purpose of this project is to see how every word weighs differently in a different document.</p>
  
  <p>Now I am having two tables, one table with TF information (WORD | WordFrequency_in_EachFile), another table with IDF (WORD | HowManyFile_have_EachWord). I am not sure what query use for this calculation. </p>
  
  <p>The math I am trying to do here is:
  <code>WordFrequency_in_EachFile*(log(N/HowManyFile_have_EachWord)+1)</code>
  N is the total number of document. 
  Below is my code:</p>
  
  <pre><code>create table TF_IDF (WORD, TF*IDF) as
  select A.frequency*((log(10,132366/B.totalcount)+1)) 
  from term_frequency A, document_frequency B
  where A.WORD=B.WORD;
  </code></pre>
  
  <p>Here 1323266 is the total number of my documents, and totalcount is how many documents a word shows.</p>
  
  <p>Since I am new to SQL, I would appreciate a little explanation to your code. Thanks a lot!</p>