sqlite> select * from questions;
data_id data_text 开发者_如何学运维 data_image parent_id data_order data_id:1 data_text:1
---------- ---------- ---------- ---------- ---------- ---------- -----------
23 google 5 5 favorites
Hi, I'm testing query. But I want to select just the 'data_text:1' column.
I don't know how to select column.
Surround the name of the column with double-quotes:
select "data_text:1" from questions;
SQLite follows SQL-92 syntax where double quotes are used to quote identifiers (column/table names). Single quotes are used to quote literal values like strings 'I am a string!'
or X'ABCD'
(blob data).
Happy coding.
I recommend simple column names that do not require to be quoted in SQL and do not clash with reserved words as it make life easier.
Surround the name of the column with ``
`data_text:1`
Known as a 'backtick' you usually find it above TAB and left of 1 on keyboards.
Alternatively you can get it with the combination : (alt gr + 7)
Surround the name of the column with double-quotes
select "data_text:1" from questions;
@pst helps to explain it in a comment. I'm paraphrasing him here:
SQLite follows SQL-92 so a double quote (which is an identifier quote) will work
精彩评论