C++ Programming Basics and Control Structures
C++ Programming Basics and Control Structures
in ®
COMPUTER
APPLICA-
TION
Join Now: [Link] Downloaded from [Link] ®
Join Now: [Link] Downloaded from [Link] ®
Chapter 1
Review of C++ Programming
Tokens
Fundamental building blocks of C++ program. (Lexical units)
Classification: (POLIK)
1. Punctuators: Special symbols used in C++ program. Eg: # ; ( ] }
2. Operators: Symbols that indicate an operation. Eg: +, <, *, &&
3. Literals(Constants): Constant values used in program.
(a) Integer literals: Whole numbers. Eg: 23, -145
(b) Floating literals: Constants having fractional parts. Eg: 12.5, 1.87E05
(c) Character literals: A character in single quotes. Eg: „a‟, „8‟
(d) String literals: One or more characters within double quotes. Eg: “a”, “score1”
4. Identifiers: Names given to different program elements.
(a) Variable: Name given to memory location.
(b) Label: Name given to a statement.
(b) Function name: Name given to a group of statements.
Rules to form an identifier:
(a) Can have only alphabets(upper and lower),digits and _(underscore).
(b) Cannot be keywords.
(c) Cannot start with digit.
5. Keyword (Reserved word): They convey a specific meaning to the compiler.
Eg: float, if, break, switch
Data types: Used to identify nature and type of data stored in a variable.
Fundamental datatypes:
const Keyword
The const keyword specifies that the value of a variable does not change throughout the
program.
syntax :const data type variable_ name = value;
Eg:constfloat pi=3.14;
Control Statements
Control statements are used for altering the normal flow of program execution
They are classified into two
Control Statements
The statements provided by C++ for the selected execution are called decision making statements
or selection statements.
if statement
if...else statement
Decision making
statements
nested if
else if ladder
switch statement
Conditional Operator (? :)
It is a ternary operator (it takes three operands).
The conditional Operator can be used as an alternative of if... else statement
The syntax is: Condition? True-part: false-part;
The condition is true the result is the true part, else the result is the false-part.
Eg: big = (a>b)? a: b;
Iteration statements
Iteration statements or looping statements are used to perform repeated execution of a set of one or
more statements.
C++ provides three looping statements: while loop, for loop and do...while loop.
for loop
Entry control loop
while loop
Iteration/Looping
statements
Entry controlled loop means condition is executed before loop body. The loop will run only if
condition is true
Exit controlled loop means condition is executed after loop body. the loop will run at least once
even if condition is true/false
A Looping statement has four elements:
a) Initialization - statement that gives starting value to loop variable eg:(i=1)
b) Condition – the test expression. eg: (i<=10)
c) updation – statement that changes the value in loop variable eg: (i++)
d) Body of loop- set of statements to execute repeatedly eg:((cout<<i;)
1. while loop
It is an entry-controlled loop.
The condition is checked first and if it is found True the body of the loop will be executed.
The syntax is:
initialization;
while(test expression)
{
body of the loop;
update statement;
}
}
2. for loop
It is an entry-controlled loop.
The condition is checked first and if it is found True the body of the loop will be executed.
The syntax is:
3. do...while loop
It is an exit controlled Loop.
Here, the test expression is evaluated only after executing body of the loop.
Its syntax is:
initialization;
do
{
body of the loop;
update statement;
} while(test expression);
Nested loop
Placing a loop inside body of another loop is called nested loop.
A nested loop contains an inner loop and an outer loop.
In a nested loop, the inner loop statement will be executed repeatedly as long as the condition of the
outer loop is true.
Example
for( int i=1; i<=5; i++)
{
for(int j=1; j<=i; j++)
{
cout<< i << " " ;
}
cout<<”\n”
}
Jump statements
Jump statements transfers program control from one place to another part of a program
Jump statements
CHAPTER 2 - ARRAYS
Array
Array is a collection of elements of same type placed in contiguous memory location
Each element in an array can be accessed using its position called index number or subscript.
An array index starts from 0
The elements of an array with ten elements are numbered from 0 to 9.
Array declarations
Data_type array name[size];
where size is the number of memory locations in the array.
Eg: int a[10] ;
Join Now: [Link] Downloaded from [Link] ®
Declares an array of size 10, where the first element is at a[0] and the last element is at a[9].
Array initialization
Giving values to the array elements at the time of array declaration is known as array initialization.
Eg : int N[10]={12,25,30,14,16,18,24,22,20,28} ;
char word[7]={'V' , 'I' , 'B' , 'G' , 'Y' , 'O' , 'R' } ;
Memory allocation for arrays
Total bytes = size of data type x size of the array
Eg:
o The number of bytes needed to store the array int A[10] is 4 x 10=40 bytes.
o The number of bytes needed to store the array float B[5] is 4 x 5 = 20 bytes.
CHAPTER 3 - FUNCTIONS
Modular Programming / Modularization
The process of breaking large programs into smaller sub programs is called modularization.
Function
Function is a named unit of statements in a program to perform a specific task.
functions are classified into two types
Functions
Arguments / Parameters
A parameter is a named variable passed into a function
Eg: cup=makeCoffee(water,milk,sugar,coffee powder) here makeCoffee is a function name and
water ,milk ,sugar ,coffee powder is arguments
Return value
The result obtained after performing the task assigned to a function. Some functions do not return
any value
Built-in functions
get()
Input Function
Stream functions for I/O getline()
operations
Header file : iostream put()
Output Function
write()
strlen()
strcpy()
String functions
strcat()
Header file : cstring
Predefined functions/
strcmp()
built-in functions
strcmpi()
abs()
Mathematical functions
sqrt()
Header file : cmath
pow()
isupper()
islower()
isalpha()
Character functions
isdigit()
Header file : cctype
isalnum()
toupper()
tolower()
Join Now: [Link] Downloaded from [Link] ®
4. Mathematical functions
A. abs( )
used to find the absolute value of a number
Header file : cmath
Syntax : int abs( int) ;
Eg : cout<<abs(-5) ; // displays 5
B. sqrt( )
used to find the square root of a number
Header file : cmath
Syntax : double sqrt(double) ;
Eg : cout<<sqrt(16) ; // displays 4
C. pow( )
used to find the power of a number
Header file : cmath
Syntax : double pow(double, double) ;
Eg: cout<<pow(3,2) ; // displays 9
5. Character functions
isupper( )
used to check whether a character is in upper case(capital letter) or not.
Join Now: [Link] Downloaded from [Link] ®
Header file : cctype
Syntax : int isupper (char) ;
Eg : cout<<isupper('A') ; // displays 1
islower( )
used to check whether a character is in lower case(small letter) or not.
Header file : cctype
Syntax : int islower (char) ;
Eg : cout<<islower('A') ; // displays 0
isalpha( )
used to check whether a character is an alphabet or not.
Header file : cctype
Syntax : int isalpha(char) ;
Eg : cout<<isalpha('B') ; // displays 1
cout<<isalpha('8') ; // displays 0
isdigit( )
used to check whether a character is digit or not
Header file : cctype
Syntax : int isdigit(char c) ;
Eg : cout<<isdigit('5') ; // displays 1
cout<<isdigit('r') ; // displays 0
isalnum( )
used to check whether a character is alphanumeric or not.
Header file : cctype
syntax : int isalnum(char) ;
Eg : cout<<isalnum('8') ; // displays 1
cout<<isalnum('+') ; // displays 0
toupper( )
used to convert the given character into its uppercase.
Header file : cctype
Syntax : char toupper(char) ;
Eg : cout<<toupper('b') ; // displays B
tolower( )
used to convert the given character into its lower case.
Header file : cctype
Syntax : chat tolower(char) ;
Eg : cout<<tolower('B') ; // displays b
function prototype
A function prototype is the declaration of a function by which compiler is provided with the
information about the function such as the name of the function, its return type, the number and
type of arguments, and its accessibility.
Syntax : data_type function_name(argument list);
Ordinary variables are used as formal Reference variables are used as formal
parameters. parameters.
Actual parameters may be constants, Actual parameters will be variables only
variables or expressions.
Exclusive memory allocation isrequired for Memory of actual arguments is shared by
the formal arguments. formal arguments.
The changes made in the formal arguments The changes made in the formal do reflect in
do not reflect in actual arguments actual arguments.
Default argument
Join Now: [Link] Downloaded from [Link] ®
A default argument is a value provided in a function declaration that is automatically assigned by the
compiler if the calling function doesn‟t provide a value for the argument.
Scope and life of variables and functions
Local variable -The variables declared within the body of Function are called local variables
Global variable -The variables declared outside any function and which are accessible to all functions are
called global variables
Local function- A function which is declared inside the body of another function is called a local function.
Global function - A function declared outside the function body of any other function is called a global
function
4 - WEB TECHNOLOGY
Website
Web page is a document available on World Wide Web.
A web page contains huge information including text, graphics, audio, video and hyper links.
Website is a collection of web pages.
Web pages are developed with the help of HTML (Hyper Text Markup Language).
Web server
A web server is a powerful computer that hosts websites.
A web server enables us to deliver web pages or services like e-mail, blog, etc.
A web server is a computer that process request and distributes information.
A web server can have single or multiple processors, fast access RAM, high performance hard disks,
Ethernet cards that support fast communication.
Software ports
Software ports are used to connect client computer to server computer.
It is a 16-bit number.
Some of the commonly used ports and services are:
PORT NO SERVICE
20&21 FTP
22 SSH
25 SMTP
53 DNS
80 HTTP
110 POP3
443 HTTPS
Join Now: [Link] Downloaded from [Link] ®
DNS Server
DNS Server used to resolve (Convert) domain name into IP.
The process of translating domain name to IP address is called name resolution.
The internet contains thousands of interconnected DNS servers.
When you type a URL in your browser, the browser contacts the DNS server to find IP address.
Web designing
Web designing is the process of designing attractive web sites.
Any text editor can be used to design web pages. Eg: notepad, geany, sublime text etc..
Scripts
Scripts are program codes written inside HTML pages.
Script are written inside <SCRIPT> and </SCRIPT> tags.
The commonly used scripting languages are java script,VB script,PHP etc
<HEAD> Tag
It is a container tag used to specify the details of a webpage like title, scripts, CSS etc
<TITLE> Tag
The <TITLE> tag defines the title of the HTML document.
<BODY> Tag
The <BODY> Tag defines the body section of HTML document.
The main attributes of <BODY> tag are,
1)Bgcolor:-It specifies the background color of the document.
2)Background:-It specifies the background image for the document.
3)Text:-It specifies the colour of Text displayed on the document.
4)Link:-It specifies the colour of unvisited [Link] default colour is blue.
5)Alink:-It specifies the colour of active [Link] default colour is green.
6)Vlink:-It specifies the colour of visited [Link] default colour is purple.
7)Leftmargin: -Specifies the left margin from where the text in the body appears.
8)Topmargin:-Specifies the top margin from where the text in the body appears.
Headings in HTML
HTML supports headings from <H1> to <H6>.
An important attributes of heading tags is Align.
It has three values Left,Right,Center
<P>Tag
The <P> tag is used to create paragraph
Attributes of <P> tag is Align
It has three value, left,right,center or justify.
<BR> Tag
The <BR> tag is used to insert a line break.
<HR> Tag
The <HR> tag is used to create a horizontal line in HTML.
Attributes of <HR> Tag
Size:-It specifies the thickness of the line.
Join Now: [Link] Downloaded from [Link] ®
Width:-It specifies the width of the line.
Align:-It specifies the alignment of the line(Left, Right and Center)
Color:-It specifies the color of the ruler
<CENTER> Tag
It is a container tag used to display contents to the center of webpage.
The content can be text,image,table etc.
<PRE> Tag
The <PRE> tag defines preformatted text
It is a container Tag used to display a text exactly in its original form that we typed in Text editor
<ADDRESS> tag
It is container tag used to display a postal address
The information may include name, phone numner,e-mail, address etc.
The contents enclosed in <address> tag will be displayed in Italics similar to <i> tags
<MARQUEE> Tag
The <MARQUEE> tag defines the text that scrolls across the user‟s display.
Attributes of <MARQUEE> tag
The important attributes of <MARQUEE> tag are,
Height and Width:-It determines the size of marquee area.
Hspace and Vspace:-It defines the space between marquee and the surrounding text.
Scrollamount and Scrolldelay:-These attributes control the speed and smoothness of scrolling
marquee.
Behaviour:-It defines the type of scrolling. It has three values scroll, slide and alternate.
Loop:-It specifies how many times the marquee text must scroll. The default value is endless.
Direction:-It specifies the direction of scroll.
<DIV> Tag
The <DIV> tag defines a division or a section in an HTML document.
Attributes of <DIV> tag is align,id,style
<FONT> Tag
The <FONT> tag allows to define size,colour,style of text.
Attributes of <FONT> Tag is
Face:-It specifies the font name.
Size:-It specifies the font size.
Join Now: [Link] Downloaded from [Link] ®
Color:- It defines color to the text.
<IMG> tag
The <IMG> tag is used to insert image in a web page.
Attributes of <IMG> tag are,
Src:-It specifies the name of image.
Align:-It controls alignment of the image (TOP,MIDDLE or BOTTOM).
Width:-It specifies the width of the image.
Height:-It specifies the height of the image.
Alt:-It defines the text to be displayed if the browser cannot display the image.
Vspace and Hspace:-Controls the vertical and horizontal spacing between images in the web
page
1. Unordered lists
3. Definition list
1. Unordered lists
Unordered list display a bullet or graphic symbol in front of each item.
<UL> Tag is used to create Unordered List.
Each list item is added using <LI>
Important attribute of UL tag is Type
Values in Type attribute are : Disc , Square, Circle
Eg: <UL Type= "Disk">
<DT>computer :</DT>
<DD> A computer is a digital electronic machine</DD>
Nested lists
A list inside another list is called nested list.
Eg: an ordered list inside another ordered list, an unordered list inside an unordered list, etc
Types of linking
Link
2. Internal Linking
Link to a particular section of same document is known as internal linking.
Name attribute of <A> is used for internal Linking.
Eg: Eg. <a name=”Introduction”> Introduction</a>
Then we can link to this section as
<a href=”#Introduction”> Go to Introduction</a>
E-mail Linking
mailto: protocol is used to create email linking
Eg:- <A Href= mailto: "scertkerala@[Link]">Mail SCERT Kerala </A>
Join Now: [Link] Downloaded from [Link] ®
Nesting of Framesets
Placing frameset tag inside another frameset tag is known as nesting of frames
<NOFRAMES> tag is used to display some text content in the window if browser does not support
frames
<INPUT> Tag
Its a an empty tag different types form controls
Type , Name ,Value , Size and Maxlenght are attributes of <INPUT>
Value of Type attribute is
Value Description
text Text Box
password checkbox Text box enter to password
checkbox Check box control
radio Radio button control
reset RESET button
submit SUBMIT button
button A standard button
<TEXTAREA> Tag
It is used to create multiline text box.
Important attributes of <TEXTAREA> tag are ,
Name , Rows, Cols
<SELECT> tag
It is used to create Dropdown list (or Select Box) in a form.
Important attributes of <SELECT> tag are
Name , Size, Multiple
<OPTION> allows to add each items to the dropdown list.
<fieldset> tag
The <fieldset> tag is used to group related elements in a form.
The <fieldset> tag draws a box around the related elements.
The <legend> tag is used to define a caption for the <fieldset> element.
Join Now: [Link] Downloaded from [Link] ®
<SCRIPT>Tag
<SCRIPT> tag is used to include scripting code in an HTML page.
Important attribute of <script> tag is language and type
Language Attribute – To Specify the Scripting Language.
Example:- <SCRIPT Language="javascript">
...................................................
...................................................
</SCRIPT>
How to design a web page using Java Script
<HTML>
<HEAD> <TITLE> sample title </TITLE> </HEAD>
<BODY>
<SCRIPT Language= "JavaScript">
[Link]("Welcome to wayanad.");
</SCRIPT>
</BODY>
</HTML>
This program is saved with .html extension.
[Link] ():-This command is used to display a text in the body of a webpage.
Variables in JavaScript
var keyword is used for declaring all type of variable.
Variable is used for storing a value.
Example: var x,y;
X=10;
Y=”wayanad”;
Here, the variable x is number data type and y is String data type
Operators in JavaScript
Arithmetic Operators
Operator Description Example
+ Addition c= a+b
- Subtraction c= a-b
* Multiplication c= a*b
/ Division c= a/b
% Modulus c= a%b
++ Increment c= ++b
-- Decrement c= --b
Assignment Operators
Operator Description Example Meaning
= Assignment A=B
+= Add and Assignment A+=B A=A+B
-= Subtraction and Assignment A-=B A=A-B
*= Multiplication and Assignment A*=B A=A*B
/= Division and Assignment A/=B A=A/B
%= Modulus and Assignment A%=B A=A%B
Relational Operators
Operator Description Example
== Equal to a==b
!= Not equal a!=b
< Less than a<b
> Greater than a>b
<= Less than or Equal to a<=b
>= Greater than or Equal to a>=b
Logical Operators
Operator Description Example
&& AND C= a && b
|| OR C= a || b
! NOT C= !a
if(test_expression)
{
Statements;
}
2) Switch statement
The Switch statement is a multi-branching statement,
It is executes statement based on value of the expression.
The syntax is
switch(expression)
{
case value1:statement1;break;
case value2:ststement2;break;
- -----------------------
Default: statement;
}
3) for ............Loop
The for loop executes a group of statements repeatedly.
The syntax is
while(expression)
{
statements;
}
String addition operator (+)
The JavaScript concatenation operator is a plus sign (+).
This operator lets you add the contents of two or more strings together to create one larger string
Example: x = “Java”;
y = “Script”;
z = x + y;
The + operator will add the two strings and the variable z will have the value JavaScript.
7 - WEB HOSTING
Web Hosting
It is the process of providing storage space in web server for a web site.
The companies that provide web hosting services are called web hosts.
Join Now: [Link] Downloaded from [Link] ®
Stages of web hosting
1. Selection of hosting type.
2. Buying hosting space.
3. Registration of domain name.
4. Transfer of files to the server using FTP.
I. Shared hosting
In this type, more than one web sites are stored in a single web server.
This is the most common type of web hosting.
Characteristics
Suitable for small web sites.
Cheaper and easy to use
Less service/performance
Characteristics
Suitable for secure and high performance web sits.
Expensive
More service/fast service
Limitations:
Limited size of file can be uploaded.
Advertisements from the service provider
Audio/video may not be permitted
Chapter 8
Database management System
Concept of Database
A database is a collection of data.
A DBMS (Data Base Management System) is a set of programs used to create access and maintain a
database
Advantages of DBMS
1) Data Redundancy can be avoided:-
Storing same data in multiple locations or the duplication of data is called data redundancy.
2) Data inconsistency can be reduced:-
Data redundancy leads to data inconsistency.
That is when the various copies of the same data does not match each other.
Inconsistency can be controlled by controlling data redundancy.
3) Efficient data access:-
A DBMS provides easy access to data in database.
4) Data integrity:-
Data integrity refers to correctness, completeness and accuracy of data stored in the database.
5) Data Security:-
Data security refers to protecting data against accidental loss or accessing /modifying data by
unauthorized users.
Data security can be done by setting access rights using passwords.
6) Sharing of data:-
The data stored in the database can be shared among multiple programs andusers.
7) Enforces standard:-
The database administrators enforce necessary standards.
Some standards include-naming convention, display format, report structure, access rules etc.
8) Crash Recovery:-
A DBMS provides a mechanism for data backup and recovery from crash/hardware failure.
Components of DBMS
A DBMS consists of the following components,
1) Hardware:-
Hardware includes computers (Server,PCetc),storage devices(hard disk,magnetic tape) and
other devices for data storage and retrieval.
Join Now: [Link] Downloaded from [Link] ®
2) Software:-
The Software consists of DBMS, application programs and utilities.
Application programs are used to access data in database to generate reports, tabulations, etc.
Utilities are the software tools used to manage the database system.
3) Data:-
The database should contain all the data needed by the organization.
The database contains Metadata (data about data) and operational data.
The data in the DBMS is organized in the form of Field, Record and Files.
Field:-A field is the smallest unit of stored data. [Link] No,Name,Place etc.
Record:-A record is a collection of related fields. For eg. 1001, Rajesh, Kollam
Files:-A files is a collection of records of same type.
4) Users:-
The users access the database by using application programs.
5) Procedure:-
Procedures are rules and instructions that govern the design and use of a database.
Database Abstraction
Abstraction is the process of hiding the complex background details of a DBMS from its users.
1) Physical Level:-
It is the lowest level of abstraction.
It describes how data is actually stored in a secondary storage medium like magnetic disk or tape.
2) Logical Level(Conceptual Level):-
Logical level describes what data are stored in the database andwhat relationship exists between
data.
That is, the data type, format of data etc are hidden from users.
Logical level abstraction is used by database administrator.
3) View Level:-
This is the highest level of database abstraction and is closest to the users.
It is concerned with the way in which individual users view the data.
Data Independence:
Data Independence is the ability to modify the schema (structure of database) at one level without
affecting the database structure at next higher level.
1) Physical data independence:
It is the ability to modify the schema at the physical level without affectingthe schema at the
logical level.
2) Logical data Independence:
It is the ability to modify the schema at the logical level without affecting the schema at the
view level.
Different users of database
Based on the mode of interaction with DBMS the users of a database are classified into four
1. Database Administrator (DBA)
2. Application Programmer
3. Sophisticated Users
4. Naive Users
Database Administrator (DBA):
A database administrator is a person who has central control over thedatabase.
The main duties of a DBA are
Design of the Physical and Logical Schema
Security and Authorization
Data availability and recovery from failure
Application Programmer:-
Application programmers are computer professionals who interacts with the database through
application programs written in any languages such as C,C++,Java etc.
They interact with the data base using DML.(Data Manipulation Language).
Join Now: [Link] Downloaded from [Link] ®
Sophisticated Users:-
Sophisticated users interact with database through their own queries (request to database) for
their complicated needs.
They include engineers, analyst, scientists etc.
Naive users:-
Naive users interact with database by invoking previously written application programs.
Naive users include billing clerk in a super market, bank, hotel, clerical staff in an office etc.
Relational data model
A relational model stores database as a collection of tables called relations.
Some of the popular RDBMS are Oracle,MYSQL,DB2 etc.
Terminologies in RDBMS
a. Entity
An entity is a person or a thing in the real world that is distinguishable from others.
b. Relation
Relation is a collection of data elements organized in terms of rows and columns.
A relation is also called Table.
c. Tuple
The rows (records) of a relation are generally referred to as tuples.
A row consists of a complete set of values used to represent a particular entity.
d. Attribute
The columns of a relation are called attributes.
AdmNo, Roll, Name, Batch, Marks and Result are attributes of the STUDENT relation.
e. Degree
The number of attributes in a relation determines the degree of a relation.
The relation STUDENT has six columns or attributes and therefore the degree of the
STUDENT relation is 6.
f. Cardinality
The number of rows or tuples in a relation is called cardinality of the relation.
The relation STUDENT has eight tuples and hence the cardinality of the STUDENT relation
is 8.
g. Domain
A domain is a pool of values from which actual values appearing in a given columnare
drawn.
For example, the domain of the column Batch in the relation STUDENT is the set of values
{Science, Humanities, Commerce}.
h. Schema
The description or structure of a database is called the database schema, which is specified
during database design.
i. Instance
An instance of a relation is a set of tuples in which each tuple has the same numberof fields
as the relational schema.
Keys
A key is an attribute or a collection of attributes in a relation that uniquely distinguishes each
tuples from other tuples in a given relation.
Join Now: [Link] Downloaded from [Link] ®
a. Candidate key
A candidate key is the minimal set of attributes that uniquely identifies a row in a relation.
In the STUDENT relation, AdmNo can uniquely identify row.
Therefore it can be considered as a candidate key.
b. Primary key
A primary key is one of the candidate keys chosen to uniquely identify tuples within the
relation.
As it uniquely identifies each entity, it cannot contain null value and duplicate value.
c. Alternate key
A candidate key that is not the primary key is called an alternate key. I
.
d. Foreign key
A key in a table can be called foreign key if it is a primary key in another table.
Chapter 9
Structured Query Language
Structured Query Language (SQL) is a language designed for managing data in relational database
management system (RDBMS).
SQL provides an easy and efficient way to interact with relational databases.
A query is a request to a database.
Components of SQL
SQL has three components - Data Definition Language (DDL), Data Manipulation language (DML)
and Data Control Language (DCL).
Data Definition Language
DDL is a component of SQL that provides commands to deal with the schema definition of
the RDBMS.
The DDL commands are used to create, modify and remove the database tables.
The common DDL commands are CREATE, ALTER, and DROP.
Data Manipulation Language
The Data Manipulation Language (DML) provides commands for dealing with data in table.
DML permits users to insert data into tables, retrieve existing data, delete data from tables
and modify the stored data.
The common DML commands are SELECT, INSERT, UPDATE and DELETE.
Data Control Language
Data Control Language (DCL) is used to control access to the database for security concerns.
The commands GRANT and REVOKE are used as a part of DCL.
GRANT : Allows access privileges to the users to the database.
REVOKE : Withdraws user's access privileges given by using GRANT command.
Constraints
Constraints are the rules enforced on data that are entered into the column of a table.
Constraints could be column level or table level.
a. Column Constraints
Column constraints are applied only to individual columns.
They are written immediately after the data type of the column.
i. NOT NULL
This constraint specifies that a column can never have NULL values.
NULL is a keyword in SQL that represents an empty value.
ii. AUTO_INCREMENT
MySQL uses the AUTO_INCREMENT keyword to perform an auto-
increment feature.
If no value is specified for the column with AUTO_INCREMENT constraint,
then MySQL will assign serial numbers automatically
By default, the starting value forAUTO_INCREMENT is 1, and it will be
incremented by 1 for each new record.
Join Now: [Link] Downloaded from [Link] ®
iii. UNIQUE
It ensures that no two rows have the same value in the column specified with
this constraint.
iv. PRIMARY KEY
This constraint declares a column as the primary key of the table.
This constraint can be applied only to one column or combination of columns.
The primary keys cannot contain NULL values.
v. DEFAULT
Using this constraint, a default value can be set for a column, in case the user
does not provide a value for that column of a record.
b. Table constraints
Table constraint is applied on a group of columns of a table.
The table constraint appears at the end of the table definition.
Retrieving information from tables
The DML command SELECT is used for retrieving data from table.
Syntax:
SELECT <column_name>[,<column_name>,<column_name>, ...]FROM
<table_name>;
An asterisk (*)symbol can be used to display values from complete list of columns
Eg: SELECT * FROM student; (Display all attributes in table)
Selecting specific rows using WHERE clause
o In certain situations, we need to display only some values from the table.
o WHERE clause of SELECT command enables to display values from table that satisfies our
conditions.
o The syntax of SELECT command with WHERE clause is:
SELECT <column_name>[,<column_name>,<column_name>, ...]FROM
<table_name>WHERE <condition>;
o Eg1: SELECT * FROM student WHERE gender='F';
ICT in Business
Some major developments in business through the use of ICT are
o Social Network and big data analytics
o Business Logistics
Social Network and big data analytics
Big data analysis is the process of examining large data sets containing a variety of data to uncover
hidden patterns, market trends, customer preferences etc.
Business Logistics
It is the management of the flow of goods in a business between the point of origin and to the point
of consumption in order to meet the customer requirements.
RFID(Radio Frequency Identification)
This Technology can be used to identify, track or detect a wide variety of objects in logistics.
RFID consists of tag and reader.
The tag contains a microchip for storing data and an antenna for sending and receiving data.
Information Security
1. Intellectual Property Right (IPR)
Intellectual Property Right
Cyber crimes against individuals Cyber crime against property Cyber Crime against Government
Identity theft Credit card fraud Cyber terrorism
Harassment Intellectual Property theft Website defacement
Impersonation and cheating Internet time theft Attacks against e-
Violation of privacy governance websites
Dissemination of obscene materials