0% found this document useful (0 votes)
9 views4 pages

FA SQL Interview Question Bank

The document is a Java Interview Question Bank containing various questions related to databases, including relationships, joins, transactions, and SQL commands. It covers key concepts such as ACID properties, primary and foreign keys, stored procedures, and the differences between various SQL operations. The content is aimed at helping candidates prepare for technical interviews in the field of Java and database management.

Uploaded by

namson2709
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
9 views4 pages

FA SQL Interview Question Bank

The document is a Java Interview Question Bank containing various questions related to databases, including relationships, joins, transactions, and SQL commands. It covers key concepts such as ACID properties, primary and foreign keys, stored procedures, and the differences between various SQL operations. The content is aimed at helping candidates prepare for technical interviews in the field of Java and database management.

Uploaded by

namson2709
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 4

Java Interview Question Bank

Java Interview Question Bank


Fresher Academy
Updated: 01/08/2017

DATABASE
1. What is Relationship? How many types of Relationship are there?
- The relationship can be defined as the connection between more than one tables
in the database.
- There are 4 types of relationships:
 One to One Relationship
 Many to One Relationship
 Many to Many Relationship
2. What is outer join, left join, inner join?
- Full outer join: Return all records from two tables.
- Right outer join: Preserves the unmatched rows from first table (right),
- joining with Null rows in the shape of the second table (left).
- Left outer join: Preserves the unmatched rows from first table (left),
- joining with Null rows in the shape of the second table (right).
3. What is index? When you should use index?
- Data structure created in DB for finding data more quickly and efficiently.
4. What is transaction? Why do you use transaction?
- A unit of work, performed against DB.
- Two main purposes:
 Allow correct recovery from failures and keep DB consistent even in
cases of system failure.
 Provide isolation btw programs accessing DB concurrently.
5. What is ACID?
- Four main features of transaction: Atomicity, Consistency, Isolation, Durability.
 Atomicity: Ensures that the entire sequence of operations is successfully
or not.

Fresher Academy – FPT - 2017


Java Interview Question Bank

 Consistency: Ensures that the database properly changes states upon a


successfully committed transaction.
 Isolation: Enables transactions to operate independently of and
transparent to each other.
 Durability: Ensures that the result or effect of a committed transaction
persists in case of a system failure.
6. Difference between TRUNCATE, DELETE and DROP commands?
- DELETE:
 Deletion of each row or the whole table gets logged and physically
deleted.
 Could have condition, triggers
 Need to commit the changes
- TRUNCATE:
 Log the de-allocation of the data pages in which the data exists.
 No need the commit statement.
 Don’t have condition, triggers.
- DROP command removes an object (table, view, stored procedure,...) from the
database completely.
7. When to use "group by" clause?
- Group similar data
8. When to use "order by" clause?
9. What is the different between "Having" and "Where" clause?
- Having: conditions used with group by.
- Where: conditions used with SELECT.
10. What is a Sub Query?
- A query nested inside a SELECT statements
- Alternative to complex join statements.
11. What is a View?
- A virtual table created on basis of the result set returned by the select statement.
- Increase performance and security
12. What are the advantages of Views?
- Views restrict access to the data.

Fresher Academy – FPT - 2017


Java Interview Question Bank

- Views can be used to make simple queries to retrieve the results of complicated
queries.
13. What is identity in SQL?
- Automatically generates numeric values.
14. How to find how many duplicated record in a table?
- Step1: count all distinct records in table.
- Step2: count all records in that table
- Step3: The result: the result in step2 subtracts to the result in step 1.
15. How to count a number of records in a table.
- Use count(*) from Table.
16. What is a primary key?
- A primary key is a combination of fields which uniquely specify a row
17. What is composite key?
- One primary key consists of two tables.
18. What is a foreign key?
19. What is the difference between UNIQUE and PRIMARY KEY constraints?
20. What is a stored procedure? Advantages and Disadvantages of Stored Procedure?
- Stored Procedure is a function consists of many SQL statement to access the
database system.
 Advantages:
» Reduced server/client network traffic
» Stronger security
» Reuse of code
» Improve Performance
 Disadvantage: utilizes more memory in the database server.
21. What is a trigger? When to use?
22. What is the different between "Stored procedure" and "Trigger”?
23. What is user defined functions? What are all types of user defined functions?
24. What are inserted and deleted table?
25. Difference between “LIKE” and “=” operator?
26. Difference between UNION and UNION ALL?

Fresher Academy – FPT - 2017


Java Interview Question Bank

- UNION – returns all distinct rows selected by either query.


- UNION ALL – returns all rows selected by either query, including all duplicates.

Fresher Academy – FPT - 2017

You might also like