SQLite in Python

SQLite in Python:

We can use the PyCharm code editor for this example. If you do not know about it then follow this link- How to install PyCharm for Python and create a program in it.

SQLite is a very popular relational database used in a wide variety of applications. Unlike other databases like MySQL, Oracle, etc., SQLite is a transactional SQL database engine that is self-contained and serverless. The entire database is a single file that can be placed anywhere in the file system. To access SQLite from Python, we need an SQLite driver for Python. Fortunately, the SQLite driver for Python is already included in Python standard library so we don’t need to install this.

Now we can create a database and table using SQLite in Python as shown below.

employee table create using python sqlite

When you run the code, the database and table are created. If you want to see whether the table is created or not, run the code two times because the second time it throws an error that the table already exists as shown above.

Note:- Follow this blog “Install DB Browser for SQLite on Windows” to see the table and fields created in it.

SQLite Database along with table created in it viewed in DB Browser as shown below.

employee table in db browser for sqlite

Right-click on employee_table you can browse the table as shown below.

browse table in db browser

Tutorial MySQL
Tutorial Python
Database Management System (DBMS)
Computer Software and Hardware
Malicious Software (Malware)
Application Software
Utility Software
Python (programming language)– Wikipedia

Comments (No)

Leave a Reply