Zum Inhalt springen
View in the app

A better way to browse. Learn more.

Fachinformatiker.de

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

Abfrage Problem

Empfohlene Antworten

Veröffentlicht

Hi,

ich habe folgende Situation:

Oracle10g mit folgenden Tabellen:

Country besteht aus:

NAME (Bsp: Deutschland)

CODE (Bsp: D)

CAPITAL (Bsp: Berlin)

PROVINCE (Bsp: Berlin)

AREA (Bsp: 356910)

POPULATION (Bsp: 80000000)

Borders besteht aus:

COUNTRY1 (Bsp: D)

COUNTRY2 (Bsp: A)

LENGTH (Bsp: 150) Länge der Grenzen

Ich soll nun ein SQL Statement schreiben, dass zu jedem Land die Summe der Fläche seiner Nachbarländer berechnet.

Ich bekomme es einfach nicht hin.

Vielleicht kann mir ja jemand von Euch helfen.

Danke und Gruß

wenn ich es richtig verstanden habe, sieht das ganze wie folgt aus:

select c1.name, sum(c2.area)

from country c1, country c2, borders b1

where b1.country1=c1.code

and b1.country2=c2.code

group by c1.name

Die Anweisung passt aber nur für eine Seite...

Ich hab es jetzt folgendermaßen gemacht:

Ich habe eine View erstellt und dann habe ich eine SQL Anweisung auf die View gemacht.


CREATE VIEW flaechen AS

(

SELECT a.Name, SUM((SELECT area FROM mondial.country WHERE code = b.country2)) AS AREA

	FROM

	mondial.country a

	JOIN

	mondial.borders b

	ON 

	b.Country1 = a.Code

	GROUP BY a.Name

	UNION ALL

SELECT a.Name, SUM((SELECT area FROM mondial.country WHERE code = b.country1)) AS AREA

	FROM

	mondial.country a

	JOIN

	mondial.borders b

	ON 

	b.Country2 = a.Code

	GROUP BY a.Name

	);


	SELECT name, SUM(area) AS AREA

	FROM flaechen

	GROUP BY name

	ORDER BY name ASC;

Dann kommt das richtige Ergebniss raus...

Ist es auch möglich alles in einer Anweisung zu schreiben?

Archiv

Dieses Thema wurde archiviert und kann nicht mehr beantwortet werden.

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.