Find Interview Questions for Top Companies
Ques:- What is SQL Insert Statement?
Right Answer:
The SQL Insert Statement is used to add new rows of data to a table in a database. The basic syntax is:

```sql
INSERT INTO table_name (column1, column2, column3, ...)
VALUES (value1, value2, value3, ...);
```
Ques:- Describe a primary key in Database?
Asked In :- invenco group limited,
Right Answer:
A primary key is a unique identifier for each record in a database table, ensuring that no two records can have the same value in that key column. It cannot contain null values and is used to establish relationships between tables.
Ques:- What are the type of Database locks?
Asked In :- Data Patterns, it glue,
Right Answer:
The types of database locks are:

1. **Shared Lock (S Lock)** - Allows multiple transactions to read a resource but not modify it.
2. **Exclusive Lock (X Lock)** - Allows a transaction to both read and modify a resource, preventing other transactions from accessing it.
3. **Update Lock (U Lock)** - Used to prevent deadlocks when a transaction intends to update a resource; it allows reading but not modifying until the lock is upgraded to an exclusive lock.
4. **Intent Lock** - Indicates that a transaction intends to acquire a more restrictive lock on a resource, used in hierarchical locking.
5. **Schema Lock** - Prevents changes to the database schema while a transaction is in progress.
Ques:- Define Join and explain different type of joins?
Right Answer:
A join is a SQL operation that combines rows from two or more tables based on a related column between them. The different types of joins are:

1. **INNER JOIN**: Returns only the rows that have matching values in both tables.
2. **LEFT JOIN (or LEFT OUTER JOIN)**: Returns all rows from the left table and the matched rows from the right table; if there is no match, NULLs are returned for columns from the right table.
3. **RIGHT JOIN (or RIGHT OUTER JOIN)**: Returns all rows from the right table and the matched rows from the left table; if there is no match, NULLs are returned for columns from the left table.
4. **FULL JOIN (or FULL OUTER JOIN)**: Returns all rows when there is a match in either left or right table; unmatched rows will have NULLs in the columns of the table that does not have a match.
5. **CROSS JOIN**: Returns the Cartesian product of
Ques:- Explain a database transaction?
Right Answer:
A database transaction is a sequence of one or more operations performed as a single logical unit of work. It must satisfy four properties, known as ACID: Atomicity (all operations succeed or none), Consistency (the database remains in a valid state), Isolation (transactions do not interfere with each other), and Durability (once a transaction is committed, it remains so even in case of a failure).
Ques:- What do you mean by a Table in a database ?
Asked In :- Digital OnUs,
Right Answer:
A table in a database is a structured collection of data organized in rows and columns, where each row represents a record and each column represents a field or attribute of that record.
Ques:- What are the different type of normalization?
Asked In :- smsc, smollan,
Right Answer:
The different types of normalization are:

1. First Normal Form (1NF)
2. Second Normal Form (2NF)
3. Third Normal Form (3NF)
4. Boyce-Codd Normal Form (BCNF)
5. Fourth Normal Form (4NF)
6. Fifth Normal Form (5NF)
7. Domain-Key Normal Form (DKNF)
Ques:- What are the advantages and disadvantages of views in a database?
Asked In :- Sycamore Software,
Right Answer:
**Advantages of Views:**
1. Simplify complex queries by encapsulating them.
2. Enhance security by restricting access to specific data.
3. Provide a consistent interface to data, even if the underlying tables change.
4. Allow for data abstraction and hiding of complexity.

**Disadvantages of Views:**
1. Can introduce performance overhead, especially with complex views.
2. May not be updatable, limiting data manipulation.
3. Dependency on underlying tables can lead to issues if those tables change.
4. Can complicate debugging and understanding of queries.
Ques:- Tell the difference between Cluster and Non cluster Index?
Right Answer:
A clustered index determines the physical order of data in a table and can only be one per table, while a non-clustered index is a separate structure that points to the data and can be multiple per table.
Ques:- What do you mean by a materialized view?
Asked In :-
Right Answer:
A materialized view is a database object that contains the results of a query and stores them physically on disk, allowing for faster access and retrieval of data compared to a regular view, which is computed on-the-fly.
Ques:- Tell the advantages of a stored procedure?
Right Answer:
1. **Performance**: Stored procedures are precompiled, which can lead to faster execution.
2. **Reusability**: They can be reused across multiple applications, reducing code duplication.
3. **Security**: They provide a layer of security by restricting direct access to the underlying tables.
4. **Maintainability**: Changes can be made in one place without affecting the application code.
5. **Reduced Network Traffic**: They can execute multiple SQL statements in a single call, minimizing data transfer.
6. **Transaction Control**: They allow for better management of transactions and error handling.
Ques:- What do you mean by a trigger?
Right Answer:
A trigger is a special type of stored procedure in a database that automatically executes or fires in response to certain events on a particular table or view, such as insertions, updates, or deletions.
Ques:- What do you mean by Self-Join?
Right Answer:
A self-join is a type of join in SQL where a table is joined with itself to compare rows within the same table. It is typically used to retrieve related data from the same table, often using an alias to differentiate the instances of the table.


AmbitionBox Logo

What makes Takluu valuable for interview preparation?

1 Lakh+
Companies
6 Lakh+
Interview Questions
50K+
Job Profiles
20K+
Users