Halaman

Thursday, August 8, 2019

Answer Sections 13 Quiz Database Programming with SQL 2019 Learner - English


Section 13


Evaluate this statement:
Which statement about this TRUNCATE TABLE statement is true?            
                                                                               
                                               
                You can produce the same results by issuing the 'DROP TABLE employee' statement.

                                               
                You can reverse this statement by issuing the ROLLBACK statement.

                                               
                You can issue this statement to retain the structure of the employees table. (*)

                                               
                You can produce the same results by issuing the 'DELETE employees' statement.

                                                                               
A column's data type can always be changed from NUMBER to VARCHAR2 but not from VARCHAR2 to NUMBER, provided the table is empty. True or False? 
                                                                               
                                               
                True

                                               
                False (*)

                                                                               
The data type of a column can never be changed once it has been created. True or False?           
                                                                               
                                               
                True

                                               
                False (*)

                                                                               
                                                               
Comments on tables and columns can be stored for documentation by:                                                                          
                                               
                Using an UPDATE statement on the USER_COMMENTS table

                                               
                Embedding /* comment */ within the definition of the table.

                                               
                Using the ALTER TABLE CREATE COMMENT syntax

                                               
                Using the COMMENT ON TABLE or COMMENT on COLUMN (*)

                                                                               
When you use ALTER TABLE to add a column, the new column:  

                                               
                Becomes the first column in the table

                                               
                Becomes the last column in the table (*)

                                               
                Can be placed by adding a GROUP BY clause

                                               
                Will not be created because you cannot add a column after the table is created

DCL, which is the acronym for Data Control Language, allows:     

                                               
                The CONROL TRANSACTION statement can be used.

                                               
                A Database Administrator the ability to grant privileges to users. (*)

                                               
                The ALTER command to be used.

                                               
                The TRUNCATE command to be used.

                                                                               
Examine this CREATE TABLE statement:
CREATE TABLE emp_load
(employee_number CHAR(5),
employee_dob CHAR(20),
employee_last_name CHAR(20),
employee_first_name CHAR(15),
employee_middle_name CHAR(15),
employee_hire_date DATE)
ORGANIZATION EXTERNAL
(TYPE ORACLE_LOADER
DEFAULT DIRECTORY def_dir1
ACCESS PARAMETERS
(RECORDS DELIMITED BY NEWLINE
FIELDS (employee_number CHAR(2),
      employee_dob CHAR(20),
      employee_last_name CHAR(18),
      employee_first_name CHAR(11),
      employee_middle_name CHAR(11),
      employee_hire_date CHAR(10) date_format DATE mask "mm/dd/yyyy"))
LOCATION ('info.dat'));

What kind of table is created here?
                                                                 
                                               
                An external table with the data stored in a file outside the database. (*)

                                               
                A View.

                                               
                An external table with the data stored in a file inside the database.

                                               
                None. This is in invalid statement.

                                                                               
Given this employee table:
(employee_id NUMBER(10) NOT NULL,
first_name VARCHAR2(25) NOT NULL,
last_name VARCHAR2(30) NOT NULL,
hire_date DATE DEFAULT sysdate)

What will be the result in the hire_date column following this insert statement:

INSERT INTO employees VALUES (10, 'Natacha', 'Hansen', DEFAULT);

                                                                  
                                               
                The character string SYSDATE.

                                               
                Statement will work and the hire_date column will have the value of the date when the statement was run. (*)

                                               
                Statement will fail, as you must list the columns into which you are inserting.

                                               
                The column for hire_date will be null.

                                                                               
CREATE TABLE student_table
    (id NUMBER(6),
     lname VARCHAR(20),
     fname VARCHAR(20),
     lunch_num NUMBER(4));
Which of the following statements best describes the above SQL statement:

                                         
                Creates a table named student_table with four columns: id, lname, fname, lunch_num (*)

                                               
                Creates a table named student with four columns: id, lname, fname, lunch_num

                                               
                Creates a table named student_table with four columns: lname, fname, lunch, num

                                               
                Creates a table named student_table with four columns: lname, fname, lunch, num

                                                                               
You want to create a table named TRAVEL that is a child of the EMPLOYEES table. Which of the following statements should you issue?    
                                                                               
                                               
                CREATE TABLE travel
(destination_id number primary key, departure_date date, return_date date, t.emp_id = e.emp_id);

                                               
                CREATE TABLE travel
(destination_id number primary key, departure_date date, return_date date, JOIN emp_id number(10) ON employees (emp_id));

                                               
                CREATE TABLE travel
(destination_id number primary key, departure_date date, return_date date, emp_id number(10) REFERENCES employees (emp_id));
(*)

                                              
                CREATE TABLE travel
(destination_id primary key, departure_date date, return_date date, emp_id REFERENCES employees (emp_id));

                                                                               
Which of the following are valid Oracle datatypes?     
                                                                               
                                               
                DATE, BLOB, LOB, VARCHAR2

                                               
                SYSDATE, TIMESTAMP, DATE, LOCAL TIME ZONE

                                               
                DATE, TIMESTAMP WITH LOCAL TIME ZONE, BLOB (*)

                                               
                TIMESTAMP, LOB, VARCHAR2, NUMBER

                                                                               
Evaluate this CREATE TABLE statement:
CREATE TABLE sales
( sales_id NUMBER(9),
customer_id NUMBER(9),
employee_id NUMBER(9),
description VARCHAR2(30),
sale_date TIMESTAMP WITH LOCAL TIME ZONE DEFAULT SYSDATE,
sale_amount NUMBER(7,2));

Which business requirement will this statement accomplish?

                                                                               
                                               
                Description values can range from 0 to 30 characters so the column should be fixed in length.

                                               
                All employee identification values are only 6 digits so the column should be variable in length.

                                               
                Today's date should be used if no value is provided for the sale date. (*)

                                               
                Sales identification values could be either numbers or characters, or a combination of both.

                                                                               
Which statement about data types is true?        
                                                                               
                                               
                The CHAR data type should be defined with a size that is not too large for the data it contains (or could contain) to save space in the database. (*)

                                               
                The BFILE data type stores character data up to four gigabytes in the database.

                                               
                The TIMESTAMP data type is a character data type.

                                               
                The VARCHAR2 data type should be used for fixed-length character data.

                                                                               

You need to store the HIRE_DATE value with a time zone displacement value and allow data to be returned in the user's local session time zone. Which data type should you use?                                                               
                                               
                TIMESTAMP WITH LOCAL TIME ZONE (*)

                                               
                TIMESTAMP WITH TIME ZONE

                                               
                DATETIME

                                               
                TIMESTAMP
                                                                                

The ELEMENTS column is defined as:
NUMBER(6,4)
How many digits to the right of the decimal point are allowed for the ELEMENTS column?

                                               
                Four (*)

                                               
                Zero

                                               
                Two

                                               
                Six

No comments:

Post a Comment

Final Exam Java Programming 2019 Learner - English

Final Exam