Objective: πŸ” Learn how to retrieve data from a database and filter it according to specific conditions.

Let’s first learn what is a SQL Query -

A SQL query is a structured command used to retrieve, modify, or manage data in a database.

πŸ“– Continuing from our previous example of tables, below is the most basic SQL query -

SELECT: This is like highlighting a particular column or multiple columns in our spreadsheet. In this case we are retrieving all the data from the column β€˜title’. We will only see the values from β€˜title’ column (aka field) -

SELECT title FROM movies_sheet;

Screenshot 2023-09-17 at 1.56.23 PM.png

WHERE: Helps us filter out data. It's like using the filter option on our spreadsheet to only show movies released after 2000.

SELECT * FROM movies_sheet WHERE release_year > 2000;

Screenshot 2023-09-17 at 1.57.05 PM.png

Alright! Now that you've got a hang of how SELECT and WHERE play out, let's crank things up a notch. Ready?

Introduction: πŸ’Ό Imagine you're a data analyst at a popular electronics store. You need to pull out relevant data to answer business questions and make informed decisions. Using SQL, you can fetch and filter the data you need!


1️⃣ Exploring the Database

2️⃣ Select Specific Columns

 **Sample Question:** "πŸ”Ž List the **name** and **price** of all **products**."

Solution:SELECT product_name, price FROM products;

Screenshot 2023-09-17 at 2.35.30 PM.png


3️⃣ Filtering with WHERE