SQL in 3 minutes

What is SQL and why should I use it?

Subaandh
3 min readOct 26, 2022

Introduction

Are you asking yourself these questions and wondering what to do about it? If you are, then this article is for you. In this text, I will try to quickly explain what is SQL, but also why you should take your time to learn it from scratch because SQL is an extremely useful tool that can help you develop your knowledge in several areas of programming.

SQL was initially developed at IBM by Donald D. Chamberlin and Raymond F. Boyce. It was initially called SEQUEL (Structured English Query Language), was designed to manipulate and retrieve data stored in IBM’s original quasirelational database management system, System R, which a group at IBM San Jose Research Laboratory had developed during the 1970s.

— Source: Wikipedia

What is SQL?

SQL stands for “Structured Query Language". It is a language that is used to communicate with databases. SQL has been the standard language for relational database management systems that let you access and manipulate databases. It can Create, Read, Update and Delete information from a database.

Photo by Rubaitul Azad on Unsplash

What is a Database and How to query it?

A relational database represents a collection of related (two-dimensional) tables. Each table is identified by a name (e.g., “Winners” ). Tables contain records (rows) with data. Each table has columns. Columns contain the column name, data type, and any other attributes for the column. The data type is an attribute that specifies the type of data that the column can hold (e.g., varchar, integer, date, etc.). In our example the columns are (year — integer, subject — varchar, and winner — varchar).

Winners — Database table Source

SQL acts as an intermediary that provides a list of commands to communicate with the database.

Basic commands of SQL

  • To read a value from the database we use SELECT

SELECT

SELECT * from winners WHERE subject = 'chemistry'
SELECT query

The select has returned only the rows that match the condition (ie subject = chemistry). It is possible to have multiple conditions inside a where.

SELECT winner
FROM winner
WHERE yr = 1960
AND subject = 'physics'
SELECT query

Other commands

  • UPDATE - updates data in a DB
  • DELETE - deletes data from a DB
  • INSERT INTO - inserts new data into a database
  • ALTER DATABASE - modifies a database
  • ALTER TABLE - modifies a table
  • DROP TABLE - deletes a table
  • JOIN - join two tables in a database

Conclusion

SQL is a wonderful tool you can use to construct queries to input into your database. It’s not too difficult to learn, and it’s truly a big help to any database enthusiast who needs data stored in a specific place in order to analyze it.

Follow me and learn SQL. Leave your thoughts in response.

--

--

Subaandh
Subaandh

Written by Subaandh

ML / Data Engineer | MSc in Data Science

Responses (1)