Hello there, my name is Richard McMunn from the interview training company PassMyInterview.com.
And in this training video, I'm going to teach you how to pass a SQL interview. In particular,
I'm going to give you a number of SQL interview questions and top-scoring answers. In fact,
I'm going to go through 23 SQL common interview questions; the ones I feel are most likely
to come up during your interview. I will give you the answers to those as well. I'm going
to cover both technical SQL interview questions and non-technical interview questions. And
as I say, these are the questions that I believe will come up during your interview. So, please
do stick around and watch it from beginning to end. Now, I want to stress that this interview
training video is suitable for all SQL related job roles. So, it does not matter which role
you are being interviewed for, I believe it will make a big difference to your preparation.
Now, before I get into those 23. SQL interview questions and answers, a very warm welcome
to this training tutorial. My name is Richard McMunn. That's me there in the center. I've
been helping people for about 20 years now to successfully pass their interviews, and
I do that by always giving you top-scoring answers. Please, to make sure you SUBSCRIBE
to this channel by clicking the red button below the video. Then you won't miss out on
any of the training videos I'm uploading. And I would also very much appreciate your
support if it gave the video a thumbs up (cheers!) That always motivates me to create more content
for you. Thank you very much. Also, if you want me to create a video for you that is
based on your particular job role, please tell me the name of that particular job interview
that you have coming up in the comments section below, and I will come on and create a video
for you or even give you some tips, some more tips for helping you to pass. Let's get into
those 23 SQL interview questions and answers. Now, as I said at the beginning, I'm going
to walk through 23 technical and non-technical SQL interview questions to make sure you are
fully prepared for your interview because of course, you are going to get asked questions
such as tell me about yourself. What can you bring to the role? What personality can you
bring? Why do you want to leave your current job, etc. etc. There are 23 to work for. You
can either take notes as I progress, or I will tell you where you can download these
slides to help you during your preparation as I progressed through the tutorial. The
first question of our SQL interview: Tell me about yourself and why you want this position?
We want to make sure we get off on a positive footing for this first interview question.
Here is my suggested answer. “I am a strong team worker who can be relied upon to carry
out my technical duties with passion and professionalism to ensure the goals of the department and
the company I am working for are met. My level of SQL technical ability is a strong match
for this role and I have experience of working with other developers, engineers and also
third-party service providers to compete tasks successfully. I want this SQL position because
I feel I can contribute to the team positively; I can bring something new in terms of my competence,
and you are also an attractive employer to work for due to your future plans and also
the reputation you have within the industry.” So, that's a strong answer. It puts you across
in a positive light in response to this first SQL interview question. Question number two:
So a very basic question, which you will obviously understand and know…What is SQL? Here is
my answer. “Structured Query Language, more commonly known as SQL, is seen as the standard
for managing data kept in relational database management systems. For example, SQL statements
are used to carry out tasks including updating the data, and also retrieving specific data
from a database.” Question number three: Why do you want to work for our company in
this SQL position? So again, this is a guaranteed question to come up. A lot of people want
to know why you’ve chosen their company. And, you know, a lot of people will go to
companies for the salary or because it's just convenient. But they want to know exactly
why you want to work for their company in this SQL position. Here is my suggested answer
for you: “Within any SQL job, it’s really important to choose your employer carefully.
What I mean by this is, in order to carry out your job properly, you need to work as
part of a team that has clearly defined goals, sets high standards and also works collaboratively
to achieve all company objectives. From what I found during my research into your organization,
you are very well thought of by other people who work within the industry, you have exciting
and ambitious plans for the future, and it is clear you give your staff the support they
need to grow and develop within their roles.” That's a good answer to that question, which
as I say, is going to come up during your interview. Question number four: What is MySQL?
“MySQL is an open-source relational database management system that is based on SQL, most
commonly used for web databases. It was co-founded by Michael Widenius and the ‘My’ aspect
of MySQL is the name of his daughter. The remainder is obviously an abbreviation for
Structured Query Language. MySQL is utilized by a variety of database-driven web applications.
These include WordPress and Joomla amongst others. It is also used by many of the world’s
most popular websites, including YouTube, Facebook and Twitter. Written using C and
C++ languages, MySQL supports the major platforms you’d expect such as macOS, Linux, and Windows.”
By the way, if you want to connect to me on LinkedIn.com, I'm sure you are probably on
LinkedIn, I have put my LinkedIn description, my LinkedIn link, sorry, in the description
below the video, so you can connect with me and say hello. Question number 5. What's the
main difference between SQL and MySQL? “So, SQL is often used to access, manipulate and
update the data within a database, whereas MySQL is a relational database management
system that keeps the data within the database organized. In other words, SQL is a language
created to manage relational databases, and MySQL is an open-source relational database
management system, based on SQL.” Question number 6: In SQL, what are joins? “There
are four main types of joins in SQL. These are FULL JOINS, RIGHT JOINS, LEFT JOINS and
INNER JOINS. Joins basically combine the rows from two or more tables.” Question 7: What
is an index and why is it useful to have? “An index is useful because it allows for
the faster retrieval of records from a table. The index creates an entry for each value,
which in turn, makes it much faster to retrieve the data required, or in other words, an index
is a pointer to data contained within a table.” Question number 8. What personality will you
bring to the team? So, they are assessing here what kind of person you are. You might
have immense technical ability; however, your personality might be of someone who just wants
to crack on, on their own. The key word here is ‘TEAM’. You know, the personality we
want to portray is of a ‘can do attitude’ where you will help the team to achieve their
objectives. And that is the kind of answer I suggest you give! Here is my suggested answer
to, what personality will you bring to the team? “My personality is one of always being
positive, having a can-do attitude and also being supportive of other developers, team
members and ensuring I help out the team in a professional and timely manner. What’s
important within any SQL role, is to remember you are all working together collaboratively
to achieve the company’s objectives, and on that basis, you have to bring your technical
expertise to the table, look for efficient ways of working, and also respond to people’s
queries and questions in as quick a time as possible.” So that would be attractive to
any organization, any hiring manager. If you said that's the kind of personality that you
have, that's positive in nature, but you've also got the technical level of expertise.
Next question: If a constraint is added in SQL, what does this mean? “There are many
different types of SQL constraints which can be used. Their purpose is to specify a rule
for the data within a table, limiting the type of data that can go within the table.
The constraint can be added either during the creation of a table, or once it has been
created. Constraints can be applied to either the table as a whole or column level.” Question
number 10: What are the more common types of SQL constraint and what do they mean? Here
is my answer. “There are several common SQL constraints. These are PRIMARY KEY, which
identifies each record in a table; NOT NULL is used to prevent a NULL value being inserted
into a column; FOREIGN KEY, which provides a unique identification of a row or record
within another table; and also DEFAULT, which will automatically assign a default value
if there has not been a value already specified for a field. There is also CHECK, which is
a constraint that is used to verify that all values meet a specific criteria or condition
in a field; and UNIQUE, which ensures unique values are always inserted into a column.
Finally, INDEX is used to create data and to obtain it from a database with speed.”
Question 11: So far, you have referred to tables and fields in your answers. What are
they? “In its simplest form, a TABLE is a collection of data that is organized into
rows and columns. The columns are vertical, and the rows are horizontal. The columns are
called FIELDS and the rows are often referred to as records.” Don't forget, I am going
to tell you at some stage soon where you can download these slides and you can use them
during your preparation. Question 12. What's your biggest weakness? So, this is a difficult
one, because we don't want to give them a weakness that will prevent you from getting
the job. My suggested answer for the weakness interview question is to say sometimes you
find it hard to strike a healthy work life balance, because you're always committed,
always working, perhaps you are somebody who is prepared to do loads of work in the evening
and your partner doesn't like it. Something like that. Here is my answer. “My biggest
weakness is that I find it difficult to say no to people, and I end up taking on way too
many tasks than I can handle at times. In the past, because of my reluctance to say
to no to work, I've ended up working literally all weekend just to catch up. Whilst I will
always say yes to work, I am learning to manage my workload more effectively, and prioritize
what needs to be done for my employer.” That is a smart answer, because you are demonstrating
that you will take on loads and loads of work, but you are becoming more smarter at managing
your workload. Question 13: Tell me what the different subsets of SQL are? “So, there
are three main subsets of SQL. Firstly, there is Data Control Language, or DCL, which permits
you to control access to the database. For example, you can either grant access to the
database or revoke it. Then there is DDL, which is Data Definition Language, which allows
you to specify data structures in the database, including deleting tables, creating them or
altering them. Finally, there is Data Manipulation Language (DML) which, as the name suggests,
allows you to manipulate the data, including updating, inserting, deleting or retrieving
data in the table as required.” Question 14: Here is a situational type interview question.
It's 5 p.m. on a Friday and you receive a request from a stakeholder who says it's urgent.
You assess the task and it will take approximately one hour to complete. What would you do? Well,
I'd tell them I'm not going to do it. I'm going home! No, I'm joking! You can't say
that. So, because it's 5 o'clock on a Friday afternoon, that's a sort of hint in the question...
they are looking for somebody who is going to hopefully stay behind and do the work!
Here is my suggested answer. “I would start off by clarifying what their exact requirements
were before setting to work on the task to get it completed before I went home for the
weekend. I think in those types of situations, it’s easy to say you can’t do it because
it’s late on a Friday afternoon, but this is an opportunity to show how flexible we
are as an organization and to also provide great service by going above and beyond what
would normally be required. My personal life is flexible, so I would certainly be available
to stay behind and get tasks like these complete for the stakeholder.” That shows that you
are putting the team and the organization first, which is very important in any SQL
related role. Question 15. How would you format SQL server dates? So, how would you format
SQL server dates? “For this, the FORMAT function can be used. This function allows
the formatting of the date and time. Firstly, I would decide what format I wanted, for example
DD/MM/YYYY or MM-DD-YY. If I wanted to get DD/MM/YYYY I would use SELECT FORMAT (getdate(),
'dd/MM/yyyy’).” Question 16: What is primary and foreign key? “For a database table to
qualify as ‘relational’, it needs to have a primary key. A primary key has one or more
columns. The data within the columns is then used to identify each row in a table. Basically,
these are very similar to street addresses, for example. So, if you think of the rows
in the table as the dustbins or trashcans belonging to houses on a street, the primary
key is the list of the addresses. Primary key attributes cannot have NULL values. A
foreign key is a column in one table. In that table, the values are members of a primary
key column in another table. It is possible for a foreign key attribute to accept NULL
values and for there to be more than one foreign key in a table.” Question 17: Why do you
want to leave your current job? Why are you leaving your job and why do you want to work
for us? Here we go. “I want to leave my job because I am looking for a fresh challenge
with a company that has exciting and ambitious plans for the future, and one that will also
use my skills and technical SQL abilities to the full. My employer has been great and
we have achieved some fantastic things whilst I have been there, but I am now ready for
a new challenge, and I would like that challenge to be with your company.” A hint there is
never be disrespectful to your former employer. Don't be critical of any bosses or your work
colleagues. Always be positive. Say you're ready for a new challenge where, I suggest,
your skills are going to be used to great use. Question 18: What is database denormalization?
“Denormalization is a method used to improve the performance of a database, allowing the
retrieval of data in the quickest time possible. Essentially, the process of denormalization
adds redundant database data into a table which in turn enables the performance of the
database to improve significantly, as the same data can be put in several places.”
Number 19: What is database normalization? “Normalization reduces redundancy of data
within a database. Normalization is a design technique that places larger database tables
into smaller tables and then uses specific relationships to link them. In other words,
normalization is the process of putting each piece of data in the appropriate place, using
multiple tables. The benefit is keeping data integrity and it makes updating faster, but
retrieval of data, can then in turn be slower.” Question 20: What are your salary expectations
in this SQL position? So, we need to be careful here. We don't want to devalue ourselves,
but then we don't want to be overconfident and arrogant, and put them off by saying we
want a huge amount, because remember, they don't know our capabilities at present. So
here is a really strong answer to this question that works for both sides: it is a win-win
answer. “I have carried out some research in relation to the average salary for this
SQL position, and the general range is between $40,000 and $48,000. Whilst I do personally
feel I am worth the higher end of the salary scale, I understand and appreciate I need
to prove to you my worth. On that basis, I would be comfortable with a salary of $45,000.”
What I suggest you do for your role, is carry out some research and look at the average
salary range for your SQL position for your job, and then you know, give them that range.
I’ve given $40,000 to $48,000 there. I've met them halfway, basically, so that I'll
be comfortable with that. I think that's a great answer because it's a win-win. Question
21: In SQL, what is a subquery? “A subquery
is often referred to as an inner query or inner select. As the name suggests, it is
an SQL query nested inside a larger query, such as a SELECT, UPDATE, or INSERT statement,
or indeed inside another subquery. A subquery can be used to retrieve data that will be
used in the main query. This in turn provides a condition to restrict the retrieval of data
even further.” Question 22. What happens to the data rows in the table when the table
contains a clustered index? What happens to the data rows in the table when the table
contains a clustered index? “The data rows will be stored in order. Cluster indexes sort
data rows based on their key values. When a table doesn’t use clustered index, this
is called a heap – in other words, the data rows will be unordered.” Question 23: So
that's the end of your SQL interview. Do you have any questions for the panel? We need
to be very careful what we say at the end. What questions are you going to ask? Here
is my answer. “Thank you, I would like to ask just two questions: Q1. What are the future
plans for the company and how could I help you to achieve your objectives? Q2. If I am
successful, what’s the first thing you would want me to concentrate on in this SQL position?”
So, we've covered 23 questions! If you would like to download all of those in SLIDE FORMAT,
there is a link that has appeared in the top-right hand corner of the screen where you can download
these. It will go to my website PassMyInterview.com. Don't forget to tell me the name of your interview
in the comments section below. I'll be more than happy to create a video for you with
my suggested questions and high scoring answers. Don't forget to connect with me on LinkedIn.com
in the description below. Please do SUBSCRIBE. I very much appreciate the support. I hope
you've enjoyed that tutorial! And good luck in your pursuit for passing your SQL interview.
I hope you have a brilliant day. Thank you.