MySQL RDBMS
什么是 RDBMS?
RDBMS 是关系数据库管理系统(Relational Database Management System)的缩写。
RDBMS 是用于维护关系数据库的程序。
RDBMS 是所有现代数据库系统的基础,例如 MySQL、Microsoft SQL Server、Oracle 和 Microsoft Access。
RDBMS 使用 SQL 查询 来访问数据库中的数据。
什么是数据库表?
表是相关数据项的集合,它由列和行组成。
列包含表中每个记录的特定信息。
记录(或行)是表中存在的每个单独的条目。
查看 Northwind 的“Customers”表中的一部分
CustomerID | CustomerName | ContactName | Address | City | PostalCode | Country |
---|---|---|---|---|---|---|
1 |
Alfreds Futterkiste | Maria Anders | Obere Str. 57 | Berlin | 12209 | Germany |
2 | Ana Trujillo Emparedados y helados | Ana Trujillo | Avda. de la Constitución 2222 | México D.F. | 05021 | Mexico |
3 | Antonio Moreno Taquería | Antonio Moreno | Mataderos 2312 | México D.F. | 05023 | Mexico |
4 |
Around the Horn | Thomas Hardy | 120 Hanover Sq. | London | WA1 1DP | UK |
5 | Berglunds snabbköp | Christina Berglund | Berguvsvägen 8 | Luleå | S-958 22 | Sweden |
上面“Customers”表中的列有:CustomerID、CustomerName、ContactName、Address、City、PostalCode 和 Country。该表有 5 条记录(行)。
什么是关系数据库?
关系数据库以表的形式定义数据库关系。表相互关联,基于它们之间共同的数据。
查看 Northwind 数据库中的“Customers”、“Orders”和“Shippers”这三张表
Customers 表
CustomerID | CustomerName | ContactName | Address | City | PostalCode | Country |
---|---|---|---|---|---|---|
1 |
Alfreds Futterkiste | Maria Anders | Obere Str. 57 | Berlin | 12209 | Germany |
2 | Ana Trujillo Emparedados y helados | Ana Trujillo | Avda. de la Constitución 2222 | México D.F. | 05021 | Mexico |
3 | Antonio Moreno Taquería | Antonio Moreno | Mataderos 2312 | México D.F. | 05023 | Mexico |
4 |
Around the Horn | Thomas Hardy | 120 Hanover Sq. | London | WA1 1DP | UK |
5 | Berglunds snabbköp | Christina Berglund | Berguvsvägen 8 | Luleå | S-958 22 | Sweden |
“Customers”表和“Orders”表之间的关系是 CustomerID 列。
Orders 表
OrderID | CustomerID | EmployeeID | OrderDate | ShipperID |
---|---|---|---|---|
10278 |
5 | 8 | 1996-08-12 | 2 |
10280 | 5 | 2 | 1996-08-14 | 1 |
10308 | 2 | 7 | 1996-09-18 | 3 |
10355 |
4 | 6 | 1996-11-15 | 1 |
10365 | 3 | 3 | 1996-11-27 | 2 |
10383 | 4 | 8 | 1996-12-16 | 3 |
10384 | 5 | 3 | 1996-12-16 | 3 |
“Orders”表和“Shippers”表之间的关系是 ShipperID 列。
Shippers 表
ShipperID | ShipperName | Phone |
---|---|---|
1 | Speedy Express | (503) 555-9831 |
2 | United Package | (503) 555-3199 |
3 | Federal Shipping | (503) 555-9931 |