Database Design Explain the following terms briefly with a s
Database Design
Explain the following terms briefly with a suitable example:
 a) Relational schema
 b) Relational database schema
 c) Relation instance
 d) Relation cardinality
 e) Relations degree
 f) Attribute
 g) Domain
 h) Entity
 i) Relationship
 j) Entity set
 k) Relationship set
 l) One-to-many relationship
 m) Many-to-many relationship
 n) Participation constraint
 o) Weak entity set
Solution
D) Relation Cardinality -
One to One: An entity of entity-set A can be associated with at most one entity of entity-set B and an entity in entity-set B can be associated with at most one entity of entity-set A.
One to Many: An entity of entity-set A can be associated with any number of entities of entity-set B and an entity in entity-set B can be associated with at most one entity of entity-set A.
Many to One: An entity of entity-set A can be associated with at most one entity of entity-set B and an entity in entity-set B can be associated with any number of entities of entity-set A.
Many to Many: An entity of entity-set A can be associated with any number of entities of entity-set B and an entity in entity-set B can be associated with any number of entities of entity-set A.
For example, consider a database designed to keep track of hospital records. Such a database could have many tables like:
One to One: A Doctor can be associated with at least one speciality.
One to Many: A department cn have multiple doctors.
Many to One: Multiple patients can be associated with one doctor.
Many to Many: doctors have many patients, and a patient could have several doctors.
f) Attribute:
Entities are represented by means of their properties, called attributes, all attributes have values or Entity sets have associated attributes, which are properties of the entities in that set. In the E/R model, we shall assume that attributes are atomic values, such as strings, integers, or reals.
Types of Attributes
Simple attribute Simple attributes are atomic values, which cannot be divided further. For example, a student\'s phone number is an atomic value of 10 digits.
Composite attribute Composite attributes are made of more than one simple attribute. For example, a student\'s complete name may have first_name and last_name.
Derived attribute Derived attributes are the attributes that do not exist in the physical database, but their values are derived from other attributes present in the database. For example, average_salary in a department should not be saved directly in the database, instead it can be derived. For another example, age can be derived from data_of_birth.
Single-value attribute Single-value attributes contain single value. For example Social_Security_Number.
Multi-value attribute Multi-value attributes may contain more than one values. For example, a person can have more than one phone number, email_address, etc.
For Example, the entity set movies might be given attributes such as title (the name of the movie) or length, the number of minutes the movie runs.
g) Domain:
Attributes of an entity set is defined by its set of values called domain. In other words The domain of the attribute is the set of permitted values.
For example, The domain for telephone number must be positive integers or For example, a student\'s name cannot be a numeric value. It has to be alphabetic. A student\'s age cannot be negative, etc.
h) Entity:
The basic object that the ER model represents is an entity, which is a \"thing\" in the real world with an independent existence. An entity may be an object with a physical existence or an entity in an ER Model is a real-world entity having properties called attributes, and a collection of similar entities forms an entity set.
For Example: example a database about movies, their stars, the studios that produce them, and other aspects of movies. Each movie is an entity, and the set of all movies constitutes an entity set. Likewise: the stars are entities, and the set of stars is an entity set.
i) Relationship:
Relationships are connections among two or more entity sets.The association among entities is called a relationship. For example,
For Example:
(a) an employee works_at a department, a student enrolls in a course. Here, Works_at and Enrolls are called relationships.
(b) if Movies and Stars are two entity sets, we could have a relationship Stars-in that connects movies and stars. The intent is that a movie entity m is related to a star entity s by the relationship Stars-in if s appears in movie rn.
j) Entity set:
An entity set is a collection of similar types of entities. An entity set may contain entities with attribute sharing similar values.
For example: a Students set may contain all the students of a school; likewise a Teachers set may contain all the teachers of a school from all faculties.
k) Relationship set:
A set of relationships of similar type is called a relationship set. Like entities, a relationship too can have attributes. These attributes are called descriptive attributes.
A relationship type R among n entity types E1, E2, ••. , En defines a set of associations or a relationship set-among entities from these entity types. As for the case of entity types and entity sets.
For Example: The relationship set R contains relations employee works_at a department,teachers works at a college, students enrolled for the course.
l) One-to-many relationship:
In a relational database, a one-to-many relationship exists when one row in table A may be linked with many rows in table B, but one row in table B is linked to only one row in table A. It is important to note that a one-to-many relationship is not a property of the data, but rather of the relationship itself.
A mapping R from X to Y is one-to-many if each entity in X is associated with many entities in Y but each entity in Y is associated with one entity in X.
For example: A doctor can be associated with many patients but a pateint can be associated with one doctor.



