Take the 2-minute tour ×
Database Administrators Stack Exchange is a question and answer site for database professionals who wish to improve their database skills and learn from others in the community. It's 100% free, no registration required.

I have an LDAP feed that I run nightly and it makes several tables that run a lot of our internal websites. I simply get about 40 fields times 80K employees.

The tables get overridden every night on purpose because it is used for our SAML2 SSO and other stuff and don't want old employees to be able to login if there is a code breakdown somewhere.

So I guess what I trying to figure out is that if I ALTER a table how do I store or transfer the old data to an exemployee table?

    DROP TABLE
IF EXISTS testgiver.ldap_extr;

CREATE TABLE testgiver.ldap_extr

SELECT
ldap_full_forever.cn,
ldap_full_forever.uid,
ldap_full_forever.businesscategory,
ldap_full_forever.mail
FROM
ldap_full_forever
WHERE ldap_full_forever.uid NOT IN (
SELECT ldap_tiny.uid
FROM ldap_tiny
WHERE ldap_tiny.uid is not null) 

In this example I have already created an extra table - full_forever that never drops an employee on update. This is cross-referenced against a current table and then another table gets created with that subset. Is that the best/easiest way?

share|improve this question

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Browse other questions tagged or ask your own question.