Most Commonly asked Structural Query Language(SQL) and Database Interview Questions are explain in a simple and details explanation. SQL and Database Interview Questions and Answers are useful when you attend Job Interview related to Database. Hope, this Basic SQL interview questions will be useful.
1.What is SQL?
SQL stands for Structural Query Language and SQL was developed during 1970’s at IBM. SQL is standard database language for Relational Database Management System(RDBMS). SQL language is used to perform database operations like insert, delete, update and modify database.
2. What is Database?
Database is a collection of data and information. Database are used for quick information reference. It is used for easily managing, accessing and updating data by using Structural Query Language(SQL).
3. What is DBMS?
DBMS stands for Database Management System(DBMS). DBMS is program used to stored, modify and access database.
4. What is Trigger?
When database are inserted, deleted or updated, a procedure is executed in response to that action. Such SQL procedure are called as trigger.
5. Define index? Types of index?
Index is used for faster retrieval of information store and speedup query performance. There are two types of index, clustered index and non-clustered index.
6. Define sub query?
Sub-Query is also called as Nested Query. Sub-Query is a query within another query. Sub-Query can be used with SELECT, INSERT, UPDATE and DELETE Statement.
7. Difference between delete and truncate?
- Delete statement is used to delete selected rows from database tables whereas truncate statement deletes all rows from table.
- Delete statement is slower than truncate statement.
- Truncate is DML(Data Manipulation Language) command and Delete is DDL(Data Definition Language) command.
8. Define constraint?
Constraint in database set certain rules or property in a table. Suppose if a row has NOT NULL constraint, then it cannot have any null values.
9. What are the types of constraint?
NOT NULL, UNIQUE, PRIMARY KEY, FOREIGN KEY, CHECK and DEFAULT are some of constraints.
10. What is Normalization?
Normalization is process of organizing database. Normalization process usually involves removing or eliminating redundancy data from fields and tables of relational database.
11. What are different types of Normalization?
There are different types of Normalization. They are: First Normal Form(1NF), Second Normal Form(2NF), Third Normal Form(3NF), Fourth Normal Form(4NF) and Boyce-Codd Normal Form (BCNF)
12. What is SQL Join?
SQL join are used for retrieving information and data from two or more tables. SQL Join combine two or more table(or row).
13. What are the types of Joins in SQL?
The different types of joins in SQL are: INNER JOIN, OUTER JOIN, LEFT JOIN, RIGHT JOIN, FULL JOIN, OUTER JOINS and SELF JOINS
14. What is SQL Injection?
SQL Injection is a technique in which malicious users(Hackers or Attacker) inserts SQL command(malicious or unwanted SQL commands).
15. What is collation?
Collation in SQL is set of rules to determined data sorted and compared. They are different types if collation like Case Sensitivity, Accent Sensitivity and Kana Sensitivity.
16. What are the types of cursors?
The different types of cursors are: Static Cursor, Dynamic cursor, Forward Only cursor and Keyset driven cursor.
17. How to create database?
Database can be created by ‘CREATE DATABASE’ Statements. For Example: CREATE DATABASE dbname;
18. How to create Table?
For creating a Table in database, we have to use ‘CREATE TABLE’ Statement.
CREATE TABLE “SomeName”
19. What is self-join?
Self join joins tables to itself by using SQL statement JOIN. Self Join is also called has Uninary Relationship.
What are the types of relationship and it types?
In DBMS, there are mainly four types of relationship. They are: One-to-One, One-to-Many, Many-to-Many and Many-to-One.
20. What is denormalization?
Denormalization is used to improve database performance. Denormalization is achieved by adding redundant data.