11. PSEUDO COLUMNS

PSEUDO COLUMNS:

    They are the false columns or dummy columns which behaves as same to that of table columns. They are actually functions.

  •          SYSDATE
  •      ROWNUM
  •         ROWID
  •         USER
  •      UID
  •      LEVEL
  •      NEXTVAL
  •         CURRVAL
  •      CONNECT_BY_ISLEAF
  •      CONNECT_BY_ISCYCLE
  •          XML PSEUDO COLUMNS
  •      COLUMN_VALUE
  •      OBJECT_VALUE
        SYSDATE: Displays the system date or server date

            EG:  SELECT SYSDATEL, ENAME FROM EMP;

                   SELECT SYSDATE FROM EMP;

                   SELECT SYSDATE FROM DUAL;
                
                 ROWNUM:
  •          ROWNUM provides the sequential number to the rows.
  •      They are temporary numbers only to that query

 ROWID:
  •          It is the physical address of the row
  •          It is  in  hexadecimal ,generated for each of the row useful to identify the records and to increase the performance and they are permanent
  •           They differ even for duplicate records also

EG:  SELECT ROWID, EMP.* FROM EMP;

       DELETE FROM EMP WHERE ROWID=’ROWIDVALUE’;

       SELECT * FROM EMP WHERE ROWID=’ROWIDVALUE;

Note: Indexes will make use of ROWID to increase the performance

   USER AND UID: They specify username and USERID


                 SELECT USER, UID FROM DUAL;

No comments:

Post a Comment