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
- 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
- SQL Database Designs Identify the functional dependencies in the following unnormalized table. Convert the table to third normal form. TRIP (TRIP_ID, TRIP_NAME, STATE_ABBREVIATION, STATE_NAME, (GUIDE_NUM, GUIDE_LAST, GUIDE_FIRST))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_forwardHelp with SQL database 2. In database lab01, create 4 tables: course, advisor, student, and department (Note: The order of tables below is not proper for creating tables. Please think about which table should be created first) course (course_id varchar(8), title varchar(50), dept_name varchar(20), credits numeric(2,0), primary key (course_id), foreign key (dept_name) references department (dept_name)) advisor (s_ID varchar(5), i_ID varchar(5), primary key (s_ID), foreign key (s_ID) references student (ID)) student (ID varchar(5), name varchar(20) not null, dept_name varchar(20), tot_cred numeric(3,0), primary key (ID), foreign key (dept_name) references department (dept_name)) department (dept_name varchar(20), building varchar(15), budget numeric(12,2), primary key (dept_name)) . Populate tables (Note: The order of populating table below is not proper. Please think about which table should be populated first) Populate the table "student" with the data below: ('23121', 'Chavez',…arrow_forward
- Explain step-wisearrow_forward1. Create the following tables with appropriate column and table constraints in your chosen database: 1. StudentNumber is a surrogate key 2. CourseNumber is a surrogate key 3. Since both foreign keys are surrogate in parent table, no need to cascade updates. 4. Student deletions should not cascade. 5. Course deletions should cascade. 6. STUDENT(StudentNumber, LastName, FirstName, Phone) 7. COURSE(CourseNumber, CourseName, Course Date, Fee) 8. ENROLLMENT(StudentNumber, CourseNumber, AmountPaid)arrow_forwardplz help with the following: Create a database whose tables are at least in 3NF, showing the dependency diagrams for each table.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