← Rbcroyalbank Interview Insights

Rbcroyalbank·Software Engineer·Online Assessment (OA)·Junior

Junior
Jun 2026

Summary

Interviewed for a Data Engineer internship at RBC Royal Bank. Three short technical questions, all focused on data manipulation basics. Nothing too wild but the SQL dedup one took me longer than I expected.

Questions Asked (3)

Q1

In pandas, what is the difference between a Series and a DataFrame? Cover dimensionality, indexing, and when you'd use each.

Technical Trade-offsAlgorithms & Data Structures
Author's notes

Knew this one cold.

Create a free account to read the full note

AI HintsAI Generated

Suggested Approach

Start by defining both structures clearly, emphasizing that a Series is a one-dimensional labeled array while a DataFrame is a two-dimensional labeled table. Then compare their indexing capabilities and typical use cases, using concrete examples to illustrate when each is appropriate. Conclude by tying the answer back to practical data manipulation scenarios, especially in a financial context like RBC.

Pro tip: Mention that a DataFrame can be thought of as a dictionary of Series sharing the same index, which demonstrates deep understanding. Also, highlight that many pandas operations return Series from DataFrames, so knowing when to use each is crucial for efficient code.

1. Define Series and DataFrame

Clearly state that a Series is a 1D labeled array capable of holding any data type, and a DataFrame is a 2D labeled data structure with columns of potentially different types.

2. Compare dimensionality and indexing

Explain that Series has a single index, while DataFrame has both row and column indexes. Mention that DataFrame indexing allows for label-based and integer-based selection across two axes.

3. Discuss use cases

Describe when to use each: Series for a single variable or column, DataFrame for tabular data with multiple variables. Give examples like time series (Series) vs. financial records (DataFrame).

4. Highlight relationships and conversions

Note that a DataFrame column is a Series, and you can extract Series from DataFrames or combine Series to form a DataFrame. This shows how they interconnect.

5. Summarize with a practical example

Provide a concise example from a software engineering or finance context, such as using a Series for daily stock prices and a DataFrame for multiple stocks with dates.

Key Points to Mention

  • Series is 1D, DataFrame is 2D.
  • Series has one index; DataFrame has row and column indexes.
  • DataFrame columns are Series objects.
  • Use Series for single-variable data, DataFrame for multi-variable tabular data.
  • Operations like df['col'] return a Series.
  • DataFrame can be created from a dict of Series.

AI-generated suggestions, not part of the candidate's original notes. May be inaccurate — verify before relying on them.

Q2

What is the difference between WHERE and HAVING in SQL? When does each filter get applied, and can you use aggregate functions in them?

Technical Trade-offs
Author's notes

Pretty standard.

Create a free account to read the full note

AI HintsAI Generated

Suggested Approach

Start by defining the core difference: WHERE filters rows before grouping, while HAVING filters groups after aggregation. Then explain the logical order of SQL execution to clarify when each is applied, and explicitly state that aggregate functions can only be used in HAVING (and SELECT), not in WHERE. Finally, provide a simple example to illustrate the distinction.

Pro tip: Mention that some databases allow HAVING without GROUP BY (treating the whole result as one group), but this is non-standard and best avoided. Also, note that filtering early with WHERE improves performance by reducing the data before aggregation.

1. Define the core difference

State that WHERE filters individual rows before any grouping, while HAVING filters groups after aggregation. Emphasize that WHERE is applied to raw data, HAVING to summarized results.

2. Explain the logical order of execution

Describe the SQL query processing order: FROM → WHERE → GROUP BY → HAVING → SELECT → ORDER BY. This clarifies that WHERE runs before GROUP BY and HAVING runs after.

3. Address aggregate functions

Clarify that aggregate functions (e.g., SUM, COUNT, AVG) cannot be used in WHERE because they operate on groups, which don't exist yet. They can be used in HAVING and in the SELECT list.

4. Provide a concrete example

Give a simple SQL example, such as: SELECT department, AVG(salary) FROM employees WHERE salary > 50000 GROUP BY department HAVING AVG(salary) > 60000. Explain how WHERE filters rows and HAVING filters groups.

5. Mention performance implications

Note that using WHERE to filter rows before grouping is more efficient than using HAVING, because it reduces the number of rows that need to be aggregated.

Key Points to Mention

  • WHERE filters rows before grouping; HAVING filters groups after grouping.
  • Logical order: WHERE is evaluated before GROUP BY, HAVING after.
  • Aggregate functions cannot appear in WHERE, but can in HAVING and SELECT.
  • HAVING is typically used with GROUP BY, but can be used without it in some databases.
  • Filtering with WHERE improves performance by reducing data before aggregation.
  • Example: WHERE salary > 50000 vs. HAVING AVG(salary) > 60000.

AI-generated suggestions, not part of the candidate's original notes. May be inaccurate — verify before relying on them.

Q3

Given a table called transactions_raw with columns for ingest_id, account_id, transaction_id, amount, and a UTC timestamp, write a SQL query that finds all duplicate rows (same account_id, transaction_id, amount, and timestamp) and returns those groups along with a count of duplicates.

Data ModelingTechnical Trade-offs
Author's notes

This one slowed me down more than I'd like to admit.

Create a free account to read the full note

AI HintsAI Generated

Suggested Approach

Start by clarifying the definition of a duplicate: rows with identical account_id, transaction_id, amount, and timestamp, ignoring ingest_id. Then write a GROUP BY query on those four columns with HAVING COUNT(*) > 1 to return the duplicate groups and their counts. Optionally, show how to retrieve the full rows using a window function or self-join.

Pro tip: Mention that ingest_id is likely a surrogate key and should be excluded from the duplicate check, and discuss how to handle NULLs or timestamps with different precision to avoid false positives.

1. Clarify duplicate definition

Confirm that duplicates are based on account_id, transaction_id, amount, and timestamp, and that ingest_id is not part of the business key.

2. Write aggregation query

Use GROUP BY on the four columns and HAVING COUNT(*) > 1 to return each duplicate group with its count.

3. Optionally retrieve full rows

If needed, use a window function like COUNT(*) OVER (PARTITION BY ...) or a self-join to return all columns for duplicate rows.

4. Discuss edge cases and performance

Address NULL handling, timestamp precision, and indexing strategies to optimize the query.

Key Points to Mention

  • Use GROUP BY with HAVING COUNT(*) > 1 to identify duplicate groups.
  • Exclude ingest_id from the duplicate criteria as it is likely a unique identifier.
  • Consider using window functions (e.g., COUNT(*) OVER (PARTITION BY ...)) to return full rows.
  • Handle NULLs appropriately, as they can affect grouping and duplicate detection.
  • Ensure timestamp comparisons account for time zone and precision (e.g., truncate to seconds if needed).
  • Indexing the grouping columns can improve query performance on large tables.

AI-generated suggestions, not part of the candidate's original notes. May be inaccurate — verify before relying on them.