Concept explainers
Primary Key:
A Primary Key in a
Example:
Students in Universities are assigned a unique registration number.
Therefore, in a STUDENT database table, the attribute “reg_no” acts as primary key.
Foreign Key:
Foreign Key is a column in a relational database table which provides a relation between two tables. It provides a cross reference between tables by pointing to primary key of another table.
Example:
In STUDENT database table, the attribute “reg_no” acts as primary key and in COURSE database table in which the student selects his or her course, the same “reg_no” acts as foreign key for the STUDENT table.
Entity Integrity:
Entity Integrity is a
- The primary key of one database table row must not match the primary key of any other row present in the table.
- No component of primary key must be null.
Trending nowThis is a popular solution!
Chapter 3 Solutions
Database Systems: Design, Implementation, & Management
- Do the tables exhibit referential integrity? Answer yes or no, and then explain your answer. Write NA (Not Applicable) if the table does not have a foreign key. FIGURE P3.17 THE CH03_TRANSCO DATABASE TABLESarrow_forwardDo the tables exhibit referential integrity? Answer yes or no, and then explain your answer. Write NA (Not Applicable) if the table does not have a foreign key.arrow_forwardFor each table, identify the primary key and the foreign key(s). If a table does not have a foreign key, write None. FIGURE P3.17 THE CH03_TRANSCO DATABASE TABLESarrow_forward
- Create the table that results from applying an INTERSECT relational operator to the tables shown in Figure Q3.13. FIGURE Q3.13 THE CH03_VENDINGCO DATABASE TABLESarrow_forwardHow is the processing of SQL DDL statements (such as CREATE TABLE) different from the processing required by DML statements?arrow_forwardWhat is a primary key? What is the primary key for each of the tables in the Colonial Adventure Tours database shown in Chapter 1?arrow_forward
- A concise explanation of the many reasons why the use of tables in database design is a good idea could be of some use. Would you mind providing a brief remark on the subject of NULL?arrow_forwardWrite 5 queries with explanations for online book store system,(USE MySQL)-- Write 5 queries. Your queries should do a task that is meaningful in online book store system.-- At least one that joins two or more tables-- At least one that include group functions-- At least one with one or more sub-query(es)-- At least one update-- At least one delete-- At least one include arithmetic functions-- At least one uses aliasarrow_forwardWhy should not an index be generated for every field in every database table?arrow_forward
- When considering creating a join between two tables, how are we demonstrating the concept of "relational" databases? Why is it essential that we create the join by finding a common attribute that is unique in at least one table and look at situations where that attribute has the same value ( is equal ) in both tables?arrow_forwardHow about a summary of the benefits associated with using tables in relational databases? Perhaps you could elaborate on the concept of NULL in a short essay.arrow_forwardImplement a new independent entity phone in the Sakila database. Attributes and relationships are shown in the following diagram: The diagram uses Sakila naming conventions. Follow the Sakila conventions for your table and column names: All lower case Underscore separator between root and suffix Foreign keys have the same name as referenced primary key Write CREATE TABLE and ALTER TABLE statements that: Implement the entity as a new phone table. Implement the has relationships as foreign keys in the Sakila customer, staff, and store tables. Remove the existing phone column from the Sakila address table. Step 2 requires adding a foreign key constraint to an existing table. Ex: ALTER TABLE customer ADD FOREIGN KEY (phone_id) REFERENCES phone(phone_id) ON DELETE SET NULL ON UPDATE CASCADE; Specify data types as follows: phone_id, phone_number, and country_code have data type INT. phone_type has date type VARCHAR(12) and contains strings like 'Home', 'Mobile', and 'Other'. Apply…arrow_forward
- Database Systems: Design, Implementation, & Manag...Computer ScienceISBN:9781305627482Author:Carlos Coronel, Steven MorrisPublisher:Cengage LearningDatabase Systems: Design, Implementation, & Manag...Computer ScienceISBN:9781285196145Author:Steven, Steven Morris, Carlos Coronel, Carlos, Coronel, Carlos; Morris, Carlos Coronel and Steven Morris, Carlos Coronel; Steven Morris, Steven Morris; Carlos CoronelPublisher:Cengage Learning
- A Guide to SQLComputer ScienceISBN:9781111527273Author:Philip J. PrattPublisher:Course Technology Ptr