An example to introduce the external connection of mysql
Below, I would like to give you a brief introduction to mysql external links. Have you learned about similar topics before? If you are interested, let's take a look at this article. I believe it is more or less helpful for everyone to read an example to introduce the external connection of mysql.
# case: query the boyfriend information of the goddess whose number is > 3, list the details if any, and fill it with null.
SELECT bo.*FROM boys boRIGHT OUTER JOIN beauty bON b.`boyfriend _ id` = bo.`id`where b.`id` > 3
# case: query which city does not have a department
SELECT cityFROM locations lLEFT OUTER JOIN departments dON l.`location _ id` = d.`location _ id`where d.`department _ id`IS NULL
# case: query the employee information of the department named SAL or IT (with external connection, internal connection may have no employees and cannot be queried)
# use external connections, because there may be departments named above, but there are no employees, so fill in the employee table with null
# with an inner join, only the SAL or IT with employees will be matched, and the master table in the outer connection but not the slave table will be ignored
SELECT e.department, d.`department _ name`from departments dLEFT JOIN employees eON d.`department _ id` = e.`department _ id`where
D.`department _ name`IN ('SAL','IT')
What do you think of the example to introduce mysql external links to this article, whether there is anything to gain. If you want to know more about it, you can continue to follow our industry information section.