How Databases Work?

Almost all of the modern day sites make use of databases for organizing their content. They make users to register with themselves or to leave their feedback. Often you will see that when you revisit a site, it seems to remember the things that you did last time. This is due to the presence of a database.

Understanding databases is not a simple task as it looks. Many web masters work as database administrators, even when they know nothing about databases.

Some common concept of databases are:

Relational Databases
It is the most common database model being used nowadays. In this, the data is stored in the form of tables. The rows are known as records and the columns as fields. For e.g: A table may contain two fields, that is, first name and last name. Then, records can be added further such as 'James' and 'Collin'. This makes searching and referring easier.

Relational Databases are most important in the way database tables relate to each other. Each record has an ID number called the primary key. For instance, the James Collin record can be ID number 134. This is used to refer to a particular record.

Let's take, for example that you are making a record of orders received by a particular company. There can be two columns, that is, the name of customer and the date of order. This will allow you to store 134  and date every time James Collin places an order. The relational database will let you know that customer number 134 is James Collin. This can be really helpful in cases such as storage of multiple author's posts.

SQL Databases
Structured Query Language, or SQL, is the most popular language that is used to make queries to relational database systems. Query is a way to allow database to find a record for you that matches the specified criteria. In the above example, to get James Collin's name, an SQL would have to be written:

INSERT INTO names VALUES ('James', 'Collins');

This would assign the ID number automatically to the database. To find out the customer whose ID number is 134, the SQL command would look something like this:

SELECT * FROM names WHERE id = '134';

This command would display the customer 134's record that is, James Collin's record from the database.

Though SQL looks complicated, one good thing is that it is not needed a lot.

Some commonly used statements are:

CREATE: It is used to create new database tables. You have to specify the field you want and the data  to be used for each field, such as Character, or Number.

SELECT: It is used to search through the tables. This command is accompanied by operators like = , < and > to find a particular record.

INSERT: It is used to add new records to the table.

UPDATE: After insertion of the data, this command is used to modify it.

DELETE: It removes the existing record from the table.

Spread the word

del.icio.us Digg Furl Reddit Ask BlinkList blogmarks Blogg-Buzz Google Ma.gnolia Netscape ppnow Rojo Shadows Simpy Socializer Spurl StumbleUpon Tailrank Technorati Windows Live Wists Yahoo!

Print

Related Entries

Related Tags

, , , ,