In this chapter we will try to run the basic SQL queries using mysql_query() function. Throught this function we can inserting, selecting, updating, deleting and retrieving data all. For INSERT, SELECT, UPDATE, and DELETE, no additional scripting is required after the query has been executed because you’re not displaying any results (unless you want to). For SELECT, you have a few options for displaying the data retrieved by your query. But first you need create tabel in Database that we have been create before. As a sample I’m create table Person with some field like this:

 CREATE TABLE `person` (
  `id` int(5) NOT NULL auto_increment,
  `lastname` varchar(15) collate latin1_general_ci NOT NULL,
  `firstname` varchar(15) collate latin1_general_ci NOT NULL,
  `address` varchar(25) collate latin1_general_ci NOT NULL,
  `city` varchar(20) collate latin1_general_ci NOT NULL,
  `age` int(2) NOT NULL,
  PRIMARY KEY  (`id`)
) ENGINE=MyISAM  DEFAULT CHARSET=latin1 COLLATE=latin1_general_ci AUTO_INCREMENT=7 ;

And now we learning Basic SQL Command to create and manipulate MySQL database tables.
THE INSERT:
The simple code for adding new records is syntax like this:

INSERT INTO table_name (column list) VALUES (column values)

The SELECT:
We used this command is to retrieve records. This command syntax can be totally simplistic or very complicated.

 SELECT expressions_and_columns FROM table_name
 [WHERE some_condition_is_true]
 [ORDER BY some_column [ASC | DESC]]
 [LIMIT offset, rows]

One handy expression is the * symbol, which stands for “everything.” So, to select “everything” mean all rows/ all columns.

THE UPDATE:
Update is used to modify the contents of one or more columns in an wxisting record. Basic update syntax is look like:

 UPDATE table_name
 SET column_name='new value'
 [WHERE some_condition_is_true]

The guidelines for updating a record are similar to those used when inserting a record—the data you’re entering must be appropriate to the data type of the field, and you must enclose your strings in single or double quotes, escaping where necessary.

THE DELETE:
This command is used to remove specification column. And the basic syntax is look like:

 DELETE FROM table_name
 [WHERE some_condition_is_true]
 [LIMIT rows]

You have learned the basic of SQL, from tabel creation to manipulating records. See you in the next chapter.