Database and SQL Developer interview question

How do you secure database access?

Use separate least-privilege identities, short-lived credentials, network restrictions, TLS, encryption at rest, parameterized queries, audited administrative actions, protected backups, patching, and tested access revocation.

Direct answer

What a strong answer covers

How it works

Database access is secured in layers. Each application and person gets a separate identity with only the privileges its work needs; the application role can read and write its tables but cannot alter schema or read other services’ data. Credentials are short-lived, issued by a secrets manager or IAM authentication, and never shared. The database listens only on a private network with TLS required, and data is encrypted at rest with keys managed outside the database. Queries are parameterised so no user input becomes SQL. Administrative actions and access to sensitive tables are audited, backups are protected as carefully as the live data, patches are applied on a schedule, and revoking an identity is tested so a leaked credential dies quickly.

Example

The orders service connects with an IAM-authenticated role that has DML on the orders schema only; DBAs use a break-glass role through a bastion with MFA and session logging. The instance is in a private subnet with TLS enforced and storage encrypted under a KMS key. pgAudit logs every statement on the customers table and every role change, and a quarterly drill revokes a test credential and confirms all sessions drop within a minute.

Common mistakes

  • Using one superuser account for every application and person.
  • Exposing the database port to the internet behind a password.
  • Treating backups as less sensitive than the database they copy.

A useful answer structure

Answer from your own work.

Do not memorise a script: use only examples you can explain honestly in follow-up questions.

Practise this answer with MiraHint

Open the desktop workspace and rehearse a clear answer in your own words.

Download MiraHint
Database and SQL Developer interview questions