What is the difference between JOIN and UNION?
SQL JOIN allows us to “lookup” records on other table based on the given conditions between two tables. For example, if we have the department ID of each employee, then we can use this department ID of the employee table to join with the department ID of department table to lookup department names. UNION operation allows us to add 2 similar data sets to create resulting data set that contains all the data from the source data sets. Union does not require any condition for joining. For example, if you have 2 employee tables with same structure, you can UNION them to create one result set that will contain all the employees from both of the tables.
In a group of 40 people, 10 are healthy and every person the of the remaining 30 has either high blood pressure, a high level of cholesterol or both. If 15 have high blood pressure and 25 have high level of cholesterol, a) how many people have high blood pressure and a high level of cholesterol? If a person is selected randomly from this group, what is the probability that he/she b) has high blood pressure (event A)? c) has high level of cholesterol(event B)? d) has high blood pressure and high level of cholesterol (event A and B)? e) has either high blood pressure or high level of cholesterol (event A or B)? f) Use the above to check the probability formula: P(A or B) = P(A) + P(B) - P(A and B).
a) Let x be the number of people with both high blood pressure and high level of cholesterol. Hence (15 - x) will be the number of people with high blood pressure ONLY and (25 - x) will be the number of people with high level of cholesterol ONLY. We now express the fact that the total number of people with high blood pressure only, with high level of cholesterol only and with both is equal to 30. (15 - x) + (25 - x) + x = 30 solve for x: x = 10 b) 15 have high blood pressure,hence P(A) = 15/40 = 0.375 c) 25 have high level of cholesterol, hence P(B) = 25/40 = 0.625 d) 10 have both,hence P(A and B) = 10/40 = 0.25 e) 30 have either, hence P(A or B) = 30/40 = 0.75 e) P(A) + P(B) - P(A and B) = 0.375 + 0.625 - 0.25 = 0.75 = P(A or B)
Solve 5(-3x - 2) - (x - 3) = -4(4x + 5) + 13
1) -15x -10 -x +3 = -14x -20 +13 2) -2x=0 3) x=0