9/24/2020
SQL Entity-Relationship Diagram (ERD)
PHP For-loop
in for or while loops, "break;" will let you get out of the loops.
"continue;" will get you out of that current instance of the loop, moving onto the next instance of loop.
In an example: for ($i = 1, $a = 1; $i <= 29; $i = $i + $a, $a++) {}, the $i=1,$a=1 (initializer) gets executed first, and then the condition $i<=29 gets checked. If true, it executes the stuff inside the brackets {}, and then lastly, it executes the incremental stuff like $i=$i+$a and $a++ get executed. Then it repeates until the condition is false!
SQL Equi-Join & Nequi-Join
> > SELECT table1.col, ... table2.col, ... FROM table1, table2, ... WHERE join_condition AND regular_conditions;
if there are n tables, there must be AT LEAST n-1 join conditions.
ex: > SELECT eno, ename, emp.dno, dept.dno, dname FROM dept, emp WHERE dept.dno = emp.dno; --> the underlined part is the Equi Join condition.
Nequi-Join
ex: > SELECT eno, ename, sal, grade FROM emp, salgrade WHERE sal BETWEEN losal AND hisal;
(note: you can put a nickname for each of the tables, but once you do so, you must only use the nickname in the SELECT and all the other parts of the query.)
SQL Self-Join
> SELECT nickname1.col1, ... nickname2.col2, ... FROM table nickname1, table nickname2, ... WHERE join_condition AND regular_condition;
Outer-Join
> SELECT d.dno, dname, ename FROM dept d, emp e WHERE d.dno = e.dno(+) ORDER BY 1;