Exception & Database

Jamshid Hashimi
Jamshid HashimiFounder at CodeWeekend em CodeWeekend
MySQL Exception & Database
Jamshid Hashimi
Trainer, Cresco Solution
http://www.jamshidhashimi.com
jamshid@netlinks.af
@jamshidhashimi
ajamshidhashimi
Afghanistan Workforce
Development Program
Agenda
• Error
• Exception
• About Database & Hierarchical Model
• Specialization, Generalization & Aggregation
• Database Normalization
• Relationships
Error
• Error handling is important
– First, it lets the user know, in a relatively friendly
manner, that something has gone wrong and that
they should contact the technical support
department or that someone from tech support
has been notified.
– Second it allows the programmer to put in some
niceties to aid in the debugging of issues.
Error
• mysqli_connect_errno()
– Returns the error code from the last connection error
• mysqli_connect_error()
– Returns the error description from the last connection error
• mysqli_errno()
– Returns the last error code for the most recent function call
• mysqli_error_list()
– Returns a list of errors for the most recent function call
• mysqli_error()
– Returns the last error description for the most recent function
call
Exception
• With PHP 5 came a new object oriented way
of dealing with errors.
• Exception handling is used to change the
normal flow of the code execution if a
specified error (exceptional) condition occurs.
This condition is called an exception.
Exception
$arr = array(23,44,55,77,88,99);
try{
if(in_array(4,$arr)){
echo "FOUND";
}else{
throw new exception("4 not found in the array");
}
if(is_array($arr)){
echo "TRUE";
}else{
throw new customException("It is not an array");
}
}
catch(exception $e){
echo "Error occured in the file: ".$e->getFile()." and in line
".$e->getLine()." with a message: ".$e->getMessage();
}
catch(customException $e){
echo $e->errorMessage();
}
Database
• A database is an organized collection of
information. Small businesses can use databases
in a number of different ways. A database can
help you organize information about your
customers and clients. A database can contain
information about your product inventory. A
database can track sales, expenses and other
financial information.
• In a database an entity type is the equivalent of a
table. Each individual record is represented as a
row, and each attribute as a column.
Hierarchical Database Model
• IBM introduced the first generation of
database technology, known as hierarchical,
when it installed IMS (Information
Management System ) in its mainframe
computers in the mid-1960s. This technology
was upgraded in the mid-1970s to network
database technology. Both hierarchical and
network databases are often described by the
term hierarchical database.
Hierarchical Database Model
Hierarchical Database Model
• The structure allows representing information using
parent/child relationships: each parent can have many
children, but each child has only one parent (also known as
a 1-to-many relationship). All attributes of a specific record
are listed under an entity type.
• Currently the most widely used hierarchical databases are
IMS developed by IBM and Windows Registry by Microsoft.
• Mother–child relationship: Child may only have one mother
but a mother can have multiple children. Mothers and
children are tied together by links called "pointers". A
mother will have a list of pointers to each of her children.
Hierarchical Database Model
• "Hierarchical database systems are difficult to
use. They require application developers to
program navigation through the connected
records [...]
• "They also require developers to predict all
possible access patterns in advance and
design the database accordingly. A database
access pattern that is not included in the
design becomes very difficult and inefficient."
Aggregation
• Aggregation
– The aggregation is an abstraction concept, which
is used to build higher-level object (object as a
whole) from its components. For example, a
computer is built by using various related
components.
Aggregation
• The aggregation abstraction allows the
designer to either decompose objects by
breaking them into more detailed components
or to aggregate objects, grouping them
together into higher-level objects.
Decomposition is simply the. opposite process
to aggregation. Both processes are considered
the part of the aggregation abstraction.
Generalization
• Generalization is another powerful
abstraction. Generalization allows entities of
different types to be considered as examples
of a higher level set. It means that combining
different types of entities (or objects) into a
higher-level set or in more general entity
types is called generalization.
– For example, electronic device is a more general
entity type of electronic objects like computer, TV
set etc.
Specialization
• Categorizing the entities (or objects) in the set
according to their roles in a relationship, is
called specialization. Specialization is the
process of defining a set of subclasses of an
entity. The set of subclasses that form a
specialization are defined on the basis of
some distinguishing characteristics of the
entities in the super-class.
Specialization
• Clerk, manager, and programmer
– super-class 'Employee’
• An entity may have several specializations.
– EMPLOYEE
• 'Permanent-Employee'
• 'Temporary-Employee'
Database Normalization
• Normalization is the process of efficiently
organizing data in a database.
• There are two goals of the normalization
process:
– Eliminating redundant data (for example, storing
the same data in more than one table)
– Ensuring data dependencies make sense (only
storing related data in a table).
Database Normalization
• First Normal Form (1NF): First normal form
(1NF) sets the very basic rules for an organized
database:
– Eliminate duplicative columns from the same
table.
– Create separate tables for each group of related
data and identify each row with a unique column
or set of columns (the primary key).
Database Normalization
Database Normalization
Database Normalization
• Second Normal Form (2NF): Second normal
form (2NF) further addresses the concept of
removing duplicative data:
– Meet all the requirements of the first normal
form.
– Remove subsets of data that apply to multiple
rows of a table and place them in separate tables.
– Create relationships between these new tables
and their predecessors through the use of foreign
keys.
Database Normalization
Database Normalization
Database Normalization
• Third normal form (3NF) goes one large step
further:
– Meet all the requirements of the second normal
form.
– There is no transitive functional dependency
Database Normalization
Database Normalization
Database Normalization
• The Boyce-Codd Normal Form, also referred to
as the "third and half (3.5) normal form", adds
one more requirement:
– Meet all the requirements of the third normal
form.
– Every determinant must be a candidate key.
Database Normalization
• In order to convert a table to BCNF, we must:
1. Find and remove the overlapping candidate
keys. Place the part of the candidate key and
the attribute it is functionally dependent on,
in a different table.
2. Group the remaining items into a table.
• Suppose we have five columns in a table.
Primary Key
Database Normalization
• but column C can determine the value of column
B.
• In other words, the value of Column B is
determined by the Column C then this table can
not be in the Boyce - Codd Normal Form.
Database Normalization
• To convert this table into BCNF, we need to
divide into two tables.
• The table1 contains the following columns.
• where primary key is the combination of the
column A and B
Database Normalization
• And table2 will contain the two columns.
• where C will be the primary key.
• Thus every table satisfying the 3NF condition
cannot be said to be in BCNF normal form but a
table in BCNF will always be in 3NF form.
Database Normalization
• Consider the following non-BCNF table:
The candidate keys of the table are:
• {Person, Shop Type}
• {Person, Nearest Shop}
Database Normalization
Why it is not BCNF?
• The violation of BCNF means that the table is subject to
anomalies. For example, Eagle Eye might have its Shop
Type changed to "Optometrist" on its "Fuller" record
while retaining the Shop Type "Optician" on its
"Davidson" record.
Database Normalization
How to convert itn
into BCNF?
Database Normalization
• After normalization
Candidate keys are {person, shop}
and{shop},respectively.
Database Normalization
Database Normalization
• Fourth Normal Form (4NF): Finally, fourth
normal form (4NF) has one additional
requirement:
– Meet all the requirements of the third normal
form.
– A relation is in 4NF if it has no multi-valued
dependencies.
Database Normalization
Database Normalization
Relationship
• One-to-one relationships: Occur when each entry in the first table has one, and
only one, counterpart in the second table.
– One-to-one relationships are rarely used because it is often more efficient to simply put all of
the information in a single table.
• One-to-many relationships: Are the most common type of database relationship.
They occur when each record in the first table corresponds to one or more records
in the second table but each record in the second table corresponds to only one
record in the first table.
– For example, the relationship between a Teachers table and a Students table in an elementary
school database would likely be a one-to-many relationship, because each student has only
one teacher, but each teacher may have multiple students.
• Many-to-many relationships: Occur when each record in the first table
corresponds to one or more records in the second table and each record in the
second table corresponds to one or more records in the first table.
– For example, the relationship between a Teachers and a Courses table would likely be many-
to-many because each teacher may instruct more than one course and each course may have
more than one instructor.
ASSIGNMENT
QUESTIONS?
1 de 42

Recomendados

Data Modeling por
Data ModelingData Modeling
Data ModelingDrkhanchanaR
799 visualizações46 slides
Unit I Database concepts - RDBMS & ORACLE por
Unit I  Database concepts - RDBMS & ORACLEUnit I  Database concepts - RDBMS & ORACLE
Unit I Database concepts - RDBMS & ORACLEDrkhanchanaR
1.9K visualizações53 slides
Unit 2 oracle9i por
Unit 2  oracle9i Unit 2  oracle9i
Unit 2 oracle9i DrkhanchanaR
1.4K visualizações93 slides
Unit 1 dbms por
Unit 1 dbmsUnit 1 dbms
Unit 1 dbmsSweta Singh
102 visualizações39 slides
DBMS VIVA QUESTIONS_CODERS LODGE.pdf por
DBMS VIVA QUESTIONS_CODERS LODGE.pdfDBMS VIVA QUESTIONS_CODERS LODGE.pdf
DBMS VIVA QUESTIONS_CODERS LODGE.pdfnofakeNews
117 visualizações18 slides
1816 1819 por
1816 18191816 1819
1816 1819Editor IJARCET
152 visualizações4 slides

Mais conteúdo relacionado

Mais procurados

DISE - Database Concepts por
DISE - Database ConceptsDISE - Database Concepts
DISE - Database ConceptsRasan Samarasinghe
1.9K visualizações153 slides
The relational database model por
The relational database modelThe relational database model
The relational database modelDhani Ahmad
3.5K visualizações52 slides
Unit 4 rdbms study_material por
Unit 4  rdbms study_materialUnit 4  rdbms study_material
Unit 4 rdbms study_materialgayaramesh
138 visualizações40 slides
RDBMS concepts por
RDBMS conceptsRDBMS concepts
RDBMS concepts◄ vaquar khan ► ★✔
1.6K visualizações61 slides
Database intro por
Database introDatabase intro
Database introvarsha nihanth lade
1.2K visualizações50 slides
RDMS AND SQL por
RDMS AND SQLRDMS AND SQL
RDMS AND SQLmilanmehta7
82 visualizações35 slides

Mais procurados(18)

DISE - Database Concepts por Rasan Samarasinghe
DISE - Database ConceptsDISE - Database Concepts
DISE - Database Concepts
Rasan Samarasinghe1.9K visualizações
The relational database model por Dhani Ahmad
The relational database modelThe relational database model
The relational database model
Dhani Ahmad3.5K visualizações
Unit 4 rdbms study_material por gayaramesh
Unit 4  rdbms study_materialUnit 4  rdbms study_material
Unit 4 rdbms study_material
gayaramesh138 visualizações
RDMS AND SQL por milanmehta7
RDMS AND SQLRDMS AND SQL
RDMS AND SQL
milanmehta782 visualizações
Relational Database Design por Archit Saxena
Relational Database DesignRelational Database Design
Relational Database Design
Archit Saxena15K visualizações
Dbms relational model por Chirag vasava
Dbms relational modelDbms relational model
Dbms relational model
Chirag vasava9.7K visualizações
database management system por Nivetha Ganesan
database management systemdatabase management system
database management system
Nivetha Ganesan20 visualizações
Intro To DataBase por DevMix
Intro To DataBaseIntro To DataBase
Intro To DataBase
DevMix791 visualizações
DBMS - Relational Model por Ovais Imtiaz
DBMS - Relational ModelDBMS - Relational Model
DBMS - Relational Model
Ovais Imtiaz423 visualizações
Structured system analysis and design por Jayant Dalvi
Structured system analysis and design Structured system analysis and design
Structured system analysis and design
Jayant Dalvi80 visualizações
Normalization por lingesan
NormalizationNormalization
Normalization
lingesan5K visualizações
RDBMS with MySQL por People Strategists
RDBMS with MySQLRDBMS with MySQL
RDBMS with MySQL
People Strategists985 visualizações
Database Design por learnt
Database DesignDatabase Design
Database Design
learnt14.9K visualizações
Week 4 The Relational Data Model & The Entity Relationship Data Model por oudesign
Week 4 The Relational Data Model & The Entity Relationship Data ModelWeek 4 The Relational Data Model & The Entity Relationship Data Model
Week 4 The Relational Data Model & The Entity Relationship Data Model
oudesign375 visualizações
Introduction to DBMS and SQL Overview por Prabu U
Introduction to DBMS and SQL OverviewIntroduction to DBMS and SQL Overview
Introduction to DBMS and SQL Overview
Prabu U944 visualizações

Destaque

Hierarchical visual filtering pragmatic and epistemic actions for database vi... por
Hierarchical visual filtering pragmatic and epistemic actions for database vi...Hierarchical visual filtering pragmatic and epistemic actions for database vi...
Hierarchical visual filtering pragmatic and epistemic actions for database vi...Universidade de São Paulo
322 visualizações22 slides
Techniques for effective and efficient fire detection from social media images por
Techniques for effective and efficient fire detection from social media imagesTechniques for effective and efficient fire detection from social media images
Techniques for effective and efficient fire detection from social media imagesUniversidade de São Paulo
821 visualizações69 slides
Dbms mca-section a por
Dbms mca-section aDbms mca-section a
Dbms mca-section aVaibhav Kathuria
9.8K visualizações98 slides
Types dbms por
Types dbmsTypes dbms
Types dbmsAvnish Shaw
65.8K visualizações7 slides
ER DIAGRAM TO RELATIONAL SCHEMA MAPPING por
ER DIAGRAM TO RELATIONAL SCHEMA MAPPING ER DIAGRAM TO RELATIONAL SCHEMA MAPPING
ER DIAGRAM TO RELATIONAL SCHEMA MAPPING ARADHYAYANA
226.7K visualizações23 slides
Models for hierarchical data por
Models for hierarchical dataModels for hierarchical data
Models for hierarchical dataKarwin Software Solutions LLC
371.2K visualizações91 slides

Destaque(6)

Hierarchical visual filtering pragmatic and epistemic actions for database vi... por Universidade de São Paulo
Hierarchical visual filtering pragmatic and epistemic actions for database vi...Hierarchical visual filtering pragmatic and epistemic actions for database vi...
Hierarchical visual filtering pragmatic and epistemic actions for database vi...
Universidade de São Paulo322 visualizações
Techniques for effective and efficient fire detection from social media images por Universidade de São Paulo
Techniques for effective and efficient fire detection from social media imagesTechniques for effective and efficient fire detection from social media images
Techniques for effective and efficient fire detection from social media images
Universidade de São Paulo821 visualizações
Dbms mca-section a por Vaibhav Kathuria
Dbms mca-section aDbms mca-section a
Dbms mca-section a
Vaibhav Kathuria9.8K visualizações
Types dbms por Avnish Shaw
Types dbmsTypes dbms
Types dbms
Avnish Shaw65.8K visualizações
ER DIAGRAM TO RELATIONAL SCHEMA MAPPING por ARADHYAYANA
ER DIAGRAM TO RELATIONAL SCHEMA MAPPING ER DIAGRAM TO RELATIONAL SCHEMA MAPPING
ER DIAGRAM TO RELATIONAL SCHEMA MAPPING
ARADHYAYANA226.7K visualizações

Similar a Exception & Database

Presentation DBMS (1) por
Presentation DBMS (1)Presentation DBMS (1)
Presentation DBMS (1)Ali Raza
847 visualizações32 slides
Info systems databases por
Info systems databasesInfo systems databases
Info systems databasesMR Z
621 visualizações33 slides
DBMS por
DBMS DBMS
DBMS addisonabner
517 visualizações37 slides
DATABASE MANAGEMENT SYSTEM por
DATABASE MANAGEMENT SYSTEMDATABASE MANAGEMENT SYSTEM
DATABASE MANAGEMENT SYSTEMMahmud Hasan Tanvir
387 visualizações37 slides
Dbms unit 1 por
Dbms unit 1Dbms unit 1
Dbms unit 1SaiGupta18
124 visualizações154 slides

Similar a Exception & Database(20)

Presentation DBMS (1) por Ali Raza
Presentation DBMS (1)Presentation DBMS (1)
Presentation DBMS (1)
Ali Raza847 visualizações
Info systems databases por MR Z
Info systems databasesInfo systems databases
Info systems databases
MR Z621 visualizações
DBMS por addisonabner
DBMS DBMS
DBMS
addisonabner517 visualizações
DATABASE MANAGEMENT SYSTEM por Mahmud Hasan Tanvir
DATABASE MANAGEMENT SYSTEMDATABASE MANAGEMENT SYSTEM
DATABASE MANAGEMENT SYSTEM
Mahmud Hasan Tanvir387 visualizações
Dbms unit 1 por SaiGupta18
Dbms unit 1Dbms unit 1
Dbms unit 1
SaiGupta18124 visualizações
Unit 2_DBMS_10.2.22.pptx por MaryJoseph79
Unit 2_DBMS_10.2.22.pptxUnit 2_DBMS_10.2.22.pptx
Unit 2_DBMS_10.2.22.pptx
MaryJoseph796 visualizações
database1.pdf por prashanna13
database1.pdfdatabase1.pdf
database1.pdf
prashanna1314 visualizações
Unit 2 DATABASE ESSENTIALS.pptx por Nirmalavenkatachalam
Unit 2 DATABASE ESSENTIALS.pptxUnit 2 DATABASE ESSENTIALS.pptx
Unit 2 DATABASE ESSENTIALS.pptx
Nirmalavenkatachalam63 visualizações
Data massage! databases scaled from one to one million nodes (ulf wendel) por Zhang Bo
Data massage! databases scaled from one to one million nodes (ulf wendel)Data massage! databases scaled from one to one million nodes (ulf wendel)
Data massage! databases scaled from one to one million nodes (ulf wendel)
Zhang Bo605 visualizações
Data massage: How databases have been scaled from one to one million nodes por Ulf Wendel
Data massage: How databases have been scaled from one to one million nodesData massage: How databases have been scaled from one to one million nodes
Data massage: How databases have been scaled from one to one million nodes
Ulf Wendel24.3K visualizações
Arinda oktaviana 11353204810 vii lokal g por Arinda oktaviana
Arinda oktaviana 11353204810   vii lokal gArinda oktaviana 11353204810   vii lokal g
Arinda oktaviana 11353204810 vii lokal g
Arinda oktaviana183 visualizações
Database management system.pptx por AshmitKashyap1
Database management system.pptxDatabase management system.pptx
Database management system.pptx
AshmitKashyap134 visualizações
Introduction to Database Management Systems (DBMS) por Vijayananda Ratnam Ch
Introduction to Database Management Systems (DBMS)Introduction to Database Management Systems (DBMS)
Introduction to Database Management Systems (DBMS)
Vijayananda Ratnam Ch87 visualizações
Week 2 - Database System Development Lifecycle-old.pptx por NurulIzrin
Week 2 - Database System Development Lifecycle-old.pptxWeek 2 - Database System Development Lifecycle-old.pptx
Week 2 - Database System Development Lifecycle-old.pptx
NurulIzrin12 visualizações
Database Systems - Lecture Week 1 por Dios Kurniawan
Database Systems - Lecture Week 1Database Systems - Lecture Week 1
Database Systems - Lecture Week 1
Dios Kurniawan133 visualizações
Relational Database.pptx por SubhamSarkar64
Relational Database.pptxRelational Database.pptx
Relational Database.pptx
SubhamSarkar6411 visualizações

Mais de Jamshid Hashimi

Week 2: Getting Your Hands Dirty – Part 2 por
Week 2: Getting Your Hands Dirty – Part 2Week 2: Getting Your Hands Dirty – Part 2
Week 2: Getting Your Hands Dirty – Part 2Jamshid Hashimi
924 visualizações14 slides
Week 1: Getting Your Hands Dirty - Part 1 por
Week 1: Getting Your Hands Dirty - Part 1Week 1: Getting Your Hands Dirty - Part 1
Week 1: Getting Your Hands Dirty - Part 1Jamshid Hashimi
840 visualizações23 slides
Introduction to C# - Week 0 por
Introduction to C# - Week 0Introduction to C# - Week 0
Introduction to C# - Week 0Jamshid Hashimi
1.1K visualizações22 slides
RIST - Research Institute for Science and Technology por
RIST - Research Institute for Science and TechnologyRIST - Research Institute for Science and Technology
RIST - Research Institute for Science and TechnologyJamshid Hashimi
734 visualizações8 slides
How Coding Can Make Your Life Better por
How Coding Can Make Your Life BetterHow Coding Can Make Your Life Better
How Coding Can Make Your Life BetterJamshid Hashimi
833 visualizações28 slides
Mobile Vision por
Mobile VisionMobile Vision
Mobile VisionJamshid Hashimi
513 visualizações34 slides

Mais de Jamshid Hashimi(20)

Week 2: Getting Your Hands Dirty – Part 2 por Jamshid Hashimi
Week 2: Getting Your Hands Dirty – Part 2Week 2: Getting Your Hands Dirty – Part 2
Week 2: Getting Your Hands Dirty – Part 2
Jamshid Hashimi924 visualizações
Week 1: Getting Your Hands Dirty - Part 1 por Jamshid Hashimi
Week 1: Getting Your Hands Dirty - Part 1Week 1: Getting Your Hands Dirty - Part 1
Week 1: Getting Your Hands Dirty - Part 1
Jamshid Hashimi840 visualizações
Introduction to C# - Week 0 por Jamshid Hashimi
Introduction to C# - Week 0Introduction to C# - Week 0
Introduction to C# - Week 0
Jamshid Hashimi1.1K visualizações
RIST - Research Institute for Science and Technology por Jamshid Hashimi
RIST - Research Institute for Science and TechnologyRIST - Research Institute for Science and Technology
RIST - Research Institute for Science and Technology
Jamshid Hashimi734 visualizações
How Coding Can Make Your Life Better por Jamshid Hashimi
How Coding Can Make Your Life BetterHow Coding Can Make Your Life Better
How Coding Can Make Your Life Better
Jamshid Hashimi833 visualizações
Mobile Vision por Jamshid Hashimi
Mobile VisionMobile Vision
Mobile Vision
Jamshid Hashimi513 visualizações
Tips for Writing Better Code por Jamshid Hashimi
Tips for Writing Better CodeTips for Writing Better Code
Tips for Writing Better Code
Jamshid Hashimi353 visualizações
Launch Your Local Blog & Social Media Integration por Jamshid Hashimi
Launch Your Local Blog & Social Media IntegrationLaunch Your Local Blog & Social Media Integration
Launch Your Local Blog & Social Media Integration
Jamshid Hashimi954 visualizações
Customizing Your Blog 2 por Jamshid Hashimi
Customizing Your Blog 2Customizing Your Blog 2
Customizing Your Blog 2
Jamshid Hashimi526 visualizações
Customizing Your Blog 1 por Jamshid Hashimi
Customizing Your Blog 1Customizing Your Blog 1
Customizing Your Blog 1
Jamshid Hashimi737 visualizações
Introduction to Blogging por Jamshid Hashimi
Introduction to BloggingIntroduction to Blogging
Introduction to Blogging
Jamshid Hashimi644 visualizações
Introduction to Wordpress por Jamshid Hashimi
Introduction to WordpressIntroduction to Wordpress
Introduction to Wordpress
Jamshid Hashimi1.2K visualizações
CodeIgniter Helper Functions por Jamshid Hashimi
CodeIgniter Helper FunctionsCodeIgniter Helper Functions
CodeIgniter Helper Functions
Jamshid Hashimi2.5K visualizações
CodeIgniter Class Reference por Jamshid Hashimi
CodeIgniter Class ReferenceCodeIgniter Class Reference
CodeIgniter Class Reference
Jamshid Hashimi3.4K visualizações
Managing Applications in CodeIgniter por Jamshid Hashimi
Managing Applications in CodeIgniterManaging Applications in CodeIgniter
Managing Applications in CodeIgniter
Jamshid Hashimi1.5K visualizações
CodeIgniter Practice por Jamshid Hashimi
CodeIgniter PracticeCodeIgniter Practice
CodeIgniter Practice
Jamshid Hashimi1.4K visualizações
CodeIgniter & MVC por Jamshid Hashimi
CodeIgniter & MVCCodeIgniter & MVC
CodeIgniter & MVC
Jamshid Hashimi3.3K visualizações
PHP Frameworks & Introduction to CodeIgniter por Jamshid Hashimi
PHP Frameworks & Introduction to CodeIgniterPHP Frameworks & Introduction to CodeIgniter
PHP Frameworks & Introduction to CodeIgniter
Jamshid Hashimi15.2K visualizações
MySQL Record Operations por Jamshid Hashimi
MySQL Record OperationsMySQL Record Operations
MySQL Record Operations
Jamshid Hashimi924 visualizações
MySQL JOIN & UNION por Jamshid Hashimi
MySQL JOIN & UNIONMySQL JOIN & UNION
MySQL JOIN & UNION
Jamshid Hashimi7.3K visualizações

Último

Report 2030 Digital Decade por
Report 2030 Digital DecadeReport 2030 Digital Decade
Report 2030 Digital DecadeMassimo Talia
14 visualizações41 slides
Special_edition_innovator_2023.pdf por
Special_edition_innovator_2023.pdfSpecial_edition_innovator_2023.pdf
Special_edition_innovator_2023.pdfWillDavies22
16 visualizações6 slides
[2023] Putting the R! in R&D.pdf por
[2023] Putting the R! in R&D.pdf[2023] Putting the R! in R&D.pdf
[2023] Putting the R! in R&D.pdfEleanor McHugh
38 visualizações127 slides
Architecting CX Measurement Frameworks and Ensuring CX Metrics are fit for Pu... por
Architecting CX Measurement Frameworks and Ensuring CX Metrics are fit for Pu...Architecting CX Measurement Frameworks and Ensuring CX Metrics are fit for Pu...
Architecting CX Measurement Frameworks and Ensuring CX Metrics are fit for Pu...NUS-ISS
37 visualizações54 slides
Five Things You SHOULD Know About Postman por
Five Things You SHOULD Know About PostmanFive Things You SHOULD Know About Postman
Five Things You SHOULD Know About PostmanPostman
27 visualizações43 slides
Transcript: The Details of Description Techniques tips and tangents on altern... por
Transcript: The Details of Description Techniques tips and tangents on altern...Transcript: The Details of Description Techniques tips and tangents on altern...
Transcript: The Details of Description Techniques tips and tangents on altern...BookNet Canada
130 visualizações15 slides

Último(20)

Report 2030 Digital Decade por Massimo Talia
Report 2030 Digital DecadeReport 2030 Digital Decade
Report 2030 Digital Decade
Massimo Talia14 visualizações
Special_edition_innovator_2023.pdf por WillDavies22
Special_edition_innovator_2023.pdfSpecial_edition_innovator_2023.pdf
Special_edition_innovator_2023.pdf
WillDavies2216 visualizações
[2023] Putting the R! in R&D.pdf por Eleanor McHugh
[2023] Putting the R! in R&D.pdf[2023] Putting the R! in R&D.pdf
[2023] Putting the R! in R&D.pdf
Eleanor McHugh38 visualizações
Architecting CX Measurement Frameworks and Ensuring CX Metrics are fit for Pu... por NUS-ISS
Architecting CX Measurement Frameworks and Ensuring CX Metrics are fit for Pu...Architecting CX Measurement Frameworks and Ensuring CX Metrics are fit for Pu...
Architecting CX Measurement Frameworks and Ensuring CX Metrics are fit for Pu...
NUS-ISS37 visualizações
Five Things You SHOULD Know About Postman por Postman
Five Things You SHOULD Know About PostmanFive Things You SHOULD Know About Postman
Five Things You SHOULD Know About Postman
Postman27 visualizações
Transcript: The Details of Description Techniques tips and tangents on altern... por BookNet Canada
Transcript: The Details of Description Techniques tips and tangents on altern...Transcript: The Details of Description Techniques tips and tangents on altern...
Transcript: The Details of Description Techniques tips and tangents on altern...
BookNet Canada130 visualizações
Attacking IoT Devices from a Web Perspective - Linux Day por Simone Onofri
Attacking IoT Devices from a Web Perspective - Linux Day Attacking IoT Devices from a Web Perspective - Linux Day
Attacking IoT Devices from a Web Perspective - Linux Day
Simone Onofri15 visualizações
AMAZON PRODUCT RESEARCH.pdf por JerikkLaureta
AMAZON PRODUCT RESEARCH.pdfAMAZON PRODUCT RESEARCH.pdf
AMAZON PRODUCT RESEARCH.pdf
JerikkLaureta15 visualizações
handbook for web 3 adoption.pdf por Liveplex
handbook for web 3 adoption.pdfhandbook for web 3 adoption.pdf
handbook for web 3 adoption.pdf
Liveplex19 visualizações
How the World's Leading Independent Automotive Distributor is Reinventing Its... por NUS-ISS
How the World's Leading Independent Automotive Distributor is Reinventing Its...How the World's Leading Independent Automotive Distributor is Reinventing Its...
How the World's Leading Independent Automotive Distributor is Reinventing Its...
NUS-ISS15 visualizações
ChatGPT and AI for Web Developers por Maximiliano Firtman
ChatGPT and AI for Web DevelopersChatGPT and AI for Web Developers
ChatGPT and AI for Web Developers
Maximiliano Firtman181 visualizações
The details of description: Techniques, tips, and tangents on alternative tex... por BookNet Canada
The details of description: Techniques, tips, and tangents on alternative tex...The details of description: Techniques, tips, and tangents on alternative tex...
The details of description: Techniques, tips, and tangents on alternative tex...
BookNet Canada121 visualizações
Data-centric AI and the convergence of data and model engineering: opportunit... por Paolo Missier
Data-centric AI and the convergence of data and model engineering:opportunit...Data-centric AI and the convergence of data and model engineering:opportunit...
Data-centric AI and the convergence of data and model engineering: opportunit...
Paolo Missier34 visualizações
Upskilling the Evolving Workforce with Digital Fluency for Tomorrow's Challen... por NUS-ISS
Upskilling the Evolving Workforce with Digital Fluency for Tomorrow's Challen...Upskilling the Evolving Workforce with Digital Fluency for Tomorrow's Challen...
Upskilling the Evolving Workforce with Digital Fluency for Tomorrow's Challen...
NUS-ISS28 visualizações
AI: mind, matter, meaning, metaphors, being, becoming, life values por Twain Liu 刘秋艳
AI: mind, matter, meaning, metaphors, being, becoming, life valuesAI: mind, matter, meaning, metaphors, being, becoming, life values
AI: mind, matter, meaning, metaphors, being, becoming, life values
Twain Liu 刘秋艳35 visualizações
SAP Automation Using Bar Code and FIORI.pdf por Virendra Rai, PMP
SAP Automation Using Bar Code and FIORI.pdfSAP Automation Using Bar Code and FIORI.pdf
SAP Automation Using Bar Code and FIORI.pdf
Virendra Rai, PMP19 visualizações
Uni Systems for Power Platform.pptx por Uni Systems S.M.S.A.
Uni Systems for Power Platform.pptxUni Systems for Power Platform.pptx
Uni Systems for Power Platform.pptx
Uni Systems S.M.S.A.50 visualizações
Tunable Laser (1).pptx por Hajira Mahmood
Tunable Laser (1).pptxTunable Laser (1).pptx
Tunable Laser (1).pptx
Hajira Mahmood23 visualizações
Melek BEN MAHMOUD.pdf por MelekBenMahmoud
Melek BEN MAHMOUD.pdfMelek BEN MAHMOUD.pdf
Melek BEN MAHMOUD.pdf
MelekBenMahmoud14 visualizações
.conf Go 2023 - How KPN drives Customer Satisfaction on IPTV por Splunk
.conf Go 2023 - How KPN drives Customer Satisfaction on IPTV.conf Go 2023 - How KPN drives Customer Satisfaction on IPTV
.conf Go 2023 - How KPN drives Customer Satisfaction on IPTV
Splunk88 visualizações

Exception & Database

  • 1. MySQL Exception & Database Jamshid Hashimi Trainer, Cresco Solution http://www.jamshidhashimi.com jamshid@netlinks.af @jamshidhashimi ajamshidhashimi Afghanistan Workforce Development Program
  • 2. Agenda • Error • Exception • About Database & Hierarchical Model • Specialization, Generalization & Aggregation • Database Normalization • Relationships
  • 3. Error • Error handling is important – First, it lets the user know, in a relatively friendly manner, that something has gone wrong and that they should contact the technical support department or that someone from tech support has been notified. – Second it allows the programmer to put in some niceties to aid in the debugging of issues.
  • 4. Error • mysqli_connect_errno() – Returns the error code from the last connection error • mysqli_connect_error() – Returns the error description from the last connection error • mysqli_errno() – Returns the last error code for the most recent function call • mysqli_error_list() – Returns a list of errors for the most recent function call • mysqli_error() – Returns the last error description for the most recent function call
  • 5. Exception • With PHP 5 came a new object oriented way of dealing with errors. • Exception handling is used to change the normal flow of the code execution if a specified error (exceptional) condition occurs. This condition is called an exception.
  • 6. Exception $arr = array(23,44,55,77,88,99); try{ if(in_array(4,$arr)){ echo "FOUND"; }else{ throw new exception("4 not found in the array"); } if(is_array($arr)){ echo "TRUE"; }else{ throw new customException("It is not an array"); } } catch(exception $e){ echo "Error occured in the file: ".$e->getFile()." and in line ".$e->getLine()." with a message: ".$e->getMessage(); } catch(customException $e){ echo $e->errorMessage(); }
  • 7. Database • A database is an organized collection of information. Small businesses can use databases in a number of different ways. A database can help you organize information about your customers and clients. A database can contain information about your product inventory. A database can track sales, expenses and other financial information. • In a database an entity type is the equivalent of a table. Each individual record is represented as a row, and each attribute as a column.
  • 8. Hierarchical Database Model • IBM introduced the first generation of database technology, known as hierarchical, when it installed IMS (Information Management System ) in its mainframe computers in the mid-1960s. This technology was upgraded in the mid-1970s to network database technology. Both hierarchical and network databases are often described by the term hierarchical database.
  • 10. Hierarchical Database Model • The structure allows representing information using parent/child relationships: each parent can have many children, but each child has only one parent (also known as a 1-to-many relationship). All attributes of a specific record are listed under an entity type. • Currently the most widely used hierarchical databases are IMS developed by IBM and Windows Registry by Microsoft. • Mother–child relationship: Child may only have one mother but a mother can have multiple children. Mothers and children are tied together by links called "pointers". A mother will have a list of pointers to each of her children.
  • 11. Hierarchical Database Model • "Hierarchical database systems are difficult to use. They require application developers to program navigation through the connected records [...] • "They also require developers to predict all possible access patterns in advance and design the database accordingly. A database access pattern that is not included in the design becomes very difficult and inefficient."
  • 12. Aggregation • Aggregation – The aggregation is an abstraction concept, which is used to build higher-level object (object as a whole) from its components. For example, a computer is built by using various related components.
  • 13. Aggregation • The aggregation abstraction allows the designer to either decompose objects by breaking them into more detailed components or to aggregate objects, grouping them together into higher-level objects. Decomposition is simply the. opposite process to aggregation. Both processes are considered the part of the aggregation abstraction.
  • 14. Generalization • Generalization is another powerful abstraction. Generalization allows entities of different types to be considered as examples of a higher level set. It means that combining different types of entities (or objects) into a higher-level set or in more general entity types is called generalization. – For example, electronic device is a more general entity type of electronic objects like computer, TV set etc.
  • 15. Specialization • Categorizing the entities (or objects) in the set according to their roles in a relationship, is called specialization. Specialization is the process of defining a set of subclasses of an entity. The set of subclasses that form a specialization are defined on the basis of some distinguishing characteristics of the entities in the super-class.
  • 16. Specialization • Clerk, manager, and programmer – super-class 'Employee’ • An entity may have several specializations. – EMPLOYEE • 'Permanent-Employee' • 'Temporary-Employee'
  • 17. Database Normalization • Normalization is the process of efficiently organizing data in a database. • There are two goals of the normalization process: – Eliminating redundant data (for example, storing the same data in more than one table) – Ensuring data dependencies make sense (only storing related data in a table).
  • 18. Database Normalization • First Normal Form (1NF): First normal form (1NF) sets the very basic rules for an organized database: – Eliminate duplicative columns from the same table. – Create separate tables for each group of related data and identify each row with a unique column or set of columns (the primary key).
  • 21. Database Normalization • Second Normal Form (2NF): Second normal form (2NF) further addresses the concept of removing duplicative data: – Meet all the requirements of the first normal form. – Remove subsets of data that apply to multiple rows of a table and place them in separate tables. – Create relationships between these new tables and their predecessors through the use of foreign keys.
  • 24. Database Normalization • Third normal form (3NF) goes one large step further: – Meet all the requirements of the second normal form. – There is no transitive functional dependency
  • 27. Database Normalization • The Boyce-Codd Normal Form, also referred to as the "third and half (3.5) normal form", adds one more requirement: – Meet all the requirements of the third normal form. – Every determinant must be a candidate key.
  • 28. Database Normalization • In order to convert a table to BCNF, we must: 1. Find and remove the overlapping candidate keys. Place the part of the candidate key and the attribute it is functionally dependent on, in a different table. 2. Group the remaining items into a table.
  • 29. • Suppose we have five columns in a table. Primary Key Database Normalization
  • 30. • but column C can determine the value of column B. • In other words, the value of Column B is determined by the Column C then this table can not be in the Boyce - Codd Normal Form. Database Normalization
  • 31. • To convert this table into BCNF, we need to divide into two tables. • The table1 contains the following columns. • where primary key is the combination of the column A and B Database Normalization
  • 32. • And table2 will contain the two columns. • where C will be the primary key. • Thus every table satisfying the 3NF condition cannot be said to be in BCNF normal form but a table in BCNF will always be in 3NF form. Database Normalization
  • 33. • Consider the following non-BCNF table: The candidate keys of the table are: • {Person, Shop Type} • {Person, Nearest Shop} Database Normalization
  • 34. Why it is not BCNF? • The violation of BCNF means that the table is subject to anomalies. For example, Eagle Eye might have its Shop Type changed to "Optometrist" on its "Fuller" record while retaining the Shop Type "Optician" on its "Davidson" record. Database Normalization
  • 35. How to convert itn into BCNF? Database Normalization
  • 36. • After normalization Candidate keys are {person, shop} and{shop},respectively. Database Normalization
  • 37. Database Normalization • Fourth Normal Form (4NF): Finally, fourth normal form (4NF) has one additional requirement: – Meet all the requirements of the third normal form. – A relation is in 4NF if it has no multi-valued dependencies.
  • 40. Relationship • One-to-one relationships: Occur when each entry in the first table has one, and only one, counterpart in the second table. – One-to-one relationships are rarely used because it is often more efficient to simply put all of the information in a single table. • One-to-many relationships: Are the most common type of database relationship. They occur when each record in the first table corresponds to one or more records in the second table but each record in the second table corresponds to only one record in the first table. – For example, the relationship between a Teachers table and a Students table in an elementary school database would likely be a one-to-many relationship, because each student has only one teacher, but each teacher may have multiple students. • Many-to-many relationships: Occur when each record in the first table corresponds to one or more records in the second table and each record in the second table corresponds to one or more records in the first table. – For example, the relationship between a Teachers and a Courses table would likely be many- to-many because each teacher may instruct more than one course and each course may have more than one instructor.