-1

I hope I don't make myself completely ridiculous, but I'll have to admit that the definition database schema is not 100% clear to me.

I thought it would be some kind of a blueprint for my tables in my database. In terms of entity framework my DbContext would be my 'database schema'.

I began to realize that I am wrong reading this article (suggested in this question), where multi tenancy can be achieved by Shared Database, Separate Schemas.

Can somebody elaborate?

PS: I read this question but that doesn't really answer my somewhat n00bish question...

Community
  • 1
  • 1
bas
  • 12,614
  • 17
  • 59
  • 129

1 Answers1

2

The general understanding is as was explained in the question you referenced

schema : database : table :: floor plan : house : room

That is a schema is the blueprint for you database, and in that sense you DBContext + migrations could loosely be considered a database schema.

However there is also a second way the word schema is used in databases, and that is as a partitioned set (tenant) within the database. This is usually used for security.

All tables are defined within a specific schema (for example DBO) and when you query you are actually querying against tables in a specific schema hence

SELECT * FROM [database].[schema].[table]

To answer your question there are 2 meanings to this, one is the english language meaning of the word, the other is the actual SQL meaning (which is to do with tenancy)

enter image description here

Not loved
  • 32,309
  • 21
  • 118
  • 187