tailieunhanh - creating your mysql database practical design tips and techniques phần 7

Chìa khóa nước ngoài trong car_event cũng có thể được xác định trong báo cáo ban đầu CREATE TABLE. Ví dụ trước đây được thực hiện bằng cách sử dụng ALTER TABLE để cho thấy rằng các phím nước ngoài có thể được thêm vào sau đó. | Simpo PDF Merge and Split Unregistered Version - http Data Structure Tuning KEY event_code event_code ENGINE InnoDB DEFAULT CHARSET latin1 INSERT INTO car_ event VALUES 412 2006-05-27 09 58 38 . 2 INSERT INTO car_ event VALUES 500 2006-05-29 16 37 46 1 INSERT INTO car_ event VALUES 600 2006-05-30 16 38 51 2 INSERT INTO car_ event VALUES 700 2006-05-31 16 39 21 2 We must have an index on the event_code column to be able to use it in an InnoDB foreign key constraint which is defined here ALTER TABLE car_event ADD CONSTRAINT car_event_ibfk_1 FOREIGN KEY event_code REFERENCES event code ON UPDATE CASCADE The foreign key in car_event can also be defined in the initial CREATE TABLE statement. The previous example was done using ALTER TABLE to show that foreign keys can be added later. All these operations can be handled in a more visual way via phpMyAdmin. The Operations sub-page enables us to switch the engine to InnoDB gg Server localhost Database marc ii Table event fnnoDB free 1413120 CB ỊjỊ Browse structure s SQL Search Reinsert flijExport Hjlmport -Altertable order by--------------------------- I code singly I Ascending Go I 56 Simpo PDF Merge and Split Unregistered Version - http Chapter 5 Also when the tables are under the innoDB storage engine phpMyAdmin s Relation view enables us to define and modify the foreign key and related actions Server localhost jltjj Database marc Table car_event Browse structure s SQL z Search Reinsert Export HI Import Operations jEmpty Drop rLinks to Internal relations p InnoDB internal_number p J 1 3 ON DELETE p J ON UPDATE 1 31 moment 1 - r 1 No index defined event_code 1 - 1 event- code 7 ON DELETE p J ON UPDATE Ễ CASCADE TH Choose field to display II J SET NULL NO ACTION RESTRICT Having defined this ON UPDATE CASCADE clause let s see what happens when we modify a code value in the event table. We decide that the code for washed should be 10 instead of 1 57 Simpo PDF Merge and Split Unregistered .

TỪ KHÓA LIÊN QUAN
crossorigin="anonymous">
Đã phát hiện trình chặn quảng cáo AdBlock
Trang web này phụ thuộc vào doanh thu từ số lần hiển thị quảng cáo để tồn tại. Vui lòng tắt trình chặn quảng cáo của bạn hoặc tạm dừng tính năng chặn quảng cáo cho trang web này.