Docsity

Database Design and Implementation: ER Modeling and Relational Database Systems, Study Guides, Projects, Research of Database Management Systems (DBMS)

Toggle sidebar
bg1
PROGRAM TITLE: … BTEC in Computing (Network Engineering)
UNIT TITLE: ……… Database Design & Development ………….
ASSIGNMENT NUMBER: …………………………………
ASSIGNMENT NAME: ……BKC database……………….
SUBMISSION DATE: …………August 12, 2022…………………….
DATE RECEIVED: ……………August 12, 2022…………………………….
TUTORIAL LECTURER: ……NGUYEN VAN HUY………………
WORD COUNT: ……………4925…………….
STUDENT NAME: NGO MINH TUAN
STUDENT ID: ……BKC12294…….
MOBILE NUMBER: ……0379681318…
pf3
pf4
pf5
pf8
pf9
pfa
pfd
pfe
pff
pf12
pf13
pf14
pf15
pf16
pf17
pf18
pf19
pf1a
pf1b
pf1c
pf1d
pf1e
pf1f
pf20
pf21
pf22
pf23
pf24
pf25
pf26
pf27
pf28
pf29
pf2a
pf2b
pf2c
pf2d
pf2e

Partial preview of the text

Download Database Design and Implementation: ER Modeling and Relational Database Systems and more Study Guides, Projects, Research Database Management Systems (DBMS) in PDF only on Docsity!

PROGRAM TITLE: … BTEC in Computing (Network Engineering) UNIT TITLE: ……… Database Design & Development …………. ASSIGNMENT NUMBER: ………………………………… ASSIGNMENT NAME: ……BKC database………………. SUBMISSION DATE: …………August 12, 2022……………………. DATE RECEIVED: ……………August 12, 2022……………………………. TUTORIAL LECTURER: ……NGUYEN VAN HUY……………… WORD COUNT: ……………4925……………. STUDENT NAME: NGO MINH TUAN STUDENT ID: ……BKC12294……. MOBILE NUMBER: ……0379681318…

Summative Feedback:

  • A. Introduction.
  • B. Content................................................................................................................................
    • I. System requirements.........................................................................................................
        1. Scenario.
        1. Data requirements for storage
    • II. Relationship between entities.
      • a) Classifying relationship.
      • b) Applying in BKC database.
    • III. Database design.
      • a) Logical design
          1. ERD
          1. RDS (Relational database schema)
          1. Normalization.
      • b) Relational Database System
          1. Design Database
          1. Data Validation.
      • C) Implementing a query language.
          1. DDL (Data Definition Language).
          1. DQL (Data Query Language)...................................................................................
          1. DML (Data Manipulation Language).
          1. TCL (Transaction Control Language).
          1. DCL (Data Control Language).
    • IV. Database Development.
        1. Set SQL Server Authentication.
        1. Connect and form a login.........................................................................................
        1. User Interface.
          1. Test case.
          1. Document control.
  • C. Reference.

A. Introduction.

  • This unit introduces the principles and concepts of data storage, modelling and management with an emphasis on the role of data and information in organizations. The unit will cover conceptual modelling techniques, converting conceptual data models into relational data models and verifying its structural characteristics with normalization techniques, and implementing and utilizing a relational database using a database-management system. Fundamental data modelling techniques such as ER Modelling and query languages such as Structured Query Language (SQL) will be used. Concepts relating to data warehousing, governance, administration, security and privacy, ethical and green approaches to the collection, backup, use and storage of data and the construction of systems are also discussed. Overall, this unit concentrates upon building a firm foundation in information representation, organization and storage with particular emphasis upon the application of database systems.
  • In this assignment brief, I have been employed as a Database Developer at a large IT consultancy company. My manager asked me to investigate the system requirements, design, create and implement the system for our client – BKC, a local double-glazing company since they are rapidly expanding.

2. Data requirements for storage

Entity Description of entity Attribute Description of attribute Customer Customer information ID_CUS Customer ID Name Customer name Phone number Customer phone number Email Customer email Address Customer address Entity Description of entity Attribute Description of attribute Product Product information ID_PROD Product ID Name Product name Price Product price Quantity Product quantity ID_SUPP Supplier ID ID_CATEGORY Category ID Entity Description of entity Attribute Description of attribute Staff Staff information ID_STAFF Staff ID Name Staff name Date of birth Staff dob Address Staff address Phone number Staff phone number Entity Description of entity Attribute Description of attribute Supplier Supplier information ID_SUPP Supplier ID Company name Supplier company name Contact name Supplier contact name Address Supplier address Phone number Supplier phone number Entity Description of entity Attribute Description of attribute Category Category ID_CATEGORY Category’s ID Category name Category name Entity Description of entity Attribute Description of attribute Orders Orders ID_ORD Order’s ID Order date Order date Receiver name Receiver name Receiver address Receiver address ID_STAFF Staff’s ID ID_CUS Customer’s ID Entity Description of entity Attribute Description of attribute Order detail Order details ID_ORD Order’s ID ID_PROD Product’s ID Quantity Quantity Price Price

II. Relationship between entities.

a) Classifying relationship.

  • There are three types of relationships between entities (tables) in data modeling:
    1. One-to-one relationships (1:1).
    2. One-to-many relationships (also denoted as 1:M).
    3. Many-to-many relationships (M: N).
  • In a one-to-one relationship , one record in a table is associated with one and only one record in another table. For example, in a school database, each student has only one student ID, and each student ID is assigned to only one person.
  • In a one-to-many relationship , one record in a table can be associated with one or more records in another table. For example, each customer can have many sales orders.

III. Database design.

a) Logical design

1. ERD

 Definition:

  • An Entity Relationship (ER) Diagram is a type of flowchart that illustrates

how “entities” such as people, objects or concepts relate to each other within a

system.

  • ER Diagrams are most often used to design or debug relational databases in

the fields of software engineering, business information systems, education and

research. Also known as ERDs or ER Models, they use a defined set of symbols

such as rectangles, diamonds, ovals and connecting lines to depict the

interconnectedness of entities, relationships and their attributes.

  • They mirror grammatical structure, with entities as nouns and relationships

as verbs.

 Uses of ERD:

  • Database design : ER diagrams are used to model and design relational databases, in terms of logic and business rules (in a logical data model) and in terms of the specific technology to be implemented (in a physical data model.) In software engineering, an ER diagram is often an initial step in determining requirements for an information systems project. It’s also later used to model a particular database or databases. A relational database has an equivalent relational table and can potentially be expressed that way as needed.
  • Database troubleshooting : ER diagrams are used to analyze existing databases to find and resolve problems in logic or deployment. Drawing the diagram should reveal where it’s going wrong.
  • Business information systems : The diagrams are used to design or analyze relational databases used in business processes. Any business process that uses fielded data involving entities, actions and interplay can potentially benefit from a relational database. It can streamline processes, uncover information more easily and improve results.
  • Business process re-engineering (BPR): ER diagrams help in analyzing databases used in business process re-engineering and in modeling a new database setup.
  • Education : Databases are today’s method of storing relational information for educational purposes and later retrieval, so ER Diagrams can be valuable in planning those data structures.
  • Research: Since so much research focuses on structured data, ER diagrams can play a key role in setting up useful databases to analyze the data.

 Recommend ERD tools

  1. Lucid chart: This software is one of the popular online ER diagram tools which allows you to create not only basic ER diagrams with in-built templates but provides more useful functionalities. You can add images, infographics, clipart, special symbols, icons, and more.
  2. ERD Plus: This software is mainly a web-based data modeling ER diagram tool which easily represents relational database drawings and makes complex database structures to be easily understandable.

2. RDS (Relational database schema)

  • Definition: A relational (database) schema is a set of table definitions (stored base tables or derived views), constraints, and derivation rules. A table scheme is a named set of attributes (columns) that draw their values from domains. Each column, or column set, spanned by a minimal uniqueness constraint is a candidate key.
  • Thus, in the context of relational database schema following points deserve a particular consideration:  A specific characteristic, that bears the same real-world concept, may appear in more than one relationship with the same or a different name. For example, in Employees relation, Employee Id (EmpId) is represented in Vouchers as AuthBy and PrepBy.  The specific real-world concept that appears more than once in a relationship should be represented by different names. For example, an employee is represented as subordinate or junior by using EmpId and as a superior or senior by using SuperId, in the employee’s relation.  The integrity constraints that are specified on database schema shall apply to every database state of that schema.
  • Apply in BKC diagram:

3. Normalization.

 Definition:

  • Normalization is a database design technique that reduces data redundancy and eliminates undesirable characteristics like Insertion, Update and Deletion Anomalies.
  • Normalization is the process of reorganizing data in a database so that it meets two basic requirements:
  1. There is no redundancy of data, all data is stored in only one place.
  2. Data dependencies are logical, all related data items are stored together.
  • Normalization is important for many reasons, but chiefly because it allows databases to take up as little disk space as possible, resulting in increased performance.
  • Normalization is also known as data normalization.

 Importance of data normalization:

  • The first goal during data normalization is to detect and remove all duplicate data by logically grouping data redundancies together. Whenever a piece of data is dependent on another, the two should be stored in proximity within that data set.
  • By getting rid of all anomalies and organizing unstructured data into a structured form, normalization greatly improves the usability of a data set. Data can be visualized more easily, insights could be extracted more efficiently, and information can be updated more quickly. As redundancies are merged together, the risk of errors and duplicates further making data even more disorganized is reduced.
  • On top of all that, a normalized database takes less space, getting rid of many disk space problems, and increasing its overall performance significantly.

Staff (id – primary key, name, dob, address, phone) Customer (id – primary key, name, address, phone, email)

  • Before getting any further, let’s make a clear understanding of few things first.
    1. What is a KEY in SQL? A KEY in SQL is a value used to identify records in a table uniquely. An SQL KEY is a single column or combination of multiple columns used to uniquely identify rows or tuples in the table. SQL Key is used to identify duplicate information, and it also helps establish a relationship between multiple tables in the database.
    2. What is a Primary key? A primary is a single column value used to identify a database record uniquely. It has following attributes:  A primary key cannot be NULL.  A primary key value must be unique.  The primary key values should rarely be changed.  The primary key must be given a value when a new record is inserted.  2NF (Second Normal Form) Rules
  • Second Normal Form (2NF) is based on the concept of full functional dependency. Second Normal Form applies to relations with composite keys, that is, relations with a primary key composed of two or more attributes.
  • To be in second normal form, it requires the relation must be: 1) In First Normal Form. 2) There should be no Partial Dependency.
  • So, what is Dependency? Let’s take a look in below example:
  • In this Student table with columns (student_id, name, reg_no, branch, address), student_id is the primary key and will be unique for every row, hence we can use student_id to fetch any row of data from this table.
  • Even for a case, where student names are same, if we know the student_id we can easily fetch the correct record. Hence, we can say a Primary Key for a table is the column or a group of columns (composite key) which can uniquely identify each record in the table.
  • When we ask for branch name of student with student_id 10 , and we can get it, which is
CSE. Similarly, if we ask for address of student with student_id 10 or 11 , I will get it also.
Which are Kerala and Gujarat. So, all we need is student_id and every other

column depends on it, or can be fetched using it. ➜ This is Dependency and we also call it Functional Dependency.

  • Then, what is Partial Dependency? Now that we know what dependency is, we are in a better state to understand what partial dependency is. For a simple table like Student, a single

column like student_id can uniquely identify all the records in a table.

  • But this is not true all the time. So now let's extend our example to see if more than 1 column together can act as a primary key.
  • Let's create another table for Subject , which will

have subject_id and subject_name fields and subject_id will be the primary key.

  • Now we have Student table with student information and another table Subject for storing subject information.
  • Let's create another table Score , to store the marks obtained by students in the respective subjects. We will also be saving name of the teacher who teaches that subject along with marks.
  • Conclusion:  For a table to be in the Second Normal form, it should be in the First Normal form and it should not have Partial Dependency.  Partial Dependency exists, when for a composite primary key, any attribute in the table depends only on a part of the primary key and not on the complete primary key.  To remove Partial dependency, we can divide the table, remove the attribute which is causing partial dependency, and move it to some other table where it fits in well.
  • Some examples in BKC’s database:  3NF (Third Normal Form) Rules
  • Although Second Normal Form (2NF) relations have less redundancy than those in 1NF, they may still suffer from update anomalies. If we update only one tuple and not the other, the

database would be in an inconsistent state. This update anomaly is caused by a transitive dependency. We need to remove such dependencies by progressing to Third Normal Form (3NF).

  • Third Normal Form is an upgrade to Second Normal Form. When a table is in the Second Normal Form and has no transitive dependency, then it is in the Third Normal Form.
  • For example, let’s look at the following tables: Student table Subject table Score table
  • In the Score table, we need to store some more information, which is the exam name and total marks, so let's add 2 more columns to the Score table.