/* Query 3. Write one DDL statement to add a new table Project into exam1. It co
ID: 3736367 • Letter: #
Question
/* Query 3.
Write one DDL statement to add a new table Project into exam1. It contains
the following
three columns:
-ProjNum of char(3) type, which is the primary key of Project.
-Pname of varchar(30) type, which could be null. If it has a value,
its first three
characters must be 'UH2' or 'UB5'.
-Budget of smallmoney type, which cannot be null and must have a
minimum of $1,500.
*/
E EEE dbo.ProjAssignment Columns o Pno (PK, char(3), not null) StulD (PK, FK, char(3), not null) E EEE dbo.Student Columns StulD (PK, char(3), not null) GPA (decimal(3,2), nul)Explanation / Answer
use exam1;
CREATE TABLE Project(
ProjectNum CHAR(3) NOT NULL PRIMARY KEY,
Pname VARCHAR(30) CHECK(SUBSTR(Pname, 0,2) IN ('UH2', 'UB5')),
Budget INTEGER NOT NULL CHECK (Budget >= 1500)
);
Related Questions
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.