Tuesday, May 31, 2016

WDP - Database Queries

SELECT

The SELECT statement is used to select data from a database.

SYNTAX

SELECT column_name,column_name
FROM table_name;

        and

SELECT * FROM table_name;

SAMPLE CODE

CustomerIDCustomerNameContactNameAddressCityPostalCodeCountry
1Alfreds FutterkisteMaria AndersObere Str. 57Berlin12209Germany
2Ana Trujillo Emparedados y heladosAna TrujilloAvda. de la Constitución 2222México D.F.05021Mexico
SELECT CustomerName, City FROM Customers;


Output:
CustomerNameCity
Alfreds FutterkisteHamburg
Ana Trujillo Emparedados y heladosMéxico D.F.



JOIN


SQL joins are used to combine rows from two or more tables.


SYNTAX

INNER JOIN table_name

SAMPLE CODE

Customer Table
CustomerIDCustomerNameContactNameAddressCityPostalCodeCountry
1Alfreds FutterkisteMaria AndersObere Str. 57Berlin12209Germany
2Ana Trujillo Emparedados y heladosAna TrujilloAvda. de la Constitución 2222México D.F.05021Mexico


Order Table
OrderIDCustomerIDEmployeeIDOrderDateShipperID
10308271996-09-183
103093731996-09-191

SELECT Orders.OrderID, Customers.CustomerName, Orders.OrderDate
FROM Orders
INNER JOIN Customers
ON Orders.CustomerID=Customers.CustomerID


Output:

CustomerNameOrderID
Ana Trujillo Emparedados y helados10308
Antonio Moreno Taquería10365



INSERT

The INSERT INTO statement is used to insert new records in a table.


SYNTAX
INSERT INTO table_name
VALUES (value1,value2,value3,...);   AND

INSERT INTO table_name (column1,column2,column3,...)
VALUES (value1,value2,value3,...);


SAMPLE CODE

CustomerIDCustomerNameContactNameAddressCityPostalCodeCountry
87Wartian HerkkuPirkko KoskitaloTorikatu 38Oulu90110Finland
88Wellington ImportadoraPaula ParenteRua do Mercado, 12Resende08737-363Brazil

SELECT Orders.OrderID, Customers.CustomerName, Orders.OrderDate

FROM Orders

INNER JOIN Customers

ON Orders.CustomerID=Customers.CustomerID;


Output:
OrderIDCustomerNameOrderDate
10248Wilman Kala1996-07-04
10249Tradição Hipermercados1996-07-05



UPDATE

The UPDATE statement is used to update records in a table


SYNTAX

UPDATE table_name
SET column1=value1,column2=value2,...
WHERE some_column=some_value;


SAMPLE CODE

CustomerIDCustomerNameContactNameAddressCityPostalCodeCountry
1Alfreds FutterkisteMaria AndersObere Str. 57Berlin12209Germany
2Ana Trujillo Emparedados y heladosAna TrujilloAvda. de la Constitución 2222México D.F.05021Mexico


UPDATE Customers

SET ContactName='Alfred Schmidt', City='Hamburg'

WHERE CustomerName='Alfreds Futterkiste';


Output:
CustomerIDCustomerNameContactNameAddressCityPostalCodeCountry
1Alfreds FutterkisteAlfred SchmidtObere Str. 57Hamburg12209Germany
2Ana Trujillo Emparedados y heladosAna TrujilloAvda. de la Constitución 2222México D.F.05021Mexico


DELETE

The DELETE statement is used to delete records in a table.


SYNTAX

DELETE FROM table_name
WHERE some_column=some_value;


SAMPLE CODE

CustomerIDCustomerNameContactNameAddressCityPostalCodeCountry
1Alfreds FutterkisteMaria AndersObere Str. 57Berlin12209Germany
2Ana Trujillo Emparedados y heladosAna TrujilloAvda. de la Constitución 2222México D.F.05021Mexico
DELETE FROM Customers
WHERE CustomerName='Alfreds Futterkiste' AND ContactName='Maria Anders';

Output:

CustomerIDCustomerNameContactNameAddressCityPostalCodeCountry
2Ana Trujillo Emparedados y heladosAna TrujilloAvda. de la Constitución 2222México D.F.05021Mexico
3Antonio Moreno TaqueríaAntonio MorenoMataderos 2312México D.F.05023Mexico


DROP

Indexes, tables, and databases can easily be deleted/removed with the DROP statement.


SYNTAX

DROP TABLE table_name

and

DROP INDEX table_name.index_name


CREATE TABLE

The CREATE TABLE statement is used to create a table in a database.


SYNTAX
CREATE TABLE table_name
(
column_name1 data_type(size),
column_name2 data_type(size),
column_name3 data_type(size),
....
);


SAMPLE CODE
CREATE TABLE Persons
(
PersonID int,
LastName varchar(255),
FirstName varchar(255),
Address varchar(255),
City varchar(255)
);



Output:
PersonIDLastNameFirstNameAddressCity


Ref:

Sunday, May 22, 2016

Networking
- Benefits
- Social Issues
- Business Networks
- Categories

- Topology
defines the structure of the network.
Physical topology is the actual layout of the wire or media.

Logical topology defines how the media is accessed by the hosts for sending data. 

- Devices/Equipments
Equipment that connects directly to a network segment is referred to as a device. These devices are broken up into two classifications:
End-user Devices
provide users with a connection to the network are also referred to as hosts
 - allow users to share, create, and obtain information
devices are physically connected to the network media using an NIC


Network Devices
—- provide transport for the data that needs to be transferred between end-user devices. 
-—Provide extension of cable connections, concentration of connections, conversion of data formats, and management of data transfers.


- NIC
NIC is a printed circuit board that fits into the expansion slot of a bus on a computer motherboard, or it can be a peripheral device.

Wednesday, May 18, 2016

CN - VLSM Exercises

VLSM : EXERCISES

Exercise 3

We want to divide 192.168.10.0, which is a class C network, into four networks, each with unequal of IP address requirements as shown below:
·         Subnet A = 32 hosts
·         Subnet B = 8 hosts
·         Subnet C = 22 hosts
·         Subnet D = 60 hosts

Subnet D – 60 = 26 = 64 – 2 = 62 hosts          S = 22
Subnet A – 32 = 26 = 64 – 2 = 62 hosts           S = 22
Subnet C – 22 = 25 = 32 – 2 = 30 hosts          S = 23
Subnet B – 8 = 24 = 16 – 2 = 14 hosts            S = 24

Network Name
Network Address
Host Range
Broadcast Address
Subnet Mask
Subnet D
192.168.10.0
192.168.10.1 - 192.168.10.62
192.168.10.63
255.255.255.192
Subnet A
192.168.10.64
192.168.10.65 - 192.168.10.126
192.168.10.127
255.255.255.192
Subnet C
192.168.10.128
192.168.10.129 - 192.168.10.158
192.168.10.159
255.255.255.224
Subnet B
192.168.10.160
192.168.10.161 - 192.168.10.174
192.168.10.175
255.255.255.240


Exercise 4

Given a network of 201.4.3.0/24, subnet the network in order to create the subnetworks with the following requirements.
·         Office 1 – 14 host
·         Office 2 – 60 host
·         Office 3 – 32 host
·         Office 4 – 7 host
·         Office 5 – 15 host

Office 2 – 60 = 26 = 64 – 2 = 62 hosts           S = 22
Office 3 – 32 = 26 = 64 – 2 = 62 hosts           S = 22
Office 5 – 15 = 25 = 32 – 2 = 30 hosts           S = 23
Office 1 – 14 = 24 = 16 – 2 = 14 hosts           S = 24
Office 4 – 7 = 24 = 16 – 2 = 14 hosts             S = 24

Network Name
Network Address
Host Range
Broadcast Address
Subnet Mask
Office 2
201.4.3.0
201.4.3.1 - 201.4.3.62
201.4.3.63
255.255.255.192
Office 3
201.4.3.64
201.4.3.65 - 201.4.3.126
201.4.3.127
255.255.255.192
Office 5
201.4.3.128
201.4.3.129 - 201.4.3.158
201.4.3.159
255.255.255.224
Office 1
201.4.3.160
201.4.3.161 - 201.4.3.174
201.4.3.175
255.255.255.240
Office 4
201.4.3.176
201.4.3.177 - 201.4.3.190
201.4.3.191
255.255.255.240