Free Trial

Safari Books Online is a digital library providing on-demand subscription access to thousands of learning resources.

Share this Page URL

CHAPTER 5 Constraints > Primary Key Constraints - Pg. 134

Chapter 5: 5 6 7 8 9 10 , , FROM ON AND WHERE uic.column_position uic.column_name user_indexes ui JOIN user_ind_columns uic uic.index_name = ui.index_name uic.table_name = ui.table_name ui.uniqueness = 'UNIQUE'; Constraints 107 You would find the non-unique indexes with the following change of line 10: 10 WHERE ui.uniqueness = 'NONUNIQUE'; You also have the right to drop (or remove) indexes without modifying the table that the indexes organize. This is possible because no UNIQUE constraint is dependent on the unique index. MySQL Unique Indexes A MySQL unique index is indistinguishable from a UNIQUE constraint. In fact, you use virtually the same syntax to create or drop the index. Chapter 6 shows you how to create indexes and Chapter 7 shows you how to drop unique indexes. Feel free to flip there if you want to see the syntax now, but the differences are in the words KEY and INDEX. A CREATE statement that adds a UNIQUE table constraint excludes the word INDEX, while a constraint of a unique index uses the word INDEX. You can use the query from the "MySQL UNIQUE Constraints" section because keys and indexes are stored in the same tables.