Data Modelling

 

Welcome to class! 

In today’s class, we will be talking about data modelling. Enjoy the class!

Data Modelling

Data Modelling | classnotes.ng

Database packages are used to design a database on a computer. Example of a common database package is Microsoft Access. MS Access is a Relational Database Management System used to create and modify databases.

The organisation of the database using MS Access

To create a database on the computer with MS Access

Load MS Access:

Do the following;

  • Click on the Start Menu
  • Point to All program
  • Point to Microsoft Office
  • Click on Microsoft Access

ORGANIZATION OF DATABASE USING MS ACCESS

 Creating database:
  • From the displayed window, click on a blank database.
  • By the right-hand side of the windows, where the arrow is pointing in the picture-screen above, click inside the file name text box and type the desired database name.
  • Click on Create command button. A database with the filename given will be created

Files are created as tables in the database

Creating a file
  • Click on Create menu and select Table
  • At all Tables tab, right-click on any of the tables.
  • Select design View

In the Save As dialog box, type the desired table name (e.g. Student Table) in the Table Name text box and click ok.

Tables in a database on a computer are composed of rows and columns. A table in MS Access is organized into rows and columns like the picture screen shown below.

A row contains records or diverse fields. The rows specify the number of records in the table. For example, in the picture-screen above, there are six records in the student table.

A column usually represents a field in a database table. It contains specify the type of information. For example, in the picture screen above, there are three fields (data fields), REG. No., Surname, and first name.

Evaluation

  1. List the steps on how to lad MS-Access.
  2. List three (3) examples of Database package.
Create fields with data types

Fields are assigned field names relevant to the information they keep. Field names are assigned data types which determine the kind of data they accept as input. For example in MS Access table above, Surname is alphabetic, the fields will not accept numeric (numbers) inputs 10 or 500 as a surname. To set the data type for a field in MS Access, follow the steps below;

  • After creating the table in design view under the field name tab, then type the field name and under the data type tab next to the field name, click the drop-down menu and select AutoNumber as shown below.

For example, using the above picture screen, the field name ID Number will be assigned Number data type since the ID Numbers will be numeric. In the same way, the TEXT data type will be assigned to Surname and First name.

Unique Identifier

A table contains a unique identifier i.e. a KEY. In MS Access, a default primary key is usually specified for the first field. To set another field of your choice as primary key, right-click on the first cell and select Primary Key.

Note: The symbol of a key should appear beside the field, after setting that field as a unique identifier. If it does not appear repeat previous steps.

Creating a database

Generally, creating a database using any DBMS entails the following basic steps:

  • Define the database structure:

The database structure specifies the type of database organization that should be used. If the relational form is selected, the database structure will include RDBMS, the structure of the table, number of rows, number of columns, the key, and relationship of the database etc.

  • Specify field type:

When a database is being created, all fields are set to accept a particular type of input by specifying a field type. A field type is also known as a Data type. The essence of a data type is to prevent a wrong input from being stored in a database (i.e. database integrity). Usually, the name of a data type varies with DBMS but portrays a general meaning. These include;

  1. Alphanumeric/ text field: Fields that accepts both numbers and text e.g. ASP2548.
  2. Numeric Fields: Fields that accepts numbers in two forms: Real number i.e. decimal numbers e.g. 8.15, 9.1 and integers’ i.e. whole numbers e.g. 125, 80 etc.
  3. Date Fields: They store data in date format e.g. 11-04-2009
  4. Boolean fields: The data accepted by these fields are either Yes/No or True/False.
  5. Memo: Long text. Use for long pieces of text. Such as notes and long description. Can store up to 64,000 characters.
  6. Currency: Use for currency.
  7. AutoNumber: Unique sequential numbers or random number automatically inserted when you create a record. Use to create a primary key.
  8. Hyperlink: Use to store hyperlink
  9. Attachment: use to store attachments e.g. files, images etc.
  10. OLE Object: Use to attach an OLE object such as word document, Spreadsheet, or  PowerPoint Presentation
  • Input data:

After the field names and their data types have been specified, then records are stored in the database by specifying the appropriate input. In MS Access, to input a data:

  1. Double click on the Student Table at the left-hand pane of MS Access windows
  2. Enter the data beneath the field names and click on the next cell to populate data.

To keep the database updated, data inputted into the database must be saved regularly. Keyboard command CTRL + S is used. Alternatively, you click on the Office button and save.

Evaluation

  1. How is a database created?
  2. What are the data types you can specify in Ms-Acess?
Basic operation

The basic operations to be considered are:

  1. Searching
  2. Sorting
  3. Modifying
  4. Generate report
Searching:
  1. On the Tools menu, click Options
  2. Click the Edit/Find tab
  3. Under Default find/replace behave, do one of the following:
  4. Select Fast Search to search the current field and match the whole field.
  5. Select General search to search all fields and match any part of the field.
  6. Select Start of Field Search to search the current field and match the beginning characters of the field.
  7. DBMS has a certain command for saving a database. For example in MS Access, select the save option on the MS Access window to save.
Sorting:

To sort records in form view or datasheet view, follow these steps:

  1. Start MS Access, and then open the database that you are working with.
  2. Open the table or the form whose data you want to view.
  3. Click the field that you want to use for sorting records. To sort records in sub-form, click the field that you want to sort. To sort records in a sub-datasheet, display the sub-datasheet by clicking expand indicator, and then click the field that you want to sort.
  4. On the records menu, point to sort, and then click Sort Ascending or Sort Descending. NOTE: In a form, you can only sort on only one field at a time.

Sorting with sub-datasheet

In datasheet view, when you sort the sub-datasheet for one record, MS Access sorts all the sub-datasheets at that level. In a datasheet or sub-datasheet, you can select two or more adjacent columns at the same time, and then sort them. Access sorts record starting with the leftmost selected column. When you save the form or datasheet, Access saves the sort order.

Sorting records on a report

  1. Start MS Access, and then open the database that you are working with.
  2. Open the report in Design View.
  3. On the View menu, click “Sorting and Grouping” to display the Sorting and Grouping dialog box.
  4. In the first row of the Field/Expression column, select a field name or type an expression. NOTE: When you fill in the Field/Expression column, MS Access sets the sort order to Ascending.
  5. You can sort up to10 fields or expression in a report. To sort your report on more than one field, add another field or expression to the Field/Expression column. The field or expression in the first row is the first sorting level. The second row is the second sorting level, and so on.
Modifying data:

How to Add or Edit Data in a Datasheet (Table or Query) or a Form

  1. Open a table or a query in datasheet View or a form in Form View.
  2. Do one of the following:
  • In MS Office Access 2003 or in earlier versions of Access, to add a new record, point to Go to on the Edit menu, and then click New Record. Type the data, and then press TAB to go to the next field. At the end of the record, press TAB to go to the next record.
  • In MS Office Access 2007, to add a new record, click the Home tab, and then click New in the Records group.
  • To edit data within a field, click in the field that you want to edit, and then type the data.
  • To replace the entire value, move the mouse pointer to the leftmost part of the field until the pointer changes into the plus pointer, and then click. Type the data.

NOTE: To correct a typing mistake, press BACKSPACE. To cancel your changes both in the current field and in the entire record, press ESC.

How to save a record in a Datasheet or a Form

NOTE: MS Access automatically saves the record that you are adding or editing as soon as you move to a different record or close the form or table that you are working on.

Explicitly, to save the data in a record while you are editing, In Access2003 or earlier versions,

Click Save Record on the Records menu.

In Access 2007, Click the HOME tab, and then click Save in the Records group.

How to delete a record in a datasheet or a form

  1. Open a table or a query in Datasheet view or open a form in Form View.
  2. Click the record that you want to delete.
  3. In Access 2003 or earlier versions, Click Delete Record on the Edit menu. In 2007, click the Home tab, and then Click Delete Record in the Delete list in the Records group.
Generating reports
  1. Auto report:
  • Open the database window (F11) and click on the Report tab.
  • Click New. A dialog box appears.
  • Choose between Columnar and Tabular.
  • Select the table or query that you want to use for your report.
  • Click OK.
  1. Create your own report:
  • Repeat the first two steps above.
  • When the dialog box appears, click Design View.
  • Select the table or query that you intend to use.
  • Click OK.
  1. Report wizard:
  • Repeat the first two steps above.
  • Click the wizard that you want to use for your report.
  • Select the table or query that you want to use for your report.
  • Click OK.
  • Follow the instructions that the wizard provides.
General evaluation
  1. State the operations that can be performed in a database.
  2. List five (5) data type.

Weekend assignment

Instruction: Choose the correct option from the ones lettered A to D

  1. Another name for field type is known as ____ (a) File type (b) Name type (c) Record type (d) Data type
  2. Another name for unique identifier is known as ____ (a) Key (b) Data (c) Field (d) Record
  3. ____ is an attribute or field that can be used to identify a record in a database table or file. (a) Data (b) Field        (c) Key         (d) Table
  4. ____ is used to design a database on a computer. (a) Database package (b) Graphics package (c) Spreadsheet package (d) Word Processing package
  5. ____model organizes data using two fundamental constructs, called records and sets. (a) Hierarchical      (b) Relational  (c) Network  (d) Optical

 

In our next class, we will be talking more about Data Modelling.  We hope you enjoyed the class.

Should you have any further question, feel free to ask in the comment section below and trust us to respond as soon as possible.

School Owner? Looking for ready-made content and tools to save time and grow easily? Book a free demo session now

Get more class notes, videos, homework help, exam practice on Android [DOWNLOAD]

Get more class notes, videos, homework help, exam practice on iPhone [DOWNLOAD]

6 thoughts on “Data Modelling”

Leave a Reply

Your email address will not be published. Required fields are marked *

Don`t copy text!