function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
shivram survaseshivram survase 

Difference between Contact And Contacts

[select id,name,(select name,AccountId from Contacts) from Account where id in(select AccountId from Contact)]

In this SOQL query,What's the difference between Contacts and Contact.I didn't get this relationship.
Please give a hand.
Vishal NegandhiVishal Negandhi
In the first query (from Contacts), you are fetching contacts that are related to the Accounts in your query. This is termed as an Inner query. Contacts is the relationship name.

In the second query, you are querying all Contacts and you're directly fetching them from Contact object, unlike, how you did it in the first query.

Contact = sObject Contact.
Contacts = relationship name for object Contact on Account.
Carolyn CroceCarolyn Croce
As nouns the difference between contacts and contact is that contacts is while contact is the act of touching physically; being in close association.
As verbs the difference between contacts and contact is that contacts is (contact) while contact is to touch; to come into physical contact with. https://www.mymorri.net/
TUSHAR_MATHURTUSHAR_MATHUR
Contact is the API name of the object 'Contact'  and 'Contacts' is its an abbreviation as child of a parent object which we call as Child Relationship Name. 
So by using an object's child relationship name you can query this object's record which are related to your parent record directly by running the query on Parent Object.

Mark this answer as Best if this helps you.

Thanks & Regards,
Tushar Mathur