Database & Automation – Interview Question Bank

 From Past interviews

  1. How to connect to SQL Server using JDBC in Java? (your question)
  2. Write Java code for JDBC connection with a SELECT statement. (your question)
  3. Can we automate comparison of 30+ DB columns across multiple tables? (your question)
  4. How to validate test cases involving DB queries in automation? (your question)
  5. How to fetch data from DB and compare with UI in Selenium tests? (your question)
  6. How do you validate CDR (Call Detail Records) from the DB in telecom testing? (your question)
  7. How do you handle DB validation when writing automation scripts in Java/Python? (your question)
  8. Why is database testing important in test automation frameworks? (your question)
  9. How to write SQL queries inside a Java Selenium test for validation? (your question)
  10. How do you check for duplicate records in DB using SQL? (your question)

 Database Basics (0–2 Years)

  1. What is a primary key?
  2. What is a foreign key?
  3. What is the difference between INNER JOIN, LEFT JOIN, and RIGHT JOIN?
  4. What is a unique key vs. primary key?
  5. What is normalization? Explain different normal forms.
  6. What is denormalization?
  7. What is the difference between clustered and non-clustered indexes?
  8. Write a query to fetch the second highest salary from an employee table.
  9. Write a query to count duplicates in a column.
  10. Write a query to get employees who don’t have a manager.
  11. Write a query to fetch only distinct records.
  12. What is a view in SQL?
  13. What is a stored procedure vs. a function?
  14. What is a trigger in SQL?
  15. How do you find NULL values in a column?

 Intermediate Level (3–6 Years)

  1. Explain transaction properties (ACID).
  2. What is indexing? When would you use it?
  3. What is a deadlock in DB? How do you resolve it?
  4. How do you optimize a slow query?
  5. What are CTEs (Common Table Expressions)? Give an example.
  6. What is the difference between RANK(), ROW_NUMBER(), and DENSE_RANK()?
  7. Write a query to get top 5 employees with the highest salary from each department.
  8. Write a query to join 3 tables.
  9. Write a query to transpose rows into columns.
  10. What are aggregate functions in SQL?
  11. What are window functions?
  12. How do you test a stored procedure?
  13. How do you test triggers in a database?
  14. How do you check DB constraints are working as expected?
  15. How do you validate DB changes after an application update?

 Advanced (7–10 Years)

  1. Difference between OLTP and OLAP databases.
  2. Explain database partitioning and sharding.
  3. What is replication in databases?
  4. What are materialized views?
  5. Explain CAP theorem.
  6. How do you design a database for scalability?
  7. What is query execution plan? How do you use it?
  8. What is database indexing strategy for high-traffic apps?
  9. How do you handle data migration testing between DB versions?
  10. How do you ensure data integrity in distributed systems?
  11. What is database connection pooling?
  12. How do you test DB performance in automation?
  13. How do you automate DB schema validation across environments?
  14. How do you ensure DB rollback works correctly during failures?
  15. Explain database caching strategies.

 Database + Automation (Python/Java)

  1. How do you connect to a database using Python?
  2. Write Python code to fetch records from a DB table.
  3. How do you validate DB values against API response in Python automation?
  4. How do you use PyODBC or SQLAlchemy for DB automation?
  5. Write a Java JDBC code snippet to run a SELECT query. (your question)
  6. How do you handle DB credentials securely in automation scripts?
  7. How do you automate DB verification in Selenium test cases?
  8. How do you read DB data and compare with Excel test data in Python?
  9. How do you parameterize DB queries in automation frameworks?
  10. How do you integrate DB validations into CI/CD pipelines?

 Real-Time Scenarios

  1. How would you test data consistency between UI and DB?
  2. How do you validate DB records created after a user action (e.g., placing order in Amazon)?
  3. How do you test rollback when a transaction fails?
  4. How do you verify data migration after a DB upgrade?
  5. How do you check DB synchronization across environments (Dev/QA/Prod)?
  6. How do you test data archiving in DB?
  7. How do you verify stored procedure output using automation?
  8. How do you detect and handle DB deadlocks in automation?
  9. How do you compare millions of records between two DBs?
  10. How do you automate validation of telecom CDRs stored in DB?

Leave a Comment

Your email address will not be published. Required fields are marked *