-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathPractice 01.sql
More file actions
83 lines (71 loc) · 1.37 KB
/
Practice 01.sql
File metadata and controls
83 lines (71 loc) · 1.37 KB
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
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
--Question No 02
-- Answer is False
--Question No 03
-- Answer is True
--Question No 04
-- Answer is True
--Question No 05
-- Answer
/*
Four Coding Error are
SELECT employee_id, last_name
sal x 12 ANNUAL SALARY
FROM employees;
1= Comma (,) missing after last_name
2= sal is not the Column
3= multiplication opr is *
4= alias column name is not in double quoted""
*/
-- Question No 06
-- Answer is
desc hr.departments;
select
*
from
hr.departments;
-- Question No 07
-- Answer is
DESC hr.employees;
SELECT
employee_id,
last_name,
job_id,
hire_date "Start Date"
FROM
hr.employees;
-- Question No 08
-- Answer is
SELECT
employee_id,
last_name,
job_id,
hire_date
FROM
hr.employees;
-- Question No 09
-- Answer is
select
distinct job_id
from
hr.employees;
-- Question No 10
-- Answer is
SELECT
employee_id "Emp #",
last_name "Employee",
job_id "Job",
hire_date "Hire Date"
FROM
hr.employees;
-- Question No 11
-- Answer is
select
last_name || ',' || job_id " Employee and Title"
FROM
hr.employees;
-- Question No 12
-- Answer is
SELECT
employee_id || ',' || first_name || ',' || last_name || ',' || email || ',' || phone_number || ',' || job_id || ',' || manager_id || ',' || hire_date || ',' || salary || ',' || commission_pct || ',' || department_id "THE_OUTPUT"
FROM
hr.employees;