Coursera 笔记

Module 01 · Relational Database Concepts

Hands-on Lab: Relational Model Concepts动手实验:关系模型概念

Coursera ↗

Estimated time needed: 10 minutes
预计所需时间:10 分钟

In this module, you have learned the concepts of a relational model, including entity, attribute, relation, degree, and cardinality.
在本模块中,您学习了关系模型的概念,包括实体、属性、关系、度数和基数。

Now, in this lab, let's apply the concepts learned in this module to a real-world example of a database.
现在,在本实验中,让我们将本模块中学到的概念应用于一个真实的数据库示例。

Objectives 目标

After completing this lab, you will evaluate your knowledge of relational model concepts.
完成本实验后,您将评估自己对关系模型概念的知识掌握程度。

Exercise 练习

In this exercise, you will work on a relational database schema called Car Dealership, which someone designed to track automobile sales in a car dealership.
在本练习中,您将处理一个名为“汽车经销商”的关系数据库模式,该模式旨在跟踪汽车经销商的汽车销售情况。

Schema diagram for the Car Dealership relational database 汽车经销商关系数据库的模式图

Relational instance of SALE SALE 的关系实例

Now let us go through some questions based on the database schema of Car Dealership and relational instance of SALE:
现在,让我们根据汽车经销商的数据库模式和销售的关系实例来回答一些问题:

  1. How many relations does the Car Dealership database schema contain?
    汽车经销商数据库模式包含多少个关系?
    Hint 提示:A relation is also the mathematical term for a table.
    关系也是表的数学术语。

    Answer 答案:Three. The Car Dealership database schema contains three relations or tables: CAR, SALE, and SALESPERSON.
    三。汽车经销商数据库模式包含三个关系或表:CAR、SALE 和 SALESPERSON。

  2. How many columns does the relation Car contain?
    Car 关系包含多少列?
    Hint 提示:A relation is also the mathematical term for a table. A table is a combination of rows and columns. The columns are the attributes or fields.
    关系也是表的数学术语。表是行和列的组合。列是属性或字段。

    Answer 答案:Four. The relation Car contains four columns: Serial No, Model, Manufacturer, and Price.
    四个。“汽车”关系包含四列:序列号、型号、制造商和价格。

  3. How many rows does the relation Sale contain?
    “销售”关系包含多少行?
    Hint 提示:A relation is also the mathematical term for a table. A table is a combination of rows and columns. The rows are the tuples.
    关系也是表的数学术语。表是行和列的组合。行是元组。

    Answer 答案:Five 五

  4. What is the degree of the relation Salesperson?
    关系“销售员”的度是多少?
    Hint 提示:Degree refers to the number of attributes or columns in a relation.
    度是指关系中的属性或列的数量。

    Answer 答案:Three 三

  5. Identify the cardinality of the relation Sale.
    确定关系“销售”的基数。
    Hint 提示:Cardinality refers to the number of tuples, or rows, in a relation.
    基数是指关系中的元组或行的数量。

    Answer 答案:Five 五

  6. Identify the attributes of the relation Salesperson.
    识别关系 Salesperson 的属性。
    Hint 提示:A relational schema specifies each column's relation name and type, which are the attributes.
    关系模式指定了每个列的关系名称和类型,这些都是属性。

    Answer 答案:Salesperson_id, Name, Phone
    销售员 ID,姓名,电话

Congratulations! You have completed this lab and are ready for the next topic 恭喜!您已完成本实验,并为下一个主题做好了准备