SQL statement and SQL
As a C # Language developer, it is difficult to escape from dealing with SQLSERVER. Although we are developers, what I want to say is, database operations should be reviewed from time to time. The following is an interesting SQL question I have seen. I will share it with you!
Question: there is a table Named department in my tepk database, which has only one field name and a total of four records, which are a, B, c, and d, corresponding to four teams, now we have four matches, and only one match is required between two or two. Now, use an SQL statement to display all possible combinations of matches.
Solution:
1. Check all the conditions that meet the requirements first. There are 16 types in total.
Result:
2. Filter
The final result is: 6 Types
The process now seems very simple, right? But at that time it was really hard to think about writing. Hahaha. Thank you!