



























Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
Prepare for your exams
Study with the several resources on Docsity
Earn points to download
Earn points by helping other students or get them with a premium plan
Community
Ask the community for help and clear up your study doubts
Discover the best universities in your country according to Docsity users
Free resources
Download our free guides on studying techniques, anxiety management strategies, and thesis advice from Docsity tutors
A set of lecture notes from CSE 344, a course on data management. The lecture focuses on constraints in E/R diagrams and SQL. The notes cover topics such as weak entity sets, key constraints, and foreign key constraints. The document also includes examples of updates and the types of constraints used in modeling. The notes are from Fall 2013 and include announcements for the class.
Typology: Lecture notes
1 / 35
This page cannot be seen from the preview
Don't miss anything!
We are learning about database design
Person Company Product buys makes employs name CEO price address name ssn address name 5
Team University affiliation sport number name Team(sport, number, universityName) University(name) What does this say?
Finding constraints is part of the modeling process. Commonly used constraints: Keys: social security number uniquely identifies a person. Single-value constraints: a person can have only one father. Referential integrity constraints: if you work for a company, it must exist in the database. Other constraints: peoples’ ages are between 0 and 150.
address name ssn Person Product name category price No formal way to specify multiple keys in E/R diagrams Underline: 11
Product Company makes Product Company makes Each product made by at most one company. Some products made by no company Each product made by exactly one company.
Product Company makes
Q: What does this mean? A: A Company entity cannot be connected by relationship to more than 99 Product entities
CREATE TABLE Product ( name CHAR(30) PRIMARY KEY, category VARCHAR(20)) CREATE TABLE Product ( name CHAR(30), category VARCHAR(20) PRIMARY KEY (name)) Product(name, category)
CREATE TABLE Product ( name CHAR(30), category VARCHAR(20), price INT, PRIMARY KEY (name, category)) Name Category Price Gizmo Gadget 10 Camera Photo 20 Gizmo Photo 30 Gizmo Gadget 40 Product(name, category, price)
CREATE TABLE Purchase ( prodName CHAR(30) REFERENCES Product(name), date DATETIME) prodName is a foreign key to Product(name) name must be a key in Product Referential integrity constraints May write just Product if name is PK
Name Category Gizmo gadget Camera Photo OneClick Photo ProdName Store Gizmo Wiz Camera Ritz Camera Wiz Product Purchase