2013-12-16 56 views
1

我一直在努力與我的數據庫了一段時間,我的老師幾乎不可能得到一個。我的代碼如下:列數,整數值,數據截斷和其他消息

INSERT INTO `database28`.`activity` 
VALUES 
("Stefan", 1.1.2.2, "Dator", "Mozilla"); 

INSERT INTO `database28`.`activity` 
VALUES 
("Ulf", 1.1.3.3, "Mobil", "Safari"); 

INSERT INTO `database28`.`activity` 
VALUES 
("Göran", 1.1.4.4, "surfplatta", "opera"); 

INSERT INTO `database28`.`activity` 
VALUES 
("Berit", 1.1.5.5, "Dator", "Internet Explorer"); 

INSERT INTO `database28`.`activity` 
VALUES 
("Arne", 1.1.6.6, "Mobil", "Chrome"); 

INSERT INTO `database28`.`destination` 
(`Destination`, 
`Direction`, 
`Klient`) 
VALUES 
("Databas1", "Till", "Privat"); 

INSERT INTO `database28`.`destination` 
(`Destination`, 
`Direction`, 
`Klient`) 
VALUES 
("Databas2", "Till", "Företag"); 

INSERT INTO `database28`.`destination` 
(`Destination`, 
`Direction`, 
`Klient`) 
VALUES 
("Databas2", "Till", "Privat"); 

INSERT INTO `database28`.`destination` 
(`Destination`, 
`Direction`, 
`Klient`) 
VALUES 
("Databas2", "Från", "Privat"); 

INSERT INTO `database28`.`destination` 
(`Destination`, 
`Direction`, 
`Klient`) 
VALUES 
("Databas2", "Från", "Företag"); 

INSERT INTO `database28`.`destination` 
(`Destination`, 
`Direction`, 
`Klient`) 
VALUES 
("Databas1", "Till", "Privat"); 

INSERT INTO `database28`.`eventtype` 
(`EventID`, 
`Namn`) 
VALUES 
("Success Audit"); 

INSERT INTO `database28`.`eventtype` 
(`EventID`, 
`Namn`) 
VALUES 
("failure Audit"); 

INSERT INTO `database28`.`eventtype` 
(`EventID`, 
`Namn`) 
VALUES 
("Information"); 

INSERT INTO `database28`.`eventtype` 
(`EventID`, 
`Namn`) 
VALUES 
("Warning"); 

INSERT INTO `database28`.`eventtype` 
(`EventID`, 
`Namn`) 
VALUES 
("Error"); 

INSERT INTO `database28`.`log` 
(`LogID`, 
`Tid`, 
`Serverr`, 
`ActID`, 
`Destination`, 
`Källa`) 
VALUES 
(1, 11:00, "Server 1", "Stefan", "Databas1", "System"); 

INSERT INTO `database28`.`log` 
(`LogID`, 
`Tid`, 
`Serverr`, 
`ActID`, 
`Destination`, 
`Källa`) 
VALUES 
(2, 12:00, "Server 2", "Ulf", "Databas2", "exe"); 

INSERT INTO `database28`.`log` 
(`LogID`, 
`Tid`, 
`Serverr`, 
`ActID`, 
`Destination`, 
`Källa`) 
VALUES 
(3, 13:00, "Server 1", "Mats", "Databas1", "System"); 

INSERT INTO `database28`.`log` 
(`LogID`, 
`Tid`, 
`Serverr`, 
`ActID`, 
`Destination`, 
`Källa`) 
VALUES 
(2, 11:00, "Server 1", "Arne", "Databas1", "exe"); 

INSERT INTO `database28`.`log` 
(`LogID`, 
`Tid`, 
`Serverr`, 
`ActID`, 
`Destination`, 
`Källa`) 
VALUES 
(3, 21:00, "Server 1", "Berit", "Databas1", "exe"); 

然而,這給我留下了一些錯誤信息,我不把他們都在一次課程的,但是當我嘗試和改變的東西我似乎使情況變得更糟。有任何想法嗎?

回答

0

你忘了把QUOTE Mark在插入查詢activity表和log

試試這個:

INSERT INTO `database28`.`activity` 
VALUES 
("Stefan", '1.1.2.2', "Dator", "Mozilla"); 

INSERT INTO `database28`.`activity` 
VALUES 
("Ulf", '1.1.3.3', "Mobil", "Safari"); 

INSERT INTO `database28`.`activity` 
VALUES 
("Göran", '1.1.4.4', "surfplatta", "opera"); 

INSERT INTO `database28`.`activity` 
VALUES 
("Berit", '1.1.5.5', "Dator", "Internet Explorer"); 

INSERT INTO `database28`.`activity` 
VALUES 
("Arne", '1.1.6.6', "Mobil", "Chrome"); 

INSERT INTO `database28`.`destination` 
(`Destination`, 
`Direction`, 
`Klient`) 
VALUES 
("Databas1", "Till", "Privat"); 

INSERT INTO `database28`.`destination` 
(`Destination`, 
`Direction`, 
`Klient`) 
VALUES 
("Databas2", "Till", "Företag"); 

INSERT INTO `database28`.`destination` 
(`Destination`, 
`Direction`, 
`Klient`) 
VALUES 
("Databas2", "Till", "Privat"); 

INSERT INTO `database28`.`destination` 
(`Destination`, 
`Direction`, 
`Klient`) 
VALUES 
("Databas2", "Från", "Privat"); 

INSERT INTO `database28`.`destination` 
(`Destination`, 
`Direction`, 
`Klient`) 
VALUES 
("Databas2", "Från", "Företag"); 

INSERT INTO `database28`.`destination` 
(`Destination`, 
`Direction`, 
`Klient`) 
VALUES 
("Databas1", "Till", "Privat"); 

INSERT INTO `database28`.`eventtype` 
(`EventID`, 
`Namn`) 
VALUES 
("Success Audit"); 

INSERT INTO `database28`.`eventtype` 
(`EventID`, 
`Namn`) 
VALUES 
("failure Audit"); 

INSERT INTO `database28`.`eventtype` 
(`EventID`, 
`Namn`) 
VALUES 
("Information"); 

INSERT INTO `database28`.`eventtype` 
(`EventID`, 
`Namn`) 
VALUES 
("Warning"); 

INSERT INTO `database28`.`eventtype` 
(`EventID`, 
`Namn`) 
VALUES 
("Error"); 

INSERT INTO `database28`.`log` 
(`LogID`, 
`Tid`, 
`Serverr`, 
`ActID`, 
`Destination`, 
`Källa`) 
VALUES 
(1, '11:00', "Server 1", "Stefan", "Databas1", "System"); 

INSERT INTO `database28`.`log` 
(`LogID`, 
`Tid`, 
`Serverr`, 
`ActID`, 
`Destination`, 
`Källa`) 
VALUES 
(2, '12:00', "Server 2", "Ulf", "Databas2", "exe"); 

INSERT INTO `database28`.`log` 
(`LogID`, 
`Tid`, 
`Serverr`, 
`ActID`, 
`Destination`, 
`Källa`) 
VALUES 
(3, '13:00', "Server 1", "Mats", "Databas1", "System"); 

INSERT INTO `database28`.`log` 
(`LogID`, 
`Tid`, 
`Serverr`, 
`ActID`, 
`Destination`, 
`Källa`) 
VALUES 
(2, '11:00', "Server 1", "Arne", "Databas1", "exe"); 

INSERT INTO `database28`.`log` 
(`LogID`, 
`Tid`, 
`Serverr`, 
`ActID`, 
`Destination`, 
`Källa`) 
VALUES 
(3, '21:00', "Server 1", "Berit", "Databas1", "exe"); 
+0

啊謝謝!現在所有其他錯誤信息都消失了,但是出現了一條新消息 「重複輸入'Stefan',輸入密鑰'PRIMARY' – user3106867

+0

@ user3106867然後移除該輸入語句 –

+0

並且由此意味着從 中刪除」Stefan「INSERT INTO'數據庫28'.'activity' VALUES (「Stefan」,'1.1.2.2',「Dator」,「Mozilla」); ? – user3106867