測試版本平台正在積極開發中;可能有錯誤、缺少功能,以及資料遺失的風險。感謝你的支持!

Databases

邊玩邊學

回答這些題目賺取能量,接著就能釣魚、探索。不需要帳號。

給老師: 為 Databases(Computer Science、CIE)準備好可直接使用的課程投影片, 複習筆記——用於你的課程,或把這個主題當成互動班級活動,讓學生以即時遊戲的方式進行。

課程筆記

What is a Database?

  • A database is an organised collection of data.
  • It consists of one or more tables made up of fields and records.
  • Databases allow easy storage, retrieval, and management of information.
  • They are stored on secondary storage and often on remote servers for multi-user access.
  • Data can be sorted and searched efficiently, and databases are more secure than text files.

Fields & Records

  • A field is one piece of information relating to one person/item/object; represented as a column.
  • A record is a collection of fields relating to one person/item/object; represented as a row.
  • Example: In a student table, fields include StudentID, FirstName, LastName; each row is a record.

Text Files vs Databases

  • Text files are useful for small amounts of data; stored on secondary storage and read into a program.
  • Each entry is stored on a new line or separated by a delimiter (e.g., comma).
  • It can be difficult to know where a record begins and ends in a text file.
  • Databases provide better structure, security, and efficiency for large data.

Data Types

  • A data type defines the type of data held in a field, set when designing a table.
  • Common data types: Integer (whole number), Real (decimal), Text/alphanumeric, Character (single), Date/Time, Boolean (true/false).
  • Example: In a cars table, carid is Integer, make is Text, price is Real.

Validation Checks

  • Validation rules control what data can be entered into a field.
  • Length check: ensures a fixed number of characters (e.g., phone number 11 digits).
  • Format check: ensures data matches a pattern (e.g., two letters + five numbers).
  • Range check: ensures a number is within a range (e.g., age 0–40).
  • Presence check: ensures a field cannot be left blank.
  • Type check: ensures data is of the correct data type (e.g., date field cannot have text).
  • Check digit: a digit added to a number to verify accuracy using an algorithm.

Primary Keys

  • A primary key is a unique field that identifies each record in a table.
  • It must be unique for every record and cannot be null.
  • Examples: CustomerID, StudentID, Car Registration, ProductID.
  • Primary keys are often ID numbers (e.g., MemberID in a Members table).

Key Database Terminology

  • Table: a collection of records with a similar structure.
  • Record: a group of related fields representing one data entry (a row).
  • Field: a single piece of data in a record (a column).
  • Data type: the type of data held in a field.
  • Primary key: a unique identifier for each record, usually an ID number.

投影片

Sign up free to view the lesson slides

Step through every slide for this topic — plus flashcards and revision notes — with a free account.

練習題

免費預覽——60 題中的 8 題。註冊即可查看全部。
  1. 1.What is a database?

    Easy
    • AAn organised collection of data
    • BA collection of text files
    • CA single table of data
    • DA program for editing data
  2. 2.In a database table, a field is represented by a:

    Easy
    • ARow
    • BColumn
    • CRecord
    • DTable
  3. 3.In a database table, a record is represented by a:

    Easy
    • AColumn
    • BField
    • CRow
    • DPrimary key
  4. 4.Which of the following is the most suitable primary key for a table storing information about books in a library?

    Easy
    • AAuthor
    • BTitle
    • CISBN
    • DPublisher
  5. 5.Which validation check would ensure that a phone number field contains exactly 11 digits?

    Easy
    • ARange check
    • BLength check
    • CFormat check
    • DPresence check
  6. 6.A product code must be two letters followed by five numbers. Which validation check should be applied?

    Medium
    • ALength check
    • BRange check
    • CFormat check
    • DType check
  7. 7.Which data type would be most appropriate for a field storing a person's date of birth?

    Easy
    • AInteger
    • BText
    • CDate/Time
    • DBoolean
  8. 8.A field is defined as 'Boolean'. What type of values can it store?

    Easy
    • AWhole numbers only
    • BDecimal numbers
    • CTrue or false values
    • DSingle characters

Unlock all 60 questions & more

建立免費帳號,即可查看這個主題的所有題目、投影片、字卡與複習筆記。

歷屆試題

這個主題的歷屆試題練習即將推出。
即將推出