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                                      ...

Schema

 

 
Schema

External Schemas:

  • also called subschemas.
  • Multiple schemas per database correspond to different views of the data.

Conceptual Schema:

  • describes all the entities, attributes, and relationships together with integrity constraints.
  • Only one schema per database.

Internal Schema:

  • a complete description of the internal model, containing the definitions of stored records, the methods of representation, the data fields, and the indexes and storage structures used.
  • Only one schema per database.

Mappings:

The DBMS is responsible for mapping between these three types of schema: 
        The DBMS must confirm that each external schema is derivable from the conceptual schema, and it must use the information in the conceptual schema to map between each external schema and the internal schema 

Types of mappings:

  1. conceptual/internal mapping.
  2. External/conceptual mapping.

Conceptual/Internal mapping:

    Enables DBMS to:
  • To find the actual record or combination of records in physical storage that constitute a logical record in the conceptual schema Together with any constraints to be enforced on the operations for that logical record. 
  • It also allows any differences in entity names, attribute names, attribute order, data types, and so on to be resolved.

External/Conceptual mapping:

    Map names in the user’s view to the relevant part of the conceptual schema.


Instances:

    Database Schema:

        Description of the database.
        Specified during design phase. 
        Remain almost static.

    Database Instance:

        Data in the database at any particular point in time.
        Dynamic Also called an intension (or state) of database.

Data Independence:

     Logical Data Independence:

        Refers to immunity of the external schemas to changes in the conceptual schema. 
        Conceptual schema to changes (e.g addition/removal of entities).
        Should not require changes to external schema or rewrites of application programs.

    Physical Data Independence:

        Refers to immunity of the conceptual schema to changes in the internal schema. 
        Internal schema changes (e.g different file organizations, storage structures, storage devices etc.) 
        Should not require change to conceptual or external schemas.

Data Independence & Three-Level Architecture




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                                      ...

CREATE TABLE Syntax

CREATE TABLE Syntax CREATE TABLE <table-name> ( <column-list> [<constraint-list>] ). Column list with data types and optional and inline constraints. Optional external constraint list  CONSTRAINT [ ConstraintName ] <Constraint-Spec>            Primary key            Foreign key            Unique            Check CREATE TABLE Statement Example CREATE TABLE Student            ( StdNo CHAR(11),            StdFirstName VARCHAR(50),            StdLastName VARCHAR(50),            StdCity VARCHAR(50),            StdState CHAR(2),            StdZip CHAR(10),            ...

Query Formulation

Query Formulation   Query Formulation Process: Critical Questions: What tables?           - Columns in result.          - Conditions to test (including join conditions). How to combine the tables?           - Usually join of PK to FK. More complex ways to combine Individual rows or groups of rows?           - Aggregate functions in result.          - Conditions with aggregate functions. University Database Diagram: Summarization and Joins 1:      Example 1: List the number of students enrolled in each 2017 course offering showing the offer number and number of students in the result.                SELECT Offering.OfferNo,                                     COUNT (*) AS NumSt...