If you have once asked a book from a librarian, then you know the concept of querying. Asking a librarian to show you a book is pretty much similar to the concept of SQL and database.
Think of the library as database, and you asking the librarian is SQL querying.
Firstly, you must know what book you want to look for. When you know the book (data) that you are looking for, you are going to ask the librarian. The librarian then checks the availability of the book inside the library (query). If it is available, he will point you to its location (results).
The process of accessing a database is very similar to that scenario. Now that you have got the gist of data query, let us now learn the most vital part of it – SQL.
1. What is SQL and how does it work?
SQL stands for Structured Query Language. It is a programming language designed specifically to perform commands such as create, store, manipulate, update, and retrieve information from a database using a database management system (DBMS). However, SQL can only be used to access a certain kind of DBMS. It is called Relational Database Management System or RDBMS.
SQL is appointed as the standard language for RDBMSs by the American National Standard Institute.
2. What is SQL used for?
The main purpose of SQL is to communicate to an RDBMS. The most common RDBMSs as of today are Oracle DB, Microsoft SQL Server, MySQL, and PostgreSQL.
Data are now a commodity in the modern business industry. They are used to conduct highly targeted marketing campaigns, financial and strategic decisions, and more business-related decisions that will be beneficial to a company. Furthermore, when significant amounts of data are involved, companies use databases hold everything together.
However, databases (relational databases) cannot understand the language we speak. They have their own language that is called SQL. Therefore, SQL is used to access these databases to make sense of the data encapsulated within them.
3. Basic SQL Commands
Learning how to use SQL takes time – especially if you do not have any programming background. However, for you to get the hang of it, here are some basic SQL Commands and their uses:
It has three subsets of commands:
a. DDL (Data Definition Language) – primarily used by developers to create database objects (tables). It primarily uses the create, alter, and drop commands.
create – Creates a new object within the database.
alter – Implements changes to an existing database object.
drop – Deletes objects from the database.
b. DML (Data Manipulation Language) – used by data analysts to perform data query (look up data within the database). It primarily uses the select, insert, update, and delete commands.
select – Retrieves specific information from the database tables.
insert – Creates a new record.
update – Modifies existing records.
delete – Removes records from the table.
c. DCL (Data Control Language) – used by DBAs or Database Administrators to grant or revoke access to the database. It primarily uses grant and revoke commands.
grant – Grants privilege or limited access to a user.
revoke – Revokes previously granted access or privileges to user.
These commands are used to perform Queries within Tables. Data are organized in Tables; hence, tables are the heart of a database. There are four (4) objects in a database – Forms, Tables, Queries, Reports. The most important object is the Table. Without it, the other 3 objects will have no purpose at all.
4. Is SQL important to learn / Should I learn SQL?
Most companies today have online presence, and they store their information in databases. Although there are several types of relational databases (as mentioned above), all of them uses SQL, albeit with very minute difference from one another. But the principles are all the same.
Therefore, learning SQL is a must if you want to work as a data analyst, data scientist, or any data-related job. Having the knowledge to pull out data from a database means that you can do your job the way it should be done.
Now that you have learned the very basics of SQL, it is now time to get to know where they are used – Relational Database Management Systems.