Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Create table Bills
- (
- BillNo INT NOT NULL,
- MeterNo INT NOT NULL,
- FirstDate datetime NOT NULL,
- FirstDateReading INT NOT NULL,
- CurrentDate as MAX(FirstDate) CurrentDateReadng INT NOT NULL,
- LastDate as DATEADD(m,-1,CurrentDate) LastDateReading INT NOT NULL,
- Usageinm3 as (CurrentDateReadng-LastDateReading),
- Usageinlitres as (Usageinm3 * 1000), TotalBill as (UsageinLitres * 3) Primary Key (BillNo),
- Foreign Key (MeterNo) References MeterReading(MeterNo)
- );
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement