
- Learn MySQL
- MySQL - Home
- MySQL - Introduction
- MySQL - Installation
- MySQL - Administration
- MySQL - PHP Syntax
- MySQL - Connection
- MySQL - Create Database
- MySQL - Drop Database
- MySQL - Select Database
- MySQL - Data Types
- MySQL - Create Tables
- MySQL - Drop Tables
- MySQL - Insert Query
- MySQL - Select Query
- MySQL - Where Clause
- MySQL - Update Query
- MySQL - Delete Query
- MySQL - Like Clause
- MySQL - Sorting Results
- MySQL - Using Join
- MySQL - NULL Values
- MySQL - Regexps
- MySQL - Transactions
- MySQL - Alter Command
- MySQL - Indexes
- MySQL - Temporary Tables
- MySQL - Clone Tables
- MySQL - Database Info
- MySQL - Using Sequences
- MySQL - Handling Duplicates
- MySQL - SQL Injection
- MySQL - Database Export
- MySQL - Database Import
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.
- Related Articles
- Difference between Star Schema and Snowflake Schema?
- Difference Between Schema and Instance
- Difference between Star schema and Snowflake schema in SQL Server
- Methods for tracking database schema changes in MySQL?
- Difference Between Star and Snowflake Schema
- Difference between _SYS_BIC and _SYS_BI schema in SAP HANA
- Difference between Hierarchical Database and Relational Database
- What are some good tools to visualize MySQL database schema?
- Difference between Database and a Blockchain
- Checking schema creation in SAP HANA database
- Different schema types in SAP HANA database
- How do I show the schema of a table in a MySQL database?
- Difference between a data warehouse database and an OLTP database?
- Difference between Data Warehouse and Operational Database
- Difference between Operational Database and Data Warehouse?
