Link

Wednesday, September 16, 2009

SQL, ( Structured Query Language )

What is SQL?

The Structured Query Language is used in manipulating data stored in Relational Database Management Systems (RDBMS). SQL provides commands through which data can be extracted, sorted, updated, deleted and inserted. SQL has the full support of ANSI (American National Standards Institute), which has laid down certain rules for the language.
SQL can be used with any RDBMS such as MySQL, mSQL, PostgresSQL, Oracle, Microsoft SQL Server, Access, Sybase, Ingres etc. All the important and common SQL statements are supported by these RDBMS, however, each has its own set of proprietary statements and extensions.

The SQL tutorial on webdevelopersnotes.com

As I mentioned before, SQL is a general query language for several different kinds of databases. The SQl tutorial on this site is has been built around MySQL, which is a open source RDBMS available for download at MySQL.com. However, I have tried to avoid the commands specific to MySQL in this SQL tutorial. The SQL tutorial would help build a strong foundation in the SQL language and you can then port your knowledge to the specific RDBMS you plan to use.

Why MySQL?

Choosing a database system depends on three main factors; the platform on which you work, your finances and what you want to achieve. The reason I chose MySQL is because, I work mostly on the Linux system and MySQL is free for Linux. Also, I am an ardent supporter of Open Source Software movement and firmly believe that the combination of Linux, Apache, MySQL and PHP (LAMP) is hard to beat.

What are databases and why do we need them?

In simplest terms, databases are store houses of data. Suppose you have an ASCII file that contains the names of your friends and their email addresses. Would you consider this file as a database? Technically, yes! You can add, update and delete data from this file. You may also write a small program (say in Perl or C) to extract, sort and display data on the basis of some search criterion.
The need to store data is quite a fundamental to humans. Data storage and representation has been with us for thousands of years. Take the example of cave drawings (graphical data) or charting the course of seasons over the years (this would have helped in knowing the best times to sow or to migrate). Collecting data is important but more significant is the analysis of the data. A case in point is study of the movements of astronomical objects (stars, planets, the moon and the sun). Analysis of this data gave birth to two sciences, Astronomy and Astrology. Astonomy helps us predict tides, eclipses etc. Astrology on the other hand had provided loads of entertainment (!) to avid followers over the years.
Coming back to the topic at hand, storing data is of prime importance because we can then analyse the data and extract some Information.

Tutorial TCP Mapping dgn Linux

Sebelumnya saya terbiasa menggunakan WinGATE untuk melakukan tcp mapping, yaitu mengalihkan routing yang meminta paket dari port tertentu. Misalnya klien membutuhkan akses ke sebuah IP (contoh: 202.0.0.1 port 22) yang berada di luar jangkauan si klien, tentunya hal tersebut dapat dipenuhi apabila ROUTER yang menjembatani antara 2 network tersebut dapat mengakses IP tujuan, caranya dengan men-set tcp mapping pada port tertentu misal (8000). Dengan konfigurasi tersebut klien hanya tinggal mengakses IP proxy dengan port 8000 maka ROUTER akan meneruskan paket tersebut ke IP 202.0.0.1 port 22.

Dengan metoda yang sama dapat juga dilakukan dengan linux:

iptables -t nat -A PREROUTING -i eth0 -p tcp –dport 8000 -j DNAT –to 202.0.0.1:22
iptables -t nat -A POSTROUTING -o eth0 -p tcp -s 202.0.0.1 –dport 22 -j SNAT –to 10.1.1.1:8000
iptables -t nat -A POSTROUTING -o eth0 -j MASQUERADE