I was just starting with reading a book about databases and encountered schemas and data models. I read that schema is the structural design of a database and data model is a set of conceptual tools to describe the data and the relationships like Er model etc. I don't get the real sense of difference between the two. Is schema actually a file in Dbms and data model is just a concept?
A schema is collection of database objects that are logically grouped together. These can be anything, tables, views, stored procedure etc. Schemas are typically used to logically group objects in a database. For example, an application that has reporting and auditing components may have 2 schemas called reporting and auditing with a collection of tables, stored procedures etc. With Schemas, one can segregate out the reporting objects and audit objects. One can also create different security accounts which can only access a specific schema. A fully qualified name will include the schema. For example:
SELECT * FROM [Test].[dbo].[Person]
Test is the database. dbo is the schema. Person is the table.
A data model in a database should be relational which means it is described by tables. The data describes how the data is stored and organized. A data model may belong to one or more schemas, typically usually it just belongs to one schema.
The person table will be a part of a number of tables and relations that make up the data model.
Changing the schema changes the structure of your particular database.
But what happens when you want to change the very nature of what can be specified in a schema file? : That means a change to the data model used by the database software.
Unlike the schema, the data model is not isolated in a separate file for easy changing, but rather is hard-coded right in the software itself, so changes to it can have a profound impact on the database programs. One example of a data model would the Relational model.
Changing the data model would mean something like switching to a new data model such as semantic data model. That would change the entire structure of the database management software!
Image taken from: Elmasri & Navathe
Data model is a generic model used to analyse and design a database. Database model is a logical conversion of the entity relation model necessary to construct a database.