Download as docx, pdf, or txt
Download as docx, pdf, or txt
You are on page 1of 3

So now let's understand about SQL.

That's the reason why we wanted this part of the


content talks about SQL. Before we go and understand why we need SQL, let's understand
what is SQL, right? So SQL stands for structured query language. Structured query language,
right? So SQL has its beginnings from 1970s, and it was created at IBM by a bunch of
researchers who are working, who are earliest researchers on relational databases. So the
whole area of relational databases took off. There were a bunch of phenomenal
mathematicians and researchers called Boy and card who came up with some of these core
ideas of relational databases. And all this great research was being done at IBM research in
the 1970s. So SQL came from that research as a standard way. And today, SQL is super
powerful, right? But when it started, it started as a research project. And SQL, in a nutshell,
if you want to think of SQL in a nutshell, right? SQL is basically a standard way. It's basically
an industry standard way. It's a standard way to query the data or to obtain the data or to
add to the data or delete or modify the data. So any of these operations, imagine you have a
database. Imagine you have a database in which you have lots of tables. Let's say t one, T
two, t three, t four tables. Any data that you have in each of these tables. Anything that you
have in each of these tables. Any data that you have in these tables, right. If you want to
query this data, right? We saw this query, right? Suppose in the movies data set that we saw.
If I want a list of all the movies, if I want a list of all the movies which were released after
2000, okay, this is a very sensible thing. I'm only concerned about movies post 2000
because those are the movies that I really like, right? Makes a lot of sense. Or if I want
movies by a specific director, let's say Steven Spielberg, right? Or by a specific actor where a
specific actor acted in. All of this is about querying the data that you have in your tables or
obtaining the data, right? You might want to add more data. If a new movie is released, you
want to add that information to the database. Or you might want to delete some
misinformation or incorrect information. Or you might want to modify some information.
Suppose, for example, you missed out adding an actor in a movie earlier. You want to
modify and add that information or modify that information, right? So SQL is a standard
way, it's an industry wide standard way to query, obtain, add, delete, and modify data, right?
And remember, SQL is so popular today, I have seen SQL being used by a wide spectrum of
people, by data scientists, obviously, because data scientists have to obtain data, right? Data
scientists have to obtain data on a day to day basis to perform machine learning or data
science operations. On top of it. Data scientists, machine learning engineers, software
engineers. Imagine if I'm building a movie app where I'll recommend you some movies that
you might like. Obviously, I have to know SQL because all this data is stored in a database
and I can obtain this data only using a database or if I want to build a ticketing system. If I
want to build a ticketing system, be it be train tickets, flight tickets, movie tickets, whatever.
Databases are so core to it. This very website that you are watching this, watching this
content on has an SQL database at the backend to store which video should come after
which video. What are the comments for each of the videos? Who is the creator of each of
the videos? Where is this video hosted? Who are all the registered customers who should
have access to these videos? All this information, all this information is stored in a database,
which requires and most databases today, be it be relational or non relational, typically
have an SQL interface to query, obtain, add, delete data, right? So I have also seen, very
interestingly, I have seen people in my own work experience at Amazon. I have seen people
from the marketing department, from the sales teams, and these are non engineers. Trust
me, right? From business development, from business development teams. I've seen lot of
these people also learn SQL because at the end of the day, if they don't have data, they can't
perform their duties and all of the data is stored in a database. When the data is stored in a
database, their only way to obtain the data and make data driven decisions is by learning
SQL. I have seen non engineers at Amazon from all these walks of life using SQL extensively.
That's how powerful and easy SQL is. SQL is so easy that a non engineer can easily learn if
he or she spends a weekend on it. That's how simple SQL is. And SQL is so powerful that
some of the best software engineers, some of the best data scientists use SQL on a day to
day basis to get their work done. Extremely complex work can be done using SQL and it is
so widespread. Trust me. I've seen like, if you don't know SQL, you can't survive at many
companies. Trust me. Because especially if your company is a data driven company where
all decisions will be made using past data, then you better know SQL. That's how simple
things boil down to, right? Okay, so at the same time, SQL is also. This is an important thing,
SQL is not a general purpose programming language. It is not a general purpose. It is not a
general purpose programming language. General purpose programming language. You take
your C, C plus plus, Java, Python, all these programming languages are general purpose. You
can do lots of things with C. You can design an operating system with C. You can build a
database in C. The very early databases were actually built in C, right? You can build a web
server in C or Java or Python. Their general purpose, you can do lots of things with them.
But SQL is called a domain specific. SQL is called a domain specific language. Because SQL is
only used in the domain of databases. SQL is not used to build an operating system. SQL
cannot be used to build a web server. SQL cannot be used to build a game, while all these
programming languages can be used to build all of them. SQL is a domain specific language
whose primary and only task is to efficiently add, modify, delete and query data in a
database. That's what its task is, right? And there is also a very important property of SQL.
Most of the programming languages that we learn are called procedural programming
languages, right? Procedural programming languages. What it means is suppose you have,
let's assume you have a text file, right? Let's assume you have a text file. Let's assume the
movie data, movie id, movie name, movie year, and some movie genre. Let's say suppose
you want to obtain in a standard procedural language like C or C plus plus or Python or Java,
right? What do you do? If you want to answer this question that I want the list of movies.
Suppose I want the list of movies which were released where the year is greater than 2000.
Suppose this is what you want to obtain. This is your task. What do you do? You load all of
this and in a step by step. So you explain step by step. You explain step by step using control
flow statements like if else or for loops or while loop. You use all of these tools in every
language in C, C plus plus, python, Java, you have if else conditions for loops, while loops, all
of them exist. You explain step by step, you give step by step instructions. So you give step
by step instructions on how to solve this problem. Those languages are called procedural
programming languages where you give step by step instructions on how to solve a task.
SQL, on the other hand, is called a declarative programming language, is called a declarative
programming language wherein you do not wherein you do not specify step by step what to
do. You do not say what the step by step process. The step by step process in C, C plus plus
java is okay, load this file go row after row, which you can write using a for loop or a while
loop. And for every row, check if the year is greater than equal to 2000. If so, print it. That's
a step by step process that you would do in C, C plus, plus Python or Java. In an in SQL,
which is a declarative programming language, you don't say step by step. I'll write a simple
SQL query here. You can say select okay, select movie name. I'll explain you what this means
later. From movies where year is greater than 2000, this is how an SQL statement looks like.
Here you are saying that I want the movie names. From the movies table where the year is
greater than 2000, you are declaring it's called declarative because you're declaring what
you want. You're declaring what you want, not how to get it. You're not telling how to get it.
That's what a procedural programming language does. It gives you step by step instructions
on how to solve your task or how to get this information. In a declarative programming
language, you say what you want, how to get it is someone else's problem. Okay, we'll see
whose problem it is in a while. But in a procedural programming language like C cetera, you
also explain how to get this information in a declarative. In an SQL like language, you say
what you want. Again, I'll explain this syntax later, don't worry about it. I just wanted to give
you an example. There are no for loops here. There are no if else conditions here. You just
say I want all the movie names from the movies table where the year is greater than 2000.
You just said what you want, not how to get it. That's the difference between a procedural
programming language and a declarative programming language. So SQL is a declarative
programming language where we do not give step by step instructions, where we say what
we want and we expect SQL to give us because SQL is declarative. That's why it has become
extremely easy and popular because non programmers from marketing, sales, business
development need not know about for loops or if else conditions or any programming or file
handling. They can just say this is what I want, get it for me. And SQL does that for you.
Right? So the core properties of SQL is, it is super simple. It is super simple and easy to use.
That's why it's so and it's super powerful. This is also important. Just because it is
declarative and it is easy doesn't mean it's not powerful. It is so powerful that it is one of the
most used tools by software engineers, machine learning engineers, data scientists, while it
is also a very popular and most used tools by marketing, sales, and business development.
That's the power of SQL. I mean, I can't emphasize this enough. It is one of the most
important toolkits for the 21st century in terms of. Because as data increases, right. Every
company will eventually become a data driven company. So whatever role you do, you need
to have some knowledge of SQL. Whether you're a marketing guy, sales guy, business
development guy, manager, everybody, because your data is, at the end of the day, stored in
an SQL database. Knowledge of SQL will help you achieve things that you cannot do without
the knowledge of it. And you can do it very easily, and it's super powerful that it's very, very
important. So SQL is a declarative programming language where we don't have to define
step by step what we want or how to get it. We just have to say what we want. And it's a
domain specific programming language.

You might also like