database issue

Asked

Viewed 61 times

1

List only the names of customers who have made more than 10 car rentals.

inserir a descrição da imagem aqui

I started database a little while ago, if you can give me this strength I appreciate.

created as follows:

select Nome, count(CodAlu) as qte
From Cliente
WHERE CodAlu in ( select CodAlu from Aluga where (CodAlu> 10)) 

that’s right?

  • Do not repeat questions. If you want to add more details just edit the question and add them, you do not need a new question for this.

1 answer

1


The HAVING clause is used to specify filtering conditions in groups of records or aggregations. It is often used in conjunction with the GROUP BY clause to filter the grouped columns.

SELECT c.CodCli, c.Nome, Count(*) qte
  FROM Cliente c INNER JOIN Aluga a ON ( c.CodCli = a.CodCli )
 GROUP BY c.CodCli, c.Nome
HAVING Count(*) > 10

Browser other questions tagged

You are not signed in. Login or sign up in order to post.