Year 2011 was a year of learning and opportunity for me. My recent book, SQL Server Interview Questions and Answers, has received such overwhelming love and support from all of you. While writing the book, I had two simple goals: (1) Master the Basics and (2) Ignite Learning. There was a constant request from the Community to take the learning of these books to the next level. Here is an article which discusses the Author’s Perspective.
Beyond Relational has come up with a very interesting concept – they have converted a few of the questions from my book into the SQL Quiz. The quiz is indeed focused on my two goals. In addition, it’s going to put the learning of the book to a higher stage. Looking at this novel concept, Vinod Kumar (Co-author) and I have decided to help every participant and reader by giving a few hints and suggestions to solve the quiz.
Auditing is always fun when we do code reviews. And in a product back-end check we found a lot of junk names for the Default constraints inside the database. What are the different ways you can use to create a CONSTRAINT inside SQL Server?
Notes of Vinod Kumar
CONSTRAINTS are critical from a business requirement as we design the databases. Read more about them. Are you still using the RULE mode? Well, be careful because this is getting removed in the future release.
Notes of Pinal Dave
When I heard of a question about how many different types of ways there are in order for us to create a constraint, I could not believe the answers given to this, at first. Maybe it’s because I find it a bit confusing at times. However, I think the real answer to this question can be achieved if we understand the fundamentals properly. It is important to know how many types of constraints exist in SQL Server before trying to figure out how many different ways the constraints can be created. There are also cases when the constraint has not only helped maintain data integrity but also performance.
SQL Server Interview Questions and Answers ISBN: 1466405643 Page#137-139
Prevent Constraint to Allow NULL
Create Default Constraint Over Table Column
Create Primary Key with Specific Name when Creating Table
Creating Primary Key, Foreign Key and Default Constraint
How to ALTER CONSTRAINT
Disable CHECK Constraint – Enable CHECK Constraint
Query to Display Foreign Key Relationships and Name of the Constraint for Each Table in Database
List All The Constraint of Database – Find Primary Key and Foreign Key Constraint in Database
Note: SQL Quiz, winners and prizes are administrated by Beyond Relational. The goal of this blog post is to provide additional learning pointers only.
Reference: Pinal Dave (https://blog.sqlauthority.com)