Selecting an intersection with a fixed given percentage between two tables I working with PostgreSQL and I have two tables: 

Serieses

SeriesID
716
718
214
210          


Viewers

ViewID    SeriesID
10          716
12          718
10          718
15          770
10          210
12          214
12          210


How can I create a query which for each viewer if it has series intersection more than 70% with table serieses I add it to the final result?

In our example we will get: 

Result:

ViewerID
10
12
NOT tested in Postgres, but it should be similar to:

SELECT V.ViewerID
FROM   Viewers AS V
GROUP BY V.ViewerID
HAVING CAST(COUNT(*) AS NUMERIC) 
       &gt; 
       (0.7 * CAST((SELECT COUNT(*) FROM Serieses) AS NUMERIC))