Dear User ,if you are preparing for interviews looking for most asked SQL interview question ,so you landed on right platform
here we will provide you top 50+ question which help you to crack any interviews easily.
1.what is SQL?
SQL stands for Structured Query language. It is a query language which is used for storing, manipulating and retrieving data in a relational database.
2.What is the difference between SQL and MySQL?
|1-SQL(Structured Query language) is Standard language.||1-It is Relational Database Management system.|
|2-It is used for accessing, retrieving and managing data in relational database.||2-It is used for managing relational databases.|
|3- It is a database language.||It is a Software like (SQL Server).|
3.What are Tables ?
Table is a group of data which are organised in form of columns and row.
4.What are Fields?
The column in a table is called fields .
5.what are Constraints in SQL?
Constraints in SQL are the rule which we define to restrict the data on table. It is used while creating or altering the table data.
there are multiple type of constraints:
6.What are the uses of SQL?
1- It is used for retrieve data, store data and manage data in a database.
2- It is used for create function, views and stored procedures.
7.What are the subsets of SQL?
There are various subsets of SQL:
1-DDL(Data Definition Language) – used to define the structure of data.
2-DML(Data Manipulation Language) – used to managing data in the database.
3-DCL(Data Control Language) – used to control data in the database.
4-TCL(Transaction Control Language) – used to manage transaction in the database. Example: ROLLBACK, COMMIT etc.
8.What is a Data Definition Language?
DDL include following operation:
9.What is a Data Manipulation Language?
DML include following operation:
10.What is Data Control Language?
DCL include following operation:
11.What is a primary key?
Primary key is a Constraint key, It is used for uniquely define each row in a table.
It doesn’t take NULL value. One table can have only one primary key.
12.What is a foreign key?
Foreign key is a key, It is used for link two tables.
A FOREIGN KEY is a column in one table that refers to the PRIMARY KEY in another table.
13.What is a unique key?
UNIQUE is same as PRIMARY Key, It is used for define each row uniquely.
It takes NULL value.
14.What is the difference between primary key and unique key?
|PRIMARY KEY||UNIQUE KEY|
|It is used for define each row uniquely.||It is also define each row uniquely.|
|It doesn’t take any NULL value.||It takes NULL value.|
|In a table, Only one primary key can be present.||In a table, more than one unique key can be present|
15.What is a Database?
A Database is a collection of data, It can be easily accessed, managed and updated.
16.Does SQL support programming language features ?
SQL is a Structured query language, It doesn’t support programming language.
It is a query language, It doesn’t have concept like for loop, if else etc.
17.What are the differences between SQL and PL/SQL?
|SQL is a Structured query language.||PL/SQL is a programming language.|
|It can perform single operation at a time.||It can perform multiple operation at a time.|
|SQL can be embedded in PL/SQL.||PL/SQL can’t be embedded in SQL.|
|It is declarative language.||It is a procedural language.|
18.What is RDBMS?
RDBMS stands for Relational Database Management System.
It stores data in table form.
19.What is Normalization in a Database?
Normalization is used for minimizing the redundancy from a relation.
It is also improving data integrity.
The database normalization is categorized into the following types-
1- First Normal Form (1NF)
2- Second Normal Form (2NF)
3- Third Normal Form (3NF)
4- Forth Normal Form (Boyce Codd Normal Form or 4NF)
5- Fifth Normal Form (5NF).
20.What is the difference between and IN operators in SQL?
BETWEEN operator selects values within a given range. IN operator allows you to specify multiple values in a WHERE clause.
21.Write an SQL query to find names of employee start with ‘A’?
SELECT * FROM Table_name WHERE EmployeeName like 'A%'
22.What is the difference between CHAR and VARCHAR2 datatype in SQL?
|CHAR values have a fixed size.||Varchar2 values have variable size.|
23.Name different types of case manipulation functions available in SQL
Case Manipulation functions are:
1: LOWER- It converts given string in lower case.
2: UPPER- It converts given string in UPPER case.
3: INITCAP- It converts every first letter in UPPER case and rest of them in LOWER case.
24.What is a view in SQL?
View is a virtual table. A view has rows and columns as they are in a real table. We can create a view by selecting fields from one or more tables present in the database.
25.What is a JOIN in SQL?
A JOIN clause is used to combine rows from two or more tables, based on a specified condition.
26.What is INNER Join?
The INNER join selects those records that have common values in both tables.
INNER JOIN tableB
ON tableA.Col_Name = tableB.Col_Name;
27.What is FULL Join?
FULL join returns all records where there is a matching row from left table or right table.
FULL JOIN tableB
ON tableA.Col_Name = tableB.Col_Name WHERE Condition;
28.What is LEFT Join?
LEFT join returns all the records from the left table and the matching records from the right table.
LEFT JOIN tableB
ON tableA.Col_Name = tableB.Col_Name;
29.What is RIGHT Join?
RIGHT join returns all the records from the right table and the matching records from the left table.
RIGHT JOIN tableB
ON tableA.Col_Name = tableB.Col_Name;
30.What is self Join?
When the table is joined with itself, called SELF join.
FROM tableA t1, tableA t2 WHERE condition;
31.What is an index?
Index is used to retrieve data from the database more quickly.
32.What is Database?
A database is a collection of information that is organized. So that it can easily be accessed, managed, and updated.
33.What is trigger?
A Trigger is a code that is associated with insert, update or delete operations.It is a stored procedure in a database which automatically invokes whenever a specific event occurs.
34.What is Stored Procedure?
A stored procedure is like a function that contains a set of operations compiled together. so that it can be reused again and again.
35.Explain the concept of ACID property in DBMS?
Atomicity: This is based on the concept of “either all or nothing” It means that either all the transactions should be execute or none of them.
Consistency: This property ensures that all the transactions should be consistent before and after the transactions.
Isolation: This property ensure that many transactions can occur in the concurrent manner without leading to inconsistency in the database.
Durability: This property states that the data should always be in a durable state i.e. any data which is in the committed state should be available in the same state even if any failure or restart occurs in the system.
36.What are the type of index?
There are 3 types of index:-
(1)Clustered Index: A type of index where the table records are physically re-orderd to match the index. A table can contain only on clustered index.
(2)Non Clustered Index: A special type of index in which logical orders does not match with physical stored order of the rows on disk. A table can contain many non clustered index.
(3)Unique Index: Which defines a rows of table uniquely.
37.what is 1NF?
1NF stands for first Normal Form.
If a relation contains singled value attribute called 1NF.
38. What is 2NF?
2NF stands for second Normal Form.
1) Firstly, It should be in 1NF.
2) It should not contain Partial dependency.
If a subset of the candidate key determines a non-prime attribute then it is called Partial dependency.
39.What is 3NF?
3NF stands for third Normal Form.
1) Firstly, It should be in 2 NF.
2) There is no transitive dependency for non-prime attributes.
Transitive dependency :- If A->B and B->C then A->C is called tranisitive dependency.
40.What is BCNF?
BCNF stands for Boyce-Codd Normal Form.
A table is in Boyce-Codd normal form (BCNF) if and only if it is in 3NF and every determinant is a candidate key.
41.What is Dbms?
DBMS stands for Database Management System. It is a collection of programs that enables user to create and maintain a database.
42.What are the advantages of dbms?
1) Redundancy is controlled.
2) Providing multiple user interfaces.
3) Providing backup and recovery
4) Unauthorized access is restricted.