E in a single update 15 exercise 5101 p 180 16 create

Info iconThis preview shows page 1. Sign up to view the full content.

View Full Document Right Arrow Icon
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: date). 15 Exercise 5.10.1 (p. 180) 16 CREATE DOMAIN Define new domain with constraints: Consider the following relational schema. An employee can work in more than one department; the pct_time field of the Works relation shows the percentage of time that a given employee works in a given department. Emp (eid, ename, age, salary) Works (eid, did, pct_time) Dept (did, budget, managerid) Write a CHECK clause to ensure the following integrity constraint: Employees must make a minimum salary of $1000. CREATE DOMAIN AgeRange INTEGER CHECK (VALUE >= 16 AND Value <= 80); Can use in table definition: CREATE TABLE Students (ID CHAR(9), (ID Name CHAR(30), Login CHAR(20), Age AgeRange, AgeRange, gpa DECIMAL(4,2), UNIQUE (Login), PRIMARY KEY (ID)); Not supported in MySQL. MySQL. 17 18 CREATE DOMAIN (continued) CREATE TYPE Defining default value: To avoid nonsensical comparisions such as comparing sailor ID with boat ID: CREATE DOMAIN AgeRange INTEGER DEFAULT 18 CHECK (VALUE >= 16 AND VALUE <= 80); CREATE TYPE SailorIDType as INTEGER; Not supported in MySQL. MySQL. 19 19 20 Con...
View Full Document

Ask a homework question - tutors are online