DEV Community

Emmanuel Cobham
Emmanuel Cobham

Posted on

Introduction to SQL

what is SQL

What is SQL?

The computer language known as SQL, or Structured Query Language, was created specifically for relational database administration and manipulation. It is essential for anyone working in software development, analytics, or data management since it is the common language for communicating with database systems.

The fundamentals, types and features of SQL will all be covered in this article.

SQL is a domain-specific language used to:

  • Create and define tables and databases.
  • Data in databases can be added, updated, retrieved, and deleted.
  • Control database access and permissions.
  • Keep database performance under control and optimized.

Many database management systems (DBMS), such as MySQL, PostgreSQL, Oracle Database, Microsoft SQL Server, and SQLite, use SQL.

Important SQL Features:

  • Execute CRUD (Create, Read, Update, Delete) actions to manipulate data.
  • Define database structures like tables, schemas, and indexes.
  • Data querying: Use SELECT commands to extract and obtain particular data.
  • Data Control: Use the GRANT and REVOKE commands to manage user permissions.
  • Data Transactions: Enables dependable database operations by supporting ACID (Atomicity, Consistency, Isolation, Durability) compliance.
  • Portability: Compatible with various database systems.

What is SQLite3?

SQLite3 is a high-performance, lightweight, and self-contained database engine that manages data using SQL (Structured Query Language). SQLite is serverless, which means it doesn't need a separate server process to function, in contrast to other database management systems like MySQL or PostgreSQL. Rather, it saves information on the user's device as a single, portable file.

Because of its simplicity, minimal resource needs, and ease of integration, SQLite3 is widely utilized in desktop software, mobile applications, embedded devices, and browsers.

Key Features of SQLite3:

  • Serverless Architecture: SQLite reduces system overhead and simplifies installation by operating without a dedicated server.
  • Zero Configuration: It is perfect for applications where simplicity is crucial because it doesn't require any setup or administration.
  • Lightweight: SQLite is very effective and perfect for contexts with limited resources because of its modest library size (less than 1 MB).
  • Single Database File: One cross-platform database file contains all of the configurations, tables, indexes, and data.
  • Cross-Platform: SQLite databases are compatible with a wide range of operating systems without requiring any changes.
  • Self-Contained: It is portable because it doesn't require other libraries.
  • ACID Compliance: To ensure dependable transactions, SQLite complies with the Atomicity, Consistency, Isolation, and Durability characteristics.
  • SQL Standard: It allows for familiarity in usage by supporting the majority of the SQL-92 standard.
  • Open Source: A public domain license makes SQLite publicly accessible.

Fundamental SQLIte3 Exercise

Let's begin by going over the basic SQL commands required to construct tables. We'll also look at how to change already-existing tables by adding, modifying, or deleting columns. By the end of this article, we should have a firm grasp on how to use SQLite3 to efficiently manage our database schema.

1. How to set up SQLite3:

  • Install SQLite3 by using the browser's search engine
  • Search for SQLite3 and select the "SQLite Download page" option

SQLite Download page

  • On the next page, under "Precompiled Binaries for Windows" click on "sqlite-tools-win-x64-3470200.zip" to download it

download

  • Click on the Downloaded file

sqlite3

  • Now we download a Data Set
  • Search on Google for SQLite data starter packs

SQLite data starter packs

  • Click on "American Community Survey 1-Year Data for 2015"

  • And download the SQL Lite Database

SQL Lite Database

  • Now copy the downloaded dataset and move it to the folder with your SQLIte3

SQLIte3

  • Now open Command Prompt

  • And copy the file path where the SQLite and Dataset are and paste the file path in the command prompt

copy the file path

  • cd into the file path you copied

  • Then type sqlite3

cd into the file path you copied

2. Create a Database:

To create your database use the .open command

Image description

Conclusion

SQL is a key component of contemporary data management is. From novices learning to query data to experts creating intricate systems, SQL's versatility and strength make it an essential tool. Gaining proficiency in SQL ensures its continuous relevance in the rapidly changing IT scene and opens up a world of options in data-driven professions.

Top comments (0)