Professional Documents
Culture Documents
Database Concepts
Entity- A category of object person, event or thing of interest to an organization about which data is
to be recorded. Example; Employee, Film, Actor, Product, Recipe, Ingredient. Each entity in a
database system has attributes.
Foreign Key- a column or group of columns in a relational database table that provides a link
between data in two tables.
Secondary key- used when the primary key is not totally unique so the combination of two fields will
ensure that data is individually indexed.
Relational Database-
Entity
Attributes
BookID
Referential Integrity-
When tables are linked, it is imported to ensure that if one of the components of one table is
deleted, it wont affect the data in the other table.
Indexing
Normalisation
Process used to come up with the best possible design for a relational database.
Creating Tables
CREATE TABLE customers (id INTEGER PRIMARY KEY, name TEXT, age INTEGER, weight REAL);
Inserting Data
Querying Data
Select everything:
Using CASE:
SELECT name, CASE WHEN age > 18 THEN "adult" ELSE "minor" END "type" FROM customers;
Aggregating Data
Grouping data:
Inner Join:
Outer Join:
SELECT customers.name, orders.item FROM customers LEFT OUTER JOIN orders ON customers.id =
orders.customer_id;
Updating data:
Deleting data:
Isolation - ensures that concurrent execution of transactions leads to the same results as if
transactions were processed one after the other.
Durability - ensures that once a transaction has been committed, it will remain so.
However, an issue with this is deadlock. This is when two people are attempting to
update two records.
Timestamp ordering – the transaction with the earlier timestamp is always applied first.
Commitment ordering- ensures that transactions are not losts when there are two users trying to
Prevents deadlock but blocking one request until the other is completed.
Redundancy- identical systems put n place to reduce data loss so if one system fails the backup
Computers connect with each other using networks. The largest public network in the world is the
internet. This is known as a Wide Area Network (WAN).
A collection of inter-connected networks.
World wide web, WWW. - Information space where wed resources and documents are stored. Often
accessed via URL and browser.
Every computer that is connected to the Internet is part of a network, even the one in your home.
You connect to the Internet Service Provider (ISP) that you are contracted with. When you connect to
your ISP, you become part of their network. The ISP may then connect to a larger network and become
part of that network. An ISP is a company supplying connectivity to the Internet. They also offer:
Email services
Web hosting
VOIP facilities
The browse is the way of accessing the internet (edge, safari, chrome). One way of accessing a particular
page on the internet is to type it's web address or URL into the address bar. Another way of accessing a
web page is to click on a hyperlink. Information can be put on the Internet by anyone:
It may be biased
It may be inaccurate
It may be out-of-date
It may be so biased or inaccurate that it is potentially life-threatening
Every ISP has its own data storage facility (Internet Storage Facility).
Modem-
Modem stands for Modulator / Demodulator
It is needed to convert the digital signal from the computer to an analogue signal used by
telephone lines
A second modem at the receiving end converts the signal back to digital
Router-
A router is a hardware device that allows you to connect several computers and other
devices to a single Internet connection, in a home network.
Many routers incorporate a wireless Access Point (AP), allowing you to easily create a
wireless network.
PC -> Router -> Modem -> Router -> Internet Service Provider (ISP)-> Domain Name Server (DNS)
Each device on a network needs to be uniquely identified so that data can be sent to the correct
destination, much like an address on a letter. The Internet Protocol addressing system is used.
IP Version 4 (IPv4) addresses are made up of four octet values (numerical values described by 8 bits) each
separated by a full-stop. This provides only 4.3 billion addresses for 6 billion people.
IP Version 6 (IPv6) is used to extend this, giving enough for
340,282,366,920,938,463,463,374,607,431,768,211,456 separate addresses
Uniform Resource Locator URLs are used to specify the means of accessing a resource across a network
and its location. The protocol and the domain name of the resource together form the URL.
Domain Name System (DNS)
DNS servers are dedicated computers with an index of domain names and their corresponding IP
addresses. When a computer queries a DNS server for a domain name, the server returns an IP address
that the computer can use to send a message to it.
There are 13 root DNS servers that work together to catalogue every domain name. These are segmented
into geographical groupings or levels. When the IP address of a given domain is not known it is referred
to a related domain server that may know
Resolving an IP address
Suppose that a client has no cached record of an IP address for www.google.co.uk -> It sends a
DNS query for that domain to its specified DNS server. If the DNS server does not have a record
for that domain, it:
-either recursively handles the request so that it can eventually deliver an IP address (or a “DNS
address could not be found” error message),
-refers to a DNS server authoritative for example, .uk and follows this, and subsequent referrals,
to successively lower-level DNS servers.
Domain names must be unique otherwise DNS requests could be confused.
Five global internet registries are responsible for allocating IP addresses to specific domain
names, these registers then work together to maintain a database of address assignments that
ensure an IP is used once and domain names are distinct.
Local Area Networks (LANs) - two or more computers connected together within a small
geographical area e.g. one building/site
One computer, not connected to any other computing device is called a standalone.
Connecting two or more computers together forms a network.
All networks fall into one of two categories:
Local Area Network (LAN)
Wide Area Network (WAN)
Network Topologies
A network topology is the arrangement of the various computing devices which make up a computer
network:
Bus topology: an arrangement where nodes are connected in a daisy chain by a single central
communications channel
All nodes are connected to a single backbone cable –
A node is a point of intersection/connection within a network. In an
environment where all devices are accessible through the network, these
devices are all considered nodes.
Each end of the backbone is connected to either a terminator or a computer which stops
signals ‘bouncing back’
Each node is passive
Data is sent in one direction at a time only
Only one computer can transmit successfully at any one time
Advantages:
Inexpensive to set up
Devices can easily be added
Good for small networks
Disadvantages:
Main cable is a point of failure
Limited cable length- the longer we have to transmit something, the weaker the signal
(signal deteriorates over distance)
Performance degrades with heavy use, owing to data "collisions"
Poor security
Star topology: an arrangement where a central node or hub provides a common connection point for all
other nodes
All Computers are connected to a central node. This is often a
switch
A switch sends each communication to the specific computer it is
intended for
Advantages:
Easy to isolate problems
Good Performance (faster)
More secure if a switch is used as data is sent only to the recipient
Disadvantages:
Can be expensive to set up because of the length of cable required
Central Device is point of failure
Physical vs logical topology
The physical topology of a network defines how the devices are physically connected
The logical topology defines how the devices communicate across the physical topologies
The physical and local topologies are independent of each other, so that a network physically wires in star
topology can behave logically as a bus network.
E.G. Ethernet cable is half-duplex. Therefore when used in a star network, communication can only
happen in one direction at a time as per a bus protocol.
Wi-Fi
Wi-Fi is a wireless networking technology providing high-speed Internet and network connections
Devices connect to the Internet via a Wireless network Access Point (WAP)
Wireless Components:
Wireless Network Interface Card (NIC)
A station consists of a computer and an NIC
Stations share a radio frequency channel
Wireless Access Point (WAP) requires a connection to a router, and the router requires a
connection to a modem
The WAP and the modem are often built into the router
A hub is a common connection point for devices in a network. Hubs connect segments of a LAN. It
contains multiple ports so when a packet arrives at one port, it is copied to the other ports so that all
segments of the LAN can see all packets. Communication with a hub communication is essentially in
a haphazard manner with any device trying to communicate at any time, resulting in many collisions.
A hub broadcasts data to all devices on a network. This can use a lot of bandwidth as it results in
unnecessary data being sent - not all computers might need to receive the data. A hub would be
useful to link up a few games consoles for a local multiplayer game using a wired LAN.
A switch in an Ethernet-based LAN reads incoming TCP/IP data packets/frames containing
destination information as they pass into one or more input ports. The destination information in
the packets is used to determine which output ports will be used to send the data on to its intended
destination. A switch creates an electronic tunnel between source and destination ports for a split
second that no other traffic can enter. This results in communication without collisions.A switch
performs a similar role to a hub and a bridge but is more powerful. It stores the MAC addresses of
devices on a network and filters data packets to see which devices have asked for them. This makes
a switch more efficient when demand is high. If, for example, a game involved lots of data being
passed between machines, then a switch could reduce the amount of latency.
A router can form a LAN by connecting devices within a building. It also makes it possible to connect
different networks together. Homes and businesses use a router to connect to the internet. A router
can often incorporate a modem within the hardware.
Internet Communication
What can slow communication down?
Traffic
Bandwidth
Number of routers that inspect the packet
Circuit Switching-
It involves creating a communication connection between two endpoints for the duration of a phone
call or transfer of data. This is not good for the billions of inter-connected parts of the Internet. It
was created so that a communications channel was developed to be shared so when one
communication was temporarily not using it another communication could.
Data Packets-
When sending across a network, data is broken into chunks called data packets and assembled again
at the receiving end, increasing network efficiency and reliability.
Latency is the time it takes for components to respond to a request. There will be a short delay, even
a few milliseconds between asking the computer to execute a program and it finding the files in the
memory.
Packet Switching-
Packets are often sent across networks that have multiple connections with multiple routes through
to a destination, the networks are often shared. However, each packet takes the fastest available
route, and they don’t all have to take the same route.
Routers forward packets from one network to another, each router stores data about the available
routes to the destination node, then they look up the destination IP address in its routing table to
find the best router to forward the packet to, each transfer between routers is known as a hop.
Routers continue to forward the packet until it reaches its destination node.
Building a Packet-
A data packet is often referred to as the payload.
Packets are kept small to ensure individual packets do not take excessive time to transfer preventing
other packets from moving.
A packets header contains the recipients address so that it can be directed appropriately across the
network, the address of the sender is also included so that replies can be sent appropriately, the
packet number and overall number of packets in the transmission is attached to assist in
reassembling the data, the Time To Live (TTL) or hop limit is also included.
A packets trailer contains error checking components that verify the data received in the payload has
not been corrupted on transfer, techniques such as checksums (Cyclical Redundancy Checks (CRCs))
are used to check the data by the receiving host. The same checksum is recalculated at the
destination end, and if they do not match the data has become corrupted and is refused and a new
copy is requested to be sent again.
What is a protocol?
A protocol is a set of rules of the format of a digital transmission. It covers:
The size of packets
The contents
Format of the header
The error detection
Correction procedure
What is a gateway?
A gateway is required where data is travelling from one network to another that use different
protocols. Networks using different transmission media can require a gateway, and header data is
removed and reapplied using the correct format of the new network. A router can gateway are often
combined into one integrated device.
TCP/IP has become the global standard suite of networking protocols, it operates in a stack
consisting of four layers. It is a set of rules used in turn to format a message so that it can be sent
over a network. Each layer provides a specific function within the transmission of the message. The
four layers are:
Application layer:
Used to provide services for applications that want to communicate across a network, often
the internet. It uses high-level protocols, such as SMTP, FTP, HTTP, it just specifies the rules in
which the data should be sent.
Transport layer:
It uses the Transmission Control Protocol (TCP) to establish an end-to-end connection with the
recipient computer. It splits the data into packets and numbers them sequentially (i.e. 1 of 3, 2
of 3…). It also adds a port number to be used based on the protocol. At the receiving end this
layer confirms that packets have been received and requests any missing packets be resent.
Network layer:
Uses the Internet Protocol (IP) to address packets with the source and destination IP
addresses.
Link layer:
The link layer operates across a physical connection, it adds the MAC address of the NIC that
packets should be sent to based on the destination IP address. It will change the sending MAC
address with each hop (e.g. it will change the Routers MAC address to the receiving devices.)
Receiving the data:
At the destination, the message is passed back up through the layers
The Link Layer removes the MAC address from each packet and passes it to the Network Layer
The Network Layer removes the IP address from each packet and passes it to the Transport
Layer
The Transport Layer removes the port number from each packet, reassembles the packets in
the correct order and passes them to the Application Layer
The Application Layer presents the image data for the user in a browser
The protocol for sending emails is SMTP (Simple Main Transfer Protocol). The protocol for receiving
emails is POP3 (Post Office Protocol).
TCP (Transmission Control Protocol)
Breaks up messages sent over the Internet into small chunks called packets
Reassembles the packets at the other end
Detects errors
Resends lost messages
IP protocol
Routes the individual packets between sender and recipient
HTTP (hypertext transfer protocol) is used for accessing and receiving web pages in the form of
HTML files on the Internet. The protocol requests the web server to upload the requested web page
to the user’s browser for viewing
HTTPS (secure protocol) encrypts the information so that it cannot be hacked.
You need four bits of information when sending a packet:
The senders IP
The receivers IP
The sequence number of the packets
The total number of packets expected
Network Security
Firewall:
A firewall acts as a filter or barrier between your own trusted network and another with only certain
data packets across that meet filtering rules. A firewall is either software or hardware that controls
access to and from a network. Ports are opened so only certain traffic is allowed to pass through. A
typical firewall consists of a separate computer containing two NICs with one connected to the
internal network and the other connected to the external network. Using packet filters each packet
of data attempting to get through is analysed against preconfigured rules. A firewall may also act as
a proxy server.
Packet Filtering/ Static Filtering:
Packets of data are inspected by the firewall to check which port they are attempting to access.
Different network protocols use different port numbers for example, HTTP traffic, used to transfer
web page data, uses port 80 or 8080. So the packet filtering controls the access according to
network administrator rules and policies by examining the source and destination IP addresses in
packet headers. If the IP addresses match those on the 'accepted' list then they are allowed through.
Static filtering can also block packets based on protocols being used and port numbers they are
trying to access. If this traffic is to be allowed through, the port must be opened for the duration of
the connection, otherwise the firewall will automatically reject it.
Proxy Servers:
A proxy server makes a web request on behalf of your own computer, hiding the true request IP
addresses from the recipient. It intercepts all packets entering and leaving a network, hiding the true
network addresses of the source from the recipient.
A proxy server:
Enables anonymous surfing
Can be used to filter undesirable online content
Logs user data with their requests
Provides a cache of previously visited sites to speed access - speeds up.
Encryption:
The act of encoding a plaintext message so that it cannot be deciphered unless you have a numerical
key to decrypt it. If the message is intercepted it cannot be understood and if the key is intercepted,
the encryption process is rendered useless.
Network Threats and Malicious Software
Malware annoys users or damages their data.
Worms:
Is a standalone file that does not need a host program to attach itself to, or a users to run it in order
to spread. Instead worms exploit vulnerabilities in the destination system and spread automatically.
It is able to self replicate. A worm is a sub-class of virus, but it is a standalone software that can
replicate itself without any user intervention.
Viruses:
Attaches itself to another file which will activate when you run the other file. They can self replicate
and spread to others by email, local network connection, swapping removable disks, file sharing
through websites.Most viruses become memory resident when their host file is executed and once
the virus is in memory, any other uninfected file that runs becomes infected when it is copied into
the memory. Macro viruses reside in macro files usually attached to word processing and
spreadsheet data files and when the data file is opened the virus infects the template and other files.
However, macro viruses are usually less harmful than other viruses but can still be very annoying.
Trojans:
A non-self-replicating virus that masquerades as a harmless file that you might want to open. They
often they serve to open up back doors in your computer to the Internet so that the processing
power, Internet bandwidth and data can be exploited remotely by the creator of the trojan. This can
then lead to many trojans being sent out creating a botnet.
Phishing:
Phishing is using email to manipulate a victim into visiting a fake website and giving away personal
information.
•Spyware:
Covertly gathers information from your computer, it can collect usernames and passwords, email
addresses or credit card details. It can also install more spyware on your machine to read your
cookies and change your system preferences. The information is all sent back to the spyware author
who can use or sell the data for advertising or crime including identity theft.
•Adware:
It is responsible for the irritating pop-up adverts that you may see whilst using a computer
Botnets- it will take over your computer and then try to take over other computers.
Denial of service (DoS) attacks- frequently aimed at company or web servers to overload them so
they are forced to crash.
Ransomware is malware that is used to lock your computer or access to your files and you are then
asked for a fee in order to regain access.
Control Signals
Memory read: causes data from the addressed location in RAM to be placed on the data bus
Memory write: causes data on the data bus to be written into the addressed location in RAM
Bus request: indicates that a device is requesting use of the data bus
Bus grant: indicates that the CPU has granted access to the data bus
Clock: used to synchronise operations
Registers
The processor has to temporarily hold the current instruction being executed
It has to hold the address of the data that it needs, and also the data itself
Dedicated Registers
Program counter (PC) – holds the memory address of the next instruction to be executed
Current Instruction Register (CIR) – holds the current instruction, which is split into opcode
and operand
Memory Address Register (MAR) - holds the address in memory where the processor is
required to fetch or store data from or to
Memory Data Register (MDR) – temporarily holds data moving between the processor and
main memory
The role of the processor is to carry out instructions from programs stored in memory. The Control
Unit coordinates components to work together to achieve this.
The CPU…
FETCH – causes the next instruction and any data involved to be fetched from main memory
DECODE – decodes the instruction
Fetch
1. The address of the next instruction is copied from the PC to the Memory Address Register
(MAR)
2. The instruction held at that address is copied to the Memory Data Register (MDR)
4. The contents of the MDR are copied to the current Instruction Register (CIR)
Decode
6. It is split into operand and opcode to determine the type of instruction it is. Additional data,
if required, is fetched from memory…
The address of the data to be used, which is then copied to the MAR, or
8. The instruction is executed and the result held in accumulator or stored in memory.