Hitachi

Hitachi Advanced Database SQL Reference


A. SQL Reverse Lookup Reference

The following table lists the relevant SQL syntax organized according to purpose.

Table A‒1: Relevant SQL syntax organized by purpose

No.

Category

Purpose

Relevant SQL syntax

1

Data retrieval

Retrieve data by specifying a range.

BETWEEN predicate

2

Retrieve data that matches any of multiple values.

IN predicate

3

Retrieve data that contains a specific character string.

LIKE predicate

4

Retrieve data by using a regular expression

LIKE_REGEX predicate

5

Retrieve null-valued data.

NULL predicate

6

Eliminate duplication in the retrieval results.

SELECT DISTINCT

7

Sort retrieval results in ascending or descending order.

ORDER BY clause

8

Specify the maximum number of rows in the retrieval results.

LIMIT clause

9

Re-use the same derived table within a SELECT statement.

WITH clause

10

Change a column name in the retrieval results.

AS clause

11

Retrieve by specifying multiple branch conditions.

CASE expression

12

Retrieve by joining multiple tables.

Joined tables

13

Perform a subquery.

Subquery

14

EXISTS predicate

15

IN predicate

16

Comparison predicate

17

Quantified predicate

18

Create the union of query results from multiple tables.

UNION ALL

UNION DISTINCT

19

Data deletion

Delete all the rows in a base table.

TRUNCATE TABLE statement

20

Delete all the rows in a chunk in a base table.

PURGE CHUNK statement

21

Data aggregation

Determine the sum of retrieved values.

General set function SUM

22

Determine the maximum value.

General set function MAX

23

Determine the minimum value.

General set function MIN

24

Determine the average of retrieved values.

General set function AVG

25

Determine the row count (number of results)

General set function COUNT

26

Set function COUNT(*)

27

Determine the standard deviation of a population.

General set function STDDEV_POP

28

Determine the standard deviation of a sample.

General set function STDDEV_SAMP

29

Determine the variance of a population.

General set function VAR_POP

30

Determine the variance of a sample.

General set function VAR_SAMP

31

Determine the median of an ordered set of values.

Inverse distribution function MEDIAN

32

Determine the percentile of an ordered set of values.

Inverse distribution function PERCENTILE_CONT

33

Inverse distribution function PERCENTILE_DISC

34

Set a range in which to aggregate data.

Window functions

35

Aggregate the data into groups.

GROUP BY clause

36

HAVING clause

37

Character strings

Check whether the target data contains character strings that meet the search condition expression.

Scalar function CONTAINS

38

Concatenate two character string data items.

Scalar function CONCAT

39

Concatenation operations

40

Remove specific characters from character string data.

Scalar function TRIM

41

Scalar function LTRIM

42

Scalar function RTRIM

43

Extract a substring from character string data.

Scalar function SUBSTR

44

Scalar function LEFT

45

Scalar function RIGHT

46

Pad the beginning or end of character string data with any specified character string.

Scalar function LPAD

47

Scalar function RPAD

48

Replace any character string in the target data.

Scalar function REPLACE

49

Replace any character in character string data.

Scalar function TRANSLATE

50

Determine the number of characters in character string data.

Scalar function LENGTH

51

Search the target data for a character string and return the starting position of the string.

Scalar function INSTR

52

Convert uppercase letters to lowercase.

Scalar function LOWER

53

Convert lowercase letters to uppercase.

Scalar function UPPER

54

Binary data

Concatenate two binary data items.

Scalar function CONCAT

55

Extract a substring from binary data.

Scalar function SUBSTRB

56

Determine the value resulting from shifting the bits of a binary data value to the left.

Scalar function BITLSHIFT

57

Determine the value resulting from shifting the bits of a binary data value to the right.

Scalar function BITRSHIFT

58

Determine the bitwise logical AND of two binary data items.

Scalar function BITAND

59

Determine the bitwise inclusive OR of two binary data items.

Scalar function BITOR

60

Determine the bitwise logical NOT of a binary data item.

Scalar function BITNOT

61

Determine the bitwise exclusive OR of two binary data items.

Scalar function BITXOR

62

Convert binary data to a binary string representation (character string data consisting of 0 and 1).

Scalar function BIN

63

Convert binary data to a hex string representation (character string data consisting of 0 to 9, and A to F).

Scalar function HEX

64

Numerical calculations

Determine the remainder after a division.

Scalar function MOD

65

Determine the absolute value.

Scalar function ABS

66

Determine the square root.

Scalar function SQRT

67

Determine the sign of the data (positive, negative, or 0).

Scalar function SIGN

68

Determine pseudorandom numbers that follow a uniform distribution and are greater than or equal to the value specified for the minimum value and less than the value specified for the maximum value.#

Scalar function RANDOM

69

Scalar function RANDOMCURSOR

70

Scalar function RANDOMROW

71

Determine pseudorandom numbers that follow a normal distribution with an average μ, and a standard deviation σ.

Scalar function RANDOM_NORMAL

72

Rounding

Round off a numeric value.

Scalar function ROUND

73

Truncate a numeric value.

Scalar function TRUNC

74

Determine the greatest integer that is equal to or less than the specified numeric value.

Scalar function FLOOR

75

Determine the smallest integer that is equal to or greater than the specified numeric value.

Scalar function CEIL

76

Exponent and logarithm

Determine a power of the specified data.

Scalar function POWER

77

Determine the logarithm of the specified antilogarithm and base.

Scalar function LOG

78

Determine the natural logarithm.

Scalar function LN

79

Determine a power of the base of the natural logarithm.

Scalar function EXP

80

Trigonometric functions

Determine the sine (SIN trigonometric function).

Scalar function SIN

81

Determine the cosine (COS trigonometric function).

Scalar function COS

82

Determine the tangent (TAN trigonometric function).

Scalar function TAN

83

Determine the inverse sine (inverse trigonometric function).

Scalar function ASIN

84

Determine the inverse cosine (inverse trigonometric function).

Scalar function ACOS

85

Determine the inverse tangent (inverse trigonometric function).

Scalar function ATAN

86

Scalar function ATAN2

87

Determine the hyperbolic sine.

Scalar function SINH

88

Determine the hyperbolic cosine.

Scalar function COSH

89

Determine the hyperbolic tangent.

Scalar function TANH

90

Convert an angle from radians to degrees.

Scalar function DEGREES

91

Convert an angle from degrees to radians.

Scalar function RADIANS

92

Determine the value of [Figure].

Scalar function PI

93

Date and time

Extract a portion of a date or time (for example, extract only the month).

Scalar function EXTRACT

94

Given a date, determine the ordinal number of the date in the year.

Scalar function DAYOFYEAR

95

Given a date, determine what day of week it falls on as an ordinal number from the first day in the week.

Scalar function DAYOFWEEK

96

Determine the date of the last day of the specified month.

Scalar function LASTDAY

97

Determine the difference between the start date and time and the end date and time.

Scalar function DATEDIFF

98

Determine a person's age on a reference date given their birth date.

Scalar function GETAGE

99

Round a date by the year, month, day, hour, or second.

Scalar function ROUND

100

Truncate a date by the year, month, day, hour, or second.

Scalar function TRUNC

101

Determine the current date.

Datetime information acquisition function CURRENT_DATE

102

Determine the current time.

Datetime information acquisition function CURRENT_TIME

103

Determine the current data and time stamp.

Datetime information acquisition function CURRENT_TIMESTAMP

104

Perform operations on datetime data.

Datetime operations

105

Labeled duration

106

Null value

Determine the first non-null value among the specified data.

Scalar function COALESCE

107

Scalar function ISNULL

108

Scalar function NVL

109

Data comparison

Determine whether two data items are equal.

Scalar function NULLIF

110

Compare the values in the target data and the comparison data one at a time, and if there is a match, return the corresponding return value.

Scalar function DECODE

111

Compare the values in the target data and in the comparison data one at a time, and, if any value in the target data is less than the value in the comparison data, return the corresponding return value.

Scalar function LTDECODE

112

Determine the greatest value.

Scalar function GREATEST

113

Determine the smallest value.

Scalar function LEAST

114

Data types

Convert the data type.

Scalar function CAST

115

Scalar function CONVERT

116

Data information acquisition

Determine the number of bytes in the target data.

Scalar function LENGTHB

117

Determine the character code of the first character of character string data.

Scalar function ASCII

118

Determine the character corresponding to numeric value character code in the target data.

Scalar function CHR

119

User information

Determine the authorization identifier of the currently executing HADB user.

User information acquisition function CURRENT_USER

#

There are differences in specifications among the scalar functions RANDOM, RANDOMCURSOR, and RANDOMROW. For details about the differences in specifications, see (6) List of scalar functions that return pseudorandom numbers in 8.4.5 RANDOM.