• Shuffle
    Toggle On
    Toggle Off
  • Alphabetize
    Toggle On
    Toggle Off
  • Front First
    Toggle On
    Toggle Off
  • Both Sides
    Toggle On
    Toggle Off
  • Read
    Toggle On
    Toggle Off
Reading...
Front

Card Range To Study

through

image

Play button

image

Play button

image

Progress

1/15

Click to flip

Use LEFT and RIGHT arrow keys to navigate between flashcards;

Use UP and DOWN arrow keys to flip the card;

H to show hint;

A reads text to speech;

15 Cards in this Set

  • Front
  • Back
Alter the session to set the NLS_DATE_FORMAT to DD-MON-YYYY HH24:MI:SS
ALTER SESSION SET NLS_DATE_FORMAT = 'dd-mon-yyyy HH24:MI:SS';
Write queries to display the time zone offsets (TZ_OFFSET), for the following time zones.
US/Pacific-New
Singapore
Egypt
SELECT TZ_OFFSET ('US/PACIFIC-NEW') FROM DUAL;
SELECT TZ_OFFSET ('SINGAPORE') FROM DUAL;
SELECT TZ_OFFSET ('EGYPT') FROM DUAL;
Alter the session to set the TIME_ZONE parameter value to the time zone offset of US/Pacific-New.
ALTER SESSION SET TIME_ZONE = '-7:00';
Display the CURRENT_DATE, CURRENT_TIMESTAMP, and LOCALTIMESTAMP for this session
SELECT CURRENT_DATE, CURRENT_TIMESTAMP, LOCALTIMESTAMP FROM DUAL;
Alter the session to set the TIME_ZONE parameter value to the time zone offset of Singapore
ALTER SESSION SET TIME_ZONE = '+8:00';
Display the CURRENT_DATE, CURRENT_TIMESTAMP, and LOCALTIMESTAMP for this session.
Note: The output might be different, based on the date when the command is executed.
Note: Observe in the preceding practice that CURRENT_DATE, CURRENT_TIMESTAMP, and LOCALTIMESTAMP are all sensitive to the session time zone.
SELECT CURRENT_DATE, CURRENT_TIMESTAMP, LOCALTIMESTAMP FROM DUAL;
Write a query to display the DBTIMEZONE and SESSIONTIMEZONE.
SELECT DBTTIMEZONE, SESSIONTIMEZONE FROM DUAL;
Write a query to extract the YEAR from the HIRE_DATE column of the EMPLOYEES table for those employees who work in department 80.
SELECT last_name, EXTRACT (YEAR FROM HIRE_DATE) FROM employees WHERE department_id = 80
Alter the session to set NLS_DATE_FORMAT to DD-MON-YYYY.
ALTER SESSION SET NLS_DATE_FORMAT = 'DD-MON-YYYY';

note: there are No (parentheses) in this statement
Create a query to retrieve last names from the EMPLOYEES table and calculate review status. If the year hired was 2000, display Needs Review for the review status, otherwise display not this year! Name the review status column Review. Sort the results by the HIRE_DATE column. Hint: Use a CASE expression with EXTRACT function to calculate the review status.
SELECT emp.last_name, (CASE Extract (year from emp.hire_date)
WHEN 1998 THEN ' Needs Review ' ELSE ' Not this Year! ' END ) AS "Review" From employees emp ORDER BY emp.hire_date; NOTE: "I gave the employees table the nickname EMP"
Display the CURRENT_DATE, CURRENT_TIMESTAMP, and LOCALTIMESTAMP for this session.
Note: The output might be different, based on the date when the command is executed.
Note: Observe in the preceding practice that CURRENT_DATE, CURRENT_TIMESTAMP, and LOCALTIMESTAMP are all sensitive to the session time zone.
SELECT CURRENT_DATE, CURRENT_TIMESTAMP, LOCALTIMESTAMP FROM DUAL;
Write a query to display the DBTIMEZONE and SESSIONTIMEZONE.
SELECT DBTTIMEZONE, SESSIONTIMEZONE FROM DUAL;
Write a query to extract the YEAR from the HIRE_DATE column of the EMPLOYEES table for those employees who work in department 80.
SELECT last_name, EXTRACT (YEAR FROM HIRE_DATE) FROM employees WHERE department_id = 80
Alter the session to set NLS_DATE_FORMAT to DD-MON-YYYY.
ALTER SESSION SET NLS_DATE_FORMAT = 'DD-MON-YYYY';

note: there are No (parentheses) in this statement
Create a query to retrieve last names from the EMPLOYEES table and calculate review status. If the year hired was 2000, display Needs Review for the review status, otherwise display not this year! Name the review status column Review. Sort the results by the HIRE_DATE column. Hint: Use a CASE expression with EXTRACT function to calculate the review status.
SELECT emp.last_name, (CASE Extract (year from emp.hire_date)
WHEN 1998 THEN ' Needs Review ' ELSE ' Not this Year! ' END ) AS "Review" From employees emp ORDER BY emp.hire_date; NOTE: "I gave the employees table the nickname EMP"