Clustered vs non-clustered index in databases?
Clustered index files contain the primary key (or whatever search key) in some order, e.g. lowest ID to highest ID. This means you can perform searches like a binary tree search to get the direct pointer to the specific key in the table. From my understanding, this is not actually a separate file like other indexes. This is basically having a table in the DB ordered by one attribute, and searching on the table itself based on this ordering?
Non-clustered indexes are separate files. They don't have the same ordering as the table. i.e. the table itself might be like a heap order, but the non-clustered index will be ordered (depending on the attribute). Is this correct? But if that is the case, then wouldn't this also be good for binary tree searches?