What is the difference between SCHEMA and DATABASE?

3

I had never used the MySQL Workbench and it instead of database, gives me the option of SCHEMA. What's the difference between the two? Does it give one or the other?

    
asked by anonymous 18.07.2018 / 15:54

2 answers

2

According to MySQL documentation :

  

schema Conceptually, the 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, the 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.

Free translation:

  

Conceptually, a schema is a set of database objects   interrelated, such as tables, columns, data types, indexes,   foreign keys and so on. These objects are connected   through SQL syntax, because the columns make up the tables, keys   refer to these colums, 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 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. Just for references, 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, whereas a database of data is broader, having a set of schemas ).

    
18.07.2018 / 16:24
2

In MySQL they are synonymous.

According to the MySQL documentation:

  

In MySQL, physically, the 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, the schema represents only a part of the 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 the MySQL SQL syntax, for example, 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 part of a database: tables and other objects belonging to a single user.

    
18.07.2018 / 16:16