Assignment 7

Creating and Altering tables

Instructions


Write the SQL to create the following tables. Make primary key fields identitys starting at 1 and counting by 1. Make sure you run the code to create the tables

LoginTable
Column Data Type Allow Nulls Constraints
LoginKey int No Primary Key
UserName NVarchar(25) No unique
UserPassword Nvarchar(25) No Unique
PersonKey int No Foreign Key

GrantDetail
Column Data Type Allow Nulls Constraints
GrantDetailKey int No Primary Key
GrantKey int No Foreign Key
GrantDetailDate DateTime No none
DetailNotes xml Yes none

3. Change the table Person. Add a column called "Title" with an Nvarchar(20) data type.

4. Change the table Employee to add the colomn "Position" NVarchar(20)

5. Add a check constraint onto the "Zip" column in the table PersonAddress. The zipcode is to be constrained to these specific codes (98001, 98002,98010, 98011, 98012, 98013)