2020 latest interview questions (including answers)

1. There are select, from, where, group by, order by, having in sql. What is the order in which sql is executed?
Answer:
From (table) where (retrieve data according to conditions) group by (group the retrieved data) having (filter the latest data set after grouping) select (remove data from the data set according to the set column) order by (Sorting the retrieved data)
Execution order: from–where–group by–having–select–order by

2. The difference between resultMap and resultType in mybatis?
Answer: The
resultMap is more powerful, and the customizable fields are aliases (column: the field name of the library table, property: the attribute name in the entity class); in the case of one-to-many use resultMap


resultType is the entity class and the database table field one by one Correspondingly, return the type directly. The two cannot exist at the same time

3. What is the difference between hashMap and hashTable?
Answer:
HashMap (jdk1.8 uses array + linked list + red-black tree, the threshold length of the linked list exceeds 8 is converted to a red-black tree):
1. Key-value storage, singly linked list exceeds the threshold and increases automatically;
2. Thread is not safe, suitable for Single thread (deadlock may occur under multiple threads&#x

Guess you like

Origin blog.csdn.net/weixin_44146379/article/details/104287340