TAILIEUCHUNG - SQL VISUAL QUICKSTART GUIDE- P41

SQL VISUAL QUICKSTART GUIDE- P41:SQL (pronounced es-kyoo-el) is the standard programming language for creating, updating, and retrieving information that is stored in databases. With SQL, you can turn your ordinary questions (“Where do our customers live?”) into statements that your database system can understand (SELECT DISTINCT city, state FROM customers;) | Chapter 12 Creating an Index with CREATE INDEX Indexes aren t part of the SQL standard so index-related SQL statements vary by DBMS although the syntax for the minimal CREATE INDEX statement is the same for the DBMSs covered in this book. To create an index Type CREATE UNIQUE INDEX index ON table index_columns index is the name of the index to create and is a valid SQL identifier. Index names must be unique within a table. For Oracle DB2 and PostgreSQL index names must be unique within a database. table is the name of the table to create the index for and index_columns is a list of one or more comma-separated names of the columns to index. Specify UNIQUE to create a unique index. UNIQUE causes the DBMS to check for duplicates in index_columns. If table already contains rows with duplicates in index_columns the DBMS won t create the index. If you attempt to INSERT or UPDATE duplicate values in unique index_columns the DBMS generates an error and cancels the operation. Listing creates a simple index named pub_id_idx on the column pub_id for the table titles. pub_id is a foreign key and is a good candidate for an index because Changes to PRIMARY KEY constraints are checked with FOREIGN KEY constraints in related tables. Foreign-key columns often are used in join criteria when the data from related tables are combined in queries by matching the FOREIGN KEY column s of one table with the PRIMARY KEY or UNIQUE column s in the other table. Listing Create a simple index on the column pub_id for the table titles. Listing CREATE INDEX pub_id_idx ON titles pub_id 380 Indexes Listing Create a simple unique index on the column title_name for the table titles. Listing CREATE UNIQUE INDEX title_name_idx ON titles title_name Listing Create a composite index on the columns state and city for the table authors. Listing CREATE INDEX state_city_idx ON authors state city Listing creates a simple unique index named title_name_idx on the column title_name for the

TỪ KHÓA LIÊN QUAN
TAILIEUCHUNG - Chia sẻ tài liệu không giới hạn
Địa chỉ : 444 Hoang Hoa Tham, Hanoi, Viet Nam
Website : tailieuchung.com
Email : tailieuchung20@gmail.com
Tailieuchung.com là thư viện tài liệu trực tuyến, nơi chia sẽ trao đổi hàng triệu tài liệu như luận văn đồ án, sách, giáo trình, đề thi.
Chúng tôi không chịu trách nhiệm liên quan đến các vấn đề bản quyền nội dung tài liệu được thành viên tự nguyện đăng tải lên, nếu phát hiện thấy tài liệu xấu hoặc tài liệu có bản quyền xin hãy email cho chúng tôi.
Đã 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.