Skip to main content

All Questions

Tagged with
2 votes
2 answers
91 views

Storing transactions with amounts and payment types

I have a table where I'm storing a row for each transaction that records the type of transaction along with the amount of money being recorded for the transaction type. I then need to write a report ...
Michael A's user avatar
  • 1,651
13 votes
2 answers
6k views

Sales, Taxes and Totals

I'm working to get some practice with SQL functions which are often used in a financial setting, and I created this simple table with products, prices and tax rates basically. I then wrote a query to ...
Phrancis's user avatar
  • 20.4k
4 votes
1 answer
291 views

Hotel reservation system with discounts and deposits

I'm making a hotel reservation app that has the following features: Promo Codes: The guest can choose to pay half a certain percent of the total_amount or the ...
Dev14's user avatar
  • 41
4 votes
1 answer
2k views

Luhn algorithm MS-SQL

This a solution Luhn algorithm for credit validation. This algorithm is a basic one inspired by wikipedia. I mean no check for length, type, and so on. You can enhance the base code as you want it to ...
Modhaffer's user avatar
12 votes
4 answers
15k views

LW, MTD, STD, YTD Sales... all in line and looking pretty

That's Last Week, Month-to-Date, Season-to-Date, and Year-to-Date sales. I have a table-valued function for each one, that takes a date and returns all CalendarDate...
Mathieu Guindon's user avatar
3 votes
2 answers
351 views

Asking a user to take money from a checking account and move it to a savings account - follow-up

I made a few changes to this: Asking a user to take money from a checking account and move it to a savings account The changes I made were: improved the names of methods and variables to better ...
user1764094's user avatar
15 votes
8 answers
5k views

Asking a user to take money from a checking account and move it to a savings account

I'm aiming to get this program right as I might show it at a job interview. The code below runs fine but I would like to know if there's anything that can be improved in terms of readability, good ...
user1764094's user avatar
1 vote
2 answers
2k views

Maintaining a total balance of debit/credit sales transactions

The overall intent is to consolidate individual sales transactions to total debits/credits summing up the totals by year and month--retaining a running balance from start to end. This code uses ...
plditallo's user avatar
  • 251
4 votes
1 answer
9k views

SQL query for monthly bills with amounts paid

The idea is to get a listing of monthly bills with amounts paid. The subquery does a total through a group by using bill_id and ...
James P.'s user avatar
  • 413
2 votes
2 answers
6k views

Payment application database

I would really like some advice from any DB gurus who have a few minutes free. After doing some reading and playing with sqlfiddle over the weekend I have constructed this PostgreSQL schema and it is ...
John Handcock's user avatar
3 votes
1 answer
99 views

Financial report query

I have been tasked with creating financial reports. I am looking for any suggestions on improving performance, readability/formatting or best practices. ...
TheRealTy's user avatar
  • 183