I am not able to run the CREATE TABLE AS command in QGIS DB Manager (Win 10, QGIS 3.4.5-Madeira. I am getting the same error in QGIS 2.18 (Win 8).

Query execution error on CREATE TEMP VIEW _tview AS CREATE TABLE VV as SELECT 55 AS FF: 1 - near "CREATE": syntax error

enter image description here Here is the error message in a screenshot:

Actually, I see even the following does not work on my Win 10.

   ID   INT              NOT NULL,
   AGE  INT              NOT NULL,
   SALARY   DECIMAL (18, 2),       

Am I missing something in syntax, or the DB manager is missing something?

  • 4
    In which section in DB Manager are you ? Virtual Layers ? If so, DDL commands are not available. Commented Nov 27, 2019 at 8:16
  • 2
    It is a Virtual Layer. I see the problem now.
    – Stat-R
    Commented Nov 27, 2019 at 8:42
  • 1
    It would be helpful if instead of "I see the problem now," a solution were offered. I'm getting a similar error in DB manager on a non-spatial CSV. I simply need to prepend a zero on a numeric field (that was a text field in google sheets) (so I was trying to create a new text field). I'm in QGIS 3.8, and the Table Manager Plugin doesn't work. Solutions welcome. How do you know what turns into a virtual layer? And how to get a non-virtual layer from a CSV, if you need to alter the table or its contents? Commented Jul 20, 2020 at 17:58
  • @MarjorieRoswell, I have added a solution based on the above comments
    – Stat-R
    Commented Sep 24, 2022 at 7:20

1 Answer 1


I imported an sqlite database/layer into the DB Manager (See Menu Database>DB Manager). The syntax I used was the following:

create table VV as select 55 as GG

The following did not work:

create table VV as (select 55 as GG)


create table VV select 55 as GG


create table VV (select 55 as GG)
  • Is this the solution to your question? Commented Jul 14, 2023 at 8:38
  • Yes probably the first one worked. I have not checked it now
    – Stat-R
    Commented Jul 16, 2023 at 7:22

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.