Home > Database > Mysql Tutorial > body text

What is the difference between schema and database in MySQL?

王林
Release: 2023-08-25 13:17:07
forward
868 people have browsed it

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;
Copy after login

The above syntax is used in the query as follows -

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

The syntax for creating the schema is as follows -

create schema yourSchemaName;
Copy after login

The above syntax is used in the query as follows -

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

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;
Copy after login

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)
Copy after login

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!

source:tutorialspoint.com
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!