SQLite Select Constant Text – Same as Column Name

sqlite

I'm trying to select const text for an insert. However the text is the same as a column name and gets interpreted as such. How do I work around this?

INSERT INTO Table1 (a, b, c)
SELECT "a", a, b 
FROM Table2

If Table2 looks like:

a, b
1, 1
2, 2

I want the inserted columns to look something like:

"a", 1, 1
"a", 2, 2

But with this SQL query, it interprets "a" as column a, which is clearly not what I want.

Best Answer

Values in SQLite should be wrapped in single-quotes, like:

INSERT INTO Table1 (a, b, c) 
SELECT 'a', a, b 
FROM Table2;

However, as @Ypercube asked in his comment, why do you want a column with the same value for every row?