Skip to main content

SQL Set Operators

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

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.

Data Modeling Concepts: Degree:


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.


Keys:

Super key: 
                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

Comments

Popular posts from this blog

SQL Set Operators

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                                      ...
  d. Insert a new row in the Location table related to the Facility row in modification problem (c). The new row should have “Door” for the location name. Query Formulation + Result Snapshot Our Official Website :  Web Conquerors  (https://www.webconquerors.com/)  Want to get digital services?  Contact US Want to know about our services?  Our Services

Correction For ERD

 d. For each consistency error in Figure 1, you should identify the consistency rule violated and suggest possible resolutions of the error. The ERD has generic names to help will concentrate on finding diagram errors rather than focusing on the meaning of the diagram. Answer:                Entity6 is violation of the Primary key rule. As there are 3 attributes from within Entity6 that are marked as primary key. Entity6 also violates the Identifying relationship rule, as there is no foreign key in the Entity6 table to identify the item from Entity7. Since this a weak entity type, the cardinality must be 1:1, which it is not. Entity2 is a violation of the Identifying relationship rule due to it not being a weak entity type when there is an identifying relationship. Our Official Website :  Web Conquerors  (https://www.webconquerors.com/)  Want to get digital services?  Contact US Want to know about our services?  ...