|Class website:||[oit2.sps.nyu.edu/~sultans/sql] (or)||[samsultan.com/sql]|
|Course Hours:||9:00am - 1:00pm|
+ course outline
+ student listing
examples & demos
+ homework submission
+ student evaluation & comments
Structured Query Language (SQL) is the language used to manipulate data in relational databases. Learn to use SQL to select, update, insert, and delete data from database tables, and acquire hands-on experience with both Oracle and MySQL. Learn how to select data from multiple tables using joins and unions, understand how to create sub-queries to develop more complex retrieval capabilities, and use DDL to create your own database and to populate tables. In addition, learn about database design, table relationships, and normalization techniques. This course prepares you to work with any relational database, such as Oracle, DB2, SQL Server, or MySQL.
The objective of this course is to teach you the fundamentals behind the SQL language. We will discuss the concepts of databases in general, and more specifically the relational database model. We'll examine the various database engines that support this model. We will learn about SQL (Structured Query language) both as an ANSI standard language and more some vendor specific extensions. We will also use DDL (Data Definition Language) to create and delete database objects, and DML (Data Manipulation Language) to access and manipulate those objects.
This course will teach you all relevant SQL concepts more from an ANSI SQL2 standard point of view. Some topics, and examples however will need to be discussed with a specific database engine in mind. This course will cover SQL from both an Oracle and a MySQL point of view
The focus of the course will be on the following topics:
Required Books -
How to Submit Homeworks.
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.
Please Note: The Office of the University Registrar maintains individual records of students enrolled in NYU and is the only
department authorized to record an official grade. Final grades are reported on NYU-Albert.
To receive your final grade at the end of the semester,
follow these steps:
Introduction to databases|
What is a database?
The History of databases
The various database models
Object & Object relational databases
NoSQL and Big Data databases
Introduction to SQL|
DDL - Data Definition Language
DML - Data Manipulation Language
The SELECT statement
Choosing distinct values
The WHERE clause
Comparing with LIKE
Logical operators, AND, OR, NOT
Creating computational columns
|Reading:||Chapters 2, 3|
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
Set operators, UNION, INTERSECT, MINUS
Combining Join with UNION
SQL built-in Functions|
Numeric functions - CEIL, FLOOR, ROUND, TRUNCATE, etc.
String functions - CONCAT, LENGTH, SUBSTR, REPLACE, etc.
The CASE expression, 2 flavors
Date functions - MySQL and Oracle
Current date, date manipulation, date formatting
|Reading:||Chapter 7 (Skip Aggregate functions), 12|
Aggregating and Grouping|
Aggregate functions - SUM, COUNT, AVG, MIN, MAX
The GROUP BY clause
The HAVING clause
Finding Duplicate Records
GROUP BY with ROLLUP feature
The ORDER BY clause Pivoting rows into columns
|Reading:||Chapters 7 (Aggregate functions), 4|
Using SELECT Sub-Queries|
Subqueries as filters
Subqueries as inline views
Subqueries as additional derived columns
Where [NOT} EXISTS in Subquery
Finding the last record from a set
Pivoting rows into columns
Creating database objects|
What is a primary key?
What is a foreign key?
What is an index?
SQL data types
Adding a primary key
Altering table definition
MySql Auto Increment
|Reading:||Chapters 9, 10, 15|
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)
The MERGE statement (Oracle)
The Logical and Physical Model
Understanding data normalization
First normal form
Second normal form
Third normal form
Pros & cons of data normalization
Designing Self-join relationship
Designing for an ODS (Reporting Database)
Designing for a Data Warehouse
Creating and using views
Using the Data Dictionary - MySql
Using the Data Dictionary - Oracle
The show statement (MySql)
Loading data from a file
Unloading data into a file
Importing a database or table(s)
Exporting a database of table(s)
|Reading:||Chapters 13, 18|
- Final Exam -