Introduction
In this article I will explain the step-by-step process of creating a database in iPhone.
Step 1
Open Finder from Dock by double-clicking on it.
Step 2
Go to the application and select utility and click on it.
Step 3
In utility is terminal; select it and click on it.
Step 4
Now it shows in Dock, to open it double-click on it.
Step 5
In the terminal window, to make a database, first assign it to the path where we want to make the database; for this we use these commands in terminal:
cd /Users/Sachin/Documents
mkdir Company
cd Company
Step 6
Now you will see in documents, the Company name folder is automatically generated by terminal.
Step 7
To make the database using terminal we use this command in the terminal window:
sqlite3 EmployeeDatabase.sql
Step 8
Now we will see the database file in the Company folder:
Step 9
To create a table in this database we use the followinig in terminal:
CREATE TABLE Employees ( id INTEGER PRIMARY KEY, name VARCHAR(50), address VARCHAR(50), Position VARCHAR(20), image VARCHAR(255) );
Step 10
To insert a record in the database we write in terminal:
INSERT INTO Employees (name, address, Position, image) VALUES ('Sachin', 'Jaipur', 'iPhone developer');
INSERT INTO Employees (name, address, Position, image) VALUES ('Kush', 'Delhi', 'iPhone developer');
INSERT INTO Employees (name, address, Position, image) VALUES ('Monish', 'Delhi', 'iPhone developer');
Step 11
To see the record we write in terminal:
SELECT * FROM Employees;
Step 12
To quit from the database we write in terminal:
.quit
Step 13
To clear the screen in terminal we use:
clear