DbSchema Database Designer

DbSchema Tutorial | SQL SELECT Statement

Publish on DbSchema Blog >>>

SQL alt >

Welcome to the world of SQL (Structured Query Language), the standard and most widely used programming language for relational databases. This article aims to provide a tutorial on the SELECT statement, one of the most essential elements in SQL, enabling users to retrieve data from a database.

Understanding the Basics

Before we dive into the SELECT statement, let’s cover some basics of SQL:

  • Database: A database is an organized collection of data stored and accessed electronically. Databases in SQL are composed of tables.

  • Table: A table is a set of data elements that uses a model of vertical columns (which are identified by their name) and horizontal rows. It can be compared to a simple spreadsheet.

  • Column: A column in a SQL table is a set of data values of a particular type.

  • Row: A row in a SQL table represents a set of related data, and every row in the table has the same structure.

Now, let’s explore the SELECT statement!

SQL SELECT Statement

The SELECT statement is used to fetch data from a database. The data returned is stored in a result table, also known as the result-set.


Here is the basic syntax of the SELECT statement:

SELECT column1, column2, ...
FROM table_name;

Here, column1, column2, … are the field names of the table you want to select data from. If you want to select all the fields available in the table, use the following syntax:

SELECT * FROM table_name;


Let’s assume we have a table called Students, with the following data:

ID Name Age Grade
1 John 20 A
2 Sara 19 B
3 Mike 22 C
4 Jenny 21 A

Now, if you want to select the Name and Grade for every student, the SQL SELECT statement would be:

SELECT Name, Grade
FROM Students;

This would return:

Name Grade
John A
Sara B
Mike C
Jenny A

And if you want to select all data from the Students table, the SQL SELECT statement would be:

FROM Students;

This would return all the data from the Students table as output.

Result alt >


The SELECT statement is a vital part of SQL as it allows us to retrieve and view data from our databases. When we want to analyze the data stored in our tables, we use the SELECT statement to specify and retrieve exactly what we need.

In this tutorial, we have covered the basics and syntax of the SQL SELECT statement, and we also provided examples. This should give you a solid understanding to start retrieving data from a SQL database. In the upcoming articles, we will dive deeper into other SQL statements, further extending your database querying capabilities. Keep practicing your SQL skills to become proficient.

Happy coding!

Practice Questions:

You can practice these questions to have a better understanding and hands-on experience on the topic.

Exercise 1: Select all fields from the employees table.
Exercise 2: Select the salary and department of the employees from the employees table.

Visually Manage Databases using DbSchema

DbSchema is a databases client and visual designer. DbSchema has a free Community Edition, which can be downloaded here.
DbSchema main features include:

DbSchema Designer alt >

Interactive Diagrams

Design tables, column and foreign keys directly in diagrams, by double-clicking them. Changes will be saved to the design model and, if DbSchema is connected to the database also into the database. More.

Connection Dialog alt >

Simple Connection Dialog

Choose the database location, the user and password, and simply get connected. Choose 'Edit Manually' into the JDBC URL combo to enter a custom URL. More.

Relational Data Explorer alt >

Relational Data Explorer

Explore data from multiple tables simultaneously, using foreign keys or virtual foreign keys. Double-click cells to edit the data. More.

Query Builder alt >

Query Builder

Create SQL Queries featuring JOINS, GROUP BY, ORDER BY just using the mouse. More.

SQL Query Editor alt >

SQL Query Editor

Edit and execute SQL Queries. The editor is autocompletion-enabled. More.

Schema Synchronization alt >

Design Schema in Team & Schema Deployment

DbSchema is using the design model, a copy of the schema structure, independent of the database.
The design model can be saved to file and shared in a team.
Connecting to another database you may compare the design model with the database, commit the differences or merge them in the design model. More.

Dark Theme alt >

Dark Theme

Configurable styles & dark theme. More.

Many features are available in the free Community edition.
The Pro edition adds capabilities to save the design to the model file, design schema in team and deploy the schema on multiple databases.

DbSchema can be downloaded for free. No registration is required.