SQL Query Anatomy Explained
Key Points
- All major relational databases—from enterprise systems like Oracle, IBM DB2, and Microsoft SQL Server to developer‑friendly options like MySQL, PostgreSQL, and embedded SQLite—share a common language: SQL (Structured Query Language).
- SQL was originally created in 1970 and became an ANSI standard in 1986, establishing a portable query language that works across virtually any SQL‑compliant database.
- The core of any SQL statement consists of an action keyword (e.g., SELECT, INSERT, UPDATE), a list of columns (or * for all columns), a FROM clause identifying the table, and an optional WHERE clause to filter rows.
- Because SQL abstracts data as rows and columns in tables, learning it once lets you manipulate, retrieve, and manage data in any relational database without relearning each product’s proprietary syntax.
- Mastering these basic query components provides a foundation for more advanced operations and scaling, enabling developers to become proficient SQL users quickly.
Full Transcript
# SQL Query Anatomy Explained **Source:** [https://www.youtube.com/watch?v=et1n7-UxI2M](https://www.youtube.com/watch?v=et1n7-UxI2M) **Duration:** 00:08:53 ## Summary - All major relational databases—from enterprise systems like Oracle, IBM DB2, and Microsoft SQL Server to developer‑friendly options like MySQL, PostgreSQL, and embedded SQLite—share a common language: SQL (Structured Query Language). - SQL was originally created in 1970 and became an ANSI standard in 1986, establishing a portable query language that works across virtually any SQL‑compliant database. - The core of any SQL statement consists of an action keyword (e.g., SELECT, INSERT, UPDATE), a list of columns (or * for all columns), a FROM clause identifying the table, and an optional WHERE clause to filter rows. - Because SQL abstracts data as rows and columns in tables, learning it once lets you manipulate, retrieve, and manage data in any relational database without relearning each product’s proprietary syntax. - Mastering these basic query components provides a foundation for more advanced operations and scaling, enabling developers to become proficient SQL users quickly. ## Sections - [00:00:00](https://www.youtube.com/watch?v=et1n7-UxI2M&t=0s) **SQL: The Universal Database Language** - The speaker explains that Oracle, DB2, SQL Server, MySQL, PostgreSQL, and SQLite all share SQL, outlining its 1970 invention, 1986 ANSI standardization, and its portable table‑based query structure. ## Full Transcript
all right let's go it's time for senior
expan Pop Quiz what do the Enterprise
databases like Oracle and IBM db2 and
Microsoft SQL Server developer databases
like MySQL and postgress and even
embedded databases like sqlite all have
in common well you're probably starting
to Google right now but let me just kill
the suspense here they have what's known
as
SQL in common SQL stands for structured
query language now a couple of quick
facts about this particular language
which is used to process and uh deal
with storing of database uh storing of
data inside of relational databases the
first it was
invented do a little eye there invented
in 1970 that is almost 54 years ago many
many moons before even I was even born
and then roughly around 14 years later
it was made as a
standard by the ansy organization in
1986 now the big part about that is that
it is a standard that everybody learns
as a technology here and the cool thing
about this is they made a way for all
these databases to function by being
able to store data in a table format so
you're going to have a a series of rows
and columns and that is how you store
your data now the the second part about
that is the big part about SQL is how
you compose these queries and so because
it's so portable once you learn this
language one time you can use it across
almost every relational database that
actually functions off SQL off this
standard that's there so let's break
down the anatomy of aqu query and then
I'll give you some tips on how to kind
of get started in your learning and
really become an expert overnight all
right the first is you're going to have
the actual action of what you want to do
so it's going to start out with the
insert the
update okay of whatever you want to do
and depending on what you're kind of
going from or a select if you want to
read data
out all right and then you're G to have
either a wow card which is saying give
me everything from that particular
uh column that I have that row that I
have or you can specify the actual
column names that you want so we'll just
say
C1 C2 you get the gist there next you're
going to say the from statement so you
have to tell it all right I want data I
want to do this action I want these
particular columns but where do I want
to do it on well it'll be the database
name and the actual table
that I want to do it from now the last
part of that is the where you have some
condition that occurs and that can be a
filter based upon like I'll do a a
simple one like where uh ID
equals uh one a particular number or you
can do where some other condition price
is greater than 50 uh whatever you're
doing is really about being able to
select the proper data out of your uh
particular database now so that you
could do all these queries they're very
easy to do and then you're going to have
ways where you can actually escalate
this because these databases do hold
quite a large amount of information are
very very capable and in their nature
they always scale kind of vertically
Naturally by adding more CPU uh adding
more memory adding more storage to
fulfill the needs that you need uh from
that particular um project that you're
working on but let's talk about a couple
other ways um that you can go now this
is a very simple query but it can get
very complicated and very complex that
you can read any kind of guide on SQL
online and it'll take you from this
example to where you can actually write
two of these statements and join data
together from different tables um it
just gets very exciting to to work with
but as your queries get more more more
complex you're going to want to go go
across two two different things that I
want to discuss that should be top of
mind when you want to do the first is
what we like to call a
view now R viw is a way to kind of
abstract away the complexity of your
particular query where you can kind of
Alias it or just simplify it so it's
easier to read um it's easier to execute
and it can be fine-tuned uh from there
uh to work so in this particular one if
I was doing let's say we had books and
authors books in a table we could say um
select my favorite books as the name of
the view but it actually has this
particular context underneath the actual
query all right uh so next on other
Enterprise when you start to get to that
Enterprise tier that I mentioned before
they'll have functionality called store
procedures all right so let's do the
store procedures so store procedures
we're do it called stor proc and I've
worked with this a lot especially in Ms
Microsoft cql server so it is a way of
having multiple
statements that you want to execute in a
row it can get as complex so multiple
operations that you want to do it even
has the capability to be able to pass in
certain variables and information that
you want to serialize or hyd this
particular uh role of of of um way they
should execute um you'll find other
things of doing
transactions and these are very good
because they're able to process a series
of actual queries and if something goes
wrong I want you to roll them back all
right uh to do all the data there so um
and then lastly what I love to mention
is I do want you to after you kind of
conquer a bit of these um and these are
all dependent upon the actual databases
that you're using I had my start um in
in MySQL and
postgress um and then I started to work
with a lot of Enterprise databases where
you had more of these particular
interise features that you could kind of
do and you pick your database depending
on the project that you want to do but
in today's world you're going to kind of
see this particular acronym A
Lot which is object relational mapping
so arm and there'll be a series of
Frameworks out there now you're going to
be confronted with that early in your
education on SQL but I highly recommend
that you go through the basics first
because what this is going to do is be
able to say you have you map the context
of your application whatever kind of
object that you're working with so say I
was doing that building that bookstore
database with books and authors so I can
just say books create many or create one
all right and depending on which
database I use it will actually the arm
software framework will map to the
syntax required for that particular
destination database and so it makes it
very very portable for me to go and
really offis skates away the ability of
writing queries but I do uh highly
recommend that you get into the practice
of writing queries first work your way
up work with different
databases um and then depending on your
project needs the you know arm layers do
actually make the process of getting
started with a project very very fast
because you don't have to spend time
writing all those uh but that's kind of
the way I definitely want you to learn
it's the way that I learned this and
become the expert that I am uh today so
uh in conclusion this is SQL I want you
to definitely read uh put in the
comments below your favorite database
that you like to work with and some of
your adventures around SQL I want to see
hear about some of those crazy queries
that you've written uh
before until next time technically yours
Senor espa if you like this video and
want to see more like it please like And
subscribe if you have any questions or
want to share your thoughts about this
topic please leave a comment below