Given following schema:
document(id, path);
term(id, description);
term_document(id_term,id_document,frequency);
Given a document path
and term description
, if I don't have a record of the term
and the document
in the table term_documento
I want to insert into the table term_document
with frequency = 1, otherwise, I want to just increment the frequency
value.
What I came up so far is this:
insert into term_document(id_term, id_document, frequency)
select term.id, document.id, 1
from term, document where term.description='to' and document.path='/home/rogger/Projetos/projeto-ori-ufu/src/main/resources/d1.txt'
which satisties the case I dont have a record in term_document, but I don't know how to increment to satisfy both.