Oracle Database Sql Certified Associate · Free Practice Question Medium
Question 1
View and examine the EMPLOYEES table structure.
Table: EMPLOYEES
- Name Type
- EMP_ID NUMBER(6)
- EMP_NAME VARCHAR(20)
- EMP_STATUS CHAR
- HIRE_DATE DATE
- FULLTIME_STATUS VARCHAR2
- SALARY NUMBER
Identify the true statements regarding the creation and datatypes in the table structure. (Select two.)
-
A
The FULLTIME_STATUS column would cause an error.
-
B
The HIRE_DATE column would be able to store the date and time including seconds and fractional seconds.
-
C
The EMP_STATUS column would store exactly one character.
-
D
The SALARY column would not be able to store decimals.
-
E
The EMP_ID column would cause an error.
Reveal correct answers
Correct answers: A, C
Explanation
True statements:
The FULLTIME_STATUS column would cause an error. (due to missing length specification)
The EMP_STATUS column would store exactly one character.
Analyze each statement about the EMPLOYEES table structure and identify the two true ones:
1. The FULLTIME_STATUS column would cause an error.
No, this would not cause an error.
VARCHAR2without length defaults are generally not valid, but some RDBMS allow it or default to max length.In Oracle,
VARCHAR2must specify a length (e.g.,VARCHAR2(10)).If length is missing, this is an error in Oracle.
So this depends on context, but usually: TRUE (it causes error due to missing length).
2. The EMP_STATUS column would store exactly one character.
CHARdata type without length defaults toCHAR(1)in many RDBMS, including Oracle.So yes,
EMP_STATUS CHARstores exactly one character.
True statement.
3. The EMP_ID column would cause an error.
NUMBER(6)means a number with up to 6 digits.This is valid and commonly used for IDs.
False — no error here.
4. The SALARY column would not be able to store decimals.
NUMBERwithout precision or scale allows any number including decimals.
False — it can store decimals.
5. The HIRE_DATE column would be able to store the date and time including seconds and fractional seconds.
In Oracle,
DATEdatatype stores date and time up to seconds (no fractional seconds).For fractional seconds, Oracle uses
TIMESTAMP.
False — DATE does not store fractional seconds.
A. The FULLTIME_STATUS column may cause an error in the table structure if it is not defined with a valid data type. It should be defined as a character or boolean data type to store information about whether an employee is full-time or not.
B. The HIRE_DATE column can be defined with a date and time data type, such as TIMESTAMP, to store the date and time of when an employee was hired. This data type can include seconds and fractional seconds to provide precise timestamp information.
C. The EMP_STATUS column would store exactly one character if it is defined with a character data type, such as CHAR or VARCHAR. This data type restriction ensures that only one character can be stored in the column for each employee's status.
D. The SALARY column is typically defined as a numerical data type with precision and scale to store decimal values. It can accurately store decimal values such as cents in the salary amount for each employee.
E. The EMP_ID column is a common identifier column in tables and would not cause an error in the table structure. It is typically defined as a numerical data type to uniquely identify each employee.
Discussion
Think the marked answer is wrong, or have a better explanation? Share it below — comments appear after review.
