Database and Algorithm Fundamentals: Essential Concepts Q&A

Database Structure and Relationships

Database Relationships: How They Function

Relationships work by matching data in key fields, usually a field with the same name in both tables. In most cases, the matching fields are the primary key of one table and a foreign key in another.

Most Common Database Relationship Type

The most common type is the One-to-Many relationship. In this structure, a record in Table A can have many matching records in Table B, but a record in Table B has only one matching record in Table A.

Single Index vs. Performance Index

  • A Single Index, typically created by a primary key, does not allow duplicate rows.
  • A Performance Index is used specifically to facilitate and speed up the search for rows within the table.

Defining Database Tables and Data Organization

A table is a collection of data about a specific topic. The data is arranged in columns, which represent the fields in the table.

Importance of Separate Tables for Each Topic

Using separate tables ensures data is stored only once, which makes the database more efficient and significantly reduces data entry errors.

Primary Key and Foreign Key Definitions

  • Primary Key: A field or combination of fields that can uniquely identify a record in a table.
  • Foreign Key: A field in one table that is the primary key in another table.

Forms, Queries, and Reports

Key Purposes of Database Forms

Forms can be used for several purposes, including:

  1. Inputting data to insert records into a table.
  2. Working as a switchboard to open other forms or reports.

Understanding Form Controls and Visibility

Controls are graphical objects used to create the link between a form and its underlying records. To view them, you typically click the toolbox. Examples include: label and text box.

Sections of a Database Form

A form can contain the following sections:

  • The Form Header
  • Page Header
  • Detail Section
  • Page Footer
  • Form Footer

Characteristics of a Select Query

A Select Query retrieves data from one or more tables using specific criteria and displays the data in the desired order.

Common Uses for Database Queries

Queries are used to view, modify, and analyze data, or as the record source for forms and reports.

Sources of Information for Database Reports

Information for a report comes from tables, SQL queries, or calculated fields/structural elements. These structural elements are added directly into the design of the report.

Primary Goal of Database Reports

The primary goal of reports is to present data in a structured, often printed, format.

Macros and Automation

Defining Macros and Action Examples

A macro is a set of actions where each action performs a specific operation. Examples of actions include:

  • Open Form
  • Open Query (Consultation)
  • Open Report

Behavior of the Autoexec Macro

The Autoexec macro runs automatically when the file or database is opened.

Purpose of Macro Arguments

Arguments provide information about how to perform the action, specifying the objects or data to use.

Algorithm and Programming Fundamentals

Definition of Algorithms

An algorithm is a finite and ordered sequence of defined and effective actions (operations) used for solving a problem within a given period of time.

What Data Types Define

Data types define the values that a variable may be assigned and the operators that can act upon that variable.

Divisions of Primitive Data Types

Primitive data types are typically divided into:

  • Numeric: (Integer, Real)
  • Alphanumeric: (Character, String)
  • Logical: (True, False)

Variables and Identifier Rules

A variable is the representation of an element whose value can be changed during the execution of the algorithm.

Examples of Identifiers:

  • Valid: name, note
  • Invalid: student's name (contains special characters), 1nota (starts with a number)

Definition of Constants

A constant is the representation of an element whose value cannot be changed during the execution of the algorithm.

The Declaration Section in an Algorithm

This is the part of the algorithm where the data types to be manipulated, such as variables and constants, are declared.

Primitive Instructions in Programming

The primitive instructions are:

  • Data Entry
  • Assignment (Allocation)
  • Data Output

Purpose of Input Instructions

The input instruction allows the user to provide the necessary data for the program.

The Assignment Statement and Examples

The assignment statement is the mechanism used to store information in a variable.

Examples:

x <- 5;
a <- x + 8

Function of Data Output Instructions

It is the means by which information stored in memory is placed on an output device so the user can view it.