BUNDLING SQLITE DATABASES WITH YOUR APPLICATION
Although programmatically creating a SQLite database and using it during runtime is very flexible, most of the time you just need to create the database file during the designing stage of your development, and bundle the database with your application so that it can be used during runtime. Therefore, rather than create the database file using code, you need to create it in Mac OS X.
Fortunately, you can easily create a SQLite database file in Mac OS X by using the sqlite3 application in Terminal. Figure 11-5 shows the command that you need to create a database named mydata.sql, containing a table named Contacts with two fields: email and name. It also inserts a row into the table and then retrieves it to verify that it is inserted properly.

FIGURE 11-5
The commands are as follows:
- sqlite3 mydata.sql
- CREATE TABLE IF NOT EXISTS Contacts (email TEXT PRIMARY KEY, name TEXT);
- INSERT INTO Contacts (email, name) VALUES (‘weimenglee@gmail.com’, ‘weimenglee’);
- SELECT * FROM Contacts;
NOTE Remember to end each command with a semicolon (;). Also, by default, when you launch Terminal, you are in your home directory. Hence, running the sqlite3 application will save your database file in your home directory.
Even though you could use the sqlite3 ...