SELECT Statement to Query Data
The SELECT statement is fundamental for querying data in SQL databases. Its use and syntax are explained below.
SELECT Syntax
The basic syntax for performing a query is:
SELECT [columnas] FROM [tabla];For example, to select all users under 25 years old:
SELECT * FROM users WHERE age < 25;It is important to put ; at the end of each query.
Purpose of the SELECT Statement
The SELECT statement is used to query and retrieve data from a database. It allows users to select one or more fields from one or more tables, facilitating the retrieval of specific information that meets certain criteria.
Exercises
Interactive Test 1: Drag and Drop.
Drag in the corresponding order.
Drag the options:
SELECT
FROM
users
*
Completa el código:
______
______
______
______
Interactive Test 2: Fill in the Blanks
Fill the Blanks.
SELECT FROM ;
Practical Exercise:
Statement:
Write the SQL query necessary to select all users.
Example Data
| id | name | age |
|---|---|---|
| 1 | John | 25 |
| 2 | Anna | 30 |
| 3 | Kevin | 22 |
| 4 | Angela | 35 |
* Write your SQL query and execute to see results.
Resultados:
No results available.