Interview Questions and Answers for 'Database' | Search Interview Question - javasearch.buggybread.com
Javasearch.buggybread.com

Search Interview Questions


 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.
Label / Company      Label / Company / Text

   



Interview Questions and Answers - Order By Newest

next 30
  Q11. What is a self Join and give an example of a self Join ?

or

What is self Join and What is it's purpose ?
Database
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 :   

   Like         Discuss         Correct / 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 Companies      basic        frequent


  Q12. What is database Normalization ?Database
Ans. https://en.wikipedia.org/wiki/Database_normalization

 Help us improve. Please let us know the company, where you were asked this question :   

   Like         Discuss         Correct / Improve     normalization  database     Asked in 35 Companies      intermediate        frequent


 Q13. What happens to backups if we delete the RDS instance ?Amazon Web Services (AWS)
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 :   

   Like         Discuss         Correct / Improve     aws rds  aws database  amazon cloud database


 Q14. What is connection pooling?Database
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 :   

   Like         Discuss         Correct / Improve     java   jdbc   db connectivity   connection pooling   architecture     Asked in 3 Companies      basic        frequent


 Q15. Difference between Inner and Outer Join ?Database
Ans. Inner join is the intersection of two tables on a particular columns whereas Outer Join is the Union of two tables.

 Help us improve. Please let us know the company, where you were asked this question :   

   Like         Discuss         Correct / Improve     sql   joins   inner join   outer join     Asked in 4 Companies      basic        frequent


 Q16. What is a Cursor ?Database
Ans. It's a facility that allows traversal over the records pulled from a table or combination of tables. Its like iterator in Java.

 Help us improve. Please let us know the company, where you were asked this question :   

   Like         Discuss         Correct / Improve     databases   sql   cursors   packages     Asked in 5 Companies      basic        frequent


 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 :   

   Like         Discuss         Correct / Improve     sql   sql null values   sql where clause   databases


 Q18. Write an SQL to find all records having all upper case alphanumeric characters in a field ?
Ans. Select * from Table where field = upper(field)

 Help us improve. Please let us know the company, where you were asked this question :   

   Like         Discuss         Correct / Improve     sql   database


 Q19. Write an SQL to find all records having all numeric characters in a field ?
Ans. Select * from Table where isnumeric(field) = 1;

 Help us improve. Please let us know the company, where you were asked this question :   

   Like         Discuss         Correct / Improve     sql   database


 Q20. Do you know of any DB statement that can be used if we would like to insert multiple rows into a table ? Database
Ans. We can use INSERT ALL.

 Help us improve. Please let us know the company, where you were asked this question :   

   Like         Discuss         Correct / Improve     database   insert   dml statement   sql


 Q21. What is the advantage of JPA ?Database
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 :   

   Like         Discuss         Correct / Improve     jpa   hibernate   orm   technologies


 Q22. What things you will look for if you get following exception while making DB call ?

table or view does not exist
Database
Ans. First will check if the table or view actually exist in the DB

If it does , Will make sure to see that the application has rights on the schema that holds the respective Table.

Will then make sure that we have prefixed the schema with the table name while accessing it.

Will then make sure that its not DB Cache that's causing it as the table DDL might have been created recently.

 Help us improve. Please let us know the company, where you were asked this question :   

   Like         Discuss         Correct / Improve     sql   database   oracle   technical lead


 Q23. What's the benefit for specifying constraints like Not Null , Primary Key explicitly instead of specifying it against the column ?Database
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 :   

   Like         Discuss         Correct / Improve     sql   database   oracle


 Q24. How can we disable a constraint ?Database
Ans. alter table
table_name
DISABLE constraint
constraint_name;

 Help us improve. Please let us know the company, where you were asked this question :   

   Like         Discuss         Correct / Improve     sql   database   oracle


 Q25. Can we have foreign key reference to a non primary key column ?Database
Ans. Yes, but the respective key in the foreign table should be declared Unique.

 Help us improve. Please let us know the company, where you were asked this question :   

   Like         Discuss         Correct / Improve     sql   database   oracle     Asked in 2 Companies


 Q26. What should be done for auto generating primary key id in a table ?Database
Ans. We need to create a sequence.

 Help us improve. Please let us know the company, where you were asked this question :   

   Like         Discuss         Correct / Improve     sql   database   oracle


 Q27. Which constraint cannot be specified as an explicit constraint and should be specified with the column only ?Database
Ans. NOT NULL

 Help us improve. Please let us know the company, where you were asked this question :   

   Like         Discuss         Correct / Improve     sql   oracle   database   ddl   constraint   table creation


 Q28. How to know the structure of a Table in Oracle ?Database
Ans. DESC

 Help us improve. Please let us know the company, where you were asked this question :   

   Like         Discuss         Correct / Improve     sql   database   oracle


 Q29. How to know the constraints on a Table in Oracle ?Database
Ans. SELECT *
FROM user_constraints
WHERE table_name = ''

 Help us improve. Please let us know the company, where you were asked this question :   

   Like         Discuss         Correct / Improve     sql   database   oracle


 Q30. How to know the default column value of a Table in Oracle ?Database
Ans. Select DATA_DEFAULT
from DBA_TAB_COLUMNS
where TABLE_NAME = '' and COLUMN_NAME='';

 Help us improve. Please let us know the company, where you were asked this question :   

   Like         Discuss         Correct / Improve     sql   database   oracle


 Q31. What are the advantages of using distributed database management system ?Database
Ans. Reliability and Continuity if some of the sites goes down.Easy Scaling up and Down as sites can be added or removed without impacting business continuity.

 Help us improve. Please let us know the company, where you were asked this question :   

   Like         Discuss         Correct / Improve     dbms  database management system  distributed database management system     Asked in 1 Companies


 Q32. When do we generally get this database error - integrity constraint violated - parent key not found ?
Ans. This error most likely will be thrown during an insert statement, while inserting a value within a foreign key column which doesnt exist within the Parent column. For example - Trying to add a dept number reference within a Employee Table when the Dept doesnt exist in the Dept Table.

 Help us improve. Please let us know the company, where you were asked this question :   

   Like         Discuss         Correct / Improve     database  integrity constraint error  integrity constraint violated


 Q33. What is a Database Procedure ?Database
Ans. Stored procedures are a batch of SQL statements along with programming constructs ( if else, loops etc ) and stored as a single program that can be called by different clients and hence reused.


 Help us improve. Please let us know the company, where you were asked this question :   

   Like         Discuss         Correct / Improve     database  stored procedure     Asked in 2 Companies      basic        frequent


 Q34. What is a Database sequence ?Database
Ans. Its a feature wherein database creates unique values incremental values to be stored as primary key for the table.

 Help us improve. Please let us know the company, where you were asked this question :   

   Like         Discuss         Correct / Improve     database   sequence     Asked in 1 Companies


 Q35. How to count total number of tables in database ?Database
Ans. SELECT COUNT(*) FROM information_schema.tables

 Help us improve. Please let us know the company, where you were asked this question :   

   Like         Discuss         Correct / Improve     database query     Asked in 1 Companies


 Q36. There is a Table Student having Student Id, Name and Total Marks. Can you please write an SQL that will display the maximum marks obtained by a student ?Database
Ans. SELECT MARKS FROM STUDENT ORDER BY MARKS DESC LIMIT 1;

 Help us improve. Please let us know the company, where you were asked this question :   

   Like         Discuss         Correct / Improve     database query     Asked in 1 Companies


 Q37. What is CRUD ?Database
Ans. CRUD stands for "Create, read, update and delete" are the basic functions of persistence.

 Help us improve. Please let us know the company, where you were asked this question :   

   Like         Discuss         Correct / Improve     CRUD  Persistence  Database  Database Operations     Asked in 3 Companies      Basic        frequent


 Q38. When do we generally get the database error - Unique Constraint Violated ?
Ans. This error can result either on an insert, update or delete when any change in data results in duplicate record or subset of it having unique constraint on record or its subset. For example - If we have a unique constraint on a combination of columns and then trying to insert duplicate column values.

 Help us improve. Please let us know the company, where you were asked this question :   

   Like         Discuss         Correct / Improve     database  Unique Constraint error  Unique Constraint violated


 Q39. What are some alternates to keeping Audit Tables ?Database
Ans. Audit Tables generally stores Raw information to be reviewed in case of problems or determining impact. If Database space is an issue , and the audit information is rarely retrieved, one design could be to use compressed file system.

 Help us improve. Please let us know the company, where you were asked this question :   

   Like         Discuss         Correct / Improve     databases   audit tables   raw transaction information storage     Asked in 1 Companies


 Q40. What is the purpose of Commit and Rollback in Databases ?Database
Ans. When a DML is executed, the changes only stays in session and still not pushed to DB Tables, Commit is used to push those changes to the Tables.

In case we realize that we don't want to commit those changes and would like to ignore them, we can use rollback.

For example - You may like that for a banking transaction you would like to update the account balance only if the debit or credit record was correctly inserted, so you may like to encapsulate both DML's - insert for transaction and update for balance in a single transaction and would only commit if both succeeds else rollback.

 Help us improve. Please let us know the company, where you were asked this question :   

   Like         Discuss         Correct / Improve     databases  commit  rollback     Asked in 2 Companies      Basic


next 30

Help us and Others Improve. Please let us know the questions asked in any of your previous interview.

Any input from you will be highly appreciated and It will unlock the application for 10 more requests.

Company Name:
Questions Asked: