The NOT keyword
Parte de la sección Fundamentos del Journey de SQL de Coddy — lección 8 de 72.
La palabra clave NOT significa que no queremos que se cumpla la condición.
Por ejemplo, considera la siguiente tabla <strong>people</strong>:
| name | age | gender |
|---|---|---|
| Joas | 13 | male |
| Holwa | 17 | male |
| Nohlas | 24 | female |
| Polar | 23 | male |
| Loopa | 18 | female |
SELECT *
FROM people
WHERE NOT gender = 'male'Este será el resultado:
| name | age | gender |
|---|---|---|
| Nohlas | 24 | female |
| Loopa | 18 | female |
La palabra clave NOT básicamente invierte la condición. Por ejemplo, las siguientes consultas son equivalentes:
WHERE age > 20WHERE NOT age <= 20Desafío
FácilTablas y columnas disponibles:
<strong>people</strong>:<strong>name</strong>,<strong>age</strong>,<strong>status</strong>
Obtén todas las personas donde el status NO sea retired
Pruébalo tú mismo
SELECT *
FROM PEOPLE
-- Escribe tu código debajo
WHEREEsta lección incluye un breve cuestionario. Empieza la lección para responderlo y registrar tu progreso.
Todas las lecciones de Fundamentos
4More Keywords
The IN keywordThe BETWEEN keywordThe LIKE keywordThe AS keywordRecap - Cellphone Models2Conditions
Conditions BasicsThe AND keywordThe OR keywordThe NOT keywordMultiple Conditions CombinedParenthesisBooleans5Arithmetic Operations
Mathematical OperatorsMathematical ColumnsThe Modulo OperationThe ROUND() Function3Specific Return Format
Null valuesSort Results Part 1Sort Results Part 2Recap - Cyber Security FirmLimit number of recordsRecap - Vehicle Factory6Intro Challenges
Recap - Parliamentary ElectionRecap - Police Criminal ArrestRecap - Bar Beverage ContainerRecap - Engineer new columns