Halaman

Thursday, August 8, 2019

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



Section 4

Which comparison operator retrieves a list of values?  
                                                                               
                                               
                IS NULL

                                               
                IN (*)

                                               
                LIKE

                                               
                BETWEEN IN

                                                                               
Which script displays '01-May-2004' when the HIRE_DATE value is '20-May-2004'?  
                                               
                SELECT ROUND(hire_date, 'MONTH')
FROM employees;

                                               
                SELECT TRUNC(hire_date, 'MONTH')
FROM employees;
(*)


                                               
                SELECT TRUNC(hire_date, 'MI')
FROM employees;

                                               
                SELECT ROUND(hire_date, 'MON')
FROM employees;

                                                                               
ROUND and TRUNC functions can be used with which of the following Datatypes?    
                                               
                Dates and numbers (*)

                                               
                Dates and characters

                                               
                Numbers and characters

                                               
                None of the above

                                                                               
Evaluate this function: MOD (25, 2) Which value is returned? 

                                               
                1 (*)

                                               
                0

                                               
                2

                                               
                25

                                                                               
The answer to the following script is 456. True or False?
SELECT TRUNC(ROUND(456.98))
FROM dual;
                                                                           
                                               
                True

                                               
                False (*)

What will the following SQL statemtent display?
SELECT last_name, LPAD(salary, 15, '$')SALARY
FROM employees;
                                                                
                                               
                The last name of employees that have a salary that includes a $ in the value, size of 15 and the column labeled SALARY.

                                               
                The query will result in an error: "ORA-00923: FROM keyword not found where expected."

                                               
                The last name and the format of the salary limited to 15 digits to the left of the decimal and the column labeled SALARY.

                                               
                The last name and salary for all employees with the format of the salary 15 characters long, left-padded with the $ and the column labeled SALARY. (*)

                                                                               
Which of the following SQL statements would correctly return a song title identified in the database as "All These Years"?
                                     
                                               
                WHERE title CONTAINS 'Years';

                                               
                WHERE title LIKE INITCAP('%all these years'); (*)

                                               
                WHERE title LIKE LOWER('all these years');

                                               
                WHERE title IN('All','These','Years');

                                                                               
Which query selects the first names of the DJ On Demand clients who have a first name beginning with "A"?                                                         
                                               
                SELECT UPPER(first_name)
FROM d_clients
WHERE first_name LIKE %a%

                                               
                SELECT UPPER(first_name)
FROM d_clients
WHERE first_name LIKE '%a%'

                                               
                SELECT UPPER(first_name)
FROM d_clients
WHERE first_name LIKE 'a%'

                                               
                SELECT UPPER(first_name)
FROM d_clients
WHERE LOWER(first_name) LIKE 'a%'
(*)


The STYLES table contains this data:
STYLE_ID              STYLE_NAME     CATEGORY          COST
895840                     SANDAL               85940                     12.00
968950                     SANDAL               85909                     10.00
869506                     SANDAL               89690                     15.00
809090                     LOAFER                89098                    10.00
890890                     LOAFER                89789                    14.00
857689                     HEEL                     85940                     11.00
758960                     SANDAL               86979                     12.00
You query the database and return the value 79. Which script did you use?
                                                                  
                                               
                SELECT INSTR(category, -2,2)
FROM styles
WHERE style_id = 895840;

                                               
                SELECT SUBSTR(category, -2,2)
FROM styles
WHERE style_id = 758960;
(*)


                                               
                SELECT INSTR(category, 2,2)
FROM styles
WHERE style_id = 895840;

                                               
                SELECT SUBSTR(category, 2,2)
FROM styles
WHERE style_id = 895840;


Which SQL function is used to return the position where a specific character string begins within a larger character string?                                      
                                               
                SUBSTR

                                               
                INSTR (*)

                                               
                CONCAT

                                               
                LENGTH

Which of the following SQL statements will correctly display the last name and the number of weeks employed for all employees in department 90? 
                                                                               
                                               
                SELECT last_name, (SYSDATE-hire_date)/7 AS WEEKS
FROM employees
WHERE department_id = 90;
(*)

                                               
                SELECT last_name, (SYSDATE-hire_date)AS WEEK
FROM employees
WHERE department_id = 90;

                                               
                SELECT last name, (SYSDATE-hire_date)/7 DISPLAY WEEKS
FROM employees
WHERE department id = 90;

                                               
                SELECT last_name, # of WEEKS
FROM employees
WHERE department_id = 90;

                                                                               
Which query would return a whole number if the sysdate is 26-May-2004?
                                                                               
                                               
                SELECT TRUNC(MONTHS_BETWEEN(SYSDATE,'19-Mar-1979') /12)
AS YEARS
FROM DUAL;
(*)

                                               
                SELECT TRUNC(YEARS_BETWEEN(SYSDATE,'19-Mar-1979') /12)
AS YEARS
FROM DUAL;

                                               
                SELECT MONTHS_BETWEEN(SYSDATE,'19-Mar-1979') /12
AS YEARS
FROM DUAL;

                                               
                None of the above

                                                                               
You need to display the current year as a character value (for example: Two Thousand and One). Which element would you use? 
                                                                               
                                               
                YY

                                               
                YEAR (*)

                                               
                RR

                                               
                YYYY

                                                                               
What is the result of the following query?
SELECT ADD_YEARS ('11-Jan-1994',6)
FROM dual;     
                                                                               
                                               
                11-Jul-2000

                                               
                11-Jul-1995

                                               
                This in not a valid SQL statement. (*)

                                               
                11-Jan-2000

                                                                               
Round and Trunc cannot be used on Date datatypes. True or False?   

                                               
                True

                                               
                False (*)

No comments:

Post a Comment

Final Exam Java Programming 2019 Learner - English

Final Exam