[EMAIL PROTECTED] wrote:
Bijan Farhoudi <[EMAIL PROTECTED]> writes:

I am trying to create table and I would like to name one of the columns
order, but pysqlite does not like it. I do not want to have order__ or any
thing like that.  for example the following command does not work:
cur.execute('create table foo(i integer, order integer)')

You're working on dangerous ground when you use reserved words as your column
names.  'order' is a reserved word, as it is used for the ORDER BY clause.

You can do it, though, like this:

  create table foo(i integer, [order] integer)

Placing column names in square brackets lets you use reserved words as column
names.

Derrell

Thanks for your answer but still I am getting an error message:
sqlite> create table foo(i integer, [order] integer);
sqlite> .sch
CREATE TABLE foo(i integer, [order] integer);
sqlite> insert into foo values(1,2);
sqlite> select order from foo
  ...> ;
SQL error: near "order": syntax error

Any other idea?

Cheers,
   Bijan

Reply via email to