SlideShare a Scribd company logo
1 of 31
Download to read offline
Conceptual Modeling
& PHP Forms
Lecture 03
National IT ProfessionalsAssociation ofAfghanistan
NITPAA
Lecturers:
M.Zalmai Rahmani & Parwiz Danyar
Database Design Process
high level specs
conceptual schema
logical schema
(in DBMS model)
miniworld
conceptual design
logical design
physical design
functional analysis
application design
transaction implementation
Data requirementsfunctional requirements
application programs Physical schema
Requirement Analysis
Functional Design Database Design
Requirements of a Conceptual
Data Model
Expressiveness: should be expressive enough to allow modeling of
different types of relationships, objects and constraints of the miniworld.
Simplicity: non-specialists should be able to understand
Diagrammatic Representation: to ease interpretation
Formality: There should be no ambiguity in the specification
Entiities and Entity Sets
Entities
• nouns, ‘things’ in the world.
• E.g., students, courses, employees, departments, flights,
patients, ...
Attributes
• properties of entities.
• E.g., course name, deptname, departure time, age,
room#, ...
Entity set -- a set of entities that have the same attributes.
• an entity set is similar to a class, and an entity similar to an
instance
Attributes
single-valued vrs multi-valued:
• color of car could be multi-valued
• salary of employee is single-valued
atomic vrs composite:
• age of a person is atomic
• address of a person could be composite
stored vrs derived:
• derived attributes are those that can be derived from other
attributes or entities, e.g., age can be derived from date of birth.
• All other attributes are stored attributes
Relationships
sam 62900 main austin
pat 62901 north urbana
259 10000
245 2400
364 200000
305 20000
customer
account
Relationship:
• association between multiple entities
Relationship Set:
• set if relationships over the same entity sets
Binary,Ternary, 4-nary, … relationship sets
Cust-Account
Relationship set
Visualizing ER Relationships as a
Table
Relationship Set Corresponding to the Relationship Cust-Account
Row in the table
represents the pair
of entities
participating in
the relationship
Customer Account
John 1001
Megan 1001
Megan 2001
ER Diagram -- graphical
representation of ER schema
customer custacct account
cust name
ssno
street
city
acct number
balance
opening date
 Entity set -- rectangles; attributes -- ellipses; dashed ellipse -- derived
attribute; double ellipse -- multivalued attribute; relationship set --
diamonds; lines connect the respective relationship set with entity sets;
 Relationship sets may have 1 or many attributes associated with them --
known as relationship attributes.
Roles in a Relationship
The function that an entity plays in a relationship is called its role
Roles are normally not explicitly specified unless the meaning of the
relationship needs clarification
Roles needed when entity set is related to itself via a relationship.
employee works for
manager
worker
Constraints on Entity Sets
Key Constraint:
• With each entity set a notion of a key can be associated.
• A key is a set of attributes that uniquely identify an entity in entity set.
• Examples:
• designer may specify that {ssno} is a key for a entity set customer
entity with attributes {ssno, accountno, balance, name, address}
• designer may specify that {accountno} is also a key , that is, no joint
accounts are permitted.
• Denoted in ER diagram by underlining the attributes that form a key
• multiple keys may exist in which case one chosen as primary key and
underlined. Other keys called secondary keys either not indicated or
listed in a side comment attached to the diagram.
Constraints on Relationship Sets
Consider binary relationship set R between entity sets A and B
One to one: an entity in A is associated with at most one entity in B, and an
entity in B is associated with atmost one entity in A.
• an employee has only one spouse in a married-to relationship.
Many to One: An entity in A is associated with at most one entity in B, an
entity in B is associated with many entities in A.
• an employee works in a single department but a department consists of
many employees.
Constraints on Relationship
Sets(Cont.)
Many to Many: An entity in A is associated with many entities in B, and an
entity in B is associated with many entities in A.
• A customer may have many bank accounts. Accounts may be joint
between multiple customers.
Multiplicity of Relationships
Many-to-one One-to-oneMany-to-many
multiplicity of relationship in ER diagram represented by an
arrow pointing to “one”
Multiplicity of Relationships
Many-to-one One-to-oneMany-to-many
multiplicity of relationship in ER diagram represented by an
arrow pointing to “one”
Many to Many Relationship
• Multiple customers can share an account
• Many accounts may have one owner
customer custacct account
opening date
Customer Account Start Date
John 1001 Jan 20th
1999
Megan 1001 March 16th
1999
Megan 2001 Feb 18th
1994
Customer Account Start Date
John 1001 Jan 20th
1999
Megan 1001 March 16th
1999
legallegal
Many to One Relationship
• In a Many-One relationship, relationship attributes can be
repositioned to the entity set on the many side.
customer custacct account
opening date
customer custacct account
opening date
One to One Relationship
1 customer can have 1 account.
One account can be owned by
1 customer
relationship attributes can be
shifted to either of the entity
sets
Customer Account Start Date
Megan 1001 March 16th
1999
Megan 2001 Feb 18th
1994
Illegal
Customer Account Start Date
John 1001 Jan 20th
1999
Megan 1001 March 16th
1999
Illegal
Customer Account Start Date
Megan 1001 March 16th
1999
John 2001 Feb 18th
1994
Legal
customer custacct account
opening date
Weak Entity Sets
Entity sets that do not have sufficient attributes to form a key are called
weak entity sets.
A weak entity set existentially depend upon (one or more) strong entity
sets via a one-to-many relationship from whom they derive their key
A weak entity set may have a discriminator (or a partial key) that
distinguish between weak entities related to the same strong entity
key of weak entity set = Key of owner entity set(s) + discriminator
Weak Entity Sets (Cont.)
customer custacct account
cust name
ssno
street
city
acct number balance
opening date
transaction
Trans#
log
• Transaction is a weak entity set
related to accounts via log
relationship.
• Trans# distinguish different
transactions on same account
Weak Entity Sets (Cont.)
customer custacct account
cust name
ssno
street
city
acct number balance
opening date
transaction
Trans#
log
• Transaction is a weak entity set
related to accounts via log
relationship.
• Trans# distinguish different
transactions on same account
PHP Forms
PHP Forms and User Input
PHP Forms
PHP Form Handling
 The PHP $_GET and $_POST variables are used to retrieve information
from forms, like user input.
 The most important thing to notice when dealing with HTML forms and
PHP is that any form element in an HTML page will automatically be
available to your PHP scripts.
 The example below contains an HTML form with two input fields and a
submit button:
PHP Forms
PHP Form Handling
 When a user fills out the form above and click on the submit button, the
form data is sent to a PHP file, called "welcome.php":
"welcome.php" looks like this:
PHP Forms
PHP $_GET Function
 The built-in $_GET function is used to collect values in a form with
method="get".
 Information sent from a form with the GET method is visible to everyone
(it will be displayed in the browser's address bar) and has limits on the
amount of information to send.
PHP Forms
PHP $_GET Function
 When the user clicks the "Submit" button, the URL sent to the server
could look something like this:
PHP Forms
When to use method="get"?
 When using method="get" in HTML forms, all variable names and values
are displayed in the URL.
Note:This method should not be used when sending passwords or other
sensitive information!
 However, because the variables are displayed in the URL, it is possible to
bookmark the page.This can be useful in some cases.
Note:The get method is not suitable for very large variable values. It should
not be used with values exceeding 2000 characters.
PHP Forms
The $_POST Function
 The built-in $_POST function is used to collect values from a form sent
with method="post".
 Information sent from a form with the POST method is invisible to others
and has no limits on the amount of information to send.
Note: However, there is an 8 Mb max size for the POST method, by default
(can be changed by setting the post_max_size in the php.ini file).
PHP Forms
The $_POST Function
PHP Forms
When to use method="post"?
 Information sent from a form with the POST method is invisible to others
and has no limits on the amount of information to send.
 However, because the variables are not displayed in the URL, it is not
possible to bookmark the page.
The PHP $_REQUEST Function
 The PHP built-in $_REQUEST function contains the contents of both
$_GET, $_POST, and $_COOKIE.
 The $_REQUEST function can be used to collect form data sent with both
the GET and POST methods.
www.w3schools.com
PHP/MySQL Programming Class Lecture 03

More Related Content

What's hot

ER Diagrams Simplified
ER Diagrams SimplifiedER Diagrams Simplified
ER Diagrams SimplifiedPuneet Arora
 
Er Model Nandha&Mani
Er Model Nandha&ManiEr Model Nandha&Mani
Er Model Nandha&Maniguest1e0229a
 
Database Management System
Database Management System Database Management System
Database Management System FellowBuddy.com
 
03 Ch3 Notes Revised
03 Ch3 Notes Revised03 Ch3 Notes Revised
03 Ch3 Notes Revisedguest6f408c
 
Entity Relationship Model
Entity Relationship ModelEntity Relationship Model
Entity Relationship ModelA. S. M. Shafi
 
ECEG 4702-Class7-Entity-Relationship modeling.pptx
ECEG 4702-Class7-Entity-Relationship modeling.pptxECEG 4702-Class7-Entity-Relationship modeling.pptx
ECEG 4702-Class7-Entity-Relationship modeling.pptxmiftah88
 
Basic concepts of Data and Databases
Basic concepts of Data and Databases Basic concepts of Data and Databases
Basic concepts of Data and Databases Tharindu Weerasinghe
 
Chapter-3 Data Modeling Using the Entity-Relationship Model
Chapter-3  Data Modeling Using the Entity-Relationship ModelChapter-3  Data Modeling Using the Entity-Relationship Model
Chapter-3 Data Modeling Using the Entity-Relationship ModelRaj vardhan
 
Entity Relationship Model
Entity Relationship ModelEntity Relationship Model
Entity Relationship ModelNeil Neelesh
 
Fundamentals of database system - Data Modeling Using the Entity-Relationshi...
Fundamentals of database system  - Data Modeling Using the Entity-Relationshi...Fundamentals of database system  - Data Modeling Using the Entity-Relationshi...
Fundamentals of database system - Data Modeling Using the Entity-Relationshi...Mustafa Kamel Mohammadi
 
Bsc cs ii-dbms- u-iii-data modeling using e.r. model (entity relationship model)
Bsc cs ii-dbms- u-iii-data modeling using e.r. model (entity relationship model)Bsc cs ii-dbms- u-iii-data modeling using e.r. model (entity relationship model)
Bsc cs ii-dbms- u-iii-data modeling using e.r. model (entity relationship model)Rai University
 
Data Modeling and Database Design 2nd Edition by Umanath Scamell Solution Manual
Data Modeling and Database Design 2nd Edition by Umanath Scamell Solution ManualData Modeling and Database Design 2nd Edition by Umanath Scamell Solution Manual
Data Modeling and Database Design 2nd Edition by Umanath Scamell Solution Manualendokayle
 
2. Entity Relationship Model in DBMS
2. Entity Relationship Model in DBMS2. Entity Relationship Model in DBMS
2. Entity Relationship Model in DBMSkoolkampus
 
Entity Relationship Model
Entity Relationship ModelEntity Relationship Model
Entity Relationship ModelSlideshare
 
Entity Relationship Diagram2
Entity Relationship Diagram2Entity Relationship Diagram2
Entity Relationship Diagram2sadeenedian08
 
Data Modeling Using the EntityRelationship (ER) Model
Data Modeling Using the EntityRelationship (ER) ModelData Modeling Using the EntityRelationship (ER) Model
Data Modeling Using the EntityRelationship (ER) Modelsontumax
 

What's hot (19)

ER Diagrams Simplified
ER Diagrams SimplifiedER Diagrams Simplified
ER Diagrams Simplified
 
Er Model Nandha&Mani
Er Model Nandha&ManiEr Model Nandha&Mani
Er Model Nandha&Mani
 
DBMS PPT
DBMS PPTDBMS PPT
DBMS PPT
 
Database Management System
Database Management System Database Management System
Database Management System
 
03 Ch3 Notes Revised
03 Ch3 Notes Revised03 Ch3 Notes Revised
03 Ch3 Notes Revised
 
Entity Relationship Model
Entity Relationship ModelEntity Relationship Model
Entity Relationship Model
 
ECEG 4702-Class7-Entity-Relationship modeling.pptx
ECEG 4702-Class7-Entity-Relationship modeling.pptxECEG 4702-Class7-Entity-Relationship modeling.pptx
ECEG 4702-Class7-Entity-Relationship modeling.pptx
 
Basic concepts of Data and Databases
Basic concepts of Data and Databases Basic concepts of Data and Databases
Basic concepts of Data and Databases
 
Chapter-3 Data Modeling Using the Entity-Relationship Model
Chapter-3  Data Modeling Using the Entity-Relationship ModelChapter-3  Data Modeling Using the Entity-Relationship Model
Chapter-3 Data Modeling Using the Entity-Relationship Model
 
Entity Relationship Model
Entity Relationship ModelEntity Relationship Model
Entity Relationship Model
 
Fundamentals of database system - Data Modeling Using the Entity-Relationshi...
Fundamentals of database system  - Data Modeling Using the Entity-Relationshi...Fundamentals of database system  - Data Modeling Using the Entity-Relationshi...
Fundamentals of database system - Data Modeling Using the Entity-Relationshi...
 
Bsc cs ii-dbms- u-iii-data modeling using e.r. model (entity relationship model)
Bsc cs ii-dbms- u-iii-data modeling using e.r. model (entity relationship model)Bsc cs ii-dbms- u-iii-data modeling using e.r. model (entity relationship model)
Bsc cs ii-dbms- u-iii-data modeling using e.r. model (entity relationship model)
 
E r model
E r modelE r model
E r model
 
Data Modeling and Database Design 2nd Edition by Umanath Scamell Solution Manual
Data Modeling and Database Design 2nd Edition by Umanath Scamell Solution ManualData Modeling and Database Design 2nd Edition by Umanath Scamell Solution Manual
Data Modeling and Database Design 2nd Edition by Umanath Scamell Solution Manual
 
2. Entity Relationship Model in DBMS
2. Entity Relationship Model in DBMS2. Entity Relationship Model in DBMS
2. Entity Relationship Model in DBMS
 
Entity Relationship Model
Entity Relationship ModelEntity Relationship Model
Entity Relationship Model
 
DBMS Class 3
DBMS Class 3DBMS Class 3
DBMS Class 3
 
Entity Relationship Diagram2
Entity Relationship Diagram2Entity Relationship Diagram2
Entity Relationship Diagram2
 
Data Modeling Using the EntityRelationship (ER) Model
Data Modeling Using the EntityRelationship (ER) ModelData Modeling Using the EntityRelationship (ER) Model
Data Modeling Using the EntityRelationship (ER) Model
 

Similar to PHP/MySQL Programming Class Lecture 03

Conceptual Modeling of Data
Conceptual Modeling of DataConceptual Modeling of Data
Conceptual Modeling of DataM.Zalmai Rahmani
 
Entityrelationshipmodel
EntityrelationshipmodelEntityrelationshipmodel
EntityrelationshipmodelEnes Bolfidan
 
entityrelationshipmodel.pptx
entityrelationshipmodel.pptxentityrelationshipmodel.pptx
entityrelationshipmodel.pptxThangamaniR3
 
Chapter 2. Concepctual design -.pptx
Chapter 2. Concepctual design -.pptxChapter 2. Concepctual design -.pptx
Chapter 2. Concepctual design -.pptxsantosh96234
 
ER Digramms by Harshal wagh
ER Digramms by Harshal waghER Digramms by Harshal wagh
ER Digramms by Harshal waghharshalkwagh999
 
The entity relationship model
The entity relationship modelThe entity relationship model
The entity relationship modelyash patel
 
Cn presentation on the topic called as re modelling
Cn presentation on the topic called as re modellingCn presentation on the topic called as re modelling
Cn presentation on the topic called as re modellingg30162363
 
ICT DBA3 09 0710 Model Data Objects.pdf
ICT DBA3 09 0710 Model Data Objects.pdfICT DBA3 09 0710 Model Data Objects.pdf
ICT DBA3 09 0710 Model Data Objects.pdfInfotech27
 
WBC Entity Relationship and data flow diagrams
WBC Entity Relationship and data flow diagramsWBC Entity Relationship and data flow diagrams
WBC Entity Relationship and data flow diagramsArshitSood3
 

Similar to PHP/MySQL Programming Class Lecture 03 (20)

Conceptual Modeling of Data
Conceptual Modeling of DataConceptual Modeling of Data
Conceptual Modeling of Data
 
Entityrelationshipmodel
EntityrelationshipmodelEntityrelationshipmodel
Entityrelationshipmodel
 
Revision ch 3
Revision ch 3Revision ch 3
Revision ch 3
 
ER modeling
ER modelingER modeling
ER modeling
 
Database part3-
Database part3-Database part3-
Database part3-
 
entityrelationshipmodel.pptx
entityrelationshipmodel.pptxentityrelationshipmodel.pptx
entityrelationshipmodel.pptx
 
ER MODEL
ER MODELER MODEL
ER MODEL
 
Datastage database design and data modeling ppt 4
Datastage database design and data modeling ppt 4Datastage database design and data modeling ppt 4
Datastage database design and data modeling ppt 4
 
Unit02 dbms
Unit02 dbmsUnit02 dbms
Unit02 dbms
 
Chapter 2. Concepctual design -.pptx
Chapter 2. Concepctual design -.pptxChapter 2. Concepctual design -.pptx
Chapter 2. Concepctual design -.pptx
 
ER Digramms by Harshal wagh
ER Digramms by Harshal waghER Digramms by Harshal wagh
ER Digramms by Harshal wagh
 
Database design
Database designDatabase design
Database design
 
database1
database1database1
database1
 
The entity relationship model
The entity relationship modelThe entity relationship model
The entity relationship model
 
abuukarE r model
abuukarE r modelabuukarE r model
abuukarE r model
 
E R Model details.ppt
E R Model details.pptE R Model details.ppt
E R Model details.ppt
 
Cn presentation on the topic called as re modelling
Cn presentation on the topic called as re modellingCn presentation on the topic called as re modelling
Cn presentation on the topic called as re modelling
 
ICT DBA3 09 0710 Model Data Objects.pdf
ICT DBA3 09 0710 Model Data Objects.pdfICT DBA3 09 0710 Model Data Objects.pdf
ICT DBA3 09 0710 Model Data Objects.pdf
 
WBC Entity Relationship and data flow diagrams
WBC Entity Relationship and data flow diagramsWBC Entity Relationship and data flow diagrams
WBC Entity Relationship and data flow diagrams
 
Database.pdf
Database.pdfDatabase.pdf
Database.pdf
 

More from National IT Professionals Association of Afghanistan

More from National IT Professionals Association of Afghanistan (9)

Internet governance-and-digital-divide-ahmad-waleed-khaliqi-shamsullah-shams-...
Internet governance-and-digital-divide-ahmad-waleed-khaliqi-shamsullah-shams-...Internet governance-and-digital-divide-ahmad-waleed-khaliqi-shamsullah-shams-...
Internet governance-and-digital-divide-ahmad-waleed-khaliqi-shamsullah-shams-...
 
Internet eco-system-afghanistan-a.-khalil-azizi-at-af sig-2017-by-nitpaa
Internet eco-system-afghanistan-a.-khalil-azizi-at-af sig-2017-by-nitpaaInternet eco-system-afghanistan-a.-khalil-azizi-at-af sig-2017-by-nitpaa
Internet eco-system-afghanistan-a.-khalil-azizi-at-af sig-2017-by-nitpaa
 
Women right-nooria-ahmadi-af sig-2017-nitpaa
Women right-nooria-ahmadi-af sig-2017-nitpaaWomen right-nooria-ahmadi-af sig-2017-nitpaa
Women right-nooria-ahmadi-af sig-2017-nitpaa
 
Human rights-in-internet-governance-drf-nighat-dad-at-af sig-2017-by-nitpaa
Human rights-in-internet-governance-drf-nighat-dad-at-af sig-2017-by-nitpaaHuman rights-in-internet-governance-drf-nighat-dad-at-af sig-2017-by-nitpaa
Human rights-in-internet-governance-drf-nighat-dad-at-af sig-2017-by-nitpaa
 
Dns system-ahmadullah-alnoor-at-af sig-2017-by-nitpaa
Dns system-ahmadullah-alnoor-at-af sig-2017-by-nitpaaDns system-ahmadullah-alnoor-at-af sig-2017-by-nitpaa
Dns system-ahmadullah-alnoor-at-af sig-2017-by-nitpaa
 
Asia and-the-next-billion-challenges-in-digital-inclusion-mr.-satish-babu-at-...
Asia and-the-next-billion-challenges-in-digital-inclusion-mr.-satish-babu-at-...Asia and-the-next-billion-challenges-in-digital-inclusion-mr.-satish-babu-at-...
Asia and-the-next-billion-challenges-in-digital-inclusion-mr.-satish-babu-at-...
 
Asaan khedmat-shahzad-aryobee-at-af sig-2017-by-nitpaa
Asaan khedmat-shahzad-aryobee-at-af sig-2017-by-nitpaaAsaan khedmat-shahzad-aryobee-at-af sig-2017-by-nitpaa
Asaan khedmat-shahzad-aryobee-at-af sig-2017-by-nitpaa
 
Aptld presentation-leonid-todorov-at-af sig-2017-by-nitpaa
Aptld presentation-leonid-todorov-at-af sig-2017-by-nitpaaAptld presentation-leonid-todorov-at-af sig-2017-by-nitpaa
Aptld presentation-leonid-todorov-at-af sig-2017-by-nitpaa
 
PHP/MySQL First Session Material
PHP/MySQL First Session MaterialPHP/MySQL First Session Material
PHP/MySQL First Session Material
 

Recently uploaded

Unblocking The Main Thread Solving ANRs and Frozen Frames
Unblocking The Main Thread Solving ANRs and Frozen FramesUnblocking The Main Thread Solving ANRs and Frozen Frames
Unblocking The Main Thread Solving ANRs and Frozen FramesSinan KOZAK
 
Pigging Solutions Piggable Sweeping Elbows
Pigging Solutions Piggable Sweeping ElbowsPigging Solutions Piggable Sweeping Elbows
Pigging Solutions Piggable Sweeping ElbowsPigging Solutions
 
Gen AI in Business - Global Trends Report 2024.pdf
Gen AI in Business - Global Trends Report 2024.pdfGen AI in Business - Global Trends Report 2024.pdf
Gen AI in Business - Global Trends Report 2024.pdfAddepto
 
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)Mark Simos
 
Nell’iperspazio con Rocket: il Framework Web di Rust!
Nell’iperspazio con Rocket: il Framework Web di Rust!Nell’iperspazio con Rocket: il Framework Web di Rust!
Nell’iperspazio con Rocket: il Framework Web di Rust!Commit University
 
Understanding the Laravel MVC Architecture
Understanding the Laravel MVC ArchitectureUnderstanding the Laravel MVC Architecture
Understanding the Laravel MVC ArchitecturePixlogix Infotech
 
Science&tech:THE INFORMATION AGE STS.pdf
Science&tech:THE INFORMATION AGE STS.pdfScience&tech:THE INFORMATION AGE STS.pdf
Science&tech:THE INFORMATION AGE STS.pdfjimielynbastida
 
Bluetooth Controlled Car with Arduino.pdf
Bluetooth Controlled Car with Arduino.pdfBluetooth Controlled Car with Arduino.pdf
Bluetooth Controlled Car with Arduino.pdfngoud9212
 
WordPress Websites for Engineers: Elevate Your Brand
WordPress Websites for Engineers: Elevate Your BrandWordPress Websites for Engineers: Elevate Your Brand
WordPress Websites for Engineers: Elevate Your Brandgvaughan
 
SQL Database Design For Developers at php[tek] 2024
SQL Database Design For Developers at php[tek] 2024SQL Database Design For Developers at php[tek] 2024
SQL Database Design For Developers at php[tek] 2024Scott Keck-Warren
 
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 3652toLead Limited
 
Unleash Your Potential - Namagunga Girls Coding Club
Unleash Your Potential - Namagunga Girls Coding ClubUnleash Your Potential - Namagunga Girls Coding Club
Unleash Your Potential - Namagunga Girls Coding ClubKalema Edgar
 
Bun (KitWorks Team Study 노별마루 발표 2024.4.22)
Bun (KitWorks Team Study 노별마루 발표 2024.4.22)Bun (KitWorks Team Study 노별마루 발표 2024.4.22)
Bun (KitWorks Team Study 노별마루 발표 2024.4.22)Wonjun Hwang
 
My INSURER PTE LTD - Insurtech Innovation Award 2024
My INSURER PTE LTD - Insurtech Innovation Award 2024My INSURER PTE LTD - Insurtech Innovation Award 2024
My INSURER PTE LTD - Insurtech Innovation Award 2024The Digital Insurer
 
My Hashitalk Indonesia April 2024 Presentation
My Hashitalk Indonesia April 2024 PresentationMy Hashitalk Indonesia April 2024 Presentation
My Hashitalk Indonesia April 2024 PresentationRidwan Fadjar
 
"ML in Production",Oleksandr Bagan
"ML in Production",Oleksandr Bagan"ML in Production",Oleksandr Bagan
"ML in Production",Oleksandr BaganFwdays
 
Vertex AI Gemini Prompt Engineering Tips
Vertex AI Gemini Prompt Engineering TipsVertex AI Gemini Prompt Engineering Tips
Vertex AI Gemini Prompt Engineering TipsMiki Katsuragi
 
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...Integration and Automation in Practice: CI/CD in Mule Integration and Automat...
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...Patryk Bandurski
 

Recently uploaded (20)

Unblocking The Main Thread Solving ANRs and Frozen Frames
Unblocking The Main Thread Solving ANRs and Frozen FramesUnblocking The Main Thread Solving ANRs and Frozen Frames
Unblocking The Main Thread Solving ANRs and Frozen Frames
 
Pigging Solutions Piggable Sweeping Elbows
Pigging Solutions Piggable Sweeping ElbowsPigging Solutions Piggable Sweeping Elbows
Pigging Solutions Piggable Sweeping Elbows
 
Gen AI in Business - Global Trends Report 2024.pdf
Gen AI in Business - Global Trends Report 2024.pdfGen AI in Business - Global Trends Report 2024.pdf
Gen AI in Business - Global Trends Report 2024.pdf
 
E-Vehicle_Hacking_by_Parul Sharma_null_owasp.pptx
E-Vehicle_Hacking_by_Parul Sharma_null_owasp.pptxE-Vehicle_Hacking_by_Parul Sharma_null_owasp.pptx
E-Vehicle_Hacking_by_Parul Sharma_null_owasp.pptx
 
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)
 
Nell’iperspazio con Rocket: il Framework Web di Rust!
Nell’iperspazio con Rocket: il Framework Web di Rust!Nell’iperspazio con Rocket: il Framework Web di Rust!
Nell’iperspazio con Rocket: il Framework Web di Rust!
 
Understanding the Laravel MVC Architecture
Understanding the Laravel MVC ArchitectureUnderstanding the Laravel MVC Architecture
Understanding the Laravel MVC Architecture
 
Science&tech:THE INFORMATION AGE STS.pdf
Science&tech:THE INFORMATION AGE STS.pdfScience&tech:THE INFORMATION AGE STS.pdf
Science&tech:THE INFORMATION AGE STS.pdf
 
Bluetooth Controlled Car with Arduino.pdf
Bluetooth Controlled Car with Arduino.pdfBluetooth Controlled Car with Arduino.pdf
Bluetooth Controlled Car with Arduino.pdf
 
WordPress Websites for Engineers: Elevate Your Brand
WordPress Websites for Engineers: Elevate Your BrandWordPress Websites for Engineers: Elevate Your Brand
WordPress Websites for Engineers: Elevate Your Brand
 
SQL Database Design For Developers at php[tek] 2024
SQL Database Design For Developers at php[tek] 2024SQL Database Design For Developers at php[tek] 2024
SQL Database Design For Developers at php[tek] 2024
 
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365
 
Unleash Your Potential - Namagunga Girls Coding Club
Unleash Your Potential - Namagunga Girls Coding ClubUnleash Your Potential - Namagunga Girls Coding Club
Unleash Your Potential - Namagunga Girls Coding Club
 
Bun (KitWorks Team Study 노별마루 발표 2024.4.22)
Bun (KitWorks Team Study 노별마루 발표 2024.4.22)Bun (KitWorks Team Study 노별마루 발표 2024.4.22)
Bun (KitWorks Team Study 노별마루 발표 2024.4.22)
 
My INSURER PTE LTD - Insurtech Innovation Award 2024
My INSURER PTE LTD - Insurtech Innovation Award 2024My INSURER PTE LTD - Insurtech Innovation Award 2024
My INSURER PTE LTD - Insurtech Innovation Award 2024
 
My Hashitalk Indonesia April 2024 Presentation
My Hashitalk Indonesia April 2024 PresentationMy Hashitalk Indonesia April 2024 Presentation
My Hashitalk Indonesia April 2024 Presentation
 
"ML in Production",Oleksandr Bagan
"ML in Production",Oleksandr Bagan"ML in Production",Oleksandr Bagan
"ML in Production",Oleksandr Bagan
 
Vertex AI Gemini Prompt Engineering Tips
Vertex AI Gemini Prompt Engineering TipsVertex AI Gemini Prompt Engineering Tips
Vertex AI Gemini Prompt Engineering Tips
 
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...Integration and Automation in Practice: CI/CD in Mule Integration and Automat...
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...
 
Vulnerability_Management_GRC_by Sohang Sengupta.pptx
Vulnerability_Management_GRC_by Sohang Sengupta.pptxVulnerability_Management_GRC_by Sohang Sengupta.pptx
Vulnerability_Management_GRC_by Sohang Sengupta.pptx
 

PHP/MySQL Programming Class Lecture 03

  • 1. Conceptual Modeling & PHP Forms Lecture 03 National IT ProfessionalsAssociation ofAfghanistan NITPAA Lecturers: M.Zalmai Rahmani & Parwiz Danyar
  • 2. Database Design Process high level specs conceptual schema logical schema (in DBMS model) miniworld conceptual design logical design physical design functional analysis application design transaction implementation Data requirementsfunctional requirements application programs Physical schema Requirement Analysis Functional Design Database Design
  • 3. Requirements of a Conceptual Data Model Expressiveness: should be expressive enough to allow modeling of different types of relationships, objects and constraints of the miniworld. Simplicity: non-specialists should be able to understand Diagrammatic Representation: to ease interpretation Formality: There should be no ambiguity in the specification
  • 4. Entiities and Entity Sets Entities • nouns, ‘things’ in the world. • E.g., students, courses, employees, departments, flights, patients, ... Attributes • properties of entities. • E.g., course name, deptname, departure time, age, room#, ... Entity set -- a set of entities that have the same attributes. • an entity set is similar to a class, and an entity similar to an instance
  • 5. Attributes single-valued vrs multi-valued: • color of car could be multi-valued • salary of employee is single-valued atomic vrs composite: • age of a person is atomic • address of a person could be composite stored vrs derived: • derived attributes are those that can be derived from other attributes or entities, e.g., age can be derived from date of birth. • All other attributes are stored attributes
  • 6. Relationships sam 62900 main austin pat 62901 north urbana 259 10000 245 2400 364 200000 305 20000 customer account Relationship: • association between multiple entities Relationship Set: • set if relationships over the same entity sets Binary,Ternary, 4-nary, … relationship sets Cust-Account Relationship set
  • 7. Visualizing ER Relationships as a Table Relationship Set Corresponding to the Relationship Cust-Account Row in the table represents the pair of entities participating in the relationship Customer Account John 1001 Megan 1001 Megan 2001
  • 8. ER Diagram -- graphical representation of ER schema customer custacct account cust name ssno street city acct number balance opening date  Entity set -- rectangles; attributes -- ellipses; dashed ellipse -- derived attribute; double ellipse -- multivalued attribute; relationship set -- diamonds; lines connect the respective relationship set with entity sets;  Relationship sets may have 1 or many attributes associated with them -- known as relationship attributes.
  • 9. Roles in a Relationship The function that an entity plays in a relationship is called its role Roles are normally not explicitly specified unless the meaning of the relationship needs clarification Roles needed when entity set is related to itself via a relationship. employee works for manager worker
  • 10. Constraints on Entity Sets Key Constraint: • With each entity set a notion of a key can be associated. • A key is a set of attributes that uniquely identify an entity in entity set. • Examples: • designer may specify that {ssno} is a key for a entity set customer entity with attributes {ssno, accountno, balance, name, address} • designer may specify that {accountno} is also a key , that is, no joint accounts are permitted. • Denoted in ER diagram by underlining the attributes that form a key • multiple keys may exist in which case one chosen as primary key and underlined. Other keys called secondary keys either not indicated or listed in a side comment attached to the diagram.
  • 11. Constraints on Relationship Sets Consider binary relationship set R between entity sets A and B One to one: an entity in A is associated with at most one entity in B, and an entity in B is associated with atmost one entity in A. • an employee has only one spouse in a married-to relationship. Many to One: An entity in A is associated with at most one entity in B, an entity in B is associated with many entities in A. • an employee works in a single department but a department consists of many employees.
  • 12. Constraints on Relationship Sets(Cont.) Many to Many: An entity in A is associated with many entities in B, and an entity in B is associated with many entities in A. • A customer may have many bank accounts. Accounts may be joint between multiple customers.
  • 13. Multiplicity of Relationships Many-to-one One-to-oneMany-to-many multiplicity of relationship in ER diagram represented by an arrow pointing to “one”
  • 14. Multiplicity of Relationships Many-to-one One-to-oneMany-to-many multiplicity of relationship in ER diagram represented by an arrow pointing to “one”
  • 15. Many to Many Relationship • Multiple customers can share an account • Many accounts may have one owner customer custacct account opening date Customer Account Start Date John 1001 Jan 20th 1999 Megan 1001 March 16th 1999 Megan 2001 Feb 18th 1994 Customer Account Start Date John 1001 Jan 20th 1999 Megan 1001 March 16th 1999 legallegal
  • 16. Many to One Relationship • In a Many-One relationship, relationship attributes can be repositioned to the entity set on the many side. customer custacct account opening date customer custacct account opening date
  • 17. One to One Relationship 1 customer can have 1 account. One account can be owned by 1 customer relationship attributes can be shifted to either of the entity sets Customer Account Start Date Megan 1001 March 16th 1999 Megan 2001 Feb 18th 1994 Illegal Customer Account Start Date John 1001 Jan 20th 1999 Megan 1001 March 16th 1999 Illegal Customer Account Start Date Megan 1001 March 16th 1999 John 2001 Feb 18th 1994 Legal customer custacct account opening date
  • 18. Weak Entity Sets Entity sets that do not have sufficient attributes to form a key are called weak entity sets. A weak entity set existentially depend upon (one or more) strong entity sets via a one-to-many relationship from whom they derive their key A weak entity set may have a discriminator (or a partial key) that distinguish between weak entities related to the same strong entity key of weak entity set = Key of owner entity set(s) + discriminator
  • 19. Weak Entity Sets (Cont.) customer custacct account cust name ssno street city acct number balance opening date transaction Trans# log • Transaction is a weak entity set related to accounts via log relationship. • Trans# distinguish different transactions on same account
  • 20. Weak Entity Sets (Cont.) customer custacct account cust name ssno street city acct number balance opening date transaction Trans# log • Transaction is a weak entity set related to accounts via log relationship. • Trans# distinguish different transactions on same account
  • 21. PHP Forms PHP Forms and User Input
  • 22. PHP Forms PHP Form Handling  The PHP $_GET and $_POST variables are used to retrieve information from forms, like user input.  The most important thing to notice when dealing with HTML forms and PHP is that any form element in an HTML page will automatically be available to your PHP scripts.  The example below contains an HTML form with two input fields and a submit button:
  • 23. PHP Forms PHP Form Handling  When a user fills out the form above and click on the submit button, the form data is sent to a PHP file, called "welcome.php": "welcome.php" looks like this:
  • 24. PHP Forms PHP $_GET Function  The built-in $_GET function is used to collect values in a form with method="get".  Information sent from a form with the GET method is visible to everyone (it will be displayed in the browser's address bar) and has limits on the amount of information to send.
  • 25. PHP Forms PHP $_GET Function  When the user clicks the "Submit" button, the URL sent to the server could look something like this:
  • 26. PHP Forms When to use method="get"?  When using method="get" in HTML forms, all variable names and values are displayed in the URL. Note:This method should not be used when sending passwords or other sensitive information!  However, because the variables are displayed in the URL, it is possible to bookmark the page.This can be useful in some cases. Note:The get method is not suitable for very large variable values. It should not be used with values exceeding 2000 characters.
  • 27. PHP Forms The $_POST Function  The built-in $_POST function is used to collect values from a form sent with method="post".  Information sent from a form with the POST method is invisible to others and has no limits on the amount of information to send. Note: However, there is an 8 Mb max size for the POST method, by default (can be changed by setting the post_max_size in the php.ini file).
  • 29. PHP Forms When to use method="post"?  Information sent from a form with the POST method is invisible to others and has no limits on the amount of information to send.  However, because the variables are not displayed in the URL, it is not possible to bookmark the page. The PHP $_REQUEST Function  The PHP built-in $_REQUEST function contains the contents of both $_GET, $_POST, and $_COOKIE.  The $_REQUEST function can be used to collect form data sent with both the GET and POST methods.