关系数据库非关系数据库_什么是关系数据库?

关系数据库非关系数据库

A database is an application that can store and retrieve data very rapidly. The relational bit refers to how the data is stored in the database and how it is organized. When we talk about a database, we mean a relational database, in fact, an RDBMS: Relational Database Management System.

数据库是可以非常快速地存储和检索数据的应用程序。 关系位是指数据如何存储在数据库中以及如何组织。 当谈到数据库时,我们指的是关系数据库,实际上是RDBMS:关系数据库管理系统。

In a relational database, all data is stored in tables. These have the same structure repeated in each row (like a spreadsheet) and it is the relations between the tables that make it a "relational" table.

在关系数据库中,所有数据都存储在表中。 它们具有在每一行中重复的相同结构(如电子表格),并且表之间的关系使其成为“关系”表。

Before relational databases were invented (in the 1970s), other types of database such as hierarchical databases were used. However relational databases have been very successful for companies like Oracle, IBM, and Microsoft. The open source world also has RDBMS.

在发明关系数据库之前(在1970年代),使用了其他类型的数据库,例如层次数据库。 但是,关系数据库对于Oracle,IBM和Microsoft等公司来说非常成功。 开源世界也有RDBMS。

Commercial Databases

商业数据库

  • Oracle

    Oracle
  • IBM DB 2

    IBM DB 2
  • Microsoft SQL Server

    Microsoft SQL服务器
  • Ingres. The first commercial RDBMS.

    Ingres。 第一个商业RDBMS。

免费/开源数据库 ( Free/Open Source Databases )

  • MySQL

    MySQL
  • PostgresSQL

    PostgreSQL
  • SQLite

    SQLite的

Strictly these are not relational databases but RDBMS. They provide security, encryption, user access and can process SQL queries.

严格来说,这些不是关系数据库,而是RDBMS。 它们提供安全性,加密,用户访问权限,并且可以处理SQL查询。

特德·科德是谁? ( Who Was Ted Codd? )

Codd was a computer scientist who devised the laws of normalization in 1970. This was a mathematical way of describing the properties of a relational database using tables. He came up with 12 laws that describe what a relational database and an RDBMS does and several laws of normalization that describe the properties of relational data. Only data that had been normalized could be considered relational.

Codd是一位计算机科学家,他在1970年设计了归一化定律。这是一种使用表格描述关系数据库属性的数学方法。 他提出了12条定律,描述关系数据库和RDBMS的功能,以及几条规范化定律,描述关系数据的属性。 只有已规范化的数据才可以被认为是相关的。

什么是标准化? ( What Is Normalization? )

Consider a spreadsheet of client records that is to be put into a relational database. Some clients have the same information, say different branches of the same company with the same billing address. In a spreadsheet, this address is on multiple rows.

考虑要放入关系数据库中的客户记录电子表格。 有些客户具有相同的信息,例如同一公司的不同分支机构具有相同的帐单邮寄地址。 在电子表格中,此地址位于多行上。

In turning the spreadsheet into a table, all the client's text addresses must be moved into another table and each assigned a unique ID- say the values 0,1,2. These values are stored in the main client table so all rows use the ID, not the text. A SQL statement can extract the text for a given ID.

在将电子表格转换为表格时,必须将所有客户的文本地址移至另一个表格中,并为每个地址分配一个唯一的ID (例如值0,1,2)。 这些值存储在主客户表中,因此所有行都使用ID,而不是文本。 SQL语句可以提取给定ID的文本。

什么是桌子? ( What Is a Table? )

Think of it as being like a rectangular spreadsheet made up of rows and columns. Each column specifies the type of data stored (numbers, strings or binary data - such as images).

可以将其视为由行和列组成的矩形电子表格。 每列指定存储的数据类型 (数字,字符串或二进制数据-例如图像)。

Unlike a spreadsheet where the user is free to have different data on each row, in a database table, every row can only contain the types of data that were specified.

与电子表格不同,在电子表格中,用户可以自由地在每一行上拥有不同的数据,而在数据库表中,每一行只能包含指定的数据类型。

In C and C++, this is like an array of structs, where one struct holds the data for one row.

在C和C ++,这就像是一个阵列结构 ,其中一个结构保持的数据中的一行。

  • For more information see Normalizing a database in the Database Design part of databases.about.com.

    有关更多信息,请参见databases.about.com的数据库设计部分中的规范化数据库。

在数据库中存储数据有哪些不同的方式? ( What Are the Different Ways of Storing Data in a Database? )

There are two ways:

有两种方法:

  • Via a Database Server.

    通过数据库服务器。
  • Via a Database File.

    通过数据库文件。

Using a database file is the older method, more suited to desktop applications. E.G. Microsoft Access, though that is being phased out in favor of Microsoft SQL Server. SQLite is an excellent public domain database written in C that holds data in one file. There are wrappers for C, C++, C# and other languages.

使用数据库文件是较旧的方法,更适合于桌面应用程序。 EG Microsoft Access,尽管现在已逐步淘汰它,以支持Microsoft SQL Server。 SQLite是一个用C编写的出色的公共领域数据库,将数据保存在一个文件中。 有用于C,C ++, C#和其他语言的包装。

A database server is a server application running locally or on a networked PC. Most of the big databases are server based. These take more administration but are usually faster and more robust.

数据库服务器是在本地或联网PC上运行的服务器应用程序。 大多数大型数据库都是基于服务器的。 这些需要更多的管理,但是通常更快,更强大。

应用程序如何与数据库服务器通信? ( How Does an Application Communicate With Database Servers? )

Generally, these require the following details.

通常,这些要求以下细节。

  • IP or Domain name of the server. If it is the on the same PC as you, use 127.0.0.1 or localhost as the dns name.

    服务器的IP或域名。 如果与您在同一台PC上,请使用127.0.0.1或localhost作为dns名称。

  • Server Port For MySQL this is usually 3306, 1433 for Microsoft SQL Server.

    服务器端口对于MySQL,对于Microsoft SQL Server,通常为3306、1433。

  • User Name and Password

    用户名和密码

  • Name of the Database

    数据库名称

There are many client applications that can talk to a database server. Microsoft SQL Server has Enterprise Manager to create databases, set security, run maintenance jobs, queries and of course design and modify database tables.

有许多可以与数据库服务器通信的客户端应用程序。 Microsoft SQL Server具有企业管理器,可以创建数据库,设置安全性,运行维护作业,查询,当然还可以设计和修改数据库表。

什么是SQL ?: ( What Is SQL?: )

SQL is short for Structured Query Language and is a simple language that provides instructions for building and modifying the structure of databases and for modifying the data stored in the tables. The main commands used to modify and retrieve data are:

SQL是结构化查询语言的缩写,是一种简单的语言,它提供有关建立和修改数据库结构以及修改表中存储的数据的说明。 用于修改和检索数据的主要命令是:

  • Select - Fetches data.

    选择 -获取数据。

  • Insert - Inserts one or more rows of data.

    插入 -插入一行或多行数据。

  • Update - Modifies existing row(s) of data

    更新 -修改现有数据行

  • Delete - Deletes rows of data.

    删除 -删除数据行。

There are several ANSI/ISO standards such as ANSI 92, one of the most popular. This defines a minimum subset of supported statements. Most compiler vendors support these standards.

有几种ANSI / ISO标准,例如最流行的ANSI 92。 这定义了受支持语句的最小子集。 大多数编译器供应商都支持这些标准。

结论 ( Conclusion )

Any nontrivial application can use a database and a SQL-based database is a good place to start. Once you have mastered the configuration and administering of the database then you have to learn SQL to make it work well.

任何不平凡的应用程序都可以使用数据库,而基于SQL的数据库是一个很好的起点。 掌握了数据库的配置和管理后,您必须学习SQL才能使其正常运行。

The speed at which a database can retrieve data is astonishing and modern RDBMS are complex and highly optimized applications.

数据库检索数据的速度惊人,现代RDBMS是复杂且高度优化的应用程序。

Open source databases like MySQL are fast approaching the power and usability of the commercial rivals and drive many databases on websites.

像MySQL这样的开源数据库正在Swift接近商业竞争对手的力量和可用性,并在网站上推动着许多数据库的发展。

How to Connect to a Database in Windows using ADO

如何在Windows中使用ADO连接到数据库

Programmatically, there are various APIs that provide access to database servers. Under Windows, these include ODBC and Microsoft ADO. [h3[Using ADO So long as there is a provider- software that interfaces a database to ADO, then the database can be accessed. Windows from 2000 has this built in.

以编程方式,有各种API提供对数据库服务器的访问。 在Windows下,这些包括ODBC和Microsoft ADO。 [h3 [使用ADO,只要有一个将数据库连接到ADO的提供程序软件,就可以访问该数据库。 Windows 2000内置了此功能。

Try the following. It should work on Windows XP, and on Windows 2000 if you've ever installed MDAC. If you haven't and want to try this, visit Microsoft.com, do a search for "MDAC Download" and download any version, 2.6 or higher.

尝试以下方法。 它应该可以在Windows XP和Windows 2000(如果您曾经安装过MDAC)上运行。 如果您还没有想要尝试,请访问Microsoft.com,搜索“ MDAC Download”并下载2.6或更高版本。

Create an empty file called test.udl. Right click in Windows Explorer on the file and do "open with", you should see Microsoft Data Access - OLE DB Core Services". This dialog lets you connect to any database with an installed provider, even excel spreadsheets!

创建一个名为test.udl的空文件。 在Windows资源管理器中右键单击该文件,然后执行“打开方式”,您应该会看到“ Microsoft数据访问-OLE DB核心服务” 。此对话框可让您连接到具有已安装的提供程序的任何数据库,甚至包括Excel电子表格!

Select the first tab (Provider) as opens by default at the the Connection tab. Select a provider then click Next. The data source name shows the different types of device available. After filling in username and password, click the "Test Connection" button. After you press the ok button, you can open the test.udl with file with Wordpad. It should contain text like this.

选择第一个选项卡(提供程序),默认情况下在“连接”选项卡上打开。 选择一个提供程序,然后单击下一步。 数据源名称显示了可用的不同类型的设备。 填写用户名和密码后,单击“测试连接”按钮。 按确定按钮后,可以使用写字板打开带有文件的test.udl。 它应该包含这样的文本。


[oledb]
; Everything after this line is an OLE DB initstring
Provider=SQLOLEDB.1;Persist Security Info=False;User ID=sa;Initial Catalog=dhbtest;Data Source=127.0.0.1

The third line is the important one, it contains the configuration details. If your database has a password, it will be shown here, so this is not a secure method! This string can be built into applications that use ADO and will let them connect to the specified database.

第三行很重要,它包含配置详细信息。 如果您的数据库有密码,它将显示在此处,因此这不是安全的方法! 可以将该字符串内置到使用ADO的应用程序中,并使它们连接到指定的数据库。

使用ODBC ( Using ODBC )

ODBC (Open Database Connectivity) provides an API based interface to databases. There are ODBC drivers available for just about every database in existence. However, ODBC provides another layer of communication between an application and the database and this can cause performance penalties.

ODBC (开放数据库连接)提供了一个基于API的数据库接口。 几乎每个现有数据库都有可用的ODBC驱动程序。 但是,ODBC在应用程序和数据库之间提供了另一层通信,这可能会导致性能下降。

翻译自: https://www.thoughtco.com/what-is-a-relational-database-958324

关系数据库非关系数据库

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值