What Kind of Attribute Can Be Calculated Using the Value of Another Attribute?
Designing your database using the entity-human relationship model
The entity-human relationship (ER) model is a way to pattern databases at the conceptual level. It relies on describing real-earth entities and the relationships between them. If something can be individually identified, and so y'all can use information technology as an entity in your database. Any association betwixt entities is and so recorded equally a relationship in the database.
The ER model comes with a standardized diagrammatic technique that makes information technology quick and easy to design a database. We'll use Chen annotation to create our case diagram.
Each of the three bones elements in the model – entity, attribute, and relationship – is represented by a shape. An entity is a rectangle, an attribute is an oval, a relationship is a diamond. There are some variations on this, but at its center, the ER model tin can practice a lot of heavy lifting with these three shapes.
Let'southward say we're designing a user database for an online multiplayer game. At the basic level, nosotros want the player's email address, proper noun, nickname, password, location, date of nativity and sign-up date. Each of these is an attribute. The player will get more attributes over time every bit they go more than involved in our game, but for now that's enough to describe a new sign-up in our database.
And then our player entity is represented by a rectangle with the give-and-take player inside it.
The attributes listed to a higher place (email address, name, nickname, password, location, engagement of birth and sign-up date) are represented by ovals.
That gives u.s.a. our entities, simply what about relationships? We're going to let our players become friends with each other and so that there's a sense of community. The friend relationship is represented by a diamond betwixt players.
Afterwards on, nosotros'll innovate clans to fuel contest. Association volition become another relationship betwixt players. Clans will exist entities in themselves, with relationships to many players, but will likewise take their own attributes.
Entities tin can as well exist gathered into entity sets. In our game database, the set of all players is i possible gear up.
What kinds of attributes can the ER model correspond?
There are several different types of attributes and they each practice a different job in database design. Each attribute as well has some inherent limitations on the values that it can comprise, regardless of type. You volition set these yourself when designing the database. For instance, the histrion'due south name can't incorporate whatsoever numbers, while the nickname tin can. Date of birth is all numbers, but in a particular date format.
1. Simple attribute
You can't divide a simple aspect any further. That's it. You've got the record and yous tin can't pause it down whatsoever more that. In our example, the player's email address is a simple aspect. Nosotros could accept dissever the email address into user and domain, simply we don't need that level of granularity for a plain quondam electronic mail address. Nickname is another elementary attribute. We don't want actor names to be publicly visible, so we'll give them a unmarried string of alphanumeric characters for chat and messaging.
2. Composite attribute
You can apply composite attributes to comprise simple attributes. You tin can always break a blended attribute down into 2 or more simple attributes (or even more composite attributes, but we'll get into that later). For our database, the player'due south proper name is existence recorded as first name and last name. Two elementary attributes combine to create a blended attribute.
three. Derived aspect
These are useful attributes that you can derive from other attributes. We can use our role player's sign-up date to generate an aspect telling us how long they've been playing the game. Merely there are more than derived attributes hidden in those basics. When designing our database, we knew that we needed engagement of birth to make sure that the thespian is simply viewing age-appropriate content. Only each attribute tin exercise double duty, and in this example, engagement of birth is also handy for computing the histrion'south age.
4. Single-valued attribute
You tin can only store one value for each entity. Date of birth is a good example for us. A histrion can only accept a unmarried appointment of birth. Single-valued attributes can be either simple or blended.
v. Multi-valued attribute
You tin store more than ane value for each entity. In our instance, we want to brand sure that we tin go far touch with our players no matter what, so nosotros'll let them add more than than one email address every bit a backup. Multi-valued attributes tin can be either simple or composite.
Focus on composite attributes
Blended attributes are represented in the ER model as an oval shape continued to other ovals.
In our example, we've already fabricated good use of our offset blended attribute. Nosotros can pause downwardly the player's name attribute into first and terminal proper name. We decided to shop it that way so that we tin address the thespian past their first name when we want to transport them an email.
Another useful composite aspect associated with our players is their location. We didn't want to get too intrusive and ask for a total postal address when we don't really demand it. We tin can get close enough by using the thespian'south IP address. That gives us the country and probably the city where the player is located. And then our blended entity location comprises city and land.
Beyond our example, blended attributes can be very useful elements in a database. For instance, yous can break address downward into street, city, country and country and apply these for marketing or customization. You don't ever need to take access to the attributes contained in a composite aspect, but it's worth keeping them separate merely in example!
You lot tin retrieve of composite attributes as a hierarchy, where the nested component attributes tin be cleaved down ever further. A component attribute can also exist a blended attribute, and and so on.
Why utilise Gleek?
In that location are enough of graphical tools for creating ER diagrams. But sometimes y'all don't desire to fiddle with dragging and dropping. You want to continue your hands securely on the keyboard and quickly bash out a diagram. Type, don't describe or elevate, and Gleek volition practise the residual, giving y'all a clean, fast diagram to informally explicate your database structure.
Related posts
- ER diagram case: online shopping organisation (Crow'southward Foot notation)
- Guide to entity-relationship diagram notations & symbols
- How exercise you lot catechumen an ER diagram into a relational schema?
- What is the entity-relationship diagram in database design?
- Crow's foot notation in entity-human relationship diagrams
- Crow's Foot vs. Chen note: detailed comparison for 2021
- Enhanced entity-relationship diagram: features and components
- ER diagram for a hospital direction system (Crow'south Foot note)
Source: https://www.gleek.io/blog/er-model-attributes.html
0 Response to "What Kind of Attribute Can Be Calculated Using the Value of Another Attribute?"
Post a Comment