What is a Schema

在这里插入图片描述

In this case, the schema diagram has been separated into four sections:

Customer Data: Data related to the customers, such as their name, address, etc
Business: Data required to run the business, such as staff, store locations, payment details, etc
Inventory: Details on all products. In this case the products are movies, so it contains data such as movie title, its category, the actors, etc.
Views: Special view on data used for appraisals.

So by looking at these schema diagrams, we could go ahead and create a database.
You can try by MySQl workbench, which allows you to :

1.generate a CREATE TABLE script straight from the diagram.
How to Generate a Script from a Diagram in MySQL Workbench
2.You can then use the script to create a database.
How to Create a Database from a Script in MySQL
3.You can even reverse engineer a database into a diagram.

Is a Schema and a Database the same thing?
Depending on the RDBMS you use, schemas and databases may or may not be the same thing.
MySQL:a schema is synonymous with a database
Conceptually, a schema is a set of interrelated database objects, such as tables, table columns, data types of the columns, indexes, foreign keys, and so on.

*Substitute the keyword SCHEMA instead of DATABASE in MySQL SQL syntax:CREATE SCHEMA instead of CREATE DATABASE*

Oracle:certain objects can be stored inside a database but not inside a schema. Therefore, a schema and a database are two different things.
A schema is a collection of logical structures of data, or schema objects. A schema is owned by a database user and has the same name as that user. Each user owns a single schema.

CREATE USER statement creates the schema.

In Oracle, CREATE SCHEMA statement lets you populate your schema with tables and views and grant privileges on those objects without having to issue multiple SQL statements in multiple transactions.
SQL Sever: a schema is a separate entity inside the database. So, they are two different things.
In SQL Server, once you create the schema, you can then add users and objects to it.

Conclusion
The term schema can be used within many different contexts. In the context of creating schemas within a specific database management system, you’ll need to work with however that DBMS defines schemas.

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值