tailieunhanh - Java Data Access—JDBC, JNDI, and JAXP phần 2
Bạn không thể thả các bảng Đến từ mà không bị một lỗi cơ sở dữ liệu, làm như vậy phá vỡ các ràng buộc toàn vẹn tham chiếu. Để loại bỏ các bảng Đến từ bạn cần phải hoặc là phá vỡ mối quan hệ hoặc thả các bảng nhân viên đầu tiên. | Chapter 2 A Relational Database Primer The syntax for the DROP statement is simple DROP object The following snippet removes the Employees table from the database DROP Employees As with the ALTER command you need to respect the integrity rules of the database before issuing the DROP statement. For example you cannot drop a base table that provides foreign keys to a relational table. Consider the Employees-Location relationship shown in Figure 2-9. You cannot drop the Location table without incurring a database error as doing so breaks the referential integrity constraint. To remove the Location table you need to either break the relationship or drop the Employees table first. To break the relationship you can use the CASCADE CONSTRAINTS keyword along with the DROP statement. This keyword removes the integrity constraints associated with the table so you can remove it. Therefore to remove the Location table you issue the following command DROP Location CASCADE CONSTAINTS Because the DROP statement permanently removes a structure use it with caution. Contact your DBA to ensure a valid backup exists before issuing the DROP statement against any mission-critical table. That table does not have to be a production table development tables are just as valuable. Especially once you get everything working the way you want if that ever occurs. Summary The RDBMS plays a major role in enterprises today by storing mission-critical data used to make business decisions or generate revenue. As a developer you will likely build an application that will interact with database in some manner. This chapter serves as a refresher on relational database systems. In it I covered The basics of the RDBMS architecture Entity and referential integrity constraints SQL DML and DDL statements Although not a treatise on SQL this chapter should provide the essentials to help revive your SQL knowledge. Now let s move on to JDBC programming. 28 Part II Understanding JDBC Programming Basics Chapter .
đang nạp các trang xem trước