dbms数据库管理系统
DBMS数据库语言 (DBMS Database languages )
Database languages are the languages that provide the facility to specify the database schema and to express database queries and updates. They are further divided into four categories but all are purposed to provide the facilities in their specific ways and the most widely used database language is SQL language.
数据库语言是提供用于指定数据库架构以及表达数据库查询和更新的工具的语言。 它们被进一步分为四类,但是所有的目的都是以其特定的方式提供这些功能,并且使用最广泛的数据库语言是SQL语言。
Let us understand the basics of the Database Languages, what's their task are and how they perform it.
让我们了解数据库语言的基础知识,它们的任务是什么以及它们如何执行。
1)数据定义语言 (1) Data Definition Language)
A Data Definition Language is a special kind of language that used to specify the database schema by the set of definitions. DDL is also purposed to specify the additional properties of the data.
数据定义语言是一种特殊的语言,用于通过定义集指定数据库架构。 DDL还旨在指定数据的其他属性。
There is a special type of DDL named as Data Storage and Definition language that specify the storage structure and access methods used by the database system. The hidden details for the implementation of the database schemas from the users are defined by these statements. Also, the data values that are stored in the database are required to satisfy certain consistency constraints.
有一种特殊的DDL类型,称为数据存储和定义语言 ,用于指定数据库系统使用的存储结构和访问方法。 这些语句定义了用户对数据库模式实施的隐藏详细信息。 而且,需要存储在数据库中的数据值满足某些一致性约束 。
For e.g. – A university is required to fulfill the criteria of the marks of the students never be negative. DDL provides facilities to specify such type of constraints. Every time the database gets updated, these constraints are being checked by the database system. These constraints can refer to the arbitrary predicate for the database. But these arbitrary predicates are costly for the tests. Therefore, in that case, integrity constraints are implemented by the database systems so that these constraints can be tested with less overhead and more accuracy.
例如 -要求一所大学达到学生分数标准,决不能是负面的。 DDL提供了指定这种约束类型的工具。 每次更新数据库时,数据库系统都会检查这些约束。 这些约束可以引用数据库的任意谓词。 但是这些任意谓词对于测试而言是昂贵的。 因此,在那种情况下,完整性约束由数据库系统实现,以便可以用更少的开销和更高的准确性来测试这些约束。
Domain Constraints
域约束
These are the most basic form of integrity constraint. In the database, they can be easily tested by the system every time a new data item is entered. Domain needs to be related to every attribute such as integer, character, date/time types. These attributes related to domain further acts as constraints on the values associated with it.
这些是完整性约束的最基本形式。 在数据库中,每次输入新数据项时,系统都可以轻松测试它们。 域需要与每个属性相关,例如整数,字符,日期/时间类型。 与领域相关的这些属性进一步充当对与其相关联的值的约束。
Referential Integrity
参照完整性
Referential integrity means the value that is in the one relation must also appear in a certain set of attributes in another relation.
引用完整性表示一个关系中的值也必须出现在另一个关系中的一组特定属性中。
Modifications in the database could turn out to violate the referential integrity and such actions are rejected by the normal procedure.
数据库中的修改可能会违反参照完整性,并且此类操作将被常规过程拒绝。
Assertions
断言
Assertions are the conditions that are needed to be satisfied by the database. The above two constraints, Domain Constraints and Referential Integrity Constraints are the special forms of assertions.
断言是数据库需要满足的条件。 以上两个约束(域约束和引用完整性约束)是断言的特殊形式。
System checks for the validity of the assertion and if it does not fit the validity criteria, no further modifications are done to the database.
系统检查断言的有效性,如果不符合有效性标准,则不会对数据库做进一步的修改。
Authorization simply means to provide access or permission to the differentiated users on various data values in the database.
授权只是意味着对数据库中的各种数据值向有区别的用户提供访问或许可。
Most common authorizations are:
最常见的授权是:
- Read Authorization – It only allows the user to read the data.读取授权 –仅允许用户读取数据。
- Insert Authorization – It only allows the user to insert the data.插入授权 –仅允许用户插入数据。
- Update Authorization – It only allows the user to modify the data.更新授权 –仅允许用户修改数据。
- Delete Authorization – It only allows the user to delete the data.删除授权 –仅允许用户删除数据。
DDL acts like any other programming language, in which an input is taken by the user and the output is generated. These outputs are further stored in the Data Dictionary.
DDL与任何其他编程语言一样,由用户接受输入并生成输出。 这些输出进一步存储在数据字典中。
2)数据处理语言 (2) Data-Manipulation Language)
Data Manipulation Language (DML) is a language that provides the facility to access or manipulate the data to the user. There is various type of access, such as, retrieval, insertion, modification, and deletion of the information that is stored in the database.
数据操作语言(DML)是一种语言,它提供了访问或操作用户数据的工具。 有各种类型的访问,例如,对数据库中存储的信息的检索,插入,修改和删除 。
DML are further classified into two types:
DML进一步分为两种类型:
Procedural DMLs
程序DML
It is required from the user to specify what type of data is needed and how one can reach up to that data.
用户需要指定所需的数据类型以及如何获取该数据。
Declarative DMLs
声明性DML
These are also referred to a
这些也称为
Non – Procedural DML that requires from the user only to specify what type of data is needed and it doesn't specify how to reach up to that data.
非–程序DML ,仅要求用户指定所需的数据类型,而未指定如何获取该数据。
Declarative DMLs are easy to learn and use than Procedural DMLs.
声明性DML比过程DML更易于学习和使用。
But in
但在
Declarative DMLs when the user doesn’t specify how to reach up to that data, this is the responsibility of the database system to figure out itself how to do so.
当用户不指定如何到达该数据时,使用声明式DML ,这是数据库系统自行确定如何做到的。
The query is a statement that requests for the retrieval of the information. Query Language is the portion of the DML that involves information retrieval. Therefore, Query Language and Data Manipulation Language, these terms are used synonymously, although they are technically incorrect.
该查询是请求检索信息的语句。 查询语言是DML中涉及信息检索的部分。 因此,“ 查询语言”和“ 数据操作语言”在技术上不正确,但它们是同义词。
3)数据控制语言 (3) Data Control Language)
Data Control Language provides the facility of the authorization in the database. All the commands used in DDL and DML can further be authorized with DCL.
数据控制语言提供了数据库中授权的便利。 DDL和DML中使用的所有命令都可以进一步通过DCL授权。
The drawback of DCL is that one cannot rollback the command as DCL allows only implicit commit. This mainly occurs in Oracle Database. Some of the commands of DCL are:
DCL的缺点是无法回滚该命令,因为DCL仅允许隐式提交。 这主要发生在Oracle数据库中。 DCL的一些命令是:
Grant: It allows only specific user to perform specific tasks.
授予:仅允许特定用户执行特定任务。
Revoke: It allows the cancellation of the previously granted permissions or the denied one.
吊销:它允许取消先前授予的权限或被拒绝的权限。
4)交易控制语言 (4) Transaction Control Language)
Transaction Control Language is used to manage the transactions in the database. The functions performed by DML are further managed by this language. It allows the statements to be grouped together into logical transactions. TCL performs the following tasks:
事务控制语言用于管理数据库中的事务。 DML执行的功能由该语言进一步管理。 它允许将语句组合在一起成为逻辑事务。 TCL执行以下任务:
Commit: It is used to save the transaction in the database.
提交:用于将事务保存在数据库中。
Rollback: It is used to restore the database to the last committed state.
回滚:用于将数据库还原到最后的提交状态。
Savepoint: It is used to store the transaction temporarily such that one can easily rollback to the transaction when needed.
保存点:用于临时存储事务,以便在需要时可以轻松回滚到该事务。
翻译自: https://www.includehelp.com/dbms/database-languages-in-dbms.aspx
dbms数据库管理系统