Connect to your server with SSH (putty is a perfect tool for that). Once on the server you can create an SQLite database by typing this:
sqlite my_database.db
Once done you will get something that looks like that:
sqlite >
Technically your database is not yet created. If you check with your FTP client you will not see any new file. To have the database really created you need to add to it at least one table.
You can type in this command to create the “article” table:
CREATE TABLE article (id integer primary key, title varchar(10), description text);
To view the list of all the database tables you can type this command:
.tables
You should see your new created table name (article in our example).
Try to insert some data to this table by typing this:
INSERT INTO article (title, description) VALUES ('title 1', 'my description 1');
INSERT INTO article (title, description) VALUES ('title 2', 'my description 2');
Don’t forget to end each SQL statement with a “;” or else you will get an error !
You can after select all table rows by typing this command:
SELECT * FROM article;
As you can see it’s pretty simple to create an SQLite database and create and interact with its tables. The SQL syntax is mainly used so if you are familiar with MySQL you should be fine working with an SQLite database.
More information:
http://www.sqlite.org/docs.html
Recent comments