How to Create Database Using Terminal in iPhone
This article provides a walkthrough of creating a database using a terminal window for iPhone or iPad application.
In this article I will explain the step-by-step process of creating a database in iPhone.
Open Finder from Dock by double-clicking on it.
Go to the application and select utility and click on it.
In utility is terminal; select it and click on it.
Now it shows in Dock, to open it double-click on it.
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:
Now you will see in documents, the Company name folder is automatically generated by terminal.
To make the database using terminal we use this command in the terminal window:
Now we will see the database file in the Company folder:
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) );
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');
To see the record we write in terminal:
SELECT * FROM Employees;
To quit from the database we write in terminal:
To clear the screen in terminal we use: