# SELECT & WHERE — MySQL

Source: https://www.geekswithgeeks.com/en/mysql/sql-select-where

> Read rows back, and filter them with WHERE.

## SELECT basics

`SELECT` reads columns from a table; `*` means every column.

```sql
SELECT name, email FROM customers;
```

Output:

```
name        | email
Asha Rao    | asha@example.com
Rahul Mehta | rahul@example.com
Priya Nair  | priya@example.com
```

## Filtering with WHERE

`WHERE` keeps only rows matching a condition. Comparison operators: `=`, `!=` (or `<>`), `<`, `>`, `<=`, `>=`.

```sql
SELECT name FROM customers
WHERE email LIKE '%example.com';
```

Output:

```
name
Asha Rao
Rahul Mehta
Priya Nair
```

## AND / OR / IN / BETWEEN

Combine conditions with `AND`/`OR`, check a set with `IN (1,2,3)`, and a range with `BETWEEN 10 AND 20`.
