Hsslive Xii Comp App Commerce Full Notes by Jose Mathew
Hsslive Xii Comp App Commerce Full Notes by Jose Mathew
in ®
Chapter 1
Review of C++ Programming
Basics of C++
Character set - Characters used in C++ programming. A-Z, a-z, 0-9, Special characters
Keywords : Reserved words. Words that have special meaning. Ex: break, for, if ...
Identifiers : User defined words.
Rules for naming Identifiers
First character should be letter or underscore(_)
Should not be keyword
Special characters including white space, other than underscore cannot be used.
Upper case and lower case are different
Valid Identifiers
Basic_pay, Num1, _Num , A etc.
Invalid Identifiers:
Basic pay // white space cannot be used
1stNum // cannot start with number
while //keyword cannot be used
Literals : Values that do not change throughout the program. There are four types of literals
Integer Literals – Numbers that do not have decimal point and fractional part Ex: 12
Floating point literals – Numbers with decimal point and fractional part Ex: 3.14
Character Literal – Single characters enclosed between singe quotes Ex: ‘A’, ‘9’
String Literal – Characters enclosed in double quotes. Ex: “hello”, “123”
Punctuators: Special Symbols that have special meaning. Ex: {, [, ; etc.
Operators : Symbols that represents an action.
+, -, *, /, %, - Arithmetic operators
<, >, <=, >=, ==, != - Relational operators
&&, ||, ! - Logical operators
>>, << - Extraction operator and Insertion operators
= Assignment operator
++, -- increment and decrement operators
Expressions
Data types
Data type specifies the nature and type of data. The fundamental data types are
void - 0 byte
char - 1 byte
int - 4 bytes
float - 4 bytes
double - 8 bytes
Join Telegram Channel: https://t.me/hsslive Downloaded from www.Hsslive.in ®
Type modifiers
Keywords that change the size, range and precision of fundamental data types. The type modifiers
in C++ are signed, unsigned, short, long.
Type conversion
There are two types of conversion i) Implicit type conversion (Type Promotion)
ii) Explicit Type conversion (Type Casting)
Type promotion is done by the compiler automatically. Ex: 5 / 2.0 Here 5 is converted to 5.0. That
is conversion from int to float
Type casting is done explicitly by the user. Ex: 5 / (int)2.0 Here 2.0 is explicitly converted to
integer 2.
C++ Statements
Syntax:
datatype variable_name [,variable_name2 .......variable_name n] ;
Example:
int A;
float height; char ch;
Syntax:
variable_name = constant;
variable_name1 = variable_name 2;
variable_name = Expression
NB: The Left hand side of assignment statement is always a variable.
Example:
a = 10;
x = y;
z = x + y;
Syntax: stream_object>>variable_name;
Example: cin>>A;
Syntax: stream_object<<variable_name;
Example: cin<<A;
Preprocessor directives : Statements that are processed before compilation of the program.
Ex: #include, #define, #undef
Join Telegram Channel: https://t.me/hsslive Downloaded from www.Hsslive.in ®
Header files – Library files that contain pre defined objects, functions and variables. Header
files are included using #include statement.
Main Function : The execution of the program starts and ends with in the main function. All the
statements written in the main function constitutes the body of the main function.
Control Statements
Statement that change the normal flow of execution. There are two types.
i) Decision statements / Selection Statements
ii) Looping Statements / Iteration Statements
Decision Statements
1. if
syntax: if(condition) // Working: The condition is evaluated and if it
{ is true the statement block will be executed
Statement block;
}
2. if .... else
Syntax:
if(condition)
{ // Working: The condition is evaluated and if it is
Statement block1; true Statement block 1 will be executed and if
} the condition is false Statement block 2 will be
else executed.
{
Statement block 2;
}
if(condition 1)
{ // Working: The condition 1 is evaluated and if it is
Statement block1; true Statement block 1 will be executed and if
} the condition is false condition 2 will be evaluated
else if (condition 2) and if it is true Statement block 2 will be executed
{ and so on ...and if none of the condition is true
Statement block 2; Statement block n will be executed..
}
........
else
Statement block n
4. switch statement
switch (expression)
case value1: Statement block 1; // Working : The expression is evaluated and the
break; value is compared with each of the cases
case value 2: Statement block 2; and if a match is found the corresponding
break; case is executed. If there is no match
........ with any values the statements in the
Join Telegram Channel: https://t.me/hsslive Downloaded from www.Hsslive.in ®
NB: All programs written using switch can be written using if ... else if ladder. But all programs
written using else if ladder cannot be converted to switch. Conditions involving only equality
testing can be written using switch. Additionally, the first operand of the condition should be same
variable or expression and the second operand should be integer or character constants.
Looping Statements
Components of a Loop
Initialisation
Test condition
Body of Loop
Updation
Syntax
Nested Loops
}
Output
1 1 1 2
2 1 2 2
3 1 3 2
4 1 4 2
Jump Statements
Statements that transfer the program control from one place to another are called jump statements.
They are return , goto , break and continue statements.
return
The return statement is used to transfer control back to the calling program or to come out of a
function.
goto
The goto statement can transfer the program control to anywhere in the function. The target
destination of a goto statement is marked by a label, which is an identifier.
Syntax:
goto label;
............;
............;
label: ............;
............;
break statement
It transfers the program control outside the switch block or the immediate enclosing loop. Execution
continues from the statement immediately after the control structure.
Continue statement
It is a jump statement that skip a part of the loop and continue with the next iteration.
continue break
Used within loops only Used within switch and loops.
Takes the control to the beginning of the Takes the control out of the switch or loop
loop forcing next iteration Program control goes out even if test
Control goes out of loop only when the test expression is true
expression is false
Join Telegram Channel: https://t.me/hsslive Downloaded from www.Hsslive.in ®
Example:
for(i=1;i<=10;i++) for(i=1;i<=10;i++)
{ {
if (i==5) if (i==5)
continue; break;
cout<<i<<”\t”; cout<<i<<”\t”;
} }
Output: Output:
1 2 3 4 6 7 8 9 10 1 2 3 4
Conversion examples
Chapter 2 – Arrays
Arrays – Definition
An Array is a set of elements of the same type stored in contiguous memory locations.
Array is a way to store many data items using a single variable name.
Declaration
Syntax
datatype arrayname[size]
Example
int mark[65];
float height[100];
char name[20];
int Num[5];
Array Initialisation
Array can be initialised during declaration.
int score[ 5 ] = {98, 87, 92, 79, 85};
Consider an array int Num[10]. We can read elements to each location from the
keyboard using the following code
cin>> Num[0];
cin>> Num[1]; etc...
Join Telegram Channel: https://t.me/hsslive Downloaded from www.Hsslive.in ®
A better way to use arrays is with loops. We can read data to all the locations of the
array using the following code.
Operations on Arrays
Traversal
Printing each element, Finding the sum of elements etc. are examples of array traversal
cin statement will read only up to the first occurrence of white space. Ie, if we input
a string ‘Sachin Tendulkar’ the array my_name will only contain ‘Sachin’.
This problem can be solved by using a console function gets() which will read an entire
line including white space.
gets()
The function gets() is a console input function used to accept a string of characters
including white spaces from the standard input device (keyboard) and store it in a
character array.
gets(character_array_name);
Ex: gets(my_name)
Join Telegram Channel: https://t.me/hsslive Downloaded from www.Hsslive.in ®
puts()
The function puts() is a console output function used to display a string data on the
standard output device (monitor). Its syntax is:
puts(string_data)
In order to use these functions we have to include the header file cstdio in our program
Join Telegram Channel: https://t.me/hsslive Downloaded from www.Hsslive.in ®
Chapter 3 Functions
Modularization
The process of breaking large programs into smaller sub programs is called modularization.
Functions
1. getchar() -- returns the character entered from the standard input (keyboard)
char ch;
ch = getchar();
2. putchar() – displays the character given as argument to the standard output (monitor)
char ch = ‘Z’ // assigns ‘Z’ to variable ch
putchar(ch); //displays ‘Z’ on the screen
putchar(65); // displays ‘A’ on the screen
putchar(97) ; // displays ‘a’ on the screen
These functions allow a stream of bytes (data) to flow between memory and objects
Header file : <iostream>
Input functions : 1. get()
2. getline()
Output functions: 1. put()
2. write()
get() – can accept a single character or multiple characters through the keyboard
char ch, str[10];
cin.get(ch); //accepts a character and stores in ch
cin.get(str,10); //accepts a string of maximum 10 characters
getline() -- It accepts a string through the keyboard. The delimiter will be Enter key, the
number of characters or a specified character.
char ch, str[10];
int len;
cin.getline(str,len);
cin.getline(str,len,ch);
Mathematical Functions
int x = 5, y = 3, z;
z = pow(x, y); // 5 3 = 5 * 5 * 5
cout << z; // displays 125
String Functions
Character functions
User-defined Functions
Arguments
Local variables and functions : Variables and functions declared with in a block or
another function. They can be used only within that block or function in which it is defined.
Global variables and functions : Variables and functions declared outside every
function. They can be accessed throughout the program.
Software Ports
FTP 20 & 21
SSH 22
SMTP 25
DNS 53
HTTP 80
POP3 110
HTTPS 443
1. All browsers store the IP addresses of the recently visited websites in its cache.
Therefore, the browser first searches its local memory (mini cache) to see whether it has
the IP address of this domain. If found, the browser uses it.
2. If it is not found in the browser cache, it checks the operating system's local cache for
the IP address.
3. If it is not found there, it searches the DNS server of the local ISP.
4. In the absence of the domain name in the ISP's DNS server, the ISP's DNS server
initiates a recursive search starting from the root server till it receives the IP address.
5. The ISP's DNS server returns this IP address to the browser.
6. The browser connects to the web server using the IP address of hscap.kerala.gov.in and
the webpage is displayed in the browser window. If the IP address is not found, it returns
the message 'Server not found' in the browser window.
• The content and layout of a web • The content and layout may
page is fixed. change during run time.
• Static web pages never use • Database is used to generate
databases. dynamic content through queries.
• Static web pages directly run on the • Dynamic web page runs on the
browser and do not require any server side application program and
server side application program. displays the results.
• Static web pages are easy to • Dynamic web page development
develop. requires programming skills.
Scripts are small program elements embedded in Webpages. Scripts may be executed by
the client or server.
• Script is copied to the client browser • Script remains in the web server
• Script is executed in the client • Script is executed in the web server
browser • Server side scripts are usually used
• Client side scripts are mainly used to connect to databases
for validation of data at the client. • Server side scripting cannot be
• Users can block client side scripting blocked by a user
• The type and version of the web • The features of the web browser
browser affects the working of a does not affect the working of server
client side script side script
Most widely used language to write web pages. Developed by Tim Berners Lee.
HTML Tags
Tags are commands used in HTML document to tell the browser how to format and
organise your web page.
Every tag consists of a tag name enclosed in angle brackets.
HTML is case insensitive language
Tags which have opening and closing tags are called Container Tags
Ex: <BODY> </BODY>, <HTML> .... </HTML>
Tags which have only opening tag is called Empty tag
Ex: <BR>, <HR>, <IMG> ...
Attributes of Tag
Parameters provided with opening tag to give additional information
about formatting are called Attributes
Ex <BODY bgcolor = ‘Yellow’>
Usage
attribute='value' or attribute="value“
Attributes
a. Dir : Specifies the Direction of the text
values : ltr , rtl
b. Lang : Specifies the language used with in the document.
values : En, Fr, De, It, Es, Ar, Hi, Ru etc…
Attributes
a. Background – specifies a background image
<BODY Background = "Sky.jpg">
b. Bgcolor – Specifies a background color
<BODY Bgcolor = "grey">
value can be colour name or a hexadecimal colour code
c. Text - Specifies the colour of the text
Link: This attribute specifies the colour of the hyperlinks that are not visited by the
viewer. The default colour for Link attribute is blue.
Alink: It specifies the colour of the active hyperlink. The default Alink colour is
green.
Vlink: It specifies the colour of the hyperlink which is already visited by the viewer.
The default colour for Vlink is purple.
e. Leftmargin - Specifies the amount of space for left margin
f. Topmargin – Specifies the amount of space for top margin
Common Tags
<H1>, <H2>, <H3>, <H4>, <H5> and <H6> - Heading tags – Six different styles
Attributes ---- Align - left, right, center
<P> tag - Creating paragraphs
Align – left, right, center, justify
<BR> tag - Inserting line break – It is an Empty tag
<HR> tag - creating horizontal line – Empty tag
Attributes: size (thickness ) in pixels, 72 pixels= 1 inch
width (length) pixel or percentage
noshade – (boolean)shaded line or not
color - color of the line
<CENTER> tag - Centering the content
<IMG> Tag – For Inserting images Ex: <IMG Src=sunset.jpg width=200 height =200>
Attributes
Src - Specifies the file name of the image. This attribute is compulsory
Width - width of the image
Height - Height of the image
Vspace and Hspace – Space between the image and text that follows
Border - Gives a border for the image
Align- Top, Middle, Bottom, left, right
Alt – Display an alternate text – Useful when the browser does not support
images.
There are three kinds of lists in HTML – unordered lists, ordered lists and definition lists.
a. Unordered lists
Unordered lists display a bullet or other graphic in front of each item in the list.
Tags used
<UL> and <LI>
<UL> marks the beginning of the list and </UL> marks the end of the list. Each item is given using
<LI> tag.
Type attribute of <UL> determines the type of bullet that appears before each list item and the
values can be disc, circle or square
Example
<UL Type=”square”>
<LI> RAM </LI>
<LI> Hard Disk </LI>
<LI> Mother Board </LI>
<LI> Processor </LI>
</UL>
b. Ordered List
Example
<OL Type= "I" Start= "5">
<LI> Registers </LI>
<LI> Cache </LI>
<LI> RAM </LI>
<LI> Hard Disk </LI>
</OL>
c. Definition lists
Tags:
<DL> - Defines the list
<DT> - Defines a Term
<DD> - Defines a definition
Example
Links in HTML
A hyperlink is an element, a text, or an image in a web page that we can click on, and
move to another document or another section of the same document.
Two Types of Links
1.Internal Links: Links from one section to another section of the same page
2.External Link: Link from one web page to another web page
<A> tag is used to create hyperlinks. This tag is called anchor tag.
Href is the main attribute of <A> tag and it means hyper reference. The value of this
attribute is the URL of the document (address of the web page/site) to which hyperlink is
provided.
Examples
<A Href= "http://www.dhsekerala.gov.in">Higher Secondary </A>
<A Href=”address.html”> School Address </A>
Attributes of <A> tag
Creating Internal Links
Name – This attribute of <A> tag is used to give name for sections while creating Internal
links
Example
<A Name= "Introduction"> INTRODUCTION </A>
<A Name= "Air"> Air Pollution </A>
We can link to the above sections using the links created as follows
<A Href = "#Introduction"> Go to Introduction </A>
<A Href = "#Air"> Air pollution </A>
<EMBED> tag
The easiest way to add music or video to the web page is with a special HTML tag,
called <EMBED> .
Tables in HTML
<TABLE> Attributes
<TR> Attributes
Align -- Aligns the content of all the cells in a row, left right or center
Valign -- Specifies the vertical alignment. Values are top, middle, bottom, baseline
Example
<HTML>
<HEAD> <TITLE> Students Registration </TITLE>
</HEAD>
<BODY>
<TABLE Border= "1" Cellspacing= "3" Cellpadding= "5">
<TR>
<TH Colspan= "3"> No. of Registered Students </TH>
</TR>
<TR>
<TH Rowspan= "2"> Year </TH>
<TD> 2014 </TD> <TD> 75 </TD>
</TR>
<TR>
<TD> 2015 </TD> <TD> 88 </TD>
</TR>
</TABLE>
<BODY>
<HTML>
Yes.... A window can be divided into frames and we can display webpages in each of
these frames
<FRAMESET> is a container tag for partitioning the browser window into different frame
sections.
Attributes of <FRAMESET>
<FRAMESET Cols = "30%,50%,*"> -- Divides the window into three frames, first
one being 30%, second one 50% and rest of the space for the third frame
<FRAME> tag is an empty tag and it defines the frames inside the <FRAMESET>
Attributes
Src : Src specifies the URL of the document to be loaded in the frame.
Scrolling : When the content inside a frame exceeds the frame size, a scrollbar appears
depending upon the value of the Scrolling attribute.
Example
<HTML>
<HEAD> <TITLE> A simple Frameset </TITLE> </HEAD>
<FRAMESET Rows= "20%, 30%, 50%">
<FRAME Src= "sampleframe1.html">
<FRAME Src= "sampleframe2.html">
<FRAME Src= "sampleframe3.html">
</FRAMESET>
</HTML>
Nesting of Frameset
Forms in HTML
Forms are used to collect data from the user.
There are various Form controls like text fields, textarea fields, drop-down
menus, radio buttons, checkboxes, etc.
<FORM> tag
An HTML Form starts with <FORM> and ends with </FORM> tag.
1. Action : It specifies the URL of the Form handler, which is ready to process
the received data.
2. Method : It mentions the method used to upload data. The most frequently
used Methods are Get and Post.
3. Target : It specifies the target window or frame where the result of the script
will be displayed.
<INPUT> Tag
The <INPUT> tag is an empty tag that can be used to make different types of
controls such as Text Box, Radio Button, Submit Button etc.
5. Maxlength : It limits the number of characters that the user can type
into the field.
Example:
Example
Attributes
Rows : Number of lines in a textarea
Cols : Number of characters in each line
Name : Name of the textarea
<SELECT> tag
A select box, also called drop down box, provides a list of various
options in the form of a drop down list, from where a user can select
one or more options.
The options in the list are specified using <OPTION> tag
Chapter 6
Javascript
Variables in Javascript
Operators in Javascript
Arithmetic Operators - Addition( + ), Subtraction (-), Multiplication (*), Division (/), Modulus
(Division Remainder)(%), Increment (++), Decrement(--)
Assignment Operators – Assignment (=) , Arithmatic Assignment (+=, -=, *=, /=, %=)
Relational Operators – Equal (==), Greater than (>), Less than (<), Greater than or equal (>=),
Less than or equal(<=), Not equal(!=)
Logical Operators – Logical AND (&&), Logical OR (||), Logical NOT (!)
String Addition operator - The operator + is also used to add two strings
var x, y;
x = “A good beginning ”;
y = “makes a good ending.”;
z = x + y; // z = “A good beginning makes a good ending.”
var x, y;
x = “23”;
y = 5;
z = x + y; // z=235
3. switch
Syntax
switch (expression)
{
case value1:
statements;
break;
case value2:
statements;
break;
.................
.................
default:
statements;
}
Loops
for loop
Syntax: Example
<SCRIPT Language= "JavaScript">
for(initialisation; test_expression; update_statement)
var i, s;
{
for (i=1; i<=10; i++)
statements;
{
}
s = i*i;
document.write(s);
document.write("<BR>");
}
</SCRIPT>
while loop
Syntax:
while (test_expression)
{
statements;
}
Example
1. alert()
3. toUpperCase()
This function returns the upper case form of the given string.
var x, y;
x = “JavaScript”;
y = x.toUpperCase();
alert(y); // displays JAVASCRIPT
4. toLowerCase()
It returns the lower case form of the given string.
5. charAt()
It returns the character at a particular position.
var x;
x = “JavaScript”;
y = x.charAt(4);
alert(y); // displays S, because it is the character at index 4. index starts at 0
6. length property
var x, n;
x = “JavaScript”;
n = x.length;
alert(n); // displays 10, the string contains 10 characters
1. Inside <BODY>
Scripts can be included in the body of the document any number of times using the
<script> tag.
2. Inside <HEAD>
Scripts can be included in the head section of the webpage. Usually javascript
functions are defined in the head section of the document.
Chapter 7
Web Hosting
Web hosting is the service of providing storage space in a web server to serve files for a website to
be made available on the Internet.
a. Shared Hosting - Many websites are stored on one single web server and they share resources
like RAM and CPU. Shared servers are cheaper and easy to use.
b. Dedicated hosting - Dedicated web hosting is the hosting where one website uses the entire
resources of the web server. This type is expensive but offer guaranteed performance.
c. Virtual Private Server - A Virtual Private Server (VPS) is a physical server that is virtually
partitioned into several servers using the virtualization technology. Each VPS works similar to a
dedicated server.
Some popular server virtualization softwares are VMware, Virtualbox, FreeVPS, User-mode
Linux, Microsoft Hyper-V, etc.
Once the type of hosting is decided, hosting space has to be purchased from a web hosting service
provider.
The next step in web hosting is selecting a domain name for the website and registering it. For this
we need to check whether the chosen domain name is available. This can be done with facility that
checks the domain database of ICANN (Internet Consortium for Assigned Names and Numbers). If
the domain name is available we can proceed with the registration by providing the required details.
After registration the domain name has to be connected with the IP Address of the web server. This
is done using 'A record' (Address record) of the domain. An 'A record' is used to store the IP
address of a web server connected to a domain name.
The FTP client software is used to transfer the files of our website from our computer to the Web
server. FTP is the protocol used to transfer files from one computer to another on the Internet.
The popular FTP client software are FileZilla, CuteFTP, SmartFTP, etc.
Free Hosting
Free hosting provides web hosting services free of charge. The service provider displays
advertisements in the websites hosted to meet the expenses.
Content Management System (CMS) is a web based software system which is capable of creating,
administering and publishing websites. CMS provides an easy way to design and manage attractive
websites.
Some of the popular CMS software are WordPress, Drupal and Joomla!
Responsive web design is designing web sites that adapt itself to different screens of various screen
sizes and resolution. By this the same website will adjust itself to be displayed on mobile phone,
tablets, laptops or TV screen of different sizes.
Chapter 8
Database Management Systems
Database
Organised collection of interrelated data
DBMS
Collection of interrelated data and a set of programs to manipulate the data
Advantaged of DBMS
• Control data redundancy – Redundancy means duplication of data. Database system do not
maintain redundant data
• Data consistency – Redundancy leads to inconsistency. By controlling redundancy consistency
is obtained
• Efficient data access - Data can be stored and retrieved efficiently
• Data integrity – Ensure completeness and correctness of data
• Data security – Data is protected against unauthorised access and accidental updation or loss.
• Sharing of data – Data can be shared between various applications and users
• Crash recovery – DBMS has mechanism for data recovery after system crash
• Enforcement of standards – Standards can be defined for data formats to facilitate exchange
of data
Components of DBMS
• Hardware - Computer system used for storage and retrieval of the database.
• Software – DBMS,application programs and utilities.
• Data – The operational data and the meta-data (data about data). For effective storage and
retrieval of information, data is organized as fields, records and files.
Fields - A field is the smallest unit of stored data.
Record - A record is a collection of related fields.
File - A file is a collection of same type of records.
• Users – People who use the database
• Procedures - Instructions and rules that govern the design and use of the database.
Data Abstraction
Data Abstraction is the process of hiding the internal design complexities of the DBMS
Implemented in three levels
Physical Level – Defines how data is stored
Logical Level – Defines what data is stored
View Level – Describes only part of the entire database
Data Independence
Ability to modify the the scheme in one level without affecting the higher level
Physical Data Independence - ability to modify the physical level scheme without modifying the
application programs
Join Telegram Channel: https://t.me/hsslive Downloaded from www.Hsslive.in ®
Logical Data Independence - ability to modify the logical level scheme without modifying the
application programs
Users of Database
1. Database Administrator (DBA) – The person who has central control of the database.
Responsibilities of DBA
--> Design of the conceptual and physical schemas
-->Security and authorization
-->Data availability and recovery from failures
2. Application programmers - Computer professionals who interact with the DBMS
through application programs.
3. Sophisticated users - engineers, scientists, business analysts, and others who interact
with the systems through their own queries.
4. Naive users – Interact with Database through interfaces provided by application
programs.
Relational Data Model
A conceptual tool for representing data, relationship between data and their meaning.
Most of the database follows relational model and hence known as RDBMS (Relational Database
Management System). Introduced by E.F.Codd.
Relational Algebra
SELECT (σ)
PROJECT (π)
Examples
UNION (U)
UNION Operation returns a relation containing tuples in either or both the relations. It is a binary
operation.
r1 U r2
To apply Union operations the relations should be union compatible. That is, the degree of both the
relations should be same and the domain of the corresponding attributes should be identical.
Ex:
CRICKET
FOOTBAL
if we want to find the list of students who play either cricket or football of both we can get it by the
expression
CRICKET U FOOTBALL
INTERSECTION (⋂)
INTERSECTION returns a relation containing tuples that are common to both the relations. The
result of CRICKET ⋂ FOOTBALL will be the following relation.
SET DIFFERENCE ( ─ )
SET DIFFERENCE operation is also a binary operation and it returns a relation containing the
tuples in the first relation but not in the second relation.
CRICKET ─ FOOTBALL
will return the details of students who play cricket but not football
The union compatibility is applicable for INTERSECTION and SET DIFFERENCE operations
also.
CARTESIAN PRODUCT returns a relation consisting of all possible combinations of tuples from
two relations. The degree of the resultant relation will be the sum of the degrees of both the relation
and the cardinality of the resultant relation will be the product of the cardinality of both the relation.
STUDENT
AdmNo Roll No Name Batch
101 24 SACHIN S2
102 14 RAHUL C2
103 4 FATHIMA H2
Degree = 4 Cardinality = 3
TEACHER
Degree = 3 Cardinality = 2
STUDENT X TEACHER
Degree = 4 + 3 = 7 Cardinality = 3 x 2 = 6
Notes by Jose Mathew, GHSS Padiyoor
Join Telegram Channel: https://t.me/hsslive Downloaded from www.Hsslive.in ®
Chapter 9
Structured Query Language (SQL)
SQL(Structured Query Language) is a database language developed by IBM. It was originally
called Sequel and later renamed to SQL.
Components of SQL
Data Definition Language (DDL) – DDL provides commands for dealing with the structure of the
RDBMS. Ex: CREATE, ALTER, DROP ...
Data Manipulation Language (DML) – DML provides commands for manipulation of data in the
database. Ex: SELECT, UPDATE, DELETE, INSERT ...
Data Control Language (DCL) – DCL is used to control access to the database. Ex: GRANT,
REVOKE ..
MySQL
Creating Database
Opening database
USE <database_name>;
The SHOW DATABASES command will display all the databases in the system.
MySQL data types are classified into three. Numeric data type, String (Text) data type and DATE
and TIME data type.
Numeric – The commonly used numeric types are INT or INTEGER, DEC or DECIMAL.
INT or INTEGER is used for numbers without fractional part.
DEC(size,D) or DECIMAL(size,D) is used for numbers with fractional part.
NB: size indicates total digits and D indicates number of digits after the decimal point.
String (Text) – A group of characters. Commonly used string data types are CHAR and
VARCHAR.
Join Telegram Channel: https://t.me/hsslive Downloaded from www.Hsslive.in ®
DATE and TIME – DATE is used to store date values in YYYY-MM-DD format and TIME is used
to store time values in HH:MM:SS format
SQL Commands
Usage:
CREATE TABLE <table_name>
(<column_name> <data_type> [<constraint>]
[, <column_name> <data_type> [<constraint>,]
..............................
..............................
);
Example:
CREATE TABLE student
(adm_no INT, name VARCHAR(20), course VARCHAR(15));
Constraints
Constraints are the rules enforced on data that are entered into the column of a table.
Column Constraints
1.NOT NULL - Ensures that a column can never have NULL values. Ie, a column cannot be
empty.
2.AUTO_INCREMENT – The value of the column will be automatically incremented.
3.UNIQUE – Ensures that the column will not have duplicate values. All the values for the column
will be different.
4.PRIMARY KEY – Declares a column as the primary key of the table. PRIMARY KEY implies
NOT NULL and UNIQUE.
5. DEFAULT – Gives a default value for the column.
Table constraints
Usage
DESC <table_name> or DESCRIBE <table_name>
Example
DESC student; or DESCRIBE student;
Usage:
INSERT INTO <table_name> [<column1>,<column2>,...,<columnN>]
VALUES(<value1>,<value2>,...,<valueN>);
Example 1
INSERT INTO student
VALUES (1001,'Alok','M','1998/10/2', 'Science', 480);
Example 2
INSERT INTO student (name, dob, course)
VALUES ('Nike','1998/11/26','Science'); // This command will insert data only to
specified columns.
NB: VALUE clause is the compulsory clause used with INSERT command.
Usage:
SELECT <column_name>[,<column_name>,<column_name>, ...]
FROM <table_name>;
Example1:
SELECT name, course // Displays only name and course columns
FROM student;
Example 2:
SELECT * FROM student; // Displays all the columns because * denotes all columns
NB: Duplicate values in a column can be eliminated while displaying using DISTINCT
keyword.
Example 4: SELECT *
FROM student
WHERE gender='F'; // Displays details of female students
Join Telegram Channel: https://t.me/hsslive Downloaded from www.Hsslive.in ®
LIKE operator is used for pattern matching. Patterns are specified using two special characters %
and _ (underscore), where % (percentage) matches a substring of characters and _ (underscore)
matches a single character.
We can display the tuples in ascending order or descending order by using ORDER BY clause with
the SELECT statement. The column based on which the tuples are arranged should be given along
with the clause.
Example 1: If we want to display the details of student in the order of their names we may write the
query as
SELECT * FROM student ORDER BY name;
Example 2: If we want the details of students in the descending order of marks, the query is
NB: The order is to be specified by using the keyword ASC (for ascending) or DESC (for
descending) along with the column name.
Example 3 : If we need a course-based listing of students in the alphabetical order of their names,
the query is
Aggregate functions are built-in functions that operate on a group of values and return a single
value as result
If we want to apply aggregate functions after grouping tuples based on a group column we can use
the GROUP BY clause.
Example 1: If we want to find the number of students in each batch we need to write
Example 1:
SELECT course, COUNT(*) FROM student
GROUP BY course
HAVING COUNT(*) > 3;
The above query will display all he courses having more than three students.
NB: The FROM clause is the compulsory clause used with SELECT statement. All the other
clauses are optional.
The UPDATE command is used to change the values of one or more columns of all rows or selected
rows. The new data for the column within these rows is given using the keyword SET , which is the
essential clause of UPDATE command.
Join Telegram Channel: https://t.me/hsslive Downloaded from www.Hsslive.in ®
Usage:
UPDATE <table_name>
SET <column_name> = <value> [,<column_name> = <value>,...]
[WHERE <condition>];
Example 2:
UPDATE student SET total_mark=485 WHERE name='Dennis';
This query updates the total mark of Dennis to 485. If the where clause is not given the total mark
of all the students will be changed to 485.
Example 2: To update the total_mark of all the student with the sum of mark1, mark2 and mark3
The DDL command ALTER TABLE is used to modify the structure of a table.
Usage:
ALTER TABLE <table_name>
ADD <column_name> <data_type>[<size>] [<constraint>]
[FIRST | AFTER <column_name>];
Example:
ALTER TABLE student
ADD grade CHAR(2) AFTER dob,
ADD reg_no INTEGER; // Adds two columns grade and reg_no to Student table.
Usage:
ALTER TABLE <table_name>
MODIFY <column_name> <data_type>[<size>] [<constraint>];
Example:
ALTER TABLE student
MODIFY reg_no INTEGER UNIQUE; // the column constraint UNIQUE is updated
for reg_no column
Usage:
ALTER TABLE <table_name>
DROP <column_name>;
Example:
Join Telegram Channel: https://t.me/hsslive Downloaded from www.Hsslive.in ®
Renaming a table
Usage:
ALTER TABLE <table_name>
RENAME TO <new_table_name>;
Example:
ALTER TABLE student
RENAME TO student2021; // The table student is renamed to Student2021
The DML command DELETE is used to remove individual or a set of rows from a table.
Usage:
DELETE FROM <table_name> [WHERE <condition>];
Example 1:
DELETE FROM student2021 WHERE adm_no=1027;
Example 2:
DELETE FROM student2021 WHERE total_mark < 210;
If we do not need a table, it can be removed from the database using DROP TABLE command. If a
table is removed using this command it cannot be recovered later.
Usage:
DROP TABLE <table_name>;
Example:
DROP TABLE student2015;
Nested queries
If a select statement is used within another select statement, it is called Nested Query.
Example: If we want to find out the name of student who got the highest total mark, we need to
write
NB: The aggregate functions can only be used with the SELECT command.
VIEWS
A view is a virtual table that does not exist physically. A view is derived from one or more
base tables. The difference between view and a sub table is that any modification to the view will be
Join Telegram Channel: https://t.me/hsslive Downloaded from www.Hsslive.in ®
reflected in the base table where as a modification of a sub table will not change the content of base
tables.
Creating view
Usage:
CREATE VIEW <view_name>
AS SELECT <column_name1> [,<column_name2],...]
FROM <table_name>
[WHERE <condition>];
Example:
CREATE VIEW commercestudents
AS SELECT * FROM student2021
WHERE course = ‘Commerce’;
If a view is no longer needed, it can be removed from the database with DROP VIEW command
with out affecting the base tables.
Chapter 10
Enterprise Resource Planning
An enterprise is a group of people and other resources working together for a common goal.
ERP
ERP system is a fully integrated business management system covering all functional areas of an
enterprise.
• Financial module – Deals with all financial data and is responsible for generating all
financial documents
• Manufacturing module – Combines technology and business process and provides
information for production
• Production Planning module – Used for optimising the utilization of resources
• HR Module - Focuses on the management of human resources and human capital.
• Inventory control module - Covers processes of maintaining the appropriate level of stock
in the warehouse.
• Purchasing module - Generating purchase order for the supplier, evaluating the supplier,
and billing are made available in this module.
• Marketing module - Marketing module is used for monitoring and tracking customer
orders, increasing customer satisfaction and for eliminating credit risks.
• Sales and distribution module - Sales module deals with important parts of a sales cycle.
• Quality management module - This module is used for managing the quality of the
product.
Business Process Re-engineering (BPR) is the analysis and redesign of work flow within an
enterprise.
Implementation of ERP
ERP Packages
Benefits of ERP
Risks of ERP
1. High cost
2. Time consuming
3. Requirement of additional trained staff
4. Operational and maintenance issues
Product life cycle management is the process of managing the entire life cycle of a product.
The life cycle of a product goes through four stages, Introduction of the product, Growth of the
product, Maturity and Decline.
The success of any enterprise depends on good relationship with its customers. CRM covers
policies used by an enterprise to manage their relationships with customers. Customer Relationship
Management is an approach for creating, maintaining and expanding customer relationships.
The supply chain consists of all the activities associated with moving goods from the
supplier to the customer. Supply Chain Management (SCM) is a systematic approach for managing
supply chain.
Decision Support Systems are interactive, computer-based systems that help users in taking
decisions.
Chapter 11
Trends and Issues in ICT
Mobile Computing
Mobile computing is transmitting and receiving data while moving. It requires portable
devices like laptops, tablets, and smart phones and wireless communication networks.
First Generation (1G) networks refer to the first generation of wireless telephone technology
(mobile telecommunications) developed around 1980. 1G mobile phones were based on the analog
system and provided basic voice facility only.
Second Generation (2G) networks follow the digital system for communication. Multimedia
Messaging Service (MMS ) was introduced. The two popular standards introduced by 2G systems
are Global System for Mobiles (GSM) and Code Division Multiple Access (CDMA).
GSM is the most successful family of cellular standards. The network is identified using the
Subscriber Identity Module (SIM). Users can select a handset of their choice. The two major
technologies used in GSM are General Packet Radio Service (GPRS) and Enhanced Data rates
for GSM Evolution (EDGE).
In Code Division Multiple Access (CDMA) system, several transmitters can send information
simultaneously over a single communication channel. CDMA technology provides better security to
the mobile network.
3G offers higher data rates (speed). Data and voice can be combined. It uses WCDMA (Wideband
Code Division Multiple Access) technology.
A Fourth Generation (4G) system is also called Long Term Evolution (L.T.E.). 4G networks uses
Orthogonal Frequency Division Multiple Access (OFDMA). 4G provides good quality images and
videos than TV.
Fifth Generation (5G) is the emerging step in the evolution of mobile communication. It will be
mainly focusing on IoT(Internet of Things).
Short Message Service (SMS) is a text messaging service that allows exchanging short text
messages. The GSM standard allows to send a message containing up to 160 characters. SMS
messages are exchanged using the protocol called Signalling System No. 7 (SS7).
Multimedia Messaging Service (MMS) is a way to send and receive multimedia messages using
mobile phones. Unlike SMS, MMS does not specify a maximum size for a multimedia message.
The Global Positioning System (GPS) is a satellite based navigation system that is used to locate a
geographical position on earth. GPS is used for vehicle fleet tracking by transporting companies to
track the movement of their trucks. GPS is also used in oil exploration, farming, atmospheric
studies etc.
d. Smart cards
A smart card is a plastic card embedded with a computer chip / memory that stores and transacts
data. A smart card is secure, intelligent it is convenient. SIM, ATM, Credit cards etc are examples.
A mobile operating system is the operating system used in a mobile device. Popular mobile
operating systems are Android from Google, iOS from Apple, BlackBerry OS from BlackBerry
and Windows Phone from Microsoft.
Android is a Linux-based operating system designed mainly for touch screen mobile devices. The
Android OS consists of a kernel based on Linux kernel. The Android code is released under the
Apache License.
ICT in business
Big data analytics is the process of examining large data sets containing a variety of data types to
find hidden patterns, market trends, customer preferences and other useful business information.
The findings is used to take major decisions in business.
Business logistics
Business logistics is the management of the flow of goods/resources from source to destination in
order to meet the requirements of customers or companies. The objective is to ensure the
availability of right products at right time in right quantity at the right place.
Radio Frequency Identification (RFID) technology can be used to identify, track, sort or detect a
wide variety of objects in logistics.
Information security
Information is the most important resources of any organisation. Hence the security of Information
is also very important.
The creative work of people like books, software, music, art, discoveries, inventions etc. Are the
intellectual property and should be protected from unauthorised access. Intellectual Property Right
(IPR)refers to the exclusive right given to a person over the creation of his/her mind, for a period of
time. WIPO ( World Intellectual property organisation) is responsible for IPR. Intellectual
property is divided into two categories - industrial property and copyright.
A. Industrial property - Industrial property right applies to industry, commerce and agricultural
products.It protects patents to inventions, trademarks, industrial designs and geographical
indications.
Patents: A patent is the exclusive rights granted for an invention. An invention means a new
product or process (procedure) involving an inventive step, and capable of industrial a
pplication. The term of every patent in India is 20 years.
Geographical indications: Geographical indications are signs used on goods that have a
specific geographical origin. Some of the popular products with geographical indications
related to Kerala are Aranmula Kannadi and Palakkadan Matta Rice.
B. Copyright - A copyright is a legal right given to the creators for an original work, usually for a
limited period of time. This covers rights for reproduction, communication to the public, adaptation
and translation of the work.
Computer software (source code, databases, websites, etc.) can be copyrighted as a literary work.
Infringement
Unauthorised use of intellectual property rights such as patents, copyrights and trademarks are
called intellectual property infringement.
Patent infringement is caused by using or selling a patented invention without permission from the
patent holder.
Trademark infringement occurs when one party uses a trademark that is identical to a trademark
owned by another party.
Cyber Space
Cyber space is a virtual environment created by computer systems connected to the Internet. This
unregulated space also provides room for criminals.
Cyber Crimes
Cyber Crime is defined as a criminal activity in which computers or computer networks are used as
a tool, target or a place of criminal activity.
A cyber crime can occur from anywhere. Cyber crimes include phishing, hacking, denial of service
attacks, etc. Computer crime mainly consists of unauthorised access to computer systems, credit
card frauds, illegal downloading, child pornography, cyber terrorism, creation and/or distribution of
viruses, spam and so on.
Cyber crimes can be basically divided into 3 major categories: They are cyber crimes against
individuals, against property and against government.
i. Identity theft: Identity theft means using another person's identifying information, like their
name, credit card number, etc. without their permission to commit fraud or other crimes.
ii. Harassment: Humiliating individuals based on caste, religion, race and colour especially in
social media. The use of vulgar or indecent language, threatening any illegal or immoral act through
a computer or a computer network is considered as harassment.
iii. Impersonation and cheating: Impersonation is an act of pretending to be another person for the
purpose of harming the victim.
iv. Violation of privacy: Violation of privacy is the intrusion into the personal life of another,
without a valid reason.
v. Dissemination of obscene material: The distribution and posting of obscene material is one of
the important cyber crimes today.
i. Credit card fraud: Credit card fraud involves an unauthorised usage of another person's credit
card information for the purpose of payments for purchases or transferring funds from it.
ii. Intellectual property theft: The infringement of IPR's come under this category. Violation of
copyright, patent, trademark, etc. are intrusions against property.
iii. Internet time theft: The usage of the Internet time by unauthorised persons, without the
permission of the person who pays for it is called Internet time theft.
i. Cyber terrorism: Cyber terrorism is a cyber attack against sensitive computer networks like
nuclear power plants, air traffic controls, gas line controls, telecom, etc.
ii. Website defacement: Hacking of government websites and posting disrespectful comments
about a government in those websites.
iii. Attacks against e-governance websites: These types of attacks deny a particular online
government service.
Cyber ethics
Ensuring that our actions in the cyber space do not harm others in any way. We should also
remember that our actions over the Internet are being monitored by several others.
Cyber laws
Cyber law can be defined as a law governing the use of computers and Internet. Cyber crimes are
addressed by IT Act 2000 and IT Act Amendment Bill 2008.
Cyber Forensics
Cyber forensics combining law and computer science to collect and analyse data from computer
systems, networks, communication systems and storage devices to produce as evidence in the court.
Infomania
Infomania is getting exhausted with excess information. People addicted to infomania lose
concentration and sleep.