Interviews make a lot of novice programmers anxious, and rightfully so. When you spend so much time practicing tech skills, building confidence doesn’t seem to be a priority. However, when it comes to the interview, a confident programmer will look more competent, regardless of their actual experience.
In this blog post let’s take a look at possible questions you might face, and so make sure you’ll be better prepared than the competition.
The first couple of questions you’ll get will be about your education and previous work experience, and they will be pretty basic. These questions will cover your understanding of basic SQL features and functions.
Q1. One of the most popular questions is: What are the sublanguages of SQL?
SQL consists of many type of statements, which classified as sub languages. There are 6 sublanguages in SQL.
DDL-Data Definition Language
- Used to define Database objects like TABLE, VIEW,SEQUENCE,INDEX,SYNONYM creation or modification or removing.
- CREATE,ALTER,DROP,TRUNCATE,RENAME are the DDL commands
DML – Data Manipulation Language
- Used to manipulate the data in Database objects like table, view, index ..etc,.
- INSERT, UPDATE, DELETE are the DML commands.
DRL/DQL-Data Retrieval Language/Data Query Language
used to retrieve information from the database objects. it is for read only purpose.
–SELECT is the DQL or DRL command.
TCL – Transaction Control Language
-Transaction control statement are use to apply the changes permanently save into database.
-COMMIT, ROLLBACK, SAVEPOINT, ROLLBACK TO are the TCL commands.
DCL – Data Control Language
Data control statements are use to give privileges to access limited data or share the information between users.
-GRANT,REVOKE ,AUDIT,COMMENT, ANALYZE are the DCL commands.
SCL- Session Control Language
Session control statement are manage properties dynamically of a user session.
-ALTER SESSION,SET ROLL are the SCL commands.
Q2. What is the difference between binary and varbinary data, and where would you use either?
BINARY stores values in fixed lengths.
VARBINARY stores values in variable lengths. Values are not padded with any bytes
Q3. What Are the Differences between CHAR and VARCHAR?
CHAR stores values in fixed lengths. Values are padded with space characters to match the specified length.
VARCHAR stores values in variable lengths. Values are not padded with any characters. But 1 or 2 extra bytes are added to store the length of the data.
The table below shows you a good comparison of CHAR and VARCHAR data types:
Value CHAR(4) Length
'' ' ' 4 bytes
'ab' 'ab ' 4 bytes
'abcd' 'abcd' 4 bytes
Value VARCHAR(4) Length
'' '' 1 byte
'ab' 'ab' 3 bytes
'abcd' 'abcd' 5 bytes
Q4. Explain what index is and how triggers work
Indexes are special lookup tables that the database search engine can use to speed up data retrieval. Simply put, an index is a pointer to data in a table. An index in a database is very similar to an index in the back of a book.
SQL Server triggers are special stored procedures that are executed automatically in response to the database object, database, and server events. SQL Server provides three type of triggers:
- Data manipulation language (DML) triggers which are invoked automatically in response to INSERT, UPDATE, and DELETE events against tables.
- Data definition language (DDL) triggers which fire in response to CREATE, ALTER, and DROP statements. DDL triggers also fire in response to some system stored procedures that perform DDL-like operations.
- Logon triggers which fire in response to LOGON events
Code Execution Test –tips
You can read the books and manuals all you want, but ultimately, you can’t master SQL if you can’t read and write code. This is what the interviewer will be testing after you’ve gone through the basics.
The first type of question would be a task to read a piece of code. You’ll get a line or a couple of lines of code, and you need to say what the code executes.
Also, the interviewer may give you a table, or code that creates a table, and a line of code. Based on both of these, you’ll need to say what the code will return.
After you show you understand code, it’s time to write your own. You may start with explanatory questions like how do you avoid duplicate entries or how do you merge two tables with no overlapping rows. Explain how you would do that, and you’re off to the next step.
The next step is actually writing code. You may need to write a piece of code to execute what you’ve been talking about or write something completely different.
Often, you will have to create a table first and manipulate data in it to show you know more than one SQL sublanguage. Sometimes, the interviewer will ask you to write that code without using the most straightforward command to see how inventive you are.
Don’t quite understand what you need to write? Ask the interviewer!
As weird as it may sound to a beginner programmer, asking questions and clarifying your task is actually a very important skill for a programmer.
If you ask nothing and end up writing something that doesn’t work or doesn’t satisfy the interview question, you show that you don’t have any soft skills, and you more than likely won’t land the job.
The most important thing is to build confidence. Try to test queries on hackerrank.com or write more SQL code, read about interview questions.
Here is the list of the source that can help you!
Do not panic, Just take your dream job!
Thank for your attention!
Please put more smile in digital world