Interview Questions and Answers for 'Sql' | 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 Rating

   
 Q31. Difference between relational databases and NoSQL databases ?Database
Ans. https://www.mongodb.com/scale/nosql-vs-relational-databases

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

   Like         Discuss         Correct / Improve     database management  nosql database  relational database     Asked in 1 Companies        frequent


  Q32. 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


  Q33. What is the use of Transient Keyword ?Core Java
Ans. It in Java is used to indicate that a field should not be serialized.

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

   Like         Discuss         Correct / Improve     java   oops   serialization   transient   java keywords     Asked in 39 Companies      intermediate        frequent

Try 2 Question(s) Test


 Q34. 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


 Q35. 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


 Q36. What are temp tables ?
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 :   

   Like         Discuss         Correct / Improve     database   sql   temp tables   tables


 Q37. 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


 Q38. 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


 Q39. 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


 Q40. 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


 Q41. 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


 Q42. 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


 Q43. 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


 Q44. 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


 Q45. 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


 Q46. 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


 Q47. 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


 Q48. 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


 Q49. 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


 Q50. In majority of the cases, the following join will give maximum number of results ?Database
a. Inner Join
b. Outer Join
c. Left Join
d. Right Join

Ans.b. Outer Join

 Q51. Which if the following is true for SQL Joins ?Database
a. Left Join and Right Join gives equal number of Results
b. Outer Join and Inner Join gives equal number of Results
c. Inner Join gives maximum number of results records
d. Inner Join gives minimum number of result records

Ans.d. Inner Join gives minimum number of result records

previous 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: