Notice: This page requires JavaScript to function properly.
Please enable JavaScript in your browser settings or update your browser.
Impara The SELECT Statement | Retrieving Data with SELECT
Practice
Projects
Quizzes & Challenges
Quiz
Challenges
/
SQL Fundamentals: An Introductory Course

bookThe SELECT Statement

Scorri per mostrare il menu

When you want to retrieve information from a database, you use the SELECT statement. This is the most fundamental SQL command for querying data. The SELECT statement allows you to specify exactly which data you want to see from one or more tables in your database. Whether you need all the data or just a few specific pieces of information, SELECT is your main tool for asking questions and getting answers from your tables.

1
SELECT * FROM students;
copy

Often, you do not need every column from a table. You can tailor your results by specifying which columns you want to see. To do this, list the column names you are interested in after the SELECT keyword, separated by commas. For example, if you only want to see the first names and enrollment years of students, you can write a query that selects just those columns.

1
SELECT first_name, enrollment_year FROM students;
copy

Sometimes, you may want to make your output easier to read or better reflect the meaning of your data by renaming columns in your query results. You can do this using a column alias with the AS keyword. An alias gives a temporary name to a column in your result set, making it more descriptive or suitable for your needs.

1
SELECT first_name AS "Student Name", enrollment_year AS "Year Enrolled" FROM students;
copy
Tutto è chiaro?

Come possiamo migliorarlo?

Grazie per i tuoi commenti!

Sezione 2. Capitolo 1

Chieda ad AI

expand

Chieda ad AI

ChatGPT

Chieda pure quello che desidera o provi una delle domande suggerite per iniziare la nostra conversazione

Sezione 2. Capitolo 1
some-alt