W08 Flashcards

1
Q

Functions

A

Operations performed on data that will manipulate or convert it.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

ROUND function

A

The ROUND function uses two parameters to determine how to round a given number.

EXAMPLE:
ROUND(12.39, 0) —–> 12

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

Concatenate

A

Combining values, by appending them to each other, to form a single longer value.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

CONCAT function

A

This functions manipulates data to return in a string form, usually in the order inputted.

EXAMPLE:
CONCAT(fname,’ ‘, lname)
——-> Sue Jones

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

UPPER function

A

Return strings in all upper case.

EXAMPLE:
UPPER(lname) —–> JONES

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q

LOWER function

A

Return all strings in lower case.

EXAMPLE:
LOWER(lname) —–> jones

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
7
Q

LENGTH function

A

Returns the number of characters in a string value.

EXAMPLE:
LENGTH(password) ——> 8

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
8
Q

SUBSTRING function

A

Returns a substring or part of a given string parameter. The parameters here are: 1. string, 2 start, 3. length.

EXAMPLE:
ssn = 222-33-1234
SUBSTRING(ssn, 8, 3) —–> 123
——> 123

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
9
Q

Numeric Functions

A

Operates over a single number value and returns one value.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
10
Q

CEILING function

A

Will round the next highest whole number. Regardless of decimal.

EXAMPLE:
CEILING(12.2) —–> 13

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
11
Q

FLOOR function

A

Will get the next lowest whole number. Regardless of decimal.

EXAMPLE:
FLOOR(12.8) —–> 12

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
12
Q

ABS function

A

Returns the absolute value of a function.

EXAMPLE:
ABS(-2.3) —–> 2.3

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
13
Q

SQRT function

A

Returns the square root of a function.

SQRT(25) ——> 5

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
14
Q

YEAR, MONTH, DAY functions

A

These date functions take one parameter and return a value.

EXAMPLE:
YEAR(dob) —-> 1999
MONTH(dob) —–> 12
DAY(dob) ——> 20

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
15
Q

NOW function

A

Returns the current local date and time from your systems clock.

EXAMPLE:
NOW( )

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
16
Q

DATE_ADD function

A

Can return a date and a specific interval such as months, years or days.

EXAMPLE:
DATE_ADD(invoice_date, INTERVAL 30 DAY)
—–> returns date that is 30 days past invoice date.

17
Q

DATEDIFF function

A

Takes two dates as parameters, it returns the difference in days between those two dates.

EXAMPLE:
DATEDIFF(NOW(), dob)

18
Q

DATE_FORMAT

A

Returns a formatted string from a date value.

EXAMPLE:
dob = 1999-12-20
DATE_FORMAT(dob, ‘%M %d %Y’)
——> December 20, 1999

19
Q

What is id?

A

In most database tables, id is a common column that serves as a unique identifier for each record. This column is usually the Primary Key of the table.

20
Q

TIMESTAMPDIFF

A

Calculates full years between two dates. Best used to find whole years.

Example: TIMESTAMPDIFF(YEAR, ‘2015-06-10’, ‘2020-12-20’)

21
Q

INTERVAL

A

Used to define a time duration that can be added or subtracted from a date or datetime value.

Example:
DATE_ADD(‘2025-03-12’, INTERVAL 6 MONTH)
– adds 6 months

22
Q

TRIM

A

This function removes any leading or trailing spaces around the string.

23
Q

SUBSTRING_INDEX

A

Used to extract a portion of a string, based on a delimiter, and a specified count of occurrences.

Example:
SUBSTRING_INDEX(string, delimiter, count)