Member-only story

Comprehensive Guide to SQL: List of Functions, Keywords, and Syntax Essentials

btd
5 min readNov 11, 2023

--

1. Aggregate Functions

  • COUNT(): Counts the number of rows.
  • SUM(): Calculates the sum of values in a column.
  • AVG(): Calculates the average of values in a column.
  • MIN(): Retrieves the minimum value in a column.
  • MAX(): Retrieves the maximum value in a column.

2. String Functions

  • CONCAT(): Concatenates two or more strings.
  • SUBSTRING(): Extracts a substring from a string.
  • UPPER(): Converts a string to uppercase.
  • LOWER(): Converts a string to lowercase.
  • LENGTH() or LEN(): Calculates the length of a string.
  • TRIM(): Removes leading and trailing spaces.
  • LEFT(), RIGHT(): Extracts characters from the left or right of a string.

3. Date and Time Functions

  • CURRENT_DATE: Returns the current date.
  • CURRENT_TIME: Returns the current time.
  • CURRENT_TIMESTAMP: Returns the current timestamp (date and time).
  • DATE(): Extracts the date part from a timestamp.

--

--

btd
btd

No responses yet