Added more details about database (#22570)
Added little info about tables, records, fields, relationship.
This commit is contained in:
@ -7,7 +7,7 @@ As a database is a way to store data, relational-databases are a model for how t
|
||||
|
||||
## Tables
|
||||
|
||||
Like the a sheet in excel, tables are made up of columns and rows. Each row is an instance of data with attributes in the column of the table know as fields. There can be several tables for each category for entities. An example could be a table of users. Each row would be a user and each field would be details on the user like email, password, and contact details for that specific user. In Figure 1 you can see diagram of the example.
|
||||
Like the a sheet in excel, tables are made up of columns and rows. Each row is an instance of data with attributes in the column of the table know as fields. The rows are called as records or tuples while columns are called as fields or attributes. There can be several tables for each category for entities. An example could be a table of users. Each row would be a user and each field would be details on the user like email, password, and contact details for that specific user. In Figure 1 you can see diagram of the example.
|
||||
|
||||
|
||||
| | user | email | Telephone |
|
||||
@ -21,7 +21,7 @@ Figure 1 - Example of user table.
|
||||
|
||||
## Records
|
||||
|
||||
A record is a single entity of data. As in the example above, it could be a user, an account, a device, or anything that data can represent. Records do need a unique identifier, sometimes referred to as a key. This key must be unique as it is used to describe relationships a record has with other records in other tables. In Figure 1, we could add keys to each row that identifies each user with a key and the table would now look like Figure 2.
|
||||
A record is a single entity of data. It is a single row of a table known as tuple. As in the example above, it could be a user, an account, a device, or anything that data can represent. Records do need a unique identifier, sometimes referred to as a key. This key must be unique as it is used to describe relationships a record has with other records in other tables. In Figure 1, we could add keys to each row that identifies each user with a key and the table would now look like Figure 2.
|
||||
|
||||
| KEY | user | email | Telephone |
|
||||
|-----------|------------|------------------|--------------------------------------|
|
||||
@ -34,7 +34,7 @@ Figure 2 - Example of user database with KEY field.
|
||||
|
||||
## Fields
|
||||
|
||||
Fields describe the record. This could hold any information on the entity that the record symbolizes. In Figure 3 you can see a table that shows pets. The columns (fields) describe each pet (record) with p\_name, p\_age, p\_type and p\_owner. The p is shorthand for pet and the last column will be explained in the next section on relationships.
|
||||
Fields describe the record. This could hold any information on the entity known as attributes that the record symbolizes. In Figure 3 you can see a table that shows pets. The columns (fields) describe each pet (record) with p\_name, p\_age, p\_type and p\_owner. The p is shorthand for pet and the last column will be explained in the next section on relationships.
|
||||
|
||||
| KEY | p\_name | p\_age | p\_owner |
|
||||
|-----------|------------|------------------|---------------|
|
||||
@ -47,7 +47,7 @@ Figure 3 - Example of Pet table.
|
||||
|
||||
## Relationships
|
||||
|
||||
Relational-databases allow you to describe the relationships entities have with each other. This is sometimes the most difficult topic of relational databases to understand. If we take our example tables we should be able to see the relationship our user table has with the pet table. If you read the p\_owner field you can see it could be also be as in Figure 4. This explains the relation each pet has with a user. Relationship could have different types.
|
||||
Relational-databases allow you to describe the relationships entities have with each other. This is sometimes the most difficult topic of relational databases to understand. If we take our example tables we should be able to see the relationship our user table has with the pet table. If you read the p\_owner field you can see it could be also be as in Figure 4. This explains the relation each pet has with a user, as each of the pet is owned by someone say user in our example. Relationship could have different types: one-to-one, one-to-many or many-to-many.
|
||||
|
||||
|
||||
| KEY | p\_name | p\_age | p\_owner |
|
||||
|
Reference in New Issue
Block a user