Web Development with Python & MySQL


Professor:Sam Sultan [sam.sultan@nyu.edu]
Class website: [oit2.sps.nyu.edu/~sultans/pythonWeb] (or) [samsultan.com/pythonWeb]
Course Days: Mondays
Course Hours: 6:00pm - 9:00pm


+ syllabus
+ course outline
+ grades policy
+ final project
+ student listing
+ homework submission
+ Python examples/demos
+ MySql examples/demos
+ student feedback
+ student evaluation & comments

Prerequisites - html1   html2   tables   forms  
Session - 1   2   3   4   5   6   7   8   9   10   - Extra 11  

SQL - Python - MySQL Manual - SFTP (PC) (MAC) - MySQL GUI (Workbench) - Python*Tester © - SQL*Tester ©
Site Helpful?


Learn the fundamentals of two of today's most popular tools. Python is an open-source programming language that has gained tremendous popularity in the past few years. It is a general purpose language that can practically accomplish any programming task. We will be using it to develop dynamic web sites. MySQL is the world's most popular open-source database management system. Because it is readily available, low cost, and easy to install and use, many Internet service providers use MySQL and offer access to MySQL database services to potential clients. Learn both Python and MySQL, and use this powerful combination to design user-friendly, form-based HTML front end web pages that communicate with MySQL database servers through Python to create dynamic websites.


1. Course Objectives:

The objective of this course is to teach you the fundamentals behind 2 powerful software tools. We will learn both Python as a programming language and SQL to connect to a MySQL database. Python is one one of the most popular languages in use today, and MySql is an open source database that is used in over 3 million installations. We will discuss Python's programming constructs including variable, lists, tuples, dictionaries, functions, etc. and how we use all those to connect to a database and to create a web site. We will also discuss the relational database model, and will learn about SQL (Structured Query language) both as an ANSI standard language and how MySql implements those standards. We will learn and use DDL (Data Definition Language) to create and delete database objects, and DML (Data Manipulation Language) to access and manipulate those objects.

As part of this course, we will learn and use Python to create a bridge between the MySql database on the server side with HTML forms and other web presentation pages on the client side

The focus of the course will be on the following topics:

2. Student Learning Outcomes:

BOOKS - (Required / Suggested)


Details of Assignment and Evaluation.

How to Submit Homeworks.

- Homework assignments are always due the next session we meet.
- Print out your homework code and output and bring with you to class the next time we meet.
- I will either collect, or will ask students to discuss their solutions in class.
- I will not accept homework via email unless you are not able to attend the class.
- Multiple pages should be stapled together.

Grades are FINAL.

Please do not negotiate for a better grade. If you are expecting to receive a grade of an "A" at the end of the semester, then I expect you to attend all sessions (unless I am notified ahead of time), to participate in these sessions, to keep up with the class reading material, and to complete your homework assigments. This will ensure that you stay current with the class content, and will ensure that you get a good grade on your test(s), project as well as your final grade.

If you are not interested in a grade, or you do not submit your homeworks/project or take the exams, then you will receive a grade of an "NE" (Non-Evaluative). A grade of NE is final, and cannot be changed. A grade of NE cannot be applied as partial fulfillment for any NYU certificate program.

To receive your final grade at the end of the semester, follow these steps:

  1. click on http://www.sps.nyu.edu/academics/noncredit-offerings/academic-noncredit-policies-and-procedures.html#Obtaining_Grades
  2. Log into Albert using your net id, at: https://admin.portal.nyu.edu/psp/paprod/EMPLOYEE/EMPL/h/?tab
  3. Click on "Student Center"
  4. Within your student center, in the "academics" section click on the dropdown: "other academic"
  5. From the dropdown select "grades"
  6. For complete instructions click here


[Week 1] 1 Introduction to Python.
Python variables.
Numeric and string operators.
Comparison and logical operators.
Working with Lists, Tuples, and Dictionaries.
Control Structure and Program Flow.
The if conditional statement.
The while, and for loop statements.

Reading: Chapters 2, 3, 6, 12 (Murach's Python Programming)
[Week 2] 2 Working with Strings.
String Functions
Working with Numbers.
Number Functions
Working with Dates
Date Functions
Working with Lists, Tuples and Dictionaries
List, Tuple and Dictionary Functions

Reading: Chapters 9, 10, 11 (Murach's Python Programming)
[Week 3] 3 HTTP - HyperText Transfer Protocol
The client request
The server response
The GET and POST methods
Accessing client headers
Creating and adding server headers

Reading: None
[Week 4] 4 SQL - Structured Query language
DDL - Data Definition language
DML - Data Manipulation Language
SQL standard vs. vendor extensions
Our first database
The SELECT statement
The FROM clause
The WHERE clause
Comparison operators

Reading: Chapters 2, 3 (Teach Yourself SQL in One Hour a Day)
[Week 5] 5 Selecting data from multiple tables
The join construct
Old vs. new join syntax
Normal or Inner join
Cross join - Cartesian product
Outer join vs. Inner join
What is a Self Join
Performance considerations

Reading: Chapter 5 (Teach Yourself SQL in One Hour a Day)
[Week 6] 6 Creating database objects
What is a primary key?
What is a foreign key?
What is an index?
Creating tables
SQL data types
Adding a primary key
Adding constraints
Creating Indexes
Altering table definition
Droping tables

Reading: Chapter 9, 10, 15 (Teach Yourself SQL in One Hour a Day)
[Week 6] 7 Manipulating data in tables
Adding data with the INSERT statement
INSERT with a SELECT statement
Changing data with the UPDATE statement
UPDATE with a SELECT statement
Removing data with the DELETE statement
DELETE with a SELECT statement
The TRUNCATE statement
The REPLACE statement (MySql)

Reading: Chapter 11 (Teach Yourself SQL in One Hour a Day)
[Week 7] 8 Accessing HTML form data
The GET method
The POST method
Connecting to a database
Inserting, Updating & Deleting from databases
Querying databases

Reading: Chapters 17 (Murach's Python Programming)
[Week 7] 9 SQL built-in Functions
Arithmetic functions - ABS, RAND, ROUND, TRUNCATE
The CASE expression
Date functions - Current date, date manipulation, date formatting

Reading: Chapter 7, 12 (Teach Yourself SQL in One Hour a Day)
[Week 8] 10 Aggregating and Grouping
Aggregate functions - COUNT, SUM, AVG, MIN, MAX
Grouping with GROUP BY clause
The HAVING clause
The ROLLUP feature
Sorting with the ORDER BY clause

Reading: Chapter 4 (Teach Yourself SQL in One Hour a Day)

- Final Exam -
- Final Project due -
[Extra] 11 Database Design
The Logical and Physical Model
Understanding data normalization
First normal form
Second normal form
Third normal form
Pros & cons of data normalization
Denormalizing data
Entiry relationships
One-to-one relationship
One-to-many relationship
Many-to-many relationship
Designing Self-join relationship

Reading: Chapter 8 (Teach Yourself SQL in One Hour a Day)

All contents © Sam Sultan.
For more information, send e-mail to: sam.sultan@nyu.edu