PHC7065 CRITICAL SKILLS IN DATA MANIPULATION FOR POPULATION SCIENCE
Basic Structured Query Language
Hui Hu Ph.D.
Department of Epidemiology
College of Public Health and Health Professions & College of Medicine
January 28, 2019
Basic SQL
Lab: SQL Part 1
Basic SQL
Relational Databases
Relational databases model data by storing rows and columns in tables
The power of the relational database lies in its ability to efficiently retrieve data from those tables
- in particular where there are multiple tables and relationships between those tables involved in the query
Terminology
Database: contains many tables
Table (or relation): contains rows and columns
Row (or tuple): a set of fields that generally represents an object like a person or a music track
Column (or attribute, field): one of possibly many elements of data corresponding to the object represented by the row
Column
Row
Table
A table is defined as a set of rows that have the same columns
A row usually represents an object and information about the object
Objects are typically physical objects or concepts
All the data referenced by a column are in the same domain and conform to the same constraints
SQL
Structured Query Language: the language used to issue commands to the database
Create a table
Retrieve some data
Update data
Delete data
Common Database Systems
Oracle: large, commercial, enterprise-scale
MySQL: simpler but very fast and scalable, commercial open source
SqlServer: Microsoft
Many other open source projects: SQLite, PostgreSQL