0% found this document useful (0 votes)
11 views

Select Statement Notes

The document provides summaries of various SQL functions including SELECT DISTINCT, UPPER(), LOWER(), SUBSTRING(), CONCAT(), LIKE, CHAR_LENGTH(), aliases, MIN(), MAX(), COUNT(), AVG(), SUM(), and ROUND(). It describes what each function does and lists the parameters they accept.

Uploaded by

Gevita Chinnaiah
Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
11 views

Select Statement Notes

The document provides summaries of various SQL functions including SELECT DISTINCT, UPPER(), LOWER(), SUBSTRING(), CONCAT(), LIKE, CHAR_LENGTH(), aliases, MIN(), MAX(), COUNT(), AVG(), SUM(), and ROUND(). It describes what each function does and lists the parameters they accept.

Uploaded by

Gevita Chinnaiah
Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 3

The SQL SELECT DISTINCT Statement

The SELECT DISTINCT statement is used to return only distinct (different)


values.

Inside a table, a column often contains many duplicate values; and


sometimes you only want to list the different (distinct) values.

SQL Server UPPER() Function
The UPPER() function converts a string to upper-case.

The LOWER() function converts a string to lower-case.

SQL Server SUBSTRING() Function
The SUBSTRING() function extracts a substring from a string (starting at any
position).

Parameter Description

string Required. The string to extract from

start Required. The start position. Can be both a positive or negative number. If it is a positive number,
this function extracts from the beginning of the string. If it is a negative number, this function
extracts from the end of the string

length Optional. The number of characters to extract. If omitted, the whole string will be returned (from
the start position)

Mysql CONCAT() Function
The CONCAT() function adds two or more expressions together.

connecting words joining words

Parameter Description

expression1, Required. The expressions to add together.


expression2, Note: If any of the expressions is a NULL value, it returns NULL
expression3,
etc.
SQL LIKE Operator

The LIKE operator is used in a WHERE clause to search for a specified pattern


in a column.

There are two wildcards often used in conjunction with the LIKE operator:

  The percent sign (%) represents zero, one, or multiple characters


  The underscore sign (_) represents one, single character

LIKE Operator Description

WHERE CustomerName LIKE 'a%' Finds any values that start with "a"

WHERE CustomerName LIKE '%a' Finds any values that end with "a"

WHERE CustomerName LIKE '%or%' Finds any values that have "or" in any position

WHERE CustomerName LIKE '_r%' Finds any values that have "r" in the second position

WHERE CustomerName LIKE 'a_%' Finds any values that start with "a" and are at least 2 characters
in length

WHERE CustomerName LIKE 'a__%' Finds any values that start with "a" and are at least 3 characters
in length

WHERE ContactName LIKE 'a%o' Finds any values that start with "a" and ends with "o"

MySQL CHAR_LENGTH() Function
The CHAR_LENGTH() function return the length of a string (in characters).

Parameter Description

string Required. The string to count the length for


SQL Aliases
SQL aliases are used to give a table, or a column in a table, a temporary
name.

Aliases are often used to make column names more readable.

An alias only exists for the duration of that query.

SQL MIN() and MAX() Functions

The MIN() function returns the smallest value of the selected column.

The MAX() function returns the largest value of the selected column.

SQL COUNT(), AVG() and SUM() Functions


The COUNT() function returns the number of rows that matches a specified
criterion.

The AVG() function returns the average value of a numeric column.

The SUM() function returns the total sum of a numeric column. 

SQL Server ROUND() Function
The ROUND() function rounds a number to a specified number of decimal
places.

Parameter Description

number Required. The number to be rounded

decimals Required. The number of decimal places to round number to

operation Optional. If 0, it rounds the result to the number of decimal. If


another value than 0, it truncates the result to the number
of decimals. Default value is 0

You might also like