Skip to content

Commit 6f859f7

Browse files
Update 1.sql
1 parent 7f242d6 commit 6f859f7

File tree

1 file changed

+54
-10
lines changed

1 file changed

+54
-10
lines changed

1.sql

Lines changed: 54 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,54 @@
1-
show databases;
2-
use tasks;
3-
show tables;
4-
select * from Empl;
5-
select ename,sal from Empl where sal>=2200;
6-
select * from Empl where comm is NULL;
7-
select ename,sal from Empl where sal not between 2500 and 4000;
8-
select ename,job,sal from Empl where mgr is NULL;
9-
select ename from Empl where ename like '_A%';
10-
select ename from Empl where ename like '%T';
1+
-- SHOW ALL DATABASES
2+
SHOW DATABASES;
3+
4+
-- SWITCH TO THE TASK DATABASE
5+
USE tasks;
6+
7+
-- SHOW ALL TABLES
8+
SHOW TABLES;
9+
10+
-- VIEW ALL EMPLOYEE RECORDS
11+
SELECT * FROM Empl;
12+
13+
----------------------------------------------------
14+
-- 1. Employees with salary >= 2200
15+
----------------------------------------------------
16+
SELECT ename, sal
17+
FROM Empl
18+
WHERE sal >= 2200;
19+
20+
----------------------------------------------------
21+
-- 2. Employees NOT receiving commission
22+
----------------------------------------------------
23+
SELECT *
24+
FROM Empl
25+
WHERE comm IS NULL;
26+
27+
----------------------------------------------------
28+
-- 3. Employees with salary NOT BETWEEN 2500 & 4000
29+
----------------------------------------------------
30+
SELECT ename, sal
31+
FROM Empl
32+
WHERE sal NOT BETWEEN 2500 AND 4000;
33+
34+
----------------------------------------------------
35+
-- 4. Employees who do NOT have a manager
36+
----------------------------------------------------
37+
SELECT ename, job, sal
38+
FROM Empl
39+
WHERE mgr IS NULL;
40+
41+
----------------------------------------------------
42+
-- 5. Employees whose name has 'A' as the THIRD letter
43+
-- FIXED: __A% → two underscores
44+
----------------------------------------------------
45+
SELECT ename
46+
FROM Empl
47+
WHERE ename LIKE '__A%';
48+
49+
----------------------------------------------------
50+
-- 6. Employees whose name ends with 'T'
51+
----------------------------------------------------
52+
SELECT ename
53+
FROM Empl
54+
WHERE ename LIKE '%T';

0 commit comments

Comments
 (0)