You are on page 1of 26

Databases

INTRODUCTION TO SQL

Izzy Weber
Curriculum Manager, DataCamp
Course goals
1. Understand databases and their structure → Chapter 1

2. Extract information from databases using SQL → Chapter 2

INTRODUCTION TO SQL
Introducing databases

INTRODUCTION TO SQL
Introducing databases

INTRODUCTION TO SQL
Relational databases
De ne relationships between tables of data inside the database

INTRODUCTION TO SQL
Database advantages
More storage than spreadsheet
applications

Storage is more secure

INTRODUCTION TO SQL
Database advantages

INTRODUCTION TO SQL
SQL
Short for Structured Query Language
SELECT *
The most widely used programming FROM patrons
language for databases LIMIT 30

INTRODUCTION TO SQL
Let's practice!
INTRODUCTION TO SQL
Tables
INTRODUCTION TO SQL

Izzy Weber
Curriculum Manager, DataCamp
A seat at the table
Table rows and columns are referred to as records and elds

Fields are set at database creation; there is no limit to the number of records

INTRODUCTION TO SQL
Good table manners

Table names should...

be lowercase

have no spaces—use underscores instead

refer to a collective group or be plural

INTRODUCTION TO SQL
Laying the table: records
A record is a row that holds data on an individual observation

INTRODUCTION TO SQL
Laying the table: fields
A eld is a column that holds one piece of information about all records

INTRODUCTION TO SQL
More table manners

Field names should...

be lowercase

have no spaces

be singular

be di erent from other eld names

be di erent from the table name

INTRODUCTION TO SQL
Assigned seats
Unique identi ers are used to identify records in a table

They are unique and o en numbers

INTRODUCTION TO SQL
The more the merrier

INTRODUCTION TO SQL
Let's practice!
INTRODUCTION TO SQL
Data
INTRODUCTION TO SQL

Izzy Weber
Curriculum Manager, DataCamp
SQL data types

Di erent types of data are stored di erently and take up di erent space

Some operations only apply to certain data types

INTRODUCTION TO SQL
Strings

A string is a sequence of characters such as le ers or punctuation

VARCHAR is a exible and popular string data type in SQL

INTRODUCTION TO SQL
Integers

Integers store whole numbers

INT is a exible and popular integer data type in SQL

INTRODUCTION TO SQL
Floats

Floats store numbers that include a fractional part

NUMERIC is a exible and popular oat data type in SQL

INTRODUCTION TO SQL
Schemas

INTRODUCTION TO SQL
Database storage

INTRODUCTION TO SQL
Let's practice!
INTRODUCTION TO SQL

You might also like