Notes 2CEBA 2023 Classes Objects
Notes 2CEBA 2023 Classes Objects
SYSTEMS
MOTHERBOARD
The motherboard is a circuit board that connects all system components like CPU, RAM,
expansion cards etc.
Characteristics of Motherboard
1.Form factor: It refers to the motherboard’s geometry, dimensions, arrangement and
electrical requirements.
2.Chipset: It is a collection of microchips to perform specific functions.
3.Processor socket: It is a place where CPU is connected.
Types Of Motherboard
1.XT Motherboard
XT stands for eXtended Technology. In these motherboards, we find RAM slots, DIMM
(Dual Inline Memory Module) and, 12 pin power connector.
Example - Pentium-I
2.AT Motherboard
AT stands for Advanced Technology. They have PGA (Pin Grid Array) socket,20 pin power
connector, PCI(Peripheral Component Interconnect ) slots .
Example - Pentium-III processors
3.Baby AT Motherboard
Baby AT Motherboards have the combination of XT and AT.
Example - Pentium-IV
Components Of Motherboard
1.Processor: The processor or CPU is the main component of the motherboard and is called
the brain of the computer which consist of ALU, Control Unit and Registers.
Note:
a) The clock speed of a CPU is defined as the frequency with which a processor executes
instructions or the data.
b) Microprocessor is a small integrated circuit on a silicon chip that make the computer’s
CPU.
2.North Bridge
North Bridge or north Chipset is responsible for controlling high speed components like
CPU, RAM and Video Card.
3.South Bridge
South Bridge or south Chipset is responsible for controlling low speed components like
Sound Card, Net Card, hard disk etc.
4. BIOS (Basic Input Output System)
A read only memory chip which contains the start-up instructions for the computer system.
5.CMOS (Complementary Metal Oxide Semiconductor) Battery
It is a lithium battery which provides the power supply to a motherboard to keep information
like system time and date when the system is off.
6.Slots
A slot is a socket in the mother board which is used to connect the add-on-cards.
Different Types of Slots are listed below
a) Expansion slot - The expansion cards are inserted in the expansion slots to give
the new features.
b) ISA (Industry Standard Architecture) slot - ISA slot is used to connect modem
and input devices.
c) PCI (Peripheral Component Inter Connect) slot - PCI slots are used to connect
graphics accelerator cards, sound cards etc.
d) AGP (Accelerated Graphic Port) slot- AGP slot is meant to provide faster access
to a graphics accelerator card.
e) RAM slot - RAM slot is used to install memory and is of two types.
i)SIMM (Single Inline Memory Module) slot
ii)DIMM (Dual Inline Memory Module) slot.
f) Processor slot - Processor slot is used to insert the processor chip.
g) PC Card Slot - It is a slot to insert card which includes Wi-Fi card, network card
and external modem.
7.Disk Controller
Disk Controller enables the CPU to communicate with hard disk and floppy disk.
a) Hard Disk Controller (HDC)
The hard disk controller is the interface that enables the computer to read and write
information to the hard drive.
NOTE: The first standard hard disk controller is IDE (Integrated Drive Electronics)
or Advanced Technology Attachment (ATA).
b) Floppy Disk Controller (FDC)
A floppy-disk controller is the interface that enables computer to read and write
information to the computer’s floppy disk drive (FDD).
8. I/O Ports and Interfaces
The ports and interfaces are used to connect external devices like printers, keyboards or
scanners to the computer.
Different Types of Slots are listed below
a)Serial Port
They are used for connecting communication devices like mouse and modem.
b)Parallel Port
They are used to connect external input/output devices like printers or scanners.
c)IDE (Integrated Digital Electronics) Port
IDE devices like CD-ROM drives or hard disk are connected to the motherboard
through the IDE port.
d)USB (Universal Serial Bus) PORT
USB port allows to connect printers, scanners, digital cameras, web cameras, speakers
etc.to computer.
NOTE: USB - It is a plug-and-play interface between a computer and add-on devices
e)PS-2 (Personal System-2 Port)
Used to connect keyboard, mouse, trackballs and touch pads.
f)AGP (Accelerated Graphics Port)
The AGP port is used to connect to graphic card.
g)SCSI (Small Computer System Interface) Port
This port is used for adding external devices such as high-speed hard-disks, high-end
scanners to computer.
h)VGA(Visual Graphics Adaptor) Port
It connects monitor to a computer’s video card.
i)Power Connector
It connects to the computer’s power cable.
j)MODEM (Modulator Demodulator)
It connects a PC’s modem to the telephone network.
k)Ethernet Port
It connects to a network and high-speed internet.
l)Game Port
It connects a PC to a joystick.
m)DVI (Digital Video Interface) Port
It connects LCD monitor to video graphic cards.
n)Sockets
They are used to connect microphone, speakers to sound card of the computer.
o)MIDI (Musical Instrument Digital Interface) Port
It is a system designed to transmit information between electronic musical
instruments.
9. Bus
A bus is a collection of parallel wires that carry address, data and control signals.
There are two types of Buses
a) Internal bus /System Bus
b) External bus/Expansion Bus
a) Internal bus: It connects major computer components like, processor, memory and I/O.
It consists of 3 buses
i) Data bus provides a path to transfer data between CPU and memory.
ii) Address bus connects CPU and RAM for transferring address.
iii) Control bus carry control information between the CPU and other devices within
the computer.
b) External bus: It connects the different external devices, peripherals, expansion slots, I/O
ports and drive connections to the rest of the computer.
REGISTERS
The registers are high speed temporary storage areas located inside the CPU.
CACHE MEMORY
1)The cache memory is a high-speed memory placed between RAM and CPU to speed up
access of data and instructions stored in RAM memory.
2)Cache memory is very expensive and smaller in size.
3)The CPU have Level1 (L1) cache and Level2 (L2) cache of size 256KB and 6MB
respectively.
4)Some CPUs have a separate cache chip on the motherboard called Level3 (L3) cache of
size 12MB.
TYPES OF RAM
1)DRAM or Dynamic RAM
It must be refreshed continually to store information.
2)SRAM and Static Random Access Memory
It does not need constant refreshing and therefore is faster than DRAM.
3)SDRAM or Synchronous Dynamic Random Access Memory
It is a special type of DRAM that is synchronized to the system clock.
4)DDR-SDRAM or Double-Data Rate SDRAM It is same as SDRAM but the data rate is
double
ARRAYS
Collection of homogeneous elements with same name and data type
Types of arrays
1) One-dimensional array
2) Two-dimensional array
3) Multi-dimensional array
1.One-dimensional array
A structured collection of elements having same type and data type structured in one
dimension.
Syntax: datatype arrayname [size];
2.Two-dimensional array
A structured collection of elements having same type and data type structured in two
dimensions.
Syntax: datatype arrayname arrayname[row][column];
Representation of 2-dimensional array in memory
There are two methods:
a) Row-major order
In row-major order, all the first-row elements are stored in sequential memory locations and
then all the second-row elements are stored and so on.
b) Column-major order
In column-major order, all the first column elements are stored in sequential memory
locations and then all the second-column elements are stored and so on.
3.Multi-dimensional array
A structured collection of elements having same type and data type structured in n
dimensions.
NOTE: 1. Index indicates the component’s position within the collection.
2. Elements of array are accessed by numbers called as subscripts or indices.
Features
1.Array size should be positive number only.
2.Index values ranges from 0 to n-1.
3.Useful for multiple reading of elements.
Application of arrays
1.Arrays are used to implement other data structures such as strings ,stacks, queues etc.
2.Arrays are used to implement mathematical vectors and matrices.
3.Many data bases include one-dimensional arrays whose elements are records.
Advantages of arrays
1.It is used to represent multiple data items of same type using only single name.
2.It can be used to implement other data structures such as stacks and queues, trees etc.
3.It can be used to represent matrices.
Disadvantages of arrays
1.We must know in advance the number of elements that has to be stored in the array.
2.Array is of fixed size
3.If we allocate more memory than required, then the memory space will be wasted.
LIST
A list is a sequential data structure in which addition and removal of element can be made at
any position.
Types of List
1. Linear data structures: A linear data structure is a data structure that has homogeneous
elements and elements will have linear relationship between them
Example: stacks, queues and linked lists
2. Non-Linear data structures: A non-linear data structure is a data structure in which a
data element is connected to several other data elements and the elements will have non-
linear relationship between them.
Example: trees and graphs
STACKS
A stack is an ordered collection of items where the insertion and removal of an item always
takes place at the same end called as Top.
Note: It follows LIFO, last-in first-out.
Operations on stack
1. stack()
Creates a new stack that is empty.
2. push(item)
Adds a new item to the top of the stack.
3. pop()
Removes the top item from the stack.
4. isEmpty()
Tests whether the stack is empty.
5. size()
Returns the number of items on the stack.
Algorithm for PUSH Operation (Inserting element into stack)
If TOP = N-1 then
PRINT “Stack is full”
Exit
End if
TOP = TOP + 1
STACK[TOP] = ITEM
Algorithm for POP Operation (Removal of element from stack)
If TOP = -1
PRINT “Stack is empty”
Exit
End if
ITEM = STACK[TOP]
TOP = TOP – 1
Application of Stacks
1. reverse a word
2. “undo” mechanism in text editors
3. Conversion of decimal number into binary
4. Quick sort
5. To solve tower of Hanoi
QUEUES
A queue is an ordered collection of items where an item is inserted at one end called ‘Rear’,
and an existing item is removed at the other end called the ‘Front’.
Note: first-in first-out (FIFO) principle.
Operations on queue
1)queue()
Creates a new queue that is empty.
2)enqueue (item)
Adds a new item to the rear of the queue.
3)dequeue()
Removes the front item from the queue.
4)isEmpty()
Tests to see whether the queue is empty.
5)size()
Returns the number of items in the queue.
Types of Queue
1.Simple Queue
In Simple queue, insertion occurs at the rear end of the list, and deletion occurs at the front
end of the list.
2.Circular Queue
A circular queue is a queue in which all nodes are connected in circular form such that the
last node follows the first node.
3.Priority Queue
A priority queue is a queue that contains items that have some preset priority.
4.Double Ended queue
It is a queue in which insertion and deletion takes place at both the ends.
Algorithm for Enqueue (Inserting an item into the queue)
If REAR = N-1 Then
PRINT “Overflow”
Exit
End if
If FRONT = NULL
FRONT = 0
REAR = 0
Else
REAR = REAR + 1
End if
QUEUE[REAR] = ITEM
Algorithm for Dequeue (Deleting an element from the queue)
If FRONT = NULL Then
PRINT “Underflow”
Exit
End if
ITEM = QUEUE[FRONT]
If FRONT = REAR Then
FRONT = -1
REAR = -1
Else
FRONT = FRONT + 1
End if
Applications of Queues
1.Simulation
2.Operating system
3.Different type of scheduling algorithm
4. Printer server routines
5. multi-Programming platform systems
CHARACTERISTICS OF OOP
1.Object
Object is an instance of a class.
2.Class
A class is a user defined data type that contains data members and member functions.
3.Data Abstraction
The process of representing essential features without including the background details.
4.Data Encapsulation
The process of combining data and functions into single unit.
NOTE: The concept of insulating the data from direct access by the program is called
data hiding.
5.Inheritance
A mechanism by which one class acquires the properties of another class is called as
inheritance.
6.Polymorphism
The ability of an operator and functions to take multiple forms is known as polymorphism.
a)Operator Overloading: The ability of operator to perform different operations in
different instances based on data used is Operator Overloading.
b)Function Overloading: Two or more functions having same name but differ in number
of arguments or type of arguments is called Function Overloading.
7.Dynamic binding
Dynamic binding is the process of linking procedure call to a specific sequence of code.
8.Message passing
Message passing is sending and receiving information between the objects.
ADVANTAGES OF OOP
1. The programs are modularized based on the principle of classes and objects.
2. Code reusability.
3. Provides data security using encapsulation.
4. Easier to develop complex software through inheritance.
5. Reduces software development time.
LIMITATIONS OF 00P
1. The adaptability of flow diagrams and object-oriented programming using classes and
objects is a complex process.
2. To convert a real-world problem into an object-oriented model is difficult.
3. Programmer needs to do proper planning and design.
4. OOPs use tricky methods to do programming.
5. Programmer needs proper skills.
APPLICATIONS OF OOP
1. Real time systems
2. Artificial intelligence and expert systems.
3. CAD/CAM systems.
4. Simulation and modeling.
5. Computer graphic applications.
___________________________________________________________________________
CLASS DEFINITION
A class definition is a process of naming a class and its data variables and member functions.
Syntax :
class classname
{
private:
Member data;
Member functions;
public:
Member data;
Member functions;
protected:
Member data;
Member functions;
};
Example:
class student
{
private :
int regno;
char name [30];
public:
void getdata ( );
void putdata ( );
};
DATA MEMBERS
Properties of the class.
Example: regno, name
MEMBER FUNCTION
The set of operations performed on data members.
Example getdata()
ACCESS SPECIFIERS
The access specifiers define the scope of data. They provide security to the data.
Types of Access Specifiers
1.Private
Data member or a member function declared under private can be accessed only within the
class.
NOTE: The Default access specifier is Private
2.Public
Data member or a member function declared under public can be accessed by any function
outside the class also. (From anywhere within a program)
3.Protected
Data member or a member function declared under protected can be accessed only by the
derived class and friend function.
OBJECT
It is an instance of the class.
The syntax for declaring object is
classname objectname;
Ex. Student s;
ARRAYS OF OBJECTS
An array having class type elements is known as array of objects.
Example: Program to enter and display 3 students information using array of objects.
#include<iostream.h>
#include<conio.h>
class student
{
private:
int regno;
char name[10];
public:
void getdata();
void putdata();
};
void student::getdata()
{
cout<<"Enter register number";
cin>>regno;
cout<<"Enter name";
cin>>name;
}
void student::putdata()
{
cout<<"Register number="<<regno;
cout<<"Name="<<name;
}
void main()
{
clrscr();
student s[3];
int i;
for(i=0;i<3;i++)
s[i].getdata();
for(i=0;i<3;i++)
s[i].putdata();
getch();
}
Output:
DIFFERENCES BETWEEN OBJECT ORIENTED
PROGRAMMING(OOP) AND PROCEDURE ORIENTED
PROGRAMMING(POP) LANGUAGES
FUNCTION SIGNATURE
The argument list of a function is called function signature.
ADVANTAGES
1. Code is executed faster.
2. Eliminates the use of different function names for the same operation.
3. It is easier to understand the flow of information and debug.
4. Code maintenance is easy.
5. Easier interface between programs and real-world objects.
INLINE FUNCTIONS
The Inline function is a function whose body is inserted at the place of its call.
Syntax
inline returntype functionname(argument declaration)
{
statements;
return(expression);
}
Example:
C++ program to find the cube of a number using inline function. (Without classes and
objects)
#include<iostream.h>
inline int cube (int a)
{
return (a*a*a);
}
void main()
{
int x;
cout<<“Enter a number “;
cin>>x;
cout<<“Cube=” <<cube(x);
}
Output:
Enter a number
2
Cube=8
NOTE: The inline function may not work for one of the following reasons.
1. The inline function definition is too long or too complicated.
2. The inline function is recursive.
3. The inline function has looping constructs.
4. The inline function has a switch or goto statement.
FRIEND FUNCTION
A friend function is a non-member function that is a friend of a class which can access
protected and private data members of class.
Syntax
friend returntype friendfunctionname (classname objectname)
{
Statements;
}
Example: To add two numbers and display the sum using friend function.
#include<iostream.h>
#include<conio.h>
class addition
{
public:
int a,b;
public:
void getdata();
friend int calculate(addition obj);
};
void addition::getdata()
{
cout<<"Enter a and b";
cin>>a>>b;
}
int calculate(addition obj)
{
return (obj.a+obj.b);
}
void main()
{
addition object;
object.getdata();
cout<<"Sum="<<calculate(object);
}
Output:
TYPES OF CONSTRUCTORS
1. Default constructor
2. Parameterized Constructor
3. Copy constructor
1.Default Constructor
A constructor which does not accept any arguments is called a zero-argument constructor or
default constructor.
Example:
Note to Students: Refer the same example which is given for the ‘Constructors’ above.
Features of default constructor
1. Cannot be overloaded.
2. All objects of a class are initialized to same set of values by the default constructor.
3. If different objects have to be initialized with different values, it cannot be done using
default constructor
2.Parameterised Constructors
A constructor that takes one or more arguments is called parameterised constructors.
Example: Program to add two numbers and display the sum using Parameterized
Constructors.
#include<iostream.h>
#include<conio.h>
class addition
{
private:
int a,b,sum;
public:
addition(int x,int y)
{
a=x;
b=y;
}
void compute()
{
sum=a+b;
}
void display()
{
cout<<”Sum=”<<sum;
}
};
void main()
{
clrscr();
addition ad(10,20);
ad.compute();
ad.display();
getch();
}
Output:
Sum=30
Features Of Parameterised Constructors
1. This can be overloaded.
2. For an object created with one argument, constructor with only one argument is
invoked and executed.
3. Different objects can be initialized with different values.
Invoking parameterised constructors
The parameterised constructor can be invoked through the following methods.
a) Explicit call
b) Implicit call
c) Initialization using assignment operator (=)
a) Explicit call
In explicit call, declaration of an object is followed by assignment operator, constructor
name and argument list enclosed in parenthesis.
Syntax
classname objectname =constructorname(arg1,arg2,…..);
Example :
addition ad= addition (10,20); //Explicit call
b) Implicit call
Here, declaration of the object is followed by argument list enclosed in parenthesis.
Syntax
classname objectname(arg1,arg2,…..);
Example:
addition ad(10,20); //Implicit call
c) Initialisation Using Assignment Operator
This is used for the constructor with exactly one argument. Declaration is followed by
assignment operator and the value to be initialised.
Syntax
classname objectname = value;
Example:
addition ad=100;
3.Copy Constructor
Copy constructor is a parameterized constructor using which one object can be copied to
another object .
Example
addition ad1;
addition ad2=ad1;
CONSTRUCTOR OVERLOADING
Constructors with same name but different number or type of arguments.
Example: Program to add two sets of numbers and display their sum using Constructor
Overloading.
#include<iostream.h>
#include<conio.h>
class addition
{
private:
int a,b,sum;
public:
addition()
{
a=10;
b=20;
}
addition(int x,int y)
{
a=x;
b=y;
}
void compute()
{
sum=a+b;
}
void display()
{
cout<<”Sum=”<<sum;
}
};
void main()
{
clrscr();
addition ad;
addition ad1(30,40);
ad.compute();
ad.display();
ad1.compute();
ad1.display();
getch();
}
Output:
Sum=30
Sum=70
DESTRUCTORS
A destructor is a special member function that will be executed automatically when an object
is destroyed.
Note: Like constructor, it has the same name as that of the class, but preceded by a tilde (~)
Syntax :
class class name
{
private: data members;
public: constructorname();
~destructorname();
};
Example:
class example
{
private:
int a,b;
public:
addition ()
{
a=10;
b=20;
}
~ addition()
};
Features Of Destructor
1. The destructor’s name is the same as that of class.
2. They take no arguments.
3. It is declared under public.
4. Destructors can never return a value.
5. There can be only one destructor in each class.
___________________________________________________________________________
APPLICATIONS OF DATABASE
1.Educational Institutions
For storing the details of students - address, fees, marks etc.
2.Banking
For storing customer information, banking transactions etc.
3.Rail and Airlines
For reservations and schedule information.
4.Human Resources
For storing information about employees, salaries etc.
5.Medical
For storing the patients records.
DATA
Data is a collection of facts, figures or statistics, which is yet to be processed.
Example
Marks of the students
INFORMATION
Information is the processed data with definite meaning.
Example
Marks card of the student which gives the total marks, percentage and the result.
Note: Data is the raw material while information is the processed data.
DBMS USERS
1.Database designers
2.Application programmers
3.Database Administrator (DBA)
4.End users
DATA ABSTRACTION
Hiding background details and exhibiting only essential features.
There are three levels of data abstraction - internal, conceptual, and external levels.
1.Internal level/Physical level
It describes how the data is physically stored and organized on the storage medium.
2.Conceptual level/Logical level
Describes the type of data is stored and the relationship among the data.
3.External level/View level
It permits users to access data in a way that is customised according to their needs.
DATA INDEPENDENCE
Data independence is an ability of a database to modify a schema definition at one level
without affecting schema in the next higher level.
Note: Schema is the structure of a database.
Two types of data independence are:
1.Logical data independence
It refers to the ability to modify the conceptual level schema without affecting external level
schema.
2.Physical data independence
It refers to the ability to modify the physical level schema without affecting the conceptual
level schema.
DATABASE TERMS
1.File
File is the basic unit of storage in computer system.
2.Table
A table is a collection of data organised in terms of rows and columns.
3.Record/Tuple
Each row of a table is called as a record or tuple.
4.Field/Attribute
Each column is identified by a distinct header called attribute or field.
5.Domain
Set of values for an attribute in that column.
6.Entity
Entity represents object or table or class.
Note: Weak entity is an entity that depends on another entity. Double rectangle represents
weak entity.
Salary Loan
2)Attribute:
Describes property of an entity and is represented using ellipse.
Example: Name, Age, Address etc. of an entity Student
Types of attributes:
a) Key Attribute:
Key attribute represents the main property of an Entity. It is used to represent Primary
key. Ellipse with underlying lines represent Key Attribute.
b) Composite Attribute:
An attribute can also have their own attributes.
3.Relationship:
A relationship describes relations between entities and represented using rhombus.
c) Many To One:
Many instances of an entity are associated with only one instance of another entity.
d)Many to Many:
Many instances of an entity are associated with many instances of another entity.
KEYS
It is used to establish and identify relationship between tables or to identify each record in a
table.
1)Candidate key
All the attributes/properties used to identify each record uniquely are called as candidate
keys.
Example
STUDENT(Reg.no, Aadhar.no,Name, Comb, Marks)
Reg.no and Aadhar.no are the candidate keys
2)Primary key/Super key
Primary key is a key that uniquely identify each record in a table.
Example
STUDENT(Reg.no, Name, Comb, Marks).
Reg.no is the primary key
3)Alternate key/ Secondary key
Candidate keys which are not selected as the primary key are called alternate key.
Example
STUDENT(Reg.no, Aadhar.no, Name, Comb, Marks)
Aadhar.no is alternate key since it isn’t selected as primary key.
4)Foreign key
A foreign key is an attribute that appears as a non-key attribute in one table and as a primary
key attribute in another table.
Example
Employee(Emop_id,name,Dept_id,address)
Department(Dept_id,Dept_name,Designation)
Dept_id is the foreign key.
5)Composite key
Two or more attributes are clubbed together to uniquely identify each record in a table.
DATABASE MODEL
A database model or a data model is an abstract model that describes how the data is
represented and used.
1)Hierarchical Model
a) Data is organized in a tree-like structure.
b) There is parent node and a child node following a hierarchy.
c) Parent node may have many child nodes but every child node will have only one parent
node.
Advantage
Faster retrieval and updating of records.
Disadvantage
The Hierarchy and its link are permanently established and cannot be modified.
2)Network Model
a) Data is organized in a graph like structure.
a) No Hierarchy followed
b) All the nodes are connected to each other using links.
Advantage
Parent node can have many child modes and a child can also have many parent nodes
enabling many-to-many relationships.
Disadvantage
Since it has many links, the model is complicated.
3)Relational Model
a) Data is organized in the form of tables.
b) There are no physical links.
c) The tables are connected using common attribute
Advantage
Programmer Friendly
FILE ORGANIZATION
Systematic arrangement of the contents of the file for effective access.
1)Serial File Organization
Records are arranged one after the other in the order of their entry into the file.
Advantage
Fast access to next records in sequence.
Disadvantage
Updating consumes time.
2)Sequential File Organization
Records are stored in ascending or descending order determined by the key-field.
Advantage
Easy to design
Disadvantage
It should be sorted always
3.Random/ Direct Access File Organization
a) Records are stored in random order within the file.
b) Record-key is mapped to the record’s address by hashing algorithm.
Advantage
Faster record access
Disadvantage
Expensive
4.Indexed Sequential Access Method (ISAM)
a) Hybrid between sequential and direct access file organization.
b) The records within the file are stored sequentially.
c) Direct access to individual records is possible through an index.
Advantages
1. Use of sequential processing techniques (Sequential Access) when the activity ratio is
high.
2. Use of Direct record accessing techniques (Direct Access) when the activity ratio is
low.
Disadvantages
Extra storage space and processing time for the indexing.
DATA PROCESSING
The process of converting data into meaningful information is called data processing.
Data Processing Cycle
The data processing cycle consists of five steps.
1) Input
2) Processing
3) Storage
4) Output
5) Communication
1) Input: Input is any kind of data – letters, numbers, symbols, images etc. (raw material) put
into the computer system.
2) Processing: It is a series of actions or operations performed on the input data to generate
outputs.
3) Storage: Data and information must be stored in the secondary storage medium like hard
disk, pen drive etc. so that it can be accessed later.
4) Output: The result obtained after processing the data must be presented to the user in the
form of hardcopy or softcopy.
5) Communication: Information generated is transferred to the destinations via network
technology.
DATA WAREHOUSE
A data warehouse is a repository of an organisation’s electronically stored data.
Fundamental Stages of Data Warehouse
1.Offline Database
At this stage, data is transferred from the operational systems to an offline server for backup.
2.Offline Data Warehouse
At this stage, Data is updated frequently (weekly, monthly, etc.)
3.Real-Time Data Warehouse
At this stage, data warehouses are updated every time a transaction happens.
4.Integrated Data Warehouse
At this stage, the Data Warehouse generates transactions that are forwarded to the operational
system so that both the systems are in synchronization.
Components Of Data Warehouses
1)Data sources: Any information pertaining to the management/organization.
2)Data transformation: Data from data sources undergoes cleaning and standardizing
process.
3)Reporting: Data must be available to the organization’s staff in report-oriented structure
4)Metadata: It represents ‘data about data’. It is used to inform operators/users of the data
warehouses about its status.
5)Operations: Loading, updating and extraction are some of the operations performed on
Data Warehouses.
Advantages of Data Warehouses
1. Helps in extracting various reports.
2. Easy Analysis of information
3. Increases productivity
4. Able to combine data from different sources
5. Queries can be made simpler
Disadvantages of Data Warehouses
1. Extracting, cleaning and loading data could be time consuming
2. Can get outdated quickly
3. Requires training to end-users
4. Security Issues may arise
5. Expensive
DATA MINING
The discovery of knowledge from the collected data is called data mining.
Stages
1.Selection- Segmenting the data according to some criteria
2.Preprocessing - Removal of unwanted information
3.Tranformation-The data is made useable and navigable
4.Interpretation and Evaluation - The patterns identified by the system are interpreted into
knowledge which can be used to support human decision-making.
__________________________________________________________________________
SQL COMMANDS
There are four different types of SQL commands.
1. DDL(Data Definition Language)
2. DML(Data Manipulation Language)
3. DCL(Data Control Language)
4. TCL(Transaction Control Language)
1.DDL(Data Definition Language)
DDL is a language which creates and maintains physical data structure.
a) CREATE TABLE COMMAND
This is used to create a new table.
Syntax
CREATE TABLE tablename
(columnName1 datatype,columnName2 datatype,
columnName3 datatype, ..................... ,
columnNameN datatype
PRIMARY KEY (one or more columns)
);
Example
CREATE TABLE EMPLOYEE(ID NUMBER(6), NAME VARCHAR2(30), DESG
VARCHAR2(10), SALARY NUMBER(3) PRIMARY KEY(ID));
b) ALTER COMMAND
The table can be modified or changed by using the ALTER command.
Syntax
ALTER TABLE tablename MODIFY/ADD(columname datatype, columnname datatype,
….);
Example
1)ALTER TABLE EMPLOYEE MODIFY SALARY NUMBER (7);
2) ALTER TABLE EMPLOYEE ADD ADDRESS VARCHAR2(50);
c) DROP COMMAND
The SQL DROP command statement is used to remove a table along with the data.
Syntax
DROP TABLE tablename;
Example
DROP TABLE EMPLOYEE;
2.DML(Data Manipulation Language)
DML commands enables users to access, insert, update and delete data.
a)INSERT
This command is used to add new rows of data to a table in the database.
SYNTAX
INSERT INTO Tablename (column1, column2,……, column n) VALUES (value1, value2,
……,value n);
Example
INSERT INTO EMPLOYEE(ID, NAME , DESG ,SALARY) VALUES (12,
‘aaaa’,’AE’,32000);
b)SELECT
SELECT statement is used to retrieve data from a database table.
SYNTAX
SELECT column1, column2,…….column n FROM tablename;
Example : SELECT ID,NAME FROM EMPLOYEE;
Note: To fetch all rows the syntax and example are as follows
SYNTAX
Example :SELECT * FROM EMPLOYEE;
SELECT * FROM tablename;
c)UPDATE
The SQL UPDATE query is used to modify the existing records in a table. We can use
WHERE clause with UPDATE query to update selected rows.
SYNTAX
UPDATE tablename SET column1 = value1, column 2 = value2,……… WHERE
(CONDITION);
Example
UPDATE EMPLOYEE SET SALARY = 40000 WHERE ID= 123;
d)DELETE
DELETE query is used to delete the existing records from a table.
Syntax
DELETE FROM tablename WHERE condition;
Example
DELETE FROM EMPLOYEE WHERE ID=3
3.DCL (Data Control Language)
DCL commands are used for providing security to the database.l
OPERATORS IN SQL
1. Arithmetic operators
Suppose variable ‘a’ holds 40 and variable ‘b’ holds 10.
2. Comparison Operators
Suppose variable ‘a’ holds 10 and variable ‘b’ holds 40.
GROUP FUNCTIONS OF SQL
1.SQL MAX(): This function is used to get the maximum value from a column.
Example : SELECT MAX (salary) FROM employee;
2.SQL MIN(): This function is used to get the minimum value from a column.
Example : SELECT MIN (salary) FROM employee;
3. SQL AVG(): This function is used to get the average from a column.
Example : SELECT AVG (salary) FROM employee;
4. SQL SUM(): This function is used to get the sum of a numeric column.
Example : SELECT SUM (salary) FROM employee;
5. SQL COUNT (): This function returns the number of rows in the table.
Example : SELECT COUNT (*) FROM employee
ORDER BY & GROUP BY
1.Order By clause is used to sort the data in ascending or descending order, based on one or
more columns.
Syntax:
SELECT column-list FROM table_name
WHERE [condition]
[ORDER BY column1, column2][ASC | DESC];
2.Group By is used to arrange identical data into groups
Syntax
SELECT column1, column2 FROM table_name
WHERE [ condition]
GROUP BY column1, column2
___________________________________________________________________________