Transcripts
1. Course Overview: Welcome to their engineer
365, my name is Benjamin. In this SQL course,
you will learn the SQL programming language, the SQL basics and fundamentals
in a practical manner. We will start with a
brief introduction to the SQL programming language, and thereafter we'll get an
overview of databases and the relational database
management system, also called RDBMS. Next, we will install Microsoft SQL Server
in Docker container to start learning this
installation section will provide you with a brief
introduction to Docker. Docker is an open-source
platform for developing, shipping and running
applications. It provides an isolated
environment to run applications afterwards using a healthcare
system use case, it will create a
database, create tables, and finally insert some
data into those tables. Once we've done some
basic installation, will then dive into the
heart of this course, will then perform
basic operations on the data to learn
the SQL Fundamentals, SQL syntax and SQL DML
operations used to access, modify, or retrieve the
data from the database. At the end of this course, you'll be able to perform
C-Corporations to retrieve, update, and insert
data in a database. This course will provide
first-hand knowledge for new data engineers and
software developers, will learn first-hand using examples in a
real-world database. This is an exciting course
and I can't wait for you to get started and learn SQL
basics from the ground up, please refer to
the timestamps in the video description to skip ahead to other sections
of the course, follow along and learn
SQL basics in one hour. If you have any
feedback loops or comments in the common section, I'd love to hear from you. All right, let's get started learning SQL in a
practical manner.
2. Why Should I learn SQL: Now that we're here,
the question you may be asking yourself is, why should I learn SQL? This course is fit for
those interested in learning SQL from the ground up, from students begin
a data engineers and other IT professionals
interested in learning about data and data engineering. Sql is in high demand for data analysis and
data engineering. Data engineers and
software engineers are required to know SQL. With a growth of
cloud computing and generation of petabytes
of data every single day. Sql is a de facto programming
language to access and manipulate data
stored on the cloud. According to Glassdoor.com,
the average base pay of a data engineer
is $102 thousand. Therefore, it's imperative
for you to learn SQL.
3. Why Should You Listen To Me: Why should you listen to me? I'm a Master Data
Management Engineer and healthcare IT subject matter
expert and have worked for Fortune 500 companies such
as g and paradigm for the last ten years to design and build data products
utilizing ETL, HL7, an EMP systems, disparate RDBMS
and OS platforms. I've worked with terabytes of
healthcare data running in clustered environment
in Amazon Web Services, and Microsoft Asia
to enable secure, reliable, and
connected healthcare. I've worked with complex
datasets requiring building reliable patient
matching applications for statewide data exchanges. These large applications
require an understanding of all data characteristics
and aspects to work and process the
large datasets via ETL, the data needs to be analyzed for consistency and accuracy. And the SQL programming
language is a go-to language to
understand this data. Rest assured, you're
imperfect hands.
4. Database Overview: Let's talk about the database. What is a database? Applications such as
Facebook, Google, Netflix store data about users and products in
relational databases. Relational database is
made up of collection of objects or relations
that stored the data. Therefore, a collection of related objects are stored
in a database table. I'll give you one example. When you sign on to Facebook, all sign-in information
or login information is stored in either a login
table or a person table. These could be things
such as your username, password, date of login, timed login, and
location of login. Database is made up of a collection of
two-dimensional tables. Therefore, database can have
from one to many tables. It can have 12345 or more
tables within the database. The table is a basic
storage structure of a relational database
management system or RDBMS. We'll cover more of RDBMS later. Each table is composed
of rows and columns, and data in these rows is accessed and
manipulated via SQL. Let's take a look
at this example. On the right-hand side
you have this image which represents
a patient table. Take about five seconds to really look at the
patient table. The rows in this
patient table represent a single transaction
record or data entry. For instance, we have five
rows in this patient table. Each row represents
a distinct object or a distinct person. Look at row number one. You have FirstName, LastName
as gender, and a date. By the way, all this
data is fake data. It's not real. The rows are
column values in a table. Therefore, in this table, you have various columns. You have a medical
record number. Column one on the
left-hand side, followed by the
first name column, LastName as SN, gender, BOB, or date of birth. All these columns make
up the row values. Tables are connected to each
other using relationships. That is why this is called
a relational database. The columns in this case represent the properties
of that data. Therefore, think about
this table right here. We have the patient table. What are some of
their properties you see about this data? You see names, you see
social Scruton numbers, you see gender, you see dates. You can also have other
information such as address information or
driver's license information. All follow within
this patient table. Just to make it very basic
for this representation. Therefore, the column values as you see them
here, first name, last name, ssn, represent
the rows in a table. Field is intersection
between a row and a column. May or may not contain data, which means it will
be null or empty. For instance, you can have an incidence way if
you have a middle name, if the person hasn't
provided a middle name, that intersection, that
field will be empty. If we look at row number 1, first name is Alyssa, last name is sentence. If the record, if the person didn't
provide your last name, that field will be empty. This case we're looking
at a patient table. And the person table is a
part of a larger database. For instance, if it's
a health care system, you could have a patient
table, medication, stable insurance, stable medical mitigate table
and so on and so forth. Now let's jump ahead
and take a look at relational database
management system or RDBMS.
5. Healthcare System Database Use Case: Healthcare system
database use case. Let's take a look at
a practical example of a hospital system. When a patient arrives at
the medical facility for medical treatment or for an appointment or nurse
or the help desk. Personnel typically
checks them in. This check-in involves
the patient providing the demographic or
insurance information. This check-in involves
efficient search in the patient registration system or a patient lookup
in the same system. If a patient is found, record is returned, which means the record exists
in the database. If a record is not found, it means we need to add a
new record to the database. These two types of transactions, one the patient search and
to the patient registration, both happen in the patient
registered system. The healthcare
system database in this scenario can hold
different types of information. One, the patient table, which is one table among
many tables in this system, holds the patient demographics, which is the first
name, middle name, last name, suffix, date of
birth, gender, or address. Secondly, council hold
insurance information, which is insurance number
or insurance group. It can also hold
in this scenario. Remember for this
course, medications, which means prescriptions upon the patient seeing a doctor. Therefore, this patient
information can hold a number of datasets
within this hospital system. These three tables and this scenario will form
the basis of this course.
6. RDBMS Overview: Relational database
management system or RDBMS. What is RDBMS? Rdbms is an acronym
that stands for relational database
management system. Rdbms, software that manages
relational databases. Therefore, it's called
relational database management system or RDBMS. Software manages a
SQL code execution between the databases and the computer system application. There are different
types of vendors that provide RDBMS software. And each flavor of RDBMS
is slightly different, but it's implementation
is largely the same. Let's take a look
at some examples of common RDBMS software. These are a few examples. There are tens of others that you can find
online as well, but I'll focus on these
ones are mentioned here. Oracle tangy is one flavor of RDBMS software by
the Oracle company, Microsoft SQL Server,
Microsoft Access. And within Microsoft SQL Server, there are different versions
of Microsoft SQL Server. Amazon Redshift by AWS
or Amazon Web Services. Mysql. And MySQL is a widely
used open-source relational database
management system. The last one on this
list is IBM Db2. You may have, if I
had not heard of DB2, but it's a flavor of
RDBMS software by IBM. For our purposes, we'll use the course server
provided by Microsoft. The RF readmissions available, which I'll provide in the
individual description. The same SQL principles
should apply to other RDBMS software
used because SQL is an ansi
standard language, which means it's widely
accepted and it's standardized. Therefore, all major
RDBMS software support some flavor of SQL.
7. Relational vs NoSQL Databases: Relational vs. NoSQL databases. There are two main
categories of databases. Nosql databases and
relational databases. Let's take a look at
relational databases. On the top right corner, you have a sample table from
our relational database, which has a structure. Relational databases
are typically stored or hosted on
a single server. These databases are table based, which means they have tables. And they store structured data that conforms to a
schema or a structure. Relational databases
are made up of collection of objects or
relations does store the data. These related
collection of objects are stored in a database table. Common examples of
relational databases are Microsoft SQL
Server and IBM Db2. There are other different
types of relational databases, such as Oracle and MySQL. On the other hand, we
have NoSQL databases. As a term implies, NoSQL databases store
data as documents. They don't have relations. Nosql databases have
dynamic schemas to store the unstructured data. Examples of a NoSQL
database is Hadoop, which is built upon the
Hadoop file system or HDFS, which deals with files. These files are
often distributed on processing nodes
across the network. By and large, Hadoop file
system uses a part of more than one
machine to read and perform computation
against the data. Therefore, these are the two main categories
of databases, that is relational databases
and NoSQL databases. The rise of Web 2 companies
made NoSQL database is very popular as datasets handled by Internet companies grew even
bigger in size and larger. New approach to design
databases came to the for the strict schema design of relational databases was shunned in favor of a
schema-less database. Therefore, NoSQL databases come in different forms and
address different use cases. The following are some of
them that is ever mentioned. However, the scope
is also this course. These include key-value stores. Common examples are
Redis, Amazon, DynamoDB, column stores such as
HBase and Cassandra, document stores such as
MongoDB and couch base. Graph databases, such
as Neo4j and search engine databases such as solar
Elastic Search and Splunk. These are the common
types of databases and differences between
relational databases and NoSQL databases.
8. What is SQL?: What is SQL? Sql pronounced SQL stands for Structured
Query Language. Sql is an ansi standard language for accessing and manipulating
data stored in a database. The answer keyword in this case means the American National
Standards Institute. And C, which is a private
non-profit organization that administers and coordinates
the US voluntary standards and conformity
assessment system. Since SQL is an ansi
standard language, it's an industry
accepted standard. It's also universally accepted. Therefore, since SQL is
a standard language, it has been widely accepted
as a standard language for accessing our monthly
data stored in a database. Sql is therefore the de
facto programming language to access and manipulate
data stored in a database.
9. SQL Fundamentals: Seo fundamentals. Let's take a look at the
basic SQL query block, the SQL structure. A SQL query is made up
of four basic clauses. The select clause identifies the what columns are to
be accessed or retrieved. The from clause identifies a which tables are to be accessed. The where clause limits or restricts the rows that
meet a certain criteria. The optional order BY clause, sort the rows of the
truth data in either ascending or descending order
to one or more columns. And we'll look at
this more later. Therefore, these are the
basic building blocks of a SQL query. These four clauses. But for the most part, you will find that you have a select from an a where clause. The order BY clause is optional.
10. DCL Commands: This year commands, data
control language commands. These commands offer privileges
or access rights for database users to perform certain actions in a database
based on their roles. Common examples of DCL
commands are grant and revoke. The grant command gives a user access privileges
to the database. The revolt command removes user access privileges
from the database. The scope of these commands
is beyond this course, but these are the
two common types of DCL commands in use today.
11. DDL Commands: Sql command categories. There are four categories
of SQL query commands. Ddl commands, or data
definition language. The amalgam hands or Data
Manipulation Language, DQL commands or data
query language, DCL commands or data
control language. Let us look at the
first example. Data definition language
commands or DDL commands. These commands are
used to specify the database schema,
database structure. Used to create and or modify the structure of
database objects. There are two basic
types of DDL commands. The first is create table, which is used to build and
create tables in a database. The second type is alter table, which is used to alter the
structure of a database. Table in a database. These are a few examples, but these DDL commands are
out of scope of this course. This is the result for
subsequent intermediate course. We will use the create
table SQL statement instead later in this course to create our database table.
12. DML Commands: Dml commands, data manipulation
language commands are used to modify
data in a database. Common examples of DML commands are insert, update and delete. The insert command is used to insert data into
a database table. The update command
is used to update or modify data in a database. The delete command is, is to delete data from
a database table. We'll review a few examples
later in this course.
13. DQL Commands: Dql commands, Data Query Language
commands are used to access and retrieve
data in a database. The most commonly
used DQL command is the select statement. Select statement is used to retrieve data from a database. Main focus in this course will be on the select statement.
14. Install SQL Server on Docker: The thing started install
SQL Server database. Depending on your
operating system OS, you will need to install SQL
Server in different ways. To make this course
easier for you, I have included links to download the required
software to install SQL Server on one Windows
to Linux, and three Mac. I'm using a Mac and for
my purposes I'll be installing SQL Server on
a dark image on a Mac. For this course, I will use Microsoft SQL Server on a Mac, or the course material
should work on a Windows and Linux
machine as well. You will find resources
and links below for installation of the
broker says software. Now let's get started and
install SQL Server on Docker. You may ask yourself,
what is Docker? Docker is an open
platform for developing, shipping and running
obligations. Darker enables you to separate your applications from
an infrastructure. You can deliver
software quickly. Therefore, darker enables
software to run in its own isolated environment,
SQL Server 2019. And any other version
of SQL Server can be run on Docker in its
own isolated container. Once Docker is installed, you simply download or pool the SQL Server on Linux
Docker image to your Mac, then run it as a
Docker container. This container is in an
isolated environment that contains everything
SQL server needs to run. All right, let's get started. The very first thing
you'll need to do is install Docker and you get the darker free
community edition from the link right
here, which is hub, the docker.com click on get darker once the download
completes to install, double-click on the
DNG file and then drag the darker dot app icon to your applications folder and the installation should
begin right now, you can see all the files
are getting copied over to your applications
folder on your Mac. And for Windows, you may
skip this step because you have a Windows
machine and you can directly install SQL Server, this should take about
a minute to run. And once Docker is installed, we'll go over to the
Applications folder. Double-click on the darker
icon to launch docker. Looks like the
installation is complete. I'll go ahead and open
the darker software. Double-click on it. Once you open darker, you might be prompted to enter
your password in order to grant access to the
networking components on your machine. Make
sure you do that. You can see right
here it says docker is an app downloaded
from the Internet. I usually want to open it, just go ahead and click on open. And right away you
will get this window. At the very top it says darker. And the icon is a ship looks
like a large vessel and it's gonna say Docker
Engine starting by default, Docker will have two gig of memory allocated the SQL Server. However, it won't hurt if
you increase the memory. For my case, I'm going to
increase the memory to six gigs because I have about
48 gigs on this machine. I'll click on this gear icon, go to Resources advanced, and select six gigs,
apply and restart. Now, depending on the version
of your Mac you have, the menus might be different, but I believe you may be
running the latest version. And once it's done, it just defaults back to this view. Go back
to the general. Now here comes the fun part. Download SQL Server. Now that we have
Docker installed, we'll go ahead and download
SQL Server for Linux. To download SQL Server, you'll need to go to
your terminal window and run this command, which I'll provide in
the video description. And I will need to
enter my password. Once you enter the password, the latest SQL Server
2019 Linux Docker image will be pulled over
to your computer. This process may take a few minutes depending
on your internet speeds. Just be patient uses gonna
say 2019 leaders pulling from Microsoft SQL Server for slash server, pool
complete extracting. And it's done. Next step is to launch
the Docker image. Run the following command to launch an instance
of the Docker image, you just downloaded
an issue the command. I'll go ahead and
pause recording because I need to
enter my password. Next, we'll need
to run a series of commands to install SQL CLI, which is a command line
interface to interact with the Docker image for
that year on a type npm install dash G SQL, CLI, enter, guess it's
doesn't like NPM, then beyond is going to work. And if you really
see this output connecting to local host done SQL CLI, version
number provided. And you'll see the help
option as well and the prompt changes to
MSS SQL, microsoft SQL. Now this means you
have successfully connected to your
instance of SQL Server. Now let's run a quick test and see if we get some options. And we'll say select
SAT ACT version to show us the version of SQL Server which is running and
you will see an output. It's gonna say Microsoft
SQL Server 2019 is going to give you a date and it's gonna say
one row return, provide you with
the execution time. And that's pretty much it. We have install SQL
Server on darker. Next, we'll need to have a graphical user interface to interact with the SQL Server. For our purposes, we'll be
using Azure Data Studio, which was formerly SQL
Operations Studio, and it's a free GUI option for interacting with
your SQL Server. So I'll go to Azure Data
Studio download page for a Mac will need
to get this option, this release, which
is a zip file. Once you download finishes, double-click on it to launch it, it's gonna say Azure Data Studio to is an app downloaded
from the internet. Do trust it. Yes,
once that is done, you should see this. I actually had
install this before. Now let's add a connection
to the darker SQL Server. You want to type
that server's local host authentication
type is SQL login, username is ASA
anti your password, when I say remember password, database is default, so a
group is default, say connect. Right off the bat. We have a connection to
our local SQL Server. Up to this point, we
have successfully install SQL Server
on a Docker image, which will allow us to run SQL Server and proceed
with the course. And that's it for this section. Let's move ahead to the next.
15. SQL Create Database: For those of you who are
new to Azure Data Studio, azure Data Studio was formerly
secret operations studio, which is a free graphical
user interface or GUI management tool
that allows you to connect or Managed
SQL Server on your Mac or any other
Linux-based machine, which means you
can just use it to create a managed databases, write queries, backup and restore your databases and more. This is a first cranial G2. Once you launch
Azure Data Studio, on the left-hand side, you
have your connections, your solvers,
localhost, and then your databases will be
under this tree or branch. I have provided you with
a bunch of SQL scripts that I'll need you to use in order to follow along
in this course, the first thing you want
to do is just go to your browser and open up though. Extensions. Listening I want to do is just
create a database because we won't have a table or tables before we
have a database. This SQL query lets you
create a new database. First thing it does is checks if the actual database exists, then it runs his
create statement and then set some other parameters, or SQL Server or just SQL. So let's go ahead and run this. Once I refresh the
databases on the left, we'll have a new database
known as healthcare DB.
16. SQL Create Table: I'm referencing want to
do is make sure that you are connected to
the healthcare dB. If you're using
Microsoft SQL server, that should be on the left-hand
side as this one here. Or SSMS, SQL Server
Management Studio. You will see your database name here and all your tables
will fall underneath. In this case, the table
patients does not exist, as you can see here on
this drop-down section. The syntax that we use for
this section is to drop the table it exists and then
recreate it from scratch. Now the syntax for
creating a table, or rather new table
is this one here. Create table, table name. Next followed by the
column name. The datatype. Column to datatype. And you can have column three, datatype and so on and so forth. This just means to create a table that you define
within the named want. These are the column parameters, specify the column names
and the datatypes. By datatype, I mean the type of data or the column can hold. In our case, this is artist
syntax, create table. Patients has to be prefixed
by this syntax here, the biota of patients
in our case, first column will have
is a personal ID, which is an integer. It's not empty, meaning it's not null and it's a primary key. Every table and SQL
Server database, or in most databases, has a primary key followed
by the other columns. We have medical record number, which the variable
character 100. And it's not empty,
meaning milk. Now, the difference
between n var char and variable character is n var
char uses mostly space, typically two bytes by
unit Unicode character, and the variable
character uses one byte. In this case things like gender, I just specify
variable character. But then the first
name, middle name, last name will be n
bar chart up to a 100. So this means a first-name can be up to 100
characters in length. It's very hard to find a
firstname with more than a 100 cactus unless it's your
sub-factorial dummy data. These are the columns. First name, middle name, last
name, gender, DOB, address. The address is also a
variable character and bar chart with date of birth
is a datetime datatype, which is, can be empty. City after 20 characters stayed, Appleton cactus, the
phone numbers and text. This is our syntax. Very simple. It's possible to have very
large tables which have a different type of syntax
or many, many other columns. I have seen columns up to 60
columns in a single table. Now let's go ahead and make sure the connection type is helped get EB and then just run it. So we are basically checking if the table exists and
then dropping it. In this case, if I refresh
this section up here actually, and then open the branch, we have a new table here
known as, known as patients. And if you compare the syntax to the actual
table definition, this is a table intersection. C Person ID has pk, abbreviation for primary key, and all the other columns
are defined here.
17. Add data into Patients Table Using SQL INSERT INTO: If you run this query, there is no data
here, which is okay. Brings me to this other
section for insert. Basically I wanted
to show you guys that there is no data here. Once I run the insert statement will be received some data. Now, the secret insert statement and such data
into a database table. The basic syntax is inserted
into the schema table name, followed by the
columns specified. The columns specified has to
match the values provided. Which means person ID
corresponds to this one hundred, ten hundred medical
record number corresponds to this one, FAC 1010 or 10,010. Firstname corresponds to seven. Middle name is king, last name is Daniel,
gender is male. Dob 1921 or 110. The address, city, state
on the phone number. You're going to repeat
this over and over again for every single table insert. Now for other advanced courses touching on ETL operations, those deal with
large table inserts. And It's another course I'll probably create
some point in time on how to insert
or perform extraction, transformation and load of massive datasets into
a database table. But for this course,
very simple. Studying how many rows, 12345 rows, it's going
to say one row affected. Go back to my previous
electric tall and I run it, I get two rows back.
18. SQL Create Medication Table: It an additional table
known as medication table, which we'll use to work on
the comparison operators. Now first thing we will use to connect to the healthcare DB and the syntax is actually the same as the patient's table, are just change the signature for creating the actual table. In this case, it's
a medication table which has the
following parameters. First thing I'll do is
just check if the table exists in our database. If it does would drop it and
then create a table itself. These are the different columns. Remember the syntax for credit
table is the column name, whether it's null or not, and the actual datatype. This case, mitigation ID, Medicaid number,
medical record number, insurance, and the
mitigation details. Let's go ahead and connect
the healthcare DB run it. Now we do have it created. I'm just going to refresh the databases and
look at the tables. We have amortization table has the same signature or syntax
as our main table here. Next, we'll insert some
data into this table. You'll notice this is a syntax
for the insert operation. Begin, truncate the actual
table if data exists. So we start with a fresh slate. Never ever do this. If you're working on a
production database. This is just for our own
purposes, for this course. Just truncating. We can start with a clean
database table when I run it. And you will see here we
have inserted five rows. As you can see in this syntax. Syntax is as I described in previous sections for inserting data into the patient's table. You define the columns. Right here. Insert into table name, the actual columns
and the values, and the columns match the values in the
sequence as shown here. That's pretty much it created
a new medication table and insert some data
into this table. Let us proceed with
the next section.
19. SQL SELECT Statement: Let's talk about the
SQL select command, which is the most basic and the most widely
used SQL command. I'll go ahead and open up the
SQL select statement here. Very first thing
we want to do is ensure you have the
right connection, your own local host, and select healthcare DB, which is our primary
database for this course. Now the SQL select statement basically retrieves
data from the database. And the basic select statement
syntax is as follows. Select, provide the commands rather than columns
from the table. In this case will
be patient's table. Also you have a condition where
condition which limits or restricts the sequel query two rows that meet
a certain criteria. Critic example, we have
a very small table. Remember, you should
never run select star on very large our database
tables because that will degrade your
application performance or probably been
lockup your database. Mine is very simple. Do select star from patients, which basically means
select all the columns. The star from this table. As you can see in
the results here. Person ID column,
medical record number, FirstName, and all
other good stuff, all the demographics
order to the end, gender, DOB, address, city,
state, and phone number. There is also another table, medication table, select
star from medication. And it brings up
a results set of mitigations from
this healthcare dB. If you go to the left, you can see the databases, healthcare dB, the tables, medication table on
the patient's table. These are the table definitions on the left-hand side and always browse and see which
columns you need gonna suggest run select
star from patients, and you specify order
by in this case, let's say lastName. Run this, your order. The results set by the last name can see it's
in alphabetical order. Arthur Daniel DO fits back
with James Cook and Patrick. This was a possible to select your specific columns
in this case, when I say person ID, Let's just say any
of the firstname, name, and date of birth. This is a result set. I get fairly simple, select SQL select statement to retrieve data
from the database.
20. SQL Select TOP: Now we have our table. Next section, we will
study select top. Now, the select top statement limits the number grows
returned from a SQL query. This is very important for a very large tables where
you wanted to limit the output in order not to impact the application
performance. In this case, if
I do select top, then he defined the columns. You can choose to prefer to say limited number of columns or just have as many
columns as you need. Followed by the keyword from the database
name right here, the schema, and
the table itself. If you run this query,
I get two rows back. It's also possible,
as I mentioned, to limit how many
columns you need that by using that's just
providing your column names. It's also possible
to provide a stall. We just simply means give me all the other columns
from this table. If you have ten columns, you'll get columns using
the star syntax here. And these are the columns. Now we're doing a top ten. If you increases to talk three, you'll get, you'll get the top three rows from that
table in sequential order. Can see the row numbers 1234. You will get another
row returned.
21. SQL WHERE clause: The next command that we'll
use is a SQL where clause. I'll open up my recent query. I have a SQL query here. We do have a connection,
localhost, connect, select your connection
database healthcare DB, SQL where clause basically
limits or restricts the SQL query two rows that meet a certain
criteria or condition. Remember before I mentioned that you shouldn't
just run SQL select SQL star on us on a table without Providing a
condition or a limit. In this case, I'm basically
running a select count. Count is sort of aggregate over the columns
and the rows here. So select count from patients
where the gender is male. You can see right here I have four rows rather for records which are
of the male gender. You can also provide an
alias for this column. In this case, you can
say male patients. If you run this, you will have a more defined column header. It's also possible to
use a where clause where the AND operator to further
limit your results set. In this case, I want
to run account select all from patients where the gender is male and
the first name is John. This case is a good
scenario where you want to see the distribution of
the use of generic names. For instance, John,
you have Jain, these other generic names
you can find in the dataset. That's the use of the
where clause to limit or restrict SQL query to rows that meet a certain
criteria or condition.
22. SQL distinct keyword: Sometimes you may want to retrieve distinct or unique
values from a column. In this case, you make use of the distinct keyword which returns unique
results in a dataset. For instance, I wanted
to find out the distinct or the unique first names
of the male gender. In this case, I'll
change my connection to healthy dB and just
run this command. I would see that
these are basically the common names that you have in this dataset
which are unique. We have John,
Johnson and Steven. Now if I copy this SQL and just remove the
distinct keyword and run both of these. You'll see we have in
the first dataset, three names come back.
These are distinct. But then in the second one, you see there are
44 rows returned, basically are distinct keyword
gets rid of duplicates. You can see that that's the
use of the distinct keyword. Also, if you say instance, let's change this gender to female and see what we get back. A different result. First one is the
most common name is chain distinct or unique? We have duplicates, which
means there are two of these. If I do select star, basically the star here
means get all the columns. You'll see Jane is repeated, but basically I want to
show you guys that this is, this is one distinct
record, Jane Doe. And this is Jane Patrick,
distinct as well. And that's the use of
the distinct keyword.
23. SQL Order By: The SQL order BY clause
sought rows with the order BY clause in either ascending or
descending order. In this case, we'll go back to our de facto table,
the patient stable. Let's change our connection
to healthcare dB. In this case, we
would do a select all the first name, middle name, last name, and city
and state by the city. Now if we look here,
you will see that the order sequence
is alphabetical, setting with a D and ending
with San Francisco here. So denver all the way
to San Francisco. The order BY clause orders, columns based either
in ascending order, which is denoted by ASC
or descending order. If you reverse, you will see
San Francisco is at the top. It's also possible to sort
by more than one column. In this case, if
I say firstName, can say firstName ascending. So first I'll order
BY city descending, followed by
first-name ascending. I've looked at this data, city descending, San Francisco. So let's City Rochester, new York, Lubbock, Denver. And then firstName Johnson comes before Stephen
and so on and so forth. And that's the order or the sequence when you
use the order BY clause, very important if
you want to look at specific datasets depending on your needs or different columns, and so on and so forth. You can also use column aliases or a number for the column position in
the order BY clause, healthcare dB per run this, select first name, middle name, last name, city-state,
by city for his name. This is what I get back. It's also possible to use
aliases for the columns, which means, for instance, city. For that position, you want
to count the columns 1234. You can say order
by four descending, then firstName can do one, which means ordering
by position of the columns in the
select clause here. For run this, I still get the
same results set down here. That's something
cool to remember. If you have so
many rows brother, so many columns to choose
from when you select, you want to rely on
column alias or a number for the column position
in the order BY clause.
24. Sql Order By Position: You can also use column aliases. Number for the column position
in the order BY clause. For example, if I
run this query here, let me clean up my database
first. Healthcare dB. If I run this, select first
name, middle name, last name, city, state by
city for his name. This is what I get back. It's also possible to use
aliases for the columns, which means, for instance, city. For that position, you want
to count the columns 1234. You can say order
by four descending, then firstName can do one. Which means ordering
by position of the columns in the
select clause here. If I run this, I still get the same
results set down here. That's something
cool to remember. If you have so
many rows brother, so many columns to choose
from when you select, you want to rely on
column alias or a number for the column position
in the order BY clause.
25. SQL Group By: A core group by
statement returns a set of rows to give one
result per group. I have provided you with
a SQL groupby script to run for this section. Select my database. First oxygen needs to
connect to the database. Select the connection
healthcare db. Now in this case,
what I want to do is say for the first
query is just, let me run all of these three. The very top query here, I'm retrieving the
top two records from the medication table. The next section here, I'll do a select count of
the medical record number, followed by insurance names, and then grouping
by insurance names. This is a fairly common use
case when you want to see the distribution of patients who have different types of
insurance providers. It could be at now, Medicare, Medicaid, things like that. Which means you can
you can do a count of the records followed
by the insurance name, and then you group by the
insurance name itself. Section here. For instance, if
you want to check insurance providers
by average price of a medication coverage. If I run this query here, what I'm looking for
is the insurance name, the average medication price. If I go to my table definition, I want to show you guys
the medication table. It has a number of columns. One of those columns is
the mitigation price. Let me just run a
simple query here. Select star from
medication again, it's a very simple table, should never run
this in production. Select star. You can see we have mutation ID, Medicaid number,
medical record number. This is, this is a primary
key in the patient's table, which means it's a
foreign key here. Insurance name,
Aetna, Blue Cross, Blue Shield, Medicare,
and so on and so forth. And then the mitigation price. This table basically shows you the medications and the prizes and the insurance providers for those fairly simple use case. I've run this query. I'm looking for the
average price grouping by the insurance name. In a later section, we will look at the
average function, which is fairly commonly
used when you're working with financial
data or numbers. And you want to
see the average of some value or parameter. That's the look at the
Group By which means to group the results set by
one result per group. In this case, I want to see the average price on over here. I can just provide
an alias and call this average that price. Which means I want to get a
more definitive column name. Just like that. Let's move on to
the next section.
26. SQL Having Clause: It comes up fairly often in interview questions
for data engineers or SQL programming because it's
a very tricky clause to use. And it's often used with
a group BY as well. Now the SQL having clause
is used to further restrict the results of
the group by clause. So first of all, you grouped by using the group by clause. And then you limit the
results that further using the having clause syntax. Now, the basic
having clause syntax is you select a
bunch of columns. The group function from a table, the condition where clause, group by which comes
first and then having the group
condition comes next. You may also Order By the end, which means rows are grouped. The group by function is
applied to the group. And the groups marching to
have in conditioner or return. Let me give you a
common example. In this case, say you want to find the
number of patients by insurance provider with
the most expensive drug or a very expensive drug. Which means you want to do
cost analysis of your dataset, of your patient data. Now in this case, we're around a simple query. I'm selecting the the
number of records, number of patients, which is
the medical record number, which is a primary
key, unique key. That's the number of
patients, insurance name, just insurance, mitigation price as addiction prize from
the medication table. In this case I'm grouping by insurance name and
meditation price. Now the next section
I'm gonna say having a mitigation of say, over a $1000, I've
run this query. I need to first connect
to my database. I'm going to come back here
and just run this query. You can see right here, I have one patient
who is covered by insurance and they
have $1200 medication. For instance, if you
limit this to say 500, this basically means give me
accountable the patients and the insurance names or insurance providers who have
a medication of over $500. You can see we have one record. Blue Cross Blue Shield. Thus the medication price. I can actually even
come down here. I'll show you guys
the medication table. Look for this 555. You'll see right here. The second drug on this list is our parameter injection,
which costs 555. It's covered by
insurance and it's tied to this rapid here. In later sections we'll look at joined statements,
things like that, which should allow you to perform special
operations on your data, which means combining
different tables and different datas from
different tables. Now for instance,
come back here, display the insurance
provider with the most expensive drug. You'll see that that is the, that is a cost for this drug
under ethnic insurance. And that's a look. I'll be having clause, which is often used in
combination with the group BY to further limit
your dataset result.
27. SQL AND OR Operators: The operators SQL AND, OR and NOT operators. Here we have our connection
to the healthcare dB. First thing you'll do is select
star from patients table. We want to see the
group of data in here. You can see we have gender. Right here, the agenda column. Now the and operator
returns records if all the conditions are met, which means all the conditions separated by the and are met. And those conditions are too. For instance, you
can see right here, I have, I'm doing a query doing account the male patients. First thing if you run this, you will get four records back. Now in this case, if we add the and operator, it means you want to
check for this condition. This other condition,
if both are true, then you'll get results back. We can see we have one record
that is a male record. First name is John. If I go back select. You will see right here we
have one John, second row. Now the or operator
returns records if any of the conditions separated
by the or operator R2. Now, for instance, let's
use the same query. I'm going to grab
all the patients. Select star from patients
where gender is male. Firstname is either
John or Steven. In this case, we should
see two records back. And you have two records. Now, if hours to
copy this query, run it for the first
with the AND operator. You will get no
records because it's checking for where
the first name is, both John and Stephen. Now, change this back to
or you'll get two records. What if you change this to? Let's just remove this clause
or gender equals to female. What do you think? We'll get back? Let's
run this and check. Will get four records. Because there is this
probably a few columns, a few rows which don't have whichever node
gender right here. That is unknown. Run it again, you'll get four records bag. Therefore, that's the look
at the AND and OR operator. While the and operator returns true when all
conditions are met, the or operator returns any. If either of the
conditions are met. Let's jump onto
the next section.
28. SQL AND OR NOT Operators: Sql AND, OR, and NOT operators. Here we have our connection
to the healthcare dB. First thing you'll do is select
star from patients table. We want to see the
group data in here. You can see we have gender. Right here, the gender column. Now the and operator
returns records if all the conditions are met, which means all the conditions separated by the and are met. And those conditions are too. For instance, you
can see right here, I have, I'm doing a query, doing a count of
the male patients. First thing if you run this, you will get four records back. Now in this case, if we add the and operator, it means you want to
check for this condition. This other condition.
If both are true, then you'll get results back. We can see we have one record
that is a mill record. First name is John.
If I go back select. You will see right
here we have one John. Second row. The or operator
returns records if any of the conditions separated
by the or operator R2. Now for instance, let's
use the same query. I'm going to grab
all the patients. Select star from patients
where gender is male. Firstname is either
John or Steven. In this case, we should
see two records back. And you have two records. Now, if hours to
copy this query, run it for the first
with the AND operator. You will get no
records because it's checking for where
the first name is, both John and Stephen. Now, change this back to
or you'll get two records, NOT operator, which displays
a record or records. If the condition or
conditions is not true. Let's see what we
have in the records. In this case, what
you want to do is make use of the not operator. To do that. We want to do something like
not gender equals to mail. What do you think
you'll get back? Took a few seconds
and think about it. If you run this
query, you will see, you will get the records
while the gender is not male, can see you have a known
and female records. If I change this to female, select star from patients where
the gender is not female, you'll get all the male records as well as this one
which is unknown. That's the use of
the not operator, which displays a
record or records. If the condition or
conditions is not true.
29. SQL LIKE Operator: In this section,
we'll take a look at the SQL-like operator, which is used in combination
with a where clause to find a pattern or
patterns in a column. In this case, I have
this table medication. And if I just run it just to see the data
which is in here, we have these two columns, medical record number
and the insurance name. In this case, I'm trying to find the insurance name Blue Cross. How do I do that using
the like operator, it's always used in combination
in the where clause, which means it'll come in
the where clause section. Find Data is use a single quote, percent and then the
data or the text, then the percent symbol, and ended by a single quote. In this case, for instance, I'm trying to find
Aetna Insurance. Now, remember, if you
have no percentage sign, you're basically trying
to find data which starts with a B followed by the LUB. So blue in this case, which in this case you will find Blue Cross Arizona Blue
Cross Blue Shield. The other variation
is to find patients insured by provider
and then with the Medicaid or Medicare. In this case. You have
opening Cote percent, then the the words you're looking for in that
insurance name. If you run this query, you will find Medicare. That's how you use
the lac operator. Remember you always
if you're trying to find text in-between
texts you want to use present between the
string you're looking for. If you're trying to
find columns where the data starts with
specific strings, you want to make sure
it's just a single code followed by the text. If it's ending, you
want to make sure that the ending texts is at the end followed by
the single quote and the percent is at the
beginning of that. Another single instance we
can look at here is I did a select of the medications
from medication table, the actual description, we
have these medications. Now if you want to find, let me run this query here. Basically find any, any
medication that starts with a K, starts with an a
and ends with an a. In this case, just trying
to find AstraZeneca such than a ends with an a. This is a format
you use for that. And that's a look at
the SQL-like operator, which is used to find
patterns in columns.
30. SQL Wild Characters: Let's write another
query here to just see what's in this
table, medication table. I'm just gonna do a select star. It's a very small table,
so I can do that. In this case. Let's try and find an insurance. Rather all medications
form covered by Aetna. If you do something
like select star from litigation where insurance
name like Aetna, what do you think comes back? Let's run this query. Will get this one
row which shows you the insurance name Aetna
and the medication itself. Now down here, we can
consider SQL wildcards. And a wildcard character
is often used in combination with a
SQL-like operator. We looked at this
before when you had the percentage symbol. The percentage symbol often
denotes the wildcard. It's used to find characters between the specified symbol. For instance, if
I run this query, select mitigation
medical record number, insurance name for
meditation table, where the insurance
name is Blue Cross, which means the string
or the text between the wild between the
percentage symbol is returned. In this case will find
all the medications where the insurance name is Blue Cross Blue Shield
or Blue Cross Arizona, if you had another state, Blue Cross Florida, would
come down this result here. Another format of the
wildcard uses an underscore, which means it finds characters between
the specified symbol. For instance, in this case, let's do, let's pull all the records from
the patient's table. So I'm selecting
FirstName from patients. Now if you want to find all
the names ending in ON, for instance, John Don
Kohn and the like. You use the like operator, single code percent and
then underscore followed by the characters
that and that name. In this case, you will
find Johnson and Johnson. You just find, I'm
basically just doing all the single-cell active I
data's select distinct. I would get one drawback. So that's what you want to do. Just do a distinct on that. Another format of
the wildcard is to use right square bracket and
the left square bracket. Now the square brackets wildcard finds characters between
the specified symbol and the following SQL
statements selects all the patients
with a first-name, starting with a and D. Now if we run this, nothing comes back butt. That's the lowercase. Let me just change this to AD. Comes back, Let's try j. I get all the records were the first name
starts with a J. Now let's see what
data is in here. So we have Stephen as well. Let's add an S and
see what happens. You get Stephen and John. This is very useful and comes up fairly often
in interview questions. How do you find the data that starts with
a sudden letter? In this case, firstname, starting with j or S, and followed by just
any other characters. And that's how you do that. And that's the use of
the wild character with the square brackets. Let's assume we want to find all the names starting
with j, first names. And they don't contain an O, uses special type
of wild character, which is the upper carrot, which means it returns any
character not in the brackets. Therefore, it's going
to ignore any names without that have
an older brother. So if we run this
query, you'll get Jane. If you want to see
all the data in here. We have two Janes,
Johnson, John, if you put an OH is just
going to ignore all the John Johnson's or any other
names in that format. That's the use of the
upper carrot wildcard to ignore any capital is
not in the square brackets. Let's move on to
the next section.
31. SQL NOT Operator: Iterator returns the records if the condition or
conditions is not too. Let's run one quick
example right here. I'll copy the first
query down here. Let's see what we
have in the records. In this case, what
you want to do is make use of the not operator. To do that. We want to do something like
not gender equals male. What do you think?
You'll get back? Took a few seconds
and think about it. If you run this
query, you will see, you will get all the records while the gender is not male. Can see you have a known
and female records. If I change this to female, select star from patients where
the agenda is not female, you'll get all the male records as well as this one
which is unknown. Thus the use of
the not operator, which displays a
record or records. If the condition or
conditions is not true.
32. SQL Count, Avg, Min, Max and Sum: Sudo group functions
operate on a set of rows to provide
one result by group. Common examples of SQL group
functions are SQL count, SQL average, SQL
minimum, and maximum. Now let's equal count function gives you a
count of something. For instance, I'll connect to my database, localhost,
my database. In this case, I'm running a select count star patients
where the city is that. In this case, the
count function returns a number of rows that
match my criteria, where the city is that. Let me run these two here. Actually let me
run this one here. This case I'm counting
the number of medical record numbers
which is distinct or unique for a patient where
the city is that. I can also use account with
a combination of a group by, in this case, for
run this command. Basically counting
the number of records showing their first name from the city group
by the firstName. This is important
when you're trying to look at the distribution
of your data, meaning the first names, counts for different
cities, things like that. If I get rid of the whereClause
and run this again, you can see I'm getting
more data back. That's the use of the account. Now the next one is
the SQL minimum. For instance, if you want to
find a minimum of something, which means returns
the minimum value of a selected column. In this case, I do have
this medication table, which I'm just getting the
minimum mitigation price from this column and
efficient price, the average works on, on one specific column. In this case, medication
prize average is 601, which means it
aggregates aggregates all the values in the mitigation price column and gives me an average of that. The average function returns the average value of n
Ignoring null values. Common example is average of average age of persons
in our patient table, or average price for mitigation
in amortization table. We looked at minimum, the maximum returns, the maximum value of a
selected column. In this case, you want to find what's the most expensive drug. You'll do something like select, select statement Max,
provide the column name. And you can see the maximum or the most expensive
drug as this one. You can also display the most expensive medication with its description as well. In this case, I need to group by group by meditation
description. In this case you will see that the the average
mitigation price, I'm going to alias this as
give it a new column name. So we'll say this is
the average price. The med description. If you run this again, I'm getting the maximum or the most expensive drug and grouping it by the
medication description. So you have AstraZeneca, barium sulfate
suspension, flu vaccine, and all the other
drugs we have here. Now the final group function
is the sum function, which it gets you
the sum values of n Ignoring null values
from my numeric column. Remember, the sum function
works on numeric columns. The sum function returns a total sum of a numeric
column in this case, to find the total price
of the medication column. And you'll see it's 3,006. And that's a look at the most commonly
used group functions. You may use these in financial applications or
other types of applications. You have to find specific
metrics on your data.
33. SQL JOIN and INNER JOIN: Sql Joins. Sql join is used to combine two or more tables together
based on common columns, greater insights are
derived from joining the tables together from
the DDL commands provided, you will notice that the
medical record number, the patient medical
record number is common among the patients, stable and mitigation stable. In this case, the
syntax for joining two tables is based on
the common columns. For our case, the medical record number
is a common column. Let's take a look
at one example. But before we do the
basic syntax is select the column names from table one. Table name one. Join. The second table
on column name one, column named two, which means the first column is
from the first table, second column is from
the other table. A good example we'll look at is returning all
the patients and their medications from Salt Lake City under
Aetna Insurance. And before we do that, let's do a basic select
star from medication. You will look at
this table here. Medications does not have city. How do you get the city? You get the city by using
the medical record number, because this column here
is foreign key here, but it's a primary key
on our other table. If you do select star from patients around
these two selects, you will see at the very
end here, you have this, the city information, but
then medications does not. Now, in our use
case is to return all the patients and their medications
from Salt Lake City and the Aetna Insurance, which means you want to get all the medications
from this first table that are from Aetna
or in this case, I guess we're using
guardian insurance. This case. Let's just copy
that here. How do you do that? You do that by combining the patients and
medication table. In this case, we're using
an inner join which returns records that have
matching values in both tables. The matching values are
the medical record number. So what you do is select from patients PAT as the alias
and adjoin medication MED. The common column, which
is medical record number. It's common in both tables where the patients city remember, City information is not
in medication stable. It's in the patient's table, which is right here
where PAT dot cd is Salt Lake City and medication
or metadata insurance. Insurance name is guardian. If we run this, it
will get one record. This one record has guided insurance and it's
from Salt Lake City. If you go back here. If you were to do
for instance Athena, this record is 110. It's from New York. You'd have to change
this a little bit. So if you were to try
and find the records that have Aetna Insurance
from Salt Lake City, you would not find. This would actually
come back empty. See that? Let's just go back. Thus, the reason is
if I run this again, you will try to find Aetna. Only one record has
at an insurance. This is the medical
record number 110. These three here, they don't have Salt Lake City as a city. They have Colorado,
Texas, and New York.
34. SQL LEFT JOIN and SQL RIGHT JOIN: In SQL, left join, the left join or
left outer join. Select records from the first or the leftmost table with
marching right table records. Now in this case, let us look at this
one example here. This is the medication stable. Let's run this square root here. I'm just joining the patient
stable on the medication, which, which means here, basically selecting records from the first leftmost table with matching right table records, I get seven rows back. Now this means here, this is fairly important
for you to see. Let me do a select star here
from the patient's table. I'm gonna run these
three queries here. First one is a patient
stable has seven rows. Second one is the
medication has five. And the left join here
returns seven rows down here. The reason for that
is this record here. Jane, row 67. If you look at this medical
record number is 165166. It does not exist in the
medication stable override, which means if you run a
left join of patients and medication is
returning the records from the leftmost table, the patient's table with
margin-right table records. So if you go at the end, these values here show up as
null because this record, Jane Doe and Jane Patrick
does not have medications. That's why you have nulls. So it's possible to
have null values returned in the left join here, the SQL right join, the SQL right outer join, select records from the
second rightmost table with matching left records. Syntax is select
columns from table one, right join table to table one dot column name equals to
table two dot column name. Run this. Right. Five rows are returned based on the previous
explanation I provided. Because if you were
to run in this case, what we're doing
is returning the, returning the records
from the rightmost table. In this case, you'll
just get five rows because you're retaining
the records from the medication table that match the patient
stable in this case. You can see here, you will get those
records including the medications on
the right-hand side. In this case, I'm
doing a select star, which means you have all
the columns returned. If you just wanted to
return specific data, you want to do PAT dot FirstName,
LastName for instance. Let me just come back here. Let's do medication dot. Let's look at insurance name. Run this. It's more descriptive
in this case. That's a look at the
right outer join. Remember the SQL right outer join or the SQL
right John returns records from the second or the rightmost table with
matching left table records. Now the SQL left join returns records from the
first leftmost table with matching right
table records.
35. SQL UNION: A civil union, the union
operator is used to combine the results set of two or
more select statements. The union operator performs Indian on columns with
the same datatype. That means that
the union columns must have the same datatype. In our case, medical record
number in both tables is of the same datatype
and the columns must be in the
same column order. And the basic syntax of union operator is select the column names from
the first table, table one, union the select
column name from table two. For example, the
following SQL statement returns the medical
record numbers distinct from both patient rather patient's table,
meditation tables. There are two
formats I have here, but let's stick to
the second format, which is select the medical record number
from patients, union. Select medical record
number from medication. Basically just writing
two select statements and combining the results
with a union operator. And I'm ordering by the medical record
number. Run this query. This is the order I get. The medical record numbers
are unique for case. That's the SQL union operator that you can use to query
your database tables.
36. SQL SORTING ASC or DESC: Sql sorting, either
ascending or descending. The SQL ascending
operator is used to sort column values
in ascending order. We have looked at this
throughout the course where we looked at our different
select statements. For example, if you just run select medical record
number from medication, you can order by this
column in ascending order. This is going to be the order. You can use the SQL
descending operator to sort column values
in descending order. In this case, if I run
both of these queries, you will see it's
in ascending order. And it's in descending
order here. That's a look at the SQL sorting operators are the
ascending and descending.
37. SQL UPDATE: A SQL update is used to
modify records in a table. Always use a where
clause to limit the update operation
to specific records. Uses update statement
with caution. And only when
absolutely necessary. You want to avoid manipulating data
directly on the database. Always use an application
unless you're performing backend operations
in a staging area or during ETL or
something of that sort. The syntax is for instance,
update table name, set that column equals to that, or set the other
column into that. The condition. And a good example is update a single records column value
with the new column value. For example, update medication, said Medicaid number, that make it number
is close to that. So basically we are
just trying to change the Medicaid number
from FAC 172, that that's a single that's
the look at the medication. And if I go to the actual table, let's just copy this. I'm going to show
you guys the use of that update statement here. Just pull all the medications. Say I wanted to update this
medical record number, which is not a good
practice because as the foreign key on
the other table, which is why I said you want to update data directly using an application or some other
integrity operation tool. This case, simple
operations such as this. You can just say for instance, if you want to update the name, this name here,
medication description. Do update medications set,
medication description. Let's say we copy this. Let's say instead of an ease
and I copy this back here, mitigation description
equals to that. So basically just changing the medication description name here from an E2 and I
update medication tables set mitigation description
to that where it's that actually where it's that
if you just run this, you'll see one row affected. If we go back and run it here. You see we've changed
that, that record. Thus the use of the update
statement, but again, use APA statement would caution you should always
have a condition where just to make
sure that you are updating one row or just
a set amount of data.
38. SQL DELETE: Delete. The secured
least statement is used to delete
rows from a table. Use this command cautiously. The reason I'm showing
this is because I want to show you how to
delete a single record, single role from a table. As a precaution, always
set a condition for your delete statement to
avoid letting unwanted roles. Combine either two
or more conditions with your delete statement. Let me show you guys
an example here. I'm running a select star from patients to view all
the patient records. I want to delete
row number seven. The syntax for delete is the delete keyword from table name where the
condition is such and such. This case, I have prepared
the delete statement. Delete from patients where medical record number
equals to this one here. Copy that. I'm also going
to add another condition. Let's say personal ID
equals to such and such. In this case it's one
hundred, ten hundred and six. Just gonna copy that
just to make sure we have more than one condition. Then run this command. You will see the output
one row affected, which means we have
successfully deleted one row. If I go back and
run this select, you will see we now have
six rows instead of seven, and Jane Fitzpatrick
has been deleted. That's a look at the
SQL delete statement.