Thursday, January 17, 2013

Steps to create sqlite database for ios application

Most of the application in the ios requires server interaction but there can be times when you would like the application to store data locally. In such conditions you can use sqlite or core data.

I already have a post, which deals with core data, and hence in todays post we will be having a look at the CURD (Create, Update, Read, Delete) operations using sqlite database.

SQLITE is a light weighted database, which helps you to store your application related data tables in which you can store data and retrieve them with the help of SQL queries.

In this tutorial we will learn how to create the sqlite database with few tables in it and in the next session we will use that database to perform CURD operations.

There are various ways by which you could create database in your mac machine one of the most commonly method used is by using the terminal but the hurdle by using that approach is that if you miss out a command or type it wrong then you are stuck with the tons of error messages on your screen.

The method that i follow to create sqlite DB for my applications is by using the Add-on provided by firefox browser which i feel is one of the most simplest way of creating an sqlite database for your application. By following the given steps you can create sqlite database for your iOS application.

Step 1: Open Firefox browser and from the tools tab select Add-ons.


when you hit the Add-on button you will be navigated to the screen just like the one given below

Towards the right hand side of the screen you can see a search bar where you have to type the following keyword "SQlite Manager" and hit the enter keyboard button.

After doing that you will get a list of available add-ons from which you have to select the first one which says SQlite Manager the one which we are looking for, make sure you select the Available Add-ons section just like shown in the below image

Hit the install button given at the right hand side.

After installing the SQlite Manager firefox will ask you to restart the browser, hence kindly restart your browser and then after restarting it again select the tools menu and this time you will see the sqlite manager add-on added to your browser.

Step 2: Now open the firefox browser select tools and from the tools menu select the SQlite Manager add-on, now we are going to create a blank database and add tables inside that database, click on the blank page like option towards your left of the sqlite manager tool

After selecting the blank page like menu the tool will ask you to enter your database name and then it will prompt you to save the database to a particular location.

After saving the file to the desired location of your choice its time to add tables inside your database.

Step 3: After creating the database you can see several options towards the left hand side of the sqlite manager among which there is one option called as the "Tables", kindly right click it so that you can see the option to create table.

Once you do that you will get the below view 

Step 4: Now as per your business logic kindly add the column name of the table along with the data type, one habit as a developer you should have and that is to mark your first column entry as primary keys.

Give your table a valuable name and hit the ok button given at the bottom, after pressing the ok button it will ask your permission to execute the given query as per your settings that you did just now.

Step 5: Press the YES button to proceed, after you hit the press button it will add one table in your database which you may view by selecting the tables section towards your left.

Now as you can see from the above image we have successfully added the Employee table in our database. Accordingly you may add one or more table in your database.

In case if you think that you have missed out a column to add then no need of deleting the table, first select the table in which you want to add your new column and then simply select the structure tab 

scroll a little bit so that you can see the add column button

As per your business logic you can add the missed out column name and assign a datatype to it, and once you are done just hit the Add Column button and your new column will be added to your table.

I hope that this tutorial has helped you out for creating your own sqlite database and in case if you have find any point confusing then feel free to ask me via comments or via mail until then Happy iCoding and have a great day.

Move to second part of sqlite tutorial.


  1. how to acces particular created database using xcode

  2. @Amol Jadhav : If you run the application in the iOS simulator then in that case you can go to the document directory folder and see your database there,

    If you want to access the database of your app (in the development process) using xcode then you have an option in the organizer for that where you need to select your device application section and download the package content at your desktop and view it.

    The package content will contain your database, which is currently present in the device, but this process is valid only at development process and not on the release mode.

    Hope this answers your query and if not then please provide more details of your question

  3. This is very helpful webside for me
    Thank You

  4. Its an informative post on Steps to create sqlite database for ios application. We are iPhone App Developers at iPhone APP Development Company Dublin CA.

  5. I really appreciate information shared above. It’s of great help. If someone want to learn Online (Virtual) instructor lead live training in IOS development, kindly contact us
    MaxMunus Offer World Class Virtual Instructor led training on IOS development . We have industry expert trainer. We provide Training Material and Software Support. MaxMunus has successfully conducted 100000+ trainings in India, USA, UK, Australlia, Switzerland, Qatar, Saudi Arabia, Bangladesh, Bahrain and UAE etc.
    For Demo Contact us:
    Name : Arunkumar U
    Email :
    Skype id: training_maxmunus
    Contact No.-+91-9738507310
    Company Website –


  6. Thanks for posting useful information.You have provided an nice article, Thank you very much for this one. And i hope this will be useful for many people.. and i am waiting for your next post keep on updating these kinds of knowledgeable things...Really it was an awesome article...very interesting to read..
    please sharing like this information......
    Android training in chennai
    Ios training in chennai

  7. Usually I do not read post on blogs, but I would like to say that this write-up very forced me to try and do it! Your writing style has been surprised me. Great work admin.Keep update more blog.
    IOS Training in Chennai

    1. Thank you i will try to keep it as simple as i can :)

  8. This is extremely great information for these blog!! And Very good work. It is very interesting to learn from to easy understood. Thank you for giving information. Please let us know and more information get post to link.

    Weblogic Application Server training

  9. Very Helpful Post And Explained Very Clearly About All the things.Very Helpful. Coming To Our Self We Provide Food Service Parts Through Out US At Very Affordable Prices And Also We Offer Same Day Shipping In US.We Offer Only Genuine Products.

  10. This Blog is very helpful and useful,came to know that i should be strong in my basics and this blog helps me to improve it,Urgent Care Services Provided by Us.Thanks For Posting.I Am refereed by my friend to this blog and i also want to refer my other friends to this blog.

  11. Thank you for sharing beneficial information nice post Bala Guntipalli

  12. Good job in presenting the correct content with the clear explanation. The content looks real with valid information. Good Work

    DevOps is currently a popular model currently organizations all over the world moving towards to it. Your post gave a clear idea about knowing the DevOps model and its importance.

    Good to learn about DevOps at this time.

    devops training in chennai | devops training in chennai with placement | devops training in chennai omr | devops training in velachery | devops training in chennai tambaram | devops institutes in chennai | devops certification in chennai | trending technologies list 2018

  13. Thanks for the informative article About Java. This is one of the best resources I have found in quite some time. Nicely written and great info. I really cannot thank you enough for sharing.
    Java training in chennai | Java training in annanagar | Java training in omr | Java training in porur | Java training in tambaram | Java training in velachery