SELECT command is one of most common commands in MySQL. Its syntax is little more complex, but here we'll as all, present basic things...
SELECT atributes FROM table_or_tables WHERE condition;
More advanced purpose of this command we'll explain later in this post. For now, if there is some data that needs to be changed then we will use command:
UPDATE table SET atribute="value" WHERE condition;
For example lets try to correct value of height to 185 at person: edin bukva
in this example condition will consists of two parts because there are two people named edin. So for condidition we can use:
name='edin' and surname='bukva'
or just: surname='bukva' because there is only one man with bukva surname
UPDATE person SET height='185' WHERE name='edin' and surname='bukva';
In condition part we used "and" operator. It is normal to use these operators (and, or, etc...)
If we wanted to add new row (record) we would use this command:
INSERT INTO table VALUES('1st atribute value','2nd',...);
so on our example it would be like this:
INSERT INTO person VALUES('name1','surname1','180','78',NULL);
NULL for value means that there will be no value for that field.
You can see the procedure at whole image:

On pictures you can see that i have used SELECT * FROM person; command to list, so i could see what i have got.
-----------------------------
rest of basic stuff in part 4, until then...
other parts about MySQL:
MySQL basic commands part 1MySQL basic commands part 2MySQL basic commands part 4
0 Responses to “MySQL basic commands part 3”
Leave a Reply