Osprey-1_edited.jpg
SELECT FISH
FROM LAKE
WHERE BIRD = 'Osprey';
SQL is that easy!

Thanks for visiting my SQL site.  I have been working with SQL for over 25 years and have learned how to simplify learning SQL while making it interesting, even though the SQL language itself is already not complicated to learn.  I hope you enjoy your visit and find the information here useful in your SQL journey and pursuit of superior data management.  - Ryan

tysqlbook.jpg

Teach Yourself SQL in 24 Hours, 7th Edition

 

Your step-by-step guide to master the fundamentals of SQL with examples, hands-on exercises, a bonus workshop for the road, and a sample database with the code you need to get started.  Compatible with Oracle, Microsoft, or any relational database that uses standard SQL features.

Get a copy of the book:

Amazon.com

Pearson Education

About Ryan
x-ryan-stephens-1.jpg

Ryan is an entrepreneur who has built his career and multiple IT firms around SQL, relational databases, and data management. Ryan has over 25 years of experience with SQL and has worked as a programmer, developer, designer, database administrator, consultant to large enterprise, and college instructor.  Ryan has authored several SQL-related books for Pearson Education, some of which are internationally published.  Ryan has mentored other consultants for years and currently teaches online SQL classes for Pearson Education and O'Reilly.  The 7th Edition of his latest book, Teach Yourself SQL in 24 Hours, has just been released and remains a popular SQL training tool for individuals, organizations, and universities.

SQL Short

Back to the Basics - SQL and Referential Integrity

January 2022

 

Referential integrity is the hallmark of any relational database.  The following figure represents this concept with a parent table, EMPLOYEES, and a child table, DEPENDENTS.  EMPLOYEES has a primary key that ensures a unique entry for each employee, and DEPENDENTS has a foreign key that references the primary key, ensuring that each dependent record has a corresponding parent record. 

In this example, Kelly Mitchell has 3 dependents.  Kelly's record cannot be deleted because of the foreign key that represents child records.  The child records would have to be deleted first in order to delete Kelly's record.  Likewise, a new dependent cannot be created unless there is an associated parent key to which it references.  Referential integrity is important for managing data and comes in handy when using SQL to query the database effectively.