CS 174: Server-Side Web Programming February 12 Class Meeting

Slides:



Advertisements
Similar presentations
Database Systems: Design, Implementation, and Management Eighth Edition Chapter 4 Entity Relationship (ER) Modeling.
Advertisements

Systems Development Life Cycle
1 © Prentice Hall, 2002 Chapter 3: Modeling Data in the Organization Modern Database Management 6 th Edition Jeffrey A. Hoffer, Mary B. Prescott, Fred.
Database Design & Mapping
Databases Revision.
Modeling Data The Entity Relationship Model (ER) For Database Design.
Database Systems: Design, Implementation, and Management Tenth Edition
APPENDIX C DESIGNING DATABASES
© 2007 by Prentice Hall (Hoffer, Prescott & McFadden) 1 Entity Relationship Diagrams (ERDs)
1 © Prentice Hall, 2002 Chapter 3: Modeling Data in the Organization Modern Database Management 6 th Edition Jeffrey A. Hoffer, Mary B. Prescott, Fred.
3.1 CSIS 3310 Chapter 3 The Entity-Relationship Model Conceptual Data Modeling.
Chapter 3: Modeling Data in the Organization
MIS 385/MBA 664 Systems Implementation with DBMS/ Database Management Dave Salisbury ( )
IS 325 Notes for Wednesday September 4, Syllabus Change I eliminated quizzes I increased the points allocated to homework assignments.
Copyright (c) 2014 Pearson Education, Inc. Introduction to Databases.
CMPE 226 Database Systems September 9 Class Meeting Department of Computer Engineering San Jose State University Fall 2015 Instructor: Ron Mak
CMPE 226 Database Systems September 16 Class Meeting Department of Computer Engineering San Jose State University Fall 2015 Instructor: Ron Mak
Chapter 4 Entity Relationship (ER) Modeling.  ER model forms the basis of an ER diagram  ERD represents conceptual database as viewed by end user 
3 & 4 1 Chapters 3 and 4 Drawing ERDs October 16, 2006 Week 3.
Database Systems: Design, Implementation, and Management Ninth Edition Chapter 4 Entity Relationship (ER) Modeling.
Databases Illuminated Chapter 3 The Entity Relationship Model.
AL-MAAREFA COLLEGE FOR SCIENCE AND TECHNOLOGY INFO 232: DATABASE SYSTEMS CHAPTER 4 ENTITY RELATIONSHIP (ER) MODELING Instructor Ms. Arwa Binsaleh 1.
MIS 385/MBA 664 Systems Implementation with DBMS/ Database Management
Data Modeling Using the Entity-Relationship (ER) Data Model.
Chapter 3: Modeling Data in the Organization. Business Rules Statements that define or constrain some aspect of the business Assert business structure.
Entity Relationship Diagram (ERD). Objectives Define terms related to entity relationship modeling, including entity, entity instance, attribute, relationship.
CMPE 226 Database Systems February 16 Class Meeting Department of Computer Engineering San Jose State University Spring 2016 Instructor: Ron Mak
© 2009 Pearson Education, Inc. Publishing as Prentice Hall 1 Chapter 3: Modeling Data in the Organization Modern Database Management 9 th Edition Jeffrey.
Department of Mathematics Computer and Information Science1 CS 351: Database Management Systems Christopher I. G. Lanclos Chapter 4.
CS 160 and CMPE/SE 131 Software Engineering March 10 Class Meeting Department of Computer Science Department of Computer Engineering San José State University.
CS 160 and CMPE/SE 131 Software Engineering March 8 Class Meeting Department of Computer Science Department of Computer Engineering San José State University.
Data Modeling Using the Entity- Relationship (ER) Model
Data Modeling Using the ERD
Logical Database Design and the Rational Model
Data Modeling Using the Entity- Relationship (ER) Model
Entity- Relationship (ER) Model
Entity Relationship Diagram
CHAPTER 2 - Database Requirements and ER Modeling
Entity-Relationship Model
TMC2034 Database Concept and Design
Entity Relationship Model
Business System Development
Chapter 4: Logical Database Design and the Relational Model
Chapter 6 - Database Implementation and Use
© The McGraw-Hill Companies, All Rights Reserved APPENDIX C DESIGNING DATABASES APPENDIX C DESIGNING DATABASES.
Entity-Relationship Model
Tables and Their Characteristics
Database Design – Lecture 4
Quiz Questions Q.1 An entity set that does not have sufficient attributes to form a primary key is a (A) strong entity set. (B) weak entity set. (C) simple.
Databases and Database Management Systems Chapter 9
Chapter 7 Entity-Relationship Model
Outline of the ER Model By S.Saha
CMPE 226 Database Systems February 14 Class Meeting
CMPE 226 Database Systems February 21 Class Meeting
CS 174: Server-Side Web Programming February 14 Class Meeting
Chapter 4 Entity Relationship (ER) Modeling
Database Systems: Design, Implementation, and Management Tenth Edition
CHAPTER 4: LOGICAL DATABASE DESIGN AND THE RELATIONAL MODEL
Database Modeling using Entity Relationship Model (E-R Model)
Review of Week 1 Database DBMS File systems vs. database systems
Chapter 3: Modeling Data in the Organization
CMPE/SE 131 Software Engineering March 9 Class Meeting
CHAPTER 2 - Database Requirements and ER Modeling
Chapter 4 Entity Relationship (ER) Modeling
Entity-Relationship Diagram (ERD)
DBMS ER-Relational Mapping
Entity Relation Model Tingting Zhang.
ER MODELING Instructor: SAMIA ARSHAD
Entity Relationship (ER) Modeling
CMPE/SE 131 Software Engineering March 7 Class Meeting
Presentation transcript:

CS 174: Server-Side Web Programming February 12 Class Meeting Department of Computer Science San Jose State University Spring 2018 Instructor: Ron Mak (substitute for Fabio Di Troia) www.cs.sjsu.edu/~mak

Three-Tier Web Application Architecture Client-side web browser Form data Server-side web server (.html .php images, etc.) Static (.html) or dynamically generated (.php) web pages Back-end database server, e.g. MariaDB Queries Data

Software to Install Download and install XAMPP Contents: https://www.apachefriends.org/index.html Available for Mac, Windows, Linux Contents: Apache Web Server PHP MariaDB database server (compatible with MySQL)

Database System Architecture Database system: A computer-based system that enables efficient interaction between users and information stored in a database. Database Systems by Jukić, Vrbsky, & Nestorov Pearson 2014 ISBN 978-0-13-257567-6

Data Models A data model is a diagram that shows What data an application works with How the data is used Attributes and constraints of the data The relationships among the data Create models of data that will be persisted. Written to and read from a data repository.

Data Models, cont’d We can model data at three abstraction levels: conceptual logical physical

Conceptual Database Model Visualize the requirements. Use a conceptual data modeling technique. Example: Entity-relationship (ER) modeling Implementation independent: No dependencies on the logic of a particular database management system (DBMS). Example DBMS: Oracle, MySQL, etc. Blueprint for the logical model.

Logical Database Model Create the relational database model. Later: Non-relational NoSQL models. It’s usually straightforward to map an ER model to a relational model.

Physical Database Model The physical model is the actual database implementation. Use relational DBMS (RDBMS) software. Later: NoSQL systems Structured Query Language (SQL) commands to create, delete, modify, and query database structures.

Front-End Application Development End users generally do not access the database directly. Front-end applications Access the database directly. Provide end users with safe application-oriented interfaces to query and manipulate the data. Fulfill the end user’s requirements.

Online Database Diagramming Tool See http://erdplus.com Free online drawing tool for: entity-relationship diagram (ERD) relational schema star schema Automatic mapping from ERD to relational schema. Create a personal account to be able to save diagrams.

Online Database Diagramming Tool See http://erdplus.com Free online drawing tool for: entity-relationship diagram (ERD) relational schema star schema Automatic mapping from ERD to relational schema. Create a personal account to be able to save diagrams.

Entities and Attributes Entity Represents a real-world concept. Examples: customer, product, store, event, etc. Data that the database stores. Attribute Characteristic of an entity that the database stores. Examples (for a customer): name, address, id, etc. A unique attribute of an entity has a value that is different for each entity instance.

Entities and Attributes, cont’d In an ER diagram (ERD), show an entity with a rectangle and its attributes with ovals. Underline the unique attribute. Database Systems by Jukić, Vrbsky, & Nestorov Pearson 2014 ISBN 978-0-13-257567-6

Entities and Attributes, cont’d An entity can have multiple unique attributes. Each one is called a candidate key. Database Systems by Jukić, Vrbsky, & Nestorov Pearson 2014 ISBN 978-0-13-257567-6

Composite Attributes A composite attribute is composed of several attributes. Parenthesize the name of the composite attribute. Database Systems by Jukić, Vrbsky, & Nestorov Pearson 2014 ISBN 978-0-13-257567-6

Composite Attributes, cont’d An entity’s unique attribute can be composite. Database Systems by Jukić, Vrbsky, & Nestorov Pearson 2014 ISBN 978-0-13-257567-6

Multivalued Attributes An entity instance can have multiple values for an attribute. If the number of values is fixed, we can use separate attributes instead. Database Systems by Jukić, Vrbsky, & Nestorov Pearson 2014 ISBN 978-0-13-257567-6

Derived Attributes The value of a derived attribute is not stored. It’s calculated from the values of the other attributes and additional data such as the current date. Show with a dashed oval. Database Systems by Jukić, Vrbsky, & Nestorov Pearson 2014 ISBN 978-0-13-257567-6

Optional Attributes An optional attribute does not always have to have a value. Indicate with (O). Database Systems by Jukić, Vrbsky, & Nestorov Pearson 2014 ISBN 978-0-13-257567-6

Relationships Each entity in an ER diagram must be related to at least one other entity. Show a relationship with a diamond and connect the diamond to the entities that are part of the relationship. Database Systems by Jukić, Vrbsky, & Nestorov Pearson 2014 ISBN 978-0-13-257567-6

Relationship Cardinality Show cardinality (how many instances of an entity) with symbols at the end of the relationship lines. Maximum symbol closest to the entity. Minimum symbol further away. Zero, one, many Database Systems by Jukić, Vrbsky, & Nestorov Pearson 2014 ISBN 978-0-13-257567-6

Relationship Cardinality, cont’d Read each relationship in both directions in this order: rectangle diamond cardinality Database Systems by Jukić, Vrbsky, & Nestorov Pearson 2014 ISBN 978-0-13-257567-6

Types of Relationships One-to-one (1:1) One-to-many (1:M) Each employee is allotted at most one vehicle. Each vehicle is allotted to exactly one employee. Each region has located in it at least one (i.e., many) stores. Database Systems by Jukić, Vrbsky, & Nestorov Pearson 2014 ISBN 978-0-13-257567-6

Types of Relationships, cont’d Many-to-many (M:N) Each employee is assigned to no or several (i.e., many) projects. Each project has assigned to it at least one (i.e., many) employee. Database Systems by Jukić, Vrbsky, & Nestorov Pearson 2014 ISBN 978-0-13-257567-6

Exact Cardinalities Indicate exact cardinalities with parenthesized minimum and maximum values. Example: (2, 6) Use M for a non-specific minimum or maximum. Database Systems by Jukić, Vrbsky, & Nestorov Pearson 2014 ISBN 978-0-13-257567-6

Relationship Attributes An relationship can also have attributes. Database Systems by Jukić, Vrbsky, & Nestorov Pearson 2014 ISBN 978-0-13-257567-6

Unary Relationships In a unary relationship, an entity is involved in a relationship with itself. One instance has a relationship with another instance of the same entity. You can indicate the relationship role. Database Systems by Jukić, Vrbsky, & Nestorov Pearson 2014 ISBN 978-0-13-257567-6

Multiple Relationships Two entities can have multiple relationships with each other. Database Systems by Jukić, Vrbsky, & Nestorov Pearson 2014 ISBN 978-0-13-257567-6

Weak Entities A weak entity does not have its own unique attribute. It only has a partial key. Underline the partial key with dashes. Therefore, it must be associated with an owner entity via an identifying relationship. Indicate the weak entity and the identifying relationship with double borders. The partial key and the owner attribute’s unique attribute uniquely identifies the weak entity.

Weak Entities, cont’d Database Systems by Jukić, Vrbsky, & Nestorov Pearson 2014 ISBN 978-0-13-257567-6

ER Diagram Example Database Systems by Jukić, Vrbsky, & Nestorov Pearson 2014 ISBN 978-0-13-257567-6

Logical Database Model Map the ER diagram to a logical model represented as a relational schema. Database Systems by Jukić, Vrbsky, & Nestorov Pearson 2014 ISBN 978-0-13-257567-6

Conditions for a Table to be a Relation Each column must have a name. Within a table, each column name must be unique. All values in each column must be from the same (predefined) domain. Within a table, each row must be unique. Within each row, each value in each column must be single-valued. Multiple values of the content represented by the column are not allowed in any rows of the table.

Relational vs. Non-Relational Tables Database Systems by Jukić, Vrbsky, & Nestorov Pearson 2014 ISBN 978-0-13-257567-6

Additional Properties for a Relational Table The order of columns is irrelevant. The order of rows is irrelevant.

Primary Key Each relation must have a primary key. A column or set of columns whose value uniquely identifies each row. Underline the primary key of the relational table. Database Systems by Jukić, Vrbsky, & Nestorov Pearson 2014 ISBN 978-0-13-257567-6

Mapping Entities Database Systems by Jukić, Vrbsky, & Nestorov Pearson 2014 ISBN 978-0-13-257567-6

Mapping Entities, cont’d As mapped. Entity with a composite attribute. As seen by a front-end application. Database Systems by Jukić, Vrbsky, & Nestorov Pearson 2014 ISBN 978-0-13-257567-6

Mapping Entities, cont’d Attribute with a composite primary key. Database Systems by Jukić, Vrbsky, & Nestorov Pearson 2014 ISBN 978-0-13-257567-6

Mapping Entities, cont’d Entity with an optional attribute. Database Systems by Jukić, Vrbsky, & Nestorov Pearson 2014 ISBN 978-0-13-257567-6

Entity Integrity Constraint No primary key column of a relational table can have null (empty) values. Database Systems by Jukić, Vrbsky, & Nestorov Pearson 2014 ISBN 978-0-13-257567-6

Entity Integrity Constraint, cont’d Database Systems by Jukić, Vrbsky, & Nestorov Pearson 2014 ISBN 978-0-13-257567-6