I am using this as a resource to get me started – http://www.pantz.org/software/sqlite/sqlite_commands_and_general_usage.html
Currently I am working on creating an AIR program making use of the built in SQLite database. I could be considered a complete noob in making SQL queries.
table column types
I have a rather large excel file (14K rows) that I have exported to a CSV file. It has 65 columns of varying data types (mostly ints, floats and short strings, MAYBE a few bools). I have no idea about the proper form of importing so as to preserve the column structure nor do I know the best data formats to choose per db column. I could use some input on this.
table creation utils
Is there a util that can read an XLS file and based on the column headers, generate a quick query statement to ease the pain of making the query manually? I saw this post but it seems geared towards a preexisting CSV file and makes use of python (something I am also a noob at)
Thank you in advance for your time.
J
SQLite3’s column types basically boil down to:
Generally in a CSV file you will encounter strings (TEXT), decimal numbers (FLOAT), and integers (INT). If performance isn’t critical, those are pretty much the only three column types you need. (
CHAR(80)is smaller on disk thanTEXTbut for a few thousand rows it’s not so much of an issue.)As far as putting data into the columns is concerned, SQLite3 uses type coercion to convert the input data type to the column type whereever the conversion makes sense. So all you have to do is specify the correct column type, and SQLite will take care of storing it in the correct way.
For example the number
-1230.00, the string"-1230.00", and the string"-1.23e3"will all coerce to the number 1230 when stored in aFLOATcolumn.Note that if SQLite3 can’t apply a meaningful type conversion, it will just store the original data without attempting to convert it at all. SQLite3 is quite happy to insert
"Hello World!"into aFLOATcolumn. This is usually a Bad Thing.See the SQLite3 documentation on column types and conversion for gems such as: