10

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?

Jon Raynor
  • 10,905
  • 29
  • 47
user1369975
  • 1,259
  • 4
  • 15
  • 24

4 Answers4

4

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.

Jon Raynor
  • 10,905
  • 29
  • 47
  • ,I understood the meaning of schema,thanks to your explanation but still I have confusion about data model – user1369975 Jun 13 '15 at 04:17
  • In fact the words are often basically interchangeable. In SQL Server, a "schema" is both a database object which represents a grouping of other objects (and performs somewhat the role of a namespace), and it also means a description of the database structure or "data model" as a whole (such as its usage in the term "schema stability lock", which is completely unrelated to the role of the "schema" objects). – Steve Feb 14 '21 at 17:44
1

The database schema is like a blueprint that describes the layout of the data contained in the database: what kinds of fields are present and how they are organized. Here's an example : schema:

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!

Refer to this page for a detailed explanation.

Image taken from: Elmasri & Navathe

0

A database model is otherwise its design - a graphic representation of all its tables and the relationships between them. You can make a database model on a piece of paper or in a database design application. If you use the program for this, you will be able to generate a SQL / DDL script for the database, which will make your work easier. Below an example database model:

example database model

  • 2
    The long-ago accepted answer describes the most common meaning of the word, "schema," but it's also important to point out that not all databases use these terms in exactly the same way. A similar thing could also be said of "data model." So, exactly what do these terms mean to 'you' and 'your' case? *"Well, it depends ..."* Especially when you are comparing two different systems, you might need to **clarify** exactly what these (and other) terms mean, to avoid confusion. – Mike Robinson Feb 14 '21 at 18:18
-2

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.