Menu

creating SQLite3 database using mac Terminal.

How to create SQLite3 database using mac Terminal.


  • 1. Using spotlight(press the cmd+space) search the terminal, Terminal its a default editor available in mac. or in the Menu go on Application -> Terminal.
  • 2.First select the location where you want save your database file. i choose desktop. then type the command CD Desktop (semicolon ; not require).
  • 3. type the command “SQlite3 database_name.sqlite” and press enter. for your understanding purpose i create database name as MyCircle.
    ex – SQLite3 MyCircle.sql
    *note: you can give extension of your database file as .sql,.sqlite,.db
  • 4. after creating the database for using .databases command you can show the list of databases.
    ex – .databases;
  • 5. after if u create successful database then required to go for create the table for storing and manage the data.
    ex. create table Table_Name(field_name1, type, field_name2 type,fild_n type_n); (After writing query must and should semicolon ; required otherwise execution time you get output like…>)
    ex. create table Friends(ID integer primary key autoincrement, Name varchar(60), Age int);
    *note :- this Friends table belong to MyCircle database.
  • 6.After without any error creating table you need for feel the some data in that table then go for insert statement.
    ex. insert into table_name values(value1,value2,value_n);
    *note :- fill the value as per datatype. if datatype is varchar then require data in single qoute ‘ ‘ where as integer type no required.
    ex. insert into Friends values(1,’Nitin’,21);
    explanation:- ID is 1, Name type as a varchar then require ‘Nitin’.


For More Information Please Visit


No comments:

Post a Comment

Related Posts Plugin for WordPress, Blogger...