The Characteristics of Databases
- The purpose of a database is to keep track of things.
- Relational Databases are the most common form of database today.
- Built in units of a table
- In the book, they will name tables in all upper case
- CLASS, GRADE, STUDENT
- This is a convention, not a syntax requirement.
- Each table has a number of rows
- The rows represent an instance of a thing.
- Think of rows as a record in C++
- Each row has a number of columns
- In the book they will name columns in MixedCase
- StudentNumber, EmailAddress, ...
- Again, a convention, not a syntax requirement
- Think of a column within a row as a field within a record in C++
-
-
- These two tables are part of a database, but there is not inter-relationship between them.
- Adding a third table:
-
- This table provides a linking between students, classes and grades.
- The StudentNumber in the GRADE table provides a reference to the student in the STUDENT table.
- The same is true with ClassNumber
- Each row in a table is uniquely identified by a primary key
- In the above tables, StudentNumber is the primary key in the STUDENT table.
- If we know the student number, then we know the key.
- The same is true of ClassNumber and the CLASS table.
- For this database, the DBMS generates the student number for us.
- This is known as a surrogate key
- For the GRADE table, the primary key consists of two parts.
- The StudentNumber from the STUDENT table
- The ClassNumber from the CLASS table.
-
- Since the data is from another table, this is called a foreign key
- Adding a foreign key creates a relationship between tables.
- Perhaps another view
-
- We will spend quite a bit of time discussing keys, tables, relations, and other topics.
- The author claims that databases create information
- Data is defined as recorded facts and numbers.
- Information is
- Knowledge derived from data
- Data presented in a meaningful context
- Data processed by summing, ordering, averaging, grouping, comparing, or other similar operations.
- Databases are used to organize data so that information can be produced.
-