SQL Database Basic Commands
1. Create a SQLite Database (and a Table) First, let us understand how create a SQLite database with couple of tables, populate some data, and view those records. The following example creates a database called company.db. This also creates an employee table with 3 columns (id, name and title), and a department table in the company.db database. We’ve purposefully missed the deptid column in the employee table. We’ll see how to add that later. # sqlite3 company.db sqlite> create table employee(empid integer,name varchar(20),title varchar(10)); sqlite> create table department(deptid integer,name varchar(20),location varchar(10)); sqlite> .quit Note: To exit from the SQLite commandline “sqlite>” prompt, type “.quit” as shown above. A SQLite database is nothing but a file that gets created under your current directory as shown below. # ls -l company.db -rw-r--r--. 1 root root 3072 Sep 19 11:21 company.db 2. Insert Records The following example populates both...