10 C
New York
Tuesday, February 27, 2024

SQLite Download and Installation

SQLite is very interesting is because it’s a self-contained database and it’s a serverless database. That means it doesn’t require any server for it’s working. So, mostly it’s used in mobile application because it’s a serverless database and you can transfer your database from one computer to another computer without any server requirement. So, now let’s download the binary and install it.

Please follow the steps below in order to download and install Sqlite database on Windows:

So just go to download and in here we will search for the windows binary, so I will go here and I will download this sqlite zip file.

So just click it, after getting downloaded it and this file looks like this.

It has only one exe file called sqlite3.exe so what I will do is I will go to my C folder and where I have made a folder called sqlite2, for example and in here I will extract my sqlite file.

The sqlite zip file only contains one exe file so I can drag and drop this into my C and sqlite folder.

Now, let’s get started with this database. So go to your start button of your windows.

And press C-M-D (cmd), press enter.

And in here write ‘cd’ because I have created my database in the C file, so write cd and ‘’ and you’ll reach to the cd…. C directory of your command prompt.

Now this is in my sqlite2 folder, so Sqlite2….. Cd sqlite2.

 Now I will create a new database. So write the name of this exe file which is sqlite3. First of all I will show you this sqlite3 is in this folder, now I will write sqlite3 and then the name of your database. So, for example, I will name my database as company.db and press Enter.

This has created a database in my folder so, now I will create a table in my company.database. So, I will write a query for creating a simple table, so I will write this code, write create table and the name of your table.

Then in the bracket, you need to pass what column you need in your table. So first column, in my table I want employee id and riches of integer data type. So, first the name of the column and *space* the data type of your column. Second, name – so after *comma* write name and this is of string data type so I write varchar and the length of my string *comma* the title of the employee, this is also a string type varchar and bracket and bracket close and don’t forget this semicolon (;) and then I press enter and it has created a table.

Now, I will check that sqlite has really created a database for me or not, so for that I write select * from the table name so my table name is employee and I will press Enter

And it’s giving me this command because I haven’t entered the semicolon here.

So, I will give the semicolon, this is important and once again it says ‘error – syntax error’.

That maybe because my file or the table is empty so I will enter some data in my table, so I will write this command ‘ insert into employee values and first column is for employee id so I will write employee id 101, the name of the employees. So, inside this single code write the names – ‘John Smith’,  the title of the employee, so for example – CEO.

And then once again I press enter and it has inserted data in my table. So now, let’s try once again, this same select star from employee and press enter and now it shows me the data. So employee id and then the name ‘John Smith’, and the title – CEO.

Now, I can enter more data inside this table, for example, insert into the table name and value 102, the name and the title once again.

And press enter. One more data and I will insert one more row of data, so insert into employee and then once again the employee id, name and title and press enter.

Now, I will do select * from employee and it should contain these 3 employees in my table, so press enter and yes it has these 3 rows of data.

So in this way you can create your first table in your sqlite database.

Related Articles

Latest Articles