简体   繁体   中英

How to make column names case-sensitive of Sqlite3 in Python?

I want to create a table as below:

import sqlite3 as sql
con = sql.connect('test.db')
cur = con.cursour()
sql_command = "create table test(dose float, Dose float, DOSE float)"
cur.execute(sql_command)

But i got an error: OperationalError: duplicate column name: Dose. I wonder how to make the table title case-sensitive?

Sqlite column names are case-insensitive, according to this . I think it is enforced on C level of implementation.

As a side-note, mixing column names dose , Dose , etc does not seem a great idea even if permitted, unless as an exploratory exercise.

Also this can be useful: Is SQL syntax case sensitive?

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM