0% found this document useful (0 votes)
5 views10 pages

MySQL Country Road Network Database

Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
5 views10 pages

MySQL Country Road Network Database

Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd

STAGES A Simple

Country Road
 Requirement Stage Network
 Component Design Database
Stage using MySQL
 Implementation Stage By Azubuike Godswill
190405005
 Requirement Stage
STAGES  Component Design
Stage
 Implementation Stage
REQUIRMENT STAGE
This stage involved a rough sketch creation
of my data model. This is where I thought of
the contents, relationships and constraints of
the data.
The idea is a create a simple road network
design that one can also use to analyse
accident rates and some traffic data.

This stage mainly focussed on thinking,


research and pen sketching.
The two main processes in this stage are:
 Determine the purpose of your database
 Find and organize the information
required
COMPONENT DESIGN
STAGE
 Having all the requirements Processes to Database Design
to build my model, this stage i. Divide the information into
focussed on the design and tables.
creation of the model.
ii. Turn information items into
 Here I created the tables columns.
added the attributes, iii. Specify primary keys.
relationships, as well as the
iv. Set up the table relationships.
business rules.
v. Refine your design.
 The next slide describes the
processes stated here ->. vi. Apply the normalization rules
Turn information  WeatherCondition
Divide the Columns contd.

information into items into columns  Road  Date

Information items here  Name  Temperature


tables
are the attributes of the  Length  Precipitation
Information here are entities and there are:  SpeedLimit  Visibility
the entities of the  State
database. The  RoadSegment
 StateName
following are the  StatePopulation
 StartIntersection Specify primary
entities for the  EndIntersection
keys
 StateArea
database State – StateID
 dialect
 Accident LocalGovernment –
 State LocalGovID
 Date
 LocalGovernment  LocalGovernment
 Time Wards – WardID
 LocalGovName
 Wards  Severity Road – RoadID
 LocalGovArea
 Road  LocalGovPopulation
 Description RoadSegments –
SegmentID
 Road Segments
 TrafficData Accident – AccidentID
 Accidents  Wards
 Timestamp TrafficData – TrafficData
 Traffic Data
 Wardname
 AverageSpeed WeatherCondition -
 population
 WeatherCondition  VehicleCount WeatherID
Adding Table Relationships, Specifying Cardinalities.

RoadSegments and TrafficData TrunkBRoad and LocalGovernment


ENTITY RELATIONSHIPS
Relationship = 1:N Non-Identifying Relationship = N:M Non-Identifying
Unary Relationships
Cardinalities : 1:1 - 1:N
Cardinalities : N:1 - 1:N
Tables– State , LocalGovernment
Binary Relationships RoadSegments and Accidents
Relationship = 1:N Non-Identifying
TrunkCRoad and Wards
State and LocalGovernment Tables
Cardinalities : 1:1 - 1:N Relationship = N:M Non-Identifying
Relationship = 1:N Non-Identifying
Cardinalities : N:1 - 1:M
Cardinalities : 1:1 - 1:N
Accidents and WeatherCondition
Relationship = 1:N Non-Identifying
TrunkARoad and TrunkBRoad
Wards and LocalGovernment Tables
Cardinalities : 1:1 - 1:N
Relationship = 1:N Non-Identifying
Relationship = 1:N Non-Identifying
SUPERTYPE AND SUBTYPES Cardinalities : 1:1 - 1:N
Cardinalities : 1:1 - 1:N
RELATIONSHIPS
Road(Supertype) – TrunkARoad , TrunkBRoad,
TrunkCRoad (Subtypes) TrunkBRoad and TrunkCRoad
Road and RoadSegments
Relationship = 1:N Non-Identifying
Relationship = 1:N Identifying
TrunkARoad and State Cardinalities : 1:1 - 1:N
Cardinalities : 1:1 - 1:N
Relationship = N:M Non-Identifying
Cardinalities : N:1 - 1:N
Database
Design
IMPLEMENTATION STAGE WITH MySQL
WORKBENCH 2. LINKING TABLES
 For a Unary Recursive Relationship, click
1, TABLE CREATION
on the relationship on the side panel and
 Launch MySQL Workbench from the then, double click the interested table.
start menu ( See 1)
 On the home menu go to models  For a Binary Relationship, choose the
 Click the + sign to create a new relationship and click on both tables of
model interest. If relationship is 1:N, first click on
the many side, then the one side. ( See 2)
 Edit the database name
 For N:M Binary Relationships, click on the
 Click on Add Diagram, this should
relationship and then both tables, this
take you to the worksheet.
automatically creates a joint table.
 To create a table, click on the table  For 1:N Binary relationships, non-
icon and click on the worksheet
identifying relations are automatically
 Double click the table to edit its created. If one needs a non-identifying
name and columns (attributes). Also relationship, double click on the linking
assign datatypes to each attribute. crows foot line , go to foreign key , and
check identifying ( See 3)
 To make an attribute a primary key,
just tick the PK and NN
 For N:M Binary Relationships, a joint
2

4
NORMALIZATION
1st Normal Form
The database is of first normal form 2nd Normal Form
because:
A relation that is in First Normal Form and
 There are only Single Valued every non-primary-key attribute is fully
Attributes. functionally dependent on the primary key,
 Attribute Domain does not then the relation is in Second Normal Form
change. (2NF).
 There is a unique name for Every attribute of a table in my database
every Attribute/Column. design depends solely on their primary key
 The order in which data is with no partial dependencies. Hence, the
stored does not matter. database of a 2nd normal form
Boyce-Codd Normal Form
3rd Normal Form
 Rule 1: The table should be in the
 The database is of 3 normal
rd 3rd Normal Form.
form since every non-key  Rule 2: X should be a superkey
attribute in a table depend on for every functional dependency
the key and nothing but the (FD) X−>Y in a given relation.
key. Both of these rules apply to the
tables in the database since every PK
 They are no transitive is a superkey (No composite or other
dependencies in the database candidate keys ) and all attributes is
functionally dependent on it

Common questions

Powered by AI

Challenges in the database design process may include handling complex relationships, ensuring data normalization without compromising performance, and managing scalability. These can be addressed by using iterative design reviews, employing effective normalization techniques while balancing them with performance needs, and adopting modular design practices that accommodate future changes. Additionally, leveraging database management tools in MySQL Workbench allows for visualizing and testing relationships, ensuring design robustness and adaptability to requirements .

The significance of setting primary keys in database design lies in ensuring each record's uniqueness within a table, facilitating reliable querying and maintaining data integrity. In the road network model, primary keys such as StateID for State, LocalGovID for LocalGovernment, WardID for Wards, etc., are assigned to each table to identify records uniquely. This practice is critical for establishing relationships between tables and supporting referential integrity across the entire database structure .

The main stages include the Requirement Stage, Component Design Stage, and Implementation Stage. In the Requirement Stage, the focus was on determining the purpose of the database, organizing the required information, and creating rough sketches. In the Component Design Stage, the database model was designed by creating tables, defining attributes, setting primary keys, and establishing relationships. Finally, in the Implementation Stage, the database was developed using MySQL Workbench, involving table creation, linking tables, and applying normalization rules .

Understanding traffic data integration enhances the utility of the road network database by enabling analysis of traffic patterns, accident occurrences, and general road usage statistics. By including tables like TrafficData with attributes such as Timestamp, AverageSpeed, and VehicleCount, the database can provide insights into peak traffic times, assess congestion areas, and contribute to urban planning and infrastructure development decisions. These data-driven insights are crucial for improving road safety and efficiency in regional transportation systems .

The criteria used to determine the relationships between roads and their segments in the database include cardinality definitions, such as 1:N relationships between Road and RoadSegments, and non-identifying relationships that indicate optional dependencies between entities. These criteria ensure that each Road can encompass multiple segments, facilitating detailed mapping of road infrastructure and supporting granular analysis of traffic and environmental data per segment .

The database design ensures normalization by adhering to specific rules at each normal form level. In First Normal Form, it allows only single-valued attributes, keeps attribute domains consistent, and ensures unique names for each attribute. In Second Normal Form, all non-primary-key attributes are fully functionally dependent on the primary key without partial dependencies. For Third Normal Form, every non-key attribute depends solely on the key with no transitive dependencies. The Boyce-Codd Normal Form is achieved by ensuring that each table adheres to Third Normal Form and that each functional dependency's determinant is a superkey .

Supertype-subtype relationships in the road network database facilitate the modeling of hierarchical data structures, where a general entity (supertype) is broken down into more specific entities (subtypes). In this database, the Road entity serves as a supertype with TrunkARoad, TrunkBRoad, and TrunkCRoad as subtypes. These relationships are structured to maintain data specificity, enable complex querying, and properly link zones such as State, LocalGovernment, and Wards through N:M cardinalities .

In the Component Design Stage, effective database structuring is achieved by dividing information into tables, turning information items into columns, specifying primary keys for each table, setting up table relationships, refining the design through normalization, and applying normalization rules. This includes defining entity relationships with appropriate cardinalities and differentiating supertype-subtype relationships to ensure scalability and efficiency in handling complex data interactions .

The implementation stage in MySQL Workbench facilitates the management of table relationships by providing tools to create unary and binary relationships easily. For unary recursive relationships, one needs to select the relationship from the side panel and apply it to the interested table. For binary relationships like 1:N, the process involves selecting the many side first, followed by the one side; for N:M relationships, a joint table is automatically created. This interface simplifies the setup of complex relationships and ensures that database integrity is maintained throughout the lifecycle .

The road network database includes unary and binary relationships with varying cardinalities. Unary relationships exist within single tables like State and LocalGovernment. Binary relationships exist between different tables, such as State and LocalGovernment (1:N), Wards and LocalGovernment (1:N), Road and RoadSegments (1:N), etc. These relationships affect database design by requiring specific linkage through foreign keys, which are critical for maintaining data integrity and enabling complex queries. Non-identifying relationships are common, indicating non-compulsory links, which impacts how the database can be queried and updated .

You might also like