MySQL Examples


MySQL Examples08 May 2006 10:40 am

The Delete command is used to delete the records from a table using conditions as shown below:

Syntax:

$deleteSQL=("DELETE * FROM tablename WHERE condition");

Example:

CODE:
  1. $deleteSQL=("DELETE * FROM tblstudent WHERE fldstudid=2");

MySQL Examples08 May 2006 10:39 am

The Select command is used to select the records from a table using its field names. To select all the fields in a table, '*' is used in the command. The result is assigned to a variable name as shown below:

Syntax:

$selectSQL=("SELECT field_names FROM tablename");

Example:

CODE:
  1. $selectSQL=("SELECT * FROM tblstudent");

MySQL Examples08 May 2006 10:38 am

CREATE Command

The Create command is used to create a table by specifying the tablename, fieldnames and constraints as shown below:

Syntax:

$createSQL=("CREATE TABLE tblName");

Example:

CODE:
  1. $createSQL=("CREATE TABLE tblstudent(fldstudid int(10) NOTNULL AUTO_INCREMENT PRIMARY KEY,fldstudName VARCHAR(250) NOTNULL,fldstudentmark int(4) DEFAULT '0' ");

« Previous Page


Mobile Phone - Bad Credit Mortgages - Car Insurance - Myspace Layouts - Online Loans
X10 Home Security|Dakar's Photos
Listed on BlogShares