Relational Database Model

Choose a study mode

Play Quiz
Study Flashcards
Spaced Repetition
Chat to Lesson

Podcast

Play an AI-generated podcast conversation about this lesson

Questions and Answers

What does the relational database model primarily focus on when viewing data?

  • Physical storage characteristics
  • Data access speed
  • Security protocols
  • Logical structure (correct)

In the context of relational databases, what is an 'attribute' most accurately described as?

  • A specific value in a table
  • A relationship between tables
  • A named column in a relation (correct)
  • A row in a table

What is the significance of a 'domain' in a relational database?

  • It determines the access privileges for different users.
  • It represents the physical storage location of the data.
  • It defines relationships between tables.
  • It specifies the allowable values for an attribute. (correct)

Which statement accurately describes a characteristic of a relational table?

<p>Each row must represent a distinct entity. (D)</p> Signup and view all the answers

In a relational database, why is the order of rows and columns considered immaterial to the DBMS?

<p>Because the DBMS identifies data by content and relationships, not position. (A)</p> Signup and view all the answers

What is the primary purpose of requiring each table in a relational database to have an attribute that uniquely identifies each row?

<p>To maintain data integrity and allow for efficient data retrieval and manipulation. (B)</p> Signup and view all the answers

Which definition accurately describes a 'relation' in the context of relational databases?

<p>A table with columns and rows (D)</p> Signup and view all the answers

Consider a database table 'Employees' with columns 'EmployeeID', 'FirstName', 'LastName', and 'HireDate'. Which column or combination of columns would best serve as a primary key?

<p>EmployeeID (C)</p> Signup and view all the answers

What is 'cardinality' of a relation?

<p>The number of rows (D)</p> Signup and view all the answers

What is 'degree' of a relation?

<p>The number of attributes (C)</p> Signup and view all the answers

What best describes a candidate key?

<p>An attribute that determines all other attributes in the relation (C)</p> Signup and view all the answers

In a database 'Students' table, 'StudentID' and 'Email' could both uniquely identify a student. 'StudentID' is chosen as primary key. What is 'Email' considered in this scenario?

<p>Candidate key (B)</p> Signup and view all the answers

Which of the following accurately describes a 'composite key'?

<p>A key composed of more than one attribute (A)</p> Signup and view all the answers

In a database with tables 'Orders' (OrderID, CustomerID) and 'Customers' (CustomerID, CustomerName), what role does 'CustomerID' play in the 'Orders' table?

<p>Foreign key (D)</p> Signup and view all the answers

In a relational database, what does 'functional dependence' between two attributes, A and B mean?

<p>The value of B can be uniquely determined by the value of A. (B)</p> Signup and view all the answers

Why are nulls often avoided in relational databases?

<p>They can cause problems with aggregate functions and complicate data interpretation. (D)</p> Signup and view all the answers

What is the term for the acceptable duplication of primary or foreign keys in a database that is required to make the relationship work?

<p>Controlled redundancy (B)</p> Signup and view all the answers

In a database where a foreign key exists, what does having a foreign key enable that helps minimize data redundancy?

<p>It means you do not duplicate attributes in the table to which the foreign key refers. (B)</p> Signup and view all the answers

What is the primary purpose of entity integrity in a relational database?

<p>To guarantee that each row in a table is uniquely identifiable. (C)</p> Signup and view all the answers

What is the main goal of referential integrity in a relational database?

<p>To ensure that relationships between tables remain consistent. (B)</p> Signup and view all the answers

Referential integrity states the foreign key can be null or which of the following?

<p>Must be a valid entry in the table to which the foreign key relates (B)</p> Signup and view all the answers

Under what condition would a relational database have a 1:1 relationship?

<p>When one entity can be uniquely related to only one other entity, and vice versa (D)</p> Signup and view all the answers

Which of the following most accurately describes a 'data dictionary' in the context of database management?

<p>A repository of metadata describing the structure and characteristics of database elements (D)</p> Signup and view all the answers

What is the main difference between a data dictionary and a system catalog?

<p>System catalogs are automatically maintained by the DBMS, while data dictionaries are often constructed from system catalogs by the database designer. (C)</p> Signup and view all the answers

What does a database index primarily consist of?

<p>An index key and a set of pointers (D)</p> Signup and view all the answers

What is a characteristic of a unique index? What can its key have?

<p>A unique index is in which the index key can have only one pointer value associated with it. (A)</p> Signup and view all the answers

In relational database design, which type of relationship is generally considered the ideal and most commonly used?

<p>One-to-many (1:*) (D)</p> Signup and view all the answers

Why are many-to-many relationships difficult to implement directly in a relational model?

<p>They violate data normalization rules. (B)</p> Signup and view all the answers

When a many-to-many relationship exists, how can you still implement a relational model?

<p><em>:</em> relationships can be changed into two 1:* relationships (C)</p> Signup and view all the answers

According to Codd's relational database rules, how should all data be stored?

<p>In tables (D)</p> Signup and view all the answers

Codd’s rule that access can happen using table, column, and key relates to which of the following?

<p>Guaranteed access (B)</p> Signup and view all the answers

According to Codd, metadata must follow which step?

<p>Managed as ordinary data (D)</p> Signup and view all the answers

According to Codd, what independence must follow application programs and ad hoc facilities are logically unaffected when physical access methods and storage structures are changed?

<p>Physical data (D)</p> Signup and view all the answers

According to Codd, what independence includes end users and application programs are unaware and unaffected by the data location between distributed and local databases?

<p>Distribution (E)</p> Signup and view all the answers

According to Codd, if the system supports low-level access to the data, there must not be a way to bypass the integrity rules of the database. Which rule is this?

<p>Non-subversion (B)</p> Signup and view all the answers

How do relational models handle many-to-many relationships?

<p>Breaking it up to produce a set of 1:* relationships (B)</p> Signup and view all the answers

What does the 'systematic treatment of nulls' rule in Codd's 12 rules emphasize?

<p>Nulls must be represented and handled consistently, regardless of data type. (A)</p> Signup and view all the answers

A database designer aims to create a table that stores information about employees and their job titles. Each employee can hold multiple titles during their tenure. Which type of relationship would be most appropriate between 'Employees' and 'JobTitles' tables?

<p>Many-to-many (<em>:</em>) (C)</p> Signup and view all the answers

What was the primary motivation behind Codd's publication of 12 rules for relational databases?

<p>To ensure that products marketed as 'relational' met minimal standards. (D)</p> Signup and view all the answers

Flashcards

What is a relation?

A relation is a table with columns and rows, forming the basic structure of a relational database.

What is an attribute?

An attribute is a named column of a relation, representing a specific characteristic of the entity.

What is a record?

A record is a logically connected set of one or more fields that describe a person, place, or thing.

What is a domain?

A domain is the set of allowable values for one or more attributes, ensuring data consistency.

Signup and view all the flashcards

What does each row represent?

Each row (tuple) represents a single entity instance and must be distinct to maintain data integrity.

Signup and view all the flashcards

Table column represents?

Each table column represents an attribute, and each column has a distinct name for clarity.

Signup and view all the flashcards

Content of each cell?

Each cell should contain an atomic (single) value, ensuring data is not unnecessarily complex.

Signup and view all the flashcards

Values in a single column?

All values in a column must conform to the same data format, such as text, numbers, or dates.

Signup and view all the flashcards

Range of values for each column?

Each column must have a specific range of values known as the attribute domain, like dates, numbers, etc.

Signup and view all the flashcards

Order of table row and column?

The order of the rows and columns is immaterial to the Database Management System (DBMS).

Signup and view all the flashcards

Requirement of each table?

Each table must have an attribute or a combination of attributes that uniquely identifies each row.

Signup and view all the flashcards

Cardinality of a relation?

Cardinality of a relation is the number of rows in a table or data set.

Signup and view all the flashcards

Degree of a relation?

The degree of a relation is the number of attributes/columns in a table structure.

Signup and view all the flashcards

What do keys consist of?

Keys consist of one or more attributes that determine other attributes within a database table.

Signup and view all the flashcards

Candidate key?

A Candidate Key is an attribute that determines all the other attributes in the relation.

Signup and view all the flashcards

Primary Key (PK)?

The Primary Key (PK) uniquely identified any given row in the relation, it cannot be NULL.

Signup and view all the flashcards

Composite key?

A Composite Key is a key composed of more than one attribute.

Signup and view all the flashcards

Foreign Key (FK)?

A Foreign Key (FK) is an attribute whose values match primary key values in the related table.

Signup and view all the flashcards

What is determination in databases?

When you know the value of attribute A, you can determine the value of attribute B.

Signup and view all the flashcards

What is Functional dependence?

Functional Dependence: Attribute B is functionally dependent on attribute A, if each value in column A determines one and only one value in column B.

Signup and view all the flashcards

What are Nulls?

Nulls have the following properties: No data entry and can represent an unknown attribute value.

Signup and view all the flashcards

Controlled redundancy?

Controlled redundancy refers to tables within the database sharing primary/foreign keys that enable the tables to be linked together.

Signup and view all the flashcards

Entity Integrity?

Entity integrity ensures each row is uniquely identified by the primary key.

Signup and view all the flashcards

Referential Integrity?

Referential integrity concerns how 2 tables reference each other.

Signup and view all the flashcards

Purpose of a Data Dictionary?

Data dictionary provides detailed accounting of all tables found within the database.

Signup and view all the flashcards

System catalogue definition?

A System catalogue is a detailed system data dictionary describing all objects within the database.

Signup and view all the flashcards

What are Indexes?

Indexes are Arrangement used to logically access rows in a table like finding a book in the library or a topic in a book.

Signup and view all the flashcards

1:* Relationship?

1:* relationship relational modeling ideal.

Signup and view all the flashcards

1:1 Relationship?

1:1 relationship should be rare in any relational database design.

Signup and view all the flashcards

: Relationships?

: relationships Cannot be implemented as such in the relational model

Signup and view all the flashcards

Convert : to?

Breaking : relationships into two 1:* relationships

Signup and view all the flashcards

Study Notes

  • The relational database model takes a logical view of data.
  • Relations are components in a relational model which are implemented through tables in a relational DBMS.
  • Relations tables are made up rows and columns.

Relational Data Structure

  • A relation is a table with columns and rows
  • An attribute is a named column of a relation
  • A record is a logically connected set of one or more fields that describe a person, place, or thing
  • A domain is the set of allowable values for one or more attributes.

Characteristics of a Relational Table

  • A relational table is perceived as a two-dimensional structure composed of rows and columns.
  • Each row (tuple) represents a single entity and must be distinct.
  • Each column represents an attribute and has a distinct name.
  • Each cell must contain an atomic value—a single cell value.
  • All values in a column must conform to the same data format.
  • Each column has a specific range of values known as the attribute domain.
  • The order of the rows and columns is inconsequential to the DBMS.
  • Each table must have an attribute that uniquely identifies each row.

Relational Schema Terminology

  • Relational schema is the textual representation of database tables.
  • Each table is described by its name followed by a list of its attributes in parentheses.
  • Example Schema: Student(Stud_Num, FirstName, Surname, Age)
  • Cardinality of a relation refers to the tally its rows.
  • Degree of a relation refers to its attributes/columns.

Keys

  • Keys consist of one or more attributes that determine other attributes
  • Candidate key is an attribute that determines all the other attributes in the relation; the primary key can be chosen from these.
  • Candidate keys can uniquely identify database records without referring to other data. The one unique key is called the primary key, and is usually the best one to use for identification.
  • Primary Key (PK) is an attribute that uniquely identifies any given row.
  • Composite key is a key composed of more than one attribute.
  • Foreign Key (FK) is an attribute whose values match primary key values in the related table.
  • Keys' role is based on determination.
  • If the value of attribute A is known, attribute B can be determined when applying determination
  • Functional dependence signifies that Attribute B is functionally dependent on attribute A if each value in column A determines only one unique value in column B

Null Values

  • Nulls signifies no data entry
  • Must not be set in a primary key
  • Should be avoided in other attributes if possible
  • Represents:
    • An unknown attribute value
    • A known, but missing, attribute value
    • Or a "not applicable" condition
  • Can create problems when functions such as COUNT, AVERAGE, and SUM are in operation

Controlled Redundancy

  • Controlled redundancy is when tables within the database share primary/foreign keys allowing linking the tables together.
  • Multiple occurrences of values in a table are not redundant when they are required to make the relationship work. Example: foreign key
  • Redundancy exists only when attribute values are duplicated.
  • Foreign keys avoid duplicating attributes; in that way, there's redundancy control.

Integrity

  • Two types:
    • Entity integrity
    • Referential integrity

Entity Integrity

  • Ensures that each row is uniquely identified by the primary key.
  • Ensures that a search will find an existing row will always be successful.
  • If no match is found then the record is missing in the table

Referential Integrity

  • Referential integrity concerns how tables reference each other.
    • This relationship with FK
    • FK can EITHER be null or must be a valid entry in the table to which it is related
    • FK value must reference an existing primary key value
  • It is possible for an attribute to NOT have a corresponding value, but it will be impossible to have an invalid entry
  • Example
    • A customer may not yet have an assigned sales representative (number)
    • It will be impossible to have an invalid sales representative (number).

Data Dictionary

  • A data dictionary provides a detailed summary for all tables found within the database
  • Contains (at least) all the attribute names and characteristics for each table in the system.
  • Data Dictionaries contain “metadata”—data about data.

System Catalog

  • System catalogue is a detailed system data dictionary.
  • Describes all objects within the database.
  • Includes data about table names, the table's creator & creation date, the number of columns in each table, the data type of each column, index filenames, index creators and authorized users and access privileges.
  • DBMS only provides a system catalogue from which the database designer can construct his/her data dictionary.

Indexes

  • Indexes function as logical arrangements used to logically access rows in a table like finding a book in the library or a topic in a book.
  • An index consist of an index key and a set of pointers.
  • The index key is an index's reference point like a primary key.
  • Pointers are identifiers, e.g. numbers that point to the data location, which is identified by the key.
  • A unique index is one in which the index key can have only one pointer value (row) associated with it.

Relationships within the Relational Database

  • Three types:
  • 1:* relationship
  • 1:1 relationship
  • : relationships

One-to-Many relationship

  • Relational modeling ideal.
  • Should be the norm in any relational database design.

One-to- One Relationship

  • Should be rare in any relational database design.

Many-to-Many Relationship

  • Cannot be implemented as such in the relational model
  • Can be changed into two 1:* relationships.

Codd's Relational Database Rules

  • In 1985, E F Codd published a list of 12 rules to define a relational database system.
  • The list existed because many vendors were marketing products as "relational" even though those products did not meet minimum relational standards.

Studying That Suits You

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

Quiz Team

Related Documents

More Like This

Database Management Systems Unit-2 Quiz
37 questions
DBMS IS212 Chapter 1 Quiz
26 questions
Relational Database Model: Tables and Structure
38 questions
Use Quizgecko on...
Browser
Browser