In a real world scenario, there can be multiple students studying at the same school and therefore have the same school id.īetween the School and Student entities, there is a connector. Multiple student records can share the same School ID. Note that foreign keys need not be unique. It is a reference to the primary key Id in the School table. Student, another table, has a foreign key column, namely SchoolId. In other words, there must not be two (or more) school records that share the same id. A primary key is capable in uniquely defining records in a table. id is the primary key (PK) column, which is in bold and has a key symbol next to it. In the School table, there are two columns - id and name.
School and Student are entities (note: In ERD, the term "entity" is often used instead of "table". The following is an ERD that depicts the tables for a simple school system. People use ERDs to model and design relational databases. Example: SchoolĪn entity relationship diagram (ERD) is a visual form of relational databases. Hence, we would relate the customer and transaction tables to obtain complete information about a transaction. For instance, knowing the information of a transaction is meaningless without knowing the customer who performed the transaction. It connects data (in tables) together in meaningful ways. RelationshipĪ relationship is a connection between two entities. A column describes a property we are interested in storing for the table it belongs to. ColumnĬolumns refer to a set of fields in tables. A table consists of columns, which are the properties of the table, and rows which are the records to store and retrieve. entities), from which we want to seek information. TableĪ relational database consists of a collection of tables (i.e. Relationships, critical elements in relational database can be added between tables to indicate that two sets of data are inter-related. Each table contributes a set of columns, which are the properties of the table that are worthwhile and need to make persist. Relational database stores data as collections of tables. Oracle, Microsoft SQL Server, MySQL and PostgreSQL are some of the popular relational database management systems. Therefore, despite being challenged by object database for years, relational database still remains to be the most prevalent way of storing enterprise data to this date. Developers may use Structured Query Language (SQL) to query data, and add indexes to database for faster querying, making relational database performs well even when the amount of data increases over time. The way it stores data makes users easy to understand the structure and content of the data. Relations are defined between tables for cross referencing. Relational databases store data in collections of tables. They differ in hardware requirements, efficiency, and how data is stored, organized and accessed.
Over the years, there has been a number of database types emerged, such as hierarchical database, relational database, object database, XML database etc. The history of database can be traced back to the earliest days of electronic computing.