-
Notifications
You must be signed in to change notification settings - Fork 0
/
20200904.sql
110 lines (86 loc) · 1.83 KB
/
20200904.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
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
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
SELECT *
FROM emp
WHERE comm IS NULL;
SELECT *
FROM emp
WHERE comm IS NOT NULL;
SELECT *
FROM emp
WHERE deptno NOT IN (10);
SELECT *
FROM emp
WHERE mgr IS NULL;
SELECT *
FROM emp
WHERE mgr = 7698 OR sal > 1000;
h--WHERE mgr = 7698 AND sal > 1000;
SELECT *
FROM emp
h--WHERE mgr != 7698 AND mgr !=7839;
WHERE mgr NOT IN(7698, 7839);
SELECT *
FROM emp
WHERE mgr IN (7698, 7839) OR mgr IS NULL;
h--WHERE mgr IN (7698, 7839, NULL);
h--WHERE mgr NOT IN (7698, 7839, NULL);
SELECT *
FROM emp
WHERE job = 'SALESMAN' AND hiredate >= TO_DATE('19810601','YYYYMMDD');
SELECT *
FROM emp
WHERE deptno != 10 AND hiredate >= TO_DATE('19810601', 'YYYYMMDD');
SELECT *
FROM emp
WHERE deptno NOT IN(10) AND hiredate >= TO_DATE ('19810601','YYYYMMDD');
SELECT *
FROM emp
WHERE deptno IN(20,30) AND hiredate >= TO_DATE ('19810601','YYYYMMDD');
SELECT *
FROM emp
WHERE job IN('SALESMAN') OR hiredate >= TO_DATE ('19810601','YYYYMMDD');
SELECT *
FROM emp
WHERE job IN('SALESMAN') OR empno 78%;
SELECT *
FROM emp
WHERE job IN('SALESMAN') OR empno IN(78); ????????????
SELECT *
FROM emp
WHER job = 'SALESMAN' OR ????????????;
SELECT *
FROM emp
ORDER BY job, empno DESC;
SELECT empno eno, ename enm
FROM emp
ORDER BY enm;
SELECT empno, ename, sal, sal +500
FROM emp
ORDER BY sal +500;
SELECT deptno, dname, loc
FROM dept
ORDER BY dname;
SELECT deptno, dname, loc
FROM dept
ORDER BY dname DESC;
SELECT *
FROM emp
WHERE comm IS NOT NULL AND comm NOT IN(0)
--WHERE comm != 0
ORDER BY comm DESC, empno DESC;
SELECT *
FROM emp
WHERE mgr IS NOT NULL
ORDER BY job , empno DESC;
SELECT *
FROM emp
WHERE deptno IN(10,30) AND sal > 1500
ORDER BY ename DESC;
SELECT *
FROM (SELECT ROWNUM rn, a.*
FROM
(SELECT empno, ename
FROM emp
ORDER BY ename)a)
WHERE rn BETWEEN (:page -1) * : pageSize +1 AND :page * :pageSize;
SELECT ROWNUM, e.*
FROM emp e;