What we have covered so far is but a small part of what MySQL is capable of. Let's delve a little deeper into the language, exploring some of the more advanced commands of the language. Logical Operations MySQL includes full support of all basic logical operations. AND (&&)
Result: OR ( || )
Result: NOT ( ! )
Result: Order By
Result: Search functions MySQL offers the user the ability to perform both general and specific searches on data.
Result: Notice that "LIKE" has been used instead of the equals sign (=). "LIKE" signifies that one is searching for an estimate of the data requested, and not necessarily an exact copy. The '%' sign could be placed anywhere within the string. The method in which the server searches for a string is dependent upon where one places the '%' sign.
Result: Focused Search Results One can also perform searches and display only certain columns.
Result:
Alter table Another very important function of MySQL is the ability to modify previously created tables. This is accomplished via the ALTER statement. This function allows one to add, modify, and delete columns, as well as rename the table, among other functions. Example: Rename the table
Example: Add a column
Example: Modify a column
Example: Delete a column
Executing the above four functions would modify test, creating the following table:
The topics covered within this article are but a short introduction of the capabilities of MySQL. However, these functions form the basis of almost all advanced commands to be found in the language. Above all, the most important lesson that one can remember is to practice, study the documentation, and become an active member of the mailing list archives (And obviously read DevShed frequently!). Only by taking an enthusiastic, even "aggressive" approach to the language can one successfully master it.
blog comments powered by Disqus |
|
|
|
|
|
|
|