SQL Reference
Table Of Contents
- Chapter 1 Introduction
- Chapter 2 Supported standards
- Support for Unicode characters
- SQL statements
- SELECT statement
- SQL clauses
- FROM clause
- WHERE clause
- GROUP BY clause
- HAVING clause
- UNION operator
- ORDER BY clause
- OFFSET and FETCH FIRST clauses
- FOR UPDATE clause
- DELETE statement
- INSERT statement
- UPDATE statement
- CREATE TABLE statement
- TRUNCATE TABLE statement
- ALTER TABLE statement
- CREATE INDEX statement
- DROP INDEX statement
- SQL expressions
- SQL functions
- FileMaker system objects
- Reserved SQL keywords
- Index
Chapter 2 | Supported standards 33
Functions that return dates
Functions that return
dates Description Example
CURDATE
CURRENT_DATE
Returns today’s date
CURTIME
CURRENT_TIME
Returns the current time
CURTIMESTAMP
CURRENT_TIMESTAMP
Returns the current timest
amp value
TIMESTAMPVAL Converts a character string to a
timest
amp
TIMESTAMPVAL('2016-01-30 14:00:00')
returns its timestamp value
DATE
TODAY
Returns today’s date If today is 11/21/2016, DATE
() returns 2016-11-21
DATEVAL Converts a character string to a date DATEVAL('2016-01-30')
returns 2016-01-30
Note The DATE() function is deprecated. Use the SQL standard CURRENT_DATE instead.
Conditional functions
Conditional
functions Description Example
CASE WHEN Simple CASE format
Compares the value of input_ex
p to the values
of value_exp arguments to determine the result.
CASE i
nput_exp
{WHEN val
ue_exp THEN result...} [ELSE
result]
END
SELECT
Invoice_ID,
CASE Company_Name
WHEN 'Exports UK' THEN
'Expo
rts UK Found'
WHEN 'Home Furniture
Suppl
iers' THEN 'Home Furniture
Suppliers Found'
ELSE 'Neither Exports UK
nor H
ome Furniture Suppliers'
END,
Salesperson_ID
FROM
Sales_Data
Searched CASE format
Returns a result based on whethe
r the condition
specified by a WHEN expression is true.
CASE
{WHEN bo
olean_exp THEN result...} [ELSE
result]
END
SELECT
Invoice_ID,
Amount,
CASE
WHEN Amount > 3000 THEN 'Above
3000'
WHEN Amount < 1000 THEN 'Below
3000'
ELSE 'Between 1000 and 3000'
END,
Salesperson_ID
FROM
Sales_Data