The columns of a query

We can use the SELECT statement to request data from the tables in the database. The result of the SELECT statement is also a table; that means that it consists of columns and rows. At first, you can think of it like an Excel spreadsheet. The simplest form of the SELECT statement looks like this:

SELECT <Feldliste> FROM <Tabellenname>

All columns of a table

If we request all columns of the table, then we can specify the asterisk * in the field list. The corresponding request for this:

SELECT * FROM <Tabellenname>

This allows us to request the full contents of a table:

  • all columns and
  • all lines

Let’s try this out by querying the table TASKS in our data model. This table contains 1000 rows and many columns.

Individual columns in the field list

Often we don’t need all the columns and sometimes superfluous columns are even annoying. Then we can name the required columns in the field list individually. For this purpose, the column names are listed separated by commas.

SELECT id, 
       title, 
       assignee, 
       due_date
  FROM tasks;