Difference between Data Model and Database Schema in DBMS?

后端 未结 7 2259
鱼传尺愫
鱼传尺愫 2020-12-25 11:47

I know the Data Model is basically two types ER-Model and Relational Model & Database schema is also two type Physical and logical.

But I can not understand what

7条回答
  •  慢半拍i
    慢半拍i (楼主)
    2020-12-25 12:28

    A schema can have multiple models related with it and each model can have multiple instances related with it.

    for eg.

    animalSchema{name:String, type:String}
    
    mongoose.model('carnivores', animalSchema)
    

    It simply means that carnivores is a model that is based on animalSchema.

    mongoose.model('herbivores', animalSchema).
    

    It simple means that herbivores is a model that is also based on animalSchema.

    const lion = new carnivores();
    
    const tiger = new carnivores();
    

    These both are the instances of the carnivores model of the schema animalSchema

    const deer = new herbivores();
    
    const cow = new herbivores();
    

    These both are the instances of the herbivores model of the schema animalSchema

提交回复
热议问题