More than 3000 questions in repository. There are more than 900 unanswered questions. Click here and help us by providing the answer. Have a video suggestion. Click Correct / Improve and please let us know.
Ans. Inner join is the intersection of two tables on the condition defined by the where clause i.e will get records from both tables matched by a column.
Outer join is the union of two tables i.e will get all records from both tables and will put null in the columns where related records are not present.
Left Outer join is the left union of two tables i.e all records from the table on the left and values from the right table for related records else null for the columns from right table.
Right Outer join is the right union of two tables i.e all records from the table on the right and values from the left table for related records else null for the columns from left table.
Help us improve. Please let us know the company, where you were asked this question :
Ans. ACID stands for Atomicity, Consistency, Isolation, Durability is a set of properties of database transactions.
Atomicity means all or nothing. i.e parts of a transaction shouldn't commit if any one of them fails. Either the whole transaction should succeed or it should be complete rollback.
Consistency means that any transaction should lead database from one stabe state to another.
Isolation means that the execution of transaction results in a system state that would be obtained if transactions were executed serially.
Durability means that when a transaction is committed it forms the permanent state of database.
Help us improve. Please let us know the company, where you were asked this question :
Ans. The JDBC is a pure Java API used to execute SQL statements. It provides a set of classes and interfaces that can be used by developers to write database applications.
The steps needed to execute a SQL query using JDBC:
1. Open a connection to the database.
2. Execute a SQL statement.
3. Process th results.
4. Close the connection to the database.
Help us improve. Please let us know the company, where you were asked this question :
Q6. If you are given a choice to implement the code to either Insert a Record or Update if already exist, Which approach will you follow ?
1. Insert into the DB Table. If exception occurs, update the existing record. 2. Check if the record exists and update it if it exists, If not insert a new record.
Ans. In first case, there would be 2 DB calls in worst case and 1 in best case. In 2nd approach there will be always 2 DB calls.
Decision on the approach should depend on the following considerations -
1. How costly is the call to DB ? Are we using indices , hibernate etc
If calls to DB are costly , 1st approach should be the choice.
2. Exception Book keeping load upon exception.
The benefit of saving 1st call in approach 1 should be bigger than the Book keeping for the exception.
3. Probability of the exception in first apparoach.
If the DB Table is almost empty, it makes sense to follow Approach 1 as majority of the 1st calls will pass through without exception.
Help us improve. Please let us know the company, where you were asked this question :
LikeDiscussCorrect / Improve  database   insert-update   db exceution plan   db strategy   design   architecture   technical lead
Q7. What is the use of @GeneratedValue annotation in Hibernate?
Ans. This annotation is added to the auto increment column with the strategy to increment the column value. Usually this is added to the surrogate primary key column and specified with the Database Sequence.
Help us improve. Please let us know the company, where you were asked this question :
Ans. These are the tables that are created temporarily and are deleted once the Stored Procedure is complete.
For example - we may like to pull some info from a table and then do some operations on that data and then store the output in final output table. We can store the intermediary values in a temp table and once we have final output with us, we can just delete it.
Help us improve. Please let us know the company, where you were asked this question :
Ans. The external tables feature is a complement to existing SQL Loader functionality. It enables to access data in external sources as if it were in a table in the database. We have used it few times for replicating tables across different database systems.
Help us improve. Please let us know the company, where you were asked this question :
Ans. When a Table Join itself , it's a Self Join. For example - we like to know the pair of department names where first dept has lesser employees than the later.
Select D1.name , D2.name from Dept D1, Dept D2 where D1.employee_count < D2.employee_count
Help us improve. Please let us know the company, where you were asked this question :
LikeDiscussCorrect / Improve  sql  joins  self join  self-join  Pair of employee names with first having lesser salary than later  Pair of department names where first dept has lesser employees than the later Asked in 26 Companiesbasic  frequent
Ans. Automated Backups are deleted automatically whereas Snapshots are preserved. Upon terminating RDS instance , AWS gives a warning about that and requests to create a final snapshot before terminating the instance.
Help us improve. Please let us know the company, where you were asked this question :
Ans. It's a technique to allow multiple clients to make use of a cached set of shared and reusable connection objects providing access to a database or other resource.
Help us improve. Please let us know the company, where you were asked this question :
Q17. Does SQL allow null values ? Can we use it within Where clause ?
Ans. Yes , we can have null values for columns in SQL. Null value represent that the columns value is unknown or haven't been filled. Yes, We can use it within where clause to get the rows with null values.
Help us improve. Please let us know the company, where you were asked this question :
Ans. Its a specification that guides the implementation of ORM frameworks. Implementations abiding by the specification would mean that one can be replaced with other in an application without much hassle. Only the Features that are added over the specification needs to be taken care of if any such change is made.
Help us improve. Please let us know the company, where you were asked this question :
Ans. In case we specify them explicitly we can have control over constraint name as otherwise they will be system generated. It provides an ease in case we plan to drop the constraint in future.
Help us improve. Please let us know the company, where you were asked this question :