Microsoft sql server software overall view part 2
Store_Information
SELECT * FROM V_REGION_SALES
Store_Information
|
Store_Name
|
Sales
|
Txn_Date
|
|
A
|
1500
|
Jan-05-1999
|
|
B
|
250
|
Jan-07-1999
|
|
A
|
300
|
Jan-08-1999
|
|
C
|
700
|
Jan-08-1999
|
Geography
|
Region_Name
|
Store_Name
|
|
East
|
C
|
|
East
|
D
|
|
West
|
A
|
|
West
|
B
|
CREATE VIEW V_REGION_SALES\AS
SELECT
A1.Region_Name REGION, SUM(A2.Sales) SALES
FROM Geography A1, Store_Information A2
WHERE A1.Store_Name = A2.Store_Name
GROUP BY A1.Region_Name;
FROM Geography A1, Store_Information A2
WHERE A1.Store_Name = A2.Store_Name
GROUP BY A1.Region_Name;
•NOT NULL - Enforces
a column to NOT accept NULL values
•UNIQUE - Uniquely
identifies each record in a database table
•CHECK - limit the value range that can be placed in a column
•DEFAULT - insert a default value into a column
