Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- -- The table referred:
- CREATE TABLE Categoria (
- Nome VARCHAR(50) NOT NULL,
- Immagine MEDIUMBLOB,
- PRIMARY KEY (Nome));
- -- The table with FK:
- CREATE TABLE Sottocategoria_Di (
- Categoria1 VARCHAR(50) NOT NULL,
- Categoria2 VARCHAR(50) NOT NULL,
- PRIMARY KEY (Categoria1, Categoria2),
- FOREIGN KEY (Categoria1) REFERENCES Categoria(Nome) ON DELETE NO ACTION,
- FOREIGN KEY (Categoria2) REFERENCES Categoria(Nome) ON DELETE CASCADE);
- INSERT INTO Categoria VALUES ('Chitarra', NULL);
- INSERT INTO Categoria VALUES ('Chitarra Acustica', NULL);
- INSERT INTO Categoria VALUES ('Chitarra Classica', NULL);
- LOAD DATA INFILE "C:/ProgramData/MySQL/MySQL Server
- 8.0/Uploads/MusicShop/Sottocategoria.txt" INTO TABLE
- Music.Sottocategoria_Di
- CHARACTER SET latin1
- FIELDS TERMINATED BY '|'
- ENCLOSED BY ''
- LINES TERMINATED BY 'n'
- IGNORE 1 LINES
- (Categoria1,Categoria2);
- -- Sottocategoria.txt
- Categoria1,Categoria2
- Chitarra Classica|Chitarra
- Chitarra Acustica|Chitarra`
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement