Linked Questions
22 questions linked to/from SQL standard to escape column names?
0 votes
2 answers
635 views
how do you insert to a column name that is similar to an SQL statement? in MySQL [duplicate]
Hi I have a column name called "condition", and I don't know if this is an SQL statement but its in color pink in my phpmyadmin sql. so how do you insert to a column that shares the same name to an ...
0 votes
1 answer
199 views
How to query columns with [] inside the names? [duplicate]
I am working with python and sqlite3 to develop a query tool for an specific database. In this database, some columns have brackets inside the name to indicate the units of the value, such as: ...
314 votes
17 answers
504k views
How to deal with SQL column names that look like SQL keywords?
One of my columns is called from. I can't change the name because I didn't make it. Am I allowed to do something like SELECT from FROM TableName or is there a special syntax to avoid the SQL Server ...
12 votes
6 answers
30k views
Select a column with a keyword name [duplicate]
I have a table named 'test' It contains a column named 'AND' For that I use the following queries insert into test values ('a','abc'); insert into test values ('b','def'); Now I want to select my '...
2 votes
2 answers
7k views
Syntax error when inserting into Access 2013 with Pyodbc
I am using Pyodbc and am trying to insert values into a Microsoft 2013 Access Database. However, everytime I run the code I get an error on the execute line: pyodbc.ProgrammingError: ('42000', '[...
2 votes
3 answers
12k views
Mysql select always returns empty set
So for some reason my Mysql table always returns an empty set mysql> show table status like 'test_table'; +-----------------+--------+---------+------------+---------+----------------+-------------...
2 votes
2 answers
2k views
Can't select column name that is a SQL keyword
For whatever reason, there is a column in the database named order. I can't select it in a query in Snowflake. The following all fail due to SQL compilation error: syntax error line 1 at position 9 ...
20 votes
1 answer
1k views
Bracket-escaped table names with dplyr
I'm programmatically fetching a bunch of datasets, many of them having silly names that begin with numbers and have special characters like minus signs in them. Because none of the datasets are ...
1 vote
2 answers
3k views
MySQL ERROR 1064 in line, but don't know what is wrong?
I've got the following line I want to execute in MySQL: CREATE TABLE 'virtual_domains' ( 'id' int(11) NOT NULL auto_increment, 'name' varchar(50) NOT NULL, PRIMARY KEY ('id')) ENGINE=...
3 votes
1 answer
321 views
Why can't I "SELECT INTO" a database whose name starts with a number?
Main.dbName = "7202" query = "select * into " + Main.dbName + ".dbo.[AccountReceivableHistory] from " + dbOrigin + ".dbo.[AccountReceivableHistory] where AccountReceivableHistory]....
-1 votes
2 answers
633 views
Print keys from dictionary as tuple without quotation marks
I have this dictionary which keys I later want to pass into a sql statement: dic = {'address': 'Emil-Dannecker-Straße 2, 78234 Engen', 'addressLink': 'https://atlas.immobilienscout24.de/...
0 votes
1 answer
1k views
How to generate insert statements of each row from csv in python?
I am creating a script where I am reading from csv file and iterating all the rows in the csv file but i need help to generate insert statements of each row and I am also output it that into a file. ...
1 vote
2 answers
117 views
Very simple SQL quest
SELECT Id, to, Subject, Body, DateCreated, DateSent FROM Emails Gives the following error: Msg 156, Level 15, State 1, Line 1 Incorrect syntax near the keyword 'to'. Any idea why? TO is ...
1 vote
5 answers
216 views
Selecting specific records to run query on
I am trying to select a small number of records in a somewhat large database and run some queries on them. I am incredibly new to programming so I am pretty well lost. What I need to do is select ...
0 votes
1 answer
245 views
How to remove duplicate results based on an aggregate field?
I have created an aggregate of fieldA and fieldB (fieldA_field_B) as new_field. How to remove duplicate rows from the results based on that field alone? Using min() it still comes up with he same ...