In the code-complete exercise on an existing Java/JDBC CRUD codebase, implement the required database access without introducing SQL injection (parameterized PreparedStatement rather than string formatting).
Asked in the Code complete screen stage. Practical code-complete screen, candidate chose Java.
Write a SQL query that returns active orders for a given customer email domain and minimum order amount.
order_id, customer_name, customer_email, order_total, order_statusactive, whose total is at least the requested minimum, and whose customer email ends with the requested domaincustomer_email is NULLorder_total descending, then order_id ascending| Column | Type | Description |
|---|---|---|
| idPK | INT | Primary key for the customer |
| full_name | VARCHAR(120) | Customer full name |
| VARCHAR(255) | Customer email address | |
| is_active | BOOLEAN | Whether the customer account is active |
| Column | Type | Description |
|---|---|---|
| idPK | INT | Primary key for the order |
| customer_id | INT | Customer who placed the order |
| total_amount | NUMERIC(10,2) | Order total amount |
| status | VARCHAR(20) | Order status |
| created_at | DATE | Order creation date |