Connection Help Forms Help Advanced Forms Help SSI Help My SQL help PHP help Front Page Frontpage FAQ Frontpage Tutorial Page 1 Page 2 Page 3 Help Home Opt2 Home |
Mysql Database The following documentation provides a brief introduction to the use of Opt2.net's SQL database system, "Mysql". For detailed information about Mysql, please consult the Mysql documentation, or visit the Mysql web site. As with CGI, Opt2.net does NOT provide support for installation, development, or programming issues. There is a wealth of information provided on the Mysql web site, including various support options, and information on finding a Mysql developer. SQL If you are not familiar with SQL, Mysql (or any SQL database, for that matter) is probably not for you. Miva provides a beginner database which proves more-than-sufficient for most needs. Creating your database Each SQL-enabled account includes access to a single Mysql database (a
database consists
of zero or more tables). This database is created for you upon request, and
is typically named Access to your database is restricted by username and password, where appropriate. Managing tables Tables can be created, modified, and deleted using Opt2.net's SQL Executer (available in the customer service area). A "create" statement with different data types and indexing looks like:
To view the description of a table, use the following syntax:
To delete a table, removing all contents:
You can also use the Table List feature of the SQL Executer to list your table information. To change a table's structure without deleting it, use the
Managing data Once you have a table created, you will typically want to enter data into and query data from the database. Data entry can be done as follows (continuing the previous example):
Data retrieval can be done as follows:
Mysql supports several aggregate functions, i.e.:
While the above commands can be entered using Opt2.net's SQL Executer, you will typically want to execute them from within your Perl or C code. Remember to "backslash" single quotes and backslashes before entering them into the Mysql command stream. Using Mysql in Perl The following code fragment illustrates the use of Mysql in Perl:
Using Mysql in PHP The following code fragment illustrates the use of Mysql in PHP:
Using Mysql in C Please consult the Mysql documentation for information on using Mysql with C Mysql vs. Msql Mysql has been designed to be completely compatible with Msql (mini SQL, a popular database by Hughes Technologies), for those who are familiar with that database system. However, Mysql includes significant feature set, performance, and security improvements over Msql. Porting a Msql application to Mysql is as easy as executing this command on your code:
More Information This document only scratches the surface of Mysql's capabilities. There are hundreds of items -- indexing, aggregate functions, command syntax, detailed Perl and C API, and more -- discussed in the Mysql documentation. Developers interested in seriously using Mysql should take the time to read it. |