Survey
* Your assessment is very important for improving the workof artificial intelligence, which forms the content of this project
* Your assessment is very important for improving the workof artificial intelligence, which forms the content of this project
Database Management System Lecture 4 The Relational Database ModelIntroduction, Relational Database Concepts Introduction • In this lesson, an introduction to the relational database model is provided. • Description of the main building blocks of a relational database and its definition. Learning Outcomes • Understand how a relation (table) is the main organization unit of a database. • Understand the main building blocks of a relational database and its definition Terminology • Domain A set of values that define the value range for an attribute. • Attribute The basic unit in a relation (table) definition. Each attribute has a domain associated with it. Terminology (Cont.) • Relation Schema (Table Schema) Defines the structure of a relation (table) which consists of a set of attributes and an association between each attribute and its domain • Relational Database Schema A collection of relation (table) schemas Terminology (Cont.) • Tuple (record/row) A list of values with each value being an element in a domain or NULL. A tuple represent a record or row in a table (relation). • Relation (Table) An instance of a relation schema which is composed of a set of tuples Terminology (Cont.) • Database A collection of relations (tables). Introduction to the Relational Database Model • As discussed in the previous lecture, the relational database model is the most widely used data model in DBMSs. • It was developed by E. F. Codd at IBM in 1970. Introduction to the Relational Database Model (Cont.) • The relational database model is based on organizing data with the basic organization unit being a relation that is represented as a table. Relational Database Concepts Domain: • is a set of values that define the value range for an attribute. • A domain can be considered as a data type. Examples of domains include integer, float, string, date, etc. Relational Database Concepts (Cont.) • Relation Schema (Table Schema): defines the structure of a relation (table) which consists of a set of attributes and an association between each attribute and its domain (specifying the possible values of an attribute). • Relational Database Schema: that is a collection of relation (table) schemas. Relational Database Concepts (Cont.) Attribute: • is the basic unit in a relation (table) definition. • Each attribute has a domain associated with it. It can be considered as a column in relational database table. Relational Database Concepts (Cont.) • Tuple (Record/row): • that is a list of values with each value being an element in a domain or NULL. • A tuple represent a record or row in a table (relation). Relational Database Concepts (Cont.) Relation (Table): • is one instance of a relation schema which is composed of a set of tuples. Relational Database: • is a collection of relations (tables). • Figure 5.1 illustrates the definition of Library database. • A database schema is defined which consists of two relation (table) schemas: Books and Members. • As shown in the books table schema in Figure 5.1, the schema defines the structure of the table specifying the attributes of the table (book_Id, title, author, publisher and publication_date). • Each attribute is associated with a domain in the schema, e.g. attribute title has domain text which specifies that values of attribute title are of type text. • Figure 5.2 illustrates the library database instance. • It can be seen that the library database consists of two relations (tables): books and members. • The books table is an instance of the books table schema shown in Figure 5.1. • The books table (records/rows). consists of tuples • Each tuple is composed of values for the attributes defined in the table schema. • Each value in a table tuple is part of the domain associated with the corresponding attribute in the table schema. • For example, value ‘A Tale of Two Cities’ in the 1st tuple of the book table is a value of attribute title with domain text as defined in the table schema (shown in Figure 5.1). Summary • An Introduction to the Relational Database Model • The main relational database concepts.