Chapter 4 - Slides Flashcards

1
Q

What are the naming conventions of a table and column name?

A
  1. Must begin with a letter
  2. Upto 30 characters long
  3. Alphanumeric, and can use $/_/#
  4. Spaces and Hyphens cannot be used
  5. Must be unique
  6. Cannot be an Oracle server-reserved word.
  7. Case insensitive.
  8. Should be short and meaningful
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

True or False? Data types help to optimize storage space.

A

True

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

The ____ type is a character data type to store variablelength alphanumeric data in a column.

A

VARCHAR2

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

What is the maximum allowable size for a VARCHAR2 type?

A

4000 Characters

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

_____ is the most appropriate type for a column whose

values do not have a fixed length

A

VARCHAR2

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

True or False? If a VARCHAR2 value is longer than the specified size is entered, the longer values are truncated.

A

False, an error is generated

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

True or False? The CHAR data type uses the storage more efficiently and processes data faster than the VARCHAR2 type.

A

True

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

The maximum allowable size for a CHAR type character is:

A

2000 characters

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

True or False? If a Char value longer than the specified size is entered, however, an
error is generated. The longer values are not truncated.

A

True

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

When a number type is used for a column, its
precision and scale can be specified optionally, using
the general syntax:

A

fieldname NUMBER [([precision,][scale])]

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

The precision value includes:.

A

only the digits, and does
not include formatting characters, such as the
currency symbol, commas, or the decimal point

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

_____ is the total number of significant digits in the number, both to the left and to the right of the decimal
point. It n can range from 1 to 38.

A

Precision

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

a _____ requires 1 to 22 bytes.

A

NUMBER

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

What are the three Number data subtypes:

A

Integer
Fixed-Point
Floating Point

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

The scale value for number can range from __ to __.

A

-84 to 127

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

A FLOAT value is represented internally as NUMBER. The precision p can range from _ to _ binary digits.

A

1 to 126

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

A FLOAT value requires

from _ to __ bytes

A

1 to 22

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

The DATE data type is used for storing date and time

values. The range of allowable dates is between

A

January 1, 4712 B.C. and December 31, 9999 A.D.

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

True or False? There is no need to specify size for the DATE type.

A

True

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

The default date format is

A

DD-MON-YY HH:MM:SS A.M.

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

The ___ type is used for variable-length character

data up to 2 gigabytes.

A

LONG

22
Q

The ___ type is similar to CHAR but uses 2-byte

binary encoding for each character

A

NCHAR

23
Q

True or False? The CHAR type is useful for character sets such as
the Japanese Kanji, which has thousands of different
characters

A

False, it is NCHAR

24
Q

____ is used to store binary data up to 4 gigabytes.

A

BLOB (Binary Large Object) date type

25
Q

____ is used to store singlebyte character data up to 4 gigabytes.

A

CLOB (Character Large Object) data type

26
Q

___ uses 2-byte character codes.

A

NCLOB (character large object) data type

27
Q

____ references to a binary file that is external to the database and is maintained by the operating system’s file system.

A

BFILE (Binary File type)

28
Q

___ or ____ are used for raw binary data of length size bytes.

A

RAW or LONG_RAW

29
Q

___, use when you are using an unique row address of a row.

A

ROWID

30
Q

____ enforce rules on tables

A

Constraints

31
Q

There are two types of constraints:

A

Integrity and Value Constraints

32
Q

What is an integrity constraint?

A

define both the primary

key and the foreign key with the table and primary key it references

33
Q

What is a value constraint?

A

define if NULL values are

disallowed, if UNIQUE values are required, and if only certain set of values are allowed in a column

34
Q

The general convention used for naming constraints is

A

__

ie. dept_deptno_pk

35
Q

If you do not name a constraint, the Oracle server will ______

A

generate a name for it by using SYS_Cn format, where

n is any unique number

36
Q

_____ references a single
column and is defined along with the definition of the
column.

A

A Column-level Constraint

37
Q

_____ references one or more columns and is defined separately from the definitions of the columns.

A

A Table-level Contraint

38
Q

What is the general syntax of a Column level Constraint?

A

column datatype [CONSTRAINT constraint_name] constraint_type

39
Q

What is the general syntax of a Table level Constraint?

A

[CONSTRAINT constraint_name] constraint_type (Column, . . .)

40
Q

CONSTRAINT dept_deptid_pk PRIMARY KEY(DeptId) is an example of?

A

Primary Key Constraint

41
Q

The _____ constraint is also known as the referential integrity constraint.

A

FOREIGN KEY

42
Q

The ______ constraint ensures that the column has a value and the value is not a null (unknown or blank) value

A

NOT NULL

43
Q

The _____ constraint requires that every value in a

column or set of columns be unique.

A

UNIQUE

44
Q

The ____ constraint defines a condition that every

row must satisfy.

A

CHECK

45
Q

True or False? The A NOT NULL constraint can be declared as a CHECK constraint.

A

True

46
Q

A CREATE TABLE statement may have an optional

______ clause

A

STORAGE

47
Q

The ____ clause is used to allocate initial diskspace for the table at the time of creation with INITIAL parameter, and also to allocate additional space with NEXT parameter in case the table runs out of allocated initial space.

A

STORAGE

48
Q

To display all columns, type the following statement:

A

SELECT * FROM USER_TABLES;

49
Q

You can get information about STORAGE clauses’

attributes by:

A

using data dictionary view

50
Q

slide 37

A

slide 37