Friday, August 17, 2012

How to Create a MySQL query




Add Row]
insert into table name (field name) values ​​(value);
insert into table name (Field 1, Field 2, Field 3) values ​​(Value 1, Value 2, Value 3);

Row Edit]
update set the table name field name = 'field value';
update set the table name field name = 'field value' where to find the field = 'field value';
update table name a set field = 'value 1', Field 2 = 'value 2' where to find the field = 'field value';
※ `where ~`, the query does not exist the problem, to recognize all the rows
※ teyibeulsok update the value of all the values ​​of the field changes. Be careful.

[Delete Row]
delete from table name where the field name = 'field value';

Row Selection
select * from table name;
select * from table name where the field name = 'field value';
select * from table name where field 1 = 'value 1' and field 2 = 'value 2';
select * from table name where field 1 = 'value 1' or Field 2 = 'value 2';
※ and the field value of 1 as the value of a field value of 2, O 2 must see the value of (True) will be.
※ or the value of the field, a value of 1 or field 2 of the value Value 2, true, true even to either (True) will be.

Select a row in the `*` to query the row selection means that all the data.

No comments:

Post a Comment