What are user-defined functions and what types are available?

Heisenbug logo
TheHeisenBug

Search

Search across questions, learning content, and hands-on projects

Ace Your Next Tech Interview

5,986+ interview questions across 87 technologies — with expert answers, advanced search, AI-powered assistance, personal highlights, structured learning paths, and hands-on practice projects.

5,986+Questions & Answers
87Technologies
AdvancedSearch
Built-inAsk AI
PersonalHighlights
StructuredLearning Paths
Hands-onPractice Projects

Lifetime Access

One-time payment. No subscriptions. Unlock everything, forever.

$19.90USD

or R$49.90 BRL

FeatureFreePremium
Question titlesAllAll
Answers per topicTop 5All
Learning chaptersFirst 5All
Practice projectsFirst 3All
Highlights
Ask AI
Read tracking
Search

SQL Interview Questions

  1. [JUNIOR] What is SQL and what is it used for?
  2. [JUNIOR] What are the main types of SQL commands (DDL, DML, DQL, DCL, TCL)?
  3. [MID] What is the difference between INNER JOIN, LEFT JOIN, RIGHT JOIN, and FULL OUTER JOIN?
  4. [JUNIOR] What is the difference between DELETE, TRUNCATE, and DROP?
  5. [JUNIOR] What is a primary key and how does it differ from a unique key?
  6. [JUNIOR] What are the different types of joins in SQL?
  7. [JUNIOR] What is the purpose of the WHERE clause?
  8. [JUNIOR] What is the SELECT statement and how is it used?
  9. [MID] What is a subquery and what are its types?
  10. [MID] What are indexes and how do they improve query performance?
  11. [MID] What is normalization and what are the different normal forms?
  12. [SENIOR] What are window functions and how do RANK(), DENSE_RANK(), and ROW_NUMBER() differ?
  13. [SENIOR] How would you optimize a slow-running SQL query?
  14. [JUNIOR] What is a foreign key and how does it enforce referential integrity?
  15. [JUNIOR] What is the difference between CHAR and VARCHAR data types?
  16. [JUNIOR] What are NULL values in SQL and how do they behave?
  17. [JUNIOR] What is the purpose of the ORDER BY clause?
  18. [JUNIOR] What are aggregate functions in SQL?
  19. [JUNIOR] What is the GROUP BY clause and how is it used?
  20. [MID] What is the difference between UNION and UNION ALL?
  21. [MID] What is a view in SQL and when would you use one?
  22. [MID] How do you perform pattern matching in SQL?
  23. [MID] What is a self-join and when is it useful?
  24. [SENIOR] What is a CTE (Common Table Expression) and when would you use it?
  25. [SENIOR] What is the difference between a correlated subquery and a non-correlated subquery?
  26. [SENIOR] How would you calculate a running total using SQL?
  27. [JUNIOR] What is the difference between WHERE and HAVING clauses?
  28. [JUNIOR] What are constraints in SQL and what types are available?
  29. [JUNIOR] What is the purpose of the DISTINCT keyword?
  30. [JUNIOR] What is an alias in SQL and when would you use one?
  31. [JUNIOR] What is the difference between SQL and NoSQL databases?
  32. [MID] What is the difference between a clustered and a non-clustered index?
  33. [MID] What is denormalization and when is it appropriate to use?
  34. [MID] What is a cross join and how does it differ from an inner join?
  35. [MID] How does the CASE statement work in SQL?
  36. [MID] What is the purpose of the COALESCE function?
  37. [MID] What are the ACID properties of a transaction?
  38. [SENIOR] What is a materialized view and how does it differ from a standard view?
  39. [SENIOR] What is the purpose of the LAG and LEAD window functions?
  40. [SENIOR] What are the different transaction isolation levels in SQL?
  41. [SENIOR] How do you find the top N rows per group in SQL?
  42. [SENIOR] What is the purpose of the SQL MERGE (UPSERT) statement?
  43. [EXPERT] How does SQL handle recursive queries using recursive CTEs?
  44. [JUNIOR] What is the purpose of the DEFAULT constraint?
  45. [JUNIOR] What is the purpose of the ALTER command?
  46. [JUNIOR] What are the differences between COUNT() and SUM() functions?
  47. [MID] What are set operations like UNION, INTERSECT, and EXCEPT?
  48. [MID] What is the difference between EXISTS and IN?
  49. [MID] What is a stored procedure and how is it used?
  50. [MID] What is a trigger in SQL and when would you use one?
  51. [SENIOR] What are anti-joins and how are they implemented?
  52. [SENIOR] How can you handle duplicates in a query without using DISTINCT?
  53. [SENIOR] What is the difference between NOT IN and NOT EXISTS and when should you use each?
  54. [SENIOR] What strategies can protect a web application from SQL injection?
  55. [SENIOR] What is an execution plan (EXPLAIN) and how do you use it to optimize queries?
  56. [EXPERT] How do you handle deadlocks in SQL databases and what causes them?
  57. [EXPERT] What is the difference between database sharding and partitioning?
  58. [EXPERT] What are the differences between OLTP and OLAP systems?
  59. [JUNIOR] What is the difference between SQL and MySQL?
  60. [JUNIOR] What is a table and what are fields in a database?
  61. [MID] What is a cursor in SQL and when is it appropriate to use one?
  62. [MID] What are temporary tables and how are they used?
  63. [MID] What is the difference between a local and a global temporary table?
  64. [MID] What is an auto-increment and how does it work?
  65. [SENIOR] What are composite indexes and how do you choose column order?
  66. [SENIOR] How do you implement dynamic SQL and what are its risks?
  67. [SENIOR] What is the purpose of the SQL PIVOT operator?
  68. [SENIOR] What is a covering index?
  69. [EXPERT] How can you ensure data consistency across distributed databases?
  70. [EXPERT] What is the difference between horizontal and vertical partitioning?
  71. [EXPERT] How do you handle slowly changing dimensions (SCD Type 2)?
  72. [JUNIOR] What are scalar functions in SQL?
  73. [MID] What is collation and what are the different types of collation sensitivity?
  74. [MID] What are user-defined functions and what types are available?
  75. [SENIOR] What is the purpose of the WITH (NOLOCK) hint in SQL Server?
  76. [SENIOR] What is sargability in SQL and why does it matter?
  77. [EXPERT] How do you sessionize events using a time-based inactivity window?
  78. [EXPERT] How can you monitor and diagnose query performance in a production database?
  79. [EXPERT] What are the considerations for indexing very large tables?
  80. [EXPERT] What are the trade-offs of using indexing versus denormalization for performance?
  81. [JUNIOR] What happens if you use COUNT() on NULL values?
  82. [MID] What is the difference between the NVL and NVL2 functions?
  83. [SENIOR] What causes double counting in joins and how can it be prevented?
  84. [EXPERT] What is a live lock and how does it differ from a deadlock?
  85. [EXPERT] How do you compute retention cohorts (D1/D7) using SQL?
  86. [EXPERT] What is multi-version concurrency control (MVCC) and how does it work?
  87. [EXPERT] What is Write Ahead Logging (WAL) and why is it important?
  88. [EXPERT] How do you calculate funnel conversion rates across multiple steps in SQL?