There is the Field Calculator which has a lot of functionalities. Then there is Select by Expression which has a SQL Style Syntax. However, is it possible to write plain SQL in QGIS on a Layer like a shapefile or geopackage?


1 Answer 1


No, the tool Select by Expression is not using proper SQL. It's QGIS Expression. https://docs.qgis.org/latest/en/docs/user_manual/working_with_vector/expression.html

It has its own syntax. But it works for any layer provider : ogr, geopackage, postgresql, csv as long as you have loaded the layer in QGIS.

  • I know that, that is why I am asking if there is a specific tool that uses SQL :)
    – four-eyes
    Feb 18, 2022 at 8:02
  • Well, your question is not really clear. Can you copy paste exactly your query as an example ? Virtual layer might be ok ? Layer properties -> Source -> Query builder is SQL dialect on shapefile etc, but for filtering. What is the final goal, select, extract, filter ?
    – etrimaille
    Feb 18, 2022 at 16:04

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.