chapter 5.1 Flashcards

1
Q

how does oracle store dates internally

A

stores dates as numbers

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

date information is displayed as _______

A

DD-Mon-YYYY

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

what are the 2 types of data conversion

A

implicit data type
explicit data type

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

example of implicit data conversion

A

oracle server can automatically convert char data to NUMBER and DATE data types

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

what is 1 way to ensure reliability in sql statements

A

it is best to explicitly make data type conversions to ensure reliability in SQL statements

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

what is example of explicit data types

A

character data type to number datatype using TO_NUMBER function

Number data type to character data type using TO_CHAR

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

syntax for to_char when converting date to character data

A

TO_CHAR(date column name, ‘format model you specify’)

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

how do you spell out a number using format model

A

use sp

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

how to have the number appear as an ordinal using format model

A

use th

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

why use fm element

A

remove padded blanks or remove leading zeroes from the output

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

how to specify the numeric day of year

A

DDD

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

how to specify the numeric day of the month

A

DD

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

how to specify the numeric day of the week

A

D

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

how to specify the hours

A

HH

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

how to specify the minutes

A

MI

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

how to specify the seconds

A

SS

17
Q

how to get 24 hour time with am/pm

A

HH24:MI:SS AM

18
Q

sql format to convert number to character data

A

TO_CHAR(number, ‘format model ‘)

19
Q

how do you want to format numbers in money format ($xx,xxx)

A

SELECT TO_CHAR(SALARY, ‘$99,999’) AS “SALARY”
FROM EMPLOYEE;

20
Q

how do you perform character conversion to number

A

USE TO_NUMBER(CHARACTER STRING, ‘format model’)

the format model is optional but should be included if character string contains any characters other than numbers

21
Q

what happens if in the TO_NUMBER function the column value has 4 values but the format model has only 3 characters

A

invalid number error

22
Q

what function to convert a character string to a date format

A

to_date(‘character string’, ‘format model ‘)

23
Q

what does the format model tells the server in the to_date function

A

tells the server what the character string looks like

24
Q

what does the fx (format exact) modifier specify

A

specifies the exact matching for the character argument and the date format model

25
Q

SELECT TO_DATE(‘MAY10, 1989’, ‘fxMonDD, YYYY’) as “convert” from dual

A

10-May-1989

26
Q

some legacy databases may still use the ______ year format

A

2 digit year (YY)

27
Q

result of

SELECT TO_DATE(‘27-Oct-95’, ‘DD-Mon-YY’)
AS “DATE”
FROM DUAL;

A

27-Oct-2095

2 digit year is interpreted as 2095, however, this may not be what was intended.

28
Q

what happens if the date format is specified with RR format

A

if the 2 digits of the current year are 0-49 and the specified 2 digit year is 0-49 then the return date is in current century

if the 2 digits of the current year are 0-49 and the specified 2 digit year is 50-99 then the return date is in century before the current one

if the 2 digits of the current year are 50-99 and the specified 2 digit year is 0-49 then the return date is in century after the current one

if the 2 digits of the current year are 50-99 and the specified 2 digit year is 50-99 then the return date is in current century