HomeData scienceTop10 SQL Capabilities for Knowledge Evaluation | by TechNikhil | Jan, 2024

Top10 SQL Capabilities for Knowledge Evaluation | by TechNikhil | Jan, 2024


COUNT():

  • Syntax: COUNT(expression)
  • Description: Counts the variety of rows in a end result set based mostly on the required expression.

SUM():

  • Syntax: SUM(expression)
  • Description: Calculates the sum of values in a numeric column based mostly on the required expression.

AVG():

  • Syntax: AVG(expression)
  • Description: Computes the typical of values in a numeric column based mostly on the required expression.

MIN():

  • Syntax: MIN(expression)
  • Description: Finds the minimal worth in a column based mostly on the required expression.

MAX():

  • Syntax: MAX(expression)
  • Description: Finds the utmost worth in a column based mostly on the required expression.

2. Mathematical Capabilities:

ROUND():

  • Syntax: ROUND(quantity, decimals)
  • Description: Rounds a numeric worth to the required variety of decimal locations.

CEIL() or CEILING():

  • Syntax: CEIL(quantity) or CEILING(quantity)
  • Description: Rounds a numeric worth as much as the closest integer.

FLOOR():

  • Syntax: FLOOR(quantity)
  • Description: Rounds a numeric worth all the way down to the closest integer.

ABS():

  • Syntax: ABS(quantity)
  • Description: Returns absolutely the worth of a numeric expression.

POWER():

  • Syntax: POWER(base, exponent)
  • Description: Raises a numeric worth to the facility of one other.

CONCAT() or CONCATENATE():

  • Syntax: CONCAT(string1, string2, …)
  • Description: Concatenates two or extra strings.

SUBSTRING() or SUBSTR():

  • Syntax: SUBSTRING(string, begin, size) or SUBSTR(string, begin)
  • Description: Extracts a substring from a string.

LENGTH() or LEN():

  • Syntax: LENGTH(string) or LEN(string)
  • Description: Returns the size of a string.

UPPER():

  • Syntax: UPPER(string)
  • Description: Converts a string to uppercase.

LOWER():

  • Syntax: LOWER(string)
  • Description: Converts a string to lowercase.

TRIM():

  • Syntax: TRIM([leading | trailing | both] characters FROM string)
  • Description: Removes main and/or trailing areas from a string.

NOW():

  • Syntax: NOW()
  • Description: Returns the present date and time.

DATE():

  • Syntax: DATE(datetime)
  • Description: Extracts the date portion from a datetime worth.

TIME():

  • Syntax: TIME(datetime)
  • Description: Extracts the time portion from a datetime worth.

DATEDIFF():

  • Syntax: DATEDIFF(interval, start_date, end_date)
  • Description: Calculates the distinction between two dates.

DATEADD():

  • Syntax: DATEADD(interval, worth, start_date)
  • Description: Provides a specified time interval to a date.

CASE WHEN():

WHEN condition1 THEN result1

WHEN condition2 THEN result2

ELSE else_result

END

  • Description: Performs conditional logic inside a question.

COALESCE():

  • Syntax: COALESCE(value1, value2, …)
  • Description: Returns the primary non-null expression in a listing.

ROW_NUMBER():

  • Syntax: ROW_NUMBER() OVER (PARTITION BY partition_column ORDER BY order_column)
  • Description: Assigns a novel quantity to every row inside a partition of a end result set.

RANK():

  • Syntax: RANK() OVER (PARTITION BY partition_column ORDER BY order_column)
  • Description: Assigns a rank to every row based mostly on the values in a number of columns.

DENSE_RANK():

  • Syntax: DENSE_RANK() OVER (PARTITION BY partition_column ORDER BY order_column)
  • Description: Just like RANK(), however with out gaps between rank values.

LEAD():

  • Syntax: LEAD(column, offset, default_value) OVER (ORDER BY order_column)
  • Description: Accesses information from subsequent rows throughout the end result set.

LAG():

  • Syntax: LAG(column, offset, default_value) OVER (ORDER BY order_column)
  • Description: Accesses information from earlier rows throughout the end result set.

GROUP BY():

  • Syntax: GROUP BY column1, column2, …
  • Description: Teams rows based mostly on the values in specified columns.

HAVING():

  • Syntax: HAVING situation
  • Description: Filters group rows based mostly on a specified situation.

CAST():

  • Syntax: CAST(expression AS data_type)
  • Description: Converts a price from one information kind to a different.

CONVERT():

  • Syntax: CONVERT(data_type, expression, fashion)
  • Description: Converts a price from one information kind to a different, with an elective fashion parameter for date and time conversions.

IFNULL() or ISNULL():

  • Syntax: IFNULL(expression, value_if_null) or ISNULL(expression, value_if_null)
  • Description: Returns the required worth if the expression is NULL.

NULLIF():

  • Syntax: NULLIF(expression1, expression2)
  • Description: Returns NULL if the 2 expressions are equal; in any other case, returns the primary expression.

SUM(DISTINCT column):

  • Syntax: SUM(DISTINCT column)
  • Description: Calculates the sum of distinct values in a numeric column.

AVG(DISTINCT column):

  • Syntax: AVG(DISTINCT column)
  • Description: Computes the typical of distinct values in a numeric column.

COUNT(DISTINCT column):

  • Syntax: COUNT(DISTINCT column)
  • Description: Counts the variety of distinct values in a column.

LIKE:

  • Syntax: column LIKE sample
  • Description: Matches a column worth in opposition to a specified sample utilizing wildcard characters (% and _).

SUBSTRING() with POSITION():

  • Syntax: SUBSTRING(string FROM POSITION(substring IN string))
  • Description: Retrieves a substring ranging from the place of one other substring in the principle string.

REGEXP:

  • Syntax: column REGEXP sample
  • Description: Matches a column worth in opposition to a daily expression sample.

UTCNOW():

  • Syntax: UTCNOW()
  • Description: Returns the present date and time in Coordinated Common Time (UTC).

GETUTCDATE():

  • Syntax: GETUTCDATE()
  • Description: Returns the present date and time in Coordinated Common Time (UTC).

For extra matters do go to https://nikhilhans.in/



Supply hyperlink

latest articles

ChicMe WW
Lightinthebox WW

explore more