Course contentsShow
← Data Science
Lesson 850 of 2,14522. SQL FoundationsFree lesson

FROM Clause: Specifying Data Sources

Understand how the FROM clause identifies which table to query and how to reference tables in your database.

FROM Clause: Specifying Data Sources

What you'll learn: How to tell SQL exactly which table to pull data from using the FROM clause.

What is the FROM Clause?

In your previous lesson, you learned that SELECT retrieves data. But data from where? That's where the FROM clause comes in. Think of a database like a library with many books (tables). The FROM clause is you telling the librarian exactly which book you want to read.

Every SQL query that retrieves data needs to specify its source. The FROM clause identifies the table(s) you're querying. Without it, SQL wouldn't know where to look for your data.

Basic Syntax

SELECT column_name
FROM table_name;

The FROM keyword is followed by the name of the table you want to query. For example:

SELECT *
FROM customers;

This tells SQL: "Get all columns from the customers table."

Referencing Tables

Table names must match exactly as they appear in your database—SQL is case-sensitive in some systems. If your table is named employee_data, you must write it that way, not Employee_Data or employeedata.

In databases with multiple schemas (organizational containers for tables), you might need to specify both:

SELECT *
FROM sales_schema.customers;

This format (schema.table) ensures you're pulling from the correct table when multiple schemas exist.

The Foundation of Every Query

The FROM clause is mandatory for data retrieval. You can't get data without telling SQL where it lives. It's like asking "What's the temperature?" without specifying a location—the question is incomplete.

Key Takeaway: The FROM clause specifies which table SQL should query, acting as the essential data source identifier in every retrieval operation.