SAP Knowledge Base Article - Preview

3443706 - Expectations regarding the result of "SELECT *" and "SELECT COUNT(*)" in the context of SAP HANA for tables and views

Symptom

  • The expectation regarding the following queries in case of database table:
      SELECT * FROM <table_name>                 - - > list all rows from the table, the number of rows = X
      SELECT COUNT(*) FROM <table_name>  - - > return the total number of rows = X from the table
    When you run the above queries on the same table, the result for the number of rows should return the same number (X = X).

  • The expectation regarding the following queries in case of database view:
      SELECT * FROM <view_name>                 - - > list all rows from the view, the number of rows = X
      SELECT COUNT(*) FROM <view_name>  - - > return the total number of rows = X from the view
    When you run the above queries on the same view, the result for the number of rows should return the same number (X = X).

  • For views, expectations are not always met when executing SQL statements. Views could behave strangely.

  • For views, the number of rows not equal in case of the above SQL statements.


Read more...

Environment

SAP HANA, platform edition

Product

SAP HANA, platform edition all versions

Keywords

SAP, HANA, db, database, table, tables, view, views, select, *, count(*), count, number, of, rows, rowcount, different, result , KBA , HAN-DB , SAP HANA Database , How To

About this page

This is a preview of a SAP Knowledge Base Article. Click more to access the full version on SAP for Me (Login required).

Search for additional results

Visit SAP Support Portal's SAP Notes and KBA Search.