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.
Many to one relationship:
When one record in a database table is associated with one or more records in another table, the relationship between the two tables is referred as many to one relationship. It is also represented as M:1 relationship.
ENTITY- RELATIONSHIP DIAGRAM (ERD):
Entity- Relationship Diagram is also known as ER Diagram. It is used to define the conceptual view of the database as viewed by the end user. It is used to depict the database’s main components: entities, relationships and attributes.
CROW FOOT ERD:
The Crow Foot ERD is an Entity Relationship Diagram which is used to represent the cardinalities present in the basic ER diagram. It is used to represent the relationships present between two tuples or tables present in the database.
Given database tables:
Table Name: STORE
STORE_CODE | STORE_NAME | STORE_YTD_SALES | REGION_CODE | EMP_CODE |
1 | Access Junction | 1003455.76 | 2 | 8 |
2 | Database Corner | 1421987.39 | 2 | 12 |
3 | Tuple Charge | 986783.22 | 1 | 7 |
4 | Attribute Alley | 944568.56 | 2 | 3 |
5 | Primary Key Point | 2930098.45 | 1 | 15 |
Table Name: REGION
REGION_CODE | REGION_DESCRIPT |
1 | EAST |
2 | WEST |
Trending nowThis is a popular solution!
Chapter 3 Solutions
Database Systems: Design, Implementation, Management, Loose-leaf Version
- Add a new row in the ORDERS table with the following data: Order# = 1023 and Customer# = 1009. Describe the error raised and what caused the error.arrow_forwardUpdate the VID_STATUS attribute of the VIDEO table using a subquery to set the VID_STATUS to OUT for all videos that have a null value in the DETAIL_ RETURNDATE attribute of the DETAILRENTAL table.arrow_forwardThe SERVICE_REQUEST table uses the CHAR data type for the DESCRIPTION and STATUS fields. Is there an alternate data type that could be used to store the values in these fields? Justify your reason for choosing an alternate data type or for leaving the data type as CHAR.arrow_forward
- A new table has been requested to support tracking automated emails sent to customers. Create the table and add data as described below. Tablename: email_log Columns: emailid (numeric), emaildate (datetime), customer# (numeric) Primary key: emailid column, define as an Identity Column Add the following data rows and display resulting rows (if any errors occur, explain why the error is expected) Emaildate = current date, customer# = 1007 Emailid = specify to use the column default value, emaildate = current date, customer# = 1008 Emailid = 25, emaildate = current date, customer# = 1009arrow_forwardWhen must you define constraints at the table level rather than the column level?arrow_forwardDetermine the functional dependencies that exist in the following table, and then convert this table to an equivalent collection of tables that are in third normal form. LOCATION (LOCATION_NUM, LOCATION_NAME, (UNIT_NUM, SQR_FT, BDRMS, BATHS, CONDO_FEE))arrow_forward
- Add two columns to the EMPLOYEES table. One column, named EmpDate, contains the date of employment for each employee, and its default value should be the system date. The second column, named EndDate, contains employees date of termination.arrow_forwardEnsure that the only legal values for the BDRMS column in the CONDO_UNIT table are 1, 2, or 3.arrow_forwardDelete the OWNER_INDEX 3 index from the OWNER table.arrow_forward
- Rename the EMPLOYEES table as JL_EMPS.arrow_forwardWhich of the following characters can be used in a table name? a. b. ( c. % d. !arrow_forwardProblem 1. Using the INVOICE table structure shown in table below do the following: INVOICE Attribute Name Sample Value Sample Value Sample Value Sample Value Sample Value INV_NUM 211347 211347 211347 211348 211349 PROD_NUM AA-E3422QW QD-300932X RU-995748G AA-E3422QW GH-778345P SALE_DATE 15-Jan-2016 15-Jan-2016 15-Jan-2016 15-Jan-2016 16-Jan-2016 PROD_LABEL Rotary sander 0.25-in. drill bit Band saw Rotary sander Power drill VEND_CODE 211 211 309 211 157 VEND_NAME NeverFail, Inc. NeverFail, Inc. BeGood, Inc. NeverFail, Inc. ToughGo, Inc. QUANT_SOLD 1 8 1 2 1 PROD_PRICE $49.95 $3.45 $39.99 $49.95 $87.75 Write the relational schema, draw its dependency diagram, and identify all dependencies, including all partial and transitive dependencies. You can assume that the table does not contain repeating groups and that an invoice number references more than one…arrow_forward
- Np Ms Office 365/Excel 2016 I NtermedComputer ScienceISBN:9781337508841Author:CareyPublisher:Cengage
- COMPREHENSIVE MICROSOFT OFFICE 365 EXCEComputer ScienceISBN:9780357392676Author:FREUND, StevenPublisher:CENGAGE LA Guide to SQLComputer ScienceISBN:9781111527273Author:Philip J. PrattPublisher:Course Technology PtrDatabase Systems: Design, Implementation, & Manag...Computer ScienceISBN:9781305627482Author:Carlos Coronel, Steven MorrisPublisher:Cengage Learning