I’m just getting back into DBA after not doing any heavy SQL in the past few years and I’m not sure if I’m missing something or if it’s something idiosyncratic with the application.
I’m trying to update a reference table (company_divisions) using my target table (emps) to discover values the reference table is missing as a way to expedite creating entries on the newly created reference table.
For example target table has a foreign key with values, 1, 2, 3, 4, 5 that are not unique in the target table but should be in the reference table. At time of table creation, the reference table has a primary key with values 1, 3, 5 that the target table FK references.
When I attempt to make the FK in the target table I get an error message that value 2 doesn’t exist in the reference table which violates the foreign key restraint. OK, check – I get that. So, I would like to update the reference table by doing a left join with the current ref table as the join table (right side) and find the nulls in the reference PK that are populated in the would be target table FK. I then would like to select anything where reference table PK is null and insert those rows into the reference table using the target table would be FK values as the new reference table PK values to be inserted.
For now I just want to get the join right. Here is the SQL statement I’m using:
SELECT emps.department, company_divisions.department FROM emps LEFT JOIN company_divisions ON emps.department = company_divisons.department
This returns the following error:
ERROR: missing FROM-clause entry for table "company_divisons" LINE 4: ON emps.department = company_divisons.department
What am I doing wrong?
✓ Extra quality
ExtraProxies brings the best proxy quality for you with our private and reliable proxies
✓ Extra anonymity
Top level of anonymity and 100% safe proxies – this is what you get with every proxy package
✓ Extra speed
1,ooo mb/s proxy servers speed – we are way better than others – just enjoy our proxies!
USA proxy location
We offer premium quality USA private proxies – the most essential proxies you can ever want from USA
Our proxies have TOP level of anonymity + Elite quality, so you are always safe and secure with your proxies
Use your proxies as much as you want – we have no limits for data transfer and bandwidth, unlimited usage!
Superb fast proxy servers with 1,000 mb/s speed – sit back and enjoy your lightning fast private proxies!
99,9% servers uptime
Alive and working proxies all the time – we are taking care of our servers so you can use them without any problems
No usage restrictions
You have freedom to use your proxies with every software, browser or website you want without restrictions
Perfect for SEO
We are 100% friendly with all SEO tasks as well as internet marketing – feel the power with our proxies
Buy more proxies and get better price – we offer various proxy packages with great deals and discounts
We are working 24/7 to bring the best proxy experience for you – we are glad to help and assist you!