SQL Interview Questions

SQL Interview Questions

Last Updated by Monika Dadool

0 12122

SQL is probably used for database interaction and management. Nowadays, SQL skills are essential for getting jobs, especially in the web development field.

In this blog, I am going to introduce a set of SQL interview questions to cope up with the growing competition in IT markets.

Let's Continue !!

1) What is DBMS?

DBMS is known as the file manager program that is designed for data management in the database which includes creating, implementing, and maintaining data.

It provides a systematic method to perform modification, administration, and retrieval. Data present in the DBMS's applications are stored as a file.

2) What is RDBMS?

A relational database management system (RDBMS) is a software program store information in the form of tables. Moreover, it offers the relational operators for performing data manipulations across the tables.

3) What do you mean by SQL?

SQL (Structured Query Language) is known as the standard language to interact with the database. It is designed to accomplish database tasks like retrieval and insertion.

4) What do you mean by "Table" in a Database?

A table is known as a database object that can be used for storing the record in terms of rows and columns.

5) What is "Record" in a Database?

A record is known as the row of the table that contains arranged sets of interrelated data. It has the capability to hold multiple values. Moreover, It is known as a data structure to hold different kinds of data items.


<402 yuvi 405>

6) What do you mean by the "database" in DBMS?

The database comprises of logically related records or data.

7) List some major objectives of DBS?

  • Data availability
  • Data integrity
  • Data independence

8) List some applications of the DBS system?

  • Reservations systems
  • Telecommunications
  • Banking
  • Sales
  • Scientific applications

9) What are the keys that are present in DBMS?

There are mainly six key founds in DBMS to manage the table. They are:
  • Candidate key
  • Foreign key
  • Primary key
  • Secondary key / Alternate key
  • Composite key
  • Super key

10) How can you maintain and identify relations between two or more than two tables in DBMS?

Keys are used in maintaining the relationship between tables.

11) Discuss the role of keys in DBMS?

  • Impose Integrity
  • Uniquely identify the records within the table
  • Identify and maintain relations between tables
  • To fetch the records from a database

12) What is the need of the "keys" in an organization?

Keys are referred to as the set of one or more attributes that are used for unique identification. They are used to provide the record's uniqueness.


For instance, suppose you want to store the huge amount of unformatted data of an organization. Keys are implemented along with conditions to fetch any specific record from that organization.

Thus keys in the database are used to avoid duplicities and to streamline record's identification.

13) What is the role of "Database Testing" in SQL?

Database testing is one of the most considerable testing techniques. This scheme needs a tester with an expert to investigate tables, procedures, and written queries. Through the back-end data, the integrity of front-end data is verified.

Although, it validates the database tables, triggers, junk records, and performs record modification. Database testing can be used in the applications of Oracle or SQL.

Application of Database Testing:

  • Banking project
  • Finance
  • All health insurance-related projects in which extensive database testing is required.

14) What is the difference between DELETE and TRUNCATE command?

Delete Command is used to delete a row in a table whereas the truncate command is used to delete entire rows. Delete command is slower as compared to truncate statement.

You cannot rollback data after applying the truncate command.

15) "If anyone wants to calculate values from multiple columns in a table" which type of functions can be used in SQL?

We can use "Aggregate functions" to calculate the values of multiple columns in a table.

16) What do you mean by "Aggregate functions" in SQL?

Aggregate functions are used to perform calculations on multiple columns and rows in a table. As a result, they return a single value. Also, these Aggregate functions allow you to produce the report of summarized data effortlessly.

17) Name the Aggregate functions that are found in SQL?

There are seven Aggregate functions used in SQL i.e.
  • MAX
  • MIN
  • LAST
  • SUM
  • AVG

MIN(): To returns the smallest value among records

MAX(): To returns the largest value from specified columns

SUM(): To returns the sum of the numeric values of specified

AVG(): To returns the average value of a particular column

COUNT(): To returns the entire number of values in a given column

FIRST(): To Returns the initial value of the record

LAST(): To Returns the finishing value of the given records

18) Name some leading Database management systems used in MNC?

  • MySQL
  • PostgreSQL
  • MongoDB
  • Microsoft Access
  • Microsoft SQL Server
  • Oracle
  • DB2
  • Sybase

19) What is the different type of statement in SQL?

SQL Statements can be separated into the following types:
  • DDL - Data Definition Language
  • DQL - Data Query Language
  • TCL - Transaction Control Language
  • DML - Data Manipulation Language
  • DCL - Data Control Language

20) Triggers in SQL

Triggers are identical to the procedures that are stored to bring a response of a specific action applied on a table. A specific action may be an insertion, deletion, or update. Triggers can also be invoked explicitly. The main components of SQL triggers are action and event.


ON table_name [FOR [EACH] {ROW|STATEMENT}]
EXECUTE PROCEDURE function name {arguments}

21) List some operations of Data Manipulation Language?

  • Insertion of data into the database
  • Retrieval of data from the database
  • Updation and deletion of data in the database

22) Name the commands of the Data control language?

We can control the access of the database with the use of the commands i.e. GRANT, DENY and REVOKE.

  • GRANT is used to grant specific task to a user
  • REVOKE is used to repeal or cancel user access
  • DENY is used to deny the permission

23) Can we Rollback data in a database, which has been committed with a commit keyword?


24) What is the different type of TCL commands used in SQL?

The modifications done by DML statements can be managed through the TCL commands i.e. COMMIT, SAVEPOINT, and ROLLBACK. These commands are used in transaction management

Commit: Commit is used to save changes permanently.
Syntax: COMMIT;

Rollback: Rollback command is used to restore or undo the work done in the current transaction.
Syntax: ROLLBACK TO savepoint-name;

Savepoint: This transaction command is used to save a transaction temporarily for further rollback requirements.
Syntax: SAVEPOINT savepoint_name;

25) What is the role of SQL Alias?

Alias is the process of giving a temporary name to a table or column. Moreover, it is applicable in the case of large or complex queries.

Following is the syntax for SQL Alias for tables name:

SELECT column-name FROM table-name AS alias-name

26) What do you mean by the DISTINCT Keyword in SQL?

The Distinct keyword is used along with SELECT Statement to eliminate the duplication at the time of retrieving particular records from the table.


SELECT DISTINCT column-name FROM table-name;

27) What do you mean by Order by clause?

Order by clause is used with a select statement for organizing retrieved data in sorted order i.e. ascending or descending order.


SELECT column-list|* FROM table-name ORDER BY DESC | ASC

28) What is the minimum condition required for joining the table in SQL?

(n-1) where n, is a number of tables.

29) What is the main difference between Alias and Rename?

Alias is the temporary name given to any table whereas 'Rename' is the permanently given name to any column or table.

30) What do you mean by JOIN?

Joins are used for combining rows from two or more than two tables. There are four types of joins that are available in SQL. They are INNER JOIN, RIGHT JOIN, LEFT JOIN, and OUTER JOIN.

Best WordPress Hosting


SSL for business, from $12.88

Discount Coupons

Get a .COM for just $6.98

Secure Domain for a Mini Price

Leave a Reply

    Waiting for your comments