Home  >  Article  >  Database  >  What is the difference between schema and database in MySQL?

What is the difference between schema and database in MySQL?

王林
王林forward
2023-08-25 13:17:07915browse

MySQL 中架构和数据库的区别?

In MySQL, schema is synonymous with database. When writing a query to create Databases, similarly queries can be written to create schemas.

Patterns can use logical structures to store data, while memory components can be Used by databases to store data. Furthermore, a schema is a collection of tables, while a database is Collection of architectures.

To illustrate this concept, a database and schema were created. The steps are as follows -

First, create the database using the following syntax -

create database yourDatabaseName;

The above syntax is used in the query as follows -

mysql> create database DatabaseSample;
Query OK, 1 row affected (0.14 sec)

The syntax for creating the schema is as follows -

create schema yourSchemaName;

The above syntax is used in the query as follows -

mysql> create schema SchemaSample;
Query OK, 1 row affected (0.19 sec)

Now the database and schema are created

To display the database and schema, use the show command. Inquiries about this As follows -

mysql> show databases;

The following is the output of the above query

+--------------------+
| Database           |
+--------------------+
| business           |
| databasesample     |
| hello              |
| information_schema |
| mybusiness         |
| mysql              | 
| performance_schema |
| sample             |
| schemasample       |
| sys                | 
| test               |
+--------------------+
11 rows in set (0.07 sec)

In the oracle database, schema can be used to represent part of the database.

The above is the detailed content of What is the difference between schema and database in MySQL?. For more information, please follow other related articles on the PHP Chinese website!

Statement:
This article is reproduced at:tutorialspoint.com. If there is any infringement, please contact admin@php.cn delete