Challenge - 5 Problems
Full-text Search Master
Get all challenges correct to earn this badge!
Test your skills under time pressure!
❓ query_result
intermediate2:00remaining
Full-text search basic query output
Given a MySQL table
Assume the table has these rows:
Which rows will be returned?
articles with a full-text index on the content column, what is the output of this query?SELECT id, MATCH(content) AGAINST('database') AS score FROM articles WHERE MATCH(content) AGAINST('database');Assume the table has these rows:
- 1, 'Introduction to database'
- 2, 'Advanced SQL queries'
- 3, 'Database indexing techniques'
Which rows will be returned?
MySQL
SELECT id, MATCH(content) AGAINST('database') AS score FROM articles WHERE MATCH(content) AGAINST('database');
Attempts:
2 left
💡 Hint
Full-text search matches rows containing the search word in the indexed column.
✗ Incorrect
Rows 1 and 3 contain the word 'database' in their content, so they match the full-text search. Row 2 does not contain 'database', so it is excluded.
🧠 Conceptual
intermediate1:30remaining
Understanding full-text index limitations
Which of the following is a limitation of MySQL full-text indexes in natural language mode?
Attempts:
2 left
💡 Hint
Think about common default settings for full-text search.
✗ Incorrect
By default, MySQL full-text indexes ignore words shorter than 4 characters, which can affect search results.
📝 Syntax
advanced1:30remaining
Correct syntax for creating a full-text index
Which option shows the correct syntax to create a full-text index on the
description column of the products table in MySQL?Attempts:
2 left
💡 Hint
Remember the syntax for adding indexes with ALTER TABLE.
✗ Incorrect
The correct syntax to add a full-text index is using ALTER TABLE with ADD FULLTEXT INDEX specifying the index name and columns.
❓ optimization
advanced2:00remaining
Improving full-text search performance
You have a large MySQL table with a full-text index on the
comments column. Which approach will most improve full-text search query performance?Attempts:
2 left
💡 Hint
BOOLEAN MODE allows more control over search terms and can speed up queries.
✗ Incorrect
Using BOOLEAN MODE allows more efficient searching with operators and can improve performance compared to natural language mode.
🔧 Debug
expert2:30remaining
Why does this full-text search return no results?
You run this query:
But it returns no rows, even though some titles contain the word 'the'. Why?
SELECT * FROM posts WHERE MATCH(title) AGAINST('the');But it returns no rows, even though some titles contain the word 'the'. Why?
Attempts:
2 left
💡 Hint
Common words are often excluded from full-text indexes.
✗ Incorrect
Words like 'the' are stopwords and ignored by default in MySQL full-text searches, so no matches are found.