Retrieve Parent Record From Child Record in Salesforce

In below example “Project” is the custom Child object, and “Student” is the custom Master object.

Controller:

public class SampleController
{
    //Contact List Variable
    public List<Project__c> proList {get;set;}
    
    //Constructor
    public SampleController(){
        proList = [SELECT Id, Name, Student__r.Name FROM Project__c LIMIT 10];
    }    
}

Visualforce Page:

<apex:page controller="SampleController">
    <apex:form >
        <apex:pageBlock >
            <apex:pageBlockTable value="{!proList}" var="pro">
                <apex:column value="{!pro.Name}"/>
                <apex:column value="{!pro.Student__r.Name}"/>
            </apex:pageBlockTable>
        </apex:pageBlock>
    </apex:form>
</apex:page>

Output: