Professional Documents
Culture Documents
Work Book
Grade 12 CBSE
Academic Session 2016-2017
Period
Unit Topic Total periods
Theory Practical
1 Networking and Open Standards 20 4 24
2 Programming 46 44 90
3 Relational Database Management System 50 40 90
4 It Aplications 10 26 36
Total 126 114 240
Unit 2: Programming
Review of Class XI;
Programming Fundamentals
(Refer to Appendix A for Swing Control Methods & Properties, and Appendix B for sample
guidelines of GUI Programming)
Basic concept of Access specifier for class members (data members and methods)
Basic concept of Inheritance
Commonly used libraries:
String class and methods: toString(), concat(), length(), toLowerCase(), toUpperCase(),
trim(), substring()
Math class methods: pow(), round()
Accessing MySQL database using ODBC/JDBC to connect with database.
Web application development: URL, Web server, Communicating with the web server,
concept of Client and Server Side
HTML based web pages covering basic tags – HTML, TITLE, BODY, H1..H6, Paragraph (P), Line
Break (BR), Section Separator (HR), FONT, TABLE, LIST (UL, OL), FORM
Creating and accessing static pages using HTML and introduction to XML
Unit 4: IT Applications
Front-end Interface: Introduction; content and features; identifying and using appropriate
component (Text Box, Radio Button, CheckBox, List etc. as learnt in Unit 2 (Programming)) for
data entry, validation and display.
Back-end Database: Introduction and its purpose, exploring the requirement of tables and its
essential attributes.
Front-End and Database Connectivity: Introduction, requirement and benefits
Demonstration and development of appropriate Front-end interface and Back-end Database
for e-Governance, e-Business and e-Learning applications
Impact of ICT on society: Social, environmental and Economic benefits.
In each of the above domains, identify at least two real-life problems, list the expected outputs
and the input(s) required for the output, and describe the problem solving approach and develop
relevant front-end interface and back-end database.
COURSE DESIGN
Class XII (Practical) (2015-16)
S.No. Description Marks
2 SQL Queries 4
3 Practical Record 6
Identify Network configuration and OSS used in school 1
Simple problems using IDE Java 2
SQL Queries 1
IT Applications 2
4 Project Work 5
5 Viva Voce 5
Total 30
2. SQL Queries
Students will be practicing SQL queries in MySQL throughout the year alongwith course coverage in
theory.
Student will be asked to write four queries based on one or two tables during final practical examination
to be conducted at the end of the academic session
4. Project File
Students in group of 2-3 are required to work collaboratively to develop a project using Programming
and Database skills learnt during the course. The project should be an application in any one of the
domains – e-Governance, e-Business and e-Learning - with GUI front-end and corresponding database at
the back-end.
5. Viva Voce
Students will be asked oral questions during practical examination to be conducted at the end of the
course. The questions will be from the entire course covered in the academic session.
2 Conceptual 4 5 1 - 18 25.7
Understanding
Introduction to Programming
1. Heiko BöckThe Definitive Guide to the NetBeans Platform 6.5, Apress
Computer Network
1. A.S. Tanenbaum, Computer Network 4th Edition, Prentice Hall of India P. Ltd.
2. Williams Stalling, Data Communication and Networks 5th Edition, Prentice Hall of India P. Ltd.
String Function 93
1) Length Function 93
2) Concatenation Function 93
3) Instring Function 94
4) Lower Case Function 94
5) Upper Case Function 94
6) Left Function 95
7) Right Function 95
8) Left Trim Function 95
9) Right Trim Function 96
10) Trim Function 96
11) Substring Function 96
12) ASCII Function 97
Computer Network
1) Computer Network:
Definition:
A computer network is a collection of interconnected computers and other devices which are able to
communicate with each other and share hardware and software resources.
2) Need of networking:
1. Resource sharing
2. Cost saving
3. Collaborative user interaction
4. Time saving
5. Increased storage
• Resource Sharing:
1. Allows all the network users to share data, programs and the hardware devices connected to the
network.
2. Network resources and users may be located at different places.
3. Example: all the computers are connected to a printer over a network. Print can be taken from any
of these interconnected computers. No need of separate computer for each computer.
4. Hence, resource sharing leads to cost saving.
1
• Collaborative user interaction:
1. Allows us to communicate to the network users.
2. Example: if we are working on a computer which is a part of a computer network, we can
communicate with any other user of the network through e-mail or chatting. It takes less time to send and
receive messages.
3. Collaborative user interaction leads to time saving.
• Increased storage:
1. A file can have copies on two or three different machines, so if one of them is unavailable, the other
copies could be used.
2. For military, banking and many other applications, it is of great importance.
3) Application of Networks:
Advantages Disadvantages
1. Allows different users to share resources, such 1. Large computer networks can sometimes be
as printers and scanners. This saves cost because difficult to run. As the size of network grows,
each user need not buy separate devices. trained staff is required to run it, thereby
increasing costs.
2. Allows sharing of software installed centrally 2. The central server that contains all the software
on a server by different users. This results in cost and files might fail, thereby causing heavy loss to
saving, as buying licenses for software to install the organization.
on individual computers would be costly.
3. Allows user to share the data present on 3. Poor management of network services may
computers connected to a network anytime. result in decreased productivity.
4. Allows users to collect information from 4. Websites are not completely secure.
websites.
2
Network Terminologies
1. Node: The term nodes refer to the computers that are attached to a network and are seeking to share the
resources.
2. Server: A computer that facilitates the sharing of data, software and hardware resources on the network.
Servers are classified into two types,
1. Dedicated servers
2. Non-dedicated servers
Dedicated servers:
• A dedicated server is a computer that is used to work only as a server on a network.
• The network using such a server is known as MASTER-SLAVE network.
Non-Dedicated servers:
• A non-dedicated server is a server that performs the function of both a workstation and a server
simultaneously on a network.
• The network using such a server is known as PEER-TO-PEER network.
Network Devices
6) Network Devices:
Network devices are required to form computers other than transmission media. Some of the devices
are,
1. NIC
2. Hub
3. Switch
4. Repeater
5. Gateway
NIC:
1. NIC stands for Network Interface Card or Network Interface Controller or Network Interface Unit (NIU).
3
2. NIC is a device that enables a computer to connect to a network and communicate.
3. Any computer which has to be a part of a computer network must have an NIC installed in it.
Hub:
1. A Hub is an electronic device that connects several nodes to form a network and redirects the received
information to all the connected nodes in broadcast mode.
2. Whenever a computer has to send information to some other computers, the information is sent by the NIC
to hub. Then the hub retransmits this information to other computers attached to it. The intended computer
accepts the information. Other computers on the internet simply reject the information.
Switch:
1. Switch is an intelligent device that connects several nodes to form a network and redirects the received
information only to the intended nodes.
2. Switch can also be otherwise called as an intelligent hub.
3. It looks like hub and it has a same function like hub.
4. But the only difference between hub and switch is that, switch sends the information only to the intended
nodes instead of sending the information to all the computers attached to it.
5. Switch has 24 ports.
4
Repeater:
1. A repeater is a device that is used to regenerate a signal which is on its way through a communication
channel. A repeater regenerates the received signal and re-transmits it to its destination.
Gateway:
1. A gateway is a device, which is used to connect different types of networks and perform the necessary
translation so that connected networks can communicate properly.
Network Topology
7) Network Topology:
Definition:
* Bus Topology:
It is a series of node which all connected to a backbone.
6
* Star Topology:
* Tree Topology:
1. It is a combination of bus and star topology.
2. It is used to combine multiple star topology networks.
3. All the star topologies are connected together like a bus.
7
Characteristics of tree topology:
1. Even if one network fails, the other networks remain connected and working.
*Ring Topology:
A Ring network is circular in shape and every node will have one node on either side of it.
8
*Mesh Topology:
1. In this topology, each node is connected to more than one node.
2. Mesh topology is excellent for long distance networking.
9
Identifying computers and users over network
8) Identifying computers and users over network
If a node X sends some proper information for node Y on a network, then it is mandatory that node X
and Y are uniquely identifiable on the network. Let us see how it is achieved.
o MAC Address
o IP Address
o Domain Name
o Domain Name Resolution
MAC Address:
Definition:
A MAC (Media Access Control) address is a unique 12 digit (6 digits for manufacturer code and 6 digits for
serial number) hexadecimal number assigned to each NIC. MAC address of an NIC never changes.
1. Each NIC has a universally unique address assigned to it by its manufacturer. This address is known as
MAC address of the card.
2. It has 6 bytes, separated by colon (:)
3. The first half of a MAC address contains the ID number of the adaptor manufacturer. The second half of a
MAC address represents the serial number assigned to the adaptor (NIC) by its manufacturer.
IP Address:
Definition:
1. Every machine in a network has another unique identifying number, called its IP (Inter Protocol) address.
2. An IP address is a group of four bytes (32 bits) each of which can be a number from 0 to 255.
3. Four bytes are separated by dot(.).
4. IP address settings of a node can be changed by the user.
3. A typical IP address looks like,
10
MAC address and IP address:
On a network, IP address of a machine is used to identify it, not the MAC address.
For example,
* If we use the PCs IP address to block a system from the use of internet, then the system is not
blocked permanently as its IP address may change.
* Instead, if the PCs MAC address is used for blocking a system, then the work is done.
MAC IP
1. It has 6 bytes, separated by colon (:) 1. It has 4 bytes, separated by dot (.)
2. MAC address of a system can never be changed. 2. IP address of a system can be changed.
3. MAC address is assigned by the manufacturer. 3. IP address is assigned by the Internet Service
Provider (ISP).
4. From the MAC address it is not possible to track 4. From the IP address it is possible to track the
the location of the system. location of the system.
11
Domain Name:
Definition:
Domain names are used to identify one or more IP addresses.Domain names are used in URLs to identify
particular Web pages. For example, in the URL, http://www.hello.com/index.html, the domain name is
www.hello.com.
For example,
In the domain name cbse.nic.in,
in is the top level domain name;
nic is the sub-domain of in or second level domain.
cbse is the sub-domain name of nic or second level domain.
1. WWW
2. Name of the website
3. Top Level Domain (TLD), such as .com, .net, .org, .in. TLS represents the most general part of the
domain name in an IP address.
The following are some examples of domain name:
www.ebay.in www.cbse.nic.in www.yahoo.com
There are only a limited numbers of top level domain, and these are divided into two categories,
• ca – Canada
• pk - Pakistan
• ch – China
Definition:
Domain Name Resolution is the process of getting corresponding IP address from a domain name.
DNR Process takes place in the background, and it can be explained in the following steps:
1. Enter the domain name of the website that you want to access in the web browser.
2. The web browser issues a command to the operating system of your computer to generate the IP address of
the given domain name.
3. Generally, the operating system maintains a HOSTS file, which contains a list of the IP addresses of
some domain names. Therefore, the OS first checks this file to find the IP address of the given domain name.
If the IP address is not found in the HOSTS file, the operating system connects to the DNS server on a
network. The DNS server maintains a directory containing a list of all the domain names and IP addresses that
are registered on the internet. The DNS server finds the IP address of the given domain name and returns it to
the operating system.
4. After obtaining IP address, the operating system (OS) sends it to the web browser that has requested it.
5. And now we can able to view the requested website.
13
Transmission Media
Networking Hardware:
To form a computer network, lot of hardware devices are required. Some of these devices are
described below,
9) Transmission Media:
Definition:
Communication Medium
Wired Media
• Twisted Pair Cable:
1. Most widely used cable for creating small network.
2. It has 4 twisted pairs. These pairs are colour coded.
3. It is of two types,
UTP (Unshielded Twisted Pair)
STP (Shielded Twisted Pair)
14
UTP (Unshielded Twisted Pair):
15
• Co-axial Cable:
Wireless Media
Electromagnetic waves are used for wireless communication over networks. Frequencies of waves are
measured in Hertz (Hz). Based on their frequencies, electromagnetic waves are categorized as, (increased
order of frequency)
Radio Waves
Micro Waves
Infrared Radiation
Visible Light
Ultraviolet Radiation
X-rays
Gamma rays
Out of these only radio waves, micro waves and infrared rays are used for wireless communication.
• Radio Waves:
17
Fig: Radio Wave Tower
• Micro Waves:
Transmitter
Receiver
18
• Infrared Waves:
1. It is a line of sight transmission. Therefore, information passed to one device is not leaked to another
device.
2. No government license is required.
3. At a time only two devices can communicate.
4. Performance drops with longer distances.
• Bluetooth:
1. Bluetooth technology uses radio waves in the frequency range of 2.402 GHz to 2.480 GHz.
2. Used for short range communication (app. 10m).
3. Example: Cell phones.
• Satellite Link:
1. Used for very long distance communication which may range from city to continent.
2. Transmission from a satellite to the earth is known as uplink.
3. Transmission from a earth to satellite is known as downlink.
4. Frequency used for uplink varies from 1.6 GHz to 30.0 GHz.
5. Frequency used for downlink varies from 1.5 GHz to 20.0 GHz.
6. Downlink frequency is always lower than the uplink frequency.
7. Communication satellites are normally owned by government or by government approved organizations of
various countries.
19
Characteristics of Satellite Link Transmission:
Network Protocol
Network Protocol Definition
A network protocol is a set of rules for communication among networked devices. Protocols generally include
rules of,
1) HTTP
2) TCP/IP
3) PPP
1. Allows us to transfer resources (comprising files and other data) from one computer to another across
the globe.
2. When the HTTP request is sent from the HTTP client (Browser) to the HTTP server (web server), the
request is being processed by the server and accordingly the response is being sent back to the client.
3. The transfer of request and response between the client (browser) and server (web server) is done
through the HTTP Protocol.
20
TCP/IP (Transmission Control Protocol / Internet Protocol):
When data is to be sent from one computer to another over internet, it is first broken into smaller
packets (pieces) which are actually sent. When the packets are received by the receiver computer, they are
assembled into the original message.
5. Function of IP Protocol:
The IP protocol ensures that the data has been sent to the correct destination.
Types of Networks
On the basis of area covered computer networks are classified as,
• PAN
• LAN
• MAN
• WAN
PAN (Personal Area Network):
21
• PAN is a small network consisting of devices, such as cell phones which are within a range or reach of
an individual.
• PAN can be setup using guided media (USB cable) or Unguided media (Bluetooth).
• LAN can be set up using wired media (UTP cables, Co-axial cable) or wireless media (radio waves).
22
WAN (Wide Area Network):
• WAN is a network of computing / communicating devices crossing the limits of a city, country or
continent.
• WAN is usually formed by interconnecting a number of LANs, MANs and individual computers.
23
Difference between the types of network
(few meters to a few (few kilometers to a few (an area over hundreds of
kilometers radius) hundred meters radius) kilometer radius)
Speed Faster Slower Slowest
1. An HTTP cookie (also called web cookie, Internet cookie, browser cookie or simply cookie), is a small
piece of data sent from a website and stored in the user's web browser while the user is browsing.
2. Every time the user loads the website, the browser sends the cookie back to the server to notify the user's
previous activity such as,
• clicking particular buttons, logging in, or recording which pages were visited in the past
3. Cookies can also store passwords and form content a user has previously entered, such as a credit card
number or an address.
4. The security of an authentication cookie generally depends on the security of the issuing website and the
user's web browser.
24
2. Firewall:
1. It is a technique used in a secured computer system or network to block unauthorized access and allow only
authorized users.
2. Firewall can be implemented in either hardware or software, or a combination of both hardware and
software.
3. It is normally placed between a protected network (usually a LAN) and an unprotected network (usually a
WAN) and acts like a gate to protect all resources to ensure that nothing goes out without permission and
nothing unwanted comes in into the system.
3. Cyber Law:
1. The propagation of a virus, worms and Trojan is one of the common means of making cyber crime.
2. Like traditional crimes such as theft, fraud, forgery, cyber crimes are also treated criminal in nature.
3. Information Technology Act 2000 (The IT Act 2000) is a law currently existing in India, which provide
legal support to the computer users against the cyber crime.
4. These laws have been described as “paper laws” for “paperless environment”.
4. Hackers:
1. A hacker is someone who seeks and exploits weaknesses in a computer system or computer network.
2. Hackers may be motivated by a multitude of reasons, such as profit, protest, challenge, enjoyment, or to
evaluate those weaknesses to assist in removing them.
3. Hackers steal sensitive information.
4. Hackers are most often programmers.
5. Crackers:
1. A cracker is someone who breaks into someone else's computer system, often on a network, by passes
passwords or licenses in computer programs or in other ways intentionally breaches computer security.
2. A cracker can be doing this for profit, maliciously, for some altruistic purpose or cause, or because the
challenge is there.
3. Crackers create nothing but destroy much.
25
Chapter – 1: Computer Networking
Lab Exercises
2. Find the MAC address of atleast 2 computers in your lab. Then verify their manufacture’s name on the net.
26
Step 2: Go to www.macvendors.com
Step 3: Type the MAC address and get the manufacturer’s name.
Step 1: Go to www.whatismyipaddress.com
27
Computer Networks
Work Sheet
(1 MARK QUESTIONS)
1. Ms. Kant Sengupta wants to prevent unauthorized access to/from his company’s local area network. Write the
name of a system (software/hardware), which he should install to do the above.
Ans: _______________________________
2. Seven Brother Fashion Inc. is a fashion company with design unit and market unit 130 meters away from each
other. The company recently connected their LANs using Ethernet cable to share the stock related information.
But, after joining their LANs, they are not able to share the information due to loss of signal in between. Which
device out of the following should you suggest to be installed for a smooth communication?
(i) Modem (ii) Repeater (iii) UPS Ans: _______________________________
4. Raj kamal International school is planning to connect all computers, each spread over distance within 45
meters. Suggest an economical cable type having high-speed data transfer, which can be used to connect these
computers. Ans: _______________________________
5. Write the name of the most suitable wireless communication channels for each of the following situations.
(i) Communication between two offices in different countries.
(ii) To transfer the data from one mobile phone to another.
Ans: _______________________________
6. Chander vardhan is not able to identify the Domain Name in the given URL. Identify and write it for him.
Ans: _______________________________
__________________________________________________________________________________________
b) _______________________________________________________
__________________________________________________________________________________________
Trojan Horse:
__________________________________________________________________________________________
__________________________________________________________________________________________
3. Ms. Rani Sen, General Manager of Global Nations Corporate recently discovered that the communication
between her company’s accounts office and HR office is extremely slow and signals drop quite frequently. These
offices are 125 meters away from each other and connected by an Ethernet cable.
(i) Suggest her a device, which can be installed in between the offices for smooth communication.
(ii) What type of network is formed by having this kind of connectivity out of LAN,MAN and WAN?
Ans: (i) _______________________________________________
(ii) ______________________________________________
29
5. Give an advantage of using Star topology over Bus topology. Show a network layout of star topology to
connect 5 computers. (Twice in 2012 & 2013)
__________________________________________________________________________________________
__________________________________________________________________________________________
9. What do you understand by Network Security? Name two common threats to it. (Twice in 2013 & 2015)
__________________________________________________________________________________________
__________________________________________________________________________________________
__________________________________________________________________________________________
30
Chapter – 1: Computer Networking
Assignment – 1
Total Marks: 30
1. Write down the steps to find the IP address of a system. 2
3. Write down the steps for finding the IP address of a website (Domain Name Resolution). 2
a) 191.123.1.5
b) 75.29.56.22
c) 55.12.40.39
d) 87.100.255.4
a) A8-B9-DE-02-A0-FA
b) 27-32-CA-5B-6C-01
c) A1-B2-34-D5-E6-F7
d) 12-34-A3-B0-AA-FF
6. Diagrammatically show how you would connect 4 PCs, 1 server, 2 printers in the
following topologies, 6
A. Ring
B. Star
C. Mesh
D. Fully Connected
E. Bus
F. Tree
31
Chapter – 2: Open Source Concepts
Examples of OSS:
Linux OS
Google Chrome OS
Open Office
NetBeans
Java
PHP
Pyhton
32
(3) Proprietary Software:
A software that is neither open nor freely available.
Its source code is not available.
Modification is either forbidden or requires special permission by the supplier or vendor.
Example: MS Office, Adobe Photoshop
(4) Freeware:
(5) Shareware:
Software for which license fee should be paid after its trial period.
Example: Team Viewer
Firefox:
o It is a free and open source web browser produced by Mozilla Foundation.
o Firefox runs on various versions of GNU/Linux, Microsoft Windows and many other Unix like
Operating System.
o It can be downloaded from www.mozilla.org.
Open Office or Open Office.org (OOo):
NetBeans:
o The NetBeans project is an open source project. What this means is:
1. The NetBeans Platform is free for commercial and non- commercial use.
2. The source codes to both are available to anyone to reuse as they see fit under the terms
of the license.
o It can be downloaded from www.netbeans.org
MySQL:
o It is one of the most popular open source database system in the world.
o MySQL works on many different platforms such as Linux, Windows XP, etc.
o It also supports many programming languages such as C, C++, Java, Perl, PHP, Python.
o MySQL can be downloaded from www.mysql.com.
Java:
1. NRCFOSS:
NRCFOSS stands for National Resource Centre for Free and Open Source Software.
NRCFOSS contributes to the growth of FOSS in India through
o Research and Development
o Human Resource Development
NRCFOSS serves as the reference point for all FOSS related activities in the country.
2. OSI:
OSI stands for Open Source Initiative.
It is an organization for promoting OSS.
It was founded in Feb 1998 by Bruce Pernes and Erics Raymond.
It specifies the criteria for open source software.
34
(8) Technical Standards:
A technical standard or simply a standard refers to an established set of rules or requirements, which
are approved by a recognized body and is widely used across various software platforms.
The technical standards can be classified into:
Proprietary Standards and Open standards
Proprietary Standards:
These standards are those, for which users have to buy license to use them.
Their specification is not publicly available.
These standards are owned by a single company/ person/ vendor or a group of vendors.
Example: Microsoft Office Formats (eg, .doc, .docx, .ppt, .xls, etc).
Proprietary Standards are also otherwise called as closed standards or exclusive standards.
If you create a document in MS Word 2007 and send it to your friend who does not have Word 2007, then
he/she would not be able to open and read the file.
2. Single supplier or vendor has total control over the functionality and usefulness of the product:
Since a proprietary standard is the property of a certain company or vendor, other users and developer cannot
add new functionality to it.
Open Standards:
Open standards are internationally accepted technical standards that guarantee that data can be
exchanged across platforms and applications.
Open standards remove the restriction of using any specific software or license. Hence, people will be able
to open the files using software of their choice. 35
(9) Common open standards:
2. Ogg Vorbis:
It is a new audio compression format developed by Xiph.org.
It is a open source.
It was developed to replace all the proprietary formats currently used for audio compression (MO3,
WMA, etc).
It is a text-based markup language for processing and displaying data in a structured format.
36
The platform independent nature of the language makes the XML file an ideal format for exchanging
textual data between different applications.
6. IP (Internet Protocol):
It is an open source specification of Internet Engineering Task Force (IETF) for transmitting data over
a network.
It is an open source specification of IETF for implementing streams of data (packets of data) on top of
IP.
10. Fonts:
Font refers to a group of printable and displayable text characters which have some particular style and
size.
A font is the most important tool for character encoding because it is the font through which a
character is represented on screen (or printer).
1 Technical Specification
2 Font configurations
37
Technical Specification:
It is a 8 bit font.
It is the Native Operating System Font Format for Windows and MacOS.
It is easier to install.
Disadvantages:
This font is not cross-platform compatible (different files needed for platforms like
windows and Mac os).
It is an extension of TTF.
It is a 16 bit font.
OTF’s character set is based on UNICODE representation. Thus, OTF contains 65,536
characters.
Advantages:
Disadvantages:
Font Configuration:
1 Static Font.
38
2 Dynamic Font.
Static Font:
Whenever printing takes place, the same character (identical shape) is displayed every
time.
Dynamic Font:
39
OPEN SOURCE CONCEPTS
Work Sheet
(1 MARK QUESTIONS)
1. Name any two Indian scripts included in Unicode. (Twice in boards, 2011 &2012)
__________________________________________________________________________________________
__________________________________________________________________________________________
__________________________________________________________________________________________
__________________________________________________________________________________________
4. What is UNICODE? Name one Indian language, which is supported by UNICODE. (2013 again repeated)
__________________________________________________________________________________________
__________________________________________________________________________________________
__________________________________________________________________________________________
__________________________________________________________________________________________
__________________________________________________________________________________________
__________________________________________________________________________________________
__________________________________________________________________________________________
(2 MARKS QUESTIONS)
1. Mr. Vidya Chauhan is confused between Proprietary and Open source software. Mention at least two points
of differences to help her understand the same. (Thrice in boards 2011 ,2014 &2015)
40
Chapter – 6: Data Connectivity
Connecting Database to NetBeans
Program 1:
jButton1(Add Rows):
import java.sql.Connection;
import java.sql.Statement;
import java.sql.DriverManager;
import javax.swing.JOptionPane;
String Name=jTextField1.getText();
String Mobile=jTextField2.getText();
String Email=jTextField3.getText();
try
Class.forName("java.sql.DriverManager");
Connection con=(Connection)DriverManager.getConnection("jdbc:mysql://localhost:3306/cbse","root","school");
41
Statement stmt=(Statement)con.createStatement();
stmt.executeUpdate(query);
catch (Exception e)
JOptionPane.showMessageDialog(this, e.getMessage());
jButton2(Exit):
System.exit(0);
42
Program 2:
jButton1(OK):
import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.Statement;
import javax.swing.JOptionPane;
String Emp_No=jTextField1.getText();
String Emp_Name=jTextField2.getText();
String Designation=jTextField3.getText();
String Salary=jTextField4.getText();
try
Class.forName("java.sql.DriverManager");
Connection
con=(Connection)DriverManager.getConnection("jdbc:mysql://localhost:3306/grade12","root","school");
Statement stmt=(Statement)con.createStatement();
43
String query="insert into Employee values ('"+Emp_No+"','"+Emp_Name+"','"+Designation+"','"+Salary+"');";
stmt.executeUpdate(query);
catch (Exception e)
JOptionPane.showMessageDialog(this, e.getMessage());
Task 1: Create a table named “Student” in the database test, with the specified table structure.
44
Task 2: Create a table in the database test, with the specified table structure.
Program 3: To search for a matching row and display corresponding information from the table “details” using
database connectivity.(search by mobile no).
jButton1(Search):
String mobile=jTextField2.getText();
jTextField1.setEditable(false);
jTextField3.setEditable(false);
if(mobile.isEmpty())
try
Class.forName("java.sql.DriverManager"); 45
Connection con=(Connection)DriverManager.getConnection("jdbc:mysql://localhost:3306/cbse","root","school");
Statement stmt=(Statement)con.createStatement();
ResultSet rs=stmt.executeQuery(query);
if(rs.next( ))
String Name=rs.getString("Name");
String Email=rs.getString("Email");
jTextField1.setText(Name);
jTextField3.setText(Email);
else
catch (Exception e)
JOptionPane.showMessageDialog(this, e.getMessage());
Output
46
Task 1: Write a java program to search for a matching row and display corresponding
information from the table “employee” using database connectivity.(Search by Emp_No).
Program 4: To search for a matching row and display corresponding information from the table “details” using
database connectivity.(search by Name).
jButton1(Search):
String name=jTextField1.getText();
jTextField2.setEditable(false);
jTextField3.setEditable(false);
if(name.isEmpty())
try 47
{
Class.forName("java.sql.DriverManager");
Connection con=(Connection)DriverManager.getConnection("jdbc:mysql://localhost:3306/cbse","root","school");
Statement stmt=(Statement)con.createStatement();
ResultSet rs=stmt.executeQuery(query);
int found=0;
while(rs.next())
String Mobile=rs.getString("Mobile");
String Email=rs.getString("Email");
jTextField2.setText(Mobile);
jTextField3.setText(Email);
found++;
if(found = = 0)
catch (Exception e)
JOptionPane.showMessageDialog(this, e.getMessage());
48
Output 1
Output 2
49
Task 1: Write a java program to search for a matching row and display corresponding
information from the table “employee” using database connectivity.(Search by Emp_Name).
Program 5: To display records retrieved from the backend in the table component.
50
Step 2.1: Right click the table component and select Table Contents…
Step 2.3:
ii. By default 4 rows will be added. Select all the 4 rows as shown below and click Delete button.
Step 2.4:
ii. Delete unwanted columns and give column names as shown below.
51
Step 3: Do the following coding.
52
Step 4: Check the output.
53
Chapter – 7: Web Applications
Program 1:
Program 2:
<html> Output
<head><title>Heading Example</title> </head>
<body><h1>This is heading 1</h1>
<h2>This is heading 2</h2>
<h3>This is heading 3</h3>
<h4>This is heading 4</h4>
<h5>This is heading 5</h5>
<h6>This is heading 6</h6>
</body> </html>
54
Program 4: Paragraph Tag
<html>
<head>
<title>Centering Content Example</title>
</head>
<body> <p>This text is not in the center.</p>
<center> <p>This text is in the center.</p> </center>
</body> </html> 55
Output
<html> Output
<head>
<title>Preserve Formatting Example</title>
</head>
<body>
<pre>
function testFunction( strText ){
alert (strText)
}
</pre>
</body>
</html> 56
Program 9: Alignment
<!DOCTYPE html>
<html>
<head>
<title>Align Attribute Example</title>
</head>
<body>
<p align="left">This is left aligned</p>
<p align="center">This is center aligned</p>
<p align="right">This is right aligned</p>
</body>
</html>
Output
<html>
<head>
Output
<title>
Bold Text Example
</title>
</head>
<body>
<p>The following word uses a <b>bold</b>
typeface.</p>
</body>
</html>
57
Program 11: Italic Text
<!DOCTYPE html>
<html> Output
<head>
<title>Italic Text Example</title>
</head>
<body>
<p>The following word uses a <i>italicized</i>
typeface.</p>
</body>
</html>
<!DOCTYPE html>
<html> Output
<head>
<title>Underlined Text Example</title>
</head>
<body>
<p>The following word uses a <u>underlined</u>
typeface.</p>
</body>
</html>
<!DOCTYPE html>
<html>
<head>
<title>Strike Text Example</title>
</head> Output
<body>
<p>The following word uses a
<strike>strikethrough</strike> typeface.</p>
</body>
</html> 58
Program 14: Superscript Font
<!DOCTYPE html>
<html> Output
<head>
<title>Superscript Text Example</title>
</head>
<body>
<p>The following word uses a
<sup>superscript</sup>
typeface.</p>
</body>
</html>
<html>
<head> Output
<title>Subscript Text Example</title>
</head>
<body>
<p>The following word uses a <sub>subscript</sub>
typeface.</p>
</body>
</html>
<html>
<head>
<title>Using Image in Webpage</title>
</head>
<body>
<p>Simple Image Insert</p>
<img src="E:\light-blue-background-3.jpg" alt="Test
Image" />
</body>
</html> 59
Output 1 Output 2
<html>
<head>
<title>Using Image in Webpage</title>
</head>
<body>
<p>Simple Image Insert</p>
<img src="E:\light-blue-background-3.jpg" width=150 height=100 />
</body>
</html>
Output
60
Program 18: To display text with no line or paragraph breaks.
<html>
<title> text with no breaks</title>
<body>
Hello! welcome to my personal web page. I hope you like it.
I'm a student at DPS delhi, studying in class 9. I grew up in Bangalore, and i did my class 8 from there itself.
Output
<html>
<title> text with breaks</title>
<body>
Hello! welcome to my personal web page. I hope you like it.
<p>I'm a student at DPS delhi, studying in class 9. I grew up in Bangalore, and i did my class 8 from there
itself.</p>
61
Program 20: To display paragraphs in various alignments.
62
Attributes of Body Tag
1. Background Image
2. Background Color, Text Color, Link Color
3. Setting left and top margins
4. <Font> tag
a. Face
b. Size
c. Color
1. Background Image:
To display a background image on your web page. Output
<html>
<title> Background Image</title>
<body background=E:\CIN-BLUE.jpg>
sample web page for background image
</body>
</html>
The output will become more clear when you learn to add links also. Since there are no links in the above
example, only background and text color are visible.
63
3. Setting left and top margins:
To make body text appear 60 pixels away from the top edge of page and 75 pixels away from left edge of page.
<html>
<title> Attributes of Body tag</title>
<body topmargin=60 leftmargin=75>
hello students! Notice that the blank area on the left and top side of text. this is because of left and top margin
attributes of the body tag.
</body>
</html>
Output
<html>
<title> text with breaks</title>
<body>
<font size=7 color="blue">
T </font>
<font face=Arial,Times New Roman </font>his is my first attempt at a web page. Enjoy!</p>
</body>
</html>
Output
64
Attributes of Horizontal Rule <HR> Tag
1. Size attribute
2. No shade attribute
3. Width attribute
1. Size attribute:
<html>
<title> text with breaks</title>
<body>
<hr size=20> <br>
</body>
</html>
Output
2. No shade attribute:
<html>
<title> text with breaks</title>
<body>
<hr size=20 noshade> <br>
</body>
</html>
Output
65
3. Width attribute
<html>
<title> text with breaks</title>
<body>
<hr width=100> <br>
<hr width=200><br>
<hr width=30%><br>
<hr width=75%><br>
</body>
</html>
Output
66
Attributes of Image
1. SRC
2. Alternate
3. Border
4. Align
5. Height
6. Width
<html>
<title> Example on image </title>
<body>
<img src=" E:\htmlexample.jpg" alt=”Test Image” border=5 align="right" height=500 width=700>
</body>
</html>
Output
67
List
There are three basic types of lists in HTML: Unnumbered (unordered), Numbered (ordered), definition. Lists
can be nested as well. (having list inside other list).
68
Ordered List (Numbered): Output
<html>
<title> Ordered list </title>
<body>
<ol>
<li> apple
<li> orange
<li> banana
</ol>
</body> </html>
<html>
<title> Ordered list </title> Output
<body>
<ol type=A>
<li> apple
<li> orange
<li> banana
</ol> </body> </html>
<html>
<title> Ordered list </title> Output
<body>
<ol type=a>
<li> apple
<li> orange
<li> banana
</ol>
</body> </html>
<html>
<title> Ordered list </title> Output
<body>
<ol type=a start=5>
<li> apple
<li> orange
<li> banana
</ol> </body> </html>
69
<html>
<title> Ordered list </title> Output
<body>
<ol type=1 start=5>
<li> apple
<li> orange
<li> banana
</ol>
</body> </html>
<html>
<title> Ordered list </title> Output
<body>
<ol type=I start=3>
<li> apple
<li> orange
<li> banana
</ol>
</body> </html>
<html> Output
<title> Ordered list </title>
<body>
<ol type=i start=3>
<li> apple
<li> orange
<li> banana
</ol>
</body> </html>
Nested List
<html> Output
<title> Ordered list </title>
<body>
<ol type=i start=3>
<li> apple
<li> orange
<li> banana
<ul>
70
<li> banana1
<li> banana2
</ul>
</ol></body> </html>
Definition List:
<html> Output
<title> Ordered list </title>
<body>
<dl>
<dd>NetBeans IDE
<dd> NetBeans IDE is a platform to work in java.
</body></html>
71
Creating Tables in HTML
Table is a container element which has both opening _____________ and closing tags___________.
3. Table Data <td>…</td> Used to specify the text in a cell of the table.
Program 1: Program 2:
<html> <html>
<title> Creating Tables </title> <title> Creating Tables </title>
<body> <body>
<table border=2> <table>
<caption> Name List </caption> <caption> Name List </caption>
<tr> <tr>
<td> S.No </td> <th> S.No </th>
<td> Name of a student </td> <th> Name of a student </th>
<td> Class </td> <th> Class </th>
</tr> </tr>
<tr> <tr>
<td> 1 </td> <td> 1 </td>
Program 4:
<html> Output:
<title> Creating Tables </title>
<body>
<table border=2 cellspacing=10 bgcolor=" pink"
align="left">
<caption> Name List </caption>
<tr border=5 align="right" bgcolor="blue">
<th> S.No </th>
<th> Name of a student </th>
<th> Class </th>
</tr>
<tr>
<td> 1 </td>
<td> Md. Shariff </td>
<td> Grade 12 </td>
</tr>
<tr>
<td> 2 </td>
<td> Rebecca Abraham </td>
<td> Grade 12 </td>
</tr>
<tr>
<td> 3 </td>
<td> Sindhu </td>
<td> Grade 12 </td>
</tr>
</table>
</body>
</html>
74
Attributes of Table Data elements
Program 5: Output
<html>
<title> Creating Tables </title>
<body>
<table border=2 cellspacing=10 bgcolor=" pink"
align="left">
<caption> Name List </caption>
<tr border=5 align="right" bgcolor="blue">
<th> S.No </th>
<th> Name of a student </th>
<th> Class </th>
</tr>
<tr>
<td align="center" valign=""
bgcolor="yellow"> 1 </td>
<td> Md. Shariff </td>
<td> Grade 12 </td>
</tr>
<tr>
<td> 2 </td>
<td> Rebecca Abraham </td>
<td> Grade 12 </td>
</tr>
<tr>
<td> 3 </td>
<td> Sindhu </td>
<td> Grade 12 </td>
</tr>
</table>
</body>
</html>
Program 6:
<html> Output
<title> Creating Tables </title>
<body>
<table border=2 cellspacing=3 cellpadding=10 75
bgcolor=" pink" align =”left”>
<caption> Name List </caption>
<tr>
<th> S.No </th>
<th> My fav game </th>
</tr>
<tr>
<td> 1 </td>
<td> <img src="football.jpg" width=50
height=50></td>
</tr>
</table>
</body>
</html>
Student Details
Nishi 14 Female
Rajat 16 Male
76
Creating Forms
We can make a web page interactive by creating forms in it. A form allows the user to enter some data and send
this data to another web page.
Form element:
Input Element:
It is used to provide input field in a form where the user can enter the data.
1. Create an html document named welcome.html 2. Create an html document named form1.html
<html> <html>
<title> Welcome Page </title> <title> form </title>
<body> <body>
<h1> Welcome all </h1> <form name=form1 action="welcome.html"
</body> method="get">
</html> <input type = "submit" value="Welcome">
</form>
</body></html>
77
3. Create an html document named quote.html 4. Create an html document named form2.html
<html> <html>
<body> <title> sample form </title>
<h1> I never dreamed about success. I worked for it <body>
</h1> <form name="form2" Action="quote.html"
</body> method="get">
</html> <h1> Sample Form Page </h1>
<br>
Name:
<input type="text" Name="t1">
<br>
<br>
Email:
<input type="text" Name="t2">
<br> <br>
<input type="Submit" value="click me">
</form>
<body>
</html>
Output:
78
Form Using Radio Button
Output:
79
Form Using Checkbox
Output:
80
Form Using Combo Box
<html>
</title> Combo Box </title>
<body>
<form name="form3" >
Select your state:
<br>
<select name="select" id="select">
<option> Tamil Nadu </option>
<option> Karnataka </option>
<option> Delhi </option>
</select>
</form>
</body>
</html>
<html> Output:
<html>
</title> Combo Box </title>
<body>
<form name="form3" >
Select your state: <br>
<select name="select" id="select">
<option> Tamil Nadu </option>
<option> Karnataka </option>
<option> Delhi </option>
</select> <br> <br>
Any Comments: <br>
<textarea rows="4" cols="50">
</textarea>
</form>
</body> </html>
81
Write html coding to get the following output. Write html coding to get the following output.
<html>
<title> Form </title>
<body>
<form name="form4">
First Name:
<input type="text"><br>
Last Name:
<input type="text">
<br>
Email:
<input type="text">
<br>
<input type="radio" name="r1"> Male <br>
<input type="radio" name="r1"> Female <br>
<input type="submit" Value="Send">
<input type="reset" value="Reset">
</form>
</body> </html>
82
Chapter – 8: MySQL
1. To create database.
Syntax: create database database_name;
mysql> create database ip;
3. To create a table.
Syntax: create table table_name ( column_name1 data_type1, column_name2 data_type2,….,
column_nameN data_typeN);
mysql> create table class (Admission_num integer, Name varchar(20), Grade varchar(20));
Task 1:
• Create a table named Grade11.
• Column names and the data types are follows,
o Roll_no of integer data type.
o Name of varchar data type and its size is 15.
o Father_Name of varchar data type and its size of 20.
o Mother_Name of varchar data type and its size of 20.
• Add minimum 5 rows to the table.
• View the contents of the table.
• View any two columns of the table.
8. Mr. Ravi wants to see the names of all the tables in the database. It is done by using the following query.
9. Ms. Anne created three databases. And now she wants to know the name of the database in which she is
working.
Using alter statement, we can also do the following changes in the columns,
a. Adding a column:
b. Deleting a column:
Task 2:
• To the created table add a new column named Address of varchar(20) data type.
• View the table.
• Delete the newly added column.
• View the table.
• Modify the column name “Roll_no” as “Roll_No”.
85
Task 3:
• Create a table named Intelli_Systems.
mysql> select Emp_Name, Salary from Intelli_Systems where Salary > 50000;
mysql> select Emp_Name, Salary from Intelli_Systems where Salary >= 50000;
mysql> select Emp_Name, Salary from Intelli_Systems where Salary < 20000;
mysql> select Emp_Name, Salary from Intelli_Systems where Salary <= 20000;
86
mysql> select Emp_Name, Salary from Intelli_Systems where Salary = 20000;
mysql> select Emp_Name, Salary from Intelli_Systems where Salary != 20000;
Task 4:
__________________________________________________________________________________
__________________________________________________________________________________
__________________________________________________________________________________
Display Emp_No and designation of employees whose salary is greater than 25000.
__________________________________________________________________________________
_________________________________________________________________________________________
Display Emp_No and designation of employees whose salary is lesser than 25000.
_________________________________________________________________________________________
mysql> select Emp_Name, Salary from Intelli_Systems where Salary>10000 and Salary<50000;
mysql> select Emp_Name, Salary from Intelli_Systems where Salary>10000 && Salary<50000;
mysql> select Emp_Name, Branch from Intelli_Systems where Branch=”T.Nagar” || Branch=”Ashok Pillar”;
mysql> select Emp_Name, Salary from Intelli_Systems where Salary between 10000 and 50000;
mysql> select Emp_Name, Salary from Intelli_Systems where Salary not between 10000 and 50000;
mysql> select Emp_Name, Salary from Intelli_Systems where Salary not in (20000,56000,9000);
mysql> select Emp_Name, Salary from Intelli_Systems where Emp_Name like ‘K%’;
mysql> select Emp_Name, Salary from Intelli_Systems where Emp_Name like ‘%sh’;
mysql> select Emp_Name, Salary from Intelli_Systems where Emp_Name like ‘S%a’;
mysql> select Emp_Name, Salary from Intelli_Systems where Emp_Name like ‘%and%’;
mysql> select Emp_Name, Salary from Intelli_Systems where Emp_Name not like ‘K%’;
mysql> select Emp_Name, Salary from Intelli_Systems where Emp_Name not like ‘%sh’;
mysql> select Emp_Name, Salary from Intelli_Systems where Emp_Name not like ‘S%a’;
mysql> select Emp_Name, Salary from Intelli_Systems where Emp_Name not like ‘%and%’;
Task 5:
• Display names of employees whose salary lies on the following list 9500, 50000 and 20000.
• Display Emp_No of employees whose name not ends with a letter ‘a’.
• Display names of employees whose salary lies within the range of 15000 and 25000.
88
20. Sorting the results – Order by.
Task 6:
Task 7:
________________________________________________________________________
________________________________________________________________________
89
Important Questions
1. What is DBMS?
A Database Management System (DBMS) is a program that controls creation, maintenance and use
of a database. DBMS can be termed as File Manager that manages data in a database rather than saving it in
file systems.
2. What is RDBMS?
RDBMS stands for Relational Database Management System. RDBMS store the data into the
collection of tables, which is related by common fields between the columns of the table. It also provides
relational operators to manipulate the data stored into the tables.
Example: SQL Server.
3. What is SQL?
SQL stands for Structured Query Language , and it is used to communicate with the Database. This is
a standard language used to perform tasks such as retrieval, updation, insertion and deletion of data from a
database.
Standard SQL Commands are Select, Alter, Update,…
4. What is a Database?
Database is nothing but an organized form of data for easy access, storing, retrieval and managing of
data. This is also known as structured form of data which can be accessed in many ways.
Example: School Management Database, Bank Management Database.
9. What is a join?
This is a keyword used to query data from more tables based on the relationship between the fields of
the tables. Keys play a major role when JOINs are used.
91
Functions in MySQL
Functions
Numeric Functions
Numeric Functions:
MySQL numeric functions perform operations on numeric values and return numeric values.
o Power Function
o Round Function
o Truncate Function
Power Function
Round Function
Truncate Function
Syntax: TRUNCATE(X, D)
String Functions:
MySQL numeric functions perform operations on string values and returns either string or integer values.
1. Length 7. Right
2. Concatenation 8. Left trim
3. Instring 9. Right trim
4. Lower Case 10. Trim
5. Upper Case 11. Substring
6. Left 12. ASCII
Length Function:
o Used to find the number of characters in the string.
Syntax: LENGTH(string);
Instring Function:
Left Function:
o It returns the specified number of characters from the left side of the string.
Syntax: LEFT(string,n);
n integer
Right Function:
o It returns the specified number of characters from the right side of the string.
Syntax: RIGHT(string,n);
n integer
Syntax: LTRIM(string);
95
Mysql> select ltrim(“ Hai”); ____________________________
Syntax: RTRIM(string);
Trim Function:
Syntax: TRIM(string);
Substring Function:
o Returns the specified number of characters from the middle of the string.
mposition of character
ASCII Function:
It allows us to perform many types of tasks on data type data. The default date format in MySQL is yyyy-
mm-dd.
Syntax: CURDATE( );
97
Now Function:
Syntax: NOW( );
Syntax: SYSDATE( );
Date function:
Month function:
Syntax: MONTH(date);
Year function:
Syntax: YEAR(date);
Syntax: DAYNAME(date);
Syntax: DAYOFMONTH(date);
98
Day of week function:
Syntax: DAYOFWEEK(date);
Syntax: DAYOFYEAR(date);
99
Single Row Functions
a) Numeric functions operate on numeric data types and returns numeric values as output. They are
categorized into three,
2. Round Function:
3. Truncate Function:
b) String (Character) Functions:
Character functions operate on string inputs and returns integer or string outputs.
NOTE: the following are the three string functions which returns integer values,
Ucase(string)
5 Lower Function Lower(string)
Lcase(string)
6 Left Function Left(string,n)
Ascii(‘char’)
12 Substring Function Substring(string,m,n)
Mid(string,m,n)
1. Length Function:
2. Concat Function:
3. In String Function: (occurrence of second string in first string)
4. Upper Function:
5. Lower Function:
8. Trim Function:
1 Curdate( )
2 Now( )
3 Sysdate( )
4 Date(expression)
5 Month(date)
6 Year(date)
7 Dayname(date)
8 Dayofmonth(date)
9 Dayofweek(date)
10 Dayofyear(date)
Chapter - 8
Work Sheet
1. A table STUDENT has 5 rows and 3 columns. Table ACTIVITY has 4 rows and 2 columns. What will be the
cardinality and degree of the Cartesian product of them?
Ans: _____________________________________________________________________________________
3. Write one similarity and one difference between UNIQUE and PRIMARY KEY constraints.
Ans: _____________________________________________________________________________________
4. Write one similarity and one difference between CHAR and VARCHAR data types.
Ans: _____________________________________________________________________________________
5. Write the UPDATE command to increase the commission (Column name: COMM) by 500 of all the
Salesmen who have achieved Sales (Column name : SALES) more than 200000. The table’s name is
COMPANY.
Ans: _____________________________________________________________________________________
6. While using SQL pattern matching, what is the difference between ‘_’ (underscore) and ‘%’ wildcard
symbols?
Ans: _____________________________________________________________________________________
7. Saumya had previously created a table named ‘Product’ in a database using MySQL. Later on she forgot the
table structure. Suggest her suitable MySQL command through which she can check the structure of the already
created table.
Ans: _____________________________________________________________________________________
8. Amit works as a database administrator in a Multinational bank. He wants to undo the changes made in the
current transaction. Suggest to him a suitable MySQL command for the same.
Ans: _____________________________________________________________________________________
100
9. (a)Observe the table ‘Club’ given below:
Member_id Member_Name Address Age Fees
M001 Sumit New Delhi 20 1000
M002 Nisha Gurgaon 19 1500
M003 Niharika New Delhi 21 2100
M004 Sachin Faridabad 18 1500
10. Write SQL query to create a table ‘Bank_Customer’ with the following structure:
11. In a Bank’s database, there are two tables ‘Customer_info’ and‘Transaction__Detail’ as shown below.
i. Is it possible to have primary key and foreign key in one table? Justify your answer.
__________________________________________________________________________________________
ii. A table can have maximum how many primary keys and foreign keys?
101
__________________________________________________________________________________________
12. Write two examples of DBMS software.
__________________________________________________________________________________________
13. What is meant by NULL value in MySQL?
__________________________________________________________________________________________
14. How is NULL value different from 0 (zero) value ?
__________________________________________________________________________________________
15. Write two examples of DML commands of SQL.
__________________________________________________________________________________________
16.
102
Chapter-9:
Functions
Topic 1:
o MIN ( ) o COUNT ( )
o AVG( )
103
2. Populate the tables as follows,
104
MAX():
MIN():
AVG():
105
SUM():
COUNT():
106
Creating Tables with constraints
Question: Write the query to create table using the structure given below.
1. Table Name: ip
___________________________________________________________________________________________
___________________________________________________________________________________________
___________________________________________________________________________________________
___________________________________________________________________________________________
___________________________________________________________________________________________
___________________________________________________________________________________________
107
3. Table Name: ip2
___________________________________________________________________________________________
___________________________________________________________________________________________
___________________________________________________________________________________________
___________________________________________________________________________________________
___________________________________________________________________________________________
___________________________________________________________________________________________
2.
3.
108
5. Table Name: student
___________________________________________________________________________________________
___________________________________________________________________________________________
___________________________________________________________________________________________
___________________________________________________________________________________________
___________________________________________________________________________________________
___________________________________________________________________________________________
ALTER TABLE
1. to add a constraint
2. to remove a constraint
Table Name ip
Place Varchat(25) NO
___________________________________________________________________________________________
___________________________________________________________________________________________
___________________________________________________________________________________________
To remove a constraint:
Table Name ip
Place Varchat(25) NO
___________________________________________________________________________________________
___________________________________________________________________________________________
___________________________________________________________________________________________
110
To modify a table column:
a.
Field Type Null Key Default Extra
Roll No Int(2) NO PRI
Class Varchar(10) NO NULL
Admsn_no Int(5) NO PRI 0
111
DROP TABLE
GROUP BY Clause:
In practical applications many times there arises a need to get reports based on some groups of data. SQL
provides GROUP BY Clause to handle all such requirements.
Syntax:
1.
112
3. Display number of rows in each type of shoes.
4. Display type and sum of qty for all the types of shoes.
5. Display type ,
min of margin,
max of margin,
avg of margin,
sum of qty for all the types of shoes.
6.
113
7. Display different categories from the table customers.
9.
Syntax:
114
11. For each type, display type and size from the table shoes whose size is equal to 6.
12. Display code,name,type,size from shoes whose cost is greater than or equal to 200. Group by size.
HAVING Clause:
Sometimes we do not want to see the whole output produced by a statement with GROUP BY Clause. We want to
see the output only for those groups which satisfy some condition. This can be done using HAVING clause.
Syntax:
13.
14.
115
15.
16.
Syntax:
17.
18.
116
Displaying data from multiple tables
Displaying data from multiple tables:
Data can be displayed from multiple tables using the following two concepts,
2. Equi-Join
Cartesian Product:
Cartesian product of two tables is a table obtained by pairing up each row of one table with each row of other
table.
If two tables contain 3 rows and 2 rows respectively, then their Cartesian product will contain 6 rows (3*2=6).
Example:
117
1. Mysql> select * from order_table, product;
Question No: 1
How many rows will be displayed when the following query is executed,
select * from product, order_table,suppliers; ?
Ans: _______________________________
118
3. Display Sup_code column from the tables Supplier and Order_Table.
Question No: 2
Write a query to display name column from both the tables’ product and Supplier.
Ans:
_________________________________________________________________________________________
An IT application has two major parts: Front-end (the user interface) and back-end (the database).
Front-end:
o The front-end of an IT application is usually a group of one or more forms through which the
user enters the input values.
o A good front-end ensures the acceptance of the application in the first go.
Back-end:
o The back-end of an IT application is the database in which all the data is stored. This database
resides in the server. All the data which is requested by the front-end is supplied by back-end.
o A good back-end ensures sustainability, efficiency and easy modification of the application.
E-GOVERNANCE
It refers to application of electronic means in governance with an aim of fulfilling the requirements of common
man at affordable costs and in fastest possible time.
Advantages of E-Governance
1. Speed – Technology makes communication speedier. Internet, Phones, Cell Phones have reduced the time
taken in normal communication.
120
2. Cost Reduction – Most of the Government expenditure is appropriated towards the cost of stationary. Paper-
based communication needs lots of stationary, printers, computers, etc. which calls for continuous heavy
expenditure. Internet and Phones makes communication cheaper saving valuable money for the Government.
3. Transparency – Use of ICT makes governing profess transparent. All the information of the Government
would be made available on the internet. The citizens can see the information whenever they want to see. But
this is only possible when every piece of information of the Government is uploaded on the internet and is
available for the public to peruse. Current governing process leaves many ways to conceal the information from
all the people. ICT helps make the information available online eliminating all the possibilities of concealing of
information.
4. Accountability – Once the governing process is made transparent the Government is automatically made
accountable. Accountability is answerability of the Government to the people. It is the answerability for the
deeds of the Government. An accountable Government is a responsible Government.
Challenges:
E-Governance: Major Challenges in India Poor people and poor infrastructure are major challenges in
countries like India. It poses a major challenge in reaping the full benefits of service provision under e-
governance. The various barriers can be enumerated as follows:
1. Poverty: Accessing Internet is a costly affair for the poor who struggle for their livelihood in developing
countries like India. Required infrastructure in the form of installing the necessary telephone lines needed for
internet or email access is equally unaffordable in most poor countries.
2. Technical illiteracy: There is general lack of technical literacy as well as literacy in countries like India.
3. Language Dominance: The dominance of English on the internet constrains the access of non-English
speaking population. In the case of India, 95 percent of the population does not speak English. Due to such
overwhelming dominance of English over these communication channels, computers and the internet are quite
useless in Indian villages.
4. Unawareness: There is general lack of awareness regarding benefits of E-Governance as well as the process
involved in implementing successful G-C, G-G and G-B projects.
5. Inequality: Inequality in gaining access to public sector services between various sections of citizens,
especially between urban and rural communities, between the educated and illiterate, and between the rich and
poor.
6. Infrastructure: Lack of necessary infrastructure like electricity, internet, technology and ways of
communications will affect the speed which delays the implementation.
121
E-BUSINESS
Trading of goods or services online, such as e-Procurement, primarily through the web-sites;
Electronic retailing (e-Tailing);
Use of the internet, intranets or extranets to conduct research and manage business activities;
Web-site marketing;
Online communications, such as e-mail; and
Online training for staff (e-Learning).
Mobile phones;
Personal digital assistants (PDA);
Electronic Data Interchange;
File transfer;
Facsimile;
Video conferencing, internet, intranets and extranets.
Benefits:
The benefits of implementing e-Business tools is not so much in the use of technology, but in the streamlining
of business processes and the ease in finding new markets. Some of the advantages and disadvantages include:
122
Some E-Business websites are:
One of the main reasons that people decide to begin using Internet banking over regular banking is in reference
to convenience. Everybody wants methods that are going to save them time and make daily tasks easier on
them, and that is exactly what Internet banking does.
Internet banking was introduced in the early 80s. Many people have started availing to its facilities. Now, one
does not have to wait in long queues at the bank nor to pay bills at some shopping center and None of us want to
stand in the queue for hours and hours also.
You can notify the bank of your change of address directly over the computer . Many other services that
you would typically have to pay for are free as well when you complete them online with Internet banking, and
this is primarily due to the fact that by completing Internet banking services you are saving the bank from
having to use bank tellers, or manpower, to do the work for you.
The best thing about Internet banking is that it is fast and is available to a person in any part of the world, at
anytime he or she needs it.
1. A computer.
2. Internet connectivity.
3. Original Operating System.( e.g. XP PROFESIONAL ).
4. Original Antivirus, Not a free version.
Mobile Banking:
Mobile banking is a service provided by a bank or other financial institution that allows its customers to
conduct some financial transactions remotely using a mobile device such as a mobile phone or tablet.
After the success of online banking, mobile banking is the next revolutionary step which has attracted
huge customers from all over the country. With this service you can perform all the banking actions such as
money transfer, credit card payment, bill payment, account updates and other transactions. Further all the other
information related to your account can be accessed via your mobile phone within a span of few seconds.
However the nature of banking activities that can be done depends on the facilities provided by your bank. Read
on to know more about this banking service.
Mode of Transfer
Once the above mentioned procedure is completed, mobile banking transaction can be made using
different modes of transfer. For instance, you can use the SMS service or download the mobile banking
application on your cell phone to start your banking activities. Although both of these modes are popular in
their own way, it is better to go with the one that your bank offers and your mobile phone supports too.
125
E-LEARNING
It is a flexible term used to describe a means of teaching through technology such as a network, browser,
CDROM or DVD multimedia platform.
• On-demand availability enables students to complete training conveniently at off-hours or from home.
• Self-pacing for slow or quick learners reduces stress and increases satisfaction.
• Interactivity engages users, pushing them rather than pulling them through training.
• Confidence that refresher or quick reference materials are available reduces burden of responsibility of
mastery.
126
127