0% found this document useful (0 votes)
103 views6 pages

Com 312 (Database Design)

Data models define how data is organized and structured within a database. Some key concepts include entities, which represent real-world objects; attributes, which are properties that describe entities; and relationships, which define how entities are connected. There are different types of data models such as hierarchical, network, and relational models. The relational model uses tables with rows and columns to represent data.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
103 views6 pages

Com 312 (Database Design)

Data models define how data is organized and structured within a database. Some key concepts include entities, which represent real-world objects; attributes, which are properties that describe entities; and relationships, which define how entities are connected. There are different types of data models such as hierarchical, network, and relational models. The relational model uses tables with rows and columns to represent data.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 6

DATA MODEL

Data models are foundational structures that define how data is organized, stored, and

manipulated within a database system.

Some basic concepts of data models

1. Entity: An entity is a real-world object or concept with identifiable attributes. For example,

in a university database, entities could include students, courses, and professors.

2. Attributes: Attributes are the properties or characteristics of entities. Each entity has

attributes that describe it. For instance, a student entity might have attributes such as student

ID, name, and date of birth.

3. Relationships: Relationships define how entities are connected or related to each other.

These connections can be one-to-one, one-to-many, or many-to-many. In the university

example, a student entity may have a relationship with a course entity indicating enrollment.

4. Keys: Keys are unique identifiers within an entity that distinguish each instance of the

entity. There are different types of keys, such as primary keys (which uniquely identify each

record in a table) and foreign keys (which establish relationships between tables).

5. Data Types: Data types define the kind of data that can be stored in an attribute. Common

data types include integers, strings, dates, and floating-point numbers. The choice of data

type depends on the nature of the attribute and the requirements of the system.
6. Normalization: Normalization is the process of organizing data to minimize redundancy

and dependency. It involves breaking down large tables into smaller ones and establishing

relationships between them to ensure data integrity and optimize database performance.

Types of data model

1. Hierarchical data model: These organizes data in a tree-like structure where each record

(or entity) has a single parent record and zero or more child records, forming a hierarchy.

Example: Consider a company's organizational structure, where each department has multiple

employees. The hierarchical model would represent this as a tree structure, with the company

as the root, departments as intermediate nodes, and employees as leaf nodes. Each department

would have employees as children, and each employee would have a department as its parent.

2. Network data model: This is a type of database model that extends the hierarchical model

by allowing each record to have multiple parent and child records, creating a network-like

structure.

Example: Consider a university database where students enroll in multiple courses, and each

course can have multiple instructors. In the network model, students, courses, and instructors

would be represented as sets, with records representing individual students, courses, and

instructors. Each student record could be linked to multiple course records, and each course

record could be linked to multiple instructor records, creating a network of relationships.

3. Relational data model: This is a type of database model based on the mathematical concept

of relations, which are essentially tables with rows and columns.

Example: Consider a university database in the relational model. It might consist of tables

such as Students, Courses, and Enrollments. The Students table would contain student

information with a primary key like Student ID. The Courses table would contain course
information with a primary key like Course ID. The Enrollments table would establish a

many-to-many relationship between students and courses using foreign keys, such as Student

ID and Course ID.

CONCEPTS AND TERMINOLOGIES IN DATABASE

1. Database Administrator: A database administrator (DBA) is responsible for managing and

maintaining databases. Their duties include installing, configuring, and upgrading database

software, ensuring data security, optimizing database performance, backing up and restoring

data, and creating user accounts and permissions.

2. Database User: A database user is an individual or program that interacts with a database

to perform various operations such as querying, updating, or deleting data. Users can have

different levels of access rights and permissions based on their roles and responsibilities

within the organization.

3. Database Language: A database language is a specialized programming language used to

communicate with and manipulate databases. Examples include SQL (Structured Query

Language), which is used for querying and managing relational databases, and NoSQL query

languages like MongoDB's query language, which is used for working with non-relational

databases.

4. Data View: A data view is a virtual representation of data from one or more tables in a

database. It presents a subset of the data in a customized format that may include specific

columns, rows, or calculations. Data views are useful for simplifying complex data structures,

providing security by limiting access to certain data, and improving performance by

predefining commonly used queries.


5. An instance refers to a snapshot of a database at a particular moment in time. It represents

the actual data stored in the database, including all records, tables, relationships, and

constraints. Essentially, an instance is the current state or content of the database.

6. Schema: A schema, on the other hand, is the overall structure or blueprint of the database.

It defines the organization of data, including the tables, fields, data types, relationships, and

constraints. The schema provides a framework for how data is stored and accessed within the

database, but it does not contain the actual data itself. It's like a plan or template for how the

database should be organized.

Pitfalls in relational database design

Some common pitfalls in relational database design:

1. Poorly defined requirements: If the requirements for the database are not clear or are

constantly changing, it can lead to a design that doesn't meet the needs of the users or the

application.

2. Denormalization: While denormalization can improve query performance, it can also lead

to data redundancy and inconsistency if not done carefully.

3. Overly complex schema: Creating a database with too many tables, relationships, or

unnecessary attributes can make it difficult to understand and maintain.

4. Lack of indexes: Not properly indexing the database can lead to slow query performance,

especially as the size of the database grows.

5. Ignoring normalization rules: Failing to properly normalize the database can result in data

redundancy, anomalies, and inconsistency.


6. Ignoring data integrity constraints: Not enforcing data integrity constraints such as primary

key, foreign key, unique constraints, and check constraints can lead to data inconsistencies

and errors.

7. Inadequate error handling: Not implementing proper error handling mechanisms can lead

to data corruption and loss.

8. Ignoring scalability: Designing a database without considering scalability can lead to

performance issues as the application grows in size and complexity.

9. Not considering security: Failing to implement proper security measures such as access

controls, encryption, and authentication can lead to data breaches and unauthorized access.

10. Inefficient querying: Writing inefficient queries or not optimizing queries can lead to

slow performance and resource wastage.

By avoiding these pitfalls and following best practices in relational database design, you can

create a more efficient, scalable, and maintainable database system.

SQL BACKGROUND

SQL, which stands for Structured Query Language, is a domain-specific language used in

programming and managing relational databases. It was initially developed by IBM in the

early 1970s as a way to interact with their databases. However, SQL as we know it today was

largely standardized by ANSI (American National Standards Institute) in the late 1980s and

later by ISO (International Organization for Standardization).

The main purpose of SQL is to manage and manipulate data stored in a relational database

management system (RDBMS). It provides a standardized way to perform tasks such as

querying data, inserting, updating, and deleting records, creating and modifying database

schemas, and controlling access to the data.


Over the years, SQL has become the de facto standard for interacting with relational

databases, and it is supported by virtually all major database management systems, including

MySQL, PostgreSQL, Oracle Database, Microsoft SQL Server, SQLite, and many others. Its

versatility and widespread adoption have made it an essential skill for database

administrators, developers, data analysts, and other professionals working with data.

The basic structure of SQL

The basic structure of SQL typically involves several key components:

1. Keywords: These are reserved words used to perform specific operations in SQL, such as

SELECT, INSERT, UPDATE, DELETE, CREATE, DROP, etc.

2. Clauses: SQL statements are typically composed of one or more clauses, each serving a

specific purpose. Common clauses include SELECT, FROM, WHERE, GROUP BY,

HAVING, ORDER BY, etc.

3. Expressions: These are combinations of literals, column names, operators, and functions

that produce scalar values. Expressions are used in various parts of SQL statements, such as

in the SELECT list, WHERE clause, and ORDER BY clause.

4. Identifiers: These are names given to database objects such as tables, columns, indexes,

views, etc. Identifiers need to follow certain naming rules and conventions, and they are often

enclosed in double quotes or square brackets, depending on the database system.

5. Comments: SQL allows for comments to be included in the code to improve readability

and provide explanations. Comments can be either single-line (using --) or multi-line

(enclosed between /* and */).

You might also like