N questions that interviewers are keen to ask

1. The difference between left connection and right connection in database

2. The difference between continue and break in Java

1. Multiple tables in the database are connected and associated according to a field of different tables,

Left join displays all the tables on the left. If there are associated items in the table on the right, the specific data will be displayed. If there are unrelated items, null will be displayed

The right connection is opposite to the above. It will display all the items on the right. If there are associated items in the table on the left, the specific data will be displayed. If there are unrelated items, null will be displayed

1、 Inner connection (a typical join operation uses comparison operators such as = or < >). It includes equal joins and natural joins. Inner joins use comparison operators to match rows in two tables according to the values of columns common to each table. For example, retrieve all rows with the same identification number in the students and courses tables. 2. Outer joins. Outer joins can be left outer joins and right outer joins Or complete external connection. When specifying an outer join in the from clause, it can be specified by one of the following sets of keywords:

1) The result set of left join or left outer join includes all rows of the left table specified in the left outer clause, not just the rows matched by the join column. If a row of the left table has no matching row in the right table, all selection list columns of the right table in the associated result set row are null.

2) Right join or right outer join right outer join is the reverse of left outer join. All rows of the right table will be returned. If a row in the right table has no matching row in the left table, a null value will be returned for the left table. 3) A full join or full outer join returns all rows in the left and right tables. When a row has no matching row in another table, the selection list column of the other table contains null values. If there are matching rows between tables, the entire result set row contains the data values of the base table. 3. Cross join cross join returns all rows in the left table, and each row in the left table is combined with all rows in the right table. Cross joins are also called Cartesian products.

2. Continue and break and in the loop,

Continue statement interrupts the iteration in the loop, skips if the specified condition occurs, and then continues to the next iteration in the loop; The loop body where continue is located does not end;

When the break branch is reached in the break statement, the whole loop body will jump out, and the loop body where the break is located has ended.

 public class TestContinue {

public static void main(String[] args) {
    for (int i=1;i<=5;i++)
    {
        if (i==3) continue;
        Sy<a href="https://www.jb51.cc/tag/stem/" target="_blank" class="keywords">stem</a>.out.println(i);
    }
    //  不<a href="https://www.jb51.cc/tag/shuchu/" target="_blank" class="keywords">输出</a>3,因为continue跳过了,直接进入下<a href="https://www.jb51.cc/tag/yige/" target="_blank" class="keywords">一个</a>迭代
    //  只<a href="https://www.jb51.cc/tag/shuchu/" target="_blank" class="keywords">输出</a> 1 , 2 , 4 , 5

}

}

The content of this article comes from the network collection of netizens. It is used as a learning reference. The copyright belongs to the original author.
THE END
分享
二维码
< <上一篇
下一篇>>