From 9b97a5213567bd2efef5b844b37e6210afbc9b8b Mon Sep 17 00:00:00 2001 From: Bryan Keating <158529559+bryankeating10@users.noreply.github.com> Date: Sun, 26 Jan 2025 18:49:11 +0000 Subject: [PATCH 1/8] Testing commit --- .vscode/settings.json | 1 - queries/01_02/WHEREcondition.sql | 6 +++++- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/.vscode/settings.json b/.vscode/settings.json index c97cc32..778b9d2 100644 --- a/.vscode/settings.json +++ b/.vscode/settings.json @@ -18,7 +18,6 @@ "screencastMode.onlyKeyboardShortcuts": true, "terminal.integrated.fontSize": 18, "window.zoomLevel": 3, - "workbench.activityBar.visible": true, "workbench.colorTheme": "Visual Studio Dark", "workbench.fontAliasing": "antialiased", "workbench.statusBar.visible": true diff --git a/queries/01_02/WHEREcondition.sql b/queries/01_02/WHEREcondition.sql index 2c769f7..0e41f2d 100644 --- a/queries/01_02/WHEREcondition.sql +++ b/queries/01_02/WHEREcondition.sql @@ -4,4 +4,8 @@ WHERE salary>2500; SELECT empno,name, salary FROM emp_tab -WHERE name='KING'; \ No newline at end of file +WHERE name='KING'; + +SELECT * +FROM emp_tab + From 3766690ca3b21907bcd87770f5cb581210a7e96e Mon Sep 17 00:00:00 2001 From: Bryan Keating <158529559+bryankeating10@users.noreply.github.com> Date: Sun, 26 Jan 2025 19:33:04 +0000 Subject: [PATCH 2/8] Commiting changes to just ComparisonsConditions.sql, no nevermind LogicalConditions.sql --- queries/01_02/LogicalConditions.sql | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/queries/01_02/LogicalConditions.sql b/queries/01_02/LogicalConditions.sql index e1c3a75..9455b7d 100644 --- a/queries/01_02/LogicalConditions.sql +++ b/queries/01_02/LogicalConditions.sql @@ -1,6 +1,11 @@ SELECT * FROM emp_tab WHERE name LIKE 'S%' AND deptno=30; +SELECT * FROM ( + SELECT * FROM emp_tab WHERE name LIKE 'S%' +) AS 'Test of S'; + + SELECT * FROM emp_tab WHERE name LIKE 'S%' OR deptno=30; From 12e5f0e83a8b09dfc1e602f4afaf6d86684c38e0 Mon Sep 17 00:00:00 2001 From: Bryan Keating <158529559+bryankeating10@users.noreply.github.com> Date: Sun, 26 Jan 2025 19:35:50 +0000 Subject: [PATCH 3/8] Just messin --- queries/01_02/LogicalConditions.sql | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/queries/01_02/LogicalConditions.sql b/queries/01_02/LogicalConditions.sql index 9455b7d..15970ed 100644 --- a/queries/01_02/LogicalConditions.sql +++ b/queries/01_02/LogicalConditions.sql @@ -10,4 +10,7 @@ SELECT * FROM emp_tab WHERE name LIKE 'S%' OR deptno=30; SELECT * FROM emp_tab -WHERE deptno NOT IN(30,40); \ No newline at end of file +WHERE deptno NOT IN(30,40); + +SELECT * FROM emp_tab +WHERE NOT(NOT(deptno > 35)) \ No newline at end of file From 29fcfa374dace30a581ad085694da0d4b4696a0d Mon Sep 17 00:00:00 2001 From: Bryan Keating <158529559+bryankeating10@users.noreply.github.com> Date: Sun, 26 Jan 2025 19:44:20 +0000 Subject: [PATCH 4/8] Learned to concatenate the salary with a dollar sign for readability --- queries/01_02/LogicalConditions.sql | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/queries/01_02/LogicalConditions.sql b/queries/01_02/LogicalConditions.sql index 15970ed..2863e78 100644 --- a/queries/01_02/LogicalConditions.sql +++ b/queries/01_02/LogicalConditions.sql @@ -13,4 +13,9 @@ SELECT * FROM emp_tab WHERE deptno NOT IN(30,40); SELECT * FROM emp_tab -WHERE NOT(NOT(deptno > 35)) \ No newline at end of file +WHERE NOT(NOT(deptno > 35)) + +SELECT name 'Name', CONCAT('$', salary*12) 'Salary' FROM emp_tab +WHERE salary*12 < 50000 + +-- SELECT CONCAT('$', FORMAT(salary, 2)) 'Salary' FROM emp_tab; From 4947a478d7f970490696228e041e2a2c638d7eb5 Mon Sep 17 00:00:00 2001 From: Bryan Keating <158529559+bryankeating10@users.noreply.github.com> Date: Sun, 26 Jan 2025 19:53:30 +0000 Subject: [PATCH 5/8] Everything --- queries/01_02/ComparisonConditions.sql | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/queries/01_02/ComparisonConditions.sql b/queries/01_02/ComparisonConditions.sql index 6c3f224..b08937c 100644 --- a/queries/01_02/ComparisonConditions.sql +++ b/queries/01_02/ComparisonConditions.sql @@ -1,6 +1,6 @@ SELECT empno, name,hiredate FROM emp_tab -WHERE name LIKE '_D%'; +WHERE name LIKE '_D%' or name LIKE 'K%'; SELECT * FROM emp_tab WHERE deptno IN (30,40); @@ -9,4 +9,6 @@ SELECT * FROM emp_tab WHERE salary BETWEEN 2000 AND 6000; SELECT empno FROM emp_tab -WHERE manager IS NULL; \ No newline at end of file +WHERE manager IS NULL; + +SELECT * FROM emp_tab \ No newline at end of file From 8d2cb525ffbc993d71abf35861edab7793741d22 Mon Sep 17 00:00:00 2001 From: Bryan Keating <158529559+bryankeating10@users.noreply.github.com> Date: Sun, 26 Jan 2025 20:08:34 +0000 Subject: [PATCH 6/8] Tinkering --- queries/01_02/OrderOfPrecedence.sql | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/queries/01_02/OrderOfPrecedence.sql b/queries/01_02/OrderOfPrecedence.sql index 3524eab..1418529 100644 --- a/queries/01_02/OrderOfPrecedence.sql +++ b/queries/01_02/OrderOfPrecedence.sql @@ -1,9 +1,9 @@ SELECT empno,name,deptno,salary FROM emp_tab -WHERE deptno=30 OR deptno=40 -AND salary>2500; +WHERE deptno=40 OR deptno=30 +AND salary BETWEEN 2500 AND 4900; SELECT empno,name,deptno,salary FROM emp_tab WHERE (deptno=30 OR deptno=40) -AND salary>2500; \ No newline at end of file +AND salary BETWEEN 2500 AND 4900; \ No newline at end of file From 74ddaf56715d293e9893d94ad63f2990131d72b7 Mon Sep 17 00:00:00 2001 From: Bryan Keating <158529559+bryankeating10@users.noreply.github.com> Date: Sun, 26 Jan 2025 20:53:12 +0000 Subject: [PATCH 7/8] Ordering --- queries/01_02/ORDERBY.sql | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/queries/01_02/ORDERBY.sql b/queries/01_02/ORDERBY.sql index cd2dbed..490af98 100644 --- a/queries/01_02/ORDERBY.sql +++ b/queries/01_02/ORDERBY.sql @@ -1,5 +1,8 @@ -SELECT * FROM emp_tab -WHERE deptno=30 ORDER BY salary; +SELECT name 'Name', deptno 'Dept #', +CONCAT('$',salary*12) 'Annual Salary' FROM emp_tab +WHERE deptno=30 ORDER BY salary DESC; -SELECT * FROM emp_tab -ORDER BY deptno,salary DESC; \ No newline at end of file +SELECT name 'Name', job 'Job', deptno 'Dept #', +commission 'Commision', CONCAT('$', salary*12) +AS Salary FROM emp_tab +ORDER BY deptno DESC,commission DESC, Salary DESC; \ No newline at end of file From efb3bb48662330c80acffee91f63fedc70fa3d9a Mon Sep 17 00:00:00 2001 From: Bryan Keating <158529559+bryankeating10@users.noreply.github.com> Date: Sun, 26 Jan 2025 21:23:24 +0000 Subject: [PATCH 8/8] Two of my own examples --- queries/01_02/ORDERBY.sql | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) diff --git a/queries/01_02/ORDERBY.sql b/queries/01_02/ORDERBY.sql index 490af98..87eb892 100644 --- a/queries/01_02/ORDERBY.sql +++ b/queries/01_02/ORDERBY.sql @@ -5,4 +5,20 @@ WHERE deptno=30 ORDER BY salary DESC; SELECT name 'Name', job 'Job', deptno 'Dept #', commission 'Commision', CONCAT('$', salary*12) AS Salary FROM emp_tab -ORDER BY deptno DESC,commission DESC, Salary DESC; \ No newline at end of file +ORDER BY deptno DESC,commission DESC, Salary DESC; + +SELECT * FROM emp_tab; + +SELECT + name 'Name', + job 'Job', + deptno 'Dept #' +FROM emp_tab +WHERE NOT deptno=70 AND NOT name='FORD' +AND NOT job='CLERK' +ORDER BY name; + +SELECT * +FROM emp_tab +WHERE NOT deptno=70 AND NOT name='FORD' +ORDER BY name; \ No newline at end of file