Learning Library

← Back to Library

Relational Database Fundamentals Explained

Key Points

  • Relational databases, a technology nearing 50 years old, organize data into tables that model real‑world entities such as books, with columns for attributes (e.g., title, author) and rows for individual records identified by primary keys.
  • SQL (Structured Query Language) provides a standard way to retrieve and manipulate this tabular data, for example using `SELECT` statements to list all books.
  • Relationships between different entities are captured through foreign keys, allowing one‑to‑many or one‑to‑one links (e.g., a book’s author ID referencing an author table).
  • Normalizing data into separate tables (e.g., distinct tables for books and authors) reduces redundancy and improves data integrity while enabling complex queries that join related information.
  • Understanding these core concepts helps developers decide when a relational database is the right choice for new projects, especially when consistent, relational data modeling and powerful query capabilities are needed.

Full Transcript

# Relational Database Fundamentals Explained **Source:** [https://www.youtube.com/watch?v=OqjJjpjDRLc](https://www.youtube.com/watch?v=OqjJjpjDRLc) **Duration:** 00:07:52 ## Summary - Relational databases, a technology nearing 50 years old, organize data into tables that model real‑world entities such as books, with columns for attributes (e.g., title, author) and rows for individual records identified by primary keys. - SQL (Structured Query Language) provides a standard way to retrieve and manipulate this tabular data, for example using `SELECT` statements to list all books. - Relationships between different entities are captured through foreign keys, allowing one‑to‑many or one‑to‑one links (e.g., a book’s author ID referencing an author table). - Normalizing data into separate tables (e.g., distinct tables for books and authors) reduces redundancy and improves data integrity while enabling complex queries that join related information. - Understanding these core concepts helps developers decide when a relational database is the right choice for new projects, especially when consistent, relational data modeling and powerful query capabilities are needed. ## Sections - [00:00:00](https://www.youtube.com/watch?v=OqjJjpjDRLc&t=0s) **Intro to Relational Databases** - Jamil Spain introduces relational database concepts, explaining how tables, columns, and unique IDs map data items and relationships for software projects. - [00:03:08](https://www.youtube.com/watch?v=OqjJjpjDRLc&t=188s) **Foreign Keys & Indexing for Efficient Queries** - The speaker explains how foreign keys link tables and how creating indexes on frequently queried columns speeds up data retrieval by maintaining an up‑to‑date cache of values. - [00:06:13](https://www.youtube.com/watch?v=OqjJjpjDRLc&t=373s) **Locking, Concurrency, and Views in Relational Databases** - The speaker explains how relational databases manage large SQL queries, introduce code views, and ensure data consistency through built‑in locking and concurrency mechanisms for multiple simultaneous users. ## Full Transcript
0:00I've got a pop quiz for you. 0:02What database system has been around 0:04for almost 50 years? 0:07I guess you can guessed it by the 0:08topic of this video. 0:10It's a relational database. 0:12Hello, my name is Jamil Spain, 0:14Developer Advocate with the IBM 0:16Cloud and Brand Technical 0:18Specialists in the U.S. 0:20Financial Services market. 0:22And today's talk, we're going to 0:23dive a little bit into relational 0:25databases. 0:26I'm going to get into some of the 0:27characteristics of the database 0:29model and also some benefits 0:32that it provides for you when making 0:34your decision that you want to use 0:36this for your next project 0:38to get started. 0:39Let's talk about the structure 0:41of a relational database 0:42system. 0:44It's going to pretty much map 0:46out your data points 0:48and bring out the relationships 0:50in that. And the way that it 0:51accomplishes that is through. 0:53The first thing is making tables, 0:55which represents particular 0:57items or nouns or particular 0:59entities of your particular 1:01system that you want to actually 1:03prototype. So let's say I 1:05have a bunch of books. 1:09Now this is going to be a table. 1:11It accomplishes the attributes 1:13of these books by having columns 1:16and columns will be things like 1:18name. 1:21Date. 1:23OK, maybe author. 1:26Of course, got to have a author for 1:27a book and every. 1:30Table is going to have an ID, feel 1:32some way to uniquely identify 1:34it. Each each row 1:37of this. 1:39Database table represents an 1:41actual record or an item, 1:43a type of book. 1:44That's how it really fulfills 1:46that ability to hold the database 1:48system there. 1:51And then as you wait, you 1:53kind of query out this particular 1:55system is through what we call a 1:58you will a structured query 2:01language. 2:02And it's a particular system, you 2:04can say select. 2:07All the books. 2:12And give me all this data out 2:14for me to use. 2:15Now we have one particular item 2:17here books, but where it really 2:19comes, you really see the power of a 2:21relational database. 2:22Let's say now I want to 2:25show the authors. 2:30And the way that relational 2:31databases can really provide 2:33the structure of relating these two 2:35entities together is by 2:37describing them through a 2:39particular entity or relationships. 2:41You have one that you're here about 2:43where books can have multiple 2:45authors, so maybe a one. 2:47To many. 2:51You can have a one 2:53to one. 2:55And just a couple of relationships 2:57you can you can kind of mirror 2:59within the database system, so one 3:01way that I can have this kind of a 3:03normalized structure is to say 3:05definitely the authors 3:07is going to have. 3:09Its own particular ID 3:11and name any, any any 3:13any particular order of attributes 3:15that I want to describe there, 3:17but I can also one of these fields 3:19can be an actual number 3:22that actually relates to the ID. 3:26Of this feel, and this is what's 3:27known as a foreign key. 3:30And of course, there will be a name 3:31there, so when I do my query, the 3:33next query I do, I 3:35can reference both these tables 3:37and say, Hey, give me all the books 3:39and give me more of the author 3:40information from this table using 3:43this foreign key to 3:45describe that particular structure 3:47there. 3:48And you can imagine you'll be 3:49running a lot of these queries a 3:50lot, and there are some benefits 3:52or some things that are provided to 3:54help with those to speed 3:56up these queries and make them 3:58operate as efficiently as possible. 4:00You have the database will provide 4:02ways that you can kind of set an 4:03index. Let's say that I'm often 4:05querying and always trying to pull 4:07out by name or by date. 4:09I can set an index. 4:12On this particular column, 4:14which will automatically index all 4:16the values, so the next time you 4:17run, this query is going to pull 4:19from what we like to call this cache 4:21of all the values. 4:23Most importantly, every 4:24time new roles are added, 4:27records are added to this particular 4:30table. The index keeps building 4:32this recent, I like to say, 4:34cache of all these values, so it's 4:35always keeping up to date 4:38to work there. 4:39So this is all the characteristics 4:41of what you kind of have to model 4:43out your particular 4:44application that you want to build 4:46and describe how the entities 4:48are related to each other. 4:50Now let's switch over here to some 4:51of the benefits that you're going to 4:53get out of the box with 4:55a relational database 4:58that you want to use. 4:59The first we'll talk about 5:01is actual 5:03consistency. 5:10Now, this is useful because let's 5:11say there is some point where I want 5:13to run multiple of these 5:14transactions. 5:15Let's say I'm modeling an inventory 5:17system for an E commerce 5:18application, and I have the need 5:20to write several 5:22queries in a row that may 5:24manage a couple of 5:26different subsystems. 5:28But if one of those queries fails, 5:30I want the option to be able 5:32to roll back. 5:36The whole set of all 5:38those queries, just to make sure 5:40that my data always maintains 5:42some consistency there. 5:44The second is the option 5:46to do stored procedures. 5:50Sounds like a very complicated 5:52word there. 5:53But think of store procedures as 5:56the ability to write multiple blocks 5:58or functions of code, 6:00or if there are a certain amount of 6:01queries that I continue to always 6:03run, I can kind of model 6:05these. So it takes me less 6:07code to write that particular 6:10to access that same functionality 6:11with less SQL code. 6:13And as you start to get into more 6:15SQL writing with 6:17relational databases, you'll see 6:19queries can get pretty big. 6:21Another way 6:23you can do this, as well as another 6:24topic code views here. 6:26Definitely want to introduce some of 6:27these keywords as you do your deeper 6:29dove. You were able to see a lot 6:31of these and it'd be familiar 6:33to you. 6:34And the last one is a mechanism 6:36to handle locking 6:38in the database. 6:41And concurrency. 6:45Why is that important? 6:50Well, at some 6:52point multiple users are going 6:54to want to use the database, maybe 6:56at the same time, maybe two 6:57applications are going to be adding 6:59in books. 7:00And if the first application 7:02is making a particular 7:04insert into this table. 7:06You're going to want to make sure 7:07that the database is locked until 7:09that right is done and then 7:11the second application has its 7:13ability to go in and make its insert 7:15as well. 7:16So these are all built into 7:18a lot of the relational databases 7:20that you use. 7:21A lot of these benefits will be 7:23provided for you out of the box, not 7:24necessarily something you'll have to 7:27write in code, but just know 7:29that you'll have this at top of mind 7:31when you are kind of selecting 7:33to use a relational database for 7:35your next project. 7:37I hope this is good for you to 7:38understand the foundation of 7:40relational databases. 7:42Talk to you next time. 7:44If you have questions, please drop 7:46us a line below. 7:47And if you want to see more videos 7:49like this in the future, please 7:51like and subscribe.