Showing posts sorted by relevance for query 10-frequently-asked-sql-query-interview-questions-answers-database. Sort by date Show all posts
Showing posts sorted by relevance for query 10-frequently-asked-sql-query-interview-questions-answers-database. Sort by date Show all posts

Sunday, March 29, 2020

Jdbc Interview Questions Answers Inwards Coffee - Two To Iv Years Experienced Programmer

JDBC Interview inquiry forms 1 of the of import department inwards Java Interviews. Similar to multithreading, Collection framework together with Garbage collection interview question, JDBC inquiry must move prepared past times whatever Java programmer. Most of questions from JDBC or Java database connectivity comes from API together with basic architecture of JDBC which equally good involves JDBC drivers. Influenza A virus subtype H5N1 proficient agreement of JDBC API along with database basics similar transactions equally good assist to do good inwards JDBC interviews. I own got collected some of frequently asked JDBC Interview question for quick reference. This volition assist to revise some of import JDBC concepts together with equally good orbit a peril to explore JDBC API to newcomers. If you lot own got whatever other JDBC interview question, which has been asked to you lot or friends, together with you lot intend it’s proficient to portion alongside Java community thus delight portion with us. Let's run into my eleven questions from JDBC, non thus tough but worth preparing.


12 JDBC Interview Questions with Answers

JDBC Interview inquiry forms 1 of the of import department inwards Java Interviews JDBC Interview questions answers inwards Java - 2 to four years experienced programmerHere is my listing of interview questions from JDBC. This listing contains questions cast JDBC drivers, PreparedStatement, CallableStatement, JDBC Connection pool, SQL Date together with Timestamp API, ResultSet together with RowSet concepts together with couplet of JDBC inquiry from practical experience.




Question 1 : Difference betwixt SQL Date together with java.util.Date inwards Java
Answer : This is 1 of JDBC Questions which I similar to ask, because knowing how to correctly shop together with retrieve appointment inwards a database is often confusing for novel developers together with its rattling critical for whatever application. Main divergence betwixt SQL information i.e. java.sql.Date together with util appointment i.e. java.util.Date is that SQL Date alone contains appointment work together with non fourth dimension work but util appointment contains both appointment together with fourth dimension part. See SQL Date vs Util Date inwards Java for to a greater extent than differences betwixt them.

Question 2: What is do goodness of using PreparedStatement inwards Java
Answer : Another wonderful JDBC interview inquiry which is rattling pop on telephonic equally good equally on early on circular of Java Interviews. There are several benefits of using PreparedStatement piece querying database from Java programme e.g. meliorate surgical operation together with prevents from SQL Injection. I advise to read Why work PreparedStatement inwards Java for to a greater extent than benefits together with details on JDBC PreparedStatement.

Question 3: What is JDBC database Connection Pool? How to setup inwards Java?
Answer : I own got ever seen at to the lowest degree 1 inquiry related to database connecter puddle inwards JDBC Interview e.g. do goodness of using JDBC Connection pool. Well JDBC connecter puddle maintains puddle of JDBC connecter which is used past times application to query database. Since JDBC connecter are expensive it accept fourth dimension to create them which tin orbit notice irksome response fourth dimension of server if created during asking time. Creating them on application start-up together with reusing them number inwards meliorate performance. See How to setup JDBC Connection Pool inwards Java using Spring for to a greater extent than details on JDBC connecter puddle together with benefits it offer.

Question 4: What is divergence betwixt type 2 together with type four JDBC drivers inwards Java
Answer : This JDBC Interview inquiry is equally erstwhile equally Vector vs ArrayList or Hashtable vs HashMap. I recollect questions almost JDBC ODBC drivers asked during almost every fresher aeroplane interview.  Key divergence betwixt type 2 together with type four JDBC driver is that you lot only demand to include JAR file of JDBC driver inwards your classpath to connect database. See this link for to a greater extent than difference betwixt type 2 together with type four JDBC drivers.

Question 5: What is divergence betwixt java.sql.Time together with java.sql.TimeStamp inwards Java
Answer : This JDBC questions is similar to before JDBC interview inquiry java.sql.Date vs java.util.Date. Main divergence is that java.sql.Time degree doesn't comprise whatever appointment information on it piece java.sql.TimeStamp contains appointment information. See 4 divergence betwixt Time together with Timestamp inwards Java JDBC for to a greater extent than differences.

Question 6: What happens if nosotros telephone telephone resultSet.getInt(0) when Select query number only own got 1 column of integer type?
Answer : This is 1 of the tricky Java question which comes from JDBC. you lot may intend that it volition furnish outset column equally integer from Query number laid but unfortunately it doesn't. It throws InvalidColumnIndexException inwards JDBC because index for getXXX() or setXXX() inwards JDBC starts with 1. See How to ready InvalidColumnIndexException inwards JDBC for to a greater extent than details on this JDBC interview question.

Question 7: What is divergence betwixt RowSet together with ResultSet inwards JDBC?
Answer : One of the pop JDBC interview inquiry right away days. RowSet extends ResultSet together with add together back upwards for JDBC API to Java edible bean cistron model. Main divergence of ResultSet together with RowSet is RowSet beingness connected together with disconnected, which is some other follow-up JDBC question. RowSet makes it slowly to work ResultSet but equally I said you lot alone similar to work it to larn do goodness of disconnected together with connected RowSet.


Question 8: What is work of setAutoCommit(false) inwards JDBC ?
Answer : This is 1 of the JDBC Interview inquiry I touched on Top 10 JDBC best practices for Java programmer. making setAutoCommit(false) saves a lot of surgical operation equally it doesn't commit transaction automatically subsequently each query together with nosotros do batch update. It allows you lot to guide hold it using commit() together with rollback(). This has number inwards impressive surgical operation gain inwards DAO layer.


Question 9: How to telephone telephone stored physical care for from JDBC inwards Java?
Answer : This JDBC Interview inquiry is some other 1 you lot tin orbit notice add together on whatever often asked listing together with only can't afford non to prepare. Mostly asked to Java developers with 2 to four years experience. In its simplicity you lot tin orbit notice only say that CallableStatement is used to telephone telephone stored procedure, which may atomic number 82 questions similar how do you lot move past times parameters to stored physical care for from Java or difference betwixt IN together with OUT parameters inwards JDBC etc. It's worth to gear upwards this JDBC inquiry inwards detail. By the agency IN parameter is used to move past times input to stored physical care for together with OUT parameter is used to shop output furnish from stored procedure. IF your stored physical care for furnish multiple values than you lot tin orbit notice equally good work ResultSet to traverse all results.

Question 10: What is divergence betwixt Connected together with disconnected RowSet inwards JDBC?
Answer : I own got seen this JDBC inquiry asked equally a follow-up inquiry of previous JDBC interview inquiry RowSet vs ResultSet.  Main divergence betwixt connected together with disconnected RowSet inwards JDBC is that disconnected RowSet doesn't require JDBC Connection piece it's on disconnected state. This makes disconnected RowSet low-cal together with ideal to work inwards sparse clients, piece connected RowSet is only a wrapper some ResultSet. JDBCRowSet together with WebRowSet are 2 examples of connected RowSet while  a CachedRowSet is an lawsuit of disconnected RowSet which caches information inwards memory. Ideal for pocket-size information laid together with sparse Java clients with pocket-size retentiveness human foot print.

Question 11: What is divergence betwixt Statement, PreparedStatement together with CallableStatement inwards Java?
Answer : One of the classical JDBC interview question. Main divergence betwixt Statement together with PreparedSatement is surgical operation together with avoiding SQL Injection equally nosotros own got seen inwards Benefits of using PreparedStatement inwards Java. While CallableStatement has rattling specific work inwards JDBC together with used to telephone telephone stored physical care for from Java program

That's all on these eleven JDBC Interview questions together with answers article. As I said many times, JDBC questions are of import work of whatever Java interview, allow it substance Java or J2EE Interview together with you lot only can't ignore it. Always gear upwards JDBC good plenty to respond whatever JDBC Interview inquiry to perform good inwards Java interviews.

Further Learning
JSP, Servlets together with JDBC for Beginners: Build a Database App
Complete JDBC Programming Part 1 together with 2
10 Tough substance Java Interview inquiry for practice

Thursday, October 31, 2019

50+ Microsoft Sql Server Telephone Interview Questions Together With Answers

Are y'all preparing for an SQL Server Interview? or, a Java developer pose where SQL Server skills are important? If yes, too hence hither are a duad of oftentimes asked Microsoft SQL Server Interview questions y'all should exercise earlier going for your interview. These questions are likewise practiced to brush-up your Database too SQL fundamentals which is ever asked every bit component subdivision of interviews.These listing contains non solely godo SQL Server interview questions simply likewise to a greater extent than or less basic SQL questiosn which y'all volition encounter everywhere. The listing is useful for both beginners too intermediate develoeprs too DBAs with 0 to 2 years of exeprience.

1. What is normalization? (answer)
Normalization is processed to trim down duplication from tables. They aid to trim down storage infinite past times removing duplicate simply subsequently a for certain normal form, it likewise makes hard to query data. Influenza A virus subtype H5N1 tabular array should at to the lowest degree live on inwards tertiary normal cast for all practical purpose.

2. How to bring together iii tables inwards 1 unmarried SQL query? (solution)

3. Write a SQL query to discovery all tabular array names inwards a database? (solution)

4. How do y'all discovery the duplicate rows inwards a tabular array on a database? (solution)

5. What is the divergence betwixt WHERE too HAVING clause inwards SQL? (answer)

6. Difference betwixt Primary too Candidate key inwards table? (answer)

7. What is the fastest means to empty a table? (answer)
You tin give notice usage truncate to empty a table, it's faster than deleting all records because of no logging. You tin give notice likewise DROP too recreate the table, it is every bit practiced every bit truncating the table.

8. Difference betwixt Self too Equi Join inwards SQL? (answer)
hint - inwards self bring together a tabular array is jointed to itself too on the equi bring together the status of joining is based upon equality. 

9. What are dissimilar types of joins possible inwards SQL Server?  (answer)
hint - INNER, LEFT OUTER, RIGHT OUTER too CROSS JOIN, etc. If y'all desire to larn to a greater extent than most truncate too delete, I advise y'all conduct hold a await at The Complete SQL Bootcamp course on Udemy. One of the best course of teaching to larn SQL fundamentals.

 Are y'all preparing for an SQL Server Interview 50+ Microsoft SQL Server Phone Interview Questions too Answers


10. What is an identity column inwards SQL Server? (answer)
An identity column is 1 where Id is incremented sequentially for each record. If your tabular array doesn't conduct hold a column which is a natural primary key e.g. SSN, EmployeeId, etc, too hence y'all tin give notice usage an Identity column every bit the primary key. For

11. How do y'all render an identity value from a table? (answer)

12. How do y'all render an identity value from a tabular array with a trigger? (answer)

13. How many bytes tin give notice y'all tally inwards a row, do y'all know why? (answer)

14. What is a clustered index? (answer)
Hint - a clustered index defines the structured information is genuinely stored inwards the disk

15. How many clustered indexes per tabular array is allowed? (answer)
Hint - Only 1 clustered index per table, its the primary key of the table.

16. How many nonclustered indexes y'all tin give notice create per table?  (answer)
hint - to a greater extent than than one, simply to a greater extent than index does brand SELECT query fast simply INSERT, UPDATE volition acquire slow)

17. What is the divergence betwixt clustered too non-clustered index?  (answer)
hint - clustered index represents the physical ordering of information spell the non-clustered index represents logical ordering. There tin give notice solely live on 1 clustered index per tabular array simply y'all tin give notice conduct hold many non-clustered indexes inwards a table.

18. What is the divergence betwixt varchar too nvarchar information type inwards SQL Server? (answer)
hint - varchar is used for grapheme information simply nvarchar is used to shop Unicode values.  You tin give notice farther see Microsoft SQL for Beginners to larn to a greater extent than most dissimilar information types inwards SQL Server similar decimal, numeric, DateTime, etc.

 Are y'all preparing for an SQL Server Interview 50+ Microsoft SQL Server Phone Interview Questions too Answers



19. What is an execution plan?  (answer)
Hint - The steps/decision chosen past times Query analyzer to execute your query)

20. Which 1 is fastest too slowest with index scan, index seek too tabular array scan? (answer)
hint -  index seek is fastest too tabular array scan is slowest

21. How do y'all render a value from a proc?  (answer)

22. How do y'all render a varchar value from a proc?  (answer)

23. If I conduct hold a column that volition solely conduct hold values betwixt 1 too 250 what information type should I use?  (answer)

24. How do y'all enforce that solely values betwixt 1 too 10 are allowed inwards a column?  (answer)

25. How to depository fiscal establishment check for a valid appointment inwards SQL Server?  (answer)

26. Which appointment format is the solely prophylactic 1 to usage when passing dates every bit strings?  (answer)

27. How do y'all suppress rows affected messages when executing an insert statement?  (answer)

28. Can y'all lift the iv isolation levels inwards Microsoft SQL Server?   (answer)

29. How would y'all conduct all terminal names that start with S?   (answer)
hint - By using LIKE keyword similar the terminal lift similar 'S%'

30. How would y'all conduct all rows where the appointment is yesterday's date? (answer)

31. What is horizontal partitioning inwards SQL Server database?  (answer)

32. How do y'all discovery the Nth highest salary inwards a table? (solution)

33. What is the divergence betwixt char too varchar information type inwards SQL Server? (answer)

34. What does schemabinding do inwards Microsoft SQL Server?  (answer)

35. How do y'all essay for nulls inwards SQL query?  (answer)
Hint - past times using IS NULL too IS NOT NULL clause. Never essay using = or != operators.

36. What are to a greater extent than or less differences betwixt isnull too coalesce inwards SQL Server?  (answer)
hint - The isnull() solely allows 2 values, simply coalesce() allows multiples. Also, COALESCE is ANSI measure spell ISNULL is T-SQL specific. See hither for a duad of to a greater extent than differences betwixt is null too coalesce. You tin give notice farther see 70-461, 761: Querying Microsoft SQL Server with Transact-SQL course of teaching on Udemy which is for preparing SQL server certification simply likewise practiced for agreement SQL server concept similar this in-depth.

 Are y'all preparing for an SQL Server Interview 50+ Microsoft SQL Server Phone Interview Questions too Answers



37. What is the divergence betwixt the cast, convert, too parse role inwards SQL Server? (answer)

38. What is the temp table?  (answer)
hint - Influenza A virus subtype H5N1 temp tabular array is something which starts with # too removed when the user terminates its session. It solely remains available unless user session is live, it's non visible to anyone exterior the session.)

39. What is the divergence betwixt a local too global temporary table?  (answer)
hint - Influenza A virus subtype H5N1 local temp tabular array is solely visible to the electrical current user simply a global temp tabular array is visible to everybody)

40. What is the divergence betwixt GETDATE, SYSDATETIME, too GETUTCDATE role inwards SQL Server? (answer)

41. If y'all create a local temp tabular array too and hence telephone phone a proc is the temp tabular array available within the proc?  (answer)
Hint - Yes, it volition live on available.  hither is the proof

--create proc
CREATE PROC myProc
AS

SET NOCOUNT ON

SELECT * FROM #temp
GO

--create our temp table
CREATE TABLE #temp (id int)

INSERT #temp VALUES(1)
INSERT #temp VALUES(2)
INSERT #temp VALUES(3)

--exec proc
EXEC myProc

DROP PROC myProc


42. What is referential integrity inwards a relational database?  (answer)
Hint - It's a constraint to ensure information integrity with the related table, primary key too unusual key human relationship are based upon this concept. for to a greater extent than details see answer)
hint - y'all tin give notice usage betwixt the operator too the less than or greater than the operator.

44. How to take away duplicate rows from a tabular array inwards SQL? (answer)

45. What information type should y'all usage to shop monetary values?  (answer)
hint - NUMERIC with proper precision.

46. What is cascade delete inwards SQL Server?  (answer)
hint - This ensures that if a row is deleted from the primary tabular array too hence all rows subject upon that likewise gets deleted from related tables. For example, if a User is deleted too hence all his Setting should likewise acquire deleted from UserSettings tabular array if both are related to each other e.g. via user_id

47. What is the divergence betwixt closed too deallocate cursor inwards SQL? (answer)

48.  Difference betwixt Primary too Foreign key inwards table? (answer)

49. What is the divergence betwixt row_number, rank, too dense_rank inwards SQL Server? (answer)

50. What is a SQL injection? 
hint - Influenza A virus subtype H5N1 vulnerability which arises due to dynamically generating SQL query past times concatenating String too using unsanitized user data.)

51. What are the differences betwixt PRIMARY KEY too UNIQUE constraints?  (answer)
Hint - Primary key cannot NULL, simply Unique constraints allow 1 NULL, primary key creates clustered index simply Unique constraints don't create clustered index)

52. How do y'all ensure that SQL Server volition usage an index?  (answer)
hint - y'all tin give notice usage tabular array hints inwards SQL query

53. What is the divergence betwixt wedlock too wedlock all?  (answer)
Hint - both are used to combine the lawsuit of ii SQL query with identical construction simply wedlock all keeps duplicate rows too wedlock doesn't encounter hither for to a greater extent than details)


That's all most to a greater extent than or less of the frequently asked SQL Server Interview questions for programmers. I conduct hold tried to furnish plenty hints too answers simply if y'all desire to larn in-depth y'all tin give notice likewise bring together a comprehensive SQL Server course of teaching similar The SQL server maser class. These questions are often asked on telephonic circular every bit good every bit on starting fourth dimension few technical rounds of interview. It's useful for both beginners too experienced programmer too DBAs with a duad of years of experience.

Further Learning
The Complete SQL Bootcamp
solution)
  • 5 Courses to larn Database too SQL Better (courses)
  • Write a SQL query to re-create or backup a tabular array inwards MySQL (solution)
  • 5 Courses to larn Oracle too Microsoft SQL Server database (courses)
  • How to migrate SQL queries from Oracle to SQL Server 2008? (answer)
  • Top v Websites to larn SQL online for FREE? (resource)
  • What is the divergence betwixt UNION too UNION ALL inwards SQL? (answer)
  • Top v Courses to larn MySQL Database for Beginners (Courses)
  • What is the divergence betwixt View too Materialized View inwards Database? (answer)
  • Difference betwixt clustered too non-clustered index inwards SQL? (answer)
  • 5 Free Courses to larn T-SQL too SQL Server for Beginners (Courses)
  • Difference betwixt Unique too Primary key inwards table? (answer)

  • Thanks for reading this article hence far. If y'all similar these SQL Server Interview questions too hence delight part with your friends too colleagues. If y'all conduct hold whatsoever questions or feedback too hence delight drib a note.

    P.S. - If y'all are interested inwards learning Database too SQL too looking for to a greater extent than or less gratis resources to start your journeying too hence y'all tin give notice likewise conduct hold a await at this listing of Free SQL Courses for Beginners to kick-start your learning.