MySQL 13 - Domain Integrity

submitted by mkenny400 on 03/20/18 1

This video will introduce domain integrity. It would be helpful first to know what domain means. In the context of software development, domain defines what kind of data is expected or allowed. This may be tied to what is known as business rules. Business rules are the rules that say what the database is supposed to allow and not allow. There is a fine line between business rules and domain integrity, so let's go in a little more detail. A business rule is given in a spoken language, such as English. It is a non-technical way of describing what the data is supposed to be. For example, we could say that the business rule for a certain column is that it is supposed to store a salary. This business rule could then be described technically as a column that stores only integers. The technical requirement described would be the domain. Domain integrity means that all of the data in a column with business rules is of the right format and has appropriate content. We can go a step further and say that row has to have a value (NOT NULL) or has to be UNIQUE. How do we acquire data integrity? There are a few ways. The first is with a data type. This is the easiest way to restrict certain types of data. What is a data type? Looking at the word it becomes quite clear. The data type is the type of data. You have to select a data type for each column in a database. The important classifications of data types are numeric, string, and date. In MySQL, an example of a data type is INT. By giving a column this data type, you can force the data to be a number. The second way is with constraints. Using constraints, we could force every row to have a salary, or we could say all of the salaries have to be unique (which sounds like a dumb idea). In some databases we can even get more specific in our domain using what is known as a check constraint. This allows us to do fancy stuff like forcing every salary to be within a certain range. Unfortunately, MySQL does not support these. There are ways to emulate them. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Support me! www.patreon.com/calebcurry Subscribe to my newsletter: eepurl.com/-8qtH Donate!: bit.ly/DonateCTVM2. ~~~~~~~~~~~~~~~Additional Links~~~~~~~~~~~~~~~ More content: CalebCurry.com Facebook: www.facebook.com/CalebTheVideoMaker Google+: plus.google.com/+CalebTheVideoMaker2 Twitter: twitter.com/calebCurry Amazing Web Hosting - www.dreamhost.com/r.cgi?1487063 (The best web hosting for a cheap price!)

Leave a comment

Be the first to comment

Collections with this video
Email
Message
×
Embed video on a website or blog
Width
px
Height
px
×
Join Huzzaz
Start collecting all your favorite videos
×
Log in
Join Huzzaz

facebook login
×
Retrieve username and password
Name
Enter your email address to retrieve your username and password
(Check your spam folder if you don't find it in your inbox)

×