Complete the code to select all records from a database table named 'users'.
SELECT [1] FROM users;The asterisk (*) means 'all columns' in SQL, so this query selects all data from the 'users' table.
Complete the code to find users with the username 'alice'.
SELECT * FROM users WHERE username [1] 'alice';
The '=' operator checks for exact equality, so this query finds users whose username is exactly 'alice'.
Fix the error in the SQL query to count the number of transactions.
SELECT COUNT([1]) FROM transactions;Using COUNT(*) counts all rows in the table, which is the correct way to count transactions.
Fill both blanks to select usernames and emails of users who have logged in more than 5 times.
SELECT [1], [2] FROM users WHERE login_count > 5;
This query selects the username and email columns for users with more than 5 logins.
Fill all three blanks to create a dictionary comprehension that maps user IDs to their email addresses for users with active status.
user_emails = { [3]['[1]']: [3]['[2]'] for [3] in users if [3]['status'] == 'active' }This comprehension creates a dictionary where each key is a user_id and the value is the user's email, but only for active users.