Programming and data bases

A.A. 2023/2024
Crediti massimi
Ore totali
Obiettivi formativi
The aim is to provide a comprehensive overview of computer science applied to the solution of real problems. The course will introduce fundamental and advanced programming techniques, using the Python language. Also, it will provide the conceptual and technical tools required to understand and design the specification of a database and to implement it into a relational database.
Risultati apprendimento attesi
Students will be able to
- design and implement programs in the Python language;
- design a database and implement it into a relational database
Corso singolo

Questo insegnamento non può essere seguito come corso singolo. Puoi trovare gli insegnamenti disponibili consultando il catalogo corsi singoli.

Programma e organizzazione didattica

Edizione unica

Primo semestre

Seminar lectures and exercises on the following topics:


Introduction (4 hours)
- Computer and information sciences
- Computer architectures and operating systems
- Basics of computer programming and algorithm design
- Boolean algebra and evaluation of predicates

Introduction to the Python programming language: structure and syntax (12 hours)
- Built-in data types
- Variables
- Basic operators
- Input handling
- Conditional execution
- Loops and iterations
- Strings and regular expressions
- Data structures (tuples, lists, sets, dictionaries)

Advanced programming in Python (14 hours)
- Functions
- List comprehension / higher-order functions
- Recursion
- Files management
- Data visualization techniques

Introduction to object-oriented programming (5 hours)
- Concepts (abstraction and composition)
- Objects, classes and packages
- Attributes and methods (with constructors, getters, and setters)
- Inheritance
- Exceptions


Introduction (2 hours)
· Data versus information. The notions of Information System, Database, and DBMS. Data types, constraints, and data integrity. Queries and applications: transactional and analytical systems. Users, roles, tools and modules of a DBMS.

Relational Theory (6 hours)
· The Relational Data Model: domains, relations, tuples (informal and formal definitions); null values and primary keys.
· Relational Algebra: basic and derived operators. Simple queries.
· Complex queries; query composability and equivalence.

SQL: Structured Query Language (12 hours)
· Definition of domains and tables; primary and foreign key constraints.
· Simple SQL queries (projection, selection, joins, sorting, aggregates).
· Complex queries (set operators, grouping, nesting, views).
· Modifications (of data and schema).
· Advanced schema specification: generic integrity constraints, reaction policies, triggers and procedures (hints).
· Physical data storage, indexing, and query execution cost (hints).

Conceptual and Logical Design (6 hours)
· The Entity-Relationship model: constructs, identifiers, hierarchies and their properties.
· Phases and abstractions in database design (life cycle, strategies, quality measures).
· Logical design: translation principles, hierarchy resolution, management of identifiers, attributes, and associations. Normalization and physical design (hints).

Other Data Models (4 hours)
· Ordered, nested, hierarchical data models. The case of XML.
· Queries and query languages for non-relational data.
No prerequisites different from those required for admission to the Master Degree program.
Metodi didattici
Class lectures, exercises, and occasionally group assignments to be solved during class using the students' laptops.
Materiale di riferimento
The slides presented during the course and many solved exercises are available on "Be e-Poli" (BeeP), the portal for the network activities of students and professors at Politecnico di Milano.

Recommended textbooks:
Database Systems - Concepts, Languages and Architectures
P. Atzeni, S. Ceri, S. Paraboschi and R. Torlone
McGraw Hill - 1999 - ISBN: 978-0072353877
(Freely available at . Chapters 1-8, that cover most of the course content and present well established notions, are still perfectly valid)

Updated version (only available in Italian):
Basi di Dati (5a Edizione)
P. Atzeni, S. Ceri, P. Fraternali, S. Paraboschi and R. Torlone
McGraw Hill - 2018 - ISBN: 978-8838694455

Z.A. Shaw, Learn Python the hard way: A very simple introduction to the terrifyingly beautiful world of computers and code. (3rd Edition) (Zed Shaw's Hard Way Series) 3rd Edition
Modalità di verifica dell’apprendimento e criteri di valutazione
The assessment is based on a written exam at the end of the course, with exercises and open questions on all the topics presented in the course.
Lectures: 96 ore
Docenti: Bernasconi Anna, Braga Daniele Maria