Chapter 1 - Relational Data Model Flashcards
What is the relational data model?
It is a framework for organising and managing data in a database system.
It is based on the concept of relational DB, which is a collection of tables called relations, each with a unique name.
basically its fking table framework
What is relation, tuple and attributes?
relation->table
tuple-> row
attribute->column
What advantages does relational db provide?
provides
1. simple data representation and
2. simple querying
BECAUSE OF TABLE USAGE
Are relations ordered or unordered? Why is that good
Unordered. This means that the order of rows or columns in a table is not significant.
This allows for optimised storage and efficient querying since data can be stored and retrieved without relying on a specific order.
SQL usage to retrieve easily
What is a relational schema?
Every relation has a schema
It specifies the type of information for relations. For example, attribute name and domain.
Different relations can share the same schema.
Tables:
STUDENT
Attributes:
student_id (Primary Key)
first_name
last_name
date_of_birth
email
Description: Stores information about students.
COURSE
Attributes:
course_id (Primary Key)
course_name
department
Description: Stores information about courses offered.
what is the notation to represent the schema of r? give an example if r is STUDENT
what is the notation to represent the schema of n?
Are domains stated explicitly in the notation?
The notation is r(R)
and
n(N)
if r is student then R would be (sid, name, addr)
Domains are not explicitly stated in the notation
What does the special value NULL indicate?
It indicates that a value is unknown or unspecified.
This value causes complications in many operations and we should avoid using NULL if possible.
What should we write instead of specifying NULL?
We should specify a value 0
cannot find a page? Give error 404.
What are keys?
A key is a minimal subset of attributes within a relation that uniquely identifies a tuple. in other words, it is the smallest combination of attributes that can be used to distinguish one tuple from another
What are keys used to do?
They are used to distinguish individual tuples.
Keys define the meaning of the relation.
Can two distinct tuples have the same value in all key attributes?
NO
What is a superkey?
A superkey is a set of attributes(columns) within a table that can uniquely identify each record. EMPHASIS ON RECORD.
Example:
A single column, such as “sid” (student ID), can be considered a superkey because it uniquely identifies each student’s ID within the STUDENT table.
Not all superkeys are equally useful for identifying records uniquely.
Examples of superkeys for a STUDENT table could include “sid” (student ID), “sname” (student name), “sphone” (student phone number), and “saddress” (student address). However, not all of these are the most minimal or appropriate keys.
What is a candidate key?
A candidate key is the minimal set of fields (attributes) that can uniquely identify each record in a table.
A table can have more than one candidate key.
“sid” (student ID) and “sphone” (student phone number) are both candidate keys because they can uniquely identify students.
What is a primary key?
Primary key is a specific candidate key chosen to become the main key for the table.
It’s the key that is most appropriate to serve as the primary means of uniquely identifying records in the table.
How do we indicate primary keys?
We underline them in the table schema