ch8 questions Flashcards
What is the purpose of the semicolon in MySQL queries?
The purpose of the semicolon is to execute a command, also to string multiple commands on one line when necessary.
Which command would you use to view the available databases or tables?
SHOW databases; or SHOW tables;
What is the purpose of a MySQL index?
To give columns a unique identifier so that the table can be queried more efficiently.
How can you view the structure of a table?
By using the DESCRIBE construct
What benefit does a FULLTEXT index provide?
It allows the whole entry to be queried, much like an online search.
What is a stop word?
A word that is ignored by the query, such as ‘the’ ‘of’ ‘as’ ‘and’ etc.
How would you create a new MySQL user on a local host called newuser with a password of newpass and with access to everything in the database newdatabase?
GRANT PRIVILEGES ON newdatabase.* TO ‘newuser’@’localhost’ IDENTIFIED BY ‘newpass’;
Both SELECT DISTINCT and GROUP BY cause the display to show only one output row for each value in a column, even if multiple rows contain that value. What are the main differences between SELECT DISTINCT and GROUP BY?
SELECT DISTINCT will not show duplicates of the same data, while GROUP BY will show all matches even if they repeat multiple times. GROUP BY is useful for performing an operation such as COUNT on groups of rows.
Using the SELECT … WHERE construct, how would you return only rows containing the word Langhorne somewhere in the author column of the classics table used in this chapter?
SELECT author FROM classics WHERE author LIKE “%Langhorne%”;
What needs to be defined in two tables to make it possible for you to join them together?
A common column