Presentation is loading. Please wait.

Presentation is loading. Please wait.

Review External modelling –subsetting the universe of phenomena into user’s views Conceptual modelling –synthesis of external models into a schematic representation.

Similar presentations


Presentation on theme: "Review External modelling –subsetting the universe of phenomena into user’s views Conceptual modelling –synthesis of external models into a schematic representation."— Presentation transcript:

1 Review External modelling –subsetting the universe of phenomena into user’s views Conceptual modelling –synthesis of external models into a schematic representation called the entity-relationship model organizes the information content of the database Logical modelling –conversion of the conceptual model to a ‘computer’ model of tables and records Internal representation –usually not accessible to users computer control of I/O, storage, etc.

2 Review relation 1 relation 2 entity relationship entity relation 3 relation 4 external view Mapping External views Conceptual Model E-R model Logical Model Database Schema relation1 scheme(attr1, attr2, attr3) relation2 scheme(attr1, attr2,attr3,attr4) relation3 scheme(attr1, attr2, attr3) relation 4 scheme(attr1, attr2, attr3)

3 Mapping: Transforming the conceptual model to a logical model (spatial and attribute data) Conceptual model –identify entities street point segment landowner parcel –identify associations/relationships A. streets have segments B. parcels have segments C. segments have endpoints D. parcels have owners –develop the E-R model

4 Mapping: Transforming the Conceptual Model to the Logical Model Logical model identify attributes identify keys convert entities to relations street(street_id, street_name) owner(owner_name,owner_id,address) coordinates(point_id, X, Y) segment(segment_id) parcel(parcel_id, address) convert associations to relations street_segment(street_id, segment_id) parcel_segment(parcel_id, segment_id) segment_point(segment_id,point_id) owner_parcel(owner_id, parcel_id) Please see L&T pg 371-373 for the completed tables. Note the error in the first table STREET. Street-ID data values should be 1 and 2 (not 101 and 102).

5 Normalization First Normal Form (1NF) insures database integrity on two levels –at the table level subdivides data into thematic groupings reduces (but doesn’t eliminate) data redundancies –at the attribute level eliminates non-atomic cell values eliminates multi-valued cells

6 Normalizing a Table Structure - An Example

7 scheme: maps (map_id, map_title, map_location) scheme: cartographer (map_id, first_initial, last_name, phone)

8 scheme: specs (map_id, map_type, coverage, format) scheme: project (map_id, project, institution, completed)

9 Simple SQL Queries Queries allow you to ask questions about the data stored in tables or perform an action –SQL statements allow selection, updating, and deletion of database records Select statements always contain the following clauses: SELECT attribute FROM tablename Select statements optionally contain qualifying clauses: WHERE criteria

10 The SELECT, FROM and WHERE clauses SELECT specifies the column or columns to be retrieved from the table. –SELECT attribute1, attribute3, attribute10 –SELECT * FROM specifies the table containing the data of interest –FROM tablename WHERE sets restriction on which items will be selected –WHERE attribute1 = ‘MONDAY’ –WHERE attribute3 >= 12000 and attribute3 < 3000 and attribute4 = ‘cat’ WHERE statements also establish JOINS –WHERE table1.attribute1 = table3.attribute1 and...

11 schemes: maps (mapid, map-title, map-location) data-catalog (mapid, catalog-num) map-index (catalog-num, index_name, theme, source) mapid map-title map-location maps data-catalog mapid catalog-num map-index catalog-num index-name theme source To construct an SQL statement identify the column names to be reported and the table they belong to for the SELECT clause identify necessary joins for the WHERE clause identify the selection criteria for the WHERE clause draw a picture if you have to Constructing an SQL statement

12 Sample SQL Statements - one table Select map-location From maps Select * From map-index Select map-title, map-location From maps Select * From map-index Where theme = ‘land cover’

13 Joins When a query requires data from more than one table you must create a join in the WHERE clause –for example to finding map titles with an index number of 1234 requires information from both the maps table and the map-index table that relationship is established in the WHERE clause between the column(s) in each table that connect the data you need in addition, each table that will be part of the join must be listed in the FROM clause –The SQL statement for the example above is: SELECT map-title FROM maps, data-catalog, map-index WHERE map-index.catalog-num = data-catalog.catalog.num and data-catalog.mapid = maps.mapid and map-index.index-name=‘1234’

14 More Sample SQL statements –find all map titles Select map-title From maps –find all the map titles whose theme is vegetation Select map-title From maps, data-catalog, map-index Where map-index.catalog-num=data-catalog.catalog-num and data-catalog-mapid=maps.mapid and map-index.theme=‘vegetation’ –find all map titles sourced to NASA in index 2637 Select map-title From maps, data-catalog, map-index Where map-index.catalog-num=data-catalog.catalog-num and data-catalog-mapid=maps.mapid and map-index.source=‘NASA’ and index-name=‘2637’


Download ppt "Review External modelling –subsetting the universe of phenomena into user’s views Conceptual modelling –synthesis of external models into a schematic representation."

Similar presentations


Ads by Google