USER is a scalar SQL function/keyword that yields the identifier of the account under which the current session is running. It is frequently used for auditing, row-level security, and conditional logic. Depending on the DBMS, USER may be a reserved word (Oracle, PostgreSQL) or a built-in function that can be invoked with or without parentheses (MySQL, SQL Server). In Standard SQL it is synonymous with CURRENT_USER, but some systems make minor distinctions: SESSION_USER follows initial logon credentials while USER/CURRENT_USER may change after SET ROLE or SET SESSION AUTHORIZATION. USER never requires arguments and returns a string (or database identifier) typed as VARCHAR or identifier, limited by the maximum username length of the given system.
CURRENT_USER, SESSION_USER, SYSTEM_USER, CURRENT_ROLE, CURRENT_SCHEMA, CREATE USER
SQL-92 Standard
It returns the username under which the current SQL session is executing, usually a VARCHAR.
SESSION_USER remains fixed to the login identity, while USER/CURRENT_USER may change after SET ROLE or similar statements.
Oracle and PostgreSQL: no. MySQL and SQL Server: yes (USER()).
Yes. For example: `SELECT * FROM orders WHERE created_by = USER;`