# data[].attributes.body
By the end of this lesson, students will be able to understand the fundamental concepts of SQL and write basic SQL queries.

# data[].attributes.body
Students will:
- Define SQL and explain its purpose
- Identify basic SQL commands (SELECT, FROM, WHERE)
- Understand database table structure
- Write simple queries to retrieve data

# data[].attributes.body
How do we efficiently store and retrieve data from databases using SQL?

# data[].attributes.body
Teacher presentation on SQL basics:
- What is SQL?
- Why do we use SQL?
- Real-world applications

# data[].attributes.body
Using SQLite Online Editor, demonstrate basic queries. Students will follow along on their computers.

# data[].attributes.attachment_link.title
SQL Online Compiler - Next gen SQL Editor

# data[].attributes.attachment_link.description
SQL OnLine - Next gen SQL Editor: SQLite, MariaDB / MySQL, PostgreSQL, MS SQL Server. User-friendly interface for data science. No registration for start, No DownLoad, No Install. Online test SQL script. Online Open/Save SQLite file. Online view all table DB. Fiddle link SQL text and DB file.

# data[].attributes.body
In pairs, students will create a Padlet wall to share and compare their SQL queries, allowing for peer feedback and collaboration.

# data[].attributes.body
Work through sample queries together:
- SELECT * FROM table
- SELECT column FROM table
- WHERE clause basics

# data[].attributes.body
Advanced students can explore ORDER BY and GROUP BY clauses

# data[].attributes.attachment_link.readable_text
SQL is a standard language for storing, manipulating and retrieving data in databases.

Our SQL tutorial will teach you how to use SQL in: MySQL, SQL Server, MS Access, Oracle, Sybase, Informix, Postgres, and other database systems.

Start learning SQL now "

Examples in Each Chapter

With our online SQL editor, you can edit the SQL statements, and click on a button to view the result.

Click on the "Try it Yourself" button to see how it works.

SQL Exercises

SQL Examples

Learn by examples! This tutorial supplements all explanations with clarifying examples.
See All SQL Examples
SQL Quiz Test

Test your SQL skills at W3Schools!
Start SQL Quiz!
My Learning

Track your progress with the free "My Learning" program here at W3Schools.

Log in to your account, and start earning points!

This is an optional feature. You can study W3Schools without using My Learning.

SQL References

At W3Schools you will find a complete reference for keywords and function:
SQL Keyword Reference MYSQL Functions SQLServer Functions MS Access Functions SQL Quick Reference
SQL Data Types

Data types and ranges for Microsoft Access, MySQL and SQL Server.
SQL Data Types
Kickstart your career

Get certified by completing the course

# data[].attributes.attachment_link.description
W3Schools offers free online tutorials, references and exercises in all the major languages of the web. Covering popular subjects like HTML, CSS, JavaScript, Python, SQL, Java, and many, many more.

# data[].attributes.body
Monitor student progress through:
- Think-Pair-Share discussions
- Quick query challenges
- Student explanations of their code

# data[].attributes.body
10-minute quiz on basic SQL concepts and simple query writing

# data[].attributes.body
Students will write 5 different SQL queries to retrieve specific data from a sample database

# data[].attributes.body
Students share one new thing they learned about SQL and one question they still have

# data[].attributes.body
Students write and execute a simple SQL query of their choice and explain what it does

# data[].attributes.body
Complete 10 SQL query challenges using the online SQL editor

# data[].attributes.attachment_link.description
Well organized and easy to understand Web building tutorials with lots of examples of how to use HTML, CSS, JavaScript, SQL, PHP, and XML.

# data[].attributes.body
Using Padlet, create a post explaining a real-world scenario where SQL would be useful

# data[].attributes.body
Research and write about different types of SQL joins

# data[].attributes.attachment_link.readable_text
SQL JOIN

A JOIN clause is used to combine rows from two or more tables, based on a related column between them.

Let's look at a selection from the "Orders" table:

Then, look at a selection from the "Customers" table:

Notice that the "CustomerID" column in the "Orders" table refers to the "CustomerID" in the "Customers" table. The relationship between the two tables above is the "CustomerID" column.

Then, we can create the following SQL statement (that contains an INNER JOIN), that selects records that have matching values in both tables:

Example

Try it Yourself "

and it will produce something like this:

Different Types of SQL JOINs

Here are the different types of the JOINs in SQL:

(INNER) JOIN: Returns records that have matching values in both tables

LEFT (OUTER) JOIN: Returns all records from the left table, and the matched records from the right table

RIGHT (OUTER) JOIN: Returns all records from the right table, and the matched records from the left table

FULL (OUTER) JOIN: Returns all records when there is a match in either left or right table

# data[].attributes.attachment_link.description
W3Schools offers free online tutorials, references and exercises in all the major languages of the web. Covering popular subjects like HTML, CSS, JavaScript, Python, SQL, Java, and many, many more.

# data[].attributes.body
sql basic