
Data Structure
Networking
RDBMS
Operating System
Java
MS Excel
iOS
HTML
CSS
Android
Python
C Programming
C++
C#
MongoDB
MySQL
Javascript
PHP
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
Difference Between Schema and Database in MySQL
In MySQL, schema is synonymous with database. As the query is written to create the database, similarly the query can be written to create the schema.
Logical structure can be used by the schema to store data while memory component can be used by the database to store data. Also, a schema is collection of tables while a database is a collection of schema.
To clarify this concept, a database and a schema are created. The steps for this are as follows −
First, a database is created with the following syntax −
create database yourDatabaseName;
The above syntax is used in a query as follows −
mysql> create database DatabaseSample; Query OK, 1 row affected (0.14 sec)
The syntax to create a schema is as follows −
create schema yourSchemaName;
The above syntax is used in a query as follows −
mysql> create schema SchemaSample; Query OK, 1 row affected (0.19 sec)
Now both the database and the schema have been created
To display the database and the schema as well, the show command is used. The query for that is 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, the schema can be used to represent a part of the database.