Complete the code to select all columns from the users table.
SELECT [1] FROM users;The asterisk (*) selects all columns from the table.
Complete the code to filter users with admin role.
SELECT * FROM users WHERE role = [1];String values in SQL must be enclosed in single quotes.
Fix the error in the SQL query to prevent SQL injection by using a parameter placeholder.
SELECT * FROM users WHERE username = [1];Using a question mark (?) is a common placeholder for parameters in prepared statements to prevent SQL injection.
Fill both blanks to create a query that selects usernames and emails only for active users.
SELECT [1], [2] FROM users WHERE status = 'active';
We select only the username and email columns to avoid exposing sensitive data like passwords.
Fill all three blanks to write a query that updates a user's password securely using a placeholder and limits update to a specific user id.
UPDATE users SET password = [1] WHERE id = [2] AND role != [3];
Use a placeholder (?) for the new password to avoid injection, specify the user id (123), and exclude admin role from update.