Is there any way to in SQL I get all the data except an ID?
For example (I know this does not exist in SQL)
Select * From Utilizadores Where id_ut != 1;
Is there any way to in SQL I get all the data except an ID?
For example (I know this does not exist in SQL)
Select * From Utilizadores Where id_ut != 1;
In addition to the way you've already done in your question, where you use not equal to (! =), you can do it in other ways:
Using other than :
Select * From Utilizadores Where id_ut <> 1;
Using not in :
Select * From Utilizadores Where id_ut not in (1);
/*Usando o not in, você pode passar uma lista de valores (1,2,10)*/
Remembering that you can use these 3 operators ( <>
, !=
, not in
) not only with numeric values, but with texts as well.
For example:
Select * From Utilizadores Where nome_ut not in ('João', 'Pedro', 'Maria');
Select * From Utilizadores Where nome_ut <> 'João';
Select * From Utilizadores Where nome_ut != 'João';
Hi, do this:
Select * From Utilizadores Where id_ut <> 1;