In SQL where clauses and having clauses are used to filter data. Where clauses are fairly straight forward but having clauses are a bit trickier. Where clauses filter the data as it is in the table…