PostgreSQL Field Selection
Anonymous contributor
Published Aug 20, 2024
Contribute to Docs
In PostgreSQL, Field Selection allows the user to fetch a specific column or field from the database. The SELECT statement is used with the column name to retrieve the data.
Syntax
SELECT column1, column2, ...
FROM table_name
WHERE condition;
Example
For example, consider this students_marks table with the following data:
| student_id | name | grade |
|---|---|---|
| 1 | Alice | A |
| 2 | Bob | B |
| 3 | Charlie | A |
| 4 | David | C |
| 5 | Eva | B |
SELECT name from students_marks
The above query will return only the name column:
| name |
|---|
| Alice |
| Bob |
| Charlie |
| David |
| Eva |
All contributors
- Anonymous contributor
Contribute to Docs
- Learn more about how to get involved.
- Edit this page on GitHub to fix an error or make an improvement.
- Submit feedback to let us know how we can improve Docs.
Learn PostgreSQL on Codecademy
- Learn to analyze data with SQL and prepare for technical interviews.
- Includes 9 Courses
- With Certificate
- Beginner Friendly.17 hours
- In this SQL course, you'll learn how to manage large datasets and analyze real data using the standard data management language.
- Beginner Friendly.5 hours