Archive:PHP and MySQL Programming/Basic Queries: Difference between revisions

wikademia>Jguk
mNo edit summary
Line 32: Line 32:
The INSERT statement is used to insert data into a particular table of a database. The Syntax is as follows :
The INSERT statement is used to insert data into a particular table of a database. The Syntax is as follows :


  mysql> INSERT INTO `table_name`
  mysql> INSERT INTO table_name
         (`field1`, `field2`, etc...)
         (`field1`, `field2`, etc...)
         VALUES ('val1', 'val2', etc...);
         VALUES ('val1', 'val2', etc...);
Line 38: Line 38:
Example :
Example :


  mysql> INSERT INTO `books`
  mysql> INSERT INTO books
         (`ISBN`, `Title`, `Author`, `Year`)
         (`ISBN`, `Title`, `Author`, `Year`)
         VALUES ('1234567890', 'Programming PHP and MySQL', 'Poisson, R.W', 2006);
         VALUES ('1234567890', 'Programming PHP and MySQL', 'Poisson, R.W', 2006);