-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathL01_159100171_HONG.sql
44 lines (28 loc) · 1.3 KB
/
L01_159100171_HONG.sql
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
-- ***********************
-- Name: Youngeun Hong
-- ID: 159100171
-- Date: 14 May 2019
-- Purpose: Lab 1 DBS301
-- ***********************
-- Question 1 – Which one of these tables appeared to be the widest? or longest?
-- Q1 Solution --
SELECT * FROM EMPLOYEES;
SELECT * FROM DEPARTMENTS;
SELECT * FROM JOB_HISTORY;
--Q1 Answer – The Employees table is the longest.
-- Question 2 – If the following SELECT statement does NOT execute successfully, how would you fix it?
-- Q2 Solution – “ -> ", Hire Date -> Hire_Date
-- Q2 Result –
SELECT last_name "LName", job_id "Job Title", Hire_Date "Job Start"
FROM employees;
-- Question 3 – There are THREE coding errors in this statement. Can you identify them? correct them and provide a working statement.
-- Q3 Solution – last name -> last_name, Emp Comm => "Emp Comm", remove comma after "Emp Comm"
-- Q3 Result –
SELECT employee_id, last_name, commission_pct "Emp Comm"
FROM employees;
-- Question 4 – What command would show the structure of the LOCATIONS table?
-- Q4 answer – desc LOCATIONS;
-- Question 5 – Create a query to display the output shown below.
-- Q5 answer –
SELECT Location_id "City#", city "City", state_province || ' IN THE ' || country_id as "Province with Country Code"
FROM locations