- 論壇徽章:
- 0
|
環(huán)境: win2000+MySQL5.0
用root在MySQL的數(shù)據(jù)庫orders里創(chuàng)建了一張視圖'details'
CREATE VIEW details (order_id, customer_id, employee_id, order_date, discount, paid,
quantity, product_name, price, company_name, reseller)
AS
SELECT o.order_id, o.customer_id, o.employee_id, o.order_date, o.discount, o.paid,
od.quantity, p.product_name, p.price, c.company_name, c.reseller
FROM orders o INNER JOIN
order_details od ON o.order_id = od.order_id INNER JOIN
products p ON od.product_id = p.product_id INNER JOIN
customers c ON o.customer_id = c.customer_id
WHERE (o.customer_id < 10)
然后是用mysqldump導(dǎo)出數(shù)據(jù)庫。
mysqldump -u root -p 123456 orders > d:\\orders.sql
進(jìn)入MySQL,刪除數(shù)據(jù)庫orders,將orders.sql導(dǎo)回。
發(fā)現(xiàn)視圖details已經(jīng)不能get到數(shù)據(jù)。
打開orders.sql,發(fā)現(xiàn)這一段:
-- Table structure for table `details`
--
DROP TABLE IF EXISTS `details`;
/*!50001 DROP VIEW IF EXISTS `details`*/;
/*!50001 DROP TABLE IF EXISTS `details`*/;
/*!50001 CREATE TABLE `details` (
`order_id` int(10),
`customer_id` tinyint(2),
`employee_id` tinyint(2),
`order_date` date,
`discount` decimal(2,2),
`paid` varchar(5),
`quantity` tinyint(2),
`product_name` varchar(40),
`price` decimal(6,2),
`company_name` varchar(50),
`reseller` varchar(5)
) */;
--
也就是說沒有給我還原回去我創(chuàng)建的那個(gè)view,只是創(chuàng)建了一個(gè)空的table.
請求各位幫幫忙,該怎樣在MySQL里導(dǎo)出一個(gè)view,使得還原回去還是好好的。
謝謝了! |
|