The schema in the database is a collection of database objects, which includes tables, views and other objects. Schema is like a user name. When accessing a data table without specifying which schema it belongs to, the system will automatically add the default schema.
#We will encounter a vague concept in learning databases, which is Schema. Many people don't know much about him. Today I will introduce this concept to you in detail in the article. It has a certain reference function and I hope it will be helpful to everyone.
[Recommended course: Database Tutorial]
Schema Concept
Schema represents a collection of database objects in the database, which contains various objects, such as tables, views, stored procedures, indexes, etc. Generally, one user corresponds to one collection, so in order to distinguish different collections, you need to name different collections. The user's schema name is equivalent to the user name and serves as the user's default schema. So the schema collection looks like the username. For example, when we access a data table, if the table does not indicate which schema it belongs to, the system will automatically add the default schema.
Creation of Schema
It should be noted that the Schema method to be created in different databases is different. The same, but they have a common feature that they all support the CREATE SCHEMA statement
MySQL
In the MySQL database, we can create a database through the CREATE SCHEMA statement
Oracle Database
In Oracle, since the database user has created a schema, the CREATE SCHEMA statement creates a schema, which allows the schema to be used with the table and Views are associated and authorized on these objects, so that you don't have to issue multiple SQL statements in multiple transactions.
SQL Server
In SQL Server, CREATE SCHEMA will create a schema according to the name. Unlike MySQL, the CREATE SCHEMA statement creates a separate definition to the database. model. It is also different from Oracle database in that it actually creates a schema, and once the schema is created, users and objects can be added to the schema.
Summary: The above is the entire content of this article, I hope it will be helpful to everyone
The above is the detailed content of What is Schema in mysql database?. For more information, please follow other related articles on the PHP Chinese website!