What is SQL?
SQL stands for Structured Query Language, and it is the backbone of data management. It's a programming language used to store and process information in relational databases. Although SQL is a stand-alone language, it is rarely used to create an application on its own.
If you don't know what a relational database is, it's just a collection of information that organizes data into rows and columns. This information is usually stored in the form of a table that looks like the picture below.
See how the tables are formed with certain pieces of information? All three tables point to each other in some way!
What is SQL mainly used for, and how do we use it?
SQL is how developers store and manage data in databases. Let's briefly go over some SQL statements that you can use.
I. CREATE
This is used when you want to CREATE a new table in your database. Just make sure that you give it a name and organize the columns depending on the type of data you are storing.
**CREATE TABLE** table_name(column1 datatype, column2 datatype, … columnN datatype);
II. SELECT
SELECT is used to retrieve data from a database. This statement specifies what information you want to fetch.
It would look something like this.
**SELECT** data, FROM table_name;
III. INSERT
You can use INSERT when you want to add a new row to a table. Make sure to specify which table you want to insert data into.
**INSERT INTO** table_name (table_name column contents) **VALUES** (the data you want to pass in)
IV. DELETE
You can use the DELETE statement whenever you want to remove data from a table. Just like INSERT, make sure you specify the data you want to remove from a specific table.
**DELETE FROM** table_name **WHERE** [condition]
Let's put that all together!
First, let's create our table.
**CREATE TABLE** Employee (EMP_ID int, NAME varchar (255), SALARY int, AGE int);
Next, let's add some data into our new table.
**INSERT INTO** Employee (EMP_ID, NAME, SALARY, AGE) **VALUES** ('1', 'Azaria', 100000, 22);
We should have something that looks like the table below.
If you want to SELECT or DELETE any data, you can just use those statements. Pretty simple and straight to the point, right? There are plenty of other statements you can use in SQL, but those are just the basics.
PostgreSQL
PostgreSQL is a more advanced database management system that supports both SQL and other programming languages. Think of PostgreSQL like an extension to SQL - it supports more features and programming languages compared to plain SQL.
Conclusion
SQL helps us easily manage and keep our databases organized. Organizations like Facebook and Microsoft use SQL to store and maintain their collected data organized. Of course, SQL isn't the only way you can organize your data - but it is one of the most widely used database system today.
Extra Resources
https://www.w3schools.com/sql/sql_intro.asp
https://www.w3schools.com/postgresql/postgresql_intro.php
https://en.wikipedia.org/wiki/SQL


Top comments (0)