Security · Guide + 18 Interview Questions

SQL Injection & Row-Level Security: Stopping the Attack, Controlling the Rows

SQL injection is the vulnerability that refuses to go away. It has been in the OWASP Top 10 for two decades, and it still shows up in production systems because string concatenation is easy and parameterized queries take five extra minutes. Row-level security is the other side of the same coin: once the query is safe, how do you make sure a user cannot see data that belongs to someone else? This guide covers both. The injection examples show real payloads and why they work. The RLS sections show how SQL Server and PostgreSQL filter rows automatically, so the application does not have to remember. The eighteen interview questions are the ones that actually come up, with answers that go past "use parameterized queries" and into the why.

🎯 Key Takeaways
18 Interview Questions Beginner to Advanced SQL Server & PostgreSQL Updated Dec 4, 2026
Kailas Warade ✓ Verified Author
Data Engineer · Oracle Certified · SQL & PL/SQL
Kailas works with SQL, PL/SQL, Python, and PySpark to build data pipelines. He writes the SQL interview guides at Sankalan Data Tech, focused on practical, real-world answers.
🏆 Oracle Certified 💼 Data Engineer 📝 SQL & PL/SQL Guides 📍 Pune, India
📤 Share:

On This Page

How SQL Injection Actually Works

SQL injection is not a sophisticated attack. It does not require special tools or deep knowledge of the target. It works because of one mistake: treating user input as if it were part of the SQL code [citation:1].

Here is the classic example. A login form takes a username and builds this query:

SELECT * FROM users WHERE username = '" + username + "' AND password = '" + password + "'"

If the user types Alice, the query becomes:

SELECT * FROM users WHERE username = 'Alice' AND password = '...'

That works. But if the user types Alice' OR '1'='1, the query becomes:

SELECT * FROM users WHERE username = 'Alice' OR '1'='1' AND password = '...'

The OR '1'='1' makes the condition true for every row. The password check is bypassed. The attacker is logged in as Alice without knowing her password [citation:1].

That is the entire concept. The attacker does not break into the database. They just convince the application to run a slightly different query than the one it intended. The database does exactly what it is told — it always does — and the attacker gets what they wanted.

The Sample Data

The injection examples use a users table. The RLS examples use an accounts table with a owner_id column — the kind of table that appears in every multi-tenant application.

-- users (for injection examples)
-- user_id | username | password_hash
-- 1       | alice    | (hashed)
-- 2       | bob      | (hashed)
-- 3       | charlie  | (hashed)

-- accounts (for RLS examples)
-- account_id | account_name | owner_id | balance
-- 101        | Alice's Checking | alice  | 5000
-- 102        | Bob's Savings    | bob    | 12000
-- 103        | Alice's Savings  | alice  | 8000
-- 104        | Charlie's Checking | charlie | 3000

The owner_id is the column that RLS policies will use. Alice should see rows 101 and 103. Bob should see 102. Charlie should see 104. No one should see anyone else's accounts.

A Real Attack, Step by Step

The OWASP Top 10 still lists injection under A05:2025, and the reason is not that the fix is unknown — it is that the vulnerable pattern keeps getting written [citation:3][citation:5].

Here is the vulnerable code, written in Java:

String query = "SELECT account_balance FROM user_data WHERE user_name = '"
             + request.getParameter("customerName") + "'";
Statement statement = connection.createStatement();
ResultSet results = statement.executeQuery(query);

The attacker supplies tom' OR '1'='1 as the customer name. The query becomes:

SELECT account_balance FROM user_data WHERE user_name = 'tom' OR '1'='1'

Every row in user_data is returned. The attacker did not need to know any valid customer names. They did not need to guess a password. They just asked the database a slightly different question than the developer intended [citation:7].

The damage can go much further. If the application account has enough privileges, the attacker can append ; DROP TABLE users; -- and the table is gone. They can union in a query against information_schema and read every table name in the database. They can extract password hashes, email addresses, and anything else the application account can see.

Blind injection is the slower variant. When the application does not show query results or error messages, the attacker asks true/false questions instead: does this condition make the page load differently? Does this timing difference mean the query succeeded? It takes longer, but it works. Hiding error messages is not a fix.

Parameterized Queries — The Fix

The fix is not to sanitize the input. The fix is to stop treating input as SQL in the first place. Parameterized queries — also called prepared statements — keep the SQL text and the values separate. The database parses the SQL once, with placeholders where the values will go, and then binds the values in [citation:3][citation:5].

Here is the same Java query, fixed:

String custname = request.getParameter("customerName");
String query = "SELECT account_balance FROM user_data WHERE user_name = ?";
PreparedStatement pstmt = connection.prepareStatement(query);
pstmt.setString(1, custname);
ResultSet results = pstmt.executeQuery();

The ? is a placeholder. The setString(1, custname) binds the value. If the attacker supplies tom' OR '1'='1, the database looks for a user whose name is literally tom' OR '1'='1. It finds nothing. The attack fails because the input was never part of the SQL syntax [citation:7].

Every language and framework has a version of this:

  • .NET: SqlCommand with Parameters.Add()
  • PHP: PDO with prepare() and bindParam()
  • Python: cursor.execute(query, params) with a parameterized query
  • Ruby: ActiveRecord or db.prepare() with placeholders
  • Node.js: pool.execute(query, [values]) with placeholders

The syntax differs. The principle is identical. Values are data. They never become code [citation:3][citation:5].

Stored Procedures Can Be Vulnerable Too

A common misconception is that moving the query into a stored procedure makes it safe. That is not true. A stored procedure that builds SQL by concatenating its parameters is just as vulnerable as application code that does the same thing [citation:5].

-- Vulnerable stored procedure
CREATE OR REPLACE PROCEDURE get_balance (p_user IN VARCHAR2) AS
    v_sql VARCHAR2(400);
BEGIN
    v_sql := 'SELECT balance FROM accounts WHERE user_name = ''' || p_user || '''';
    EXECUTE IMMEDIATE v_sql;
END;

If p_user contains alice' OR '1'='1, the dynamic SQL becomes the same injection payload as before. The procedure runs inside the database, but the injection happens before the database parses the statement [citation:5].

The fix is the same: bind variables inside the procedure, not concatenation.

-- Safe stored procedure
CREATE OR REPLACE PROCEDURE get_balance (p_user IN VARCHAR2) AS
    v_sql VARCHAR2(400);
BEGIN
    v_sql := 'SELECT balance FROM accounts WHERE user_name = :name';
    EXECUTE IMMEDIATE v_sql USING p_user;
END;

The :name placeholder keeps the value separate from the SQL text. The procedure is safe. The same principle applies in SQL Server, PostgreSQL, and MySQL.

When You Cannot Parameterize

Parameters work for values. They do not work for identifiers. You cannot write SELECT * FROM ? and expect the database to substitute a table name. The parser needs the identifier at parse time, before the value is known [citation:7].

That means table names, column names, and sort directions have to be concatenated into the SQL text. If they come from user input, you have an injection risk that parameters cannot solve.

The safe approach is a whitelist. Map the user's choice to a fixed set of allowed values, reject anything else, and only then concatenate:

allowed_tables = ['customers', 'orders', 'products']
if table_name not in allowed_tables:
    raise ValueError('Invalid table')
query = f"SELECT * FROM {table_name} WHERE id = ?"

The table name is validated against a list. The value (id) is parameterized. That combination is safe. The same pattern applies to column names and sort directions — ORDER BY {validated_column} {validated_direction} where both are checked against a whitelist first [citation:7].

Row-Level Security — The Other Half

SQL injection is about protecting the query. Row-level security is about protecting the data behind the query. Even if every query is perfectly parameterized, a user can still run a valid query and see rows that belong to someone else — unless the database filters them [citation:2][citation:6].

RLS works by attaching a policy to a table. The policy is an expression that returns true or false for each row. When a user queries the table, the database appends the policy expression to the query automatically. The user never sees the filter, and they cannot bypass it by writing a different WHERE clause [citation:2][citation:6].

Three use cases come up constantly:

  • Multi-tenant applications — each tenant sees only their own rows, even though everything lives in one table.
  • Department-level access — a salesperson sees their accounts, a manager sees their team's accounts.
  • Patient or customer portals — a logged-in user sees only their own records.

The logic lives in the database, not in every application query. That is the point. If a developer forgets to add WHERE owner_id = current_user, RLS adds it for them [citation:2][citation:6].

RLS in SQL Server

SQL Server implements RLS with a security policy and an inline table-valued function that acts as the predicate. The function returns 1 for rows the user can see, and the policy applies it to the table [citation:2].

-- The predicate function
CREATE FUNCTION dbo.fn_account_access (@owner_id VARCHAR(50))
RETURNS TABLE
WITH SCHEMABINDING
AS
RETURN
    SELECT 1 AS result
    WHERE @owner_id = USER_NAME();

-- The security policy
CREATE SECURITY POLICY AccountFilter
ADD FILTER PREDICATE dbo.fn_account_access(owner_id) ON dbo.accounts
WITH (STATE = ON);

With that policy in place, SELECT * FROM accounts returns only the rows where owner_id matches the current user. If Alice runs the query, she sees her accounts. If Bob runs it, he sees his. Neither sees the other's [citation:2].

SQL Server supports two kinds of predicates. A filter predicate silently hides rows from SELECT, UPDATE, and DELETE. A block predicate raises an error when a user tries to insert or update a row that violates the policy. Filter predicates are for reading; block predicates are for writing [citation:2].

RLS in PostgreSQL

PostgreSQL uses CREATE POLICY with a USING expression and, optionally, a WITH CHECK expression. You enable RLS on the table first, then create policies [citation:6][citation:10].

ALTER TABLE accounts ENABLE ROW LEVEL SECURITY;

CREATE POLICY account_owner_policy ON accounts
    FOR ALL
    TO authenticated
    USING (owner_id = current_user)
    WITH CHECK (owner_id = current_user);

The USING clause controls which rows are visible for SELECT and which rows can be updated or deleted. The WITH CHECK clause controls which rows can be inserted or updated. If you only specify USING, it applies to both [citation:6][citation:10].

One gotcha: table owners bypass RLS by default. If you are testing as the owner, you will see all rows and wonder why the policy is not working. Create a separate role for testing, or use ALTER TABLE accounts FORCE ROW LEVEL SECURITY to apply the policy to the owner as well [citation:6].

Least Privilege — The Safety Net

Parameterized queries and RLS are the primary defenses. Least privilege is the safety net. If an injection attack somehow succeeds, the damage is limited to what the application account can do [citation:7].

The rule is simple: give each account only the permissions it needs. An application that reads customer data should not have DROP TABLE rights. An account that runs reports should not be able to modify data. An account that handles logins should not be able to read the payment table [citation:7].

The OWASP guidance is blunt: "DO NOT ASSIGN DBA OR ADMIN TYPE ACCESS TO YOUR APPLICATION ACCOUNTS" [citation:7]. It is easy to grant everything and let the application sort out what it needs. It is also how a minor injection becomes a full database compromise.

A few practical steps:

  • Create a separate database account for each application or service.
  • Grant SELECT, INSERT, UPDATE, DELETE only on the tables the application actually uses.
  • Never grant CREATE, DROP, or ALTER to an application account.
  • Use views to limit column access when a table has sensitive columns.

18 Interview Questions and Answers

These are the SQL injection and row-level security questions that come up most often. Every answer stands on its own — read them in any order.

🔍

No matching questions found

Try a keyword like injection, RLS, or parameterized.

SQL injection happens when user input is treated as SQL code instead of data. The attacker supplies text that closes the current string and adds their own SQL. The database runs it because it cannot tell the difference between the developer's code and the attacker's [citation:1].

-- Intended query
SELECT * FROM users WHERE username = 'Alice' AND password = '...'

-- After injection with username = "Alice' OR '1'='1"
SELECT * FROM users WHERE username = 'Alice' OR '1'='1' AND password = '...'

It is still a problem because the vulnerable pattern — string concatenation — is easy to write. It looks natural. It works on the happy path. The vulnerability only shows up when someone supplies malicious input, and by then the code is in production.

OWASP still lists injection under A05:2025. The fix has been known for twenty years. The problem is that new code keeps getting written without it [citation:3][citation:5].

Parameterized queries keep the SQL text and the values separate. The database parses the SQL once, with placeholders where the values will go, and then binds the values in. The values are never part of the SQL syntax, so they cannot change the query's meaning [citation:3][citation:5].

-- Vulnerable
"SELECT * FROM users WHERE name = '" + userInput + "'"

-- Safe
"SELECT * FROM users WHERE name = ?"
-- Then bind userInput to the ? placeholder

If the attacker supplies tom' OR '1'='1, the safe version looks for a user whose name is literally tom' OR '1'='1. It finds nothing. The attack fails because the input was data, not code [citation:7].

Every language has a version of this: PreparedStatement in Java, SqlParameter in .NET, bindParam in PHP PDO, execute(query, params) in Python. The syntax differs; the principle is the same.

Yes. A stored procedure that builds dynamic SQL by concatenating its parameters is just as vulnerable as application code that does the same thing. The procedure runs inside the database, but the injection happens before the database parses the statement [citation:5].

-- Vulnerable: concatenating the parameter
v_sql := 'SELECT * FROM accounts WHERE user_name = ''' || p_user || '''';
EXECUTE IMMEDIATE v_sql;

-- Safe: using a bind variable
v_sql := 'SELECT * FROM accounts WHERE user_name = :name';
EXECUTE IMMEDIATE v_sql USING p_user;

The safe version uses a bind variable. The value is passed separately, so it cannot change the SQL text. The procedure is safe, and the logic is the same.

The misconception is that "inside the database" means "safe." It does not. Dynamic SQL inside a procedure is dynamic SQL wherever it runs.

Row-level security (RLS) lets the database filter which rows a user can see or modify based on who they are. The policy is attached to the table, and the database applies it automatically on every query [citation:2][citation:6].

The use case that drives most RLS adoption is multi-tenancy. Imagine a SaaS application with a single accounts table holding data for every customer. Without RLS, every query needs WHERE tenant_id = current_tenant. If one query forgets, data leaks. With RLS, the database adds the filter for you.

-- Without RLS
SELECT * FROM accounts WHERE owner_id = 'alice';   -- developer must remember

-- With RLS
SELECT * FROM accounts;   -- database adds the filter automatically

Other use cases: a hospital where nurses see only their patients, a bank where employees see only their division's accounts, a customer portal where users see only their own records. The common thread is that the filter depends on who is asking, not on what they are asking for [citation:2][citation:6].

SQL Server uses a security policy and an inline table-valued function. The function returns 1 for rows the user can access, and the policy applies it to the table [citation:2].

CREATE FUNCTION dbo.fn_owner_access (@owner_id VARCHAR(50))
RETURNS TABLE
WITH SCHEMABINDING
AS
RETURN SELECT 1 AS result
WHERE @owner_id = USER_NAME();

CREATE SECURITY POLICY AccountPolicy
ADD FILTER PREDICATE dbo.fn_owner_access(owner_id) ON dbo.accounts
WITH (STATE = ON);

After that, SELECT * FROM accounts returns only the rows where owner_id matches the current user. The filter is invisible to the user and cannot be bypassed by adding a different WHERE clause [citation:2].

SQL Server supports filter predicates (silently hide rows) and block predicates (raise an error on insert/update that violates the policy). Filter for reading, block for writing.

PostgreSQL uses CREATE POLICY with a USING expression. You enable RLS on the table first, then create the policy [citation:6][citation:10].

ALTER TABLE accounts ENABLE ROW LEVEL SECURITY;

CREATE POLICY owner_access ON accounts
    FOR ALL
    TO authenticated
    USING (owner_id = current_user)
    WITH CHECK (owner_id = current_user);

USING controls which rows are visible for SELECT, UPDATE, and DELETE. WITH CHECK controls which rows can be inserted or updated. If you omit WITH CHECK, the USING expression applies to both [citation:6][citation:10].

The gotcha: table owners bypass RLS by default. If you test as the owner, you will see every row and think the policy is broken. Create a separate test role, or use ALTER TABLE accounts FORCE ROW LEVEL SECURITY to apply the policy to the owner as well [citation:6].

SQL injection is an attack. Row-level security is a defense. They solve different problems and you need both.

Injection prevention protects the query itself. It ensures that user input cannot change the structure of the SQL statement. Parameterized queries do this.

RLS protects the data behind the query. It ensures that even a perfectly valid query returns only the rows the user is allowed to see. The query is not the problem — the rows are.

-- Safe from injection (parameterized), but sees all rows without RLS
SELECT * FROM accounts WHERE account_id = ?;

-- With RLS, even this returns only the user's own rows
SELECT * FROM accounts;

One without the other is incomplete. Parameterized queries stop the attacker from running arbitrary SQL. RLS stops an authorized user from seeing data that belongs to someone else.

No. Parameters are for values, not identifiers. The database needs the table name at parse time to build a plan, and a parameter's value is not known until after parsing [citation:7].

-- This does NOT work
SELECT * FROM ? WHERE id = ?;

-- Identifiers have to be concatenated
SELECT * FROM customers WHERE id = ?;

If the table name comes from user input, you have an injection risk that parameters cannot solve. The safe approach is a whitelist: map the user's choice to a fixed list of allowed table names, reject anything else, and only then concatenate [citation:7].

allowed = ['customers', 'orders', 'products']
if table not in allowed:
    raise ValueError('Invalid table')
query = f"SELECT * FROM {table} WHERE id = ?"

The table name is validated against a list. The value is parameterized. That combination is safe.

A blind injection happens when the application does not show query results or error messages. The attacker cannot see the data directly, so they ask true/false questions instead.

Two common techniques:

  • Boolean-based: does this condition make the page load differently? If AND 1=1 returns the normal page and AND 1=2 returns an empty page, the attacker can extract data one bit at a time.
  • Time-based: does this condition make the query wait? If AND SLEEP(5) causes a five-second delay, the attacker knows the condition was true.

Blind injection is slower than a visible injection, but it still works. Hiding error messages is not a complete defense. Parameterized queries are.

Least privilege means giving each database account only the permissions it actually needs. An application that reads customer data should not have DROP TABLE rights. An account that runs reports should not be able to modify data [citation:7].

The reason it matters: if an injection attack succeeds, the damage is limited to what the account can do. If the application account can only SELECT from three tables, the attacker can only read those three tables. If it has DBA rights, the attacker can drop the whole schema.

The OWASP guidance is direct: "DO NOT ASSIGN DBA OR ADMIN TYPE ACCESS TO YOUR APPLICATION ACCOUNTS" [citation:7]. It is tempting to grant everything and let the application figure out what it needs. It is also how a minor vulnerability becomes a full compromise.

Yes, but usually modestly. Every query gets the policy predicate appended, which can prevent some index usage if the predicate is not sargable. The bigger cost is complexity: query plans become harder to read, and debugging why a user sees fewer rows than expected takes longer.

For most multi-tenant applications, the security benefit outweighs the cost. The alternative — every query needs WHERE tenant_id = ? — is more error-prone and fails silently when someone forgets.

If performance is a concern, index the columns referenced in the policy predicate. In PostgreSQL, wrapping auth.uid() in a subquery — (select auth.uid()) — lets the planner evaluate it once per statement instead of once per row [citation:14].

A filter predicate silently hides rows from SELECT, UPDATE, and DELETE. The user sees fewer rows and does not know what is missing. A block predicate raises an error when the user tries to insert or update a row that violates the policy.

-- Filter predicate: hide rows
ADD FILTER PREDICATE dbo.fn_access(owner_id) ON dbo.accounts

-- Block predicate: reject writes
ADD BLOCK PREDICATE dbo.fn_access(owner_id) ON dbo.accounts AFTER INSERT

Filter predicates are for reading. Block predicates are for writing. You can use both on the same table — filter for SELECT, block for INSERT and UPDATE [citation:2].

The simplest test is to supply input that would change the query's behavior if it were concatenated. If the query returns different results than expected, it might be vulnerable.

Try these payloads on any input field:

' OR '1'='1
' OR 1=1 --
'; DROP TABLE users; --
' UNION SELECT * FROM information_schema.tables --

If the application returns all rows when you supply ' OR '1'='1, the input is being treated as SQL. If it returns a database error, it is probably vulnerable but not exploitable. If it returns the same result as a normal input, the query is probably parameterized.

A better approach: use a static analysis tool or a security scanner. Automated scanners find the obvious cases. Code review finds the rest. The only reliable proof is to look at the code — is there string concatenation building the SQL?

Second-order injection happens when malicious input is stored in the database first, then used later in a query without proper handling. The first query is safe — it stores the input as data. The second query is vulnerable — it concatenates the stored value into SQL.

-- Step 1: store user input safely (parameterized)
INSERT INTO comments (author) VALUES (?);  -- stores "Alice' OR '1'='1"

-- Step 2: later, build a query by concatenating the stored value
"SELECT * FROM comments WHERE author = '" + stored_author + "'"

The second query is vulnerable even though the first one was safe. The lesson is that input must be handled safely every time it is used, not just the first time it enters the system [citation:12].

Most modern ORMs use parameterized queries by default, which prevents injection for standard operations. Laravel's Eloquent, Hibernate, Entity Framework, and Django's ORM all parameterize queries automatically [citation:11].

The vulnerability comes back when you use raw query escape hatches. Laravel's whereRaw() with string concatenation is vulnerable. Hibernate's createNativeQuery() with concatenation is vulnerable. Any ORM that lets you build SQL strings manually can be misused.

-- Safe: ORM parameterizes
User::where('email', $email)->get();

-- Vulnerable: raw query with concatenation
User::whereRaw('email = "'.$request->input('email').'"')->get();

-- Safe: raw query with bindings
User::whereRaw('email = ?', [$request->input('email')])->get();

ORMs reduce the risk. They do not eliminate it. The escape hatch is where injection comes back [citation:11].

Escaping tries to make dangerous input safe by adding backslashes or doubling quotes. Parameterization separates the input from the SQL entirely, so there is nothing to escape.

Escaping is error-prone. The rules differ between databases. MySQL has a NO_BACKSLASH_ESCAPES mode that changes the rules. Oracle and SQL Server handle quotes differently. A function that works for one database can fail on another [citation:7].

Parameterization is the recommended approach because it does not try to transform the input. The SQL text is fixed. The values are passed separately. There is no escaping logic to get wrong [citation:3][citation:7].

OWASP is explicit: "Manually escaping is strongly discouraged" [citation:7]. Use parameters.

Connection pooling is a challenge for RLS because the database connection is reused across multiple users. If the RLS policy depends on the database user, and every request shares the same connection, every user looks like the same database user.

The solution depends on the database:

  • PostgreSQL: use SET LOCAL role or a session variable to set the current user for the transaction. The policy checks current_setting('app.user_id') instead of current_user.
  • SQL Server: use SESSION_CONTEXT to set the user id per connection, and reference it in the predicate function.
  • Application-level filtering: if connection pooling makes RLS impractical, fall back to application-level WHERE owner_id = ? and make it mandatory in the data access layer.

The trade-off is between security (RLS, harder to bypass) and simplicity (application filtering, easier to implement with pooling). For high-security environments, configure the connection pool to reset session state and use session variables for RLS.

Never trust input. Ever. Not from a form, not from an API, not from a header, not from a cookie, not from a database column that was populated by user input. If it came from outside your program, it is untrusted.

That principle drives everything else:

  • Untrusted values go through parameters, never concatenation.
  • Untrusted identifiers go through a whitelist, never direct use.
  • Untrusted users get the minimum permissions they need.
  • Untrusted queries get filtered by RLS so they cannot see more than they should.

The specifics change with the language and the database. The principle does not. Input is data. It is never code. The moment you treat it as code, you have a vulnerability [citation:1][citation:7].

Mistakes I Keep Seeing

These come up repeatedly in code reviews and security audits. None of them are exotic, and all of them are easy to avoid once you know they exist.

Mistake one: concatenating user input into SQL and calling it "sanitized" because you replaced single quotes. That does not work. Use parameters.
Mistake two: assuming stored procedures are automatically safe. A procedure that builds dynamic SQL with concatenation is just as vulnerable as application code.
Mistake three: using an ORM and assuming you are protected. ORMs parameterize standard operations, but raw query escape hatches bring the vulnerability back.
Mistake four: giving the application account DBA rights because it was easier than figuring out what permissions it actually needs. Least privilege limits the damage when something slips through.
Mistake five: implementing RLS and then testing as the table owner. Owners bypass RLS by default in PostgreSQL. Test as a non-owner role or the policy looks broken.
Mistake six: hiding error messages and calling it a fix. Blind injection still works without error messages. Parameterized queries are the fix.

Follow-Up Questions Interviewers Ask

Getting the first answer right is only half the interview. What decides the outcome is what happens next. Here is what to prepare for.

After "What is SQL injection?" — expect

  • "How do you prevent it?"
  • "Can stored procedures be vulnerable?"
  • "What is blind injection?"
  • "What is second-order injection?"

After "parameterized queries" — expect

  • "Can you parameterize table names?"
  • "What do you do when you cannot parameterize?"
  • "What is the difference between escaping and parameterization?"
  • "Are ORMs safe?"

After "row-level security" — expect

  • "How does RLS work in SQL Server vs PostgreSQL?"
  • "What is a filter predicate vs a block predicate?"
  • "Does RLS affect performance?"
  • "How do you test RLS when the owner bypasses it?"

For every question above, prepare a second-level answer. The candidates who pass are the ones who keep going for another thirty seconds and say something useful about why it matters.

Quick Quiz

Three questions to check whether the topics above have landed.

1. What is the primary defense against SQL injection?
2. Can you use a parameter placeholder for a table name?
3. What does row-level security do?