Database and JDBC Interview Questions & Answers
1. What is a Database?
- A Database is a structured collection of data that is stored, managed, and accessed
electronically.
2. Why do we need a Database?
- To efficiently store, retrieve, and manage large amounts of data securely and consistently.
3. What is DBMS?
- DBMS (Database Management System) is software that allows users to create, manage, and
manipulate databases (e.g., MySQL, PostgreSQL, MongoDB).
4. What is SQL?
- SQL (Structured Query Language) is a standard language used to interact with relational
databases, performing operations like SELECT, INSERT, UPDATE, and DELETE.
5. What is a Relation in MySQL?
- A Relation is a table in a relational database, consisting of rows and columns.
6. What is a Field in a Table?
- A Field is a single column in a table that stores a specific type of data.
7. What is a Record in a Table?
- A Record (Row) is a single entry in a table, representing a set of related data.
8. What is a Query?
- A Query is a request to perform operations (like retrieval, insertion, or deletion) on a database
using SQL.
9. What is JDBC?
- JDBC (Java Database Connectivity) is an API that allows Java applications to interact with
relational databases.
10. What are the Steps of JDBC?
- 1. Load the Driver:
[Link]("[Link]");
- 2. Establish Connection:
Connection con = [Link](url, user, password);
- 3. Create Statement:
Statement stmt = [Link]();
- 4. Execute Query:
ResultSet rs = [Link]("SELECT * FROM users");
- 5. Process Result:
while ([Link]()) {
[Link]([Link]("name"));
}
- 6. Close Connection:
[Link]();