# How to use SQL SELECT

SQL `SELECT` is a keyword and statement for selecting, retrieving and displaying data in columns and tables. It serves as the foundation for **the majority of queries and actions in SQL**, making it one of the most important tools in the language.

## What is SQL `SELECT`?

The bigger the database, the more difficult it is to retrieve relevant information and records. That’s why `SELECT` is of the most important tools in [SQL](https://www.ionos.com/digitalguide/server/know-how/what-is-sql/) for **efficient queries and statements**. SQL `SELECT` specifies which records and columns you want to find, display and edit.

When combined with other [SQL commands](https://www.ionos.com/digitalguide/server/configuration/sql-commands/), [SQL operators](https://www.ionos.com/digitalguide/server/configuration/sql-operators/) and SQL functions, `SELECT` can perform **comparisons, calculations and pattern-based searches**. For example, [SQL `SELECT DISTINCT`](https://www.ionos.com/digitalguide/server/configuration/sql-select-distinct/) delivers results without duplicates. [SQL `SELECT INTO`](https://www.ionos.com/digitalguide/server/configuration/sql-select-into/) copies data from an existing table into a new one. And [SQL `SELECT TOP`](https://www.ionos.com/digitalguide/server/configuration/sql-select-top/) limits the number of results.

Tip Learn the basics of SQL and get started with this popular database language. Our [SQL introduction with examples](https://www.ionos.com/digitalguide/server/configuration/sql-introduction-with-examples/) provides an overview!

## What is the syntax of SQL `SELECT`?

The basic syntax of SQL `SELECT` looks as follows:

```sql
SELECT  *
FROM  Table
```

It uses the following parameters:

- `SELECT`: Selects the records and columns that are relevant for your query or action. You can name specific columns using primary or foreign keys or use an asterisk `*` to copy all the data in the source table.
- `FROM`: Specifies the table that the records and columns are located in.

Additional optional elements include:

- `WHERE`: An optional [SQL `WHERE`](https://www.ionos.com/digitalguide/server/configuration/sql-where/) clause can be used to set criteria that the data from the source table should fulfill.
- `GROUP BY`: Groups target data in groups or categories.
- `ORDER BY`: Sorts the data that you retrieve using `SELECT` in an order of your choosing. Can be further specified with `ASC` for ascending order or `DESC` for descending.
- `SELECT TOP`: Limits the number of results that are displayed.
- `SELECT DISTINCT`: Removes duplicates from the records in the result table.

## What is SQL `SELECT` used for?

SQL `SELECT` forms the foundation of most queries, making it indispensable for [database management systems](https://www.ionos.com/digitalguide/hosting/technical-matters/database-management-systems-dbms/). It’s used across industries in fields like marketing and sales, human resources, finance, logistics and production.

Here are some practical use cases from different industries:

- Limiting data analyses of tables with customer data to specific columns like “ID”, “Address” or “Name”
- Selecting products or services based on geographic or demographic factors
- Measuring the success of marketing campaigns using keywords like traffic, interactions and conversions
- Individualizing email campaigns, generating leads or creating offers
- Analyzing suspicious transactions using selected records related to average values or threshold values
- Managing employee data or application data
- Monitoring inventory or quality control

Tip You’re looking for a flexible, scalable, individualized server and hosting solution? Then [SQL Server Hosting](https://www.ionos.com/cloud/sql-server-hosting "SQL Server Hosting from IONOS") from IONOS might be right for you – with fast access times, high performance and fail safe security.

## Examples of SQL `SELECT` in use

We’ll now take a closer look at how SQL `SELECT` works, using 2 examples.

### Retrieving customer information

In this example you want to retrieve information from the “Name”, “Address” and “CustomerID” columns in a table called “Customers”:

```sql
SELECT  Name, Address, CustomerID
FROM  Customers
```

### Retrieving and sorting orders from a certain product category

In this next example, you want to retrieve all the orders for electronics products, in the “Product\_category” column in a table called “Orders” and sort them in descending order based on price.

```sql
SELECT  Products, Product_category, Price
FROM  Orders
WHERE  Product_category =  'Electronics'
ORDER BY  Price  DESC
```

## Are there alternatives to SQL `SELECT`?

SQL `SELECT` is a central element in SQL queries and database management. For this reason, there is no alternative function for retrieving information from [databases](https://www.ionos.com/digitalguide/hosting/technical-matters/databases/).


This is a markdown version of: [https://www.ionos.com/digitalguide/server/configuration/sql-select/](https://www.ionos.com/digitalguide/server/configuration/sql-select/) for AI/LLM consumption.