Using Oracle SQL * plus multi-table joint investigation
Users questions: Suppose I have two tables in the database "worker" and "customer" of these two tables have their names listed ("wname" and the "cname") and the city column ("ncity" and "ccity") . Now you want to find in the city "LA" All of the worker and the customer, requires the final result is two columns, the first column write the name, the second column is the worker that the person to or customer. What specifically should be how to write this sql?
Experts answer: home, the machine did not install Oracle, So I can not try. You try it. Note that the results you may have duplicate names. Worker and the customer set the table column names are name, city (so good). SELECTname, 'worker'ASoFROMworkerWHER Ecity= LA UNIONALLSELECTname customer ASoFROMcustomerWHEREcity= LA