The words you are searching are inside this book. To get more targeted content, please make full-text search by clicking here.
Discover the best professional documents and content resources in AnyFlip Document Base.
Search
Published by Oasis Publication, 2023-10-02 03:54:58

Computer 10 New

Computer 10 New

Approved by Curriculum Development Centre 101 Oasis Radiant Computer Science, Book 10 Octal Number System The number with base eight is called octal number. It is represented by Q or O. we can generate these numbers with the combination of 0,1,2,3,4,5,6,7. We can represent these numbers with suffix eight. Eg. (5432)8 Weighted value 85 84 83 82 81 80 32768 4096 512 64 8 1 Conversions from Decimal to Octal Decimal number is repetitively divided by eight and remainders are arranged in the form of octal numbers. Example a. Convert (240)10 (decimal) into octal. 8 240 0 8 30 6 3 (240)10 =(360)8 b. Convert (356)10 into octal 8 356 4 8 44 4 5 (365)10 = (544)8 Conversions from Octal to Decimal Each octal digit is multiplied by its weighted position. The sum of all products is known as decimal form of octal. Example Convert following octal numbers into decimal numbers. a. (340)8 =3 x 82 + 4 x 81 + 0 x 80 = 192 + 32 + 0= (224)10 b. (175)8 = 1 x 82 + 7 x 81 + 5 x 80 = (125)10 Octal to Binary and Binary to Octal Conversion The three-digit format of binary digits is used for octal to binary conversion or vice versa.


Oasis Radiant Computer Science, Book 10 102 Approved by Curriculum Development Centre Octal to Binary 3-bits binary numbers are written for each octal digit. Example a. Convert (56)8 (octal) into binary. Algorithm: Convert each octal digit into binary and make three digits grouping. 5= 101 6= 110 Now our equivalent binary number is (56)8 = (101110)2 b. Convert (64102)8 into binary number 6= 110 4=100 1=001 0=000 2=010 Now our equivalent binary number is (64102)8 = (110100001000010)2 Binary to Octal The binary numbers are broken into 3-bits sections from last bit and converted into octal equivalents of each binary section. Table shows the decimal, octal and equivalent binary bits. Decimal Octal Binary 0 0 000 1 1 001 2 2 010 3 3 011 4 4 100 5 5 101 6 6 110 7 7 111


Approved by Curriculum Development Centre 103 Oasis Radiant Computer Science, Book 10 Example a. Convert (10011)2 into octal number. Algorithm – make 3 bits grouping from last bit. 010 011 – convert each group into decimal numbers. 010 = 2 011 = 3 = (23)8 b. Convert (1011010011)2 into octal number. 001 011 010 011 001=1 011=3 010=2 011=3 =(1323)8 Octal to Hexadecimal Algorithm – Convert octal into binary. – Make group of 4 bits from last bit. – Convert each group into decimal numbers. Example a. (34765)8 into Hexadecimal Number – Convert into binary 3= 011, 4= 100, 7=111, 6=110, 5=101 (011100111110101)2 – Make a four digits group from the last bit of the binary number 0011 1001 1111 0101 (Add 0 before the group to make four digit) 3 9 15 5 (Convert into equivalent decimal numbers) = (39F5)16 Where F=15


Oasis Radiant Computer Science, Book 10 104 Approved by Curriculum Development Centre Hexadecimal The number with base 16 is called hexadecimal number. We can generate these numbers with the combination of 0,1,2,3,4,5,6,8,9,A,B,C,D,E,F. Where A=10, B=11, C=13, D=14, E=15, F=16. We can represent these numbers with suffix sixteen. Eg. (12AB)16 where A=10, B=11. The 4-bit format of binary is used for hexadecimal to binary conversion. Weighted value 165 164 163 162 161 160 1048576 65536 4096 256 16 1 Decimal Octal Hexadecimal Binary 0 0 0 0000 1 1 1 0001 2 2 2 0010 3 3 3 0011 4 4 4 0100 5 5 5 0101 6 6 6 0110 7 7 7 0111 8 8 1000 9 9 1001 10 A 1010 11 B 1011 12 C 1100 13 D 1101 14 E 1110 15 F 1111 Decimal to Hexadecimal Conversion The decimal number is repetitively divided by 16 and remainders are collected to represent hexadecimal numbers.


Approved by Curriculum Development Centre 105 Oasis Radiant Computer Science, Book 10 Example a. Converts following into hexadecimal number: (1047)10 = (417)16 16 1047 7 16 65 1 4 = (417)16 b. Convert (333)10 into hexadecimal. 16 333 13 16 20 4 1 (333)10 = (14D)16 Where D=13 Hexadecimal to Decimal Each hexadecimal digit is multiplied by weighted positions, and sum of the product is equal to decimal value. Example a. (A 3 7 E)16 = (?)10 A = 10 E = 14 = A × 163 + 3 × 162 + 7 ×161 + E × 160 = 10x 163 +3x162 +7x161 +14X160 = 40960 + 768 + 112 + 14 = (41854)10 Binary to Hexadecimal Conversion The binary numbers are broken into sections of 4-bit digits from last bit and its hexadecimal equivalent is assigned for each section. Example a. Convert (11 10 11)2 into base 16. (11 10 11)2 = 11 1011 0011= 3 1011= 11= B = (3B) 16


Oasis Radiant Computer Science, Book 10 106 Approved by Curriculum Development Centre Note: You have to add 00 before first group to make four bits group. ( 11 to 0011) Hexadecimal to Binary Conversion Binary equivalent of each hexadecimal digit is written in the 4-bit format or section. Example Convert the following in Binary numbers: Algorithm - Convert each hexadecimal bit into equivalent binary number by making four bits group. - Arrange all bits to make hexadecimal number. a. (45AF)16 4= 100 = 0100 (Make four digit by adding 0 before the bits) 5= 101 = 0101 A=10 =1010 F=15 =1111 = (010001011010111)2 b. (23AB)16 = (0010 0011 1010 1011)2 2=0010, 3=0011, A=10= 1010, B=11= 1011 = (0010 0011 1010 1011)2 c. (ABC)16 into Binary number. A = 10=1010, B=11=1011, C=12=1100 (ABC)16 = (1010 1011 1100)2 Hexadecimal to Octal • Convert hexadecimal into binary • Make group 3 bits from last bit. • Convert each into decimal numbers. Example a. (ABC)16 to (?)8 (ABC)16 A=10= 1010 B= 11= 1011


Approved by Curriculum Development Centre 107 Oasis Radiant Computer Science, Book 10 C= 12= 1100 = (101010111100)2 Make a group of three digits from the last digit. 101 010 111 100 5 2 7 4 = (101 010 111 100)2 = (5274)8 Binary Arithmetic You have to learn addition, subtraction, multiplication and division of binary number. In brain, you have to keep that in the arithmetic of binary number, carry is written in binary (2) just like as 10 is used in decimal system for carry. Addition Subtraction Multiplication Division 0 + 0 = 0 1 + 0 = 1 0 + 1 = 1 1 + 1 = 0 and carry 1 0 - 0 = 0 1 - 0 = 1 0 - 1 = 1 and carry 1 1-1=0 0*0=0 1*0=0 0*1=0 1*1=1 0 ÷ 1=0 1÷ 0= not defined 0÷ 0=0 1÷ 1=1 Example 11 11 110 Here, 1+1 (right most) = 0 and its carry 1 is added to left columns as 1+1+1=11 Hence, 11+11=110 Example 10 01 01 Here, 0-1 (right most) =1 because we take carry 2 from left column, and left remains 0. Hence, 10-01=01 Example 1 1 1 0 0 0 1 1 x 1 1 0 Tryout: (a) 1001x11 (b) 1100x101 (c) 1111x110 (d)1010x1001 Example 11) 1 1 0(10 1 1 0 0 Try out: 111÷11 1100÷111 1001÷11 1011÷100 1111÷1011 Addition of Binary Numbers. Follow the following formulae 1 0 0 1 + 0 + 1 + 0 + 1 1 1 0 10


Oasis Radiant Computer Science, Book 10 108 Approved by Curriculum Development Centre Example 1 0 1 0 First number 1 0 0 1 Second number 1 0 0 1 1 Add following binary numbers a. 1100 +1111=11011 1 Carry 1 1 0 0 1 1 1 1 11 0 1 1 b. 110011 + 111100 + 100111 = 10010110 Carry 1 1 1 1 1 1 1 0 0 1 1 1 1 1 1 0 0 1 0 0 1 1 1 1 0 0 1 0 1 1 0 Subtraction The subtraction of binary is more interesting, but less complex for novice students, but don’t fear, jump to complement methods when confusion takes place in the traditional methods of subtraction. Example 110-11=011 The first step is to equalise digits placing zero to the left side and make columns. You take right most columns and solve 0-1. 1 1 0 0 1 1 1 Next step, come to second column from where you have to solve again 0-1.


Approved by Curriculum Development Centre 109 Oasis Radiant Computer Science, Book 10 1 1 0 0 1 1 0 1 1 Example 1000 – 11 = 0101 1 0 0 0 0 0 1 1 0 1 0 1 Example 1000–1=111 1000 –10=110 Multiplication The multiplication of binary number is also like decimal multiplication. Example 1100 x 11 = 10100 1 1 0 0 × 1 1 1 1 0 0 1 1 0 0 1 0 0 1 0 0 Division The division process is like as division of decimal numbers. a) 110 ) 1100 ( 10 – 110 00 b) 101 ) 1001 ( 1 – 101 100 c) 101 ) 11011 ( 101 – 101 111 – 101 1 0 Quotient 101 and remainder 10


Oasis Radiant Computer Science, Book 10 110 Approved by Curriculum Development Centre Points to remember • First number system is decimal number system which is developed by Hindu philosophers. • Decimal numbers are generated with the combination of 0,1,2,3,4,5,6,7,8,9. • Binary numbers are digital numbers generated with the combination of 0 and 1. • Octal numbers are eight base numbers that are generated with the combination of 0, 1,2,3,4,5,6,7. • Hexadecimal numbers are 16 base numbers and generated with the combination of 0,1,2,3,4,5,6,7,8,9,A,B,C,D,E,F where A=10, B=11, C=12, D=13, E=14,F=15. • We can convert different numbers from one form into another using simple calculations. • We can perform binary addition, subtraction, multiplication and division. Exercises 1. Answer the following questions. a. What is decimal number system? b. What is binary number system? c. Define octal number system. d. Define hexadecimal number system. e. Can you convert decimal to octal number? How can you convert it? Demonstrate with example. f. Write the rules for binary addition. g. Write the algorithm to convert octal to hexadecimal number. h. Write the rules for binary subtraction. i. Write the steps to convert from binary to hexadecimal number using an example. j. Write the steps to convert hexadecimal to octal number. 2. Differentiate between: a. Binary and Octal Numbers b. Decimal and Hexadecimal Numbers c. Octal and Binary numbers


Approved by Curriculum Development Centre 111 Oasis Radiant Computer Science, Book 10 3. State True and False a. Octal numbers are two base numbers. b. Decimal numbers are ten base numbers. c. General arithmetic uses binary numbers. d. Electronic devices use binary numbers. e. Hexadecimal number is similar to Octal number. 4. Solve the following. a. Convert following decimal into binary: i. 234 ii. 542 iii. 158 b. Change the following decimal into octal and hexadecimal number: i. 756 ii. 5164 iii. 51818 c. Convert following hexadecimal into decimal. i. 78AB ii. EFA25 iii. 9E2C iv. ABC d. Convert (333)10 into hexadecimal e. Convert the following numbers according to the given instruction i. (240)10 into octal number ii. (ABC)16 into decimal number. f. Convert (356)10 into base 8. g. Convert (520)10 into base 16. h. Convert the following octal numbers into decimal. i. 4532 ii. 6743 iii. 1234 iv. 2342 i. Convert (A5B)16 into decimal number. j. Convert the following Binary numbers into Decimal numbers. i. 101111 ii. 1101010 iii. 11111 iv. 10010100 k. Convert the following Octal numbers into Hexadecimal numbers i. 4532 ii. 6743 iii. 1234 iv. 2342 l. Convert the following Hexadecimal into Octal numbers. i. 78AB ii. EFA25 iii. 9E2C iv. ABC m. Perform the binary addition. i. 1101 +1101 ii. 1111 + 1010 iii. 10101+10101 iv. 1101 +1011 n. Perform the binary subtraction. i. 1101 - 1001 ii. 1111 – 1010 iii. 10101- 10001 iv. 1101 - 1011 o. Perform the binary multiplication. i. 1101 x 11 ii. 1111 x 110 iii. 10101 x 110 iv. 1101 x 111


Oasis Radiant Computer Science, Book 10 112 Approved by Curriculum Development Centre Chapter 7 Database and Database Management System ffl Database and Database Management System ffl Database Structure in MS Access ffl Forms and Reports ffl Working with Queries THIS CHAPTER COVERS :


Approved by Curriculum Development Centre 113 Oasis Radiant Computer Science, Book 10 Database Database and database technology are having a major impact on the growing use of computers. Database plays a critical role in almost all areas where computers are used including business, engineering, medicine, law, education, library science, etc. A database is a collection of related data. By data, we mean known facts that can be recorded and that have implicit meaning. A database has the following implicit properties: • A database represents some aspects of the real world, sometimes called mini world. Changes to the mini world are reflected in the database. • A database is a logically coherent collection of data with some inherent meanings. A random assortment of data cannot correctly be referred to as database. • A database is designed, built and populated with data for a specific purpose. It has an intended group of users and some preconceived applications in which these users are interested. In other words, a database has some sources from which data are derived, some degree of interaction with events in the real world, and audience that is actively interested in the contents of the database. A database may be generated and maintained manually or it may be computerised. Database Management System (DBMS) A database management system (DBMS) is a collection of software programmes that allow a user to define the data types, structures, and constraints for the data; construct permanent storage for the data; and manipulate data by query and update operations. In the specific case of relational databases, the database management software is known as a relational database management system (RDBMS). Database and Database 7 Management System Chapter


Oasis Radiant Computer Science, Book 10 114 Approved by Curriculum Development Centre The objective of the DBMS is to provide a convenient and effective method of defining, storing or constructing, and retrieving or manipulating database for various applications. Defining a database involves specifying the data types, structures, and constraints for the data to be stored in the database. Constructing the database is the process of storing the data itself on some storage medium that is controlled by the DBMS. Manipulating a database includes such functions as querying the database to retrieve specific data, updating the database to reflect changes in the mini world, and generating reports from the data. Advantages of Database System • It reduces the data redundancy on the file. Redundant data are repeated unnecessary data that exist on the file. So we have to reduce it to save the memory of computer. • Data stored on the DBMS are highly consistent. These are constant in nature. • It is possible to share the data using DBMS. Various users are allowed to share the data according to their needs using same data base file. • It is possible to apply the centralised security system on DBMS. A person who controls the whole database system is called DBA (Database Administrator). DBA is responsible to give security and control to the computer system. • It has very high data integrity. We can retrieve the data in complete form using DBMS. Disadvantages of Database System • High initial investment in hardware, software, and training. • Overhead for providing security, recovery, and integrity functions. • Cost for the hardware-upgrade to allow for the extensive programmes and the workspaces required for their execution and storage. • Cost for the maintenance of the software, which remains forever. • An additional cost is for migration from a traditionally separate application environment to an interpreted one. • Cost for backup and recovery. Database Basics The core component of a database is a table. Data is defined and stored in a table. Multiple tables -- each consisting of different types of data -- can be created in a database.


Approved by Curriculum Development Centre 115 Oasis Radiant Computer Science, Book 10 Database File Record Data Data type Each row in the database is called a record. The entry for Suyash Adhikary is called a record. Another entry for Suyasha Adhikary is also a record. Each row or record is made up of columns or fields -- L.Name, F.Name, Phone, Address which contain a particular piece of information. L.Name F.Name Phone Address Suyash Adhikary 9851065214 Kathmandu Suyasha Adhikary 9841877327 Lamjung RDBMS (Relational Database Management System) Special types of DBMS that use the relational model of data arrangement is called RDBMS. It has the tabular data structure. It is easy to show the relationship between the tables to construct the database application. There are some technical words used in a relational database. These are: Domain. A world of real world data is called domain. It is a data pool from which data is entered into table for database management. Tuple. The row or record of table is called tuple. Example The following database has only two tuples. Item No Item Date Item Name Unit Price Qty AA0021 18-08-03 Mouse 60.00 25 CC0033 21-08-03 Keyboard 430.50 5 Attribute. The column of table is called attribute. For instance, the sale is an entity and its attributes are ItemNo, ItemDate, ItemName, UnitPrice, and Qty.


Oasis Radiant Computer Science, Book 10 116 Approved by Curriculum Development Centre Terms Used in Database System Data It is defined as raw facts like Rollno - 20, Name - Suyash, Address – Kathmandu etc. In other words data is a small unit of information. Record or Information Collection of interrelated data processed into some informative form is called information. It is a record that gives complete information. For example, in the above case, three data points, Rollno, Name and Address, give a piece of information, but if processed systematically and arranged, the information is about Suyash whose rollno is one and his address is Kathmandu. Database File It is the collection of record having same record format. For example, if we have collected the records of twenty students as given above, it will be a database file. So sometimes it is known as the bank of information or records. Data Type Every table contains a number of columns called fields or data types. Fields are unique pieces of information that make up the information in a table. Tables usually contain multiple fields. Major fields used on database are: 1. Text Field: It is used to store characters, numbers, special characters, etc. Arithmetic operations cannot be performed on the text data type field. These fields are used to store names of persons, addresses, telephone numbers, etc. The maximum size of a text field is 255 characters. The default setting is 50 characters. 2. Numeric Field: It is used to store numeric data. Arithmetic operations can be performed on these data type fields. Numeric data fields can store the whole numbers and real or floating numbers. For example, to store an amount or a student’s subject marks, this numeric data type field is used. 3. Date & Time Field: It is used to store date or time entries. This type of field converts the value of date or time into numeric value. It is because the arithmetic calculations can be performed on this data type field. For example, to store the date of birth, date of joining of an employee, etc. the data type of field is declared as date & time.


Approved by Curriculum Development Centre 117 Oasis Radiant Computer Science, Book 10 4. Memo Field: It is like a text field but it is used to store a large amount of text. For example, comments or descriptions are stored in this type of field. 5. Hyper Link: It is used to store the hyper links or links of the web page. For example, “http://www.atlantic.edu.np” is a web page address. 6. Object Field: It is used to store the picture, audio, video or a document created in another application programme. 7. Logical Field: It is used to store true/yes or false/no value. For example, in a student table, the result field is defined to store value “True” if a student has passed and value “False” if the student has failed. Data Type Storage Size a. Text : 0 – 255 characters (Short, alphanumeric values) b. Number: 1 ,2 , 4 or 8 bytes c. Currency: 8 bytes d. AutoNumber: 4 bytes e. Date/Time: 8 bytes f. Yes/No: 1 bit -0 or 1(Yes/No , True/False , On/ False) g. Memo: 0 – 65,535 characters h. OLE Object: Maximum 1 GB (Object Linking and Embedding) i. Hyperlink Up to 2048 characters j. Look Up Wizard: 4 bytes Field Properties In a previous example, we mentioned that a table might consist of the fields: Last Name, First Name, Phone, Address etc. Each field has unique properties. Some contain characters. Others contain numbers. These Field Properties are defined when the table is created. The properties that are available for each field are determined by the data type that you select for the field. The following table lists the available field properties in an Access database. If a certain property does not appear in the property sheet for a field, the property is not available for the data type of that field.


Oasis Radiant Computer Science, Book 10 118 Approved by Curriculum Development Centre Field Property Description Field Size You can use the Field Size property to set the maximum size for data that is stored in a field that is set to the Text data type, the Number data type, or the AutoNumber data type. Format You can use the Format property to customise the way that numbers, dates, times, and texts appear and print. The Format property only controls how the information in the field appears. The property does not store the information as formatted. Input Mask You can use the Input Mask property to make data entry easier and to control the values that users can enter in a Text Box control. Caption You can use the Caption property to provide helpful information to the user through captions on objects in various views: Field captions specify the text for labels that are attached to controls. You can create the field caption by moving the field from the field list. The field caption acts as the column heading for the field in a table or in a query in Datasheet view. Form captions specify the text that appears in the title bar in Form view. Button captions and label captions specify the text that appears in the control.


Approved by Curriculum Development Centre 119 Oasis Radiant Computer Science, Book 10 Default Value You can specify a value for a field that is automatically entered in the field when a new record is created. For example, in an Addresses table, you can set the default value for the City field to New York. When you add a record to the table, you can either accept this value or you can enter the name of a different city. V a l i d a t i o n Rule You can use the Validation Rule property to specify requirements for data that are entered in a record, in a field, or in a control. When data is entered that violates the Validation Rule setting, you can use the Validation Text property to specify the message that you want to appear when the violation occurs. V a l i d a t i o n Text You can specify a message that must appear when a validation rule is violated. Required You can use the Required property to specify if a value is required in a field. If this property is set to Yes, when you enter data in a record, you must enter a value in the field or in any control that is bound to the field, and the value cannot be Null. For example, you may want to make sure that a LastName control has a value for each record. When you want to permit Null values in a field, you must not only set the Required property to No, but if there is a Validation Rule property setting, that setting must also explicitly state validationrule or Is Null. Allow Zero Length You can use the AllowZeroLength property to specify if a zerolength string (““) is a valid entry in a table field. Indexed You can use the Indexed property to set a single-field index. An index speeds up queries on the indexed fields. An index also speeds up sorting operations and grouping operations on the indexed fields. For example, if you search for specific employee names in a LastName field, you can create an index for this field to speed up the search for a specific name.


Oasis Radiant Computer Science, Book 10 120 Approved by Curriculum Development Centre Unicode Compression Microsoft Access 2000 and later use the Unicode characterencoding scheme to represent the data in a Text field, in a Memo field, or in a Hyperlink field. Unicode represents each character as two bytes. Therefore, the data that is in a Text field, in a Memo field, or in a Hyperlink field requires more storage space than is required in Microsoft Access 97 and earlier. To offset the effect of Unicode character representation and to make sure performance is optimised, the default value of the Unicode Compression property for a Text field, a Memo field, or a Hyperlink field is set to Yes. When the Unicode Compression property for a field is set to Yes, any character whose first byte is 0 is compressed when it is stored and then uncompressed when it is retrieved. Because the first byte of a Latin characters (a character of a Western European language such as English, Spanish, or German) is 0, Unicode character representation does not affect how much storage space is required for compressed data that consists completely of Latin characters. Smart Tags In Access, you can use the Smart Tags property to add the available smart tags to the field. If you add smart tags to a field, each value that is specified for the field is analysed. If the value is recognised as one of the specified smart tags, you can perform various actions as defined by the smart tag for the value of the field. Decimal Places You can use the Decimal Places property to specify the number of decimal places to display numbers. New Values You can use the New Values property to specify how AutoNumber fields increment when new records are added to a table. Only AutoNumber fields can use the New Values property. Primary Keys Every table in Microsoft Access must have at least one field that uniquely identifies each record in the table. This field is known as the primary key.


Approved by Curriculum Development Centre 121 Oasis Radiant Computer Science, Book 10 This primary key essentially opens the door to the table and allows you to retrieve information from the table. The primary key is the mechanism by which you relate different tables and combine information for viewing (query) or printing (report). Uses of Primary Key Primary keys may consist of a single attribute or multiple attributes in combination. Primary key is used: • To uniquely identify a record, as every primary key value must be unique. • To ensure every record has a key, as a primary key cannot be left blank. • To be used in creating relationships. • For sorting and searching records. Types of Relationships Databases can be simple -- consisting of a single table -- or made up of many different tables. If you were to convert your resume into a database, for example, you might have a table that contains your name and personal mailing address. We might call this the Contact_Information table. Your work experience is a different kind of information. Instead of identifying who you are or where you live, it identifies the companies you worked for, their addresses, your job title, and responsibilities. Because this set of information is independent from the contact information, we might instead create a second table called the Work_Experience table. The same is true of your educational background. It has no direct bearing on your contact information or the companies where you worked. A third table might be created called the Education table to save this kind of data. The database contains three tables, each independent of the other, and all containing different types of information. The database needs a way to connect these three tables. So we need a relationship between these three tables so that we can work with them like a single table to design database structure. Basically we have three types of relationships. These are: • One-to-one relationship


Oasis Radiant Computer Science, Book 10 122 Approved by Curriculum Development Centre • One-to-many relationship • Many-to-many relationship One-to-One Relationship In a one-to-one relationship, two tables are associated in such a way that each record in the first table can have only one matching record in the second table, and each record in the second table can have only one matching record in the first table. Consider the relationship between countries and their capitals given below. Nepal India Pakistan Kathmandu New Delhi Islamabad One-to-Many Relationship In a one-to-many relationship, two tables are associated in such a way that each record in the first table can have many matching records in the second table, but a record in the second table has only one matching record in the first table. Roll_no Name City 1 Suyasha Adhikary Kathmandu Student Table Roll_no Phone_no 1 01-2084112 1 9851065213 Student Phone Table For example, the Student Table has unique records and each Roll_no in Student Table may have more than one phone number in Student Phone Table, on the other hand when you look at records in Student Phone Table, each record in it has only one matching record in the Student Table. Many-to-Many Relationship In a many-to-many relationship, two tables are associated in such a way that each record in the first table can have many matching records in the second table, and a record in the second table can have many matching records in the first table. 01-2084112 9851065213 9841877325 Suyasha Suyash


Approved by Curriculum Development Centre 123 Oasis Radiant Computer Science, Book 10 The relationship between two entities is shown above. In the above relationship, each record on the left side has two records on the right side. Similarly, each record on the right side has two related records on the left side. Referential Integrity Referential integrity ensures that the relationships between records in related tables remain consistent. For example; if the Student Table and Student Phone Table are related then every record in Student Phone Table has a corresponding record in the Student Table. The database management system will not allow you to delete a record from the Student Table if there are phone numbers related to that student in the Student Phone Table. So the relationship between these two tables remains consistent. Launching Microsoft Access from the Windows Desktop Microsoft Access is launched from the Windows desktop in a manner similar to that used to launch Microsoft Word, Excel, or PowerPoint. You can launch Microsoft Access either from the desktop shortcut or from the Start menu. Features of Microsoft Access • It provides very useful database features such as tables, forms, reports and queries. • It works as a front-end development tool. • This provides end-user applications developer environment. • It shares data with other applicationd such as Microsoft Word or Excel. • It supports three computer programming languages such as: SQL, Macros and Visual BASIC etc.


Oasis Radiant Computer Science, Book 10 124 Approved by Curriculum Development Centre Microsoft Access 2010 We can start the MS Access by using the following steps: Step (1): Click Start button. Step (2): Click All Programs option from the menu. Step (3): Search for Microsoft Office from the sub menu and click it.


Approved by Curriculum Development Centre 125 Oasis Radiant Computer Science, Book 10 Step (4): Search for Microsoft Access 2010 from the submenu and click it. We will enter the systen of MSAcces. - Select the Blank Database and choose OK. We will get the design system of Microsoft Access 2010. Working with Your Access Environment The Ribbon and Quick Access toolbar are where you will find the commands you will use to perform common tasks in Access. If you are familiar with Access 2007, you will find that the main difference in the Access 2010 Ribbon is that commands such as Open and Print are now housed in Backstage view.


Oasis Radiant Computer Science, Book 10 126 Approved by Curriculum Development Centre The Ribbon The Ribbon contains multiple tabs, each with several groups of commands. Some tabs, like Form Layout Tools and Table Tools, may appear only when you are working with certain objects like forms and tables. These tabs are called contextual tabs, and they are highlighted in a contrasting colour to distinguish them from normal tabs. To minimise and maximise the Ribbon: The Ribbon is designed to be easy to use and responsive to your current task; however, if you feel that it’s taking up too much of your screen space you can minimise it. 1. Click the arrow in the upperright corner of the Ribbon to minimise it. 2. To maximise the Ribbon, click the arrow again. When the Ribbon is minimised, you can make it reappear by clicking a tab. However, the Ribbon will disappear again when you are not using it. The Quick Access toolbar The Quick Access toolbar is located above the Ribbon, and it lets you access common commands no matter which tab you are on. By default, it shows the Save, Undo, and Repeat commands. If you’d like, you can customise it by adding


Approved by Curriculum Development Centre 127 Oasis Radiant Computer Science, Book 10 additional commands. Note that the Save command only saves the current open object. In addition, the Undo command will not undo certain actions, like adding a record. Pay close attention to your information when using the Undo command to make sure it has the desired effect. Backstage view Backstage view gives you various options for opening, saving, printing, and viewing more information about your database. It is similar to the Office Button Menu from Access 2007 and the File Menu from earlier versions of Access. However, unlike these menus, it is a fullpage view, which makes it easier to work with. To get to Backstage view: 1. Click the File tab. 2. You can choose an option on the left side of the page. 3. To get back to your database objects, click any tab on the Ribbon. Click the buttons in the interactive section to learn about the different things you can do in Backstage view.


Oasis Radiant Computer Science, Book 10 128 Approved by Curriculum Development Centre The Navigation pane The Navigation pane is a list containing every object in your database. For easier viewing, the objects are organised into groups by type. You can open, rename, and delete objects using the Navigation pane. To Minimise and Maximise the Navigation Pane: The Navigation pane is designed to help you manage all of your objects, but if you feel that it takes up too much of your screen space you can minimise it. 1. Click the double arrow in the upper-right corner of the Navigation pane to minimise it. 2. To make the Navigation pane visible again, click the double arrow to maximise it. If you would like to make the Navigation pane smaller without fully minimising it, you can resize it. Simply click and drag the right border of the Navigation pane. When it is the desired size, release your mouse. To sort objects in the Navigation pane: By default, your objects are sorted by type, with the tables in one group, the forms in another, and so on. However, if you want you can sort the objects in the Navigation pane into groups of your choosing. 1. Click the drop-down arrow to the right of the words All Access Objects.


Approved by Curriculum Development Centre 129 Oasis Radiant Computer Science, Book 10 2. In the drop-down menu, select the desired sort. Select Custom to create a custom group for sorting the objects. After applying the sort, drag the desired objects to the new group. Select Object Type to group the objects by type. This is the default setting. Select Tables and Related Views to group forms, queries, and reports together with the tables they refer to. Select Created Date or Modified Date to sort the objects from most to least recently created or modified. 3. The objects in the Navigation pane will now be sorted to reflect your choice. To further customise the appearance of the Navigation pane, you can minimise groups of objects you don’t want to see. Simply click the upward double arrow next to the name of the group. To restore the group to its full size, click the downward double arrow. Databases with navigation forms Some databases include a navigation form that opens automatically when the database is opened. Navigation forms are designed to be a user-friendly replacement for the Navigation pane. They contain tabs that allow you to view and work with common forms, queries, and reports. Having your frequently used objects available to you in one place lets you access them quickly and easily. To open an object from a navigation form, simply click its tab. The object will be displayed within the navigation form. Once an object is open, you can work with it as you normally would. Generally, navigation forms include only the objects a typical user will need to work with fairly regularly, which is why your navigation form may not include every single form, query, or report. This makes it easier to navigate the database. By hiding tables and rarely used forms, queries, and reports, it also reduces the chance of the database being damaged by users accidentally editing or deleting necessary data.


Oasis Radiant Computer Science, Book 10 130 Approved by Curriculum Development Centre For this reason, it’s important to ask your database designer or administrator before you work with objects that are not available in your navigation form. Once you have the go-ahead, you can simply maximise the Navigation pane and open the objects from there. Managing Databases and Objects Each Access database consists of multiple objects that let you interact with data. Databases can include forms for entering data, queries for searching within it, reports for analysing it, and tables for storing it. Whenever you work with your database, you are working with many of these objects at once. Fortunately, Access makes managing these objects pretty easy. Objects of MSACCESS Tables By this point, you should already understand that a database is a collection of data organised into many connected lists. In Access, all data is stored in tables, which puts tables at the heart of any database. You might already know that tables are organised into vertical columns and horizontal rows. In Access, rows and columns are referred to as records and fields. A field is more than just a column; it’s a way of organising information by the type of data it is. Every piece of information within a field is of the same type. For example, every entry in a field called First Name would be a name, and every entry in field called Address would be an address.


Approved by Curriculum Development Centre 131 Oasis Radiant Computer Science, Book 10 Likewise, a record is more than just a row; it’s a unit of information. Every cell in a given row is part of that row’s record. Notice how each record spans several fields. Even though the information in each record is organised into fields, it belongs with the other information in that record. See the number at the left of each row? That’s the ID number that identifies each record. The ID number for a record refers to every piece of information contained in that row. Tables are good for storing closely related information. Let’s say you own a bakery and have a database that includes a table with your customers’ names and information—their phone numbers, home addresses, and email addresses. Because these pieces of information are all details about your customers, you’d include them in the same table. Each customer would be represented by a unique record, and each type of information about customers would be stored in its own field. If you decided to add any more information—say, a customer’s birthday— you would simply create a new field within the same table. Forms Forms are used for entering, modifying, and viewing records. You probably have had to fill out forms on many occasions, like when visiting a doctor’s office, or registering for school. The reason forms are used so often is that they’re an easy way to guide people into entering data correctly. When you enter information into a form in Access, the data goes exactly where the database designer wants it to go: into one or more related tables. Forms make entering data easier. Working with extensive tables can be confusing, and when you have connected tables you might need to work with more than one at a time to enter a set of data. However, with forms it’s possible to enter data into multiple tables at once, all in one place. Database designers can even set restrictions on individual form components to ensure all of the needed data is entered in the correct format. All in all, forms help keep data consistent and organised, which is essential for an accurate and powerful database.


Oasis Radiant Computer Science, Book 10 132 Approved by Curriculum Development Centre Queries Queries are a way of searching for and compiling data from one or more tables. Running a query is like asking a detailed question of your database. When you build a query in Access, you are defining specific search conditions to find exactly the data you want. Queries are far more powerful than the simple searches you might carry out within a table. While a search would be able to help you find the name of one customer at your business, you could run a query to find the name and phone number of every customer who’s made a purchase within the past week. A well-designed query can give information you might not be able to find out just by looking through the data in your tables. Reports Reports offer you the ability to present your data in print. If you’ve ever received a computer printout of a class schedule or a printed invoice of a purchase, you’ve seen a database report. Reports are useful because they allow you to present components of your database in an easy-to-read format. You can even customise a report’s appearance to make it visually appealing. Access offers you the ability to create a report from any table or query.


Approved by Curriculum Development Centre 133 Oasis Radiant Computer Science, Book 10 Putting it all together Even if you have a good idea of how each object can be used, it can initially be difficult to understand how they all work together. It helps to remember that they all work with the same data. Every piece of data a query, form, or report uses is stored in one of your database tables. Forms allow you to both add data to tables and view data that already exists. Reports present data from tables and also from queries, which then search for and analyse data within these same tables. These relationships sound complicated, but in fact they work together so well and so naturally that we often don’t even notice when we’re using connected database objects. Have you ever used an electronic card catalog to search for a book at the library? Chances are, you entered your search into something that looks like this: Opening and closing databases Before you enter data or otherwise modify your objects, you will have to open your database. After you’ve made changes to your database, you’ll need to know how to close it.


Oasis Radiant Computer Science, Book 10 134 Approved by Curriculum Development Centre To open an existing database: 1. Click the File tab. This takes you to Backstage view. 2. Select Open. A dialogue box will appear. 3. Locate and select the desired database, then click Open. 4. One or more warning messages may appear when you open your database. If the database contains customised functions, a yellow bar with a security warning may appear below the Ribbon. If you trust the source of your database, click Enable Content for your database to display correctly. After enabling all content in the database, you may see a message asking if you want to make the database a Trusted Document. Click Yes if you would like all content to be automatically enabled each time you open the database. You may be prompted to log in to the database. Select your name from the list. If your name does not appear, click New User to enter your information.


Approved by Curriculum Development Centre 135 Oasis Radiant Computer Science, Book 10 If you have opened the existing database recently, it may be easier to look for your database in the short list that appears in the sidebar or to select Recent and choose a database from the list that appears. To close a database: 1. Click the File tab to go to Backstage View. 2. Select Close Database. 3. If you have any unsaved objects, a dialogue box will pop up for each one asking if you want to save it. Select Yes to save the object, No to close it without saving, or Cancel to leave your database open.


Oasis Radiant Computer Science, Book 10 136 Approved by Curriculum Development Centre Working with objects It’s helpful to think of your database as a large binder or folder in which you store your data. The data itself is contained in database objects. Access 2010 treats each of these objects as separate documents, which means you will have to open and save them individually in order to work with them. You may have noticed that this lesson contains no instructions for saving a database. This is because you cannot save an entire database at once. Rather, you must individually save the objects contained within the database. To open an object: 1. In the Navigation pane, locate the object you want to open. 2. Double-click the desired object. It will open and appear as a tab in the Document Tabs bar. By default, the most recently opened object will display in the main window as the current object. To view another open object, click its tab in the Document Tabs bar.


Approved by Curriculum Development Centre 137 Oasis Radiant Computer Science, Book 10 Saving objects As in other Microsoft Office programmes, you will be prompted to save any unsaved work when you attempt to close your database. However, it is a good idea to save your work as you go along. Saving your work often is the best way to ensure you don’t lose any information if your computer crashes. To save a new object: 1. Select the object you want to save by clicking its tab in the Document Tabs bar. 2. Select the File tab to navigate to Backstage View. 3. Click Save. 4. The first time you save an object, you will be prompted to name it. Enter the desired object name, then click OK. To save an existing object, select save in Backstage View, or simply click the Save command in the Quick Access toolbar.


Oasis Radiant Computer Science, Book 10 138 Approved by Curriculum Development Centre To close an object: 1. Select the object you want to close on the Document Tabs bar. 2. Click the on the far right of the Document Tabs bar. 3. If there are any unsaved changes to the object, you will be prompted to save it. Select Yes to save, No to close it without saving your changes, or Cancel to leave the object open. You can also close an object by right-clicking its tab on the Document Tabs bar. A drop-down menu will appear. Select Close to close that object, or Close All to close all open objects. To rename an object: 1. If the object you want to rename is open, close it. 2. In the Navigation pane, right-click the object you want to rename. 3. Select Rename. 4. Type the new name, then press Enter.


Approved by Curriculum Development Centre 139 Oasis Radiant Computer Science, Book 10 Table basics To open an existing table: 1. Open your database, and locate the Navigation pane. 2. In the Navigation pane, locate the table you want to open. Tables are marked with the icon. 3. Double-click the name of the table. It will open and appear as a tab in the Document Tabs bar. Understanding tables All tables are composed of horizontal rows and vertical columns, with small rectangles called cells in the places where rows and columns intersect. In Access, rows and columns are referred to as records and fields.


Oasis Radiant Computer Science, Book 10 140 Approved by Curriculum Development Centre A field is a way of organising information by type. Think of the field name as a question, and every cell within that field as a response to that question. A record is one unit of information. Every cell on a given row is part of that row’s record. Each record has its own ID number. Within a table, each ID number is unique to its record and refers to all of the information within that record. The ID number for a record cannot be changed. Each cell of data in your table is part of both a field and a record. For instance, if you had a table of names and contact information, each person would be represented by a record, and each piece of information about each person— name, phone number, address, and so on—would be contained within a distinct field on that record’s row. Create Table Table is a structure of the database file where we can declare the fields name, types of fields, and its attributes to store the data. So before designing the database file we have to design the table. We can create the table by using the following steps: ● Start MS Access 2010


Approved by Curriculum Development Centre 141 Oasis Radiant Computer Science, Book 10 ● Start the new database file and select Blank Database ● Now we will enter to the design window of MSAccess. Now select the table from the create menu. Now design the table by declaring the field name and its data types. ● Now we are going to design the database file for the address collection using given fields and data types.


Oasis Radiant Computer Science, Book 10 142 Approved by Curriculum Development Centre ● Now type the field Name and data type. ● After designing the table save the table. Open the table to enter the record on the table as given in the following figure. Navigating within tables To navigate records in a table, you can use the up and down arrow keys, scroll up and down, or use the arrows in the record navigation bar located at the bottom of your table. You can also find any record in the currently open table by searching for it using the record search box. Simply place your cursor in the search box, type any word that appears in the record


Approved by Curriculum Development Centre 143 Oasis Radiant Computer Science, Book 10 you want to find, and press Enter. To view additional records that match your search, press Enter again. To navigate between fields, you can use the left and right arrow keys or scroll left and right. Adding records and entering data Entering data into tables in Access is similar to entering data in Excel. To work with records, you’ll have to enter data into cells. If you need help entering data into records, you may want to review our Cell Basics lesson from our Excel 2010 tutorial. To add a new record: There are three ways to add a new record to a table: • In the Records group on the Home tab, click the New command. • On the Record Navigation bar at the bottom of the window, click the New Record button. • Simply begin typing in the row below your last added record. Occasionally when you enter information into a record, a window will pop up to tell you the information you’ve entered is invalid. This means the field you’re working with has a validation rule, which is a rule about the type of data that can appear in that field. Click OK, then follow the instructions in the pop-up window to reenter your data. To save a record: 1. Select the Home tab, and locate the Records group. 2. Click the Save command. Be sure to save any unsaved records before closing a table. Access will not prompt you to save them when you close the table.


Oasis Radiant Computer Science, Book 10 144 Approved by Curriculum Development Centre Editing records To quickly edit any record within a table, simply click it and type your changes. However, Access also offers you the ability to find and replace a word within multiple records, as well as to delete records entirely. To replace a word within a record: You can edit multiple occurrences of the same word by using Find and Replace, which searches for a term and replaces it with another term. 1. Select the Home tab, and locate the Find group. 2. Select the Replace command. The Find and Replace dialogue box will appear. 3. Click the Find What: box, and type the word you want to find. 4. Click the Replace With: box, and type the word you want to replace the original word. 5. Click the Look In: drop-down arrow to select the area you want to search. Select Current Field to limit your search to the currently selected field. Select Current Document to search the entire table. 6. Click the Match: drop-down arrow to select how closely you’d like results to match your search. Select Any Part of Field to search


Approved by Curriculum Development Centre 145 Oasis Radiant Computer Science, Book 10 for your search term in any part of a cell. Select Whole Field to search only for cells that match your search term exactly. Select Beginning of Field to search only for cells that start with your search term. 7. Click Find Next to find the next occurrence of your search term. 8. Click Replace to replace the original word with the new one. While you can use Replace All to replace every instance of a term, replacing them one at a time allows you to be absolutely certain you edit only the data you want. Replacing data unintentionally can have a negative impact on your database. To delete a record: 1. Select the entire record by clicking the gray border at the left side of the record.


Oasis Radiant Computer Science, Book 10 146 Approved by Curriculum Development Centre 2. Select the Home tab, and locate the Records group. 3. Click the Delete command. The record will be permanently deleted. The ID numbers assigned to records stay the same even after you delete a record. For example, if you delete the 34th record in a table, the sequence of record ID numbers will read ...32, 33, 35, 36... rather than ...32, 33, 34, 35, 36... Modifying table appearance Access 2010 offers several ways to modify the appearance of tables. These changes aren’t just about making your table look nice; they can make the table easier to read too. Resizing fields and rows If your fields and rows are too small or large for the data contained within them, you can always resize them so all of the text is displayed. To resize a field: 1. Place your cursor over the right gridline in the field title. Your mouse will become a double arrow . 2. Click and drag the gridline to the right to increase the field width or to the left to decrease the field width. 3. Release the mouse. The field width will be changed.


Approved by Curriculum Development Centre 147 Oasis Radiant Computer Science, Book 10 To resize a row: 1. Place your cursor over the bottom gridline in the gray area to the left of the row. Your mouse will become a double arrow . 2. Click and drag the gridline downward to increase the row height or upward to decrease the row height. 3. Release the mouse. The row height will be changed. Hiding fields If you have a field you don’t plan on editing or don’t want other people to edit, you can hide it. A hidden field is invisible but is still part of your database. Data within a hidden field can still be accessed from forms, queries, reports, and any related tables. To hide a field: 1. Right-click the field title. 2. From the drop-down menu, select Hide Fields. 3. The field will be hidden. If you decide you would like the field to be visible again, you can unhide it. Simply right-click any field title, then select Unhide Fields. In the dialogue box, click the check boxes of any fields you would like to be visible again, then click Close.


Oasis Radiant Computer Science, Book 10 148 Approved by Curriculum Development Centre To add a new field to an existing table: 1. Open the table, then click the header with the text Click to Add. If you already have several fields, you may have to scroll all the way to the right to see this. 2. A drop-down menu will appear. Select the data type you’d like for the new field. o Text: This is the default option, and best for text. You should also choose it for numbers you don’t plan to do math with, like postal codes and phone numbers. o Number: This is best for numbers you might want to do calculations with, like quantities of an item ordered or sold. o Currency: This automatically formats numbers in the currency used in your region. o Date & Time: This allows you to choose a date from a pop-out calendar. o Yes/No: This inserts a check box into your field. o Memo: This is ideal for large amounts of text, like product descriptions. You can format text entered in memo fields. o Attachment: This allows you to attach files, like images. o Hyperlink: This creates a link out of a website or email addresses. 3. Type a name for your field, then press Enter.


Approved by Curriculum Development Centre 149 Oasis Radiant Computer Science, Book 10 To change the data type for existing fields: 1. Select the field whose data type you want to change. 2. On the Ribbon, select the Fields tab, then locate the Formatting group. Click the Data Type drop-down arrow. 3. Select the desired data type. 4. The field data type will be changed. Depending on the data type you chose, you may notice changes to your information. For instance, because we set the data type for the Email field to Hyperlink, all of the email addresses in the field are now clickable links. You shouldn’t change field data type unless you are certain your field data is in the correct format for the new data type. Changing a field containing only text to the Number type, for instance, will delete all of your field data. This process is often irreversible. Field character limits Setting the character limit for a field sets a rule about how many characters— letters, numbers, punctuation, and even spaces—can be entered into that field. This can be useful to keep the data in your records concise or to force users to enter data a certain way. For instance, in the example below, the user is entering records that include addresses. If you set the character limit in the state field as 2, the user can only enter 2 characters of information. Note that you can only set a character limit for fields defined as text.


Oasis Radiant Computer Science, Book 10 150 Approved by Curriculum Development Centre To set a character limit for a field: 1. Select the desired field. 2. Click the Fields tab in the Table Tools tab group, then locate the Properties group. 3. In the box next to Field Size, type the maximum number of characters you want to allow in your field. 4. Save your table. Validation rules A validation rule is a rule that dictates what information can be entered into a field. When a validation rule is in place, it is impossible for a user to enter data that violates the rule. For example, if we were asking users to input a state name into a table with contact information, we might create a rule that limits the valid responses to U.S. state postal codes. This would prevent users from typing something that wasn’t actually a real state postal code. In the example below, we will apply this rule to our Customers table. It’s a fairly simple validation rule—we’ll just name all of the valid responses a user could enter, which will mean users can’t type anything else into the record. However, it’s possible to create validation rules that are much more complex. To create a validation rule: 1. Select the field where you want to add a validation rule. For our example, we’ll set a rule for the State field. 2. On the Ribbon, select the Fields tab, then locate the Field Validation group. Click the Validation drop-down command, then select Field Validation Rule. 3. The Expression Builder dialogue box will appear. Click the text box, and type in your validation rule. In our example, we want to limit data in the State field to actual state postal


Click to View FlipBook Version