Web
Programming

Fall 2012
course
navigation

Oct 18

Aside

1.
"Even the most amateur web developer knows to follow three important rules for data validation: 1. Never trust the client. 2. Never trust the client. 3. Never trust the damn client! "
2.
3.

more SQL syntax

Review the SQL we've done, and look at a few more syntax notions.
Walk through bits of
Note in particular:
More examples:
http://beginner-sql-tutorial.com/sql-select-statement.htm
SELECT colums FROM table [WHERE clause] [GROUP BY clause] [HAVING clause] [ORDER BY clause];
http://beginner-sql-tutorial.com/sql-like-in-operators.htm
Comparison operators & keywords : = <> != < > >= <= AND OR NOT LIKE IN BETWEEN ... AND ... IS NULL e.g. SELECT a, b, c FROM foo WHERE thing IN ('this', 'that');
http://beginner-sql-tutorial.com/sql-group-functions.htm
SELECT COUNT(*) FROM employee; --- number of rows returned. MAX() MIN() AVG() SUM()
http://beginner-sql-tutorial.com/sql-group-by-clause.htm
SELECT dept, SUM (salary) FROM employee GROUP BY dept;
http://beginner-sql-tutorial.com/sql-having-clause.htm
HAVING is similar to WHERE but can also include group functions. SELECT dept, SUM (salary) FROM employee GROUP BY dept HAVING SUM (salary) > 2500;
aliases
Often tables are given short names, e.g. "FROM Person p" or "FROM Person as p" after which p.id is Person.id.
http://beginner-sql-tutorial.com/sql-subquery.htm
For homework, I'm asking you to look at these :
http://en.wikibooks.org/wiki/SQL_Exercises warehouse pieces and providers planet express

ORM

Walk through http://www.rmunn.com/sqlalchemy-tutorial/tutorial.html for some of our database examples, as an in-class exercise.
http://cs.marlboro.edu/ courses/ fall2012/web/ notes/ Oct_18
last modified Thursday October 18 2012 5:17 am EDT