Вы находитесь на странице: 1из 20

OSI(Open Systems Interconnection) MODEL

NETWORKING
A computer network, often simply referred to as a network, is a group of computers and
devices interconnected by communications channels that facilitate communications among users
and allows users to share resources.

Local area network (LAN) : A small network constrained to a small geographic area. An
example of a LAN would be a computer network within a building.
Metropolitan area network (MAN) : Used for medium size area. For example city or a state.
Wide area network (WAN) : A larger network that covers a large geographic area. For example
any network whose communications links cross metropolitan, regional, or national boundaries.

Computer networks can be used for several purposes:


• Facilitating communications : Using a network, people can communicate efficiently and
easily via email, instant messaging, chat rooms, telephone, video telephone calls, and
video conferencing.
• Sharing files, data, and information : In a network environment, authorized user may
access data and information stored on other computers on the network. The capability of
providing access to data and information on shared storage devices is an important
feature of many networks.

OSI model

Open Systems Interconnection model (OSI model) is a way of sub-dividing a communications


system into smaller parts called layers. There are 7 layers in OSI model, in which a layer
provides services to the layer above it and receives services from the layer below it. It relates
with connecting open systems – that is, systems that are open for communication with other
systems.
Terminologies

Packet
A packet is the unit of data that is routed between an origin and a destination on the Internet
When any file is sent from one place to another on the Internet, the Transmission Control
Protocol (TCP) layer of TCP/IP divides the file into "chunks" of an efficient size for routing.
Each of these packets is separately numbered and includes the Internet address of the destination.
The individual packets for a given file may travel different routes through the Internet. When
they have all arrived, they are reassembled into the original file.
Protocol
A communications protocol is the rules or set of instructions for transferring data in or between
computing systems and in telecommunications. Protocols may include signaling, error detection
and correction capabilities. A protocol describes the syntax, semantics, and synchronization of
communication.
Example: TCP/IP

LAYER 1 : PHYSICAL LAYER


The Physical Layer defines the electrical and physical specifications for devices. It provides the
hardware means of sending and receiving data on a carrier such as a copper or optical cable.

The major functions and services performed by the Physical Layer are:
• Establishment and termination of a connection to a communications medium.
• Participation in the process whereby the communication resources are effectively shared
among multiple users.
• Modulation.
• It provides the hardware means of sending and receiving data on a carrier
• Once it decodes the bit stream, the physical layer notifies the data link layer that a frame
has been received and passes it up.

Data Link Layer


The data link layer transforms the physical layer , a raw transmission facility, to a reliable link .
It makes the physical layer appear error-free to the upper layer (network layer) .

Two sub-layers of Data-link layer:-

MAC=Media Access control(controls how a computer on the network gains access to the data
and permission to transmit it.)
LLC=Logical Link control(controls flow control, frame synchronization, error checking)
Data link layer is responsible for moving frames from one hop (node) to the next .

Other responsibilities of the data link layer include the following:

 Framing. The data link layer divides the stream of bits received from the network layer
into manageable data units called frames.

 Physical addressing. If frames are to be distributed to different systems on the network,


the data link layer adds a header to the frame to define the sender and/or receiver of the
frame. If the frame is intended for a system outside the sender’s network, the receiver
address is the address of the device that connects the network to the next one.

 Flow control. If the rate at which the data are absorbed by the receiver is less than the
rate at which the data are produced in the sender, the data link layer imposes a flow
control mechanism to avoid overwhelming the receiver.

 Error control. The data link layer adds reliability to the physical layer by adding
mechanisms to detect and retransmit damaged or lost frames. It also uses a mechanism to
recognize duplicate frames. Error control is normally achieved through a trailer added to
the end of the frame.

 Access control. When two or more devices are connected to the same link, data link
layer protocols are necessary to determine which device has control over the link at any
given time.

Network Layer
The network layer is responsible for the source-to-destination delivery of a packet, possibly
across multiple networks (links). Whereas data link layer overseas the delivery of the packet
between two systems on the same network (links), the network layer ensures that each packet
gets from its point of origin to its final destination.

If two systems are connected to the same link, there is usually no need for a network layer.
However, if two systems are attached to different networks (links) with connecting devices
between the networks (links), there is often a need for the network layer to accomplish source-to-
destination delivery.

Network layer is responsible for the delivery of individual packets from the source host to the
destination host.

Other responsibilities of the network layer include the following :

 Logical addressing. The physical addressing implemented by the data link layer handles
the addressing problem locally . If a packet passes the network boundary, we need
another addressing system to help distinguish the source and destination systems. The
network layer adds a header to the packet coming from the upper layer that, among other
things, includes the logical address of the sender and receiver .

 Routing. When independent networks or links are connected to create internetworks


( network of networks) or large network, the connecting devices (called routers or
switches) route or switch the packets to their final destination. One of the functions of the
network layer is to provide this mechanism.

 Congestion control and packet sequencing.

 Error handing

Transport Layer
The Transport layer is responsible for process-to-process delivery of the entire message. A
process is an application program running on a host. Whereas the network layer overseas source-
to-destination delivery of individual packets, it does not recognize any relationship between
those packets. It treats each one independently, as though each piece belonged to a separate
message, whether or not it does. The Transport layer, on the other hand, ensures that the whole
message arrives intact and in order, overseeing both error control and flow control at the source-
to-destination level.

Transport layer is responsible for the delivery of a message from one process to another.

Other responsibilities of the transport layer include the following:

 Service-point addressing. Computers often run several programs at the same time. For
this reason, source-to-destination delivery means delivery not only from one computer to
the next but also from a specific process (running program) on one computer to a specific
process (running program) on the other. The transport layer header must therefore include
a type of address called a service-point address (or port address) . The network layer gets
each packet to the correct computer.

 Segmentation and reassembly. A message is divided into transmittable segments, with


each segment containing a sequence number. These numbers enable the transport layer to
reassemble the message correctly upon arriving at the destination and to identify and
replace the packets that were lost in transmission.

 Connection control. The transport layer can be either connectionless or connection-


oriented. A connectionless transport layer treats each segment as an independent packet
and delivers it to the transport layer at the destination machine. A connection-oriented
transport layer makes a connection with the transport layer at the destination machine
first before delivering the packets. After all the data are transferred, the connection is
terminated.

 Flow control. Like the data link layer, the transport layer is responsible for flow control.
However, flow control at this layer is performed end to end rather than across a single
link.
 Error control. Like the data link layer, the transport layer is responsible for error
control. However, error control at this layer is performed process-to-process rather than
across a single link. The sending transport layer makes sure that the entire message
arrives at the receiving transport layer without error (damage,loss , or duplication) . Error
correction is usually achieved through retransmission.

SESSION LAYER
The session layer is the network dialog controller.

It establishes, maintains, and synchronizes the interaction between communicating system.

Specific responsibilities of the session layer include the following:

a) dialog control: the session layer allow two system to enter into a dialog. It
allows the communication between two process to take place either in half-
duplex(one way at a time) or full-duplex(two way at a time). For examples,
the dialog between a terminal connected to a mainframe can be half-duplex.

b) Synchronization: the session layer allow the process to add checkpoints


into a stream of data. For example, if a system is sending a file of 2000
pages, it is advisable to insert checkpoints after every 100 pages to ensure
that each 100 page unit is received and acknowledged independently. In this
case, if a crash happens during the transmission of page 523, retransmission
begins at page 501, page 1 to 500 need not be retransmitted.

The Session Layer of the OSI model is responsible for session check pointing and recovery. It
allows information of different streams, perhaps originating from different sources, to be
properly combined or synchronized.

An example application is web conferencing, in which the streams of audio and video must be
synchronous to avoid so-called lip synch problems. Floor control ensures that the person
displayed on screen is the current speaker.Another application is in live TV programs, where
streams of audio and video need to be seamlessly merged and transitioned from one to the other
to avoid silent airtime or excessive overlap.

Fig: session layer


Relationship of the session layer to the transport and presentation layers

PRESENTATION LAYER

The Presentation Layer is Layer 6 of the seven-layer OSI model of computer


networking.

This layer provides independence from differences in data representation (e.g.


encryption) by translating from application to network format, and vice versa. The
presentation layer works to transform data into the form that the application layer
can accept. This layer formats and encrypts data to be sent across a network,
providing freedom from compatibility problems. It is sometimes called the syntax
layer.

The presentation layer is concerned with the syntax and semantics of the
information exchanged between two system.

Specific responsibilities of the presentation layer include the following:

a) Translation: the process (running programs) in two system are usually


exchanging information in the form of character strings, numbers, and so on.
The information should be changed to bit streams before being transmitted,
because different computers use different encoding system, the presentation
layer is responsible for interoperability between these different encoding
methods. The presentation layer at the sender changes the information from
its sender-dependent format into a common format. The presentation layer at
the receiving machine changes the common format into its receiver-
dependent format.
b) Encryption: to carry sensitive information, a system must be able to assure
privacy. Encryption means that the sender transforms the original
information to another form and sends the resulting message out over the
network. Decryption reverses the original process to transform the message
back to its original form.

c) Compression: data compression reduces the no of bits to be transmitted.


data compression becomes particularly important in the transmission of
multimedia such as text, audio and video.

The Presentation Layer is the lowest layer at which application programmers


consider data structure and presentation, instead of simply sending data in form of
datagrams or packets between hosts. This layer deals with issues of string
representation - whether they use the Pascal method (an integer length field
followed by the specified amount of bytes) or the C/C++ method (null-terminated
strings). The idea is that the application layer should be able to point at the data to
be moved, and the Presentation Layer will deal with the rest.

Fig: presentation layer

Relationship between the presentation layer and the application and


session layers
APPLICATION LAYER
The application layer enables the user, whether human or software , to access the
network. It provides user interfaces and support for services such as electronic mail,
remote file access and transfer, shared database management, and other types of
distributed information services.

This layer supports application and end-user processes. Communication partners


are identified, quality of service is identified, user authentication and privacy are
considered, and any constraints on data syntax are identified. Everything at this
layer is application-specific. This layer provides application services for file
transfers, e-mail, and other network software services. Telnet and FTP are
applications that exist entirely in the application level. Tiered application
architectures are part of this layer.

Specific services provided by application layer include the following:

a) Network virtual terminal: a network virtual terminal is a software version


of a physical terminal and allow a user to log on to a remote host. To do so,
the application creates a software emulation of a terminal at the remote host.
The user’s computer talks to the software terminal, which, in turn, talks to
the host, and vice versa. The remote host believes it is communicating with
one of its own terminals and allow you to log on.
b) File transfer, access, and management(FTAM): this application allows a
user to access file in a remote computer( to make changes or read data), to
retrieve files from a remote computer; and to manage or control files in a
remote computer.
c) Mail services: this application provides the basic for e-mail forwarding and
storage.
d) Directory services: this application provides distributed database sources
and access for global information about various objects and services.

Fig: application layer


Relationship of the application layer to the user and the presentation layer

Remember
• A convenient aid for remembering the OSI layer names is to use the first
letter of each word in the phrase:
• All People Seem To Need Data Processing

7)Application Layer All

6)Presentation Layer People

5)Session Layer Seem

4)Transport Layer To

3)Network Layer Need

2)Data Link Layer Data

1)Physical Layer Processing

Summary of layer functions:


INTRODUCTION OF SQL

 WHAT IS SQL?

• SQL STANDS FOR STRUCTURED QUERY LANGUAGE


• SQL IS AN ANSI (AMERICAN NATIONAL STANDARDS INSTITUTE)
STANDARD
• SQL IS A UNIVERSALLY ACCEPTED QUERY LANGUAGE WHICH ACTS AS AN
INTERFACE TO THE RELATIONAL DATABASES TO FETCH, INSERT AND
MANIPULATE THE EXISTING DATA IN THE DATABASE.
 WHAT CAN SQL DO?
• SQL CAN EXECUTE QUERIES AGAINST A DATABASE
• SQL CAN RETRIEVE DATA FROM A DATABASE
• SQL CAN INSERT RECORDS IN A DATABASE
• SQL CAN UPDATE RECORDS IN A DATABASE
• SQL CAN DELETE RECORDS FROM A DATABASE
• SQL CAN CREATE NEW DATABASES
• SQL CAN CREATE NEW TABLES IN A DATABASE
• SQL CAN CREATE STORED PROCEDURES IN A DATABASE
• SQL CAN CREATE VIEWS IN A DATABASE
• SQL CAN SET PERMISSIONS ON TABLES, PROCEDURES, AND VIEWS
ASSIGNMENT 2:-

CREATE A TABLE OF STUDENTS WITH FOLLOWING FIELDS:-


I. NAME, ROLL NO, AGE, GENDER, ADDRESS & MARKS.
II. INSERT 5 RECORDS
III. MAKE ROLL NO. AS PRIMARY KEY
IV. FETCH THE NAME OF STUDENTS WHOSE AGE IS GREATER THAN 20
V. FETCH THE NAME AND ROLL NO. OF STUDENTS WHOSE MARKS ARE
EQUAL TO 500.

SOLUTION:-

CREATE TABLE STUDENTS


(
ROLLNO INTEGER PRIMARY KEY,
NAME VARCHAR(20),
AGE INTEGER,
GENDER VARCHAR(1),
ADDRESS VARCHAR(40),
MARKS INTEGER
)

INSERT INTO STUDENTS VALUES(01,'MANISH',21,'M','PITAMPURA',250)

INSERT INTO STUDENTS VALUES(02,'KOMAL',22,'F','DELHI',350)

INSERT INTO STUDENTS VALUES(03,'RITU',24,'F','GHAZIABAD',400)

INSERT INTO STUDENTS VALUES(04,'ROHIT',23,'M','NOIDA',500)

INSERT INTO STUDENTS VALUES(05,'MAYANK',20,'M','SARITA VIHAR',200)

SELECT* FROM STUDENTS


SELECT* FROM STUDENTS WHERE AGE>20
SELECT* FROM STUDENTS WHERE MARKS=500

ASSIGNMENT 3:-
CREATE A TABLE OF EMPLOYEES WITH FOLLOWING FIELDS:-
I. NAME , ID, SALARY, GENDER, AGE, ADDRESS & DEPARTMENT.
II. ENTER 10 RECORDS
III. FETCH ALL THE DATA
IV. FETCH THE NAME AND SALARY.
SOLUTIONS:-

CREATE TABLE EMPLOYEES


(
EID INTEGER,
ENAME VARCHAR(20),
AGE INTEGER,
GENDER VARCHAR(1),
ADDRESS VARCHAR(40),
DEPARTMENT VARCHAR(20),
SALARY INTEGER
)
INSERT INTO EMPLOYEES VALUES(111,'Dhruv',21,'M','Pitampura','Marketing',20000)
Insert into Employees values(112,'komal',22,'F','Delhi','finance',50000)
Insert into Employees values(113,'Ritu',24,'F','Ghaziabad','HR',60000)
Insert into Employees values(114,'Rohit',23,'M','Noida','IT',40000)
Insert into Employees values(115,'Mayank',20,'M','Sarita vihar','IT & HR',35000)
Insert into Employees values(116,'Divya',21,'F','Rohini','Finance & HR',75000)
Insert into Employees values(117,'Jyoti',22,'F','Mayur vihar','IT & Marketing',45000)
Insert into Employees values(118,'Rahul',23,'M','Preet vihar','HR',70000)
Insert into Employees values(119,'Priyanka',24,'F','Dilshad Garden','IT',25000)
Insert into Employees values(120,'Manish',20,'M','Rajori garden','Marketing & finance',80000)
Select* from Employees
Select* from Employees
where Salary=75000 and EName='Divya'

Select* from Employees


where Salary=40000 and EName='Rohit'
Select* from Employees
where Salary=35000 and EName='Mayank'

Select* from Employees


where Salary=80000 and EName='Manish'

Select* from Employees


where Salary=70000 and EName='Rahul'

Select* from Employees


where Salary=20000 and EName='Dhruv'

Select* from Employees


where Salary=50000 and EName='Komal'

INTRODUCTION OF DBMS
Assignment 4

 What is DBMS?
• DBMS stands for Data Base Management System.
• DBMS is system software used to manage the organization, storage, access,
security and integrity of data in a structured database.
• It accepts requests from the application and instructs the operating system to
transfer the appropriate data.
• There are different types of DBMS products: Relational, Network and
Hierarchical. The most widely commonly used type of DBMS today is the
Relational Database Management Systems (RDBMS).
 Major Features of DBMS
• Data Security
The DBMS can prevent unauthorized users from viewing or updating the
database. Using passwords, users are allowed access to the entire database.
• Data Integrity
The DBMS can ensure that no duplicate records out of the database; for example,
no two customers with the same customer number can be entered.
• Interactive Query
A DBMS provides a query language and report writer that lets users interactively
interrogate the database. These essential components give users access to all
management information as needed.
• Interactive Data Entry and Updating
A DBMS typically provides a way to interactively enter and edit data, allowing
you to manage your own files and databases.
• Data Independence
When a DBMS is used, the details of the data structure are not stated in each
application program. Any change in data structure requires changing all
application programs.
 Data Definition Language (DDL):-
• Used to specify a database scheme as a set of definitions expressed in a DDL
• DDL statements are compiled, resulting in a set of tables stored in a special file called a
data dictionary or data directory.
• The data directory contains metadata (data about data)
• The storage structure and access methods used by the database system are specified by a
set of definitions in a special type of DDL called a data storage and definition language
• Basic idea: hide implementation details of the database schemes from the users

 Data Manipulation Language (DML):-

1. Data Manipulation is:-


 Retrieval of information from the database
 Insertion of new information into the database
 Deletion of information in the database
 Modification of information in the database

2. A DML is a language which enables users to access and manipulate data.

 The goal is to provide efficient human interaction with the system.

3. There are two types of DML:

 Procedural: the user specifies what data is needed and how to get it
 Non-procedural: the user only specifies what data is needed
 Easier for user
 May not generate code as efficient as that produced by procedural languages
4. A query language is a portion of a DML involving information retrieval only. The terms
DML and query language are often used synonymously.

1. Data Definition Language (DDL) statements are used to define the database
structure. Some examples:

• CREATE - To create objects in the database

• ALTER - Alters the structure of the database

• DROP - Delete objects from the database

2. Data Manipulation Language (DML) statements are used for managing data within
schema objects. Some examples:

• SELECT - Retrieve data from the a database

• INSERT - Insert data into a table

• UPDATE - Updates existing data within a table

• DELETE - Deletes all records from a table, the space for the records remain

DBMS Keys
A key is an attribute (also known as column or field) or a combination of attribute that is
used to identify records. Sometimes we might have to retrieve data from more than one
table, in those cases we require to join tables with the help of keys. The purpose of the
key is to bind data together across tables without repeating all of the data in every table.

The various types of key with e.g. in SQL are mentioned below, (For examples let
suppose we have an Employee Table with attributes ‘ID’ , ‘Name’ ,’Address’ ,
‘Department_ID’ ,’Salary’)

(I) Super Key – An attribute or a combination of attribute that is used to identify the
records uniquely is known as Super Key. A table can have many Super Keys.
E.g. of Super Key
1 ID
2 ID, Name
3 ID, Address
4 ID, Department_ID
5 ID, Salary
6 Name, Address
7 Name, Address, Department_ID ………… So on as any combination which can
identify the records uniquely will be a Super Key.

(II) Candidate Key – It can be defined as minimal Super Key or irreducible Super Key.
In other words an attribute or a combination of attribute that identifies the record
uniquely but none of its proper subsets can identify the records uniquely.
E.g. of Candidate Key
1 Code
2 Name, Address
For above table we have only two Candidate Keys (i.e. Irreducible Super Key) used to
identify the records from the table uniquely. Code Key can identify the record uniquely
and similarly combination of Name and Address can identify the record uniquely, but
neither Name nor Address can be used to identify the records uniquely as it might be
possible that we have two employees with similar name or two employees from the same
house.

(III) Primary Key – A Candidate Key that is used by the database designer for unique
identification of each row in a table is known as Primary Key. A Primary Key can consist
of one or more attributes of a table.
E.g. of Primary Key - Database designer can use one of the Candidate Key as a Primary
Key. In this case we have “Code” and “Name, Address” as Candidate Key, we will
consider “Code” Key as a Primary Key as the other key is the combination of more than
one attribute.

(IV) Foreign Key – A foreign key is an attribute or combination of attribute in one base
table that points to the candidate key (generally it is the primary key) of another table.
The purpose of the foreign key is to ensure referential integrity of the data i.e. only values
that are supposed to appear in the database are permitted.
E.g. of Foreign Key – Let consider we have another table i.e. Department Table with
Attributes “Department_ID”, “Department_Name”, “Manager_ID”, ”Location_ID” with
Department_ID as an Primary Key. Now the Department_ID attribute of Employee Table
(dependent or child table) can be defined as the Foreign Key as it can reference to the
Department_ID attribute of the Departments table (the referenced or parent table), a
Foreign Key value must match an existing value in the parent table or be NULL.
(V) Composite Key – If we use multiple attributes to create a Primary Key then that
Primary Key is called Composite Key (also called a Compound Key or Concatenated
Key).
E.g. of Composite Key, if we have used “Name, Address” as a Primary Key then it will
be our Composite Key.

(VI) Alternate Key – Alternate Key can be any of the Candidate Keys except for the
Primary Key.
E.g. of Alternate Key is “Name, Address” as it is the only other Candidate Key which is
not a Primary Key.

(VII) Secondary Key – The attributes that are not even the Super Key but can be still
used for identification of records (not unique) are known as Secondary Key.
E.g. of Secondary Key can be Name, Address, Salary, Department_ID etc. as they can
identify the records but they might not be unique.

What is the difference between a candidate key and...

Candidate key is a Unique Key and it can be used to find out any purticular Tuple(row) in
a table..
a Primary key is also a Candidate Key...

But these are the diff..


1)on a table we can have only 1 primary key but 'N' number of unique keys.
2)Unique key can be null but not a Primary key

For Example:-Create a table Name ‘Employees’ with 3 records and use ALTER, UPDATE,
DROP, DELETE, CREATE and INSERT command.

Solution:-

Create table Employees

EID integer,

EName varchar(20),
department varchar(20),

Salary Integer

Insert into Employees values(10,'Mohit','Marketing',10000)

Insert into Employees values(20,'Rohit','Finance',20000)

Insert into Employees values(30,'Sohan','HR',15000)

Select* from Employees

Alter table Employees add Age Integer

Update Employees set Age=22 where EID=10

Update Employees set Age=24 where EID=20

Update Employees set Age=25 where EID=30

Delete from employees where EID=20

Drop table Employees

MS DOS

 Execute the following commands in Ms Dos:-

• ‘ VER ’ stands for Version


• ‘ DATE ’ to know the date
• ‘ TIME ’ to know the time
• ‘ MD ’ stands for Make Directory
• ‘ Dir ’ stands for Directory
• ‘ CD.. ’ stands for Change Directory
• ‘ CLS ’ stands for Clear Screen
• ‘ EXIT ’ to Exit the document

Вам также может понравиться