26 May 2011

Mysql Introduction - Php For Beginners - Lesson 10

Databases are very important in the field of web development. A database is a collection of data in a very organized fashion. By organized fashion it is meant that the data will be stored in different tables. So that it will be easier to retrieve the date when needed. The most common database used with php is Mysql. Mysql is a relational database. A relational database is one in which tables are linked together.

What is a Table?
A table is an structure in which the datat is stored, It can contain rows and columns. Columns are used to categorize the data and rows contain the actual data. For example if a company contains its user's data in a table named 'Users' then the table structure may look like this:


User Id User Name Email Password
1 John john@example.com 123
2 Smith smith@example.com 456

In the above example, A company's users table is shown, it contains 4 columns and 2 rows. 4 columns are the categories and 2 rows are actual data. It is not mandatory that each row contains all the columns, some times rows can contain empty columns.

What is a Query?
A query is an statement used to manipulate the data in the database. You can write queries to Insert, retrieve, delete, and update the data and also to perform any action on the data present in the database.A sample query may look like this:
SELECT email FROM users
The above statement is used to retrieve all the emails from the users table. So the output of the above query will be like this:

Email
john@example.com
smith@example.com

Well I guess that's all for the introduction, further details will be discussed in the later lessons. For any queries or questions should you have, feel free to comment.

next Previous Lesson --- Next Lesson next

No comments: