{"id":177,"date":"2020-03-30T12:00:00","date_gmt":"2020-03-30T19:00:00","guid":{"rendered":"https:\/\/coderpad.io\/sql-interview-questions\/"},"modified":"2023-08-04T13:57:58","modified_gmt":"2023-08-04T20:57:58","slug":"sql-interview-questions","status":"publish","type":"post","link":"https:\/\/coderpad.io\/blog\/interviewing\/sql-interview-questions\/","title":{"rendered":"SQL Interview Questions"},"content":{"rendered":"\n<h2 class=\"wp-block-heading\">How to Structure SQL Interview Questions<\/h2>\n\n\n\n<p>If you\u2019ve ever interviewed technical talent, you know that the pressure is on to accurately assess candidates\u2019 skills, experience and fit.<\/p>\n\n\n\n<p>A technical interview is the classic way to jumpstart this process. But is your approach one that gets you the answers you need while also putting your best foot forward to top candidates?<\/p>\n\n\n\n<p>To get the inside perspective on running a brilliant SQL-focused technical interview, and evaluating candidates, we had a chat with two experts: <a href=\"https:\/\/www.linkedin.com\/in\/wenbolu\/\" target=\"_blank\" rel=\"noopener\">Wendy Lu<\/a>, Growth Analytics Lead at <a href=\"https:\/\/www.figma.com\/\" target=\"_blank\" rel=\"noopener\">Figma<\/a>, and <a href=\"https:\/\/www.linkedin.com\/in\/jgeggatt\/\" target=\"_blank\" rel=\"noopener\">Jonathan Geggatt<\/a>, VP of Engineering at CoderPad (and formerly Head of Data at Airbnb).<\/p>\n\n\n\n<p>Here\u2019s what they told us.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Mine the real world for scenarios that resonate.<\/h2>\n\n\n\n<p>Candidates already practice the SQL interview questions that pop up in a basic Google search &#8211; so how useful is it to ask them?<\/p>\n\n\n\n<p>That\u2019s why leading companies are increasingly moving away from generic questions and are instead offering candidates a crack at real-life internal scenarios. \u201cAt Airbnb, we gave potential hires access to the tools we use and a vetted data set, one where we knew its limitations and problems. It allowed them to focus on the shape of the data and frame answers to problems that were meaningful to us,\u201d notes Geggatt.<\/p>\n\n\n\n<p>Lu agrees that a case-based interview is optimal. \u201cI\u2019m not hung up on the hardest questions but the ones that are most relevant for the business problems we\u2019re working on day to day,\u201d she says. \u201cMore companies are looking inward for case-based questions because they\u2019re good for holistic testing. They can help candidates show critical thinking, technical skills, business acumen, and communication ability.\u201d<\/p>\n\n\n\n<p>Yes, it\u2019s obvious but ensure you\u2019re testing for skills that fit the candidate\u2019s experience level.<br>SQL doesn\u2019t have a ton of conceptually challenging elements to test for, says Geggatt. He structures interviews to determine if a candidate\u2019s stated experience aligns with reality as well as what\u2019s needed for the role. For instance, an entry-level person should understand the different kinds of joins whereas someone mid-level should easily show a solid grasp of window functions and aggregations, plus how they work together and when they\u2019d be useful.<\/p>\n\n\n\n<p>For senior level candidates, he says throwing in a dirty dataset, one in which a prospective hire can\u2019t be sure the data quality is top notch, is a good way to assess higher-order skills. Watch how well they clean it up &#8211; removing dupes, for instance, or casting currency into numbers instead of strings. Manipulating data to improve the fidelity of a dataset is a typical real-world scenario.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Offer problems that require conceptualization and application.<\/h2>\n\n\n\n<p>If you\u2019ve game-planned it well, candidates won\u2019t be able to nail a technical interview by cramming for it like a test. Place a premium on candidates\u2019 ability to intelligently apply concepts, not how well they parrot back the basics. In a SQL interview, you might ask them to:<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>Take a large dataset and join it to a clean dataset. For example, the user\u2019s table might be clean but the analytic events table could have issues. Perhaps it\u2019s something relatively basic like the ID on the user\u2019s table is an integer but on the other, it\u2019s a string. Ask for insights like how many times a user visited the site in the last three months. In a more complex advanced example, you might challenge prospective hires to develop a 360-degree view of customer behavior around events like payments and site visits. Query them on specifically how they would get answers.<\/li>\n\n\n\n<li>Demonstrate the difference between actions like filtering an \u201con\u201d clause versus the \u201cwhere\u201d clause in a join. This can indicate the extent of their knowledge around order of operations within joins. Do they know the result of null equals null? Questions like these can help you gauge curiosity around niche concepts.<\/li>\n\n\n\n<li>Walk you through table relationships, specifically ordinality and cardinality. Do they know inner and outer joins? Can they talk about order of operations because they understand how SQL processes these operations?<\/li>\n<\/ul>\n\n\n\n<h2 class=\"wp-block-heading\">Set expectations.<\/h2>\n\n\n\n<p>A technical interview bears some similarity to grade school: you want candidates to share their thinking, show their work, and raise their hand as needed throughout the process. So set that expectation up front &#8211; and also make it clear that you expect them to dig a little deeper into each problem.<\/p>\n\n\n\n<p>\u201cTechnical interviews aren\u2019t always straightforward. Candidates should assume there\u2019s a level of nuance to what we\u2019re giving you,\u201d advises Geggatt. \u201cThey should be thinking about what you might be implying or even what could be missing before jumping into the answer.\u201d<\/p>\n\n\n\n<p>Similarly, you\u2019ll want to see if a prospective hire is willing to ask questions if they get stuck along the way. \u201cIt tells you a little bit about what that person might be like to work with &#8211; if they\u2019ll barrel ahead or connect with their team,\u201d he says.<\/p>\n\n\n\n<p>Lu emphasizes that a willingness to ask questions is a positive. \u201cSometimes candidates will sit for five minutes and won\u2019t ask questions,\u201d she notes. \u201cThat\u2019s a red flag around communication. Sometimes it\u2019s that they don\u2019t want to look stupid but there\u2019s no perfect answer. It does show how this person would potentially work on a team. I want to know the assumptions they\u2019re making along the way so I can correct them and keep the interview moving forward.\u201d<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Remember it\u2019s about so much more than just their technical skills.<\/h2>\n\n\n\n<p>How a candidate approaches a technical task is as important &#8211; if not more important &#8211; than actually getting an answer that\u2019s textbook perfect. As a hiring manager, try to evaluate critical thinking skills as well as the ability to problem solve.<\/p>\n\n\n\n<p>\u201cI\u2019m looking for someone who\u2019s professionally skeptical about the datasets they\u2019re working with,\u201d says Lu. \u201cAre they addressing data hygiene? Are they thinking about data structure before jumping right into analysis?\u201d<\/p>\n\n\n\n<p>A typical SQL test could have three or four \u201ccorrect\u201d answers so don\u2019t get hung up on the idea there\u2019s only one impressive response. The metric should be, Can this candidate write queries that will generate a meaningful answer for a real business case? Evaluate how well that person then communicates it. People who can articulate the assumptions they made during the analysis &#8211; and then convey the results to technical and non-technical audiences alike &#8211; should rise to the top of your heap. For example:<\/p>\n\n\n<div\n\tclass=\"sandbox-embed responsive-embed  sandbox-embed--full-width\"\n\tstyle=\"padding-top: 125%\"\ndata-block-name=\"coderpad-sandbox-embed\">\n\t<iframe src=\"https:\/\/embed.coderpad.io\/sandbox?question_id=249809&#038;use_question_button\" width=\"640\" height=\"800\" loading=\"lazy\" aria-label=\"Try out the CoderPad sandbox\"><\/iframe>\n<\/div>\n\n\n\n<h2 class=\"wp-block-heading\">Look for the candidates who put in extra effort.<\/h2>\n\n\n\n<p>Candidates should know a decent amount about your company. That\u2019s just table stakes. But give major bonus points for those who use that information creatively, say, by finding and extrapolating typical use cases. Do they have a point of view on what the company is trying to optimize for? A sense of the challenges could they use data to overcome? Mention how competitors are approaching the same issues? Those are great signals you\u2019ve got a winner on your hands.<\/p>\n\n\n\n<p>Ultimately, SQL is a tool that many can pick up. But beyond mastering the functionality, hiring managers should design the interview to ensure they get a full-spectrum view of candidates: from critical thinking and communication skills to generating useful results.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">More interviewing resources<\/h2>\n\n\n\n<p>We have made available these extra resources to improve your SQL coding skills:<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li><a href=\"https:\/\/coderpad.io\/interview-questions\/mysql-interview-questions\/\">25+ questions for MySQL<\/a><\/li>\n\n\n\n<li><a href=\"https:\/\/coderpad.io\/interview-questions\/postgresql-interview-questions\/\">25+ questions for PostgreSQL<\/a><\/li>\n\n\n\n<li><a href=\"https:\/\/coderpad.io\/online-coding-tests\/mysql-online-coding-test\/\">Online coding test questions for MySQL<\/a><\/li>\n\n\n\n<li><a href=\"https:\/\/coderpad.io\/online-coding-tests\/postgresql\/\">Online coding test questions for PostgreSQL<\/a><\/li>\n<\/ul>\n","protected":false},"excerpt":{"rendered":"<p>If you\u2019ve ever interviewed technical talent, you know that the pressure is on to accurately assess candidates\u2019 skills, experience and fit.<\/p>\n","protected":false},"author":1,"featured_media":130,"comment_status":"closed","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"footnotes":""},"categories":[12],"tags":[],"persona":[],"blog-programming-language":[],"keyword-cluster":[],"class_list":["post-177","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-interviewing"],"acf":[],"_links":{"self":[{"href":"https:\/\/coderpad.io\/wp-json\/wp\/v2\/posts\/177","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/coderpad.io\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/coderpad.io\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/coderpad.io\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/coderpad.io\/wp-json\/wp\/v2\/comments?post=177"}],"version-history":[{"count":8,"href":"https:\/\/coderpad.io\/wp-json\/wp\/v2\/posts\/177\/revisions"}],"predecessor-version":[{"id":35872,"href":"https:\/\/coderpad.io\/wp-json\/wp\/v2\/posts\/177\/revisions\/35872"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/coderpad.io\/wp-json\/wp\/v2\/media\/130"}],"wp:attachment":[{"href":"https:\/\/coderpad.io\/wp-json\/wp\/v2\/media?parent=177"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/coderpad.io\/wp-json\/wp\/v2\/categories?post=177"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/coderpad.io\/wp-json\/wp\/v2\/tags?post=177"},{"taxonomy":"persona","embeddable":true,"href":"https:\/\/coderpad.io\/wp-json\/wp\/v2\/persona?post=177"},{"taxonomy":"blog-programming-language","embeddable":true,"href":"https:\/\/coderpad.io\/wp-json\/wp\/v2\/blog-programming-language?post=177"},{"taxonomy":"keyword-cluster","embeddable":true,"href":"https:\/\/coderpad.io\/wp-json\/wp\/v2\/keyword-cluster?post=177"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}