Web Development with Python & MySQL

INFO1-CE9367

Professor:Sam Sultan [sam.sultan@nyu.edu]
Class website: [workshop.sps.nyu.edu/~sultans/pythonweb] (or) [samsultan.com/pythonweb/]
Course Days: Saturdays, June 22 - August 10
Course Hours: 9:00am - 1:00pm
Course Modality: Online Synchronous Sessions via Zoom Software

Announcement(s):

+syllabus
+course outline
+grades & evaluation
+final project
+student list
+Python examples/demos
+MySql examples/demos
+student feedback
+student evaluation & comments

Prerequisites - html   tables   forms  
Session - 1   2a   2b   3   4a   4b   5a   5b   6   7   8   - Extra   9   10   11  


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

COURSE DESCRIPTION:

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 dynamically driven websites.


COURSE LEARNING GOALS:

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)


GRADE ASSIGNMENT AND EVALUATION:


Details of Assignment, Exam and Grade Evaluation.

NE and P/F Grades
If you are not interested in receiving a grade, and you simply require an NE (non-evaluative) or P/F (pass/fail) grade, please fill out the appropriate form listed. Neither an NE nor a P/F grade will count toward an NYU certificate.

NYU SPS Grading Scale and Policies

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 instructions under Obtaining Grades:

  1. click on https://www.sps.nyu.edu/homepage/student-experience/policies-and-procedures.html#CareerAdvancement3
  2. Scroll down to Obtaining Grades
  3. Log in to NYU Albert to see your grades


COURSE OUTLINE:

DATE SESSION TOPIC[s] COVERED
 
[Week 1] 1 Introduction to Python
What it Python, and why so Popular?
Downloading and Installing Python
Using IDLE (Integrated Development Environment)
Rules for coding with Python
Python variables
Lists, Tuples, Sets and Dictionaries
The assignment statement
Numeric and string operators
Comparison and logical operators
The print statement
Working with Lists
Working with Dictionaries
Coding, testing and running your scripts

Reading: Chapters 2 (starting out with Python), or
Chapters 2, 6, 12 (Murach's Python Programming)
 
[Week 2] 2a Program Logic and Control Flow
Sequential, conditional and iterative processing
The "if" statement
Logical Operators and, or, not
The while loop
The for loop
The range statement
Nested loops
Prompting a user for input
Passing arguments on the command line
Handling Exceptions
Python comments

Reading: Chapters 3, 4 (Starting out with Python), or
Chapters 3, 8 (Murach's Python Programming)
 
[Week 2] 2b Python Functions and Methods
Working with Numbers
Numeric Functions
Working with Strings
String Functions
Providing external data to your program
Generic functions
Working with Dates
Date Functions
Defining your own functions
Calling your own functions
Passing and returning data
Variable scope
Import programs and modules
Recursive Processing

Reading: Chapters 5 (Starting out with Python), or
Chapters 4, 9, 10, 11, 13 (Murach's Python Programming)
 
[Week 3] 3 Python Functions and Methods (continue)
Working with Lists
List Functions
Analytic Functions
Tuple functions
Set functions
Working with Dictionaries
Dictionary Functions
Sorting Lists and Dictionaries
Introducing Lambda functions
Using Lambda functions to sort
Two Dimensional Lists
Nested data structures
Iterating through nested data structures
Stacks and Queues

Reading: Chapters 5, 8 (Starting out with Python), or
Chapters 6, 12 (Murach's Python Programming)
 
[Week 4] 4a 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
Using SELECT DISTINCT

Reading: Chapters 2, 3 (Teach Yourself SQL in One Hour a Day)
 
[Week 4] 4b 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 5] 5a 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 5] 5b 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 6] 6 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] 7 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 8] 8 Creating Persistence on the web
Repopulating HTML Form Fields
Using Form Hidden Fields
Using the end of the URL
Using Cookies
Creating Cookies (temporary and more permanent)
Retrieving Cookies
Redirecting to Another Page
Custom web sessions

Reading: None

- Final Exam -
- Final Project due -
 
[Extra] 9 SQL built-in Functions
Arithmetic functions - ABS, RAND, ROUND, TRUNCATE
Character functions - CONCAT, LENGTH, SUBSTR, TRANSLATE
The CASE expression
Date functions - Current date, date manipulation, date formatting

Reading: Chapter 7, 12 (Teach Yourself SQL in One Hour a Day)
 
[Extra] 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)
 
[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