0
0
MySQLquery~30 mins

Password policies in MySQL - Mini Project: Build & Apply

Choose your learning style9 modes available
Password Policies Management
📖 Scenario: You are managing a user database for a website. To keep user accounts safe, you want to create a table that stores password policies. These policies will help enforce rules like minimum length and whether special characters are required.
🎯 Goal: Create a table called password_policies with columns for policy ID, minimum length, and a flag for requiring special characters. Then insert a sample policy and finally query the table to see the policies.
📋 What You'll Learn
Create a table named password_policies with columns policy_id (integer, primary key), min_length (integer), and require_special_char (boolean).
Insert one row with policy_id 1, min_length 8, and require_special_char true.
Write a query to select all columns from password_policies.
💡 Why This Matters
🌍 Real World
Password policies are essential for securing user accounts in websites and applications. Managing these policies in a database helps enforce consistent rules.
💼 Career
Database administrators and backend developers often create and manage tables that store security policies, including password requirements.
Progress0 / 4 steps
1
Create the password_policies table
Write a SQL statement to create a table called password_policies with three columns: policy_id as an integer primary key, min_length as an integer, and require_special_char as a boolean.
MySQL
Need a hint?

Use CREATE TABLE with the column names and types exactly as specified.

2
Insert a sample password policy
Write a SQL INSERT statement to add one row into password_policies with policy_id 1, min_length 8, and require_special_char true.
MySQL
Need a hint?

Use INSERT INTO with the exact column names and values.

3
Query all password policies
Write a SQL SELECT statement to get all columns from the password_policies table.
MySQL
Need a hint?

Use SELECT * FROM password_policies; to get all rows and columns.

4
Add a new password policy
Write a SQL INSERT statement to add a second password policy with policy_id 2, min_length 12, and require_special_char false.
MySQL
Need a hint?

Use INSERT INTO with the exact column names and values for the second policy.