INSERT IF NOT EXISTS ELSE UPDATE?

Have a look at http://sqlite.org/lang_conflict.html. You want something like: insert or replace into Book (ID, Name, TypeID, Level, Seen) values ((select ID from Book where Name = “SearchName”), “SearchName”, …); Note that any field not in the insert list will be set to NULL if the row already exists in the table. This is why … Read more

Java and SQLite [closed]

I found your question while searching for information with SQLite and Java. Just thought I’d add my answer which I also posted on my blog. I have been coding in Java for a while now. I have also known about SQLite but never used it… Well I have used it through other applications but never … Read more

How to set Sqlite3 to be case insensitive when string comparing?

You can use COLLATE NOCASE in your SELECT query: SELECT * FROM … WHERE name=”someone” COLLATE NOCASE Additionaly, in SQLite, you can indicate that a column should be case insensitive when you create the table by specifying collate nocase in the column definition (the other options are binary (the default) and rtrim; see here). You … Read more

What are the performance characteristics of sqlite with very large database files? [closed]

So I did some tests with sqlite for very large files, and came to some conclusions (at least for my specific application). The tests involve a single sqlite file with either a single table, or multiple tables. Each table had about 8 columns, almost all integers, and 4 indices. The idea was to insert enough … Read more

How do I add a new column in between two columns?

You have two options. First, you could simply add a new column with the following: ALTER TABLE {tableName} ADD COLUMN COLNew {type}; Second, and more complicatedly, but would actually put the column where you want it, would be to create the new table with the missing column and a temporary new name: CREATE TABLE {tempNewTableName} … Read more

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)