Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
0% found this document useful (0 votes)
41 views

Getting Started - Transcript

This document provides an introduction to a guided project on using subqueries in SQL. The project instructor will teach how to use SQL subqueries with the WHERE, FROM, and SELECT clauses to query an employees database and solve real-world problems. The document outlines the tasks in the project, which include using subqueries in the WHERE, FROM, and SELECT clauses, and exercises to reinforce learning. The goal is for students to gain a strong understanding of writing subqueries by the end of the project.

Uploaded by

Retail Vew
Copyright
© © All Rights Reserved
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
41 views

Getting Started - Transcript

This document provides an introduction to a guided project on using subqueries in SQL. The project instructor will teach how to use SQL subqueries with the WHERE, FROM, and SELECT clauses to query an employees database and solve real-world problems. The document outlines the tasks in the project, which include using subqueries in the WHERE, FROM, and SELECT clauses, and exercises to reinforce learning. The goal is for students to gain a strong understanding of writing subqueries by the end of the project.

Uploaded by

Retail Vew
Copyright
© © All Rights Reserved
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
You are on page 1/ 4

Hello and welcome to this guided project working with sub-

-queries in SQL.
My name is Olayinka and I'll be your instructor
for this project.
This project is for people who are interested in advancing
their knowledge and skills in using SQL. In this project,
we will write very nice queries to solve real life problems.
This project is extremely important for you as an SQL user
because you will understand how subqueries work.
We will work on a massive database called the employees database.
Be rest assured that you will learn a ton of good work here.
This project is a follow up to- and a continuation of a series
of projects on mastering SQL for database querying
and database insights.
Before now we have covered eight exciting projects
in this series.
This project will add a new and powerful skill to your database
querying and SQL toolbox in general.
You can add this project to your portfolio of projects which
yeah, essential for your next job interview.
I will teach you how to use SQL subqueries together
with the WHERE clause, the FROM clause, and the SELECT clause
to query the employees database for database insights.
This project will come in handy as an SQL user who wants
to get work done quickly or wants to expand their knowledge
in the use of SQL. You don't need to be a database expert
or data analyst expert or data administrator as the case
may be to take this project, but you should have a good
understanding of using SQL for querying databases in order
to get the most out of this project.
Since this project is quite an advanced concept in SQL
and you will need to be familiar with SQL concepts like SQL
joins and aggregate functions.
I strongly recommend my previous projects in this series,
like the project on Querying Databases using SQL SELECT
Statement and Mastering SQL Joins.
Please check them out. If you are great with writing SQL
queries, then join me on this exacting ride.
I am excited to teach you how to effectively use SQL subqueries
to query a databases.
I have taught students on using SQL for data analytics
from beginners to advanced level.
So, I have a good experience in introducing these concepts
in a beginner-friendly manner.
So, by the end of this project you will have a full
understanding of, um- how to use and write subqueries in the
WHERE clause, in the FROM clause, and in the SELECT clause
to get the desired result set. Let us do a quick overview
of the Rhyme platform.
This is the Rhyme platform. Rhyme is generally an online
platform for hands-on project creation.
It will- it will allow you to learn by doing. What is really
powerful about Rhyme is that; it comes pre-configured for you.
So, it's a pre-configured cloud desk-
-top with all the software preinstalled.
Simply put,
you don't need to worry about any installations or just
any headaches like that.
Just go ahead and follow along and code with me.
Now on the right hand side panel, the one you can see
right now, um- is my own cloud desktop.
I'm currently in the collapse mode.
I can move to the expanded mode and go back to the collapse
mode which we'll use majorly for this project.
On the left hand side.
The big cloud desk-
-top you see is yours. Okay,
so, um-- since this is a hands-on project, I want you to watch what
I am doing and follow the steps on your own cloud desk-
-top. If you need to pause my instruction at any time,
please bring the cursor on top of my cloud desk-
-top and click the pause button below the speed button.
If I'm going too fast or too slow,
you can also click the speed button just by the side
of the pause button. For this project, we'll be using Postgre-
-SQL just like we have on the screen- as our database
management system.
Also, by now I believe you should know that SQL is not case
sensitive for keywords; that is if I have SELECT in uppercase
and in lowercase, they mean the same thing in SQL statements.
However, it is a good practice to write keywords in uppercase
I prefer to write those key words in uppercase.
Um-- now using PostgreSQL we can query the database.
So, throughout each task in this project, I will show you how
to use Progres to aggregate, manipulate and retrieve
or query data from data-- tables in the database using SQL
subqueries.
Alright.
Let us dive in.
The first thing we want to do is to come over to this server
and click here,
okay? And it will ask you for a password.
The password is coursera2021. coursera--
No space between 2021 and coursera. coursera in lower case like this.
coursera2021, okay? Come over and click
OK. And that gives us access to the database server.
I can come here and expand this
alright? Now, let's come down here.
Okay, so, if I just click on close. Now on your cloud
desktop, I have this folder called Mastering SQL, um- sub-
-queries,
right? All I needed to do is just come to this database-
employees database. I'll talk about is briefly-- and right
click, okay? Come down to query tool,
alright?
And it will open a blank query tool for us where we can type
our script.
So, what I want to do is to come to open,
alright?
And you will see this file.
Um-- here.
Mastering SQL Subqueries.
That's the name of the file I have given to it.
Beautiful!
Note that I have preinstalled, um- the employees database for
the purpose of this project.
This database contains nine tables.
Let's go down to see these nine tables.
We have the customers, the departments, the departments duplicate
table, the department employment table, the department
managers table, the department managers duplicate table, um-
the employees table, the salaries table and the sales table.
So, this database is an excerpt from the employees database
that is freely hosted on GitHub. In general, this database like
I've said, contains 9-- 9 tables. Seven of these
I have mentioned that earlier. Also, I added these two tables. This
sales and this customers table into the data-- employees
database.
These two tables were extracted from the popular Superstore
datasets. I simply imported
these tables as CSV files, um-- as tables into the employees
database.
Note that this database is fictitious.
Therefore, any resemblance of details whether the name or the
address is purely coincidental.
Do not worry.
I have provided this database in the additional reading
section of this project.
You can download it and practice on your own.
If you have taken the last project in this series, you will
notice that the database is very similar.
It is important that also before we go on,
okay? Let me just come over here to close this a bit, so as to
have more space to work.
Yeah, before we go on, what I have done is, I have divided
this project into different-- a series of task,
right? So, in task number one, we will get started with the project;
where we'll retrieve some tables, um- from the- from the database,
okay? Then going forward to task number two, we're going to
use subqueries in the WHERE clause,
alright? Um-- then please note that you will find some code
cells like this one here that I have written for you.
That is when, um- we have some code that needs just explanation.
It's not something to really worry about.
So, we'll just go ahead and run this kind of queries but in some
cases you see here- there are some that I have space there for us to
actually code together.
Um-- I highly recommend that you should code along with me and
make sure you get the same result. One strategic thing I have also
done in this project is to make sure you think through the
solutions to these real-life problems.
I have tried to include a lot of exercises. So, if you go down
here, you will begin to see some exercises
yeah. So, I have exercise 2.1, exercise 2.2, and like that-
everywhere throughout the project.
The idea is to try to reinforce the learning and make sure
that you understand the concepts properly.
Also, I have provided solutions to these exercises as we go
on. I've also added a file- a script in the additional reading
section in case you would like to practice later with these
solutions.
So, um-- going forward in task three would select-- we'll add sub-
-queries in the FROM clause. And in task four down here, we will have
subqueries in the SELECT clause.
Then, throughout task five to task um, seven, we would be working on
different exercises on subqueries to establish our
understanding. Basically,
I want us to get our hands dirty. And in task six- task six-- we'll
go on to task seven still on subqueries exercises.
Um-- I believe that if you work through each task, you will become a
solid subquery person by the end of this project. Together
with your focus and determination,
I believe you come out strong after completing each task in
this project.
Okay, so now let us go back to task one,
okay? At this point, what we want to do is to get familiar a
bit with the columns and rows of the tables we have in the
database-- just to get familiar with these tables.
So, what I want to do is I want to select all-- this asterisk (*)
means, I want to select all the records from the employees
table. So, I'm going to just highlight this first line, and come over
to this run and you begin to see the employee number, the
birth date, the first name, the last name, the gender and the
hire date of the employee.
So, what I want you to do right now is to pause my video and
run each line of this query to get familiar with what each of
this table contain.
This is the departments table.
You'll see it has the department number and the department name. It
has nine records.
You can come to the messages to see it has nine rows.
That is nine records.
So, what I want you to do now is pause my video and for a
little while- just to run through each of these query lines and
you'll see what you can get out of that.
Okay, so I believe you were able to run each line and you can
see I've run also the, uh- sales table and you'll see the details
in the sales table.
Amazing!
At this point, all is set for us to start to explore how sub-
-queries work in SQL. Great job on completing the first part of
this project. In this task, we got familiar with our
expectations, what we want to get, what we want to achieve, what
we want to do in this project.
To end, we retrieved data from tables in the employee database.
I hope you enjoyed it. In the next task,
we will pick it up from where we left off here, and we'll start to
use subqueries in SQL. Particularly, we'll
use subqueries in the WHERE clause.

You might also like