var user = userContext.Users.First(u => u.Id == 1);
user.Name = "John";
userContext.SaveChanges();
How does EF know that only Name column was changed and hence create the SQL Query to update it?
How does EF keep track of the entities?
Does it keep a copy of the entity in memory after getting it from database, and then compare it with the modified entity from the context?
The short answer is yes. EF keeps “original” copy of data read from database. You can read more on change tracking on MSDN.