A Guide to SQL
9th Edition
ISBN: 9781111527273
Author: Philip J. Pratt
Publisher: Course Technology Ptr
expand_more
expand_more
format_list_bulleted
Concept explainers
Expert Solution & Answer
Chapter 7, Problem 22RQ
Explanation of Solution
Referential integrity:
- Referential integrity is the rule that if a table “R” contains a foreign key that equals the table “Q” primary key, then the value of this foreign key must either equivalent value of the primary key for some row in the table “Q” or be null.
Example:
The example for the referential integrity constraints is given below:
STUDENT table:
STUDENT_ID | STUDENT_NAME | DEPARTMENT |
304 | John | Computer Science |
608 | Rose | Earth Science |
BOOKS table:
BOOK_ID | BOOK_NAME | STUDENT_ID |
CS123 | SQL | 304 |
CS576 | C++ | 304 |
CS876 | Java Programming | 302 |
ES103 | Earth Science Basics | 608 |
Explanation:
From the above two tables,
- The primary key of “STUDENT” table is “STUDENT_ID”.
- The primary key of “BOOKS” table is “BOOK_ID” and the foreign key of “BOOKS” table is “STUDENT_ID”...
Expert Solution & Answer
Trending nowThis is a popular solution!
Students have asked these similar questions
Which are the two types of integrity constraints?
How do the two types of integrity constraints differ?
Please written by computer source
Give 10 examples of integrity constraints that you think should hold on the database shown in Figure 1.2.
Chapter 7 Solutions
A Guide to SQL
Ch. 7 - What is a view?Ch. 7 - Which command creates a view?Ch. 7 - Prob. 3RQCh. 7 - What happens when a user retrieves data from a...Ch. 7 - What are three advantages of using views?Ch. 7 - Which command deletes a view?Ch. 7 - Prob. 8RQCh. 7 - Which command terminates previously granted...Ch. 7 - Prob. 10RQCh. 7 - How do you create an index? How do you create a...
Ch. 7 - Prob. 12RQCh. 7 - Does the DBMS or the user make the choice of which...Ch. 7 - Describe the information the DBMS maintains in the...Ch. 7 - The CUSTOMER table contains a foreign key,...Ch. 7 - Prob. 16RQCh. 7 - Prob. 17RQCh. 7 - Prob. 18RQCh. 7 - Prob. 19RQCh. 7 - When would you usually specify primary key...Ch. 7 - Prob. 21RQCh. 7 - Prob. 22RQCh. 7 - Prob. 23RQCh. 7 - Use SQL to make the following changes to the TAL...Ch. 7 - Create a view named ITEM_ORDER. It consists of the...Ch. 7 - Create a view named ORDER_TOTAL. It consists of...Ch. 7 - Write, but do not execute, the commands to grant...Ch. 7 - Prob. 5TDCh. 7 - Perform the following tasks: a. Create an index...Ch. 7 - Delete the index named ITEM_INDEX3.Ch. 7 - Write the commands to obtain the following...Ch. 7 - Prob. 9TDCh. 7 - Prob. 10TDCh. 7 - Toys Galore currently has a credit limit of 7,500....Ch. 7 - Use SQL to make the following changes to the...Ch. 7 - Create a view named RESERVATION_CUSTOMER. It...Ch. 7 - Create a view named TRIP_INVENTORY. It consists of...Ch. 7 - Write, but do not execute, the commands to grant...Ch. 7 - Prob. 5CATCh. 7 - Create the following indexes: a. Create an index...Ch. 7 - Prob. 7CATCh. 7 - Write the commands to obtain the following...Ch. 7 - Prob. 9CATCh. 7 - Ensure that the only legal values for the TYPE...Ch. 7 - Prob. 11CATCh. 7 - Use SQL to make the following changes to the...Ch. 7 - Create a view named CONDO_OWNERS. It consists of...Ch. 7 - Create a view named CONDO_FEES. It consists of two...Ch. 7 - Write, but do not execute, the commands to grant...Ch. 7 - Prob. 5SCGCh. 7 - Prob. 6SCGCh. 7 - Delete the OWNER_INDEX 3 index from the OWNER...Ch. 7 - Write the commands to obtain the following...Ch. 7 - Prob. 9SCGCh. 7 - Ensure that the only legal values for the BDRMS...Ch. 7 - Prob. 11SCG
Knowledge Booster
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.Similar questions
- One way to secure a database is to allow only administrators to have access to create and delete tables. (513)arrow_forwardNot all databases in this series provide relative integrity checks for all foreign keys. You should use the RDBMS tools at your disposal to look for lapses in referential integrity. Complete the missing restrictions and definitions in the respective tables.arrow_forwardYou decided to create a client ID field for the primary key since some clients have the same name as others. Now you need to decide on a name for the field. The field name should make it clear that the field is a unique identifier for each record in order for it to be valuable for others using the database. What field name will help you track the relevant information as you work with this table? a)ClientID . b)PrimaryKey.arrow_forward
- List two reasons why null values might be introduced into the database.arrow_forwardThe StayWell Property Management team considers creating a discount scheme for the property owners with more than one property in the system. You will need to provide all the owner IDs (OWNER_NUM) and the count of properties of the owners with more than one active property in the database. The output columns should be OWNER_NUM and COUNT(*) respectively.arrow_forwardWhat are Situations where default values will improve data integrity and situations where using them May decrease data integrity.arrow_forward
- What are nulls? Which field cannot accept null values? Why?arrow_forwardWrite appropriate SQL DDL statements to define the database schema you made in the previous question. Create all the appropriate Referential Integrity constrains.arrow_forwardplease use sql to answer the following question an erd has been provide Task 1: Creating a Logon Procedure The home page of the Brewbean’s Web site has an option for members to log on with their IDs and passwords. Develop a procedure named MEMBER_CK_SP that accepts the user ID and password as inputs, checks whether they match a valid logon, and returns the member first name+lastname and cookie value. The name should be returned as a single text string containing the first and last name. The head developer wants the number of parameters minimized so that the same parameter is used to accept the password and return the name value. (passwd Paramater as IN OUT use passwd as INPUT firstname||lastname as OUTPUT) Also, if the user doesn’t enter a valid username and password, return the value INVALID in a parameter named p_check. Test the procedure using a valid logon first, with the username rat55 and password kile. Then try it with an invalid logon by changing the…arrow_forward
- What is a "referential integrity constraint"? Give examples to show its uses.arrow_forwardIf we want to keep track of the annual salary that is calculated depending on the stored monthly salary in the database, then what is the suitable attribute type to be used for annual salary? Maximum file size: 10KB, maximum number of files: Filesarrow_forwardComplete the Performing SQL Injection to Manipulate Tables in a Database lab which is located on Infosec Learning's website. Follow the instructions for the lab and export your performance report. When you have completed the lab, attach your performance report by clicking on the title of this assignment and submit it for grading. You are required to submit the following deliverable for grading: Performing SQL Injection to Manipulate Tables in a Database.arrow_forward
arrow_back_ios
SEE MORE QUESTIONS
arrow_forward_ios
Recommended textbooks for you
- A Guide to SQLComputer ScienceISBN:9781111527273Author:Philip J. PrattPublisher:Course Technology PtrEnhanced Discovering Computers 2017 (Shelly Cashm...Computer ScienceISBN:9781305657458Author:Misty E. Vermaat, Susan L. Sebok, Steven M. Freund, Mark Frydenberg, Jennifer T. CampbellPublisher:Cengage Learning
A Guide to SQL
Computer Science
ISBN:9781111527273
Author:Philip J. Pratt
Publisher:Course Technology Ptr
Enhanced Discovering Computers 2017 (Shelly Cashm...
Computer Science
ISBN:9781305657458
Author:Misty E. Vermaat, Susan L. Sebok, Steven M. Freund, Mark Frydenberg, Jennifer T. Campbell
Publisher:Cengage Learning