File tree Expand file tree Collapse file tree 2 files changed +5
-15
lines changed
docs/4-language-usage/3-dml-and-sql/1-general Expand file tree Collapse file tree 2 files changed +5
-15
lines changed Original file line number Diff line number Diff line change @@ -18,9 +18,7 @@ select last_name
1818 from employees
1919 join departments
2020 using (department_id)
21- where extract(month
22- from hire_date) = extract(month
23- from sysdate );
21+ where extract(month from hire_date) = extract(month from sysdate );
2422```
2523
2624## Example (better)
@@ -32,9 +30,7 @@ select e.last_name
3230 from employees e
3331 join departments d
3432 on (e .department_id = d .department_id )
35- where extract(month
36- from e .hire_date ) = extract(month
37- from sysdate );
33+ where extract(month from e .hire_date ) = extract(month from sysdate );
3834```
3935
4036## Example (good)
@@ -48,9 +44,7 @@ select emp.last_name
4844 from employees emp
4945 join departments dept
5046 on (emp .department_id = dept .department_id )
51- where extract(month
52- from emp .hire_date ) = extract(month
53- from sysdate );
47+ where extract(month from emp .hire_date ) = extract(month from sysdate );
5448```
5549
5650## Example Subquery (bad)
Original file line number Diff line number Diff line change @@ -17,9 +17,7 @@ select e.employee_id
1717 from employees e
1818 ,departments d
1919 where e .department_id = d .department_id
20- and extract(month
21- from e .hire_date ) = extract(month
22- from sysdate );
20+ and extract(month from e .hire_date ) = extract(month from sysdate );
2321```
2422
2523## Example (good)
@@ -32,7 +30,5 @@ select emp.employee_id
3230 from employees emp
3331 join departments dept
3432 on dept .department_id = emp .department_id
35- where extract(month
36- from emp .hire_date ) = extract(month
37- from sysdate );
33+ where extract(month from emp .hire_date ) = extract(month from sysdate );
3834```
You can’t perform that action at this time.
0 commit comments