Loved by learners at thousands of companies
You’ve already used SQL to query data from databases. But did you know that there's a lot more you can do with databases? You can model different phenomena in your data, as well as the relationships between them. This gives your data structure and consistency, which results in better data quality. In this course, you'll experience this firsthand by working with a real-life dataset that was used to investigate questionable university affiliations. Column by column, table by table, you'll get to unlock and admire the full potential of databases. You'll learn how to create tables and specify their relationships, as well as how to enforce data integrity. You'll also discover other unique features of database systems, such as constraints.
Your first databaseFree
In this chapter, you'll create your very first database with a set of simple SQL commands. Next, you'll migrate data from existing flat tables into that database. You'll also learn how meta-information about a database can be queried.Introduction to relational databases50 xpAttributes of relational databases50 xpQuery information_schema with SELECT100 xpTables: At the core of every database50 xpCREATE your first few TABLEs100 xpADD a COLUMN with ALTER TABLE100 xpUpdate your database as the structure changes50 xpRENAME and DROP COLUMNs in affiliations100 xpMigrate data with INSERT INTO SELECT DISTINCT100 xpDelete tables with DROP TABLE100 xp
Enforce data consistency with attribute constraints
After building a simple database, it's now time to make use of the features. You'll specify data types in columns, enforce column uniqueness, and disallow NULL values in this chapter.Better data quality with constraints50 xpTypes of database constraints50 xpConforming with data types100 xpType CASTs100 xpWorking with data types50 xpChange types with ALTER COLUMN100 xpConvert types USING a function100 xpThe not-null and unique constraints50 xpDisallow NULL values with SET NOT NULL100 xpWhat happens if you try to enter NULLs?50 xpMake your columns UNIQUE with ADD CONSTRAINT100 xp
Uniquely identify records with key constraints
Now let’s get into the best practices of database engineering. It's time to add primary and foreign keys to the tables. These are two of the most important concepts in databases, and are the building blocks you’ll use to establish relationships between tables.Keys and superkeys50 xpGet to know SELECT COUNT DISTINCT100 xpIdentify keys with SELECT COUNT DISTINCT100 xpPrimary keys50 xpIdentify the primary key50 xpADD key CONSTRAINTs to the tables100 xpSurrogate keys50 xpAdd a SERIAL surrogate key100 xpCONCATenate columns to a surrogate key100 xpTest your knowledge before advancing100 xp
Glue together tables with foreign keys
In the final chapter, you'll leverage foreign keys to connect tables and establish relationships that will greatly benefit your data quality. And you'll run ad hoc analyses on your new database.Model 1:N relationships with foreign keys50 xpREFERENCE a table with a FOREIGN KEY100 xpExplore foreign key constraints100 xpJOIN tables linked by a foreign key100 xpModel more complex relationships50 xpAdd foreign keys to the "affiliations" table100 xpPopulate the "professor_id" column100 xpDrop "firstname" and "lastname"100 xpReferential integrity50 xpReferential integrity violations50 xpChange the referential integrity behavior of a key100 xpRoundup50 xpCount affiliations per university100 xpJoin all the tables together100 xp
In the following tracksData AnalystData Analyst Data Analyst Data EngineerSQL for Database AdministratorsSQL Server for Database Administrators
PrerequisitesIntroduction to SQL
Project Lead Automated Journalism at Tamedia
Timo Grossenbacher is a project lead for automated journalism at Swiss publisher Tamedia. Prior to that, he used to be a data journalist working with the Swiss Public Broadcast (SRF), where he used scripting and databases for almost every data-driven story he published. He also teaches data journalism at the University of Zurich and is the creator of rddj.info – resources for doing data journalism with R. Follow him at grssnbchr on Twitter or visit his personal website.
What do other learners have to say?
I've used other sites—Coursera, Udacity, things like that—but DataCamp's been the one that I've stuck with.
Devon Edwards Joseph
Lloyds Banking Group
DataCamp is the top resource I recommend for learning data science.
Harvard Business School
DataCamp is by far my favorite website to learn from.
Decision Science Analytics, USAA