Q:

Selecting Data from a different Table through the value of a other table

REPLACE INTO `Lehrling` (`idLehrling`,`Nachname`,`Vorname`,`Aufnahmedatum`,`Austrittsdatum`,`Klasse`,`Klassensprecher`,`Betriebe_idBetriebe`,`Ausbildungsberufe_idAusbildungsberufe`,`Credentials_idCredentials`) VALUES (1,'Krahn','Daniel','09.02.2015','31.12.2015','FI31',0,1,3,1);

REPLACE INTO `Credentials` (`idCredentials`,`Benutzername`,`Passwort`,`Anlegedatum`) VALUES (1,'krahnd','osz123','10.02.2015');

My goal is to select Nachname,Vorname from 'Lehrling' where Klasse is 'FI31' and also select Benutzername,Passwort from Credentials through the 'idCredentials' at the same time.

A:

This process is called joining:
Select Lehrling.Nachname, Lehrling.Vorname, Credentials.Benutzername, Credentials.Passwort
    From Lehrling
        inner join Credentials on Credentials.idCredentials = Lehrling.Credentials_idCredentials
    Where Lehrling.Klasse = 'FI31'

