显示标签为“customers”的博文。显示所有博文
显示标签为“customers”的博文。显示所有博文

2012年3月27日星期二

DIsk quotas

Hello,

I am investigating setting up a shared sql server. I wish to enforce
database size quotas, and hopefully still allow customers to manage
the creation of their own databases.

Any thoughts or suggestions would be appreciated.

Kind Regards
Simon Hall"Simon Hall" <itguy@.xtrahost.co.uk> wrote in message
news:84f037fd.0404290756.77945c9@.posting.google.co m...
> Hello,
> I am investigating setting up a shared sql server. I wish to enforce
> database size quotas, and hopefully still allow customers to manage
> the creation of their own databases.
> Any thoughts or suggestions would be appreciated.
> Kind Regards
> Simon Hall

CREATE DATABASE is usually restricted only to administrators, to prevent
someone grabbing all the disk space. One solution might be a custom database
creation/resizing request tool, which could be a web form or whatever. That
would allow you to check a request against other information (eg. billing
status) before processing it, either manually via a DBA or in some automated
way (perhaps using SQLDMO).

Alternatively, when you set up a new client, just create a database with the
largest size you want to allow them, although since different clients may
have different requirements in terms of transaction log use and recovery
models, it may not be that simple.

There may well be other solutions using genuine disk quotas (ie. in the OS,
in SAN software, a commercial app etc.), but since the MSSQL service runs as
one user account, I'm not sure how a quota could be linked to a specific
login/client. Unless you could do something where a single client's files
are all in one folder, then manage that folder. But you'd still probably
need some sort of custom tool in that case to handle new requests and assign
more space if needed.

Simon

2012年3月20日星期二

Discount-calculation

Hello everybody,

I'm busy with a website with a MySQL-database, and I want to build in a discount-calculation. Customers who log in at the have their own general discount, but there can be an exception for a few products.
I have the following tables and fields (only the ones I use in the script):

- discount
- discount_id
- product_id
- company_id
- productdiscount

- companies
- company_id
- companydiscount

- users
- user_id
- company_id

- products
- product_id
- name
- price

The first thing that has to be calculated is the companydiscount.
And for the products that have a alternative discount, I of course want to show that alternatvie discount.

I wrote the following SQL-script:

select products.product_id, products.name, products.price, discount.discount_id, discount.product_id, discount.company_id, discount.productdiscount, companies.company_id, companies.companiediscount, users.user_id, users.company_id,

(price)-(price/100*productdiscount) as alternative_discount,
(price)-(price/100*companydiscount) as general_discount

from products, companies, users, discount

where companies.company_id = users.company_id and
products.product_id = discount.producte_id

The only thing that happens now is that only the product that have an anlternative discount are showed. How can I make a script that show all the products with the general discount, but the products with the alternative discount with the right calculated discount?

I hope anyone can help me!

Many thanks,

Michael RoosWell, you should be posting this in the MySQL forum, but I can see right off that you haven't linked your Companies and Discounts tables. You are essentially running a crossjoin query, and I don't think that is your intention.

blindman