Wentworth Institute of Technology COMP2670 – Databases | Spring 2016 | Derbinsky
SQL: Part 2 (DDL)
Lecture 4
1.29.2016 SQL: Part 2 (DDL) 1
SQL: Part 2 (DDL) Lecture 4 SQL: Part 2 (DDL) 1.29.2016 1 - - PowerPoint PPT Presentation
Wentworth Institute of Technology COMP2670 Databases | Spring 2016 | Derbinsky SQL: Part 2 (DDL) Lecture 4 SQL: Part 2 (DDL) 1.29.2016 1 Wentworth Institute of Technology COMP2670 Databases | Spring 2016 | Derbinsky Outline 1.
Wentworth Institute of Technology COMP2670 – Databases | Spring 2016 | Derbinsky
1.29.2016 SQL: Part 2 (DDL) 1
Wentworth Institute of Technology COMP2670 – Databases | Spring 2016 | Derbinsky
1.29.2016 SQL: Part 2 (DDL) 2
Wentworth Institute of Technology COMP2670 – Databases | Spring 2016 | Derbinsky
1.29.2016 SQL: Part 2 (DDL) 3
Wentworth Institute of Technology COMP2670 – Databases | Spring 2016 | Derbinsky
1.29.2016 SQL: Part 2 (DDL) 4
Wentworth Institute of Technology COMP2670 – Databases | Spring 2016 | Derbinsky
1.29.2016 SQL: Part 2 (DDL) 5
Wentworth Institute of Technology COMP2670 – Databases | Spring 2016 | Derbinsky
1.29.2016 SQL: Part 2 (DDL) 6
Wentworth Institute of Technology COMP2670 – Databases | Spring 2016 | Derbinsky
CREATE TABLE [IF NOT EXISTS] table_name ( column_name1 TYPE [OPTIONS], column_name2 TYPE [OPTIONS], {constraint}, … ); High-level notes
else separate entry, or sometimes separate command
1.29.2016 SQL: Part 2 (DDL) 7
Wentworth Institute of Technology COMP2670 – Databases | Spring 2016 | Derbinsky
1.29.2016 SQL: Part 2 (DDL) 8
Wentworth Institute of Technology COMP2670 – Databases | Spring 2016 | Derbinsky
1.29.2016 SQL: Part 2 (DDL) 9
Wentworth Institute of Technology COMP2670 – Databases | Spring 2016 | Derbinsky
1.29.2016 SQL: Part 2 (DDL) 10
Wentworth Institute of Technology COMP2670 – Databases | Spring 2016 | Derbinsky
1.29.2016 SQL: Part 2 (DDL) 11
Wentworth Institute of Technology COMP2670 – Databases | Spring 2016 | Derbinsky
1.29.2016 SQL: Part 2 (DDL) 12
Wentworth Institute of Technology COMP2670 – Databases | Spring 2016 | Derbinsky
1.29.2016 SQL: Part 2 (DDL) 13
Wentworth Institute of Technology COMP2670 – Databases | Spring 2016 | Derbinsky
– Convenience/code re-use: if multiple queries rely upon a common data transformation – Security: users only see the data they “need” to see (e.g. calculation/join/aggregation over base data) – Performance: a view may optionally be materialized (sometimes indexed), meaning the DBMS actually stores its contents on disk – can reduce query time via caching complex
1.29.2016 SQL: Part 2 (DDL) 14
Wentworth Institute of Technology COMP2670 – Databases | Spring 2016 | Derbinsky
1.29.2016 SQL: Part 2 (DDL) 15
Wentworth Institute of Technology COMP2670 – Databases | Spring 2016 | Derbinsky
1.29.2016 SQL: Part 2 (DDL) 16
Wentworth Institute of Technology COMP2670 – Databases | Spring 2016 | Derbinsky
1.29.2016 SQL: Part 2 (DDL) 17
Wentworth Institute of Technology COMP2670 – Databases | Spring 2016 | Derbinsky
1.29.2016 SQL: Part 2 (DDL) 18
Wentworth Institute of Technology COMP2670 – Databases | Spring 2016 | Derbinsky
1.29.2016 SQL: Part 2 (DDL) 19