如果标题令人困惑,我很抱歉,我不太确定还有什么可以称呼这个问题。基本上,到目前为止,我已经完成了对表ORDER_DETAIL的备份并对其进行了修改,以便当它运行表ORDER_DETAIL的原始数据时,将其插入到表ag715中。这样做的目的是,当运行名为HACKER的单独脚本时,此脚本将更改ORDER_DETAIL。
我现在的任务是比较表并显示已删除,插入和更新的内容。但是我的问题是,当我运行备份文件时,ORDER_DETAIL为空并且ag715具有数据,因此我无法比较表。
我的问题是我的备份文件是否被正确修改,或者是否正确,并且在运行时删除了表ORDER_DETAIL的内容?
-- MySQL dump 10.13 Distrib 8.0.13, for Linux (x86_64)
--
-- Host: localhost Database: csit115
-- ------------------------------------------------------
-- Server version 8.0.13
/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */;
/*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */;
/*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */;
SET NAMES utf8mb4 ;
/*!40103 SET @OLD_TIME_ZONE=@@TIME_ZONE */;
/*!40103 SET TIME_ZONE='+00:00' */;
/*!40014 SET @OLD_UNIQUE_CHECKS=@@UNIQUE_CHECKS, UNIQUE_CHECKS=0 */;
/*!40014 SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS=0 */;
/*!40101 SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='NO_AUTO_VALUE_ON_ZERO' */;
/*!40111 SET @OLD_SQL_NOTES=@@SQL_NOTES, SQL_NOTES=0 */;
--
-- Table structure for table `ORDER_DETAIL`
--
DROP TABLE IF EXISTS `ORDER_DETAIL`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
SET character_set_client = utf8mb4 ;
CREATE TABLE `ORDER_DETAIL` (
`ORDER_ID` decimal(9,0) NOT NULL,
`PRODUCT_NAME` varchar(40) NOT NULL,
`UNIT_PRICE` decimal(10,2) NOT NULL DEFAULT '0.00',
`QUANTITY` decimal(9,0) NOT NULL DEFAULT '1',
`DISCOUNT` decimal(4,2) NOT NULL DEFAULT '0.00',
PRIMARY KEY (`ORDER_ID`,`PRODUCT_NAME`),
KEY `FK_PRODUCT_NAME_ag715` (`PRODUCT_NAME`),
CONSTRAINT `FK_ORDER_ID_ag715` FOREIGN KEY (`ORDER_ID`) REFERENCES `ORDERS` (`order_id`),
CONSTRAINT `FK_PRODUCT_NAME_ag715` FOREIGN KEY (`PRODUCT_NAME`) REFERENCES `PRODUCT` (`product_name`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci;
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Dumping data for table `ORDER_DETAIL`
--
LOCK TABLES `ag715` WRITE;
/*!40000 ALTER TABLE `ag715` DISABLE KEYS */;
INSERT INTO `ag715` VALUES (248,'Mozzarella di Giovanni',34.80,5,0.00),(248,'Queso Cabrales',14.00,12,0.00),(248,'Singaporean Hokkien Fried Mee',9.80,10,0.00),(249,'Manjimup Dried Apples',42.40,40,0.00),(249,'Tofu',18.60,9,0.00),(250,'Jack\'s New England Clam Chowder',7.70,10,0.00),(250,'Louisiana Fiery Hot Pepper Sauce',16.80,15,0.15),(250,'Manjimup Dried Apples',42.40,35,0.15),(251,'Gustaf\'s Knackebrod',16.80,6,0.05),(251,'Louisiana Fiery Hot Pepper Sauce',16.80,20,0.00),(251,'Ravioli Angelo',15.60,15,0.05),(252,'Camembert Pierrot',27.20,40,0.00),(252,'Geitost',2.00,25,0.05),(252,'Sir Rodney\'s Marmalade',64.80,40,0.05),(253,'Gorgonzola Telino',10.00,20,0.00),(253,'Inlagd Sill',14.40,42,0.00),(253,'Maxilaku',16.00,40,0.00),(254,'Guarana Fantastica',3.60,15,0.15),(254,'Longlife Tofu',8.00,21,0.00),(254,'Pate chinois',19.20,21,0.15),(255,'Chang',15.20,20,0.00),(255,'Inlagd Sill',15.20,25,0.00),(255,'Pavlova',13.90,35,0.00),(255,'Raclette Courdavault',44.00,30,0.00),(256,'Original Frankfurter grune Sosse',10.40,12,0.00),(256,'Perth Pasties',26.20,15,0.00),(257,'Inlagd Sill',14.40,6,0.00),(257,'Original Frankfurter grune Sosse',10.40,15,0.00),(257,'Schoggi Schokolade',35.10,25,0.00),(258,'Chang',15.20,50,0.20),(258,'Chef Anton\'s Gumbo Mix',17.00,65,0.20),(258,'Mascarpone Fabioli',25.60,6,0.20),(259,'Gravad lax',20.80,1,0.00),(259,'Sir Rodney\'s Scones',8.00,10,0.00),(260,'Jack\'s New England Clam Chowder',7.70,16,0.25),(260,'Outback Lager',12.00,21,0.25),(260,'Ravioli Angelo',15.60,50,0.00),(260,'Tarte au sucre',39.40,15,0.25),(261,'Sir Rodney\'s Scones',8.00,20,0.00),(261,'Steeleye Stout',14.40,20,0.00),(262,'Chef Anton\'s Gumbo Mix',17.00,12,0.20),(262,'Gnocchi di nonna Alice',30.40,2,0.00),(262,'Guarana Fantastica',17.00,15,0.00),(263,'Guarana Fantastica',3.60,28,0.00),(263,'Longlife Tofu',8.00,36,0.25),(263,'Nord-Ost Matjeshering',20.70,60,0.25),(263,'Pavlova',13.90,60,0.25),(264,'Chang',15.20,35,0.00),(264,'Jack\'s New England Clam Chowder',7.70,25,0.15),(265,'Alice Mutton',31.20,30,0.00),(265,'Outback Lager',12.00,20,0.00),(266,'Queso Manchego La Pastora',30.40,12,0.05),(267,'Boston Crab Meat',14.70,50,0.00),(267,'Lakkalikoori',14.40,15,0.15),(267,'Raclette Courdavault',44.00,70,0.15),(268,'Mozzarella di Giovanni',27.80,4,0.00),(268,'Thuringer Rostbratwurst',99.00,10,0.00),(269,'Geitost',2.00,60,0.05),(269,'Mozzarella di Giovanni',27.80,20,0.05),(270,'Inlagd Sill',15.20,30,0.00),(270,'Ipoh Coffee',36.80,25,0.00),(271,'Geitost',2.00,24,0.00),(272,'Gorgonzola Telino',10.00,40,0.00),(272,'Mozzarella di Giovanni',27.80,24,0.00),(272,'Sir Rodney\'s Marmalade',64.80,6,0.00),(273,'Boston Crab Meat',14.70,60,0.05),(273,'Geitost',2.00,20,0.00),(273,'Gorgonzola Telino',10.00,15,0.05),(273,'Ikura',24.80,24,0.05),(273,'Lakkalikoori',14.40,33,0.05),(274,'Flotemysost',17.20,20,0.00),(274,'Mozzarella di Giovanni',27.80,7,0.00),(275,'Guarana Fantastica',3.60,12,0.05),(275,'Raclette Courdavault',44.00,6,0.05),(276,'Ikura',24.80,15,0.00),(276,'Konbu',4.80,10,0.00),(277,'Rossle Sauerkraut',36.40,20,0.00),(277,'Tarte au sucre',39.40,12,0.00),(278,'Gula Malacca',15.50,16,0.00),(278,'Raclette Courdavault',44.00,15,0.00),(278,'Rod Kaviar',12.00,25,0.00),(278,'Vegie-spread',35.10,8,0.00),(279,'Alice Mutton',31.20,15,0.25),(280,'Guarana Fantastica',3.60,12,0.00),(280,'Pate chinois',19.20,20,0.00),(280,'Rhonbrau Klosterbier',6.20,30,0.00),(281,'Guarana Fantastica',3.60,6,0.00),(281,'Steeleye Stout',14.40,4,0.00),(281,'Teatime Chocolate Biscuits',7.30,1,0.00),(288,'Scottish Longbreads',10.00,3,0.10),(288,'Tourtiere',5.90,10,0.10),(289,'Aniseed Syrup',8.00,30,0.00),(289,'Wimmers gute Semmelknodel',26.60,9,0.00),(290,'Chef Anton\'s Gumbo Mix',17.00,20,0.00),(290,'Maxilaku',16.00,15,0.00),(290,'Original Frankfurter grune Sosse',10.40,10,0.00),(290,'Thuringer Rostbratwurst',99.00,15,0.00),(291,'Gula Malacca',15.50,24,0.10),(291,'Konbu',4.80,20,0.10),(291,'Manjimup Dried Apples',42.40,2,0.10),(292,'Sir Rodney\'s Marmalade',64.80,20,0.00),(293,'Carnarvon Tigers',50.00,12,0.00),(293,'Guarana Fantastica',3.60,10,0.00),(293,'Rhonbrau Klosterbier',6.20,6,0.00),(293,'Vegie-spread',35.10,5,0.00),(294,'Alice Mutton',31.20,15,0.00),(294,'Camembert Pierrot',27.20,21,0.00),(294,'Chai',14.40,18,0.00),(294,'Ipoh Coffee',36.80,15,0.00),(294,'Rhonbrau Klosterbier',6.20,6,0.00),(295,'Gnocchi di nonna Alice',30.40,4,0.00),(296,'Gudbrandsdalsost',28.80,15,0.00),(296,'Pavlova',13.90,30,0.00),(296,'Queso Cabrales',16.80,12,0.00),(297,'Inlagd Sill',14.40,60,0.00),(297,'Mozzarella di Giovanni',27.80,20,0.00),(298,'Chang',15.20,40,0.00),(298,'Inlagd Sill',15.20,40,0.25),(298,'Raclette Courdavault',44.00,30,0.25),(298,'Tarte au sucre',39.40,15,0.00),(299,'Outback Lager',12.00,20,0.00),(299,'Teatime Chocolate Biscuits',7.30,15,0.00),(300,'Louisiana Hot Spiced Okra',13.60,30,0.00),(300,'Scottish Longbreads',10.00,20,0.00),(301,'Boston Crab Meat',14.70,10,0.00),(301,'Gnocchi di nonna Alice',30.40,20,0.00),(302,'Alice Mutton',31.20,40,0.00),(302,'Ipoh Coffee',36.80,12,0.00),(302,'Rossle Sauerkraut',36.40,28,0.00),(303,'Boston Crab Meat',14.70,40,0.10),(303,'Louisiana Fiery Hot Pepper Sauce',16.80,30,0.10),(303,'Scottish Longbreads',10.00,15,0.10),(304,'Flotemysost',17.20,2,0.00),(304,'Maxilaku',16.00,30,0.00),(304,'Raclette Courdavault',44.00,10,0.00),(305,'Carnarvon Tigers',50.00,25,0.10),(305,'Inlagd Sill',14.40,30,0.10),(305,'Thuringer Rostbratwurst',99.00,25,0.10),(306,'Nord-Ost Matjeshering',20.70,10,0.00),(306,'Perth Pasties',26.20,10,0.00),(306,'Tourtiere',5.90,5,0.00),(307,'Scottish Longbreads',10.00,3,0.00),(307,'Tarte au sucre',39.40,10,0.00),(308,'Gudbrandsdalsost',28.80,1,0.00),(308,'Outback Lager',12.00,5,0.00),(309,'Chef Anton\'s Cajun Seasoning',17.60,20,0.00),(309,'Flotemysost',17.20,3,0.00),(309,'Grandma\'s Boysenberry Spread',20.00,30,0.00),(309,'Ipoh Coffee',36.80,20,0.00),(309,'Singaporean Hokkien Fried Mee',11.20,2,0.00),(310,'Pavlova',13.90,10,0.00),(310,'Tarte au sucre',39.40,5,0.00),(311,'Gudbrandsdalsost',28.80,7,0.00),(311,'Singaporean Hokkien Fried Mee',11.20,6,0.00),(312,'Ipoh Coffee',36.80,24,0.00),(312,'Perth Pasties',26.20,20,0.00),(312,'Rhonbrau Klosterbier',6.20,10,0.00),(312,'Rossle Sauerkraut',36.40,4,0.00),(313,'Inlagd Sill',15.20,12,0.00),(314,'Escargots de Bourgogne',10.60,30,0.10),(314,'Mascarpone Fabioli',25.60,40,0.10),(314,'Tarte au sucre',39.40,25,0.10),(315,'Outback Lager',12.00,30,0.00),(315,'Sasquatch Ale',11.20,14,0.00),(316,'Jack\'s New England Clam Chowder',7.70,10,0.00),(316,'Tarte au sucre',39.40,70,0.00),(317,'Chai',14.40,20,0.00),(318,'Jack\'s New England Clam Chowder',7.70,15,0.00),(318,'Lakkalikoori',14.40,6,0.00),(319,'Alice Mutton',31.20,8,0.00),(319,'Lakkalikoori',14.40,30,0.00),(319,'Rossle Sauerkraut',36.40,14,0.00),(320,'Flotemysost',17.20,30,0.00),(321,'Steeleye Stout',14.40,10,0.00),(322,'Filo Mix',5.60,15,0.00),(323,'Genen Shouyu',12.40,5,0.00),(323,'Grandma\'s Boysenberry Spread',11.20,4,0.00),(323,'Inlagd Sill',14.40,4,0.00),(324,'Pavlova',13.90,21,0.15),(324,'Raclette Courdavault',44.00,40,0.15),(324,'Spegesild',9.60,30,0.00),(324,'Steeleye Stout',14.40,70,0.15),(324,'Vegie-spread',35.10,80,0.15),(325,'Gorgonzola Telino',10.00,4,0.00),(325,'Grandma\'s Boysenberry Spread',25.30,6,0.00),(325,'Konbu',4.80,12,0.00),(325,'Mozzarella di Giovanni',27.80,40,0.00),(325,'Tofu',18.60,9,0.00),(326,'Chef Anton\'s Cajun Seasoning',17.60,24,0.00),(326,'Ravioli Angelo',15.60,16,0.00),(326,'Rhonbrau Klosterbier',6.20,50,0.00),(327,'Chang',15.20,25,0.20),(327,'Escargots de Bourgogne',10.60,30,0.20),(327,'Nord-Ost Matjeshering',20.70,35,0.20),(327,'Queso Cabrales',16.80,50,0.20),(328,'Louisiana Fiery Hot Pepper Sauce',16.80,40,0.00),(328,'Raclette Courdavault',44.00,9,0.00),(328,'Scottish Longbreads',10.00,10,0.00),(329,'Côte de Blaye',210.80,20,0.05),(329,'Gnocchi di nonna Alice',30.40,12,0.05),(329,'Nord-Ost Matjeshering',20.70,8,0.05),(329,'Teatime Chocolate Biscuits',7.30,10,0.05),(330,'Gumbar Gummibarchen',24.90,50,0.15),(330,'Mozzarella di Giovanni',27.80,25,0.15),(331,'Tourtiere',5.90,15,0.00),(332,'Carnarvon Tigers',50.00,40,0.20),(332,'Singaporean Hokkien Fried Mee',11.20,10,0.20),(332,'Zaanse koeken',7.60,16,0.20),(333,'Flotemysost',17.20,40,0.10),(333,'Sir Rodney\'s Scones',8.00,10,0.10),(333,'Tofu',18.60,10,0.00),(334,'Filo Mix',5.60,8,0.00),(334,'Scottish Longbreads',10.00,10,0.00),(335,'Chang',15.20,7,0.20),(335,'Gorgonzola Telino',10.00,25,0.20),(335,'Manjimup Dried Apples',42.40,48,0.20),(335,'Mascarpone Fabioli',25.60,6,0.20),(336,'Chef Anton\'s Cajun Seasoning',17.60,18,0.10),(337,'Gravad lax',20.80,28,0.00),(337,'Gumbar Gummibarchen',24.90,24,0.00),(337,'Inlagd Sill',15.20,20,0.00),(337,'Mozzarella di Giovanni',27.80,25,0.00),(337,'Tunnbrod',7.20,40,0.00),(338,'Alice Mutton',31.20,20,0.00),(338,'Uncle Bob\'s Organic Dried Pears',20.70,15,0.00),(339,'Alice Mutton',31.20,70,0.05),(339,'Chef Anton\'s Cajun Seasoning',17.60,10,0.00),(339,'Tarte au sucre',39.40,28,0.00),(340,'Carnarvon Tigers',50.00,20,0.05),(340,'Ipoh Coffee',36.80,40,0.05),(340,'Jack\'s New England Clam Chowder',7.70,12,0.05),(341,'Geitost',2.00,8,0.00),(341,'Raclette Courdavault',44.00,9,0.15),(342,'Chang',15.20,24,0.20),(342,'Gorgonzola Telino',10.00,56,0.20),(343,'Pavlova',13.90,16,0.00),(343,'Queso Manchego La Pastora',30.40,15,0.00),(343,'Wimmers gute Semmelknodel',26.60,6,0.00),(344,'Longlife Tofu',8.00,30,0.00),(345,'Chang',15.20,45,0.15),(345,'Pavlova',13.90,49,0.15),(345,'Sirop d\'erable',22.80,90,0.15),(345,'Thuringer Rostbratwurst',99.00,24,0.15),(346,'Louisiana Hot Spiced Okra',13.60,60,0.00),(346,'Queso Cabrales',16.80,30,0.00),(346,'Schoggi Schokolade',35.10,50,0.00),(346,'Tourtiere',5.90,80,0.00),(347,'Queso Cabrales',16.80,6,0.20),(348,'Alice Mutton',31.20,10,0.00),(348,'Rossle Sauerkraut',36.40,12,0.00),(349,'Gumbar Gummibarchen',24.90,15,0.00),(349,'Steeleye Stout',14.40,8,0.00),(350,'Guarana Fantastica',3.60,20,0.10),(350,'Inlagd Sill',14.40,6,0.00),(350,'Jack\'s New England Clam Chowder',7.70,30,0.00),(350,'Teatime Chocolate Biscuits',7.30,12,0.10),(350,'Tourtiere',5.90,15,0.00),(351,'Filo Mix',5.60,15,0.10),(351,'Gorgonzola Telino',10.00,3,0.10),(352,'Flotemysost',17.20,2,0.00),(352,'Louisiana Fiery Hot Pepper Sauce',16.80,35,0.00),(352,'Teatime Chocolate Biscuits',7.30,40,0.00),(353,'Gumbar Gummibarchen',24.90,6,0.00),(354,'Boston Crab Meat',14.70,20,0.00),(355,'Gnocchi di nonna Alice',24.80,14,0.00),(356,'Filo Mix',5.60,20,0.00),(357,'Ikura',24.80,20,0.20),(357,'Tarte au sucre',39.40,35,0.00),(358,'Pate chinois',19.20,120,0.10),(358,'Tourtiere',5.90,6,0.20),(359,'Wimmers gute Semmelknodel',26.60,35,0.10),(360,'Louisiana Fiery Hot Pepper Sauce',16.80,28,0.10),(361,'Original Frankfurter grune Sosse',10.40,55,0.10),(362,'Gula Malacca',15.50,100,0.05),(362,'Rossle Sauerkraut',36.40,15,0.00),(363,'Chocolade',10.20,15,0.10),(363,'Outback Lager',12.00,25,0.10),(364,'Geitost',2.00,20,0.20),(364,'Pavlova',13.90,20,0.20),(364,'Spegesild',9.60,10,0.20),(365,'Flotemysost',17.20,30,0.00),(365,'Inlagd Sill',14.40,20,0.00),(365,'Perth Pasties',26.20,50,0.00),(365,'Sirop d\'erable',22.80,25,0.00),(366,'Maxilaku',16.00,21,0.15),(366,'Sir Rodney\'s Scones',8.00,40,0.15),(367,'Raclette Courdavault',44.00,36,0.00),(368,'Flotemysost',17.20,50,0.00),(368,'Gnocchi di nonna Alice',30.40,15,0.00),(368,'Gumbar Gummibarchen',24.90,30,0.00),(368,'Ipoh Coffee',36.80,20,0.00),(368,'Rossle Sauerkraut',36.40,30,0.00),(369,'Mozzarella di Giovanni',27.80,40,0.00),(369,'Spegesild',9.60,20,0.05),(369,'Uncle Bob\'s Organic Dried Pears',24.00,16,0.05),(370,'Rhonbrau Klosterbier',6.20,4,0.25),(370,'Scottish Longbreads',10.00,21,0.25),(371,'Nord-Ost Matjeshering',20.70,28,0.25),(371,'Pate chinois',19.20,60,0.25),(371,'Sir Rodney\'s Scones',8.00,40,0.25),(372,'Konbu',4.80,1,0.00),(372,'Tunnbrod',7.20,21,0.00),(373,'Singaporean Hokkien Fried Mee',11.20,50,0.00),(373,'Teatime Chocolate Biscuits',7.30,21,0.00),(374,'Camembert Pierrot',27.20,20,0.00),(374,'Chef Anton\'s Cajun Seasoning',17.60,16,0.20),(374,'Gnocchi di nonna Alice',30.40,30,0.20),(374,'Ipoh Coffee',36.80,3,0.00),(375,'Boston Crab Meat',14.70,20,0.00),(375,'Guarana Fantastica',3.60,25,0.00),(375,'Rogede sild',7.60,30,0.10),(375,'Thuringer Rostbratwurst',99.00,18,0.10),(375,'Valkoinen suklaa',13.00,25,0.00),(378,'Ipoh Coffee',36.80,15,0.00),(378,'Nord-Ost Matjeshering',20.70,8,0.00),(379,'Chang',15.20,40,0.15),(379,'Gula Malacca',15.50,2,0.15),(379,'Pavlova',13.90,35,0.15),(380,'Carnarvon Tigers',50.00,30,0.00),(380,'Tunnbrod',7.20,15,0.00),(380,'Wimmers gute Semmelknodel',26.60,8,0.00),(381,'Gnocchi di nonna Alice',30.40,20,0.00),(381,'Uncle Bob\'s Organic Dried Pears',24.00,30,0.00),(382,'Guarana Fantastica',3.60,80,0.05),(382,'Manjimup Dried Apples',42.40,18,0.00),(383,'Flotemysost',17.20,12,0.00),(383,'Geitost',2.00,12,0.00);
/*!40000 ALTER TABLE `ag715` ENABLE KEYS */;
UNLOCK TABLES;
/*!40103 SET TIME_ZONE=@OLD_TIME_ZONE */;
/*!40101 SET SQL_MODE=@OLD_SQL_MODE */;
/*!40014 SET FOREIGN_KEY_CHECKS=@OLD_FOREIGN_KEY_CHECKS */;
/*!40014 SET UNIQUE_CHECKS=@OLD_UNIQUE_CHECKS */;
/*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */;
/*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */;
/*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */;
/*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */;
-- Dump completed on 2019-06-02 11:20:01
下面的也是HACKER脚本,以防万一我忽略了某些内容。
CREATE TABLE order_detail AS (SELECT * FROM ORDER_DETAIL);
DELETE FROM order_detail
WHERE order_id = 267;
INSERT INTO order_detail VALUES(249,'Singaporean Hokkien Fried Mee', 0.0, 0.0, 0.0);
DELETE FROM ORDER_DETAIL;
INSERT INTO ORDER_DETAIL( SELECT * FROM order_detail);
INSERT INTO ORDER_DETAIL VALUES(251, 'Manjimup Dried Apples', 0.0, 0.0, 0.0);
INSERT INTO ORDER_DETAIL VALUES(250, 'Singaporean Hokkien Fried Mee', 0.0, 0.0, 0.0);
UPDATE ORDER_DETAIL
SET unit_price = unit_price + 1, quantity = quantity + 1
WHERE order_id = 248;
DELETE FROM order_detail;
DROP TABLE order_detail;
COMMIT;
答案 0 :(得分:2)
我的问题是我的备份文件是否被正确修改,或者是否正确,并且在运行时删除了表ORDER_DETAIL的内容?
是的,备份脚本将删除ORDER_DETAIL
表(如果存在),然后再次重新创建该表。这就解释了为什么表为空。见下文:
DROP TABLE IF EXISTS `ORDER_DETAIL`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
SET character_set_client = utf8mb4 ;
CREATE TABLE `ORDER_DETAIL` (
...
然后在以下脚本上,查询将行插入到ag715
表中。解释了为什么在运行脚本后它有行。
尝试此操作,删除以下行:DROP TABLE IF EXISTS ORDER_DETAIL;
然后将您的CREATE TABLE ORDER_DETAIL (
修改为:
/*!40101 SET @saved_cs_client = @@character_set_client */;
SET character_set_client = utf8mb4 ;
CREATE TABLE IF NOT EXISTS `ORDER_DETAIL` (
答案 1 :(得分:1)
为此,创建新表可能不是您想要的!请查看诸如Percona xtrabackup之类的增量备份解决方案。 我不知道为什么要这样做,但是也许我应该警告您,如果您有一些企业任务,这不是检查数据库层中数据之间差异的正确方法!您应该在逻辑层(使用适当的编程语言或脚本工具)执行此类过程。