Tuesday, April 5, 2016

sqllite3 commands in Ubuntu Shell

How to install and use Sqllite3 in Ubuntu: 

Its quite easy to install sqllite3 in Ubuntu using 'apt-get install sqlite3'

naveen@naveen-Inspiron-7352:~/mysite$ sqlite3 mydb
SQLite version 3.8.2 2013-12-06 14:53:30
Enter ".help" for instructions
Enter SQL statements terminated with a ";"
sqlite> .databases
seq  name             file                                                     
---  ---------------  ----------------------------------------------------------
0    main             /home/naveen/mysite/mydb                                 
sqlite> exit
   ...> exit()
   ...> create table employee(id integer,name TEXT );
Error: near "exit": syntax error
sqlite> create table employee(id integer,name TEXT );
sqlite> insert into employee(1,'naveen');
Error: near "1": syntax error
sqlite> insert into employee values (1,'naveen');
sqlite> ;
sqlite> select * from employee
   ...> ;
1|naveen
sqlite> .exit

No comments: