0

I'm a beginner in DBMS, sorry if my question sounds dumb. I often see some textbooks says: create a schema . does it that mean "create a database"?

But isn't that a schema is also a skeleton of a table? don't we often describe a table's structure such as column name/column type using schema? so does schema a table concept or database concept?

  • Which RDBMS system are you referring to? In Oracle, a schema is different to a schema in SQL Server. – Randolph West Jul 17 at 3:00
  • @RandolphWest I mean sql server – slowjams Jul 17 at 4:27
3

This is for SQLServer, databases and schemas are different in other DBMS like Oracle.

A database and a schema are two different concepts. A database can contain multiple schemas, for example the default schema 'dbo'

You can address a table by specifiying database.schema.tablename.

Schemas are often used for security reasons, cause you can have one database, multiple schemas, and you can give permissions on the schemas. That way you don't have to specify permissions for each of the objects in the database. Eg. HR users have select permissions on the entire HR schema, while IT only has select permissions on the IT schema

It also gives you a nice grouping of objects that belong together.

Some more useful information: http://www.abstractnew.com/2014/11/database-vs-schema-in-database-systems.html https://www.brentozar.com/archive/2010/05/why-use-schemas/

  • but I also see online resource describe schemas as skeletons of tables, why the schema concept is different here? – slowjams Jul 17 at 23:18
  • A schema in general databases design refers to the design of table or tables without the data. That’s why I asked in the original place what the context was. – Randolph West Jul 18 at 6:39

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.