DATABASE NOTES msomimaktaba, May 3, 2021 DATABASESA database is a collection of data organized in manner that allows access, retrieval, use and maintenance of that data. Examples of databasesTelephone books (directories)Customer address booksEmployee information formsDictionariesTelevision guides e.t.cCharacteristics of databasesThe data is arranged in columns(fields) and rows()Each column has similar data itemsEach row contains information belonging to a single individualTypes of databases (i). Flat file databaseIt is a database made up of only one tableIt is easy to set up and use(ii). A relational databaseIt is a database which can take information from two or more database tables and combine them into a new table or report.NB: A relationship determines the way in which the details in one table are related to the details in another table. It can be a one to one relationship, one to many or many to many relationship. A database can also be categorized as a paper/manual database or a computerized (electronic) database An example of a paper database is a personal address book on the other hand, an electronic inventory tracking system is one example of computerized database Advantages of using electronic database system It is easy to enter and retrieve data in a short period of time.Data is frequently updated after each single entry.An electronic database can store data for a very long period of time in an archive.An electronic database is flexible since it can be redesigned, to hold thousands of data.An electronic database can be used by many people at the same time.Data can be retrieved in different formats e.g. Query, forms, reports, etc.An electronic database stores data that is consistent and reliable since at each stage, it is checked for consistency and reliability. Disadvantages of database systemThey are also difficult and time consuming to developThey are expensive to set up as they may require sophisticated programs and hardware.Data in a database may be more susceptible to sabotage, theft or destruction.It requires much time for training to be effective in using an electronic database A DATABASE MANAGEMENT SYSTEM (DBMS) A database management system (DBMS) is a software tool that lets users add, view, and work with the data in a databaseExamples of (DBMS) OracleLotus ApproachCorel paradoxMYSQLInformixMicrosoft Access etcWe shall deal much with the basic one which is Microsoft Access TERMS USEDCommon terms used in database management systemsData entry: The process of getting information into a database, usually done by peopleObjects: These are the components that makeup a database. Examples of database objects include, tables, forms, queries, reports, modules, macrosAn entity: is a person, place, thing, activity, or event for which data is collectedA field: is a single piece of information from a record. In a database table every column represents a fieldA record: Is a row on a datasheet and is a set of values defined by fieldsField name (Field Labels): Is a title of a particular column in a database table e.g. titles like ID No, Name, Sex, District, Allowance.Field Length: Is the maximum number of characters that can be stored for data in aParticular field.Data type (Field Type): is an attribute which determines the kind of data which users can store in a fieldData redundancy: Is the repeating of data in more than one file.Query: is a database object used to request for specific type of data from a database table or combination of tables.Form: is a database object that allows you to enter or view data stored in your tables.Report: is a formatted screen display or printout of the contents of one or more tables in a database.Design view: This provides the tools for creating fields in a table and other objects.Datasheet view: Allows one to update, edit and delete information from a table.Attribute: a part of the description of an entity. The entity itself is described by one or more attributes e.g. the attributes for student can be name, Address, Telephone, etc. Primary key (key field): is a field in a data file that uniquely identifies each record. It is also used to connect two or more tables in a databaseCharacteristics of a primary keyIt uniquely identifies each record ie cannot have repeated valuesIt is never empty or null15. Foreign key: Is a primary key of one table that also appears in another table16. Data integrity: Is the degree to which the data in any file is accurate and up-to date.17. A string is a data type used to represent text rather than numbers. It is comprised of a set of characters that can also contain spaces and numbers. Wild cards: Is a special character that represents one or more other characters. Wild card characters may be used to represent a letter or letters in a word. Wild cards can be used in access queries to look for specific informationWildcardDescriptionExample*Matches any number of characters. You can use the asterisk (*) anywhere in a character string.wh* finds what, white, and why, but not awhile or watch.?Matches any single alphabetic character.B?ll finds ball, bell, and bill.[ ]Matches any single character within the brackets.B[ae]ll finds ball and bell, but not bill.!Matches any character not in the brackets.b[!ae]ll finds bill and bull, but not ball or bell.–Matches any one of a range of characters. You must specify the range in ascending order (A to Z, not Z to A).b[a-c]d finds bad, bbd, and bcd.#Matches any single numeric character.1#3 finds 103, 113, and 123. Data normalizationThe process of applying the normalization rules to your database design is called normalizing the database, or just normalization.When do we use normalization rules?When you want ensure that you have divided your information items into the appropriate tables i.e. when you want to see if your tables are structured correctly.You apply the rules in succession, at each step ensuring that your design arrives at one of what is known as the “normal forms.” Five normal forms are widely accepted iethe first normal formsecond normal formthird normal formfourth normal formfifth normal forms Database objectsThese are the basic components that make up a database and they include:TablesQueriesFormsReportsmacrosModules etc Macros (Mini programs): These are tools used to automate the way one uses his database. Macros can be used to instruct the computer to print specific reports at a given time.Macros in Access can be thought of as a simplified programming language which you can use to add functionality to your database. For example, you can attach a macro to a command button on a form so that the macro runs whenever the button is clicked. Macros contain actions that perform tasks, such as opening a report, running a query, or closing the database. Most database operations that you do manually can be automated by using macros, so they can be great time-saving devices.Modules: A module is a collection of declarations, statements, and procedures that are stored together as a unit.Modules, like macros, are objects you can use to add functionality to your database. Whereas you create macros in Access by choosing from a list of macro actions, you write modules in the Visual Basic for Applications (VBA). Visual Basic for Applications (VBA): is a macro-language version of Microsoft Visual Basic that is used to program Microsoft Windows-based applications and is included with several Microsoft programs.Database tablesCharacteristics of a good database tableIt should have a primary keyIt should have the required fieldsIt should have required data types and formats Data types in Microsoft AccessData typeStoresSizeTextAlphanumeric characters Use for text, or text and numbers that are not used in calculations (for example, a product ID).Up to 255 characters.MemoAlphanumeric characters (longer than 255 characters in length) or text with rich text formatting. Up to 1 gigabyte of characters, or 2 gigabytes of storage (2 bytes per character), of which you can display 65,535 characters in a control.NumberNumeric values (integers or fractional values). Used for storing numbers to be used in calculations, except for monetary values (use the Currency for data type for monetary values).1, 2, 4, or 8 bytes, or 16 bytes when used for replication ID.Date/TimeDates and times. Used for storing date/time values. Note that each value stored includes both a date component and a time component.8 bytes.CurrencyUsed for storing monetary values (currency).8 bytes.AutoNumberA unique numeric value that Office Access automatically inserts when a record is added.Use for generating unique values that can be used as a primary key. Note that AutoNumber fields can be incremented sequentially.4 bytes or 16 bytes when used for replication ID.Yes/NoBoolean values. Use for True/False fields that can hold one of two possible values: Yes/No or True/False, for example.1 bit (8 bits = 1 byte).OLE(Object Linking and Embedding) ObjectOLE objects or other binary data. Use for storing OLE objects from other Microsoft Windows applications.Up to 1 gigabyte.AttachmentPictures, Images, Binary files, Office files. This is the preferred data type for storing digital images and any type of binary file.NoteField name should be written as a CaptionFor compressed attachments, 2 gigabytes. For uncompressed attachments, approximately 700k, depending on the degree to which the attachment can be compressed.HyperlinkHyperlinks.Use for storing hyperlinks to provide single-click access to Web pages through a URL (Uniform Resource Locator) or files through a name in UNC (universal naming convention) format. You can also link to Access objects stored in a database.Up to 1 gigabyte of characters, or 2 gigabytes of storage (2 bytes per character), of which you can display 65,535 characters in a control.Lookup WizardNot actually a data type; instead, this invokes the Lookup Wizard.Use to start the Lookup Wizard so you can create a field that uses a combo box to look up a value in another table, query or list of values.Table or query based: The size of the bound column. Value based: The size of the Text field used to store the value.Note For phone numbers, part numbers, and other numbers you don’t intend to use for mathematical calculations, you should select the Text data type, not the Number data type.For the Text and Number data types, you can specify the field size or data type more specifically by setting a value in the FieldSize property box.Field propertiesUse this field propertyToFieldSizeSet the maximum size for data stored as a Text, Number, or AutoNumber data type.FormatCustomize the way the field appears when displayed or printed.DecimalPlacesSpecify the number of decimal places to use when displaying numbers.NewValuesSet whether an AutoNumber field is incremented or assigned a random value.InputMaskDisplay editing characters to guide data entry.CaptionSet the text displayed by default in labels for forms, reports, and queries.DefaultValueAutomatically assign a default value to a field when new records are added.ValidationRuleSupply an expression that must be true whenever you add or change the value in this field.ValidationTextEnter text that appears when a value violates the ValidationRule expression.RequiredRequire that data be entered in a field.AllowZeroLengthAllow entry (by setting to Yes) of a zero-length string (“”) in a Text or Memo field.IndexedSpeed up access to data in this field by creating and using an index.UnicodeCompressionCompress text stored in this field when a large amount of text is stored (> 4,096 characters)IMEModeControl conversion of characters in an Asian version of Windows.IMESentenceModeControl conversion of characters in an Asian version of Windows.SmartTagsAttach a smart tag to this field.AppendOnlyAllow versioning (by setting to Yes) of a Memo field.TextFormatChoose Rich Text to store text as HTML and allow rich formatting. Choose Plain Text to store only text.TextAlignSpecify the default alignment of text within a control.PrecisionSpecify the total number of digits allowed, including those both to the right and the left of the decimal point.ScaleSpecify the maximum number of digits that can be stored to the right of the decimal separator.If you want more space to enter or edit a property setting in the property box, press SHIFT+F2 to display the Zoom If you are entering an input mask or validation expression and would like help in building it, click next to the property box to display the appropriate builderUnderstanding input masksAn input mask is a set of literal characters and mask characters that control what you can and cannot enter in a field. For example, an input mask can require users to enter dates or telephone numbers that follow the conventions for a specific country/regionWhen and where to use an input maskYou use an input mask whenever you want users to enter data in a specific way. For example, if you want users to enter phone numbers in the British format or German format, use an input mask.By default, you can apply input masks to table fields that are set tothe Text,Number (except ReplicationID),Currency, andDate/Time data types.You can also apply input masks to form controls, such as text boxes, that you bind to table fields that are set to those data types.How to use input masksYou can add input masks to table fields by running the Input Mask Wizard, or by manually entering masks in a field property (the Input Mask property).Input mask character referenceThe following table lists and describes the placeholder and literal characters that you can use in an input mask.CharacterUse0Digit. You must enter a single digit in this position.9Digit. Single digits in this position are optional.#Enter a digit, a space, or a plus or minus sign in this position. If you skip this position, Access enters a blank space.LLetter. You must enter a single letter in this position.?Letter. Single letters in this position are optional.ALetter or digit. You must enter a single letter or digit in this position.aLetter or digit. Single letters or digits in this position are optional.&Any character or space. You must enter either a single character or a space in this position.CAny character or space. Characters or spaces in this position are optional.. , : ; – /Decimal and thousands placeholders, date and time separators. The character you select depends on your Microsoft Windows regional settings.>All characters that follow appear in uppercase.<All characters that follow appear in lowercase.!Causes the input mask to fill from left to right instead of from right to left.\Forces Access to display the character that immediately follows. This is the same as enclosing a character in double quotation marks.“Literal text”Encloses any text that you want users to see in double quotation marks.PasswordIn Design view for tables or forms, setting the Input Mask property to Password creates a password entry box. When users type passwords in the box, Access stores the characters but displays asterisks (*).Examples of input masksThe examples in the following table demonstrate some of the ways you can use input masks.This input mask Provides this type of valueNotes(000) 000-0000(206) 555-0199In this case, you must must enter an area code because that section of the mask (000, enclosed in parentheses) uses the 0 placeholder.(999) 000-0000!(206) 555-0199 ( ) 555-0199In this case, the area code section uses the 9 placeholder, so area codes are optional. Also, the exclamation point (!) causes the mask to fill in from left to right.(000) AAA-AAAA(206) 555-TELEAllows you to substitute the last four digits of a U.S. style phone number with letters. Note the use of the 0 placeholder in the area code section, which makes the area code mandatory.#999-20 2000Any positive or negative number, no more than four characters, and with no thousands separator or decimal places.>L????L?000L0GREENGR339M3 MAY R 452B7A combination of mandatory (L) and optional (?) letters and mandatory numbers (0). The greater-than sign forces users to enter all letters in uppercase. To use an input mask of this type, you must set the data type for the table field to Text or Memo.00000-999998115- 98115-3007A mandatory postal code and an optional plus-four section.>L<??????????????Maria PierreA first or last name with the first letter automatically capitalized.ISBN 0-&&&&&&&&&-0ISBN 1-55615-507-7A book number with the literal text, mandatory first and last digits, and any combination of letters and characters between those digits.>LL00000-0000DB51392-0493A combination of mandatory letters and characters, all uppercase. Use this type of input mask, for example, to help users enter part numbers or other forms of inventory correctly. QueryQuery: is a database object used to request for specific type of data from a database table or combination of tables.This is achieved through the use of query criteriaA query criteria is a rule that identifies the records that you want to include in the query result.Use this criterionQuery result“China”Returns records where the Value in the field is set to China.Not “Mexico”Returns records where the Value in the field is set to any other value in the field other than Mexico.Like A*Returns records for all fields whose values start with “A”, Note When used in an expression, the asterisk (*) represents any string of characters — it is also called a wildcard character.Like “*Korea*”Returns records for all fields that contain the string “Korea”.K*and*I*D*K*or b*<>john*E or *INot Like U*Returns records for all fields whose names start with a character other than “U”.Not Like “*Korea*”Returns records for all fields that do not contain the string “Korea”.Like “*ina”Returns records for all fields whose names end in “ina”, such as China and Argentina.Not Like “*ina”Returns records for all fields that do not end in “ina”, such as China and Argentina.Is NullReturns records where there is no value in the the field.Is Not NullReturns records where the value is not missing in the field.“” (a pair of quotes)Returns records where the field is set to a blank (but not null) value.Not “”Returns records where the field has a nonblank value.“” Or Is NullReturns records where there is either no value in the field, or the field is set to a blank value.Is Not Null And Not “”Returns records where the field has a nonblank, non-null value.>= “Mexico”Returns records of all fields with values beginning with Mexico and continuing through the end of the alphabet.Like “[A-D]*”Returns records for fields whose values start with the letters “A” through “D”.“USA” Or “UK”Returns records for USA and UK.In(“France”, “China”, “Germany”, “Japan”)Returns records for all fields with values specified in the list.Right([Value in the], 1) = “y”Returns records for all fields where the last letter is “y”.Len([Country/Region]) > 10Returns records for countries/regions whose name is more than 10 characters long.Like “Chi??”Returns records for fields with values, such as China and Chile, whose names are five characters long and the first three characters are “Chi”.Criteria for Number, Currency, and AutoNumber fieldsUse this criterionQuery Result100Returns records where the value is 100.Not 1000Returns records where the value is not 1000.< 100 <= 100Returns records where the value is less than 100 (<100).Displays records where the value is less than or equal to 100.20 or 25Returns records where the value is either 20 or 25.>10 and <90Returns records where the value is between (but not including) 10 and 90Between 50 and 100Returns records where the value is between (and including) 50 and 100<50 or >100Returns records where the value is not between 50 and 100.In(20, 25, 30)Returns records where the value is either 20, 25, or 30.Like “*4.99”Returns records where the value ends with “4.99”, such as 4.99, 14.99, 24.99, and so on.Is NullReturns records where no value is entered in the field.Is Not NullReturns records where the value is not missing in the field.Criteria for Date/Time fieldsUse this criterionQuery result#2/2/2006#Returns records with date set to Feb 2, 2006.NoteRemember to surround date values with the # character so that Access can distinguish between date values and text strings.Not #2/2/2006#Returns records that took place on a day other than Feb 3, 2006.5/*/*Displays all records on 5th of any month of any year5/10/**/6/*All records with the month of june*/*/2012< #2/2/2006#Returns records that took place before Feb 2, 2006.> #2/2/2006#Returns records that took place after Feb 2, 2006.>#2/2/2006# and <#2/4/2006#Returns records took place between Feb 2, 2006 and Feb 4, 2006.You can also use the Between operator to filter for a range of values. For example, Between #2/2/2006# and #2/4/2006# is the same as >#2/2/2006# and <#2/4/2006# .<#2/2/2006# or >#2/4/2006#Returns records took place before Feb 2, 2006 or after Feb 4, 2006.#2/2/2006# or #2/3/2006#Returns records that took place on either Feb 2, 2006 or Feb 3, 2006.In (#2/1/2006#, #3/1/2006#, #4/1/2006#)Returns records that took place on Feb 1, 2006, March 1, 2006, or April 1, 2006.DatePart(“m”, [SalesDate]) = 12Returns records that took place in December of any year.DatePart(“q”, [SalesDate]) = 1Returns records that took place in the first quarter of any year.Date()Returns records that took place on the current day. If today’s date is 2/2/2006, you see records where the Date field is set to Feb 2, 2006.Date()-1Returns records that took place the day before the current day. If today’s date is 2/2/2006, you see records for Feb 1, 2006.Date() + 1Returns records that took place the day after the current day. If today’s date is 2/2/2006, you see records for Feb 3, 2006.< Date()Returns records that took place before today.> Date()Returns records that will take place after today.Is NullReturns records where the date is missing.Is Not NullReturns records where the date is known.DateDiff (“yyyy”, [BirthDate], Date()) > 30This criterion applies to a Date/Time field, such as BirthDate. Only records where the number of years between a person’s birthdate and today’s date is greater than 30 are included in the query result. The design processThe design process consists of the following steps:Determine the purpose of your databaseThis helps prepare you for the remaining steps.Find and organize the information required Gather all of the types of information you might want to record in the database, such as product name and order number.Divide the information into tablesDivide your information items into major entities or subjects, such as Products or Orders. Each subject then becomes a table.Turn information items into columnsDecide what information you want to store in each table. Each item becomes a field, and is displayed as a column in the table. For example, an Employees table might include fields such as Last Name and Hire Date.Specify primary keysChoose each table’s primary key. The primary key is a column that is used to uniquely identify each row. An example might be Product ID or Order ID.Set up the table relationshipsLook at each table and decide how the data in one table is related to the data in other tables. Add fields to tables or create new tables to clarify the relationships, as necessary.Refine your designAnalyze your design for errors. Create the tables and add a few records of sample data. See if you can get the results you want from your tables. Make adjustments to the design, as needed.Apply the normalization rulesApply the data normalization rules to see if your tables are structured correctly. Make adjustments to the tables, as needed. Factors to consider before designing a databaseSize and nature of the work that need to be entered into a database.Number of users of the database.How the database will be administered.Future needs of the organization.Initial cost for designing.Application program to use (on the programming side). DATA VALIDATIONValidation – Is the process of comparing the data entered with a set of predefined rules or values to check if the data is acceptable. OR Validation is the name for the checks that detect incorrect data, display an error message and request another input or just reject the data.Data Validation – is the checking of input data for errors (e.g., of the correct data type) before processing.Validation checks used in a databaseAlphabetic check: ensures that only alphabetic characters are entered into the fieldNumeric checks: ensures that only numeric data is entered into the fieldConsistency check: test Checks fields to ensure data in these fields corresponds, e.g., If Title = “Mr.”, then Gender = “M”.Check digits: this confirms the accuracy of a primary key value. It is usually appended to or inserted into a primary checkCross-system consistency checks: Compares data in different systems to ensure it is consistent, e.g., the address for the customer with the same id is the same in both systems.Data type checks: Checks the data type of the input and give an error message if the input data does not match with the chosen data type, e.g., In an input box accepting numeric data, if the letter ‘O’ was typed instead of the number zero, an error message would appear.Range check: Checks that the data lie within a specified range of values, e.g., the month of a person’s date of birth should lie between 1 and 12.Spelling and grammar check: Looks for spelling and grammatical errors.Validation rulesThis prevent bad data from being saved in your table. Basically, they look like criteria in a query.Validation ruleValidation text<>0Enter a nonzero value.>=0Value must be zero or greater.-or-You must enter a positive number.0 or >100Value must be either 0 or greater than 100.BETWEEN 0 AND 1Enter a value with a percent sign. (For use with a field that stores number values as percentages).<#01/01/2007#Enter a date before 2007.>=#01/01/2007# AND <#01/01/2008#Date must occur in 2007.<Date()Birth date cannot be in the future.M Or FEnter M for male or F for female. END ALL NOTES FOR ALL SUBJECTS QUICK LINKS:AGRICULTURE O LEVEL PURE MATHEMATICS A LEVELBAM NOTES A LEVELBASIC MATH O LEVELBIOLOGY O/A LEVELBOOK KEEPING O LEVELCHEMISTRY O/A LEVELCIVICS O LEVELCOMPUTER(ICT) O/A LEVELECONOMICS A LEVELENGLISH O/A LEVELCOMMERCE O/A LEVELACCOUNTING A LEVELGENERAL STUDIES NOTESGEOGRAPGY O/A LEVELHISTORY O/A LEVELKISWAHILI O/A LEVELPHYSICS O/A LEVELMOCK EXAMINATION PAPERSNECTA PAST PAPERS Computer Study/ICT Study Notes Computer NotesPost navigationPrevious postNext postRelated Posts Computer Study/ICT Study Notes COMPUTER/ICT NOTES FORM ONE TOPIC 4: COMPUTER HANDLING November 6, 2018May 6, 2020F1-RevisionHomework-Module2.pdf (138k) ICT Form 1 – Lesson 1.pps (879k) ICT Form 1 – Lesson 2.pps (726k) ICT Form 1 – Lesson 3.pps (622k) 12:31 AM ICT Form 1 – Lesson 4-MSWord.pps (548k) 12:31 AM ALL NOTES FOR ALL SUBJECTS QUICK LINKS: AGRICULTURE O LEVEL PURE MATHEMATICS A LEVEL BAM NOTES… Read More TOP 10 REASONS TO MAJOR IN COMPUTING May 3, 2021TOP 10 REASONS TO MAJOR IN COMPUTING Computing is part of everything we do! Computing and computer technology are part of just about everything that touches our lives from the cars we drive, to the movies we watch, to the ways businesses and governments deal with us. Understanding different dimensions… Read More Computer Study/ICT Study Notes COMPUTER FORM 4 TOPIC 1: MANAGEMENT OF DATABASE INFORMATION SYSTEM November 6, 2018February 13, 2019F1-RevisionHomework-Module2.pdf (138k) ICT Form 1 – Lesson 1.pps (879k) ICT Form 1 – Lesson 2.pps (726k) ICT Form 1 – Lesson 3.pps (622k) 12:31 AM ICT Form 1 – Lesson 4-MSWord.pps (548k) 12:31 AM ICT Form 2 – Lesson 1.pps (1053k) 12:32 AM ICT Form 2 – Lesson 2.pps (1040k)… Read More Leave a Reply Cancel replyYour email address will not be published. Required fields are marked *Comment *Name * Email * Website Save my name, email, and website in this browser for the next time I comment. Δ
Computer Study/ICT Study Notes COMPUTER/ICT NOTES FORM ONE TOPIC 4: COMPUTER HANDLING November 6, 2018May 6, 2020F1-RevisionHomework-Module2.pdf (138k) ICT Form 1 – Lesson 1.pps (879k) ICT Form 1 – Lesson 2.pps (726k) ICT Form 1 – Lesson 3.pps (622k) 12:31 AM ICT Form 1 – Lesson 4-MSWord.pps (548k) 12:31 AM ALL NOTES FOR ALL SUBJECTS QUICK LINKS: AGRICULTURE O LEVEL PURE MATHEMATICS A LEVEL BAM NOTES… Read More
TOP 10 REASONS TO MAJOR IN COMPUTING May 3, 2021TOP 10 REASONS TO MAJOR IN COMPUTING Computing is part of everything we do! Computing and computer technology are part of just about everything that touches our lives from the cars we drive, to the movies we watch, to the ways businesses and governments deal with us. Understanding different dimensions… Read More
Computer Study/ICT Study Notes COMPUTER FORM 4 TOPIC 1: MANAGEMENT OF DATABASE INFORMATION SYSTEM November 6, 2018February 13, 2019F1-RevisionHomework-Module2.pdf (138k) ICT Form 1 – Lesson 1.pps (879k) ICT Form 1 – Lesson 2.pps (726k) ICT Form 1 – Lesson 3.pps (622k) 12:31 AM ICT Form 1 – Lesson 4-MSWord.pps (548k) 12:31 AM ICT Form 2 – Lesson 1.pps (1053k) 12:32 AM ICT Form 2 – Lesson 2.pps (1040k)… Read More