0% found this document useful (0 votes)
8 views27 pages

Computer Tybcom - 241111 - 133608

Uploaded by

Tanishqa More
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
8 views27 pages

Computer Tybcom - 241111 - 133608

Uploaded by

Tanishqa More
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 27

ADVAIT COACHING CLASSES

TYBCOM SEM-V SUBJECT:-COMPUTER


1. Data Communication , Networking & Internet

DATA COMMUNICATIONS
The communication of Data includes sharing or transferring Data from one end to other end. The
data can be the form of text ,numbers, audio, images or videos. In Networking it implies exchange
of data between two devices via some form of transmission medium. The communication requires
a system which is made up of hardware and software.
Thus Data Communication consist of exchange of information in the form of different types of data
from one point (sender) to another point (receiver) and vice versa. The purpose is not only to
transfer a message but also to ensure that message reaches proper destination, in a timely manner
and with the required effect.
The Efficiency of data communication system depends on the following four basic characteristics.
CHARACTERISTICS
 Delivery : The system must deliver the data to the correct specified destination. The
destination can be single or multiple in number.
 Accuracy : The data must be delivered accurately. That is, the system isn’t allowed to make
any changes, variations in the data. Suppose, these are alterations, it should result in an
error.
 Timelines : The data must be delivered at specified exact time to the destination. If the data
isn’t delivered on time, sometimes it becomes useless or redundant at the receiver’s end.
For example if daily balances at different branches of a bank are to be reported to the head
office everyday sat before 4.00 p.m, then it will be useful to head office, only when it
reaches it, within the stipulated time.
 Jitter : It refers to the fluctuations in the arrival time of packets, especially while delivery is
of audio or video packets. There should not be Jitters or variations in Data communication.
COMPONENTS
The following are five components of Data communication System. These include the Sender, the
Receiver, the Message , the Transmission Medium and the Protocol. Let us learn more about
them.
 Sender : The Sender is a devise used to send the data message. It may be a computer, work
station, Telephone Handset, Video camera, Mobile, radio and so on.
 Receiver : The Receiver is a device used to receive the message. It can be computer,
workstation, Telephone Handset, Television and so on.
 Message : The Message consists of the data or information to be communicated.
It can be in the form of text, numerals, images, audio, and video.
 Transmission Medium : The Transmission Medium refers to the physical path through
which data travels from sender’s end to receiver’s end. Some of the commonly used media,
for Data transmission are twisted pair wires, coaxial cables, fibre-optic cables and radio
waves.
 Protocol : A Protocol refers to set of rules that govern communication of data.
Communication is not possible without a Protocol. The TCP/ IP Protocol is widely used in
Internet and is framework for developing a complete range of computer communication
statndards.
Now let us study different ways in which Data is reprented.
DATA REPRESENTATION
The information or data can be in terms of Text, Numbers, Images, Audios and Videos.
 Text : The Text is represented as a Bit (Binary Digit ) pattern, i.e a sequence of 0 ( zero) and l
(one) digits. There are many ways of representing text symbol in a code. The current coding
system, Unicode, uses 32 bits to represents a symbol or character used in any language in
the world, which contains the popular ASCII code (American Standard Code for Information
Interchange) as first l27 characters.
 Numbers : The Numbers are also represented by bit pattern. Note that ASCII codes are not
used but a number is directly converted into binary digit e.g. the number 23 is represented
as l0lll in Binary.
 Images : The Images are represented by bit pattern. An image is composed of a matrix,
consisting of small dots known as Pixels. The size and number of pixels in an Image depends
on the resolution. e.g. an image can be divided into l000 pixels or l0,000 pixels as well.More
Pixels lead to better Resolution with a better Presentation of Image. At the same time, more
Pixels require more Memory to store the image.
 Audio : It refers to data represented as recording or broadcasting of sound or music. The
data is in a continuous form, not like earlier types. Data communication, it is changed to a
digital or an analog signal.
 Video : It refers to data type consisting of recording or broadcasting of a picture or a
movie. It can be produced in the continuous form as a continuous entity with the help of a
medium like a T.V. camera. It can also be requested as a combination of Images, each, a
discrete entity, but the combination or arrangement gives idea of motion. The video data is
changed to a digital or an analog signal.
After studying the various data types, let us consider the concept of Distributed Processing, in
networks while communicating data.
DISTRIBUTED PROCESSING
In Data Communication, data is transferred with the help of Networks of Computers, connected by
Communication Links. The network may consist of, not only computers but any other input-output
device as well like a printer. These are called as Nodes, which can be any device capable of sending/
receiving data from other nodes of the network.
The transmission of Data in Networks is mostly carried out with the help of Distributed Processing,
the tasks or functions are divided among many computers. There are separate computers, usually
P.C.S. to handle a subset of processing. There are many Independent Computers, with their own
local memory which deal with different aspects of Processing. These autonomous computers can
communicate with each other by passing the message.
A Distributed Processing system is more efficient than a single large machine handling all aspects of
Processing.
NETWORK BASICS AND INFRASTRUCTURE
We know that Network is a group of computers and other peripheral devices like printers, scanners,
which are connected by a communication link. All computers in a network are connected to each
other, to enable them to share applications, data and hardware components.
The networks can be divided into different types according to the transmission medium, according
to their size, architecture, structure, etc. Let us consider different types of Network, classified
according to their size like LAN, MAN and WAN.
TYPES OF NETWORK
LAN (Local Area Network)
 It is a network restricted to a Limited geographical location. The LAN is usually located
within a single building or a campus of upto a few kilometers in size, like offices of
companies, banks, educational institutions, etc.
 It is used to connect various terminals, in different departments to facilitate sharing of data
resources, peripherals, etc.
 It increases memory of each terminal, providing alternative sources of supply.
 The terminals or nodes (workstations) are connected to the network File Server which is
sometimes referred as Network driver. In some LAN systems, there are special servers like
network print servers, communication servers, fax servers, etc.
 The file server stores the required data, and provides it to the workstations or nodes, on
request.
 The resources like software packages, data-storage devices, hardware, etc. are shared by all
nodes.
 Sharing of Resources increases efficiency of network by helping in quick decision making
and by reducing the cost.
 The limited or restricted area of LAN helps in easy and quick location of faults and thus delay
in results is decreased.
 The workstations are physically connected with the help of wire or cable.
 The nodes/ workstations are physically arranged using topologies such as Star, Bus, Ring
(which will be discussed later in the chapter).
 The data transfer speed is in megabytes per second. The early LAN networks had the rates in
the range 4 to l6 mbps. However, now-a- days speed is l00 to l000 mbps.
MAN (Metropolitan Area Network

 It is a Network, covering the area of 40-60 kms inside a city. It is used in companies requiring
a high speed connectivity.
 It is a larger version of LAN and it uses a similar technology.
 An example of a MAN network is a special part of telephone company network (like MTNL),
which provide high speed DSL (Digital Subscriber Line ) Line to customers or a cable T.V.
network, which, now-a-days, is used for high-speed data connection to Internet.
 A MAN can provide and support data as well as voice signals.
 It is a bigger network than LAN, where micro computers or nodes or workstations are
physically connected using fiber optic cable.
 Usually MAN contains more than one file server which manages sharing of resources like
printers, data storage devices, software’s, etc.
 In MAN networks, the data transfer speed is around 20 mbps.
 LAN can be connected to MAN and two or more MAN networks can be connected to each
other using Bridges and Gateways.
WAN (Wide Area Network)
 It is a much larger Network than LAN, covering a vast geographical area, often a country or a
continent.
 It is a collection of host machines, connected by a communication subnet.
 In most WAN systems, the subnet consists of components like Transmission media (also
called as circuits, channels) and the switching elements which are also called as packet-
switching nodes, intermediate nodes or routers.
 The switched WAN connects the end systems, which mostly consists of a Router which
connects to another WAZN or LAN.
 The point to point WAN consists of leased line from a telephone company or a cable T.V.
provider. It is used to connect a small LAN to an ISP (Internet service provider).
 Examples of WAN are ATM network (Asynchronous Transfer Mode). Now-a-days wireless
WAN network are also used.
 In WAN also, sharing of resources, data, more than one file servers, etc. are used.
 The data transfer speed is around 55 kbps
 The working of WAN is based on following:
1. The data is moved by transmission line in bits or packets between the machine lines.
2. When the data is arrived at a router, it selects an outgoing line to forward it to required
router.
3. It may be sent via one or more intermediate routers, in which it is stored until the
required output line is free and then forwarded.
4. A subnet, using this principle is called a Point-to-point, store and forward or packet-
switched subnet
NETWORK STRUCTURES
The Networks can be divided according to their Architecture like server based, client/ server, peer
to peer, etc. the type are categorized by the roles the servers and nodes (computer) play, in terms
of hierarchical and security interaction. Let us study them in detail.
Served Based Networks
In theses network, there are many nodes and one or more servers. The servers control the access
to resources for user nodes. Each node can access the file on the server but not files on the other
nodes.
When a node requires information(file) from the server, it request the server about file. The server
simply stores the files and forwards the specified file to the node which request for it. The node
then processes the request for it. The node then processes the requested file. It can access other
resources like printer from the server.
In these networks, the user nodes gain access to required hardware, software by obtaining rights
and permission, given through a centrally controlled server.
Client/server network
In client/ server network, individual computers or note share the processing and storage of data
with server. The network has arrangement of special software for nodes and server to share
processing. In this architecture, these are certain servers, dedicated for specific jobs. When a client
or node requests about any information from the server, the server processes the data and returns
only the requested information to the client.
This client/ server arrangement can be used on LAN’s or WANs. This is useful in cases where a
database can be accessed by many computers on the network. The database is stored on the
network server, along with a portion of the database management system (DBMS). The computer
working as a node stores and runs the client portion of the DBMS.
When the user with computer node requires any information in the database, he uses client
software to send the query to the server, which searches the database and returns the information
to the user.

Peer-To-Peer Network (P2PN)


In this network all nodes have equal relationships with each other. Each node has software which
supports sharing of resources. Each node has access to at least some of the resources of remaining
nodes.
One of the features of Peer-to-Peer Network is the Management and control point of access to
shared resources like files and printers. Many client operating systems such as Windows 2000
Professional, Windows XP, Macintosh, etc. feature built-in support for Peer-to-Peer Networking.
A Peer-to-Peer Network may include a Network server as well, in that case a Peer-to-Peer LAN
becomes similar to a file-server Network. But, note that P2P Network provides more access to the
other users or nodes then a file server network.
NETWORK TOPOLOGIES
The physical arrangement of a network is termed Network Topology. It includes a network
configuration and contains representation of all links with the corresponding nodes in the network.
The different arrangements of nodes are designed so as to achieve the following goals for the
network.
 To provide maximum reliability for data.
 To route the data traffic through the least cost path between the sending and receiving
nodes within the network.
 To provide data in optimal time for the end user.
Several forms of topologies are used in Network to achieve these goals. Let us consider a few of
these like Star, Bus and Ring topology.
Star Topology
 In this topology, there is a Central Controller called Hub and all nodes are connected to it.
The individual nodes cannot interact with each other directly. The entire traffic of data has
to pass through the Central Hub to the destination node from the sender’s end.
 The topology is used to connect local terminals to the mainframe computers like in a LAN.
 The number of nodes can be increased, because each is connected to the Central Hub only.
 The failure of the Central Hub may lead to failure of the entire network.
 The failure of a node will not affect the Network.
 The data transmission may be delayed due to queuing at the Central Hub.
 The initial cost of setting Star Network is high because Central Hub has to be installed with a
margin for possible expansion. But the expansion cost is not much because it contains only
additional cost for installation of additional nodes.
Bus Topology
 In a Bus topology, all nodes are connected with a single (linear) cable.
 All nodes or workstations are connected to bus cable by drop lines and taps.
 The data is communicated via the cable, which passes through all nodes in the network.
 New nodes can be added without rearrangement of entire network
 The cost per node is less than star network but higher than ring network
 At any instant of time, only one machine is allowed to transmit data and all other machines
are required to refrain from sending the data.
 Failure of a node can affect entire network.
Ring topology
 The nodes are physically arranged in the shape of a ring (as shown in the figure) so that
each node can communicate with only two nodes which are adjacent to it.
 Data is transmitted along the ring in one direction, from node to node, until it reaches its
destination node.
 Ring topology is almost exclusively used by local area networks.
 Total length of the ring and the distance between successive nodes in restricted, through
the total span is more than of a Bus topology.
 Maximum number of nodes is limited because of the structure of the ring.
 Additional nodes require re-arrangement of system and it affects performance of the
Network as well.
 The cost per node is less than other network topologies.
 Failure of a node can affect network.
Hybrid Topology
All above networks have their advantages and disadvantages. Hence, a combination of these
networks is used in practice, which is called a Hybrid topology which is simply a combination of
different types of networks, each following different topologies.
NETWORK MEDIA : WIRED AND WIRELESS
Now let us study the media using which nodes are connected within a Network. The medium of
connecting these nodes can be a wire of different types like twisted pair cable wires, coaxial cables,
fiber optic cables. Now-a-days even a wireless medium like radio or infrared signal is used in
wireless networks. Let us learn about them.
(I) WIRED MEDIA
Twisted-Pair Cable
 It consists of at most 4 pairs of wires, each pair has 2 wires, separately insulated in plastic
and twisted around each other.
 The 4 pairs are bound together in a plastic layer. The plastic coating is the only shield
available to protect these wires from outside interference.
Hence it is also known as Unshielded Twisted-Pair (UTP) wire.
 There is another type of twisted wire, in a metal sheath, and is known as Shielded Twisted-
Pair (STP) wire.
 It is a common transmission medium for analog and digital signals as well. In the initial
stages it was a low-bandwidth medium, but now, networks based on twisted pair cable may
support transmission speed up to l gbps (gigabit per second).
 Examples of Twisted Pair Cable networks are telephone networks and Data communication
within a building.
 It is less expensive than the other media and is easier to work with.
Coaxial Cable
 It is made up of a single wire or conductor in the centre of a cable. There is a wire mesh
(outer conductor) shield surrounding the first wire at the center, with an insulator in
between the two. It is covered with a jacket or a shield.
 It supports transmission speed up to mbps.
 It can carry more data than the twisted pair wiring.
 It is used over longer distances, liking crossing of an ocean, television distribution, long
distance telephone transmission, in LANS, MANS, etc.
 It is used to transmit both analog and digital signals.
 It is less susceptible to interferences than twisted wire, because of its construction and
outer shield.
 Though it is a versatile transmission medium, it is more expensive then twisted wire cables.
Fibre Optic Cable
 An optical fibre is a thin, flexible glass medium, through which, an optical ray can pass.
 An optical fibre cable is cylindrical in shape and it consists of 3 concentric sections, the
core, the cladding and the jacket. The core contain one or more optical fibres. The
cladding is a glass or plastic coating which surrounds each fibre. The outermost jacket is
made up of plastic and other material, as protection against moisture, crushing etc.
 The transmission is done by pulsating beams of light, instead of electric current. The
beam of light is transmitted by means of total internal reflection. The internal reflection
occurs because the fibre optic is a trsnparent medium having higher refraction index
than the surrounding medium.
 The main characteristics are greater capacity and speed, smaller size and lighter weight
with more security.
 The Fibre Optic cable network is used in LANS, Subsciber loops, connecting telephone
networks in rural areas, etc.
 The cable can carry data at more than a billion bits per second. Now-a-days the
transmission speeds can be around l00 gbps, as well.
 It is more expensive then coaxial and twisted pair of cable wire, but its advantages are
far better than these types.

(II) WIRELESS MEDIA


The wireless media are used for communication through laptops, notebooks, palmtops, wristwatch,
computers, mobiles, etc. Here communication with the Network is possible, even when the user is
in travel. The wireless networks use radio or infrared signals which can travel through air (called
ether) for transforming data. Now-a-days it is used even in a LAN, located within a building or in
MANS and WANS. The Wide Area Network mostly use satellites and microwave communication.
The types depend on ranges of frequencies. For example, frequencies in the range of about l GHz
(gigahertz) to 40 GHz are referred to as Microwave frequencies. It is suitable for Point-to-Point
transmission and satellite communications as well.
Frequencies in the range 30 MHz to l GHz are Radio Range frequencies and are used for
broadcasting radio programs. They don’t require dish-shaped antennas.
Frequencies outside these ranges are called Infrared Range Frequencies, which are useful in local
Point-to-Point application with confined area. These are used for short range communication like
remote controls used for electronic instruments like T.V, V.C.D, A.C’s, Car’s etc.
The above mentioned types of transmission media can be remembered as follows.

NETWORK HARDWARE
The hardware used to connect different networks with different transmission media is naturally
different. There are Hubs, Bridges, Switches, Routers, etc. which are used at various levels in
Networking.
All these devices operate in different layers of networks as follows.
 A hub has a number of input lines (nodes) and it joins all lines electrically.
 Data arriving on any of the lines is sent to all other lines, in addition to the destined line.
 All lines must operate at the same speed.
 A hub can hold multiple line cards, each with multiple inputs.
 Hubs are used in networks with twisted pair cables, to connect devices and hubs can be
joined to create larger networks.
 In its earlier form, a hub was used to provide a pathway for the electrical signals to travel
along and so, it was called a Passive Hub.
 Now-a-days, there are Active Hubs, which regenerate the signal before providing a path to
forward it to all connected devices.
 No error checking or processing on the data is done in a Hub.
 Hubs are available in many shapes and sizes, with small hubs containing 5 to 8 lines and
larger ones upto 32 lines.
Switches
 Switches are connecting devices in a data link layer, of an Ethernet Network.
 A switch is used to connect individual computers, via twisted pair, cables, one cable for each
computer.
 A switch forwards the data only to the port that connects to the destination computer, by
learning the addresses of the computers attached to it and then by matching the address of
the destination computer with the one in the data received.
 This property of the switches improves the network performance by creating a direct path
between the two computers and controlling their communication.
 It reduces the number of collisions on the network which occur when two computers try to
transmit data, at exactly the same time.
Bridges
 Bridges are connecting devices in a data link layer of an Ethernet Network and contain
Hardware and Software facilities, which allow devices on one network to communicate with
devices on similar network.
 A bridge connects 2 or more LAN’s or it can be used for segmentation of a larger network
into 2 smaller, more efficient networks.
 When data arrives at the Bridge, its software extracts the destination address from it and
transfers it to the correct location.
 A Bridge connects different network types using similar protocols, topologies.
 A Bridges does not provide management facility.
 A Bridge manages the data traffic on both sides of the network to optimize the performance
on both sides of the network. It maintains the flow of data transmission on both sides and it
doesn’t allow unnecessary data transmission. Thus it acts as traffic police.
 Remote Bridges can be used to create WAN links.
Routers
 Routers are used at the Network layer and are different from switches and bridges.
 Routing algorithm is a part of network layer software, which decides the output line to be
used for transmission of incoming data. Usually the data reaches its destination by taking
multiple hops in between the journey.
 Routers select the best path for data transmission, based on the destination address and
origin.
 Routers know the addresses of computers, bridges, other routers on the network and can
determine the busy selections on the net.
 These can redirect data around those sections until they clear up.
 A router can be used to connect a LAN to the Internet.
 A router can route the data between any two protocols, any two topologies medium like
twisted pair, coaxial wire or fibre optic.
 It contains internal tables of information called routing tables, with all known network
addresses, possible paths with the cost as well.
 It contains internal tables of information called routing tables, with all known network
addresses, possible paths with the cost as well.
 Routers use network addresses of packages and so can be used with a routable protocol like
TCP/IP.
OSI MODEL
The Open Systems Interconnection (OSI) model was developed by the International Organisation
for Standardization (ISO) as a model for computer protocol architecture and as a framework for
developing protocol standards in l984. It consists of a set of protocols which facilitate
communication between 2 different systems.
It is an abstract model of how the equipment and network protocols should communicate and
cooperate for effective data transmission. Note that it is not a protocol but it is technology
standard by ISO.
The OSI model is a layered framework. It divides the entire data communication into small tasks or
subtasks, known as layers. These are seven layers in the OSI stack, divided into two groups as Upper
layers and Lower layers. Let us study them.
Upper Layers
7. Application Layer: It provides access to the OSI environment for users by giving an interface
through which users can communicate and data can be transferred on the network. It also provides
distributed information services.
6. Presentation Layer: It is responsible for Encrypting, Decrypting, Compressing and Decompressing
of Data during Data Transfer. It also decides how to present data to different computers by
converting it into a particular format, supported by specific computer.
5. Session Layer: It controls communication between the computers on the network. Is also notifies
the errors, if any, in the layers above it. It also decides when to set up or to break the connection
between the computers or devices.
Lower Layers
4. Transport layer : It facilitates delivery of packets in a proper sequence, by ensuring that data is
properly delivered at the correct destination and by keeping track of all packets which don’t reach
the destination and by transmitting them again.
3. Network Layer: It transfers packets from source to destination. It also identifies ways for
transferring data from one device to other over the network on the basis of the IP addresses. It
stops overloading of packets on the network and, if required, may break the large packets into
smaller size packets.
2. Data Link Layer : It specifies the action required to maintain the network communication.It
collects the packets to form frames which are transmitted over the network using hop-to-hop
delivery. It also identifies and removes errors during transmission of packets.
l. Physical Layer : It deals with the mechanical, electrical, functional and procedural characteristics
to access the physical medium of transmission, like it can specify the layouts of cables, hubs, etc. It
defines the relation between a single device and transmission medium, by specifies the ways in
which data transfer should take place.
In this section we will learn about types of connections available for internet, its working, the
services available, like E-mails, World Wide Web, Search engines, etc. Though, everybody knows
about the Net and the Web, let us have its brief introduction.
CYBER CRIMES, SNIFFING, SPOOFING
CYBER CRIMES
Internet has become a part of every bodies life. Specially lots of communication is dependent on
mobile irrespective of age group, educational status, races. Money transaction is done through
networking and ATM. Besides Social activities are also based on internet tremendously.
Practically real life and Virtual life in cyber space are being liver in parallel through internet. Hence
Cyber crimes are affecting society speedily. These criminals have low technical skill and lead
thousand of rupees a day without leaving their home and sell drugs with low risk. Wider area is
covered with internet speed using less time and cost. In globalization era cyber crimes has buoyant
international market in e-commerce for skill, tools and finished products. Most of the crimes are
linked with credit cards and online banking.
In the course of e-governance cyber crime is cracking government or companies or organisations
website and exposing them with risk to even changes in the interrupted policies. In industrial
matters electronic scams can affect customers or suppliers eg 2G scam. The sale of private digitized
data may cause a loss of individual at monetary, emotional and social front. In case of cyber crime
victimization organizations group of people or countries suffer due to faked documents.
Cyber crime is defined as an criminal act of using computer networks cyber space and world wide
web. It also includes traditional crimes through internet. For example internet fraud, Identity theft,
credit card account theft, illegal use software such as downloading music, cyber stalking denial of
service, virus dissemination, internet relay chat crime, credit card fraud, net extortion, trafficking in
child pornography, digital piracy, money laundering, phishing and counterfeiting.
In order to control the crime information technology act 2000 was amended in 2008. Cyber crime
investigation cell Mumbai police is located since 2000 at Annex III, Cyber Crime Investigation Cell
Office of Commissioner of Police, D.N. Road,Mumbai-l and on world wide net its address is
www.cybercellmumbai.gov.in From Punjab Mr. Kunwar Vijay Pratap Singh, India.-Deputy Inspector
General of Police, Punjab State Cyber Crime Cell, Mohali had contributed in specialized areas of
Criminal Law, Constitutional Law, Cyber Law and Service Law. Hand Book on Cyber laws and
investigation also enables one to prevent of being victimized. Some law firm s like http://
cybercrimeindia.org/ set the motive to redress victims of cyber crimes such as Copy right act,
Identity theft, Hacking, Pornography, cyber attacks, Online fraud.
Besides this following are some of the examples of cyber crime:
l. A recent news 2 June 20l4- Russian Evgeniy Bogachev sought over cybercrime botnet By Dave
Dave Lee Technology reporter, BBC News:” Evgeniy Bogachev was belived to be living in Russia, the
FBI said- The US has charged a Russian man with being behind a major cybercrime operation that
affected individuals and business worldwide.
2. News about MUMBAI, 20 September 2007-Maharashtra official web site was hacked in early
hours of Tuesday.
3. A news about MMS porn case- The CEO of bazee.com (an Ebay Company) was arrested for
allegedly selling the MMS clips involving school children on its website is the most apt example in
this reference.
4. The newspaper Mid-Daily published the pictures of the Indian actor kissing her boyfriend at the
Bombay nightspot and the arrest of Krishna Kumar for illegally using internet account of Col. (Retd.)
J.S.Bajwa.
5. The news of Aug. 20l3 New Delhi A total of 78 government websites were hacked and l6,035
incidents related to spam malware infection and system break-in were reported this year so far,
Minister of State for Communication & IT Milind Deora said.
SOME ACTIVITIES/ PACKAGES LEADING TO CYBER CRIMES
Hacking :Initially hacker was used for the talented programmers. Now a days many programmers
who are unauthorized used to work unethically on internet and computer so break network code
and passwords. Hacking is defined in wiktionary unauthorized access to computer, program, data or
network resource. Hackers write or use ready made programs to attack computers. Hackers desires
to destruct system programs or data. As per Computer society of India these are categorized as
(i) White hat hackers- The white hat hackers observe ethical rules, they are familiar with internet
details of the system and decode program for the betterment of system.
(ii) Grey hat hackers- IT cross between black and white hat hackers.
(iii) Black hat hackers-The black hat hackers are familiar with internet details of the system, use
them for phishing or for online fraud or scam.
Black hat hacker are involved exclusively to commit cybercrime.
Sniffer
According to wikitionary A network sniffers monitors data flowing over computer network links. It
can be a self-contained software program or a hardware device with the appropriate software or
firmware programming. Also sometimes called “network probes” or “snoops”, sniffers examine
network traffic, making a copy of the data but without redirecting or altering it. Some sniffers work
only with TCP/IP packets, but the more sophisticated tools can work with many other protocols and
at lower levels including Ethernet frames. They are used by hackers or people curious about
network traffic.
The popularity of packet sniffing stems from the fact that it sees everything.
Typical items sniffed include:
 SMTP, POP, IMAP traffic
Allows intruder to read the actual e-mail.
 POP, IMAP, HTTP Basic, Telnet authentication
Reads passwords off the wire in clear-text.
 SMB, NFS, FTP traffic
Reads files of the wire.
 SQL database
Reads financial transactions and credit card numbers.
Not only can sniffing read information that helps break into a system, it is an intrusion by itself
because it reads the very files the intruder is interested in.
This technique can be combined with active transmission for even more effective attack.
Spoofing :
As per Wikipedia, In relation of network security, spoofing attack means one person or program
successfully masquerades as another by falsifying data and thus gains illegitimate advantage.
Types of spoofing are as follows:
 TCP/IP sppofing
 Referrer spoofing
 Poisoning of file-sharing networks
 Caller ID spoofing
 E-mail address spoofing
 Gps spoofing
l. TCP/IP spoofing : Many of the protocols TCP/IP suite do not provide mechanism for
authentication receiver/senders address. When the sniffing program is on a segment between two
communicating end points, the intruder can impersonate one end in order to hijack the connection.
This is often combined with a denial of service (DOS) attack against the forged address so they
don’t interface anymore.
Allows abnormal traffic to be generated, such as TCP SYN floods, overlapped fragments, illegal
fragments, and TCP fingerprinting. The best attack is serve fragmentation, which fragments the TCP
header in order to prevent firewalls from filtering by port number.
Packet sniffing tools are usually written by hackers. There are many extensions for pulling desired
data off the network. The most popular are password sniffing programs.
Use of Firewalls which take care of deep packet investigation can mitigate TCP/IP snoofing attack.
2. Referrer spoofing: Some of websites especially pornographic paid site allow access by checking
referrer.
Header of http request. If this referrer header is changed to allow user to have unauthorized access.
It is called refer spoofing.
Poisoning of files-sharing networks. Spoofing can also refer to copyright holder by placing distorted
files in files sharing network.
3. Caller ID spoofing: Public telephone networks generally provide Caller ID information i.e. the
caller’s name and number, with each call. However, some technologies (especially in Voice over IP
(VOIP) networks) allow callers to forge Caller ID information and present false names and numbers.
Gateways between networks that allow such spoofing and other public networks and numbers.
Gateways between networks that allow such spoofing and other public networks then forward that
false information. Since spoofed calls can originate from other countries, the laws in the receiver’s
country may not apply to the caller. This limit’s laws’ effectiveness against the use of spoofed Caller
ID information to further a scam.
4. E-mail address spoofing: The sender information shown in e-mails (the “From” field ) can be
spoofed easily. This technique is commonly used by spammers to hide the origin of their e-mails
and leads to problems such as misdirected bounces (i.e. e-mail spam backscatter).
E-mail address spoofing is done in quite the same way as writing a forged return address using snail
mail. As long as the letter fits the protocol, (i.e. stamp, postal code) the SMTP protocol will send the
message. It can be done using a mail server the telnet.
Spam, unsolicited electronic message. Although e-mail is the most common means of transmitting
spam blogs, newgroups, social networking sites and cellular telephones are focused on targeted.
Viewed with widespread disdain, spam nonethesless remains a popular marketing tool. Spammers
are using to promote various scams and advertise pornography. Spams also contains virus or
malicious software (malware) that can invade computer (Zombies computer) and spammer can get
remote access. These zombies can make a network which is called botnet. This bot net can be
furtively controlled by spammer used to distribute spams or cyber-crime. Filtering software are
used to stop spam.
5. GPS Spoofing : A GPS spoofing attack attempts to deceive a GPS receiver by broadcasting
counterfeit GPS signals, structured to resemble a set of normal GPS signals, or by rebroadcasting
genuine signals captured elsewhere or at a different time. One of the example is the capture of a
Lockheed RQ-l70 drone aircraft in northeastern Iran in December, 20ll.

State of Cyber laws in India related to cyber crimes:


Different countries have their own cyber laws to control cyber crimes. However in India actually
there is no term cyber crime defined in as per Indian cyber laws even after IT (amendment) Act
2008. However as the Term “Cyber security” is defined under section 2(b) which means protecting
information, equipment, devices computer, computer resource, communication device and
information stored there in from unauthorized access, use, disclosure, disruption modification and
destruction. Cyber laws is described in connection with communication technology legal issues
relation of “cyber space” i.e. internet. Cyber crime and punishment explained under article “Types
of Cyber crime Law & Cyber Security” Part I by Expert. Extract is as follows:
Offence Provision under Indian law
Hacking Under IT Act 2008 amendment, section 43(a) read with section 66 is
applicable, Under section 309 & 404 of Indian penal code & l860 are also
applicable Offence is cognizable and bailable Punishment –Max 3 year, fine
max. lakh
Data theft Under IT Act 2008 amendment, section 43 (b) read with section 66 is
applicable, under section 379, 405 & 420 of Indian penal code & l860 are also
applicable Offence is cognizable and bailable
Spearding virus IT Act 2008 amendment section 43(c) and 43 (e) read with section 66 is
and worms applicable, under section 268 of Indian penal code & l860 are also applicable
Offence is cognizable and bailable
Identity theft IT Act 2008 amendment section 43(b) read with section 66(c) is applicable,
under section 4l9 of Indian penal code & l860 are also applicable Offence is
cognizable and bailable
Email Spoofing IT Act 2008 amendment, section 66-D is applicable, under section 4l7,4l9,465
of Indian penal code & l860 are also applicable Offence is cognizable and
bailable
Defensive mechanism to protect computers and network resources- Antivirus, Fire walls and
Spyware utilities
It better to understand how to safe guard computer resources. Defensive mechanism is universally
adopted to work on internet safely by using standard hardwares as well as authentic soft wares
under the certified companies.
Anti Virus: Virus is a program inserted into another program. There are boot sector viruses, file
viruses, Multipurpose viruses like Torjan Horse, logic Bomb, Worms. Anti-virus program are
designed to defeat virus attack which gives rises to the problem of productivity, corrupted files, lost
data, unreliable applications, system crashes screen messages and lock-up. This can be avoided
antivirus packages like Norton-protects system through easy interface, Macfee Virus scan-capable
of detection and disinfection, Red alert- automatically restore partition & boot record and checks
viruses in attachments you receive through e-mail.
Fire Wall: It is to most commonly used network protection. It is a fence between two networks
internal network and eternal network i.e. internet. It gives level wise authority to insiders to work
with freedom for services to externals while it grant access to external network with log on name
and passwords, IP address etc. Computer user should get Firewall to protect computer and network
resources.
There are two types of firewall [ www.computerhope.com] :
l. Hardware firewall : A Hardware firewall device is to be used to network. Often many home users
who have a home network can use their network router as a firewall solution a network security
device with a firewall and other security option, like the ZyXEL Zy WALL.
2. Software firewall : The widely used software programs are installed as firewall programs which
protects computers from unauthorized incoming and outgoing data. Some of such software
programs and antivirus programs companies are named below.
Software Firewall programs :
 Agnitum Outpost Firewall
 BlackICE PC Protection
 Kerio Personal Firewall
 Sygate Firewall
 Tiny software Tiny Personal Firewall
 Network Associates
 Zone Labs Zone Alarm
3. Anti-Spyware utilities: Spyware personal information from you without your knowledge,
understanding or consent. Spyware collects the information from all the websites you visit including
user name and passwords. The spywares are generally embedded and unnecessary internet
settings.
Windows Antispyware (Beta) protects window user from spyware. Ad-ware is a privacy tool It
prorects computer resources from known datamining. Hijackthis program used to detect browser
hijacker. Spyware cleaner removes spyware utility by scanning memory registry and hard drives.
Spyware Doctor protects privacy. It detects spyware utility and clean potential software.
Precautions to be taken by computer device/ internet user for not being victimized :
For not being victimized by computer crimes one has to take precautions:
(i) Never open or run an attachment it may contain virus.
(ii) Keep direct contact with bank because e-mail fish will never request any of your personal
details.
(iii)Keep on changing your password.
(iv) Include numbers and special character in password.
(v) Never store important security code etc. on computer desk.
(vi) Do not share your password with anyone.
(vii) Use antivirus, hardware and software fire walls and anti-spy wares.
(viii) Use licensed copy of software and devices.
CHAPTER 2 : MICROSOFT EXCEL

FUNCTIONS IN EXCEL
PV:-
Purpose: Returns the Present value of an investment. The present value is the total amount that a series of
payments is worth now. For example, when you borrow money, the loan amount is the present value future
to the lender.
Syntax: PV (rate, nper, pmt, fv, type)

PMT:-
Purpose: Calculates the payments for a loan based on constant payments and a constant interest rate.
Syntax: PMT (rate, nper, pv, fv, type)

PPMT
Purpose: Returns the payments on the principal for a given period for an investment based on periodic,
constant payments and a constant interest rate.
Syntax: IPMT (rate, per, nper, pv, fv, type)

IPMT
Purpose: Returns the interest payment for a given period for an investment based on periodic, constant
payments and a constant interest rate.
Syntax: IPMT (rate, per, nper, pv, fv, type)

NPER:
Purpose: Returns the number of periods for an investment based on periodic, constant payments and a
constant interest rate.
Syntax: NPER (rate, pmt, pv, fv, type)

RATE:
Purpose: Returns the interest rate per period of an annuity. RATE can have zero or more solutions.
Syntax: RATE (nper, pmt, pv, fv, type, guess)

MATHEMATICAL AND STATISTICAL FUNCTIONS


ROUND:
Purpose: Rounds a number to a specified number of digits.
Syntax: ROUND (number, num_digits)

ROUNDDOWN:
Purpose: Rounds a number down towards zero.
Syntax : ROUNDDOWN (number, num_digits)

ROUNDUP
Purpose: Rounds a number up, away from zero.
Syntax: ROUNDUP (number, num_digits)

CEILING:
Purpose: Returns number rounded up, away from zero, to the nearest multiple of significance.
Syntax: CEILING (number, significance)
FLOOR:
Purpose: Returns number down, toward zero, to the nearest multiple of significance.
Syntax: FLOOR (number, significance)

INT:
Purpose: Rounds a number down to the nearest integer.
Syntax: INT (number)

MAX:
Purpose: Returns the largest value in a set of values.
Syntax: Max (numl, num2, num3,….) where numl, num2, num3,….. are up to 30 arguments for which you
want to find the maximum value.

MIN:
Purpose: Returns the smallest value in a set of values.
Syntax: MIN(numl, num2, num3,…..) where numl, num2, num3,…. Are up to 30 arguments for which you
want to find the minimum value.

MOD:
Purpose: Returns the remainder after number is divided by divisor. The result has the same sign as divisor.
Syntax: MOD (number, divisor)

SQRT:
Purpose: Returns the positive square root of its argument.
Syntax: SQRT (number).

ABS:
Purpose: Returns the absolute value of a number. The absolute value of a number is the number without its
sign.
Syntax: ABS (number), where number is the real number whose absolute value you want.
Example: ABS(7)=7

SUM:
Purpose: Adds all the numbers in a range of cells.
Syntax: SUM (num l,num 2, num3,…..)

AVERAGE: ,
Purpose: Returns the average (arithmetic mean) of the arguments.
Syntax: AVERAGE (numl, num2, num3,….)

COUNT:
Purpose: Returns the number of values in a range.
Syntax: COUNT (Value l, value2,…)
Module – ll (Practical)
CREATING TABLES

Write MySQL command to create the following tables:

a) Table STUDENT having the following columns:

Roll no: integer should automatically increase by l, primary key.

Name : Character variable width 20 columns.

Age : integer default value 20.

Marks : integer should not be empty.

Mysql> create table student

 (rollno smallint auto_increment primary key,


 name varchar (20),
 age smallint default 20,
 marks smallint not null);

b) table EMP having the following columns:

Employee number : integer primary key

First name : character variable width 20 columns

Middle name : character variable width 20 columns

Last name : character variable width 20 columns

Gender : character l columns

Salary : 5 integers and 2 decimals

Married : True or False

Mysql> create table emp

 (empno smallint primary key,


 fname varchar(20),
 mname varchar(20),
 lname varchar(20),
 gender char(l),
 salary decimal(7,2),
 married Boolean);

c) Table DEPARTMENT having the following columns:

Department number : integer primary key

Department name : character variable width 20 columns

Manager identity no : integer


Target : very large integer number

Location : character variable width 20 columns

Employee no : integer foreign key to table EMP

Mysql> create table department

 (deptno smallint primary key,


 Deptname varchar(20),
 Mgrid smallint,
 target bigint,
 location varchar(20),
 empno smallint,
 foreign key (empno) reference emp (empno));

d) Table CAR having the following columns:

Car make : character variable width 20 columns should not be empty

Registration no : character variable width l5 columns primary key

Cost of the car : 7 integers 2 decimals

Date of purchase : date

Mysql> create table car

 (car_make varchar(10) not null,


 regn_no varchar(15) primary key,
 cost decimal(9,2),
 dop date);

e) Table EMPLOYEES having the following columns:

Employee ID : integer should not be empty, primary key

First name : character variable width 20 columns

Last name : character variable width 20 columns

Email : character variable width 25 columns

Phone number : character variable width l0 columns

Hire date : Date

Job ID : character variable width l0 columns

Salary : 6 integers, 2 decimals

Commission : 4 integers 2 decimals

Manager ID : integer

Department ID : integer
Mysql> create table employees

 (emp_id smallint not null primary key,


 fname varchar(20),
 lname varchar(20),
 email varchar(25),
 phoneno varchar(l0),
 hire_date date,
 jobid varchar(l0),
 salary decimal(8,2),
 commission decimal(6,2),
 manager_id smallint,
 dept_id smallint);

f) Table JOB_GRADES having the columns:

Grade_level : character l columns should not be empty

Lowest salary : 6 integers and 2 decimals

Highest salary : 7 integers and 2 decimals

Mysql> create table job_grades

 (grade_level char(l) not null,


 Lowest_sal decimal(8,2),
 Highest_sal decimal(9,2));

Module ll(practicals)
Modifying Tables
Write MySQL statement for the following:
a) Add a column ‘gender’ of character type of size l column to this table.

Mysql> alter table pay

 Add gender char(l);

b) Add a column ‘bonus’ decimal(7,2) to this table after the salary column with default value 2000.

Mysql> alter table pay

 Add bonus decimal(7,2) default 2000 after salary;

c) Change the size of column ‘name’ to voucher(25)

mysql> alter table pay

 Modify name varchar(25);

d) Change the name of the column ‘bonus’ to ‘mbonus’.

Mysql> alter table pay

 Change bonus mbonus decimal(7,2) default 2000;


e) Change the name of the column ‘dob’ to ‘d_birth’.

Mysql> alter table pay

 Change dob d_birth date;

f) Delete the column mbonus.

Mysql> alter table pay

 Drop mbonus;

g) Rename the table PAY to EPAY.

Mysql> alter table pay rename epay;

h) Delete the table EPAY.

Mysql> drop table epay;

Module – ll (Practicals)
Inserting/Altering Data

a) Create a table called MY_EMPLOYEE containing the columns employee id smallint which will be the
primary key , last name varchar(25) , first name varchar(25) userid varchar(8), and salary decimal (9,2).
Mysql> create table my_employee
-) (empid smallint primary key,
-) lname varchar(25),
-) fname varchar(25),
-) userid varchar(8),
-) salary decimal(9,2));
b) Display the structure of MY_EMPLOYEE table listing the names of the columns.
Mysql> desc my_employee;

Field Type Null Key Default Extra


empid smallintt(6) No PRI NULL
lname varchar(25) YES NULL
fname varchar(25) YES NULL
userid varchar(8) YES NULL
salary decimal(9,2) YES NULL

c) Add a row to the table MY_EMPLOYEE without naming the coloumns. Use your own data, but give employee id as l.
mysql> insert into my_employee values
-) (l, ‘shah’ ,’ Bobby’, ‘bobl’ ,35000);
d) Add another row to the table MY_EMPLYOEE using the columns names. Use your own data but give employee id as
2.
Mysql> insert into my_employee values
-) (2,’mehta’ , ‘jignesh’,’jig2 , 40000);
e) Add another 3 rows of data together to the table MY_EMPLOYEE. Use ypur own data but give employee id as 3,4,5.
Mysql> insert into my_employee values
-) (3,’kapur’ , ‘kiran’ , ‘kir3’ ,33000),
-) (4 ,’joshi’ , vaibhav’,’vai4’ , 43000),
-) (5, ‘shroff’,’bhikaji’,’bhi5’ ,49000);
f) Change the last name of employee id 3 to Mehta in the tableMY_EMPLOYEE.
Mysql> update my_employee
-) set lname = ‘mehta’
-) where empid =3;
g) Change the salary of all the employees to 40000 if the salary is below 40000 in the table MY_EMPLOYEE.
Mysql> update my_employee
-) set salary = 40000
-) where salary(40000;
h) Delete the row of employee id 5 in the table MY_EMPLOYEE.
Mysql> delete from my_employee
-) where empid=5;

Module – ll (Practicals)
Queries
Table EMPLOYEES contains the fields emp_id smallint not null, fname varchar(20),Iname archar(20), email varchar(25)
phoneno varchar(10), hire _date, date, jobid smallint, where emp_id is the primary key.
Write MySQL statements for the following:
a) Display the structure of this table:
mysql> desc employees;
Field Type Null Key Default Extra
emp_id smallint(6) NO PRI NULL
fname varchar(20) YES NULL
lname varchar(20) YES NULL
email varchar(25) YES NULL
phoneno varchar(10) YES NULL
hire_date date YES NULL
jobid varchar(10) YES NULL
salary decimal(8,2) YES NULL
commission decimal(6,2) YES NULL
manager_id smallint(6) YES NULL
dept_id smallint(6) YES NULL

b) Add l row of data to this table. Then add another 6 rows.


Mysql> insert into employees values
-) (511,’riyaz’ , gadiwala’,’ [email protected]’,’43551123’,’1999-03-02’,’sal_mgr’,54000,5400,515,104);
Similarly add another 6 rows of data.
c) Display all the rows in this table.
Mysql> select* from employees;
emp-id fname Lname Email Phoneno hire_date Jobid salary
1 dinkar Joshi [email protected] 23994515 2001-10-05 ad_vp 21000
2 Kiran gandhi [email protected] 23889932 1998-02-21 st_clerk 14000
3 Hiral jain [email protected] 26238905 2001-10-12 sa_rep 19000
4 Firdosh mehta [email protected] 24229059 1998-11-24 ac_mgr 25000
511 Riyaz gadiwa m 43551123 1999-03-02 sal_mgr 54000
512 binita l [email protected] 42200115 1999-12-10 pur_mgr 35000
515 pinaz shah [email protected] 23556687 1995-10-20 gen_mgr 55000
Mehta [email protected]
Commission manager_id Dept id
l00.00 515 101
l400.00 512 102
l900.00 511 104
2500.00 511 103
5400.00 515 104
3500.00 515 102
5500.00 NULL 102
d) To display last name and salary of all employees earning more than ₹14000
mysql> select lname,salary
-) from employees
-) where salary>14000;
Lname Salary
Joshi 21000
Jain 19000
Mehta 25000
Gadiwala 54000
Shah 35000
Mehta 55000
6 rows in set (0.03 sec)
e) To display last name and deparment id for employee id 3.
Mysql> select lname,salary
-) From employees
-) where emp_id = 3;
Lname Dept_id
Jain 104

f) To display last name and salary for all employees whose salary is in the range l5000 to 24000.
Mysql> select Iname,salary
-)where salary between 15000 and 24000;
Lname Salary
Joshi 21,000.00
Jain 19,000.00
2 rows in set (0.01 sec)
g) To display last name, job_id and hire date of employees hired between Feb 20, 1998 and May 1, 1998 in
the ascending order of hire date.
Mysql> select lname, job id, hire_date
-)from employees
-) where hire_date)’1998-02-20’ and hire_date(’1998-05-01’
-)order by hire_date;
Lname Job id hire_date
Gandhi St_clerk 1998-02-21
1 row in set (0.00 sec)
h) To display the last name and department of the employees in department l0l or l03 in the alphabetic
order of last name.
mysql> select lname, dept _id
-)from employees
-)where dept_id in (101,103)
-)order by lname;
Lname Dept_id
Joshi 101
Mehta 103
2 rows in set (0.01 sec)
i)To display the last name and salary of employees who earn from l5000 to 24000 and are in department l0l
or 103. Label the columns as Employee and monthly Salary respectively.
Mysql> select lname Employee, salary ‘Monthly Salary’
-)from employees
-)where salary between 15000 and 24000 and dept _id in (101,103);
Employee Monthly Salary
Joshi 21000.00
1 row in set (0.00 sec)

j) To display the last name and hire date of every employee who was hired in 2001.
Mysql> select lname, hire_date
-)from employees
-)where year (hire_date)=2001 or hire_date like ‘2001%’;
Lname hire_ date
Joshi 2001-10-05
Jain 2001-10-12
2 rows in set, 1 warning (0.06 sec)
k) To display the last name and job type of all employees who do not have a manager.
Mysql> select lname, jobid
-)from employees
-)where manager _id is null;
Lname Jobid
Mehta gen_mgr
1 row in set (0.00 sec)
l) Display the last name salary and commission of all employees who earn commissions in the desending
order of salary and commission.
Mysql> select lname, jobid
-)from employees
-)where commission is not null or commission !=0
-)order by salary desc, commission desc;
Lname Salary Commission
Mehta 55000.00 5500.00
Gadiwala 54000.00 5400.00
Shah 35000.00 3500.00
Mehta 25000.00 2500.00
Joshi 21000.00 2100.00
Jain 19000.00 1900.00
Gandhi 14000.00 1480.00
7 rows in set (0.05 sec)
m) Display the last names of all employees where the third letter of the name is an h.
mysql> select lname
-)from employees
-)where lname like’_h%;
Lname
Mehta
Mehta
2 rows in set (0.00 sec)
n) To display the last name of the employees who have an ‘a’ and an ‘e’ in their last name.
mysql>select lname
-)from employees
-)where lname like ‘%a%’ and lname like ‘%e%’;
Lname
Mehta
Mehta
2 rows in set (0.00 sec)
o)To display the last name, jobid and salary of the employees whose jobid is sales rep or store clerk and
whose salary is not equal to 21000, 25000 or 37000.
Mysql>select lname, jobid, salary
-)from employees
-)where jobid in (’st_clerk’ ‘sa_rep’)
-)and salary not in (21000,25000,35000);
Lname Jobid Salary
Gandhi St_clerk 14000.00
Jain Sa_rep 19000.00
2 rows in set (0.01 sec)
p) To display the last name, salary and commission of all the employees whose commission amount is below
2000.
Mysql >select lname,salary,commission
-)from employees
-)where commission (2000;
Lname Salary commission
Gandhi 14000.00 1400.00
Jain 19000.00 1900.00
2 rows in set (0.00 sec)

MODULE- lll (PRACTICALS)


MULTI-TABLE QUERIES
Consider the following tables employees, departments and locations:
Mysql>select *from employee;
Emo fname lname email phon Hire_ jobid salary commi manag depttid
id eno date ssion erid
1 Dinkar Joshi djoshi@h 2399 2001- ad_vp 21000.00 2100.0 515 101
otmail.co 9451 10-05 0
2 m 2
Kiran Gandi kiran@ya 2388 1998- st_clerk 14000.00 1400.0 512 102
hoo.com 9932 02-21 0
3 Hiral Jain hiral@hot 2623 2001- sa_rep 19000.00 1900.0 511 104
mail.com 8905 10-12 0
4 Firdos Mehta firdosh@ 2422 1998- ac_mgr 25000.00 2500.0 511 103
hotmail.c 9059 11-24 0
om
511 Riyaz Gadiw riyaz@ya 4355 1993- sal_mgr 54000.00 5400.0 515 104
ala hoo.com 1123 03-02 0
512 Binita Shah binita@g 4220 1999- pur_mg 35000.00 3500.0 515 102
mail.com 0115 12-10 0
515 pinaz Mehta pin@gmai 2355 1995- gen_mg 55000.00 3500.0 NULL 102
l.com 6687 10-20 0

ows in set (0.00)


Mysql>select *from departments;
Deptid Dept name mgrid locationid
101 admin 515 1700
102 purchase 512 1800
103 accounts 511 1500
104 sales 515 1400

Mysql>select* from location;


Location id Steetdar postalcode city state countryid
1400 19,n.g.road 415510 Aurangabad Maharashtra In
1500 21 marina road 462001 Bhopal Madhyapradesh In
1700 92, hill road 400050 Mumbai Maharashtra In
1800 11 m.g, road 411013 pune Maharashtra In

Manager Id and department Id are common columns in the tables employees and departments. Location Id
is the column common to the tables departments and locations.
Write queries to display the last name, department number and department name for all the employees.
Mysql>(select a.lname.a.dept id,b.deptname
-)from employees a, departments b
-)where a .deptid=b. deptid;
Lname Deptid Deptname
Joshi 101 admin
Gandhi 102 purchase
Shah 102 purchase
Mehta 102 purchase
Mehta 103 accounts
Jain 104 sales
Gadiwala 104 sales

b) Create a unique listing of all jobs that are in department l0l. Include the location of the department in the
output.
Mysql>(select distinct a.jobid,b.locationid
-)from employees a, departments b
-)where a. deptid=b.deptid and a. deptid=l0l;
Jobid Location id
ad_vp 1700

c) To display the last name, department name, location Id and city of all employees who earn a commission.
Mysql> (select a.lname,b.deptname,b.locationid,c.city
-)from employees a, departments b, locations c
-)where a.deptid=b.deptid
-)and b.locationid=c.locationid
-)and a.commission)0;
Lname deptname locationid City
Joshi Admin 1700 Mumbai
Gandhi Purchase 1800 Pune
Shah Purchase 1800 Pune
Mehta Purchase 1800 Pune
Mehta Accounts 1500 Bhopal
Jain Sales 1400 Aurangabad
Gadiwala Sales 1400 Aurangabad
7 rows in set (0.00 sec)

d) Display the last name and department name of all employees who have ‘a’ in their last name.
mysql>(select a.lname,b.deptname
-)from employees a, departments b
-)where a.deptid=b.deptid
and a.lname like’ %a%’;

Lname Deptname
Gandhi Purchase
Shah Purchase
Mehta Purchase
Mehta Accounts
Jain Sales
Gadiwala Sales
6 rows in set (0.00 sec)
e) To display last name job Id, department Id and department name of all employees who work in Mumbai’.
Mysql>(select a.lname,a.jobid,a.deptid,b.deptname
-)from employees a, departments b, locations c
-)where a.deptid=b.deptid
-)and b.locationid=c.locationid
-)and c.city=’mumbai;
Lname Jobid deptid Deptname
Joshi ad_vp 101 Admin
1 row in set (0.00 sec)
f)Display all the employees last names, department name and location Id for employees who have no
manager in the order of employee Id.
Mysql>(select a. lname, b. deptname, b. locationid
-)from employees a, departments b
-)where a. deptid=b. deptid
-)and a. manager_id is null
-)order by a.emp_id;
Lname deptname Locationid
Mehta purchase 1800
1 row in set (0.02 sec)

You might also like