Solutions 1: Oracle Database Fundamental I


Oracle Database Fundamental I
 Practice 1 Solutions
          (Questions 1 to 5 just true and false, So try itself)
                6.Your first task is to determine the structure of the DEPARTMENTS table and its contents.
            Solutions: Structure- desc departments;
     Contents– select * from departments;
         7.      You need to determine the structure of the EMPLOYEES table.
            Solutions: desc employees;
         8.      The HR department wants a query to display the last name, job code, hire date, and employee number for each employee, with employee number appearing first. Provide an alias STARTDATE for the HIRE_DATE column. Save your SQL statement to a file named lab_01_07.sql so that you can disperse this file to the HR department.
Solutions: select employee_id, last_name, job_id, hire_date startdate
from employees;
         9.      The HR department needs a query to display all unique job codes from the EMPLOYEES table.
Solutions: select distinct job_id
from employees;
        10.  The HR department wants more descriptive column headings for its report on employees. Copy the statement from lab_01_07.sql to the iSQL*Plus text box. Name the column headings Emp #, Employee, Job, and Hire Date, respectively. Then run your query again.
Solutions: select employee_id “EmP#”, last_name “Employee”, job_id “Job”, hire_date “Hire Date”
from employees;
        11.  The HR department has requested a report of all employees and their job IDs. Display the last name concatenated with the job ID (separated by a comma and space) and name the column Employee and Title.
Solutions: select last_name||’, ‘||job_id “Employee and Title” from employees;
        12.  To familiarize yourself with the data in the EMPLOYEES table, create a query to display all the data from that table. Separate each column output by a comma. Name the column title THE_OUTPUT.
Solutions: select employee_id||’,’||first_name||’,’|| last_name||’,’||email||’,’||phone_number||’,’||hire_date||’,’||job_id||’,’||salary||’,’||commission_pct the_output from employees;
———-The End———-