Interviews can be really hard for people who fret in anticipation. It is what generates anxiety which can mess up even the easiest of situations. Why does that happen? Lack of confidence. And what exactly does lack of confidence stem from? Lack of preparation. Prepare well for your interview- go through SQL basic questions and advanced SQL interview questions to slay your fears and grab that job.
1. How do you explain SQL to a layman?
SQL is to a website what tools are to a carpenter- the essentials of building a website. Structured Query Language tweaks, adds, alters and manipulates data to make it suitable for usage. The data is recorded in tables with a relationship involving a foreign key or a key. Its utility is in management and storage of millions of data points in the databases.
2. What is the backbone of SQL? Elaborate.
In Structured Query Language, RDMS (Relational Database Management System) is considered as its backbone. It is a compendium of all types of data that goes into building a website- personal data, financial data, logistical data and manufacturing data. Not just SQL, but it is used in other database systems such as ORACLE, Microsoft, IBM, MySql.
3. How can SQL be used in a website?
SQL is the building block of a website. When a website is built, there is a skeleton structure that is built information/data to be put up on the website. SQL is used to breathe life in this skeleton structure so that the data is presented properly and it’s not just empty boxes that are shown.
4. What is Normalisation in the context of SQL?
What does not have anomalies is normal. Normalisation in SQL is a database that is devoid of anomalies. Examination and removal of anomalies is done for simpler and easier management of data. The relation is split into two simpler relations which make it easier to manage the data.
5. What is de-normalisation in the context of SQL?
To enhance the read performance of a database infrastructure, denormalisation is used. By grouping data and adding redundant data, denormalisation is done. It is associated with scalability. It makes it easier to search data in a group than in various tables, hence denormalisation is done.
6. How are Primary Key and Unique Key different?
The current identity in relations is identified with the help of a primary key. It contains a unique value for each row of data and does not contain a null value. It is crucial for a workable and efficient relational database. It is a key to the primary index.
Combination of columns is different for each row. This is known as a unique key. With the help of a unique key, the identification of a particular row becomes easier. The unique key may or may not have a null value. Each table can have one unique constraint.
Also Read: Professional Approach to Job Search
7. What do you understand by foreign key?
The thing that establishes a relationship between two tables in a database is a foreign key. It is used as a linkage in data in different tables.
8. What is an INDEX?
In a database table, an index helps in speedy data retrieval operations. Indexes are created to access data of different values faster. Although indexes take some space on the disk, they facilitate faster access, therefore become necessary.
9. What are the tables and fields in SQL?
Data organised in the column and row model is a table in SQL. Rows are organised in horizontal and column in vertical. There can be any number of rows which are called record but specified number of columns which are called fields.
10. What is a query and a subquery?
A code written in a way to retrieve information from the database; the request generated to retrieve it is called query.
Depending on whether the query is correlated or non-correlated, a subquery can be independent or dependent. A correlated subquery is evaluated by the main query for each processed row.
11. How are phantom reads and dirty reads different?
In the course of the transaction if the data gets changed, it is known as phantom reads. There could be addition or subtraction of rows apart from the current one. By writing the same query, when more and different number of rows are shown, it is the result of phantom reads.
The dirty reads on the other hand are the read of uncommitted data. SQL server is used to read uncommitted data that is the dirty data in a transaction. This data is however full of anomalies. It keeps on changing as one reads it. The reading of dirty data is done by Read Uncommitted using NoLock.
Some of the questions to take a look at right before you enter the venue of your interview can help you with any roadblock which you may hit. Answers to SQL interview questions like these can be memorised or just taken a glance at.