SQL Server Forums
Profile | Register | Active Topics | Members | Search | Forum FAQ
 
Register Now and get your question answered!
Username:
Password:
Save Password
Forgot your Password?

 All Forums
 General SQL Server Forums
 New to SQL Server Programming
 Star Schema
 New Topic  Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic  

toseef_asim
Starting Member

Pakistan
1 Posts

Posted - 06/05/2012 :  04:00:32  Show Profile  Reply with Quote
Write SQL statements to construct the "Star Schema" given.
Guide lines: Use appropriate data types for the table attributes.
Show the Primary/Foreign key constraints.
Please Check the code written is correct or not.

Create table Account_holder (
Account_holder_id int primary key,
Name varchar(100),
NIC_no int,
Address varchar(300),
Phone_no int,
Email varchar(100)

)

Create table account (
Account_ID int PRIMARY KEY,
Account_name varchar(100),
Account_type varchar(50),
Account_no int,
Profit_rate int
)



create table savings (
Account_holder_ID FOREIGN KEY REFERENCES Account_holder(Account_holder_id),
Account_ID int FOREIGN KEY REFERENCES Account (Account_ID),
Time_ID int FOREIGN KEY REFERENCES Time (Time_ID),
Bank_ID int FOREIGN KEY REFERENCES Bank (Bank_ID),
Saving int PRIMARY KEY
)


create table time (
Time_ID int PRIMARY KEY,
Date datetime,
Week int,
Month varchar(100),
Quarter int,
Year varchar(100)
)


create table Bank (
Bank_ID int PRIMARY KEY,
Bank_name varchar(250),
Branch_name varchar(250),
Town varchar(50),
City varchar(50),
Zone varchar(50),
Province varchar(50)
)

Please Check the code and identify errors.
regards
Toseef asim
toseef_asim@yahoo.com

Edited by - toseef_asim on 06/05/2012 04:22:36

nigelrivett
Flowing Fount of Yak Knowledge

United Kingdom
3328 Posts

Posted - 06/05/2012 :  04:31:10  Show Profile  Visit nigelrivett's Homepage  Reply with Quote
Star schema is often just a fact table with keys referencing all the dimensions - which is what yoou have.
Would expect there to be a measure on the savings table.
Would expect an amount if you are recording transactions. Maybe a transaction type too.
Could just be the total with the last time it is updated though.

==========================================
Cursors are useful if you don't know sql.
SSIS can be used in a similar way.
Beer is not cold and it isn't fizzy.
Go to Top of Page
  Previous Topic Topic Next Topic  
 New Topic  Reply to Topic
 Printer Friendly
Jump To:
SQL Server Forums © 2000-2009 SQLTeam Publishing, LLC Go To Top Of Page
This page was generated in 0.04 seconds. Powered By: Snitz Forums 2000