ch8 questions Flashcards

1
Q

What is the purpose of the semicolon in MySQL queries?

A

The purpose of the semicolon is to execute a command, also to string multiple commands on one line when necessary.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

Which command would you use to view the available databases or tables?

A

SHOW databases; or SHOW tables;

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

What is the purpose of a MySQL index?

A

To give columns a unique identifier so that the table can be queried more efficiently.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

How can you view the structure of a table?

A

By using the DESCRIBE construct

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

What benefit does a FULLTEXT index provide?

A

It allows the whole entry to be queried, much like an online search.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q

What is a stop word?

A

A word that is ignored by the query, such as ‘the’ ‘of’ ‘as’ ‘and’ etc.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
7
Q

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?

A

GRANT PRIVILEGES ON newdatabase.* TO ‘newuser’@’localhost’ IDENTIFIED BY ‘newpass’;

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
8
Q

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?

A

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.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
9
Q

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?

A

SELECT author FROM classics WHERE author LIKE “%Langhorne%”;

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
10
Q

What needs to be defined in two tables to make it possible for you to join them together?

A

A common column

How well did you know this?
1
Not at all
2
3
4
5
Perfectly