MCQS Home apps Development Gaming Mobile TECHNOLOGY Software Hordware OTHERS Education Crypto Login

Java Interview questions on Database, SQL, and JDBC

Categories: Education

Let's look at some frequently asked questions about Database and JDBC. JDBC is used to join Databases from Java programs.

 

Q.1. How do you prevent SQL injection attacks?

To prevent SQL injection attacks, use parameterized queries (prepared statements) with bound parameters, input validation, and escape characters. Avoid dynamic SQL queries constructed by concatenating user input.

 

Q.2. What is the difference between WHERE and HAVING clause? The WHERE clause filters rows before the grouping and aggregation process, while the HAVING clause filters aggregated data after the grouping process based on specified conditions.

 

Q.3. What are transactions? What is ACID?

Transactions are a set of SQL statements that are executed as a single unit of work. ACID is an acronym for Atomicity, Consistency, Isolation, and Durability, which are properties that ensure the reliability of transactions in a database system.

 

Q.4. Difference between truncate, delete, and drop clause in SQL?

(i) TRUNCATE: Removes all rows from a table but retains the table structure and any associated constraints or indexes.

(ii) DELETE: Removes specific rows from a table based on a condition, but retains the table structure and associated constraints.

(iii) DROP: Deletes an entire table, including its structure, data, and associated constraints and indexes.

 

Q.5. What are window functions? How do they work?

Window functions perform calculations across a set of rows related to the current row within a query result set. They allow you to perform aggregate functions (such as SUM, AVG, COUNT) over a specified window or subset of rows, defined by the OVER clause. Window functions operate on a set of rows and return a single value for each row based on that set of rows. They are often used for tasks such as ranking, aggregation, and calculating running totals.

Top articles
Common Mistakes to Avoid During CAT Exam Preparation Published at:- Bsc Medical Lab Technology Published at:- National board of examinations in medical sciences Published at:- Navigating the Challenges and Triumphs of State Board Exams Published at:- Understanding the CBSE Board Exam Grading System Published at:- Stress Management Techniques for ICSE Board Exam Takers Published at:- Medical Board Exam Published at:- Delicious Republic Day Recipes to Enjoy with Your Family Published at:- Essential Qualities of an Exceptional Teacher Published at:- The Psychology of Rejection: Understanding and Coping Strategies Published at:- Impactful Ways to Celebrate World Environment Day 2024 Published at:- The Ultimate Guide to Hiking Table Mountain: Cape Town's Iconic Landmark Published at:- The Environmental and Safety Benefits of Green Highway Signage Published at:- Java Interview questions on Database, SQL, and JDBC Published at:- NEET BOTANY MCQs (Morphology of flowering plants) Published at:- Business Law (MCQs) Set-1 Published at:- Business Law (MCQs) Set-2 Published at:- Business Law (MCQs) Set-3 Published at:- Business Law (MCQs) Set-4 Published at:-

Java Interview questions on Database, SQL, and JDBC