MySQL 教程
/ 管理系統(tǒng)
管理系統(tǒng)
什么是 RDBMS?
RDBMS 代表關(guān)系數(shù)據(jù)庫管理系統(tǒng)。
RDBMS 是一個用于維護關(guān)系數(shù)據(jù)庫的程序。
RDBMS 是所有現(xiàn)代數(shù)據(jù)庫系統(tǒng)的基礎,例如 MySQL、Microsoft SQL Server、Oracle 和 Microsoft Access。
RDBMS 使用 SQL 查詢 來訪問數(shù)據(jù)庫中的數(shù)據(jù)。
什么是數(shù)據(jù)庫表?
表是相關(guān)數(shù)據(jù)條目的集合,由列和行組成。
一列包含有關(guān)表中每條記錄的特定信息。
記錄(或行)是表中存在的每個單獨條目。
查看羅斯文"客戶"表中的選擇:
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 條記錄(行)。
什么是關(guān)系數(shù)據(jù)庫?
關(guān)系數(shù)據(jù)庫以表的形式定義數(shù)據(jù)庫關(guān)系。 這些表相互關(guān)聯(lián) - 基于每個表的共同數(shù)據(jù)。
查看 Northwind 數(shù)據(jù)庫中的以下三個表"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"表的關(guān)系是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"表的關(guān)系是ShipperID列:
Shippers 表
ShipperID | ShipperName | Phone |
---|---|---|
1 | Speedy Express | (503) 555-9831 |
2 | United Package | (503) 555-3199 |
3 | Federal Shipping | (503) 555-9931 |