Database Concepts and Data
Types
Mrs Mulambia Chewe Luaba
Lesson Outline
Basic Database Concepts
Basic Database Concepts
Entities
• Definition: An entity is a person, place, thing, or
concept that has independent existence and is
of interest to the organization.
• Examples: Customers, Orders, Products,
Employees
• Characteristics: Entities have attributes and
relationships with other entities.
•
Attributes
• Definition: An attribute is a characteristic or
property of an entity that describes or defines
it.
• Examples: Customer Name, Order Date,
Product Price, Employee Salary
• Types: Attributes can be single-valued (e.g.,
Customer Name) or multi-valued (e.g.,
Product Colors).
Relationships
• Definition: A relationship is a connection
between two or more entities that shows how
they interact or are associated.
• Types: Relationships can be one-to-one (1:1),
one-to-many (1:N), or many-to-many (M:N).
• Examples: A customer can place many orders
(1:N), a product can be ordered by many
customers (M:N).
Data Types Used SQL in Databases
• Numeric: Data Types
• Integer: Whole numbers, e.g., 1, 2, 3
• Decimal: Decimal numbers, e.g., 3.14, -0.5
• Float: Floating-point numbers, e.g., 3.14E-5
• Char: Fixed-length character strings, e.g., 'ABC'
• VarChar: Variable-length character strings, e.g.,
'ABCDEF'
• Text: Large character strings, e.g., paragraphs of
text
Data Types Used in Databases
Date and Time Data Types
• Date: Dates, e.g., '2022-07-25'
• Time: Times, e.g., '14:30:00'
• Timestamp: Dates and times, e.g., '2022-07-25 14:30:00‘
Other Data Types
• - Boolean: True or false values
• - Binary: Binary data, e.g., images, audio files
• - Null: Unknown or missing values
Data Types in Microsoft Access
• Text and Memo:
• Short Text: Alphanumeric data, limited to 255 characters.
• Long Text: Large amounts of alphanumeric data, up to
approximately 1 GB, but display limitations exist.
• Number:
• Number: Numeric data, with various Field Size options
(Byte, Integer, Long, Single, Double, Decimal,
ReplicationID).
• AutoNumber: Automatically increments for each new
record, often used as a primary key.
Data Types in Microsoft Access
Other Data Types:
• Date/Time: Stored as a number, representing dates and times.
• Currency: Monetary values, stored with four decimal places.
• Yes/No: Boolean values (True/False, Yes/No, On/Off), stored as 0 or -1.
• OLE Object: Stores objects from other applications, such as images or
embedded spreadsheets.
• Hyperlink: Stores links to files or web addresses.
• Attachment: Allows you to attach files to records, YittBox states.
• Calculated: Stores the result of an expression, which dynamically
calculates values based on other fields.
• Lookup Wizard: Limits field values to a list of choices,
suggests www.sfmagazine.com.
Unit Summary
• Understanding entities, attributes, and
relationships is crucial for designing and
implementing databases.
• Familiarity with various data types is also
essential for storing and manipulating data
effectively in databases.
Review Questions
• What is meant by each of the following terms:
– Entity
– Attribute
– Relationship
• List the data types found in SQL databases
• List the data types used in Microsoft Access