02 - Relational Databases Flashcards
What are:
Attributes?
Columns. Allowed data (e.g. INT, STRING, etc) in an attribute is called attribute domain.
What are:
Tuples?
records. A record in a table is a row, with the same number of attributes (columns). Important: Each tuple within a table needs to be unique as required by the relational model.
What are: Schema?
(meta-data) - Specification of how data is to be structured logically, defined at setup, rarely change. E.g. Student (SID int, name string, age int, gpa real)
What are: Instance?
Content of a table, changes rapidly, but always conforms to the schema.
What is a key?
a set of one or more attributes (columns) in the table that have certain properties.
Explain: Compound key?
Including two or more attributes
Explain: Superkey?
No two tuples have the same values. Key attributes that can uniquely identify a row. Several super keys can present in a table.
Explain: Candidate key?
It’s a minimum super key. A super key reduced to the least amount of attributes needed to uniquely identify a row.
Explain: Primary key?
Used to uniquely identify of find the tuples in a table, every tuple in a relational database has its own primary key. Normally it will be chosen from one of the primary keys.
Explain: Secondary Key?
Used to look up tuples, not uniqueness
Explain: Foreign Key?
used as constraint
What is an index?
database structure, quicker and easier to find tuples based on values in one or more attributes. Not the same as key.
What are: Constraints?
Related to a particular attribute in a table. Constraints are the rules enforced on the data columns of a table. These are used to limit the type of data that can go into a table.
Attribute required. Special value null represents an empty value.
Explain: Primary Key Constraints?
Entity integrity. No two records can have identical values for the primary key attribute of a table. All of the attributes that make up the primary key have non-null values.
Explain: Foreign Key Constraints?
Foreign key: refer to a key in another table. Referential integrity constraint. A tuples’ value in one or more attributes in one table must match the values in another table.