Skip to Content
0
Jan 20, 2016 at 05:30 PM

Difference between DEFINE VIEW and ENTITY statements (CDS-views)

589 Views

Hi experts,

I am trying to learn how to work with CDS views and I don't exactly understand what we define with ENTITY statement.

As I understand with DEFINE VIEW we can create a CDS entity. But, then what we create with ENTITY statement. It is clear for me how it works when we write:

DEFINE VIEW <name> AS SELECT FROM <db_table>.

But in the internet I often saw the code like this:

ENTITY Employee
{
  name : String,
};

VIEW MyView AS SELECT FROM Employee
{
...
}

But I don't understnad in this case where we get the data? From which table? Can you please explain me how does it work in this case? And for what we need to define ENTITY if we can do the same it inside DEFINE VIEW statement?

Best Regards,

MIkhail