SQL question

Permabanned
Joined
22 Mar 2020
Posts
2,337
what the best way via the myphpadmin to do this.

cant sell something before you buy, using dates.
So you buy it 1 nov but you cant sell it before that given date.
 
Code:
select product_id from products where release_date > "2022-11-01 00:00:00"

What I mean is, in the gui tables you lock them so you cant enter a date before you purchase the item.

you buy car on the 10 nov, but the sell column must start from the date given in the buy column.
 
I wouldn't do this at database level, unless the people using it are going to be directly modifying the database tables (which would be a bad idea).

This sort of data dependent validation belongs in the application layer, not the database itself.

If you really want to do it, you would be looking to add a check constraint.
 
Last edited:
Back
Top Bottom