SQL Set Operators Traditional Set Operators: Union Compatibility: Requirement for the traditional set operators. Strong requirement. - Same number of columns. - Each corresponding column is compatible. - Positional correspondence. Apply to similar tables by removing columns first. SQL UNION Example: Example 1: Retrieve basic data about all university people. SELECT FacNo AS PerNo, FacFirstName ...
Entity
• Object that exists and that can be distinguished from other objects • Can be person, place, event, object, concept in the real world • Can be physical object or abstraction • Entity instance is a particular person, place, etc. • Entity type is a category of entities • Entity set is a collection of entities of same type-must be well-defined • In E-R diagram, rectangle represents entity set.
Data Modeling Concepts: Entity:
Entity instance – a single occurrence of an entity.
Associative entity – an entity that inherits its primary key from more than one other entity (called parents).
Each part of that concatenated key points to one and only one instance of each of the connecting entities.
Attributes:
• Defining properties or qualities of entity type.• Represented by oval on E-R diagram.• Domain – set of allowable values for attribute. – Credit hours might be integer values between 0 and 150. – last-Name might be all legal last names – a string that might also include apostrophes, blanks, hyphens, or other special characters.• Attribute maps entity set to domain.• May have null values for some entity instances – no mapping to domain for those instances.
• May be multi-valued – use double oval on E-R diagram (e.g., student may have more than one email address).• May be composite – use oval for composite attribute, with ovals for components connected to it by lines.
Attribute or set of attributes that uniquely identifies an entity (can always tell one entity instance from another). – stud-Id is super-key for Student entity. – stud-Id, credits together form a super-key, because stud-Id is a super-key.
• Composite key: Key with more than one attribute. – course-Number, section-Number, semester make up a composite key.
• Candidate key: Super-key such that no proper subset of its attributes is also a super-key (minimal super-key –no unnecessary attributes). – Although stud-Id, credits is a super-key, only stud-Id is a candidate key. – course-Number, section-Number, semester is a candidate (no one attribute is a super-key). – If Student entity contains stud-Id and ssan as attributes, both stud-Id and ssan are candidate keys.
• Primary key: The candidate key actually used for identifying entities and accessing records.
• Alternate key: Candidate key not used for primary key.
• Secondary key: Attribute or set of attributes used for accessing records, but not necessarily unique. – last-Name might be used to find instances in Student, to help narrow down the results.
• Foreign key:term used in relational model (but not in the E-R model) for an attribute that is primary key of a table and is used to establish a relationship, usually with another table, where it appears as an attribute also – stud-Id in Enroll entity.
Our Official Website : Web Conquerors (https://www.webconquerors.com/)
Want to get digital services? Contact US
Want to know about our services? Our Services
Our Official Website : Web Conquerors (https://www.webconquerors.com/)
Want to get digital services? Contact US
Want to know about our services? Our Services
Comments
Post a Comment