Home / Notes / Class 10 / Computer Science / Databases

Databases: Class 10 Computer Science

Written by Usman Tariq (Computer Science)

Data and information, the database and the database management system, tables, fields, records and keys, data types, relationships, queries, forms and reports, and basic SQL.

Key points

Data is a collection of raw facts such as names, numbers and dates. Information is data that has been processed and organised so that it has meaning. The marks of 40 students are data. The average mark of the class is information.

A database is an organised collection of related data that is stored so that it can be searched, updated and reported easily. A database management system (DBMS) is the software that creates the database and controls how data is stored, retrieved and protected. Microsoft Access, MySQL and Oracle are examples.

The parts of a database:

  • Table: data arranged in rows and columns about one subject, such as students.
  • Field: a column of the table that stores one kind of data, such as Name or Date of Birth.
  • Record: a row of the table that holds all the data about one item, such as one student.
  • Primary key: a field whose value is different for every record, such as the roll number. It identifies each record and cannot be empty.

Data types. Each field has a data type that decides what can be stored in it. Common types are Text (names), Number (marks), Date/Time, Currency, Yes/No and Auto Number, which gives each new record the next number automatically. Choosing the right type saves space and prevents mistakes, for example a date field will not accept a name.

Relationships. In a relational database the data is kept in several tables that are linked. A student table and a class table can be linked by a common field. The primary key of one table appears in the other table as a foreign key. This avoids storing the same data twice, which is called redundancy.

Database objects in a program such as Microsoft Access:

  • Tables store the data.
  • Queries search and select data that meets a condition, for example all students with marks above 80.
  • Forms give a friendly screen for entering and viewing one record at a time.
  • Reports present the selected data in a printed layout, with headings and totals.

Basic SQL. Structured Query Language (SQL) is used to ask questions of a database. SELECT chooses the fields, FROM names the table and WHERE gives the condition. For example, SELECT Name, Marks FROM Students WHERE Marks > 80; lists the name and marks of the students who scored above 80. ORDER BY sorts the result.

Advantages of a database over a paper file:

  • Data can be found quickly by searching or sorting.
  • Data is stored once, so there is less duplication.
  • Many users can share the same data at one time.
  • Rules and passwords keep the data accurate and secure.
  • Reports can be made from the data in seconds.

Study tip: For a database answer, name the table, the fields and the primary key first. Examiners give marks for a sensible choice of the key and the data types.

Definitions and flashcards

Say the meaning first, then open the card to check.

Database

An organised collection of related data.

DBMS

Software that creates and manages a database.

Table

Data about one subject arranged in rows and columns.

Field

A column in a table that holds one kind of data.

Record

A row in a table that holds all the data about one item.

Primary key

A field that has a unique value for every record.

Foreign key

A field in one table that is the primary key of another table.

Query

A request to search for or select data that meets a condition.

Redundancy

The unnecessary repetition of the same data.

SQL

Structured Query Language, used to create, search and change data in a database.

Short questions with model answers

These are the kind of questions asked for 2, 3 and 5 marks. Try each one before opening the answer.

Differentiate between data and information. (2 marks)

Data is raw facts that have no meaning on their own, such as 45, 67 and 89. Information is data that has been processed and organised so that it is useful, such as the average mark of 67.

What is a primary key? Give an example. (2 marks)

A primary key is a field whose value is unique for every record, so it identifies each record. The roll number in a student table is an example.

Write the difference between a field and a record. (2 marks)

A field is a column in a table that stores one kind of data, such as the name. A record is a row that stores all the fields for one item, such as everything about one student.

Name any three data types in a database and give an example of data for each. (3 marks)

Text, for a name such as Ayesha. Number, for marks such as 85. Date/Time, for a date of birth such as 12/05/2010. Other types are Currency and Yes/No.

Write an SQL statement to display the names of all students from the table Students whose class is 10. (3 marks)

SELECT Name FROM Students WHERE Class = 10; SELECT chooses the field, FROM gives the table and WHERE gives the condition.

Describe four advantages of using a database instead of paper files. (5 marks)

Searching is fast, because a query can find a record in seconds. Data is stored once, so there is less duplication and fewer mistakes. Many users can use the same data at the same time. Passwords and access rights protect the data. Reports and totals can be produced automatically.

Common mistakes

  • Calling a column a record and a row a field. A field is a column and a record is a row.
  • Choosing a field with repeated values, such as a name, as the primary key.
  • Storing a phone number in a Number field and losing the leading zero. Use Text for such data.
  • Forgetting the WHERE condition in SQL and getting every record.

Practise this chapter

Practice questions and timed test Printable worksheet

Next: Spreadsheets