Working with (Struts hosting) MySQL SQL 56 mysql> begin; Query
Working with MySQL SQL 56 mysql> begin; Query OK, 0 rows affected (0.00 sec) Now execute your SQL. Once you have finished, use the command COMMIT or ROLLBACK, depending on your circumstances. Functions/Operators In several places throughout this chapter, we have used a MySQL function in a query. A function is code written by MySQL that aids in the query being used. For example, suppose you want to determine the largest account ID in the acc table. To do this, use the max() function: mysql> SELECT max(acc_id) FROM account; +————-+ | max(acc_id) | +————-+ | 1034546 | +————-+ 1 row in set (0.00 sec) In this query, the maximum value in the acc_id column is returned from the database. MySQL includes a large number of functions too many to list in this chapter. Refer to the MySQL documentation for a listing of all available functions and examples. Joins One of the harder concepts to grasp in the world of databases is the join. Let s begin our discussion by throwing another table into our current database. Right now we have a database called acc that has the following fields: acc_id int username varchar password varchar ts timestamp act_ts timestamp This table doesn t hold much information about the actual owner of the account ID. We need to add another table called acc_add that will hold address information for the account owner. Here s the table definition: mysql> create table acc_add ( add_id int not NULL, acc_id int, name varchar(64), address1 varchar(64),
Hint: If you are looking for good and high quality web space to host and run your java application check Vision java web hosting services