Week 2 Topic 1: Introduction to databases and entity–relationship diagrams

Choose a study mode

Play Quiz
Study Flashcards
Spaced Repetition
Chat to Lesson

Podcast

Play an AI-generated podcast conversation about this lesson
Download our mobile app to listen on the go
Get App

Questions and Answers

What is the primary role of a Database Management System (DBMS)?

  • To encrypt data for security purposes.
  • To design the graphical user interface of an application.
  • To provide an interface between users and databases, enabling data manipulation. (correct)
  • To physically store data on a hard drive.

Which of the following is NOT a core functionality of a DBMS?

  • Data storage, retrieval, and update.
  • Enforcing constraints to ensure data integrity.
  • Supporting transactions and concurrency.
  • Creating marketing strategies based on customer data. (correct)

In the context of databases, what does 'data redundancy' primarily refer to?

  • Deleting old and irrelevant data from the database.
  • Compressing data to save storage space.
  • Storing the same data multiple times within a database. (correct)
  • Having insufficient backup copies of critical data.

Why is it important to avoid data redundancy in database design?

<p>It prevents update anomalies and saves storage space. (C)</p>
Signup and view all the answers

Which type of database is best suited for handling unstructured, unpredictable data, making it ideal for big data applications?

<p>Non-relational database (NoSQL). (D)</p>
Signup and view all the answers

Which of the following best describes the role of an Entity-Relationship Diagram (ERD) in database design?

<p>To model the entities and relationships within a system. (D)</p>
Signup and view all the answers

What is the purpose of using primary keys in database tables?

<p>To uniquely identify each record in a table. (B)</p>
Signup and view all the answers

Which of the following is a disadvantage of using large random numbers (UUIDs) as primary keys?

<p>They are difficult for humans to read and remember. (A)</p>
Signup and view all the answers

In an ERD, what does a diamond shape typically represent?

<p>A relationship. (B)</p>
Signup and view all the answers

Which of the following is an advantage of using a database-generated sequence number as a primary key?

<p>Improved database performance due to the sequential nature of the IDs. (C)</p>
Signup and view all the answers

What is the significance of defining the cardinality (e.g., one-to-many) in the relationships between entities in an ERD?

<p>It defines the business rules and constraints regarding how entities relate to each other. (D)</p>
Signup and view all the answers

Consider an online shop database. If the relationship between 'Order' and 'Product' includes a 'quantity' attribute, what problem does this address?

<p>The possibility of a customer ordering multiple units of the same product in a single order. (A)</p>
Signup and view all the answers

Which database type is commonly used in applications requiring high performance, complex calculations, and faster results by allowing the definition of objects?

<p>Object-Oriented Databases (OODB) (D)</p>
Signup and view all the answers

What significant problem arises from not converting an ERD into a set of tables during database design?

<p>Failure to implement the designed database structure, leading to a non-functional database. (C)</p>
Signup and view all the answers

Which of the following scenarios is MOST suitable for using a Non-relational (NoSQL) database over a Relational Database (RDB)?

<p>Handling rapidly changing data structures and high volumes of unstructured social media data. (B)</p>
Signup and view all the answers

How does SQLite differ from other relational database management systems (RDBMS) like MySQL or Oracle?

<p>SQLite stores data in a single file on disk and doesn't need a separate server process. (B)</p>
Signup and view all the answers

In the context of ERDs, which of the following best describes the term 'entity'?

<p>A person, place, thing, or event about which information is maintained. (A)</p>
Signup and view all the answers

Consider a database design for a library system. There are entities for 'Book', 'Author', and 'Loan'. What type of relationship is most likely to exist between 'Book' and 'Author'?

<p>Many-to-many: Many books can have many authors, and one author can write many books. (A)</p>
Signup and view all the answers

A university database stores student information. There are tables for Students, Courses, and Enrollments. What is the MOST appropriate primary key for the Enrollments table?

<p>A composite key consisting of both Student ID and Course ID (A)</p>
Signup and view all the answers

Imagine you are designing a social media platform. Which type of database would be MOST suitable for storing the relationships between users (e.g., Friendships, Followers)?

<p>Graph Database (D)</p>
Signup and view all the answers

Flashcards

Database

A collection of data organised for access, retrieval, modification and use.

Database Management System (DBMS)

Software for creating and managing databases, acting as an interface between users and the database.

Relational Database (RDB)

Data stored in interrelated tables, allowing efficient querying and manipulation using SQL.

Object-Oriented Database (OODB)

Allows the definition of objects, referenced later as a unit, commonly used in high-performance applications.

Signup and view all the flashcards

Network Database

A database model where multiple member records can be linked to multiple owner files.

Signup and view all the flashcards

Non-Relational Database (NoSQL)

Handles unstructured, messy, and unpredictable data, suitable for big data applications.

Signup and view all the flashcards

Entity-Relationship Diagram (ERD)

A diagram that visualizes entities within a system and their interrelationships.

Signup and view all the flashcards

Entity

A major component or object within a system's scope, such as a customer, product, or order.

Signup and view all the flashcards

Relationship

A connection or association between two or more entities in a database.

Signup and view all the flashcards

Database-Generated Sequence Number

The database creates unique IDs, typically in sequential order (e.g., user 01, user 02).

Signup and view all the flashcards

Universally Unique Identifier (UUID)

Very large, randomly generated numbers used as unique identifiers with a negligible probability of duplication.

Signup and view all the flashcards

Study Notes

  • A database is a structured collection of data that enables access, retrieval, modification, and utilization of that data.
  • Database Management Systems (DBMS) are software used for creating and managing databases, serving as an interface between users and the database.
  • DBMS functionalities include data storage, retrieval, and updates, transaction and concurrency support, recovery mechanisms, authorization, remote access support, and constraint enforcement.

Database Types

  • Relational Databases (RDB): Store data in interrelated tables. Examples: Microsoft SQL Server, Oracle, and MySQL.
  • Object-Oriented Databases (OODB): Allow definition of objects for high performance applications. Example: ObjectBox.
  • Network Databases: Feature multiple member records linked to multiple owner files. Example: IMAGE.
  • Non-Relational Databases (NoSQL): Suited for unstructured, unpredictable data ("big data"). Example: Apache Cassandra.

Relational Databases

  • Organize data into tables with rows (records/tuples) and columns (fields/attributes).
  • Utilize SQL for efficient querying and manipulation.
  • SQLite is suitable for mobile apps. It is a simplified relational database that doesn't require a dedicated server.

Database design

  • Four basic steps for database design:
    • Model the problem into an entity–relationship diagram (ERD).
    • Convert the ERD into a set of tables.
    • Create the tables in the database using SQL and import any data.
    • Create queries to extract information.
  • Online shop example shows repeated data. Multiple tables are better.

Entity–Relationship Diagrams (ERDs)

  • An ERD is a structural diagram visualizing:
    • Major entities within the system scope.
    • Interrelationships among these entities.
  • Entities often refer to business objects like people/roles (e.g., student), tangible objects (e.g., product), and intangible objects (e.g., log).
  • Entities are drawn as rectangles, relations as diamonds, connected by lines.
  • Relationships are expressed as verbs. The shown relationship is one-to-many (1:M).
  • The four entities in the online shop example include Customer, Product, Order and Brand.

Primary Keys

  • Options for developing primary keys:
    • Database-generated sequence number: The database creates IDs for you.
    • Large random numbers:UUIDs are very large numbers generated randomly. The probability of generating the same one twice is negligible.

Adding Attributes to Relationships

  • Ask questions to determine attributes for each entity, e.g., What information do we need about the customer/order/product/brand?
  • Relationships can have attributes, such as including a quantity attribute in the relationship between order and product which reduces redundancies.

Studying That Suits You

Use AI to generate personalized quizzes and flashcards to suit your learning preferences.

Quiz Team

More Like This

Use Quizgecko on...
Browser
Browser