SQL

Your First Query

Your First SQL Query

Welcome to SQL! SQL (Structured Query Language) is the most widely-used language for working with databases. Companies like Google, Amazon, Netflix, and banks all rely on SQL every day to manage their data.

What is a Database?

A database is like a collection of organized spreadsheets (called tables). Each table stores rows of data, and each row has columns (fields) that describe specific attributes.

Here's what the products table looks like:

idnamecategoryprice
1LaptopElectronics999
2NotebookOffice5
............

The SELECT Statement

The most basic SQL command is SELECT. It retrieves data from a table.

Syntax:

SELECT * FROM table_name;

Let's break this down:

  • SELECT — tells the database you want to retrieve data
  • * — means "all columns" (a wildcard)
  • FROM — specifies which table to pull data from
  • ; — ends the statement (always include this!)

💡 Why Does This Matter?

Every data analysis project starts with SELECT. Whether you're checking inventory, reviewing sales numbers, or building a report — this is your starting point.

⚠️ Common Mistakes

  • Forgetting the FROM keyword
  • Misspelling the table name
  • Missing the semicolon ; at the end

Your Task

We have a table called products with information about items in a store.

Write a query to select all data from the products table.

query.sql
Loading SQL engine...
Downloading SQL engine… (one-time)

Downloading SQL engine… (one-time)

This runs entirely in your browser and is cached for next time.