Database Reference
In-Depth Information
Figure 6.13
NOT applied to a single row query.
Why do we need the parentheses in the above script? Can you work out what would hap-
pen without them and then edit your query and test your theory? Why do you think this
happens?
CONCAT
CONCAT allows you to customize your queries output any way you wish. Normally if you
execute a SELECT tablename all that you will get back are the unprocessed contents of these
records. This will not always be exactly what you need, so you can alter the output with
CONCAT. To demonstrate this we will add a table for logging visitor topic entries to our
website. We will have to run a few scripts to set this up.
First we will add an entry for the visitor's page in our webpage table:
INSERT
INTO
webpage (Title, Content)
VALUES
(“Visitor book”,
“Please sign my visitor's book by filling in the details
on this page”)
Now we will create a visitorbook table and add some fictitious entries:
CREATE TABLE visitorbook
(EntryID MEDIUMINT AUTO_INCREMENT NOT NULL PRIMARY KEY,
CookieID MEDIUMINT,
EntryDate DATETIME,
EntryText TEXT,
FirstName TEXT,
MiddleName TEXT,
LastName TEXT) ;
Search WWH ::




Custom Search