Gib natürlichsprachlich wieder, wonach folgende SQL-Anfrage sucht:

with ProdAct as (
	select
		Prod.Name as PName,
		Act.Name as AName,
		count(Act.movie_id) as CountM
	from (
		select name, movie_id from actors
		union all
		select name, movie_id from actresses
	) as Act
	inner join movies as Mov on Act.movie_id = Mov.mid
	inner join producers as Prod on Mov.mid = Prod.movie_id
	group by Prod.Name, Act.Name
	order by Prod.Name, Act.Name
)

select ProdAct.AName, ProdAct.PName, CountM
from ProdAct,
	(
	select AName, max(CountM) as maxValue
	from ProdAct group by AName
	) as maxCount
where ProdAct.AName = maxCount.AName
and ProdAct.CountM = maxCount.maxValue
Solution
  • Zeige den Namen jedes Schauspielers und jeder Schauspielerin, den Namen des Producers mit dem er/sie die meisten Filme gedreht hat und die Anzahl der gedrehten Filme.

  • URL:
  • Language: Deutsch
  • Subjects: Databases
  • Type: Name
  • Duration: 20min
  • Credits: 5
  • Difficulty: 0.4
  • Tags: sql query
  • Note:
    HPI, 2015-06-01, Datenbanksysteme 1, Aufgabe 3.4a
  • Created By: ad-si
  • Created At:
    2015-07-27 08:40:16 UTC
  • Last Modified:
    2015-07-27 08:40:16 UTC