All pastes #982993 Raw Edit

Unbenannt

public text v1 · immutable
·published 2008-04-12 23:00 UTC
rendered paste body
Datenbankschnittstelle zum Ausprobieren: http://scorpius.informatik.uni-mannheim.de:8080/DB2Abfrage.jsp?DB=Terra2
Datenbankschema: http://pi3.informatik.uni-mannheim.de/downloads/hauptstudium/download/terra2schema.html
Datenbankschema als ER-Diagramm: http://pi3.informatik.uni-mannheim.de/downloads/hauptstudium/download/er-diagramm.pdf

Bestimmen Sie den Namen und die Mitgliederzahl der Organisation mit den meisten
Mitgliedstaaten.

select * from Organisation
O_ID  	NAME  	ABKUERZUNG
1 	Abkommen der EWG mit Staaten Afrikas, der Karibik und des Pazifiks 	AKP
27 	Lateinamerikanische Integrationsvereinbarung 	ALADI
36 	Pazifikpakt zwischen Australien, Neuseeland und den USA 	ANZUS
5 	Asiatische Entwicklungsbank 	ASDB
42 	Verband Suedostasiatischer Nationen 	ASEAN
...

select * from ist_Mitglied
L_ID  	O_ID  	ART
172 	25 	volles_Mitglied
172 	33 	volles_Mitglied
...

select * from ist_Mitglied group by O_ID
SQL0119N An expression starting with "L_ID" specified in a SELECT clause, HAVING clause, or ORDER BY clause is not specified in the GROUP BY clause or it is in a SELECT clause, HAVING clause, or ORDER BY clause with a column function and no GROUP BY clause is specified. SQLSTATE=42803 

select count(*) from ist_Mitglied group by O_ID
1
4
13
2
...

select max(count(*)) from ist_Mitglied group by O_ID
SQL0112N The operand of the column function "MAX" includes a column function, a scalar fullselect, or a subquery. SQLSTATE=42607