Oracle SELECT Statement

Summary: in this tutorial, you will learn how to use the Oracle SELECT statement to query data from a single table.

In Oracle, tables are consists of columns and rows. For example, the customers the table in the sample database has the following columns: customer_idnameaddresswebsite and credit_limit. The  customers the table also has data in these columns.


To retrieve data from one or more columns of a table, you use them SELECT the statement with the following syntax:

In this SELECT statement:

  • First, determine the table name from which you need to inquire about the data.
  • Second, demonstrate the columns from which you need to restore the data. If you have more than one column, you have to isolate each by a comma (,).

Note that the SELECT the statement is very complex that consists of many clauses such as ORDER BYGROUP BYHAVINGJOIN. To make it simple, in this tutorial, we are focusing on the SELECT and FROM clauses only.

Oracle SELECT examples

How about we take some examples of utilizing the Oracle SELECT statement to see how it functions.

1) query data from a single column

To get the customer names from the customers table, you use the following statement:

The accompanying picture outlines the outcome:


2) Querying data from multiple columns

To question information from various columns, you indicate a list of comma-isolated column names.

The following example shows how to query data from the customer_idname, and credit_limitcolumns of the customer table.

The following shows the result:


3) Querying data from all columns of a table

The accompanying example recovers all rows from all columns of the customer’s table:


To make it handy, you can use the shorthand asterisk (*) to instruct Oracle to return data from all columns of a table as follows:

Note that you should just utilize the reference asterisk (*) for testing purposes. By and by, you ought to expressly indicate the columns from which you need to inquiry data notwithstanding when you want to recover data from all segments of a table.

This is because a table may have more or fewer columns in the future due to the business changes. If you use the asterisk (*) in the application code and assume that the table has a fixed set of columns, the application may either not process the additional columns or access the deleted columns.

In this tutorial, you have learned how to use Oracle SELECT statement to retrieve data from one or more columns of a table.