This relationship related question has two potential answers. The first answer (and the one that you want to hear) is the use of foreign key constraints. A foreign key constraint is used to maintain referential integrity. It is used to ensure that a field in a table will only hold values that are already defined in another field in a different (or the same) table. That field is the candidate key (usually a primary key of the other table).
The other option is the use of triggers. Triggers can be used to ensure the same effect of constraints in a roundabout way, but it is much more difficult to set up and maintain, and the performance is typically worse. Because of this, Microsoft recommends that developers use foreign key constraints instead of triggers for maintaining referential integrity.
Published Questions
How can you ensure that a table named TableB with a field named Fld1 will only have those values in the Fld1 field that
Posted by Devin 2 days ago (Editorial)What is a performance consideration of having too many indexes on a production online transaction processing (OLTP)table
Posted by Devin 2 days ago (Editorial)
You are looking for the applicant to make some reference regarding data manipulations. The more indexes on a table, the more time it takes for the database engine to update, insert, or delete data, as the indexes all have to be maintained as the data manipulation occurs.
What can be used to ensure that a field in a table only accepts a certain range of values?
Posted by Devin 2 days ago (Editorial)
The answer you want to hear is a Check constraint, which is defined on a database table that limits the values entered into that column. These constraints are relatively easy to create, and they are the recommended type for enforcing domain integrity in SQL Server.
Triggers can also be used to restrict the values accepted in a field in a database table, but this solution requires the trigger to be defined on the table, which can hinder performance in certain situations. For this reason, Microsoft recommends Check constraints over all other methods for restricting domain integrity.
Triggers can also be used to restrict the values accepted in a field in a database table, but this solution requires the trigger to be defined on the table, which can hinder performance in certain situations. For this reason, Microsoft recommends Check constraints over all other methods for restricting domain integrity.
What is the difference between an OUTPUT parameter and a return parameter?
Posted by Devin 2 days ago (Editorial)
If the applicant is able to answer this question correctly, the odds are good that they have some experience working with stored procedures.
A return parameter is always returned by a stored procedure, and it is meant to indicate the success or failure of the stored procedure. The return parameter is always an INT data type.
An OUTPUT parameter is designated specifically by the developer, and it can return other types of data, such as characters and numeric values. (There are some limitations on the data types that can be used as output parameters.) You can use multiple OUTPUT parameters in a stored procedure, whereas you can only use one return parameter.
A return parameter is always returned by a stored procedure, and it is meant to indicate the success or failure of the stored procedure. The return parameter is always an INT data type.
An OUTPUT parameter is designated specifically by the developer, and it can return other types of data, such as characters and numeric values. (There are some limitations on the data types that can be used as output parameters.) You can use multiple OUTPUT parameters in a stored procedure, whereas you can only use one return parameter.
What is a correlated sub-query? How can these queries be useful?
Posted by Devin 2 days ago (Editorial)
The sub-query contained in the query requests values from the outside query, creating a loop.
What's the difference between DELETE TABLE and TRUNCATE TABLE commands?
Posted by Devin 6 days ago (Editorial)
DELETE TABLE is a logged operation, so the deletion of each row gets logged in the transaction log, which makes it slow. TRUNCATE TABLE also deletes all the rows in a table, but it won't log the deletion of each row, instead it logs the deallocation of the data pages of the table, which makes it faster. Of course, TRUNCATE TABLE can be rolled back.
The answer should follow SAR pattern:
S = Situation
A = Action
R = Result
For ex. sample situation:
Our depatment was getting a many complaints from customers on too many email notifications.
Action:
I did a research and found out that the problem was that each department handled notifications in they own ways. Our group took the responsibility and developed unified cross-company email notification system.
Result:
The system allowed to reduce amount of emails to our clients by combining and sending email according to notification priority.
What’s the difference between a primary key and a unique key?
Posted by Devin 6 days ago (Editorial)
Both primary key and unique enforce uniqueness of the column on which they are defined. But by default primary key creates a clustered index on the column, where are unique creates a non-clustered index by default. Another major difference is that, primary key doesn’t allow NULLs, but unique key allows one NULL only.
Sort Questions
Saved Stories
Common Interview is a perpetual job interview where everyone can be both the interviewer and the interviewed. You can interact by asking interview questions, providing answers for interview questions, and rating which questions and answers are the most applicable. You can even save the best for future reference.
Read more >>.
Read more >>.











