What is the difference between SCHEMA and DATABASE?

Asked

Viewed 7,405 times

5

I had never used Mysql Workbench and it instead of database, gives me the option of SCHEMA. What is the difference between the two? It gives in the same one or the other?

2 answers

5


According to the mysql documentation:

schema Conceptually, a schema is a set of interrelated database Objects, such as Tables, table Columns, data types of the Columns, Indexes, Foreign Keys, and so on. These Objects are Connected through SQL syntax, because the Columns make up the Tables, the Foreign Keys refer to Tables and Columns, and so on. Ideally, they are also Connected logically, Working Together as part of a Unified application or Flexible framework. For example, the INFORMATION_SCHEMA and performance_schema Databases use "schema" in their Names to emphasize the close relationships between the Tables and Columns they contain.

In Mysql, physically, a schema is synonymous with a database. You can substitute the keyword SCHEMA Instead of DATABASE in Mysql SQL syntax, for example using CREATE SCHEMA Instead of CREATE DATABASE.

In free translation:

Conceptually, a schema is a set of database objects inter-related, such as tables, columns, data types, indexes, foreign keys and so on. These objects are connected through SQL syntax, because the columns compose the tables, keys foreign reference these columns, and so on. Ideally they are also connected logically, working together as part of a unified application or flexible structure. For example, INFORMATION_SCHEMA and performance_schema databases use "schema" in their names to emphasize close relationships between the tables and columns they contain.

In Mysql, physically, a schema is synonymous with a database. You can replace the SCHEMA keyword with DATABASE in the syntax Mysql SQL, for example, using CREATE SCHEMA instead of CREATE DATABASE.

That is, we can understand that a schema is a database.
For references only, in other databases the concept of schema may be slightly different (in Oracle for example a schema is a set of tables and other objects, while a database is wider, possessing a set of schemas).

4

In Mysql they are synonymous.

According to the documentation of Mysql:

In Mysql, physically, a schema is synonymous with a database. You can substitute the keyword SCHEMA Instead of DATABASE in Mysql SQL syntax, for example using CREATE SCHEMA Instead of CREATE DATABASE.

Some other database products draw a Distinction. For example, in the Oracle Database product, a schema represents only a part of a database: the Tables and other Objects owned by a single user.

Translating:

In Mysql, physically, a "schema" is synonymous with a database. You can replace the SCHEMA keyword instead of DATABASE in Mysql’s SQL syntax, for example by using CREATE SCHEMA instead of CREATE DATABASE.

Some other database products make a distinction. For example, in the Oracle Database product, a schema represents only a part of a database: tables and other objects belonging to a single user.

Browser other questions tagged

You are not signed in. Login or sign up in order to post.