Advertisement
Guest User

Untitled

a guest
Aug 12th, 2017
76
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.47 KB | None | 0 0
  1. Create table Bills
  2. (
  3. BillNo INT NOT NULL,
  4. MeterNo INT NOT NULL,
  5. FirstDate datetime NOT NULL,
  6. FirstDateReading INT NOT NULL,
  7. CurrentDate as MAX(FirstDate) CurrentDateReadng INT NOT NULL,
  8. LastDate as DATEADD(m,-1,CurrentDate) LastDateReading INT NOT NULL,
  9. Usageinm3 as (CurrentDateReadng-LastDateReading),
  10. Usageinlitres as (Usageinm3 * 1000), TotalBill as (UsageinLitres * 3) Primary Key (BillNo),
  11. Foreign Key (MeterNo) References MeterReading(MeterNo)
  12. );
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement