An Example of a Database

In this lesson we will take a look at a simple university database.

We'll cover the following

Before we move onto the example, we must identify the need to store data in tabular form.

One of the main reasons to store data regarding a specific object in a table is ease of understanding. So, instead of keeping relevant information regarding an object (like a student) in separate files, tables allow us to keep the important data regarding that object (like student ID, name, address, age, etc.) in one place.

A table is a collection of related data held in a table format within a database. It consists of columns and rows.

Column_1 Column_2 Column_3
Data_Item1 Data_Item2 Data_Item3
Data_Item4 Data_Item5 Data_Item6

Each row in a relational database represents one instance of the type of object described in that table. A row is also called a record. While the columns in a table are the set of facts that we keep track of regarding that type of object. A column is also called an attribute.

A university database example

Let’s consider a university database that is used to maintain information concerning students, courses, and departments in a university environment. The diagram below shows the database structure and a few sample data records.

Student Table

ID First_Name Last_Name Class Major
2001 Adam Smith Junior CS
2342 Jonathan Joestar Sophomore Economics
2343 Lucas Klein Senior Physics

Course Table

Course_ID Course_Name Course_credits
CS200 Intro to programming 4
MATH100 Calculus-I 3
CS300 Advanced Programming 3

Department Table

Department_Code Department_Name
1 Computer Science
2 Electrical Engineering
3 Physics
4 Biology

Instructor Table

Instructor_ID Instructor_fname Department_Code
12 Sam 1
22 Tom 2
04 David 3

Grade Table

ID Course_ID Grade
2001 CS200 A-
2220 EE100 C
2343 PHY220 B

Get hands-on with 1000+ tech skills courses.