WHAT IS SQL?
Structured Query Language (SQL) is a programming language used for managing relational databases. A Relational Database is a type of database that organizes data into tables using rows and column. The table below is an example of a relational database
WHAT IS SQLITE?
This is a light weighted, self-contained, and serverless database management system. It is widely used because it is simple, fast, and requires minimal setup.
Below are some SQL commands used on SQLITE.
SQL COMMANDS AND USAGE
- INSTALL SQLITE: You can download SQLite from the link https://www.sqlite.org/download.html
After download u need to extract the files from your file manager. U will get three files extracted, as shown below.
- OPEN SQLITE after the extraction we need to open the SQLITE3 from the list of extracted file
- CREATE A TABLE: Use the command to set up a table to store your data while adding what you want your table to contain the ID number the format for this is INTEGER as it has to do with numbers every other wordings which are not figures will be represented as TEXT or string
CREATE TABLE (name of the table)
Below a table was created named (musicians) note that the ID is INTEGER because of the format will be stored in figures, while the other information are in TEXT, the net-worth format is in figures as such it is INTEGER.
In SQLite and other SQL environments, the semicolon ; tells the database system that the command is complete and ready to be executed.
- INSERT INTO Command: This is used to add new data into a table in the database. Below shows how we used the INSERT command to the table lablled MUSICIANS we created above.
- After the INSERT INTO command we the phrase VALUES. When u use the INSERT INTO command, you follow it with the VALUES keyword to provide the data for the columns
With the VALUE keyword we can add as many info into our table while using the format
- SELECT *: This tells the database to get all the data form a table. The asterisk (*) is a wildcard that means all columns in the table. Example is shown below on how it is used un the table we created in the course of this article named 'Musicians'
- .headers on- This makes our results more readable by showing the column names at the top of the data. This is very efficient to understand what column each data represent, especially when working with large tables.
- .mode csv This command is especially useful when you want to export the result into a CSV file or view the output in a CSV style. It is widely used for exchanging data between diffrent programs like Excel or google sheets.
In this article, we’ve explored the basics of SQL (Structured Query Language), the essential language for managing and manipulating data in relational databases. From creating and modifying tables to querying and organizing data, SQL provides powerful tools to interact with databases efficiently.
Whether you are managing small-scale projects or handling large datasets, understanding SQL is a valuable skill in today’s data-driven world. Its simplicity and versatility make it the go-to solution for data analysis, application development, and much more.
By mastering SQL, you’ll be equipped to work with databases in virtually any industry and unlock the potential of your data.
Remember, practice is key. So, keep experimenting with SQL commands, try creating your own databases, and soon you’ll be comfortable using SQL to manage data like a pro.
Top comments (0)