Chapter 8 Answers

Question 8-1

The semicolon is used by MySQL to separate or end commands. If you forget to enter it, MySQL will issue a prompt and wait for you to enter it. (In the answers in this section, I’ve left off the semicolon, because it looks strange in the text. But it must terminate every statement.)

Question 8-2

To see the available databases, type SHOW databases. To see tables within a database that you are using, type SHOW tables. (These commands are case-insensitive.)

Question 8-3

To create this new user, use the GRANT command like this:

GRANT PRIVILEGES ON newdatabase.* TO 'newuser'
   IDENTIFIED BY 'newpassword';
Question 8-4

To view the structure of a table, type DESCRIBE tablename.

Question 8-5

The purpose of a MySQL index is to substantially decrease database access times by maintaining indexes of one or more key columns, which can then be quickly searched to locate rows within a table.

Question 8-6

A FULLTEXT index enables natural language queries to find keywords, wherever they are in the FULLTEXT column(s), in much the same way as using a search engine.

Question 8-7

A stopword is a word that is so common that it is considered not worth including in a FULLTEXT index or using in searches. However, it does participate in a search when it is part of a larger string bounded by double quotes.

Question 8-8

SELECT DISTINCT essentially affects only the display, choosing a single row and eliminating all the duplicates. GROUP BY does not eliminate rows, but combines all the rows that ...

Get Learning PHP, MySQL, and JavaScript now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.