Database Notes

Database Terms

  • Data: Information stored and processed by a computer.
  • Data Source: The origin from which digital data is gathered.
  • Database: A structured set of data stored in tables.
  • Table: A collection of data arranged in rows and columns.
  • Records: Rows in a table, representing one complete set of data entries.
  • Fields: Columns in a table that store a specific type of data (e.g., name, number).
  • Form: A user-friendly interface for entering or viewing one record at a time.

Data Dictionary

  • Data Dictionary: Shows the structure of a table.
  • Accessible through Design View.
  • Contains these fields:
    • Field name
    • Data type
    • Description

Data Ethics – How We Use and Protect Data

  • Data Privacy: Keeping data away from unauthorized individuals.
    • Example: Password-protecting customer data.
  • Data Security: Ensuring stored data is safe from loss or theft.
    • Example: Backing up databases and using secure networks.
  • Ethical Responsibility: Doing the right thing when using data—being honest and fair; acting within society’s values.
    • Example: Not sharing someone’s survey answers.
  • Authenticity: Making sure the data reflects the real world accurately.
    • Example: Ensuring shoe stock numbers are real and current.

Data Actions – What We Do with Data

  • Acquire: Obtaining data by typing it in, downloading it, or collecting it.
    • Example: Importing survey data into Access.
  • Validate: Checking if the data is correct, in the right format, and makes sense.
    • Example: Making sure shoe size is a number, not text.
  • Evaluate: Deciding if the data is useful and relevant for the question or goal.
  • Analyse: Inspecting and extracting meaning from data.

Data Types

  • AutoNumber: Automatically assigns a unique number to each record.
    • Example: With the ProductID field, each shoe gets a unique ID like 1, 2, 3, etc.
  • Short Text: Stores short pieces of text (up to 255 characters).
    • Example: ShoeName, Gender, Brand.
  • Number: Stores numerical data.
  • Currency: Stores prices or amounts with decimal values.
    • Example: Price, original price.
  • Yes/No: Used for filtering stock availability or special status.
    • Example: IsAvailable, yes (for sizes in stock), no (for sold out sizes).

ERD (Entity Relationship Diagram)

  • Primary Key: A field that uniquely identifies each record in a table; it cannot be blank or duplicated; default is AutoNumber.
  • Foreign Key: A field that links to the Primary Key of another table; it shows a relationship between two tables.
  • Relationship: The connection between two tables, based on Primary Keys and Foreign Keys.
  • ERD (Entity Relationship Diagram): A visual map that shows how the tables in a database are connected.

ERD Diagram/Relationship

  • Example:
    • ShoeID as the Primary Key in Shoe table
    • ShoeID as the Foreign Key in Stock table
    • Relationship Type: One-To-Many

Exercise: Relationship Selection

  • Relationship 'a' connects the Product table (containing the shoe model) to the SizeStock table (listing sizes and availability), which could be used to create a 'Size Availability List' for a given shoe model.

Database Query

  • Example:
    • IIf([IsAvailable] = True, IIf([Size]>=10, "High Demand - Available", "Available"), "Out of Stock")
    • If the shoe is available and size is 10 or more, it shows "High Demand - Available". Otherwise, it shows "Available".
    • If the shoe is not available, it shows "Out of Stock".

Possible Output Table

  • Example Table:
ProductIDSizeIsAvailableStockStatus
0017YesAvailable
00210YesHigh Demand - Available
00611.5NoOut of Stock

Sorting (Order By in SQL / Query Design)

  • Ascending: A–Z / 0–9 / Earliest date first.
  • Descending: Z–A / 9–0 / Latest date first.
  • In Access Query Design View: setting the Sort row to “Ascending” or “Descending”.

Sorting & Filter

  • Default sorting impacts usability when users search/filter for a products or report.
  • Users expect to see shoes sorted by price (low to high) or newest release date first.

Exercise

  • Sorting Examples:
    • A. Sort These Numbers in Ascending Order
    • 11, 7, 22, 3, 15 → 3, 7, 11, 15, 22
    • B. Sort These Product Codes in Descending Order
    • ZX23, AB15, RM33, PN19 → ZX23, RM33, PN19, AB15
    • C. Sort These Brand Names Alphabetically (A–Z)
    • Adidas, Converse, Nike, Reebok, Asics → Adidas, Asics, Converse, Nike, Reebok
    • D. Sort These Shoe Colors Alphabetically
    • Black, Red, White, Beige, Olive → Beige, Black, Olive, Red, White