---
layout: global
title: Reference
displayTitle: Reference
license: |
  Licensed to the Apache Software Foundation (ASF) under one or more
  contributor license agreements.  See the NOTICE file distributed with
  this work for additional information regarding copyright ownership.
  The ASF licenses this file to You under the Apache License, Version 2.0
  (the "License"); you may not use this file except in compliance with
  the License.  You may obtain a copy of the License at
 
     http://www.apache.org/licenses/LICENSE-2.0
 
  Unless required by applicable law or agreed to in writing, software
  distributed under the License is distributed on an "AS IS" BASIS,
  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  See the License for the specific language governing permissions and
  limitations under the License.
---

Spark SQL is Apache Spark's module for working with structured data.
This guide is a reference for Structured Query Language (SQL) for Apache 
Spark. This document describes the SQL constructs supported by Spark in detail
along with usage examples when applicable.

---
layout: global
title: SQL Reference
displayTitle: SQL Reference
license: |
  Licensed to the Apache Software Foundation (ASF) under one or more
  contributor license agreements.  See the NOTICE file distributed with
  this work for additional information regarding copyright ownership.
  The ASF licenses this file to You under the Apache License, Version 2.0
  (the "License"); you may not use this file except in compliance with
  the License.  You may obtain a copy of the License at
 
     http://www.apache.org/licenses/LICENSE-2.0
 
  Unless required by applicable law or agreed to in writing, software
  distributed under the License is distributed on an "AS IS" BASIS,
  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  See the License for the specific language governing permissions and
  limitations under the License.
---

Spark SQL is Apache Spark's module for working with structured data. This guide is a reference for Structured Query Language (SQL) and includes syntax, semantics, keywords, and examples for common SQL usage. It contains information for the following topics:

 * [Data Types](sql-ref-datatypes.html)
 * [Identifiers](sql-ref-identifier.html)
 * [Literals](sql-ref-literals.html)
 * [Null Semanitics](sql-ref-null-semantics.html)
 * [ANSI Compliance](sql-ref-ansi-compliance.html)
 * [SQL Syntax](sql-ref-syntax.html)
   * [DDL Statements](sql-ref-syntax-ddl.html)
   * [DML Statements](sql-ref-syntax-ddl.html)
   * [Data Retrieval Statements](sql-ref-syntax-qry.html)
   * [Auxiliary Statements](sql-ref-syntax-aux.html)
 * [Functions](sql-ref-functions.html)
   * [Built-in Functions](sql-ref-functions-builtin.html)
   * [Scalar User-Defined Functions (UDFs)](sql-ref-functions-udf-scalar.html)
   * [User-Defined Aggregate Functions (UDAFs)](sql-ref-functions-udf-aggregate.html)
   * [Integration with Hive UDFs/UDAFs/UDTFs](sql-ref-functions-udf-hive.html)
 * [Datetime Pattern](sql-ref-datetime-pattern.html)

Add links to subsections in SQL Reference main page
[SPARK-31569][SQL][DOCS] Add links to subsections in SQL Reference main page

### What changes were proposed in this pull request?
Add links to subsections in SQL Reference main page

### Why are the changes needed?
Make SQL Reference complete

### Does this PR introduce any user-facing change?
Yes
before:
<img width="1050" alt="Screen Shot 2020-04-26 at 10 52 42 PM" src="https://user-images.githubusercontent.com/13592258/80338238-a9551080-8810-11ea-8ae8-d6707fde2cac.png">

after:
<img width="1050" alt="Screen Shot 2020-04-26 at 10 51 58 PM" src="https://user-images.githubusercontent.com/13592258/80338241-ac500100-8810-11ea-8518-95c4f8c0a2eb.png">

### How was this patch tested?
Manually build and check.

Closes #28360 from huaxingao/sql-ref.

Authored-by: Huaxin Gao <b1011540267ee7fe5a02243ad09c007ca1860809@us.ibm.com>
Signed-off-by: Sean Owen <d519fa33a62684a61ab04b24d26f83452d51b34c@gmail.com>
