Top 30+ sql Interview Questions and Answers PDF (2024 Update)

sql interview questions : Hello friends, through today’s article, we will know about SQL Interview Questions. The full name of SQL is Structured Query Language, it is a Domain Specific Programming Language which is used to manage data in database management system.

sql interview questions and Answers


Question 1 : What is SQL?

The full name of SQL is Structural Query Language which is used to communicate with the database. It is a standard programming language used for retrieval, updation, insertion and deletion of data in the database.

Question 2 : What is the full form of SQL?

The full name of SQL is Standard Query Language.

Question 3 : What is DBMS?

The full name of DBMS is Database Management System, it is used for the creation and management of database. read more

Question 4 : What is RDBMS?

The full name of RDBMS is Relational Database Management System, it stores data in the form of a collection of tables. It allows relational operators to manipulate the data stored in tables.

Question 5 : What is Database?

It is an organized way of data with the help of which data can be easily accessed, retrieved, stored and managed. We also know this as a structured form of data which can be accessed in many ways.

Question 6 : What do you understand by Tables and Fields?

The data in a table is stored as an organized model of columns and rows, in which the columns are vertically and the tables are horizontal. The number of columns in the table is fixed while the number of rows can be any which we call record.

Question 7 : What is the difference between SQL and MySQL Is it wet?

SQL is a standard language used to manipulate and retrieve structured databases. And talking about MySQL, it is like Relational Management Database System like SQL Server, Oracle which is used to manage SQL database.

Question 8 : What are the constrains in SQL?

Constraints are used to specify the rules related to data in the table. It is applied in SQL table for single or multiple fields by using ALTER TABLE command during creation of table or after creation. Following are the Constraints:-

  • NOT NULL:- It restricts the insertion of NULL value in the column.
  • CHECK:- It verifies all the values to satisfy the condition.
  • DEFAULT:- When no value is given for any field then it automatically sets the default value for that field.
  • UNIQUE:- It determines that assigns a unique value to each field.
  • INDEX:- It indexes a field which provides us with fast records.
  • PRIMARY KEY:- It identifies each record in the table.
  • FOREIGN KEY:- It also ensures Referential Integrity (referential integrity) in the table.

don’t miss : Top 10 Advanced MySQL Interview Questions Answers

Question 9 : What are the uses of SQL?

  1. Executing a query against the database
  2. To retrieve data from database
  3. It maintains the data structure and relational data present in the database.
  4. It inserts the records in the database.
  5. It updates the records in the database.
  6. It deletes the records in the database.
  7. It creates the database.
  8. It creates new tables in the database.
  9. It performs complex operations in the database.

Question 10 : Does SQL support programming?

It is standard query language which is not a programming language. SQL does not have loops, conditional statements, logical operations, it cannot be used for anything other than data manipulation. It is used as a commanding language to access the database.

Question 11 : What is Join?

This is a keyword used to query data from multiple tables based on the relationship between the fields of the tables. When JOINs are used, keys have an important place.

What are the Types of JOIN?

  1. Inner Join
  2. Left Join
  3. Right Join
  4. Full Join

Question 12 : What do you understand by Normalization?

When a Relation Schema is analyzed on the basis of its Functional Dependencies, then this process is called Normalization. It is used during Redundancy, Insertion, and Deletion tax.

Normalization is a very main process which is used for data redundancy, insertion anomaly, updation anomaly, deletion anomaly.

Its most used forms:-

  1. First Normal Form(1NF)
  2. Second Normal Form(2NF)
  3. Third Normal Form(3NF)
  4. Boyce & Codd Normal Form(BCNF)

Question 13 : What do you understand by denormalization?

Through this process, by adding redundant data to the database, complex data is got rid of, with the help of which the database is boosted. Denormalization is a part of Data Optimization Technique.

Question 14 : What do you understand by Index in Database?

The index in a database is the data structure that provides instant data in the columns of tables. This index increases the speed of operations accessing data from a database table at the cost of additional writes and memory to maintain the data structure.

Question 15 : What do you understand by unique and non-unique index?

Unique indexes are indexes that help maintain data integrity by ensuring that no two rows of data in a table are identical. Once a unique index is defined for a table, uniqueness is now enforced whenever keys are added or changed to the index.

Question 16 : What are the different types of indexes in SQL?

  1. Unique Index
  2. Clustered Index
  3. Non-Clustered Index
  4. Bit-Map index
  5. Normal index
  6. Composite index
  7. B-tree index
  8. function based index

Alos Read call to undefined function sqlsrv_connect()

Question 17 : What do you understand by Clustered and Non-clustered Index?

Clustered Index:- Clustered index is used to rearrange the physical order of the table and search on the basis of key values. Each table can have only one clustered index.

A clustered index is the only index that is created automatically when a primary key is generated. Clustered indexes are preferred if moderate data modifications are required to be done to the table.

Non-clustered Index:- Non-clustered Index is created to search the data. We are well aware that clustered indexes are created automatically when the primary key is generated, but non-clustered indexes are created when multiple join conditions and different filters are used in the query.

The non-cluster index does not change the physical order of the table and maintains the logical order of the data. Each table can contain up to 999 non-clustered indexes.

Question 18 : What is SELECT Statement in SQL?

In SQL, SELECT statement is used to select data from the database. Later this data is returned to the database as a result table, which is called result set.

Don’t Miss : mysql select first row

Question 19 : Different types of SQL Commands?

  • DDL (Data Definition Language): – This type of language contains the commands that are used to define the database.
  • DML (Data Manipulation Language):- It is used for commands that manipulate the data in the database.
  • DCL (Data Control Language):- It is used for commands related to user permission and control of database system.
  • TCL (Transaction Control Language):- It is used for commands related to transaction of database.

Question 20 : What do you understand by DELETE and TRUENET commands?

  • DELETE:- This command is used to remove one or more tables.
  • TRUENET: – With the help of this command, all the data inside the table can be removed.

Question 21 : What do you understand by Stored Procedure in SQL?

Stored Procedure is a prepared SQL code that can be reused and saved at any time. In other words, Stored Procedure is a function which consist of many SQL statements to access the database system, we can consolidate many SQL statements into Stored Procedure and use them whenever they are needed. can do.

Question 22 : What do you understand by View in SQL?

View is a virtual table that contains a subset of the data present in a table. The view is virtually non-existent, and requires less space to store it. The view can contain data from one or more tables, and it depends on the relationships.

don’t miss : Top 10 Advanced MySQL Interview Questions Answers

Question 23 : What is a Relationship in SQL?

Database Relationship Establishes the connection between tables in the database. It is of the following types:-

What are the different types of relationships in SQL?

  • One-to-One:- It can be defined as the relation between two tables where each record in one table is associated with maximum one record in the other table.
  • One-to-Many:- This is the most commonly used relation where one record in one table is associated with many records in another table.
  • Many-to-Many:- It is used in cases when multiple instances are required on both the sides to define a relation.

Self Referencing Relationships:- It is used when a table needs to define a relationship with itself.

Question 24 : What is a Trigger?

Trigger is a stored program which is executed automatically when there is an event like statement like DELETE, INSERT. Triggers can also be fired in response to data definition statements (DDL) and database operations.

Question 25 : What do you understand by ACID Properties?

The full name of ACID Properties is Atomicity, Consistency, Isolation, Durability.

  • Atomicity:- Atomicity is also known as All or Nothing Rule, which means that all are considered as one unit, and they are either executed at once to complete or it is not executed at all. .
  • Consistency:- This property is related to the uniformity of the data. Consistency in this means that the database remains in consistency after each transaction.
  • Isolation:- According to this property, transactions can be executed without generating any inconsistency in the case of database.
  • Durability: – This property ensures that when any transaction is done, it is stored in non-volatile memory and it does not have any effect even in the event of a crash in the system.

Question 26 : What is SAVEPOINT in Transaction Control?

SAVEPOINT is a point in a transaction when you can roll back a transaction to a certain point without rolling back the entire transaction.

Question 27 : What are Scalar function in SQL? With examples

Scalar functions are used to return single values based on the input values. The scalar functions are as follows:-

1:- UCASE():- It converts the specified field to upper case.

2:- LCASE():- It converts the specified field to lower case.

Question 28 : What is a Cursor?

A cursor is a database object that is used to transverse data by traversing row by row in the result set. A cursor is used when you need to retrieve data, one row at a time from the result set and when you need to update records one row at a time.

Question 29 : What is T-SQL?

It is an extension of SQL (Structured Query Language) which was developed by Sybase and is used by Microsoft.

Question 30 : What is Schema?

Schema is a collection of database objects (Tables, views) in any database for a user.

Question 31 : What is Composite Key?

When more than one column is used to define the primary key, it is called Composite Key.

Question 32 : What is Shared Lock?

When two transactions are allowed to read access to the same data, they are given a shared lock. This enables the same data to be read, and the data is not updated until the Shared Lock is released.

Question 33 : What is SQL Injection?

SQL injection is a code injection technique used to hack data driven applications.

Read: sql date greater than

Question 34 : What is SQL Views?

SQL Views are virtual tables created from one or more tables. Views are a subset of the data; Therefore, it can limit the degree of display of data from tables.

Question 35 : What is Online Transaction Processing (OLTP)?

Online Transaction Processing (OLTP) manages transaction based applications, which can be used for data entry, data retrieval and data processing.

Conclusion – sql interview questions

So friends, through today’s article, you have learned about SQL Interview Questions, hope you have liked this article, if you want to ask any question related to it, then you can ask through comment.

I hope you get an idea about sql interview questions.
I would like to have feedback on my blog.
Your valuable feedback, question, or comments about this article are always welcome.
If you enjoyed and liked this post, don’t forget to share.

Leave a Comment