From the course: Choosing a Database: PostgreSQL, MySQL, Mongo, and Cloud
Unlock the full course today
Join today to access over 22,400 courses taught by industry experts or purchase this course individually.
Inheritance and data types - SQL Tutorial
From the course: Choosing a Database: PostgreSQL, MySQL, Mongo, and Cloud
Inheritance and data types
- [Instructor] Postgres is known for being very feature-rich and we don't have the time to go over many of the things that makes Postgres so advanced. So, right now we're going to take a look at two quick examples of these features: Inheritance and Advanced Phenotypes. The first is Inheritance. This works the same way it does in any programming language, where you have a parent object and children objects. We can inherit the parent table to create a child table. It's useful if you are creating many similar tables but don't want to write out the same attributes multiple times. And, we're going to do a quick example of this right now by creating a dessert table that inherits the products table, and the product is food, by the way. So, let's do create table desserts. And, we're going to add an extra column here to check the dessert is chocolate. And, it's going to inherit the products table. So, what that means is that when we…
Practice while you learn with exercise files
Download the files the instructor uses to teach the course. Follow along and learn by watching, listening and practicing.