☰ Contents · Computing

Creating a database and importing

Lessons 24–25 · 2 lessons · N. I. Taylaqov (general editor), A. B. Akhmedov, M. D. Pardayeva, A. A. Abdug‘aniyev, U. M. Mirsanov. Informatics and Information Technologies, Grade 10, 1st edition. “Extremum-Press”, Tashkent, 2017
25

Creating a database in MS Access

Textbook: pp. 52–55
GoalCreates a table in Design View, sets field types and properties, marks a primary key and enters data.
New words
Design View: the view for describing the table structure · Design ViewDatasheet View: the grid view for entering and reading records · Datasheet Viewvalidation rule: a condition that a value must meet to be accepted · tekshirish qoidasirequired field: a field that cannot be left empty · majburiy maydon
Explanation

There are three ways to create a table: entering data straight in Datasheet view (Access guesses the types itself), writing the structure by hand through Create – Table Design, and using a ready template. In Design View each row gets a Field Name, a Data Type and (optionally) a Description. The primary key is marked with Table Tools – Design – Primary Key. In the field properties below you set the size (Field Size), Default Value, Required and Validation Rule, for example >=0 And <=100 for a score; if the rule is broken, the Validation Text message appears. The table is saved with Ctrl+S under a name, then records are entered in Datasheet View; the structure can be changed later in Design View again. After creating a database, keep it in a reliable place and make a copy.

Worked examples
The Books table: BookID – AutoNumber (key); Title – Short Text, Required; Author – Short Text; Year – Number, Validation Rule >=1900 And <=2100; Price – Currency; Available – Yes/No, Default Value Yes. That is 6 fields in all. If 1850 is entered in Year, Access shows a message and does not accept the value.
A score field: Score – Number, Field Size = Byte, Validation Rule = Between 0 And 100. 85 is accepted and 120 is rejected. If you also set Default Value = 0, a new record starts with the score 0.
Class activity

“The rule breaker”: one pair sets a validation rule on a table, and the other pair enters a value that breaks it, reads Access’s message and explains the rule.

Practice
1
In which view is the table opened to change a field type later?
2
Write a validation rule for a score from 0 to 100.
3
How many fields does the Books table have (BookID, Title, Author, Year, Price, Available)?
4
Why is the Title field made Required?