Page 103 - CITS - Computer Software Application -TT
P. 103

COMPUTER SOFTWARE APPLICATION - CITS




           Example: COUNT()
           SELECT COUNT(*)
           FROM PRODUCT_GOOD;
           Output:
           10

           Example: COUNT with WHERE
           SELECT COUNT(*)
           FROM  PRODUCT_GOOD;
           WHERE RATE>=200;
           Output:

           7
           Example: COUNT() with DISTINCT
           SELECT COUNT(DISTINCT COMPANY)
           FROM PRODUCT_GOOD;
           Output:

           3
           Example: COUNT() with GROUP BY
           SELECT COMPANY, COUNT(*)
           FROM PRODUCT_GOOD

           Output:
           ComA    5
           ComB    3
           ComC    2
           Example: COUNT() with HAVING
           SELECT COMPANY, COUNT(*)

           SELECT COMPANY, COUNT(*)
           GRHAV2;
           Output:
           ComA    5

           ComB    3
           Indexing and Query Optimization


           Absolutely, your analogy of indexing to the index in a book is quite apt. It provides a clear and intuitive understanding
           of how indexing works in databases.

           In the context of databases, creating an index is akin to building a reference point for the data. Much like flipping
           through a book’s index to quickly locate information, a database index allows for the rapid retrieval of specific
           data  without  scanning  through  the  entire  dataset.  This  indexing  technique  significantly  enhances  the  speed
           and efficiency of queries, as the database can swiftly pinpoint the relevant information, leading to faster query
           performance.
           The intricacies of how databases achieve this efficiency through indexing can be explored further in the upcoming
           sections of your article.




                                                           90

                              CITS : IT&ITES - Computer software application - Lesson 18 - 36
   98   99   100   101   102   103   104   105   106   107   108