title: Selecting from a CDS entity versus from a CDS Database view
body: <p>In SAP's ABAP CDS, the <code>define view</code> statement is used to create a CDS view. This object has a CDS entity name, which is how it appears in the editor and packages but it also has an <code>AbapCatalog.sqlViewName</code> annotation that has to be different. <a href="https://help.sap.com/abapdocu_740/en/abencds_f1_define_view.htm" rel="nofollow noreferrer">The documentation of the <code>define view</code> syntax</a> has some information:</p>
  <blockquote>
  <p>Two objects are created for a CDS view (of the ABAP CDS) that is defined using DEFINE VIEW. A name must be specified for each of the two objects:</p>
  <ul>
  <li><p>The name CDS_DB_VIEW of the <strong>CDS database view</strong> must be specified in quotation marks after the annotation @AbapCatalog.sqlViewName. The usual rules for ABAP Dictionary views apply to this name and it is not case-sensitive (it is transformed internally into uppercase letters). The associated SQL view is created under this name on the database.</p>
  </li>
  <li><p>The name cds_entity of the <strong>CDS entity</strong> is defined after the keywords DEFINE VIEW (DEFINE is optional). No quotation marks need to be specified. This name follows the rules of the CDS database view, but it can be 30 places in length.</p>
  </li>
  </ul>
  <p>Both names are in the namespace of the data types in ABAP Dictionary and must each be unique. The two names can be used in other DDL statements or in ABAP programs to access the CDS view.</p>
  </blockquote>
  <p>It mentions some other differences such as the entity not being available in SAP's Data Dictionary tools (SE11, SE16) and the fact that selects from the entity always run in <a href="https://help.sap.com/abapdocu_740/en/abenopensql_strict_mode_740_sp05.htm" rel="nofollow noreferrer">strict mode</a> but the kicker is:</p>
  <blockquote>
  <p>In the DDL of the CDS and in ABAP, <strong>a CDS view can be addressed as a CDS database view</strong> CDS_DB_VIEW <strong>and as a CDS entity cds_entity. It is strongly recommended</strong>, however, <strong>that only the CDS entity is used</strong>.</p>
  </blockquote>
  <p>When I run both in a simple query, I notice that when selecting from the entity there is no MANDT column but this column <em>is</em> present when selecting from the CDS database view.</p>
  <p><strong>So, what are the real differences between the database view and the CDS entity that developers should keep in mind when working with CDS views?</strong></p>