Day 2 Learning Objectives Acquire a basic understanding of relational databases Work hands on with PostgreSQL on database fundamentals Learn how these skills can be used to obtain actionable insights
What is SQL? Definition Structured Query Language (SQL) is a language used to manage structured data in a relational database system. SQL is a standard language of the ISO. Reasons For Usage It allows us to quickly and efficiently store and relate data without needing to concern ourselves with deeper infrastructural concerns. SQL Extensions Basically nobody uses plain SQL in the modern day; common SQL extension sets include T-SQL (or MS-SQL), Oracle, MySQL, PostgreSQL, and MariaDB
1970s SEQUEL is developed at IBM Laboratories 1979 Relational Software release the first commercial RDBMS, Oracle. 1986 ISO and ANSI adopt SQL as a standard database language definition 2001 The Rise of Distributed SQL Systems 2020 ???
Installation
Category Space of SQL Commands Data Declaration Language Used to define the database schema CREATE DROP ALTER RENAME TRUNCATE COMMENT Data Manipulation & Query Language Used to manipulate and query relations SELECT INSERT UPDATE DELETE Transactional Control Language Deal with ‘transactions’ within the database COMMIT ROLLBACK
WHAT IS A RELATIONAL DATABASE? And, pertinently, what is a database schema ? A schema is a description of the entities in a database and the relationship between them. max growth A relational database is a collective of data organized by tables, columns and records
SIMPLE DATA MODEL DATABASE (SCHEMA) TABLE (RELATION) FIELD FIELD TABLE SCHEMA
Database Creation The following command set will create a database in a Postgres server: CREATE SCHEMA databasename; OWNER = rolename; CREATE TABLE tablename ( Column1 columntype, Column2 columntype, … ) ;