IKH

Semantic Constraints

Suppose you work at Tata Motors and are asked to analyse the data on the prices of different car models. The values can range from ?2 lakhs to around ?12 lakhs if you are looking to sell the cars to middle-class households. Now, imagine you come across a car model that costs ?1 crore. You would need to get rid of this value as it would negatively affect your analysis and generate misleading insights. How can you ensure such values (also known as outliers) are not present in your data? Let’s find out in the upcoming video.

Note

At [02:33], the professor misspeaks that NOT NULL is a semantic constraint. This is, however, not true. You have already learnt that it is an entity constraint.

So, as you learnt in the video, semantic constraints impose additional restrictions on the values in a column. For example, all the mobile numbers in India start with ‘+91’, followed by 10 digits. Using a semantic constraint for this requirement ensures that we do not get incorrect data for any row. For example, a row with a phone number +91987654321 would not be allowed to enter the database as it has only 9 digits after the country code.

Now, let’s have practice questions on the above-learnt topics.

Report an error