Chapter 24 - MySQL



Examples of SQL Statements

Below a few examples are provided to give you an idea of what an SQL statement looks like.

Though they have a specific structure and can perform complex operations,  SQL commands are fairly easy to understand.

For example,


CREATE TABLE Phonebook (

Id char(5),

Name char(50),

Telephone char(11)

);

creates a new table in your database named Phonebook that has three fields, Id, Name, and Telephone, which are characters strings of length 5, 50 , and 11, respectively.

The statement

INSERT INTO Phonebook (Id, Name, Telephone)

VALUES (‘AAAAA’, ‘Joe Smith’, ‘800-555-1212’);
adds the data into the named fields as a new record of the Phonebook table in your database.

The statement

SELECT Name, Telephone

FROM Phonebook 

WHERE Id = ‘AAAAA’;
searches the table Phonebook and finds the Name and Telephone number of the customer whose Id is equal to ‘AAAAA’.

These are, of course, simple statements. Much more complicated databases and queries can be written using SQL, all of which are supported by MySQL.

Much of your database management will be done through the MySQL Control Panel provided in your account administration pages and not by typing in commands such as above. Though not needed, a working undrstanding of how to read and write SQL statements is of great help. There are many books and web sites which teach SQL and have many more examples.  If you plan on doing much database development, it is recommended that you review them.




©Copyright 2000 . All Rights Reserved.
The entire contents of this site is copyrighted and may not be reproduced for any purpose without prior written permission.
Table Of Contents:

Back To Index
|
Chapter 1
FTP Instructions

|
Chapter 2
SSH / Telnet

|
Chapter 3
Email Software Setup

|
Chapter 4
CGI Bin

|
Chapter 5
Secure Server

|
Chapter 6
Formmail

|
Chapter 7
Microsoft Front Page

|
Chapter 8
CGI Scripts

|
Chapter 9
COMING SOON

|
Chapter 10
COMING SOON

|
Chapter 11
Streaming Audio/Real Video

|
Chapter 12
File Manager

|
Chapter 13
Mail Manager

|
Chapter 14
Changing Passwords

|
Chapter 15
Site Statistics

|
Chapter 16
Network Tools

|
Chapter 17
FTP & Anon FTP

|
Chapter 18
SSH / Telnet

|
Chapter 19
Password Protect Directories

|
Chapter 20
Custom Error Pages

|
Chapter 21
MySQL

|
Chapter 22
Mime Types

|
Chapter 23
Crontab

|
Chapter 24
Entropy Chat

|
Chapter 25
Shopping Cart

|
Chapter 26
Search Engine Submission

|
Chapter 27
PGP

|
Chapter 28
Subdomains

|
Chapter 29
Archive Manager

|