The Commercial and Government Entity code is a five-character identifier assigned to every company registered in SAM. Here is where it comes from, what it is used for, and how it relates to the Unique Entity ID.
Federal contracting comes with its own alphabet. Here is what the Unique Entity ID, CAGE code, NAICS codes and PSCs are, and where each one comes from.