From the course: Database Foundations: Data Structures
Unlock the full course today
Join today to access over 25,000 courses taught by industry experts.
Solution: Set additional constraints on the data
From the course: Database Foundations: Data Structures
Solution: Set additional constraints on the data
(bright music) - [Instructor] In this challenge, we're given a table for job postings and we need to alter its design to add in a number of different constraints that we want enforced before records can be stored in the table. Adding constraints on the data will help ensure that everything is entered in consistently and in a way that aligns with the business rules and formatting expectations that we have. So here is the initial CREATE TABLE statement that we have to work with. And so now we just need to go through and add in all of the different constraints. So the first one is to add in the primary key constraint. I'll just type in a comment there so we can tell where I'm at. And this is going to alter the table called JobPostings. And this is the table that's created right here. You can see the different columns that are involved with that. So we need to alter the table JobPostings, and we're going to add in our primary key constraints. So ADD CONSTRAINT. We can name the constraint…
Contents
-
-
-
-
-
-
-
-
- (Locked) Validate data with constraints3m 9s
- (Locked) Null constraints5m 34s
- (Locked) Unique constraints3m 46s
- (Locked) Setting default values3m 14s
- (Locked) Check constraints3m 8s
- (Locked) Challenge: Add constraints to a table46s
- (Locked) Solution: Add constraints to a table6m 29s
- (Locked) Solution: Set additional constraints on the data10m
- (Locked)
-