Structured Query Language or SQL is a computer language that retrieves and manages information stored in any database.
Programmers well versed in this language are offered lucrative jobs given the important role the language plays. And the competition to secure these jobs is quite fierce.
Some of the companies that hire for SQL Jobs include HCL, Capgemini, Tech Mahindra, Accenture, IBM and Oracle among others.
So, whether you are a fresher or an experienced professional, here are a few essential questions you should go through in order to succeed in your next interview.
20 Basic SQL Interview Questions & Answers
1. What is SQL?
It is a computer programming language that you can use in order to retrieve, update, manipulate, manage and store information you have stored on a database.
2. What are the subsets of SQL?
There are 3:
a. Data Definition Language- including operations like CREATE, ALTER, DELETE.
b. Data Manipulation Language- offers access and manipulation.
c. Data Control Language- offers access control of the data.
3. What is DBMS and what are its types?
Standing for Database Management System, it is a software that offers interaction between you and the database in order to collect and analyze data. It is of two types- Relational DBMS (relational storage of data), and Non-Relational DBMS (data stored is not structured in relations).
4. In SQL, what are a table and a field?
You can organize data into relational structures, a table being one such structure where data is in the form of columns and rows. The number of columns in the table is called the field.
5. What are joins and how many types are there?
You can use the JOIN clause to merge data when the data in the rows of a table are related by one or more common table.
It is of four types: inner, right, left and full.
6. What is DICTINCT statement and how is it used?
In case your records containing duplicate values, the DISTINCT statement is a SELECT command you can use to choose specific values among those duplicates.
7. What Clauses are used in SQL?
Clauses are commands in the SQL software, and there are 6 main types:
b. ORDER BY
c. GROUP BY
8. What are the constraints and what are their types?
These are commands you can use to set the rules for your data. Any operations violating the set rules are aborted by the constraints.
They are of 5 types:
a. NOT NULL– columns cannot be left empty or null
b. UNIQUE – ensures values in cells are unique and not repeated
c. PRIMARY KEY – to identify a record
d. FOREIGN KEY – ensures integrity of data
e. CHECK – makes certain values in cells meet the set rules.
9. What are Scalar Functions?
You can use the Scalar Function to return a single value for the input value. They are:
a. UCASE ()
b. LCASE ()
c. MID ()
d. FORMAT ()
e. LEN ()
f. ROUND ()
10. What is view and how can it be updated?
It is a simulated table containing your information from the fields of one or more different tables.
To update the view the commands you can use CREATE and REPLACE.
11. What is Injection?
You can use this technique to access sensitive data where a malicious command is entered into an entry field in order to open a certain database to the attacker.
12. What is Subquery?
A query whose output serves as input for another query is called a subquery.
13. What is the difference between SQL, MySQL, and PL/SQL?
SQL is involved in the creation and accessing your databases, while MySQL is a Relational DBMS which uses SQL as the standard language. PL/SQL involves programming language concepts.
14. What is data integrity?
The authenticity and consistency of data in your database is called its integrity.
15. What is clustered and a non-clustered index?
They are performance tuning methods.
The clustered index offers easy and quick retrieval and it alters the way your data is stored in rows and columns, sorting it out. A non-clustered index is comparatively slower to use and it does not affect your data storage.
16. What are Denormalization and Normalization?
Denormalization is a technique you can use to better the performance through the introduction of redundancy into a table.
Normalization is data organization techniques that help avoid any duplication and redundancy.
17. What is ACID property?
It stands for Atomicity, Consistency, Isolation, and Durability.
It ensures the reliability of your data transactions.
18. What is Trigger?
It is a procedure that automatically executes in wake of data modifications.
19. What are the operators?
They are commands in the language. They are:
20. What is DROP, DELETE and TRUNCATE?
They are commands you can use to modify your data.
DROP irreversibly removes the entire table from your database.
DELETE removes a single row from your table.
TRUNCATE removes all rows from your table.
More Resource :