// child to parent SOQL
Contact singleContact = [SELECT Id, Name, Phone,MobilePhone,Email,
Account.Name,Account.Phone
FROM Contact WHERE Name ='John Bond' LIMIT 1];
System.debug(singleContact);
// Child
system.debug(singleContact.Id);
system.debug(singleContact.Name);
system.debug(singleContact.Phone);
system.debug(singleContact.MobilePhone);
system.debug(singleContact.Email);
// Parent
system.debug(singleContact.Account.Name);
system.debug(singleContact.Account.Phone);
// Generic SOBJECT
Sobject singleConSobj = [SELECT Id, Name, Phone,Email,
Account.Name,Account.Phone
FROM Contact WHERE Name ='John Bond' LIMIT 1];
System.debug(singleConSobj);
// child
System.debug(singleConSobj.get('id')); // singleConSobj.id;
System.debug(singleConSobj.get('Name'));
System.debug(singleConSobj.get('Phone'));
System.debug(singleConSobj.get('Email'));
// Parent
System.debug(singleConSobj.getSobject('Account').get('Name'));
System.debug(singleConSobj.getSobject('Account').get('Phone'));