Adding statistics for a column with update statistics

This command adds statistics for the price column in the titles table:

update statistics titles (price) 

This command specifies the number of histogram steps for a column:

update statistics titles (price) 
    using 50 values

This command adds a histogram for the titles.pub_id column and generates density values for the prefix subsets pub_id; pub_idpubdate; and pub_id, pubdate, title_id:

update statistics titles(pub_id, pubdate, title_id)

NoteRunning update statistics with a table name updates histograms and densities for leading columns for indexes only.

It does not update the statistics for unindexed columns.

To maintain these statistics, you must run update statistics and specify the column name, or run update all statistics.