Mysql commands in Php

Mysql Commands

Just like a Sql, Mysql commands also same that means there command are also same. No worry about queries all are almost as it is I hope these notes help for beginners and the people who have doubts related to Mysql commands, Hence Mysql are mostly used in Php, And here I Concentrate on Php related coding only.

Basic commands seen in Mysql are as follows w.r.t to Php Mysql:


1. CREATE
2. INSERT
3. SELECT
4. UPDATE
5. DELETE

1. CREATE :-
This command is basically used for creation of new table. CREATE example is such a manner, i.e. is as follows.


$sql = "CREATE TABLE `school`.`testing` (`rollno` INT(22) NOT NULL, `address` VARCHAR(22) NOT NULL, `name` VARCHAR(22) NOT NULL, `remarks` VARCHAR(22) NOT NULL, PRIMARY KEY (`rollno`)) ENGINE = MyISAM";

2.INSERT :-
This command is basically used for INSERT ing values in a table. INSERT example is such a manner, i.e. is as follows.


$sql = "INSERT INTO `mysite`.`student` (`student_no`, `name`, `branch`, `probability`, `co`, `ppl`, `ma`, `emmbeded`) VALUES (\'22\', \'HAPPY\', \'M.C.A\', \'66\', \'66\', \'77\', \'67\', \'76\');";

3. SELECT :-
This command is basically used for selecting a particular table. SELECT example is such a manner i.e. is as follows.


$sql = "SELECT * FROM `class1` LIMIT 0, 30 ";

4. UPDATE :-
This command is basically used for UPDATE ing fields in particular table. UPDATE example is such a manner, i.e. is as follows.


UPDATE `school`.`class1` SET `English` = '15' WHERE `class1`.`rollno` =1 LIMIT 1 ;

5. DELETE :-
This command is basically used for DELETE ing fields in particular table. DELETE example is such a manner, i.e. is as follows.


DELETE FROM `school`.`class1` WHERE `class1`.`rollno` =1 LIMIT 1 ;

Hope it will help for u all…..

No comments: