Đang chuẩn bị liên kết để tải về tài liệu:
PHP 5/MySQL Programming- P81

Không đóng trình duyệt đến khi xuất hiện nút TẢI XUỐNG

PHP 5/MySQL Programming- P81:computer programming has often been seen as a difficult and arcane skill. Programming languages are difficult and complicated, out of the typical person’s reach. However, the advent of the World Wide Web has changed that to some extent. It’s reasonably easy to build and post a Web page for the entire world to see. The language of the Web is reasonably simple, and numerous applications are available to assist in the preparation of static pages | 378 PHP 5 MySQL Programming for the Absolute Beginner Table 11.7 The specialty Specialty ID Name 0 Electronics 1 Counterintelligence 2 Sabotage 3 Doily Design 4 Explosives 5 Flower Arranging Table 11.8 The agent specialt Agent Specialty ID Agent ID Specialty ID 1 1 2 2 1 3 3 2 1 4 2 6 5 3 2 6 4 4 7 4 5 Interpreting the agent_specialty Table with a Query Of course the agent_specialty table is not directly useful to the user because it contains nothing but foreign key references. You can translate the data to something more meaningful with an SQL statement SELECT agent_specialtyID agent.name AS agent specialty.name AS specialty FROM agent_specialty agent specialty WHERE agent.agentID agent_specialty.agentID AND specialty.specialtylD agent_specialty.specialtyID It requires two comparisons to join the three tables. It is necessary to forge the relationship between agent and agent_specialty by common agentID values. It s also necessary to secure the bond between specialty and agent_specialty by comparing the specialtylD fields. The results of such a query show that the correct relationships have indeed been joined as you can see in Table 11.9. Table 11.9 Query AGENT SPECI Interpretation of alty Table Agent Specialty ID Agent Specialty 1 Bond Sabotage 2 Bond Doily Design 3 Falcon Counterintelligence 5 Cardinal Sabotage 6 Blackford Explosives 7 Blackford Flower Arranging Chapter 11 Data Normalization The link table provides the linkage between tables that have many-to-many relationships. Each time you want a new relationship between an agent and a specialty you add a new record to the agent_specialty table. Creating Queries That Use Link Tables Whenever you want to know about the relationships between agents and specialties the data is available in the agent_specialty table. For example if you need to know which agents know flower arranging you can use the following query SELECT agent.name FROM agent specialty agent_specialty WHERE agent.agentID agent_specialty.agentID .

TÀI LIỆU LIÊN QUAN
Đã 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.