Computer Science – 8.1 Database Concepts | e-Consult
8.1 Database Concepts (1 questions)
An Entity-Relationship Diagram (ERD) is a visual representation of the entities (real-world objects or concepts) and the relationships between them in a database. It's a high-level design tool used to conceptualize the database structure. A relational database schema, on the other hand, is a detailed blueprint of the database, specifying the tables, columns, data types, primary keys, and foreign keys. It's the actual implementation plan for the database.
Purpose of an ERD:
- To provide a visual overview of the database structure.
- To facilitate communication between stakeholders (e.g., database designers, developers, and users).
- To identify potential data requirements and relationships.
- To serve as a basis for designing the relational database schema.
Example ERD for a Library Database:
| Entity | Attributes |
| Book | BookID, Title, Author, ISBN |
| Member | MemberID, Name, Address, Phone |
| Loan | LoanID, BookID, MemberID, LoanDate, DueDate |
In this ERD, the entities are Book, Member, and Loan. The relationships are represented by the lines connecting the entities. For example, a Book can be borrowed by a Member (represented by the relationship between Book and Loan). The attributes are listed within each entity.
Deriving a Relational Database Schema from an ERD:
- Each entity in the ERD becomes a table in the relational database.
- Attributes of the entity become columns in the table.
- The primary key of the entity becomes the primary key of the table.
- Relationships between entities are implemented using foreign keys. For example, the Loan table would have foreign keys referencing the Book and Member tables to represent the relationships between them.