Spark SQL Keywords

When spark.sql.ansi.enabled is true, Spark SQL will use the ANSI mode parser. In this mode, Spark SQL has two kinds of keywords:

When the ANSI mode is disabled, Spark SQL has two kinds of keywords:

By default spark.sql.ansi.enabled is false.

Below is a list of all the keywords in Spark SQL.

KeywordSpark SQLSQL-2011
ANSI modedefault mode
ADDnon-reservednon-reservednon-reserved
AFTERnon-reservednon-reservednon-reserved
ALLreservednon-reservedreserved
ALTERnon-reservednon-reservedreserved
ANALYZEnon-reservednon-reservednon-reserved
ANDreservednon-reservedreserved
ANTIreservedstrict-non-reservednon-reserved
ANYreservednon-reservedreserved
ARCHIVEnon-reservednon-reservednon-reserved
ARRAYnon-reservednon-reservedreserved
ASreservednon-reservedreserved
ASCnon-reservednon-reservednon-reserved
ATnon-reservednon-reservedreserved
AUTHORIZATIONreservednon-reservedreserved
BETWEENnon-reservednon-reservedreserved
BOTHreservednon-reservedreserved
BUCKETnon-reservednon-reservednon-reserved
BUCKETSnon-reservednon-reservednon-reserved
BYnon-reservednon-reservedreserved
CACHEnon-reservednon-reservednon-reserved
CASCADEnon-reservednon-reservedreserved
CASEreservednon-reservedreserved
CASTreservednon-reservedreserved
CHANGEnon-reservednon-reservednon-reserved
CHECKreservednon-reservedreserved
CLEARnon-reservednon-reservednon-reserved
CLUSTERnon-reservednon-reservednon-reserved
CLUSTEREDnon-reservednon-reservednon-reserved
CODEGENnon-reservednon-reservednon-reserved
COLLATEreservednon-reservedreserved
COLLECTIONnon-reservednon-reservednon-reserved
COLUMNreservednon-reservedreserved
COLUMNSnon-reservednon-reservednon-reserved
COMMENTnon-reservednon-reservednon-reserved
COMMITnon-reservednon-reservedreserved
COMPACTnon-reservednon-reservednon-reserved
COMPACTIONSnon-reservednon-reservednon-reserved
COMPUTEnon-reservednon-reservednon-reserved
CONCATENATEnon-reservednon-reservednon-reserved
CONSTRAINTreservednon-reservedreserved
COSTnon-reservednon-reservednon-reserved
CREATEreservednon-reservedreserved
CROSSreservedstrict-non-reservedreserved
CUBEnon-reservednon-reservedreserved
CURRENTnon-reservednon-reservedreserved
CURRENT_DATEreservednon-reservedreserved
CURRENT_TIMEreservednon-reservedreserved
CURRENT_TIMESTAMPreservednon-reservedreserved
CURRENT_USERreservednon-reservedreserved
DATAnon-reservednon-reservednon-reserved
DATABASEnon-reservednon-reservednon-reserved
DATABASESnon-reservednon-reservednon-reserved
DAYreservednon-reservedreserved
DAYSnon-reservednon-reservednon-reserved
DBPROPERTIESnon-reservednon-reservednon-reserved
DEFINEDnon-reservednon-reservednon-reserved
DELETEnon-reservednon-reservedreserved
DELIMITEDnon-reservednon-reservednon-reserved
DESCnon-reservednon-reservednon-reserved
DESCRIBEnon-reservednon-reservedreserved
DFSnon-reservednon-reservednon-reserved
DIRECTORIESnon-reservednon-reservednon-reserved
DIRECTORYnon-reservednon-reservednon-reserved
DISTINCTreservednon-reservedreserved
DISTRIBUTEnon-reservednon-reservednon-reserved
DIVnon-reservednon-reservednon-reserved
DROPnon-reservednon-reservedreserved
ELSEreservednon-reservedreserved
ENDreservednon-reservedreserved
ESCAPEreservednon-reservedreserved
ESCAPEDnon-reservednon-reservednon-reserved
EXCEPTreservedstrict-non-reservedreserved
EXCHANGEnon-reservednon-reservednon-reserved
EXISTSnon-reservednon-reservedreserved
EXPLAINnon-reservednon-reservednon-reserved
EXPORTnon-reservednon-reservednon-reserved
EXTENDEDnon-reservednon-reservednon-reserved
EXTERNALnon-reservednon-reservedreserved
EXTRACTnon-reservednon-reservedreserved
FALSEreservednon-reservedreserved
FETCHreservednon-reservedreserved
FIELDSnon-reservednon-reservednon-reserved
FILEFORMATnon-reservednon-reservednon-reserved
FIRSTnon-reservednon-reservednon-reserved
FIRST_VALUEreservednon-reservedreserved
FOLLOWINGnon-reservednon-reservednon-reserved
FORreservednon-reservedreserved
FOREIGNreservednon-reservedreserved
FORMATnon-reservednon-reservednon-reserved
FORMATTEDnon-reservednon-reservednon-reserved
FROMreservednon-reservedreserved
FULLreservedstrict-non-reservedreserved
FUNCTIONnon-reservednon-reservedreserved
FUNCTIONSnon-reservednon-reservednon-reserved
GLOBALnon-reservednon-reservedreserved
GRANTreservednon-reservedreserved
GROUPreservednon-reservedreserved
GROUPINGnon-reservednon-reservedreserved
HAVINGreservednon-reservedreserved
HOURreservednon-reservedreserved
HOURSnon-reservednon-reservednon-reserved
IFnon-reservednon-reservedreserved
IGNOREnon-reservednon-reservednon-reserved
IMPORTnon-reservednon-reservednon-reserved
INreservednon-reservedreserved
INDEXnon-reservednon-reservednon-reserved
INDEXESnon-reservednon-reservednon-reserved
INNERreservedstrict-non-reservedreserved
INPATHnon-reservednon-reservednon-reserved
INPUTFORMATnon-reservednon-reservednon-reserved
INSERTnon-reservednon-reservedreserved
INTERSECTreservedstrict-non-reservedreserved
INTERVALnon-reservednon-reservedreserved
INTOreservednon-reservedreserved
ISreservednon-reservedreserved
ITEMSnon-reservednon-reservednon-reserved
JOINreservedstrict-non-reservedreserved
KEYSnon-reservednon-reservednon-reserved
LASTnon-reservednon-reservednon-reserved
LAST_VALUEreservednon-reservedreserved
LATERALnon-reservednon-reservedreserved
LAZYnon-reservednon-reservednon-reserved
LEADINGreservednon-reservedreserved
LEFTreservedstrict-non-reservedreserved
LIKEnon-reservednon-reservedreserved
LIMITnon-reservednon-reservednon-reserved
LINESnon-reservednon-reservednon-reserved
LISTnon-reservednon-reservednon-reserved
LOADnon-reservednon-reservednon-reserved
LOCALnon-reservednon-reservedreserved
LOCATIONnon-reservednon-reservednon-reserved
LOCKnon-reservednon-reservednon-reserved
LOCKSnon-reservednon-reservednon-reserved
LOGICALnon-reservednon-reservednon-reserved
MACROnon-reservednon-reservednon-reserved
MAPnon-reservednon-reservednon-reserved
MATCHEDnon-reservednon-reservednon-reserved
MERGEnon-reservednon-reservednon-reserved
MICROSECONDnon-reservednon-reservednon-reserved
MICROSECONDSnon-reservednon-reservednon-reserved
MILLISECONDnon-reservednon-reservednon-reserved
MILLISECONDSnon-reservednon-reservednon-reserved
MINUSreservedstrict-non-reservednon-reserved
MINUTEreservednon-reservedreserved
MINUTESnon-reservednon-reservednon-reserved
MONTHreservednon-reservedreserved
MONTHSnon-reservednon-reservednon-reserved
MSCKnon-reservednon-reservednon-reserved
NAMESPACEnon-reservednon-reservednon-reserved
NAMESPACESnon-reservednon-reservednon-reserved
NATURALreservedstrict-non-reservedreserved
NOnon-reservednon-reservedreserved
NOTreservednon-reservedreserved
NULLreservednon-reservedreserved
NULLSnon-reservednon-reservednon-reserved
OFnon-reservednon-reservedreserved
ONreservedstrict-non-reservedreserved
ONLYreservednon-reservedreserved
OPTIONnon-reservednon-reservednon-reserved
OPTIONSnon-reservednon-reservednon-reserved
ORreservednon-reservedreserved
ORDERreservednon-reservedreserved
OUTnon-reservednon-reservedreserved
OUTERreservednon-reservedreserved
OUTPUTFORMATnon-reservednon-reservednon-reserved
OVERnon-reservednon-reservednon-reserved
OVERLAPSreservednon-reservedreserved
OVERLAYnon-reservednon-reservednon-reserved
OVERWRITEnon-reservednon-reservednon-reserved
PARTITIONnon-reservednon-reservedreserved
PARTITIONEDnon-reservednon-reservednon-reserved
PARTITIONSnon-reservednon-reservednon-reserved
PERCENTnon-reservednon-reservednon-reserved
PIVOTnon-reservednon-reservednon-reserved
PLACINGnon-reservednon-reservednon-reserved
POSITIONnon-reservednon-reservedreserved
PRECEDINGnon-reservednon-reservednon-reserved
PRIMARYreservednon-reservedreserved
PRINCIPALSnon-reservednon-reservednon-reserved
PROPERTIESnon-reservednon-reservednon-reserved
PURGEnon-reservednon-reservednon-reserved
QUERYnon-reservednon-reservednon-reserved
RANGEnon-reservednon-reservedreserved
RECORDREADERnon-reservednon-reservednon-reserved
RECORDWRITERnon-reservednon-reservednon-reserved
RECOVERnon-reservednon-reservednon-reserved
REDUCEnon-reservednon-reservednon-reserved
REFERENCESreservednon-reservedreserved
REFRESHnon-reservednon-reservednon-reserved
RENAMEnon-reservednon-reservednon-reserved
REPAIRnon-reservednon-reservednon-reserved
REPLACEnon-reservednon-reservednon-reserved
RESETnon-reservednon-reservednon-reserved
RESPECTnon-reservednon-reservednon-reserved
RESTRICTnon-reservednon-reservednon-reserved
REVOKEnon-reservednon-reservedreserved
RIGHTreservedstrict-non-reservedreserved
RLIKEnon-reservednon-reservednon-reserved
ROLEnon-reservednon-reservednon-reserved
ROLESnon-reservednon-reservednon-reserved
ROLLBACKnon-reservednon-reservedreserved
ROLLUPnon-reservednon-reservedreserved
ROWnon-reservednon-reservedreserved
ROWSnon-reservednon-reservedreserved
SCHEMAnon-reservednon-reservednon-reserved
SECONDreservednon-reservedreserved
SECONDSnon-reservednon-reservednon-reserved
SELECTreservednon-reservedreserved
SEMIreservedstrict-non-reservednon-reserved
SEPARATEDnon-reservednon-reservednon-reserved
SERDEnon-reservednon-reservednon-reserved
SERDEPROPERTIESnon-reservednon-reservednon-reserved
SESSION_USERreservednon-reservedreserved
SETnon-reservednon-reservedreserved
SETSnon-reservednon-reservednon-reserved
SHOWnon-reservednon-reservednon-reserved
SKEWEDnon-reservednon-reservednon-reserved
SOMEreservednon-reservedreserved
SORTnon-reservednon-reservednon-reserved
SORTEDnon-reservednon-reservednon-reserved
STARTnon-reservednon-reservedreserved
STATISTICSnon-reservednon-reservednon-reserved
STOREDnon-reservednon-reservednon-reserved
STRATIFYnon-reservednon-reservednon-reserved
STRUCTnon-reservednon-reservednon-reserved
SUBSTRnon-reservednon-reservednon-reserved
SUBSTRINGnon-reservednon-reservednon-reserved
TABLEreservednon-reservedreserved
TABLESnon-reservednon-reservednon-reserved
TABLESAMPLEnon-reservednon-reservedreserved
TBLPROPERTIESnon-reservednon-reservednon-reserved
TEMPORARYnon-reservednon-reservednon-reserved
TERMINATEDnon-reservednon-reservednon-reserved
THENreservednon-reservedreserved
TOreservednon-reservedreserved
TOUCHnon-reservednon-reservednon-reserved
TRAILINGreservednon-reservedreserved
TRANSACTIONnon-reservednon-reservednon-reserved
TRANSACTIONSnon-reservednon-reservednon-reserved
TRANSFORMnon-reservednon-reservednon-reserved
TRIMnon-reservednon-reservednon-reserved
TRUEnon-reservednon-reservedreserved
TRUNCATEnon-reservednon-reservedreserved
UNARCHIVEnon-reservednon-reservednon-reserved
UNBOUNDEDnon-reservednon-reservednon-reserved
UNCACHEnon-reservednon-reservednon-reserved
UNIONreservedstrict-non-reservedreserved
UNIQUEreservednon-reservedreserved
UNKNOWNreservednon-reservedreserved
UNLOCKnon-reservednon-reservednon-reserved
UNSETnon-reservednon-reservednon-reserved
UPDATEnon-reservednon-reservedreserved
USEnon-reservednon-reservednon-reserved
USERreservednon-reservedreserved
USINGreservedstrict-non-reservedreserved
VALUESnon-reservednon-reservedreserved
VIEWnon-reservednon-reservednon-reserved
WEEKnon-reservednon-reservednon-reserved
WEEKSnon-reservednon-reservednon-reserved
WHENreservednon-reservedreserved
WHEREreservednon-reservedreserved
WINDOWnon-reservednon-reservedreserved
WITHreservednon-reservedreserved
YEARreservednon-reservedreserved
YEARSnon-reservednon-reservednon-reserved