> For the complete documentation index, see [llms.txt](https://skilly.gitbook.io/mysql/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://skilly.gitbook.io/mysql/teoria-8/04.05_manejando_restricciones.md).

# Restricciones

## Crear

```sql
CREATE TABLE productos (
    id INT PRIMARY KEY,
    nombre VARCHAR(50) NOT NULL,
    precio DECIMAL(10,2),
    descripcion TEXT,
    CONSTRAINT uk_nombre UNIQUE (nombre)
);
```

## Añadir

```sql
ALTER TABLE productos
ADD CONSTRAINT no_nulo_nombre
NOT NULL (nombre);
```

## Modificar

```sql
ALTER TABLE clientes MODIFY email VARCHAR(255) NOT NULL;
```

## Eliminar

```sql
ALTER TABLE clientes DROP INDEX email;
```
