Practice - 5 Tasks
Answer the questions below
1fill in blank
easyComplete the code to fetch data from the database.
SEO Fundamentals
SELECT * FROM [1]; Drag options to blanks, or click blank then click option'
Attempts:
3 left
💡 Hint
Common Mistakes
Choosing unrelated tables like 'styles' or 'images'.
Using 'users' which stores user data, not content.
✗ Incorrect
The content table typically stores the data used for database-driven content creation.
2fill in blank
mediumComplete the code to insert new content into the database.
SEO Fundamentals
INSERT INTO content (title, body) VALUES ([1], [2]);
Drag options to blanks, or click blank then click option'
Attempts:
3 left
💡 Hint
Common Mistakes
Omitting quotes around string values.
Using double quotes which may not be supported in all SQL dialects.
✗ Incorrect
Values must be enclosed in single quotes to be valid SQL strings.
3fill in blank
hardFix the error in the SQL query to update content title.
SEO Fundamentals
UPDATE content SET title = [1] WHERE id = 5;
Drag options to blanks, or click blank then click option'
Attempts:
3 left
💡 Hint
Common Mistakes
Not using quotes around the string value.
Using double quotes which may cause errors.
✗ Incorrect
The new title must be a string literal enclosed in single quotes in SQL.
4fill in blank
hardFill in the blank to select content with a specific keyword in the title.
SEO Fundamentals
SELECT * FROM content WHERE title [1] '%keyword%';
Drag options to blanks, or click blank then click option'
Attempts:
3 left
💡 Hint
Common Mistakes
Using '=' which looks for exact matches only.
Using 'IN' or 'CONTAINS' which are not valid in this context.
✗ Incorrect
The LIKE operator is used with wildcards to find patterns in SQL.
5fill in blank
hardFill all three blanks to create a dictionary of content titles and their lengths for titles longer than 5 characters.
SEO Fundamentals
content_lengths = { [3].[1]: len([3].[2]) for [3] in contents if len([3].[2]) > 5 } Drag options to blanks, or click blank then click option'
Attempts:
3 left
💡 Hint
Common Mistakes
Using the wrong variable name for the loop.
Confusing keys and values in the dictionary comprehension.
✗ Incorrect
This dictionary comprehension maps each content's title to its length, iterating over content items.