As I believe I've mentioned in an earlier video, a constraint is basically a rule we can put in our database that prevents someone from putting the wrong data in. It protects our relationships and data integrity. Because the goal of these constraints are to protect our data integrity, you may hear them called integrity constraints.
There are many integrity constraints we are going to talk about:
There is also the DEFAULT attribute.
These are all keywords we can add to our columns that will change the way the database works with our data and also prevents incorrect data.
NOT NULL is a constraint you can put on a column that prevents nulls. A null is the absence of a value. When we say null, we are saying that every single row has to have a value for this column.
UNIQUE is a constraint that makes every row have a unique value for this column. Now note, this does not require values to be put it, and it will allow multiple rows to be null.
Next, we are going to talk about primary keys. What qualifies a column as a candidate key? First, not a single row should have a null for that column. Second, every row must be unique. The primary key constraint is essentially a combination of the NOT NULL constraint and the UNIQUE constraint.
The foreign key constraint sets the requirement that any value in this column for any row must match a row in another column.
Check constraints allow us to be more strict with what data is allowed in our database. NOT NULL and UNIQUE give some level of restriction, but what if we want something more specific? For example, what if we only want values between 0 and 100? That is where check constraints come in. When using check constraints, you give a boolean expression. A boolean expression is something that can be evaluated to true or false. It will only insert the row if the value you try to put into the row makes the expression evaluate to true. So if you put in a value too great or small, the expression will be false and the data is not allowed to be entered.
The default constraint is a value you can give a column, and if for any reason when the row is created in the table a value is not provided, the default value will be given. So for example, we could have a bank account table where the balance defaults to 0.
How do you actually implement these constraints when you are creating a table? In the next video we are going to be adding these to our users table. Please be sure to subscribe!
Support me on Patreon: http://www.patreon.com/calebcurry
Subscribe to my newsletter: http://bit.ly/JoinCCNewsletter
More content: http://CalebCurry.com
Amazing Web Hosting - http://bit.ly/ccbluehost (The best web hosting for a cheap price!)
Caleb does the main oracle (the paid for version) still use sql developer? and does it still work in the same way you are showing in the videos. Basically will i be able to learn with the free oracle 11g and then be comfortable using the main oracle for databases? By the way thanks for the videos very helpful
Russian women it is unique essences. They put family above al. They are always ready to offer the outstanding career to be with the husband and children. If you will give her a little attention, love and care, if you will show her that you appreciate her as the wife and the mistress of the house, will admire with her beauty and wit, she will be true to you to the death. The grateful woman will make you in 100 times more happily if you estimate her diligence and will love her. I wish you to meet on my site the fine Russian girl who becomes to you the excellent wife and the partner, who will fill your life with love and happiness!
Marriage agency City of Russian Brides is an dating and marriage service for singles who wish to meet most beautiful Ukrainian and Russian ladies for correspondence and marriage. We provide true pictures and information of real, beautiful, sexy, intelligent, educated ladies. Welcome to A City of Brides - online photo personals mail order bride catalog of single women from Russia looking for dating and marriage worldwide. Please, bookmark our site now Our database is frequently updated. So, please visit our profiles gallery single women now. And dont forget to visit us next time.
Over recent years in the internet more and more myths emerge connected with Russian brides (under a term ‘Russian’ one should understand Ukrainian, Belarussian and Moldavian girls. We will try to explain where there is truth and where there is invention. In this respect many characteristics of Ukrainian girls and mysterious traits of a Russian soul will become understandable for you. Facts, statistics, opinion of experts, interesting articles collected in a FAQ format – you can find all this on our site.