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.

SQL Abfrage

Empfohlene Antworten

Veröffentlicht

Hallo die Damen und Herren,

ich hab da ein kleines Problem. Ich hab schon rum gegooglet, bin aber leider nicht auf das gewünschte Ergebnis gekommen. Ich habe ein Schulprojekt und eigentlich wollte ich nicht gleich auf fremde Hilfe zurück greifen. Ich sage nur soviel, es hat etwas mit einer CD-Datenbank zu tun, bei der es darum geht, darzustellen welche CD's / Alben ich habe. Keine Angst es handelt sich dabei nicht um illigale Dinge.

Zu dem Problem:

Ich versuche es ein wenig darzustellen :confused:

Ich habe 3 Tabellen

Tabelle Album

ID__Name

1__ AlbumName1

2 __AlbumName2

Tabelle Album_has_Song

AlbumID__SongID

1________1

1________2

1________3

Tabelle Song

ID____Name

1_____SongName1

2_____SongName2

3_____SongName3

Ich möchte nun alle Song die von dem Album 1 sind selektieren. Ich ich hab da irgendwie an ein INNER JOIN gedacht... aber mir ist nicht wirklich klar, wie das gehen soll.

Ich habe es so probiert:

SELECT Song.Name FROM Song INNER JOIN Album_has_Song ON SongId =ID WHERE album_has_song = 1

Das funktioniert so leider nicht... ich habe warscheinlich einen Denkfehler, oder es ist einfach die Unerfahrenheit mit Datenbanken und SQL

Könnt ihr mir bitte weiter helfen... ich stehe echt auf der Leitung

P.S.:Bitte erschlagt mich nicht wenn ihr Rechtschreibfehler findet:rolleyes:

Bearbeitet von Dessou

Hallo Thommy88,

ich hab es so probiert wie du es vorgeschlagen hast. Leider wird auch hier ein Syntaxfehler angezeigt.

Der Fehler lautet: #1064 - You have en error in your SQL syntax; check the manuel that corresponds to your MySQL server version for the right syntax to use near 'WHERE album_has_song.albumid = 1

Limi 0, 30' at Line 1

Hat noch jemand einen anderen Vorschlag?

Trotzdem vielen Dank Thommy für deine Idee

OK ich habe die Lösung selber gefunden. :)

Lösung:

SELECT song.name FROM song INNER JOIN Album_has_song ON song.id = album_has_song.songid WHERE album_has_song_albumid = 1

Vielen Dank für die Hilfe

ungetestet:

SELECT Song.name

FROM Song INNER JOIN Album_has_Song

ON (Song.ID= Album_has_song.SongID)

WHERE Album_has_Song.ID <= 1

edit:

Da war ich wohl zu spät :)

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.