0
Let’s start by analyzing your table diagram.
Given your problem, just two tables of all the informed ones are important to find what you need.
Notice that there is a table Cliente
and a table Conjuge
. Both relate through the column Cod_Cli
, how can you tell by the yellow "key" that connects one another.
That said, we can understand that only married (or dating) customers will have a spouse, that is, they will have their code referenced in the table Conjuge
.
Therefore, we have set up an SQL command that will count how many clients do not have their code referenced in the table Conjuge
, thus identifying single customers:
SELECT COUNT(cliente.Cod_Cli)
FROM Cliente cliente
WHERE cliente.Cod_Cli NOT INT (SELECT conj.Cod_Cli FROM Conjuge conj);
have you tried anything? you can post??
– rLinhares