-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy path1.sql
More file actions
54 lines (45 loc) · 1.37 KB
/
1.sql
File metadata and controls
54 lines (45 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
-- SHOW ALL DATABASES
SHOW DATABASES;
-- SWITCH TO THE TASK DATABASE
USE tasks;
-- SHOW ALL TABLES
SHOW TABLES;
-- VIEW ALL EMPLOYEE RECORDS
SELECT * FROM Empl;
----------------------------------------------------
-- 1. Employees with salary >= 2200
----------------------------------------------------
SELECT ename, sal
FROM Empl
WHERE sal >= 2200;
----------------------------------------------------
-- 2. Employees NOT receiving commission
----------------------------------------------------
SELECT *
FROM Empl
WHERE comm IS NULL;
----------------------------------------------------
-- 3. Employees with salary NOT BETWEEN 2500 & 4000
----------------------------------------------------
SELECT ename, sal
FROM Empl
WHERE sal NOT BETWEEN 2500 AND 4000;
----------------------------------------------------
-- 4. Employees who do NOT have a manager
----------------------------------------------------
SELECT ename, job, sal
FROM Empl
WHERE mgr IS NULL;
----------------------------------------------------
-- 5. Employees whose name has 'A' as the THIRD letter
-- FIXED: __A% → two underscores
----------------------------------------------------
SELECT ename
FROM Empl
WHERE ename LIKE '__A%';
----------------------------------------------------
-- 6. Employees whose name ends with 'T'
----------------------------------------------------
SELECT ename
FROM Empl
WHERE ename LIKE '%T';