Question

Answer following questions briefly Explain difference between Disjoint and Overlap constraint rules for super-type and sub-type...

Answer following questions briefly

  1. Explain difference between Disjoint and Overlap constraint rules for super-type and sub-type entity with example of each.
  2. Explain in brief: Primary Key, Candidate Key, and Surrogate Key
  3. Explain the difference between WHERE and HAVING clause of SQL

Homework Answers

Answer #1

i.) The disjoint rule states an entity instance of a supertype can only be a member of one subtype i.e. The disjoint constraint only applies when a superclass has more than one subclass. If the subclass is disjoint, then an entity occurrence can be a member of only one of the subclasses, e.g. student or instructor, you cannot be both.

The overlap rule states an entity instance of a supertype can be a member of multiple subtypes i.e. The overlapping constraints applies when a superclass has more than one subclass. On the other hand, If the subclass is overlapping, then an entity occurrence can be a member of both subclasses, e.g. Consider an employee work-team and assume that certain employees participate in more than one work team. A given employee may therefore appear in more than one of the team entity sets that are lower-level entity sets of employees.

ii.) PRIMARY KEY is a column or group of columns in a table that uniquely identify every row in that table. The Primary Key can't be a duplicate meaning the same value can't appear more than once in the table. A table cannot have more than one primary key.

Rules for defining Primary key:

  • Two rows can't have the same primary key value
  • It must for every row to have a primary key value.
  • The primary key field cannot be null.
  • The value in a primary key column can never be modified or updated if any foreign key refers to that primary key.

In the following example, StudID is a Primary Key.

StudID Roll No First Name LastName Email
1 11 Tom Price [email protected]
2 12 Nick Wright [email protected]
3 13 Dana Natan [email protected]

CANDIDATE KEY is a set of attributes that uniquely identify tuples in a table. Candidate Key is a super key with no repeated attributes. The Primary key should be selected from the candidate keys. Every table must have at least a single candidate key. A table can have multiple candidate keys but only a single primary key.

Properties of Candidate key:

  • It must contain unique values
  • Candidate key may have multiple attributes
  • Must not contain null values
  • It should contain minimum fields to ensure uniqueness
  • Uniquely identify each record in a table

Example: In the given table Stud ID, Roll No, and email are candidate keys which help us to uniquely identify the student record in the table.

StudID Roll No First Name LastName Email
1 11 Tom Price [email protected]
2 12 Nick Wright [email protected]
3 13 Dana Natan [email protected]

SURROGATE KEY is an artificial key which aims to uniquely identify each record is called a surrogate key. This kind of partial key in dbms is unique because it is created when you don't have any natural primary key. They do not lend any meaning to the data in the table. Surrogate key is usually an integer. A surrogate key is a value generated right before the record is inserted into a table.

Fname Lastname Start Time End Time
Anne Smith 09:00 18:00
Jack Francis 08:00 17:00
Anna McLean 11:00 20:00
Shown Willam 14:00 23:00

Above, given example, shows shift timings of the different employee, a surrogate key to uniquely identify each employee.

Surrogate keys in sql are allowed when

  • No property has the parameter of the primary key.
  • In the table when the primary key is too big or complicated.

iii.) WHERE Clause:
WHERE Clause is used to filter the records from the table or used while joining more than one table.Only those records will be extracted who are satisfying the specified condition in WHERE clause. It can be used with SELECT, UPDATE, DELETE statements.

HAVING Clause:
HAVING Clause is used to filter the records from the groups based on the given condition in the HAVING Clause. Those groups who will satisfy the given condition will appear in the final result. HAVING Clause can only be used
with SELECT statement.

The key differences are:

SR.NO. WHERE CLAUSE HAVING CLAUSE
1. WHERE Clause is used to filter the records from the table based on the specified condition. HAVING Clause is used to filter record from the groups based on the specified condition.
2. WHERE Clause can be used without GROUP BY Clause HAVING Clause cannot be used without GROUP BY Clause
3. WHERE Clause implements in row operations HAVING Clause implements in column operation
4. WHERE Clause cannot contain aggregate function HAVING Clause can contain aggregate function
5. WHERE Clause can be used with SELECT, UPDATE, DELETE statement. HAVING Clause can only be used with SELECT statement.
6. WHERE Clause is used before GROUP BY Clause HAVING Clause is used after GROUP BY Clause
7. WHERE Clause is used with single row function like UPPER, LOWER etc. HAVING Clause is used with multiple row function like SUM, COUNT etc.
Know the answer?
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for?
Ask your own homework help question
Similar Questions
Briefly explain difference between endogenous and exogenous variables and provide one example of each type in...
Briefly explain difference between endogenous and exogenous variables and provide one example of each type in the supply and demand model. (Suggested length is 3 sentences)
Explain the difference between primary and secondary deviance. Give an example of each type of deviance...
Explain the difference between primary and secondary deviance. Give an example of each type of deviance to support your answer.
Please answer the following questions concerning this weeks topics: - What is the difference between strategy...
Please answer the following questions concerning this weeks topics: - What is the difference between strategy and tactics? - Give an example of each. - Why is evaluation of a campaign linked to the objectives?
Answer the following questions. 1. Discuss the elements necessary for an effective offer?  Detail each element. 2....
Answer the following questions. 1. Discuss the elements necessary for an effective offer?  Detail each element. 2. What distinguishes a bilateral contract from a unilateral contract? Give a fact pattern for each. 3. How do capacity and legality play a role in contract law? Cite an example for each and explain how a court would approach deciding a case where capacity and a case where legality was at issue. 4. What are the rules used by Courts regarding the interpretation of...
Area 4: Management Please answer the following questions in a succinct and concise manner. Each answer...
Area 4: Management Please answer the following questions in a succinct and concise manner. Each answer should yield about 3-5 sentences. How would you explain the difference between Transactional and transformational leaders? Describe the major functions of Managers. Define SWOT analysis and explain how to apply it in a business situation or setting. Area 5: Management Information Systems Please answer the following questions in a succinct and concise manner. Each answer should yield about 3-5 sentences. What are the two...
Java question, Please answer everything. Thank you Answer the following questions as briefly (but completely) as...
Java question, Please answer everything. Thank you Answer the following questions as briefly (but completely) as possible: What is a checked exception, and what is an unchecked exception? What is NullPointerException? Which of the following statements (if any) will throw an exception? If no exception is thrown, what is the output? 1: System.out.println( 1 / 0 ); 2: System.out.println( 1.0 / 0 ); Point out the problem in the following code. Does the code throw any exceptions? 1: long value...
Read the following case carefully and then answer the questions. In the movie Face/Off, John Travolta...
Read the following case carefully and then answer the questions. In the movie Face/Off, John Travolta got a new look by exchanging faces with Nicolas Cage. Unfortunately, he got a lot of trouble along with it. John could receive a much less troublesome new look by using Botox, a treatment discovered by Vancouver’s Dr. Jean Carruthers, who came upon the cosmetic potential of Botox in 1982 while treating a woman with eye spasms. Botox is marketed by Allergan, a specialty...
READ THE CASE STUDY AND ANSWER THE FOLLOWING QUESTIONS 2nd CASE: An Unexplained Death A 65-year-old...
READ THE CASE STUDY AND ANSWER THE FOLLOWING QUESTIONS 2nd CASE: An Unexplained Death A 65-year-old man of Scandinavian descent was rushed to the Emergency Room of your local hospital after a family member discovered him unconscious in his home. The woman who dialed “911” told the dispatcher that the man, her brother, was the local librarian of the past 10 years and had no spouse or children. She reported that they had spoken the day before, and he had...
read Seasons of Love chapter:measuring a child's life after suicide. please answer the questions : reflect...
read Seasons of Love chapter:measuring a child's life after suicide. please answer the questions : reflect on what happens to the families when there is a suicide in the family, based on the Seasons of Love chapter...how should people be told? What details are best left unshared? below is the story These theories may have a certain face-validity, but they often neglect environmental or contextual factors that are innate to answering the question of “why” a person might engage in...
Please answer the following Case analysis questions 1-How is New Balance performing compared to its primary...
Please answer the following Case analysis questions 1-How is New Balance performing compared to its primary rivals? How will the acquisition of Reebok by Adidas impact the structure of the athletic shoe industry? Is this likely to be favorable or unfavorable for New Balance? 2- What issues does New Balance management need to address? 3-What recommendations would you make to New Balance Management? What does New Balance need to do to continue to be successful? Should management continue to invest...