select * from tabela where 'data de pesquisa' BETWEEN dt_inicial AND dt_final
The * in select means return all fields in the table, and provided that dt_initial and dt_final are of the correct date type.
If you only want the
select num from tabela where 'data de pesquisa' BETWEEN dt_inicial AND dt_final
Complement to the answer
Based on the comment you made to the @Edgar-Muniz-Berlinck response, if you pass dt_initial and dt_final as parameters then your table must be with the wrong modeling.
Considering that the correct table would contain a column of name dt_occurrence, and receiving dt_initial and dt_final as query parameters, your sql would be:
select num from tabela where dt_ocorrencia BETWEEN dt_inicial and dt_final
His business rule can specify that he needs to know the time elapsed in the event, or when he started or when he finished. cannot say that the modeling is incorrect without understanding it completely. -1
– Marciano.Andrade
OK, then I should say that the question is misspelled because if the business rule is this one you quoted, it should be described in the question so that we can more easily assist. Maybe I was wrong to use the term, and I should have said, you must have been wrong in your modeling.
– Ademir Mazer Jr - Nuno