You are on page 1of 57

BCA103 - Computer Fundamentals What is Software?

Computer software, or just software is a general term used to describe a collection of computer programs, procedures and documentation that perform some tasks on a computer system. What is Hardware? Hardware is a general term that refers to the physical artifacts of a technology. It may also mean the physical components of a computer system, in the form of computer hardware. A cultural artifact is a human-made object which gives information about the culture of its creator and users. The artifact may change over time in what it represents, how it appears and how and why it is used as the culture changes over time. Department of BCA Session: July 2008 Nov 2008 1/57

BCA103 - Computer Fundamentals What is Application Software? Application software is a subclass of computer software that employs the capabilities of a computer directly and thoroughly to a task that the user wishes to perform. What is System Software? System software is any computer software which manages and controls computer hardware so that application software can perform a task What is Middleware? Middleware is the enabling technology of enterprise application integration. It describes a piece of software that connects two or more software applications, allowing them to exchange data. Department of BCA Session: July 2008 Nov 2008 2/57

BCA103 - Computer Fundamentals An electrical bulb is an application software. Electric power generation plant is a system software. System software which is involved in integrating a computer's various capabilities, but typically does not directly apply them in the performance of tasks that benefit the user.

What is computer programme? A sequence of instructions written in a language that can be understood by the computer is called a computer programme. The software development is continuous process, where as hardware is a one time investment.

Department of BCA

Session: July 2008 Nov 2008

3/57

BCA103 - Computer Fundamentals Relationship between hardware to users.

Hardware System Software

Application Software
Users Examples of Application Software Word Processing, Spreadsheets,

Database Management Software


Graphics, multimedia, presentation software Department of BCA Session: July 2008 Nov 2008 4/57

BCA103 - Computer Fundamentals Service or Utility Software File defragementation, Data compression Backup software, data recovery software Antivirus utility, screen savers. System Software Translators

Compilers, Assemblers, Interpreters


Operating system. Operating system carries out variety of functions Scheduling and loading, Resource management (memory,devices), Handling errors, CPU time management, Memory Management, communication with users. Department of BCA Session: July 2008 Nov 2008 5/57

BCA103 - Computer Fundamentals Types of Operating Systems Batch Processing - is known as serial, sequential, off line or stacked job processing. - Reduces the idle time of a computer system because transition from one job to another does not require operator intervention. It allows sharing of computer resources among many users and programs, - Does not allows the priority scheduling. Batch processing has been associated with mainframe computers since the earliest days of electronic computing in 1950s

Batch processing has grown beyond its mainframe origins, and is now frequently used in UNIX environments and Microsoft Windows too.
Department of BCA Session: July 2008 Nov 2008 6/57

BCA103 - Computer Fundamentals Types of Operating Systems Multi-Tasking In the case of a computer with a single CPU, only one task is said to be running at any point in time, meaning that the CPU is actively executing instructions for that task. Multitasking solves the problem by scheduling which task may be the one running at any given time, and when another waiting task gets a turn. The act of reassigning a CPU from one task to another one is called a context switch. Even on computers with more than one CPU, multitasking allows many more tasks to be run than there are CPUs. Department of BCA Session: July 2008 Nov 2008 7/57

BCA103 - Computer Fundamentals Types of Operating Systems Multi-Processing - Two or more independent processors are linked together in a coordinated system and instructions from different and independent programs can be processed at the same instant in time by the processors. - Many complex operations can be performed at the same time. - CPU can function on complementary units to provide data and control for one another.

- Is used for major control applications such as railroad control or airlines management.

Department of BCA

Session: July 2008 Nov 2008

8/57

BCA103 - Computer Fundamentals Types of Operating Systems Multi Programming - Is executing two or more different and independent programs by the same computer.

- Permits more than one job to utilize the CPU time at any moment using scheduling technique.
- The OS picks up any of the programs as scheduled and starts execution. Multiprogramming doesn't give any guarantee that a program will run in a timely manner. Indeed, the very first program may very well run for hours without needing access to a peripheral

- Is optimize the resource utilization of a computer system and supports multiple users.
Department of BCA Session: July 2008 Nov 2008 9/57

BCA103 - Computer Fundamentals Types of Operating Systems Multi-Threading As multitasking greatly improved the throughput of computers, programmers started to implement applications as sets of cooperating processes (e.g. one process gathering input data, one process processing input data, one process writing out results on disk.)

Threads were born from the idea that the most efficient way for cooperating processes to exchange data would be to share their entire memory space Thus, threads are basically processes that run in the same memory context. Threads are described as lightweight because switching between threads does not involve changing the memory context.
Department of BCA Session: July 2008 Nov 2008 10/57

BCA103 - Computer Fundamentals Types of Operating Systems Multi-Threading While threads are scheduled preemptively, some operating systems provide a variant to threads, named fibers, that are scheduled cooperatively Fibers are even more lightweight than threads Parallel processing The simultaneous use of more than one CPU to execute a program. Ideally, parallel processing makes a program run faster because there are more engines (CPUs) running it.

separate CPUs can execute different portions without interfering with each other.

Department of BCA

Session: July 2008 Nov 2008

11/57

BCA103 - Computer Fundamentals Types of Operating Systems Online processing It is a system that operates in an interactive mode with quick response time. On line processing systems perform random and rapid input of transactions and provide immediate access to the records. Real time processing operational deadlines from event to system response By contrast, a non-real-time system is one for which there is no deadline, even if fast response or high performance is desired or even preferred The anti-lock brakes on a car are a simple example of a real-time computing system Department of BCA Session: July 2008 Nov 2008 12/57

BCA103 - Computer Fundamentals

Department of BCA

Session: July 2008 Nov 2008

13/57

BCA103 - Computer Fundamentals Virus and Anti-virus Virus A computer virus is a computer program that can copy itself and infect a computer without permission or knowledge of the user. The original virus may modify the copies, or the copies may modify themselves A virus can only spread from one computer to another when its host is taken to the uninfected computer Viruses are sometimes confused with computer worms and Trojan horses

A computer worm is a self-replicating computer program.

Department of BCA

Session: July 2008 Nov 2008

14/57

BCA103 - Computer Fundamentals Virus and Anti-virus Virus Worms almost always cause harm to the network, if only by consuming bandwidth, whereas viruses almost always corrupt or modify files on a targeted computer. Bandwidth (computing): a rate of data transfer, or bit rate, measured in bits per second a Trojan horse, also known as a trojan, is malware that appears to perform a desirable function but in fact performs undisclosed malicious functions. Therefore, a computer worm or virus may be a Trojan horse.

In general, a worm does not actually harm either the system's hardware or software.
Department of BCA Session: July 2008 Nov 2008 15/57

BCA103 - Computer Fundamentals Virus and Anti-virus Non-residents Virus Nonresident viruses can be thought of as consisting of a finder module and a replication module. The finder module is responsible for finding new files to infect. For each new executable file the finder module encounters, it calls the replication module to infect that file. Residents Virus The virus loads the replication module into memory when it is executed and ensures that this module is executed each time the operating system is called to perform a certain operation In this case, the virus infects every suitable program that is executed on the computer. Department of BCA Session: July 2008 Nov 2008 16/57

BCA103 - Computer Fundamentals Virus and Anti-virus Anti-Virus Antivirus software are computer programs that attempt to identify, neutralize or eliminate malicious software Most modern antivirus software is now designed to combat a wide range of threats, including worms, phishing attacks, rootkits, trojan horses and other malware In computing, phishing is the criminally fraudulent process of attempting to acquire sensitive information such as usernames, passwords and credit card details, by masquerading as a trustworthy entity in an electronic communication.

Department of BCA

Session: July 2008 Nov 2008

17/57

BCA103 - Computer Fundamentals Virus and Anti-virus Anti-Virus A rootkit is a program (or combination of several programs) designed to take fundamental control (in Unix terms "root" access, in Windows "Administrator" access) of a computer system, without authorization by the system's owners and legitimate managers

Antivirus software typically uses two different approaches to identify virus:


1. examining (scanning) files to look for known viruses matching definitions in a virus dictionary, and 2. identifying suspicious behavior from any computer program which might indicate infection Department of BCA Session: July 2008 Nov 2008 18/57

BCA103 - Computer Fundamentals Virus and Anti-virus Anti-Virus The suspicious behavior approach, by contrast, doesn't attempt to identify known viruses, but instead monitors the behavior of all programs. If one program tries to write data to an executable program, for example, the antivirus software can flag this suspicious behavior, alert a user, and ask what to do. Unlike the dictionary approach, the suspicious behavior approach therefore provides protection against brand-new viruses that do not yet exist in any virus dictionaries

Department of BCA

Session: July 2008 Nov 2008

19/57

BCA103 - Computer Fundamentals

Virus and Anti-virus


Other approaches
Some antivirus software use other types of heuristic analysis. For example, it could try to emulate the beginning of the code of each new executable that the system invokes before transferring control to that executable. If the program seems to use self-modifying code or otherwise appears as a virus However, this method could result in a lot of false positives. Yet another detection method involves using a sandbox. A sandbox emulates the operating system and runs the executable in this simulation. After the program has terminated, software analyzes the sandbox for any changes which might indicate a virus. Also this method may fail as viruses can be nondeterministic so it will be impossible to detect it from one run. Some virus scanners can also warn a user if a file is likely to contain a virus based on the file type.

Department of BCA

Session: July 2008 Nov 2008

20/57

BCA103 - Computer Fundamentals

Virus and Anti-virus


Computers Security The computers security starts with a good virus scanner and never ends. Typical approaches to improving computer security can include the following: 1. Physically limit access to computers to only those who will not compromise security. 2. Hardware mechanisms that impose rules on computer programs, thus avoiding depending on computer programs for computer security. 3. Operating system mechanisms that impose rules on programs to avoid trusting computer programs. A firewall is a device or set of devices configured to permit, deny, encrypt, decrypt, or proxy all computer traffic between different security domains based upon a set of rules and other criteria.

Department of BCA

Session: July 2008 Nov 2008

21/57

BCA103 - Computer Fundamentals

Machine and high level languages


Programming languages are said to be lower or higher, depending on whether they are closer to the language the computer itself uses or to the language that people use. Here we will consider five levels (or generations) of languages: 1. Machine languages/1st generations 2. Assembly languages / 2nd generations 3. Procedural languages / 3rd generations 4. Problem-oriented / 4th generations 5. Natural languages / 5th generations The closer the level is to human speech, the more it is described as a user friendly language.

Department of BCA

Session: July 2008 Nov 2008

22/57

BCA103 - Computer Fundamentals

Machine and high level languages


Machine languages Computers are working two-state system, that is, on/off or yes/no. In the early days of computers, with machines as the ENIAC, which used vacuum tubes, one could actually see the tubes lit up or unlit (dark), corresponding to the 1/0 binary stat the switch was either on or off. In addition, in those early days there was no such thing as software. There was only hardware with electrical on/off switches. Whenever a program was to be run, all the switches had to be set sometimes as many as 6,000 switches for a single program. Then next program the switches had to be reset, a process that might take weeks.

Department of BCA

Session: July 2008 Nov 2008

23/57

BCA103 - Computer Fundamentals

Machine and high level languages


Machine languages Advantage: execution is very fast and efficient because the computer can accept the machine code as it is. Disadvantage: 1. there is no standard machine language 2. The language are machine dependent.

Assembly languages
Also called symbolic language or abbreviated or mnemonic code. Code are easily memorized replacing 0s and 1s of machine language. Actually, assembly language do not replace machine languages.

Department of BCA

Session: July 2008 Nov 2008

24/57

BCA103 - Computer Fundamentals

Machine and high level languages


Assembly languages The assembly languages code is very similar in form to machine language. In fact, the first assembly languages had a one-toone correspondence. That is, 20 assembly statements would be translated into 20 machine statements. Advantage: 1. standardized and easier to use than machine language. 2. Easier to debug because programs locate and identify syntax errors. 3. Operate very efficiently but not as efficient as the machine language. Disadvantage: 1. Still complex to code. 2. Again machine dependent. 3. Usually very long.

Department of BCA

Session: July 2008 Nov 2008

25/57

BCA103 - Computer Fundamentals

Machine and high level languages


High level languages Assisted programmers by reducing further the number of computer operation details they had to specify, so that concentrate more on the logic needed to solve the problem.
The term "high-level language" does not imply that the language is always superior to low-level programming languages - in fact, in terms of the depth of knowledge of how computers work required to productively program in a given language, the inverse may be true.

high-level languages make complex programming simpler, while low-level languages tend to produce more efficient code For this reason, code which needs to run particularly quickly and efficiently may be written in a lower-level language, even if a higher-level language would make the coding easier.

Department of BCA

Session: July 2008 Nov 2008

26/57

BCA103 - Computer Fundamentals

Machine and high level languages


Types of High level languages Procedural-oriented language Problem-oriented language (BASIC, Pascal) Natural language

In a procedural-based programming language, a programmer writes out instructions that are followed by a computer from start to finish. Example: c, c++, Basic, COBOL
Non procedural also called "declarative language," users concentrate on defining the input and output rather than the program steps required in a procedural language such as C++, COBOL. Query languages, report writers, interactive database programs, spreadsheets and application generators are examples of non-procedural languages.

Department of BCA

Session: July 2008 Nov 2008

27/57

BCA103 - Computer Fundamentals

MS DOS and Window OS


MS DOS MSDOS is a single user operating system and therefore all the resources are available to this user.

DOS contains three files: 1. IO.SYS, 2. MSDOS.SYS 3. Command.com


1. IO.SYS a) It verifies the input output devices and drivers. b) loads the file MSDOS.SYS from the hard disk into memory. 2. MSDOS.SYS it is also called DOS Kernel. it is a link between BIOS and users application programs.

Department of BCA

Session: July 2008 Nov 2008

28/57

BCA103 - Computer Fundamentals

MS DOS and Window OS


MS DOS

MSDOS has four important functions as: 1. Process Control 2. Memory management 3. Application Program Interface (API) 4. File Management System (FMS) Process Control: Does the management of the program that is being executed Loads program into the memory and initiates execution of loaded program. It also recovers the system files when program execution is terminated in between.

Department of BCA

Session: July 2008 Nov 2008

29/57

BCA103 - Computer Fundamentals

MS DOS and Window OS


Memory Management

Allocates the memory to different application programs. It also does file allocation according to memory demand. Application Program Interface: Works like an intelligent agent so that every program is allotted to the various hardware devices. File management system: Is the largest portion of the MSDOS.SYS. It can read, write display and print the files. It can rename, copy and remove the files.

Department of BCA

Session: July 2008 Nov 2008

30/57

BCA103 - Computer Fundamentals

MS DOS and Window OS


Command.com

Has two portions as: a) Resident portion.

b) Transient portion.

Resident portion: Contains internal commands in it. System can only be interrupted by using Ctrl+C in case of any execution error for job termination. It displays the error message like Bad command or file name Abort, Retry, Ignore? It contains code required to reload the transient portion (external command) of command.com.

Department of BCA

Session: July 2008 Nov 2008

31/57

BCA103 - Computer Fundamentals

MS DOS and Window OS Transient portion: It is the temporary portion of command.com. Any application program has shortage of memory space, then transient portion is erased and memory space is made available to application program. When an application program is not in use or terminated, then it reload the erased portion. It displays dos prompt like A:/>, B:/>. Booting: Can be defined loading of set of programs from the ROM into RAM so that it creates an environment for the execution of commands or further processing. The loadable files are IO.SYS, MSDOS.SYS, Command.com
Department of BCA Session: July 2008 Nov 2008 32/57

BCA103 - Computer Fundamentals

MS DOS and Window OS While Booting: ROM startup routines set up addresses of ROM-BIOS routines Interrupt Vector Table (IVT) at the low end of memory. RAM test ROM startup routines check for standard and nonstandard equipment attached to computer. ROM startup routines reads from BIOS. For example, First attempt of booting from A:/> then C:/>
Types of Booting: Cold Booting: when we switched on. Slow in process. Hot Booting: when we press Reset button. Faster than cold booting because it will not restart computer instead reload the files. Department of BCA Session: July 2008 Nov 2008 33/57

BCA103 - Computer Fundamentals

MS DOS Internal Commands CLS DATE TIME COPYCON TYPE RD PATH COPY
DIR DIR/P

and Window OS
VOLUME REN DEL PROMPT TIME MD VER CD

DIR/W DIR/S DIR with wildcard(*,?)

External Commands: EDIT to edit existing file. ATTRIB to change the attributes of files example. +R read only, -R remove read only +H to hide -H to remove hide attribute BACKUP create a copy to destination path RESTORE copy the files in original path CHKDSK DISKCOPY DELTREE FORMAT FDISK MOVE PRINT UNDELETE Department of BCA Session: July 2008 Nov 2008 34/57

BCA103 - Computer Fundamentals

Database Management Systems


Information is the backbone of any organization. What is information? Information is nothing but refined data, data that have been put into a meaningful and useful context and communicated to a recipient who used it to make decisions. Quality of Information Accuracy: - means that information is free from mistakes and errors - Means that information is free from bias. - Manipulated information is worse than no information.

Department of BCA

Session: July 2008 Nov 2008

35/57

BCA103 - Computer Fundamentals

Database Management Systems Quality of Information Timeliness: - Means that getting the information to the recipients within the needed time frame. - Breaking news
Relevancy: - Means the use of a piece of information for a particular person. - Subjective matter. What is Database? A database consists of data, relationships, constraints and schema. - Data are binary computer representations of stored logical entities. Department of BCA Session: July 2008 Nov 2008 36/57

BCA103 - Computer Fundamentals -

Database Management Systems Relationships represent a correspondence between the various data elements. Constraints are predicates that define the correct database states where the scheme describes the organization of data and relationships within the database The schema defines the various views of the database for database management system components use and for applications security.

Database - A collection of data designed to be used by different people is called database. - The data are stored in such a fashion that they are independent of the programs of people using the data. Department of BCA Session: July 2008 Nov 2008 37/57

BCA103 - Computer Fundamentals

Database Management Systems Why integrated database - Data redundancy each department has its own private files resulting storage space is wasted. Hence the redundancy can be controlled. - Data inconsistency if a database is updated and not reflected in other department becomes data inconsistency. - Integrity means that the data in the database is accurate. - Conflicting requirements knowing the overall requirements as opposed to the individual requirement, the database can be structured to provide an overall service that is best for the organization

Department of BCA

Session: July 2008 Nov 2008

38/57

BCA103 - Computer Fundamentals

Database Management Systems Characteristics of data in a database - Shared data in a database are shared among different users and applications. - Persistence the data can live beyond the scope of the process that created it. - Validity: data should be correct with respect to the real world. - Security: data should be protected from unauthorized access. - Independent the three levels in the schema (internal, conceptual and external) should be independent of each other so that the changes in the schema at one level should not affect the other levels.
Department of BCA Session: July 2008 Nov 2008 39/57

BCA103 - Computer Fundamentals

Database Management Systems Database Management System - A database management system (DBMS) is a software that provides services for accessing a database, while maintaining all the required feature of the data.
Transaction processing - Is a sequence is database operations that represents a logical unit of work. It access a database and transforms it from one state to another. - It may be update, delete, modify etc., Concurrency management - Is the database management activity of coordinating the actions of database manipulation process that operate concurrently, access shared data and can potentially interfere with each other. Department of BCA Session: July 2008 Nov 2008 40/57

BCA103 - Computer Fundamentals Recovery - Recovery mechanisms of a DBMS make sure that the database is returned to a consistent state after a transaction fails or aborts. - Recovery is very much related to concurrency in the sense that the more the concurrency, the more is the chance of an aborted transaction can affecting many other transactions. security - The level of access for each user and the operations that each user can perform on the data will be monitored and controlled by the DBMS depending on the access privileges of the users.

Database Management Systems

Language interface - Provides the definition and manipulation of the data in the database. Ex DDL, DML
Department of BCA Session: July 2008 Nov 2008 41/57

BCA103 - Computer Fundamentals

Types of Database Management Systems Hierarchical Model - Oldest database models (1950). - The hierarchical model assumes that a tree structure is the most frequently occurring relationship. - This mislead restrictive view of relationships.
Network Model - Replaces the hierarchical tree with a graph thus allowing more general connections among the nodes. - A strict hierarchical arrangement is not possible when an employee works for two departments, then the tree will become graph. - In hierarchical model we have to place a data simultaneously in two location in the list. In network we can connect. Department of BCA Session: July 2008 Nov 2008 42/57

BCA103 - Computer Fundamentals

Types of Database Management Systems Relational Model - The relational model uses tables to organize the data elements. Each table corresponds to an application entity, and each row represents an instance of that entity. - For example , book database is an entity, a book detail is an instance.
Object-oriented Model - OOM represents an entity as a class. - A class represents both object attributes as well as the behavior of the entity. - For example, a book class will have not only the book attributes (ISBN, Tile, Price) but also procedure that imitate actions expected (updateprice()) of a book. Session: July 2008 Nov 2008

Department of BCA

43/57

BCA103 - Computer Fundamentals

Levels of database services Physical Level - At the lowest level, certain physical components organize and store the raw data.
In addition to hardware, these components include control structures that track the location and format of the stored data elements. Example: Buffer The physical layer typically has parameters that can be tuned for optimal performance under the access pattern of an applications.

However in case of relation, object-oriented database models, the tuning task is usually left to the DBMS.
Session: July 2008 Nov 2008 44/57

Department of BCA

BCA103 - Computer Fundamentals

Levels of database services Conceptual Level - Is isolating the data storage details to the physical level of DBMS, provides a convenient environment.
The application objects exist at this level. Ex., Tables, views, triggers

If the underlying hardware and OS changes, the consequences limited to the interface between the physical and conceptual layer.
For example, OS is changed from UNIX to window, a new version of DBMS might be necessary.

Department of BCA

Session: July 2008 Nov 2008

45/57

BCA103 - Computer Fundamentals

Levels of database services External Level - Outer most layer - Different type of external views can use the same conceptual view to satisfy the differing needs of the different users. - The decoupling of the external and conceptual level is called logical data independence. Database Design - A data base about a person may be consists of - Photograph, fingerprint, retina images - Name, age, sex, height, weight, address - Telephone number, blood, caste, religion, etc.,
Now the question is how much information about an entity should be collected. Department of BCA Session: July 2008 Nov 2008 46/57

BCA103 - Computer Fundamentals

Database Design Data Normalization - Normalization is the process of building database structures to store data. - Data normalization is a corner stone of a relational theory. - The different steps involved in data normalization are called the normal forms. - Each normal form builds upon the last version. Keys - A key uniquely identifies a row in a table. Intelligent Keys - An intelligent key is based upon data values such as a date, price, name. Non-Intelligent Keys - Is completely arbitrary, having no function or meaning other than identification or a row.
Department of BCA Session: July 2008 Nov 2008 47/57

BCA103 - Computer Fundamentals

Database Design Intelligent Keys - Is problematic because the key value must be changed to reflect changing data values. - For example, price is changed, all related tables must be updated every time the key is updated.
Primary Keys - Is column in the table whose purpose is to uniquely identify records from the same table. Foreign Keys - A foreign key is a column in a table that uniquely identifies the records from a different table. or - The foreign key identifies a column or a set of columns in one (referencing) table that refers to a column or set of columns in another (referenced) table Department of BCA Session: July 2008 Nov 2008 48/57

BCA103 - Computer Fundamentals

Relationship
One-to-one - 1 to 1 relationships are rare, because data elements related in this way are normally placed in the same table One-to-many - When one data item can be linked to 0, 1 or many other data items, you are dealing with a one-tomany relationship - The same applies to the relationship that exists between a woman and her children. A woman can have 0, 1 or many children and each child has one woman as its mother.

Department of BCA

Session: July 2008 Nov 2008

49/57

BCA103 - Computer Fundamentals

Relationship
Many-to-many - The many-to-many relationship is a relationship where multiple rows from table A can correspond to multiple rows in table B. - An example of such a relationship is a school where teachers teach students. In most schools each teacher can teach multiple students and each student can be taught by multiple teachers. - This relationships are problematic. - Normally this relationship expresses using intersection tables. - An intersection table contains two or more foreign keys, relating the primary key values of two or more tables to each other. - The role of an intersection table is to convert many to many into one-to-many. Department of BCA Session: July 2008 Nov 2008 50/57

BCA103 - Computer Fundamentals -

Normalization The guidelines for proper relational database design are laid out in the relational model. They are grouped into 5 groups called "normal forms". The first normal form represents the lowest form of database normalization, the fifth represents the highest form of database normalization. These normal forms are guidelines for good database design. You are not obliged to adhere to all five normal forms when designing a database.
Nevertheless, you are advised to normalize you database to some extent, because normalization has some significant advantages in terms of the efficiency and maintainability of your database.

Department of BCA

Session: July 2008 Nov 2008

51/57

BCA103 - Computer Fundamentals

Normalization
Why normalization - Complex queries can be done using simple SQL commands. Data Integrity. data integrity means that the data values in the database are correct and consistent. Avoids data redundant Scalability. Scalability is the ability to meet with future growth demands

Department of BCA

Session: July 2008 Nov 2008

52/57

BCA103 - Computer Fundamentals

Normalization The first normal form (1NF) A database table is a representation of an "entity" in the system you are building. Examples of entities are order, customer, contact moment, product, etc. Each row in the database table represents one occurrence of an entity. For example in a customer table each row will contain information about 1 customer.
Each table has a primary key, consisting of the smallest possible number of fields.

Atomicity: each field contains one value. An adres for example, would ideally be stored in three separate fields: number, street, city.
Department of BCA Session: July 2008 Nov 2008 53/57

BCA103 - Computer Fundamentals

Normalization The second normal form (2NF) The second normal deals with data redundancy. The rules comprised in the second normal form are as follows. The database fullfills all the requirements of the first normal form All non-primary-key fields in a table must be fully dependent on the entire primary key of the table
The third normal form (3NF) Already meet the requirements of both 1NF and 2NF

Remove columns that are not fully dependent upon the primary key.

Department of BCA

Session: July 2008 Nov 2008

54/57

BCA103 - Computer Fundamentals

Normalization For example, we will normalize following fields: Order Number Customer Number Unit Price Quantity Total Remember, our first requirement is that the table must satisfy the requirements of 1NF and 2NF. Are there any duplicative columns? No. Do we have a primary key? Yes, the order number. Therefore, we satisfy the requirements of 1NF. Are there any subsets of data that apply to multiple rows? No, so we also satisfy the requirements of 2NF.
Department of BCA Session: July 2008 Nov 2008 55/57

BCA103 - Computer Fundamentals

Normalization Now, are all of the columns fully dependent upon the primary key? The customer number varies with the order number and it doesn't appear to depend upon any of the other fields.
What about the unit price? This field could be dependent upon the customer number in a situation where we charged each customer a set price. However, looking at the data above, it appears we sometimes charge the same customer different prices. Therefore, the unit price is fully dependent upon the order number. The quantity of items also varies from order to order, so we're OK there. Department of BCA Session: July 2008 Nov 2008 56/57

BCA103 - Computer Fundamentals

What about the total? It looks like we might be in trouble here. The total can be derived by multiplying the unit price by the quantity, therefore it is not fully dependent upon the primary key. We must remove it from the table to comply with the third normal form.
Perhaps we use the following attributes: Order number Customer number Unit price

Quantity
Now our table is in 3NF. But you might ask, what about total? This is a derived field and it is best not to store it in the database at all. We can compute it. Department of BCA Session: July 2008 Nov 2008 57/57