SQL UCASE() Function

The UCASE() Function

The UCASE() function converts the value of a field to uppercase.

image

SQL UCASE() Example

We have the following "Persons" table:

image

Now we want to select the content of the "LastName" and "FirstName" columns above, and convert the "LastName" column to uppercase.

We use the following SELECT statement:

image

SQL LCASE() Function

The LCASE() Function

The LCASE() function converts the value of a field to lowercase.

SQL LCASE() Syntax

image

SQL LCASE() Example

We have the following "Persons" table:

imageNow we want to select the content of the "LastName" and "FirstName" columns above, and convert the "LastName" column to lowercase.

We use the following SELECT statement:

image

SQL MID() Function

The MID() Function

The MID() function is used to extract characters from a text field.

image

SQL MID() Example

We have the following "Persons" table:

image

Now we want to extract the first four characters of the "City" column above.

We use the following SELECT statement:

image

SQL LEN() Function

The LEN() Function

The LEN() function returns the length of the value in a text field.

image

SQL LEN() Example

We have the following "Persons" table:

image

Now we want to select the length of the values in the "Address" column above. We use the following SELECT statement:

image

SQL ROUND() Function

The ROUND() Function

The ROUND() function is used to round a numeric field to the number of decimals specified.

image

SQL ROUND() Example

We have the following "Products" table:

image

Now we want to display the product name and the price rounded to the nearest integer. We use the following SELECT statement:

image

The result-set will look like this:

image

Comments

Popular posts from this blog

XML Document Schema

Extended Relational-Algebra Operations.

Distributed Databases:Concurrency Control in Distributed Databases