chProblems

--ch2p1

SELECT s_class as Classification
FROM student;

--ch2p2
SELECT employee_id as "Emp#", first_name || ', ' ||last_name as "Employees", job_id as "Job Title", hire_date as "Date Hire"
FROM employees;


--ch2p3
SELECT f_first || ' '||f_mi || '. ' || f_last|| ':  '|| f_phone as "Faculty Name: Phone"
FROM faculty;


--Ch2p4
SELECT last_name ||''' full salary is: '||(null) as "Employee", salary as "Full Salary"
FROM employees;


--Ch2p5
SELECT Employee_id as "Employee ID", start_date as "Start Date",end_date "End date", (end_date - start_date) as "Days Of Employment"
FROM job_history;
-----------------------------------------------------------------
--ch3p1
SELECT last_name as "Employee", salary as "Salary"
FROM employees
WHERE SALARY NOT BETWEEN 2000 and 9500;
 
--ch3p2
SELECT s_last "Student",s_dob  "Date of Birth"
FROM student
WHERE s_dob BETWEEN '01-MAY-1985' and '30-SEP-1985'
ORDER by s_last;

--ch3p3
SELECT bldg_code,room,capacity
FROM location
WHERE capacity >30
ORDER by capacity,room;

--ch3p4
SELECT last_name "Name",job_id "Job Title"
FROM employees
WHERE job_id LIKE '%_M%'
AND commission_pct is null
ORDER by last_name;

--ch3p5
SELECT call_id,course_name
FROM course
WHERE course_name LIKE '%C++'
ORDER by call_id;


--ch3p6
SELECT s_first || ' ' || s_mi || '. '||s_last as "Full Name",
s_dob "Date of Birth", ROUND ((SYSDATE - s_dob)/365,2) AS "Age"
FROM student
WHERE s_dob >'31-DEC-85'
ORDER BY s_dob;


--ch3p7
SELECT last_name || ', ' || job_id ||' ' "Employees", SALARY
FROM employees
WHERE salary BETWEEN &low_salary and &high_salary

ORDER by last_name;

--ch3p8
SELECT DEPARTMENT_ID, &column_name
FROM DEPARTMENTS
WHERE department_name >department_id
ORDER BY 2;


No comments:

Post a Comment