Solved

SQLite: What is wrong with my query?

Posted on 2013-01-03
3
438 Views
Last Modified: 2013-01-24
What is wrong with my query for SQLite?

I have attached the database and the query.
q.txt
forex.txt
0
Comment
Question by:hankknight
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
3 Comments
 
LVL 59

Expert Comment

by:Kevin Cross
ID: 38741893
I have not looked at the database, but the INSERT query appears to be using double quotes (") to identify columns as well as literal data. If your columns do not use reserved words or spaces, I would drop the quotes. Moreover, the literal values should be using single quotes (') if I am not mistaken.

P.S. the number of columns looked suspect to me, but I did not mention anything. However, I just had a chance to download the database and a simple SELECT from the trades table yields the following error.
Error: malformed database schema (trades) - too many columns on trades
Therefore, you may have multiple issues going on. In fact, this may be the main error. Single quotes are the typical delimiter for literals—at least for those of us who also use SQL Server. However, I tried the following simple test in a new database.
CREATE TABLE "trades2"(
    "OpenedTime" INTEGER,
    "Touched" INTEGER,
    "Size" REAL,
    "MarginLevel" REAL,
    "Pair" TEXT,
    "Balance" REAL
);

Open in new window

INSERT INTO "trades2" (
    "OpenedTime",
    "Touched",
    "Size",
    "MarginLevel",
    "Pair",
    "Balance"
) VALUES (
    "1357251341",
    "1357251341",
    "-0.67",
    "15660.100690485",
    "GBPCHF",
    "1000108.29"
);

Open in new window

Everything worked fine. When I try the same two queries in your database I get the error above even though I am not querying the trades table. It appears it corrupts the entire database, which makes sense as the error is regarding the schema.
0
 
LVL 16

Author Comment

by:hankknight
ID: 38742060
I don't think that the problem is because there are too many columns.

The database works, it just won't take my SQL to insert additional items.

Please test the attached database, thanks.
q2.txt
forexWorkingDB.txt
0
 
LVL 59

Accepted Solution

by:
Kevin Cross earned 500 total points
ID: 38742744
I am running Windows 7 Professional 64-bit. Whenever I download the database and try to run a simple SELECT statement I get the error I displayed above. Therefore, I am unable to offer other suggestions unless you can provide information on the error you get. What exactly is going wrong on your system?

EDIT: did you try my smaller query? Did it work? Just trying to get a baseline for what works and what doesn't.
0

Featured Post

NEW Veeam Agent for Microsoft Windows

Backup and recover physical and cloud-based servers and workstations, as well as endpoint devices that belong to remote users. Avoid downtime and data loss quickly and easily for Windows-based physical or public cloud-based workloads!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Creating and Managing Databases with phpMyAdmin in cPanel.
Using SQL Scripts we can save all the SQL queries as files that we use very frequently on our database later point of time. This is one of the feature present under SQL Workshop in Oracle Application Express.
Video by: Steve
Using examples as well as descriptions, step through each of the common simple join types, explaining differences in syntax, differences in expected outputs and showing how the queries run along with the actual outputs based upon a simple set of dem…
Polish reports in Access so they look terrific. Take yourself to another level. Equations, Back Color, Alternate Back Color. Write easy VBA Code. Tighten space to use less pages. Launch report from a menu, considering criteria only when it is filled…

733 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question