-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathass7.txt
More file actions
78 lines (51 loc) · 1.33 KB
/
ass7.txt
File metadata and controls
78 lines (51 loc) · 1.33 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
create table Employees (EmpID VARCHAR2(3) Check (EmpId LIKE 'E%') primary key ,
Ename VARCHAR2(25) not null ,
DOB date not null,
DOJ date not null,
salary number(7) not null)
insert into employees VALUES ('E01','John','10-Oct-1998','01-Apr-2015',8000)
insert into employees VALUES ('E02','Alex','05-Jan-1998','01-Jul-2016',8000)
insert into employees VALUES ('E03','Jenny','11-Oct-1999','01-Apr-2016',8000)
insert into employees VALUES ('E04','Max','25-Dec-2000','03-Jan-2017',8000)
insert into employees VALUES ('E05','Johnny','10-Oct-1997','01-Apr-2019',7000)
SELECT *FROM Employees
-- 1
SELECT *
FROM Employees
WHERE DOJ='01-Apr-2015';
-- 2
SELECT EmpID,
Ename,
to_char(DOJ,'MONTH DD YYYY')
FROM employees;
-- 3
SELECT *
FROM employees
WHERE DOJ<('01-Jan-2018');
-- 4
SELECT *
FROM employees
WHERE to_char(DOJ, 'mon')='jan';
-- 5
SELECT *
FROM employees
WHERE to_char(DOJ,'yyyy')=2019;
-- 6
SELECT *FROM employees ORDER BY DOJ DESC;
-- 7
select * from employees where mod(salary,2)=0
-- 8
SELECT *
FROM employees
WHERE mod(salary,2) = 1;
-- 9
SELECT *
FROM employees
WHERE to_char(DOJ,'YYYY') = '1991'
AND (EmpId ='E001'
OR EmpId ='E10') ;
-- 10
SELECT *
FROM employees
WHERE to_char(DOJ,'MON') NOT IN ('FEB');
-- 11