Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
TRUNCATE `3IN_SSID`;
SET CHARACTER SET 'utf8';
SET collation_connection = 'utf8_general_ci'
LOAD DATA LOCAL INFILE "/home/smachefert/Bureau/DG_201803/3IN_SSID.csv" INTO TABLE `3IN_SSID` FIELDS TERMINATED BY "," ENCLOSED BY '"' LINES TERMINATED BY "\n" IGNORE 1 LINES;
# mise à jour de la base après chargement :
ALTER TABLE `3IN_SSID` ADD `LN` BOOLEAN NOT NULL DEFAULT FALSE AFTER `PublisherName`;
ALTER TABLE `3IN_SSID` ADD `coverage` VARCHAR(255) NOT NULL AFTER `LN`;
UPDATE 3IN_SSID set LN = 1 where Resource like '%ational%';
update 3IN_SSID set coverage = CONCAT(StartDate, " - ", EndDate) where EndDate != '' or StartDate != '';
update 3IN_SSID set coverage = PublicationDate where PublicationDate != '' and coverage = "";
# Interrogation
select A.Resource as RessourceLN, A.coverage as CoverageLN, B.Resource as RessourcePropre, B.coverage as CoveragePropre, A.* from `3IN_SSID` as `A`, `3IN_SSID` as `B` where A.Id = B.id and A.DatabaseCode != B.DatabaseCode and A.LN = 1
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.