B
B
BonBon Slick2016-11-02 22:40:07
PHP
BonBon Slick, 2016-11-02 22:40:07

Auto-delete, cleaning records in the Database?

In the store, there are registered users, they can register addresses, everything is clear as day. And yet, there are unregistered users who can also place an order at the address, the question is, if this address is stored in the database, how can I delete it later, or how is it better to arrange all this in tables?

Answer the question

In order to leave comments, you need to log in

3 answer(s)
A
Alexander, 2016-11-03
@BonBonSlick

I have 2 tables, in rdna I shove the addresses of registered users, in another, the addresses of those who buy without registration. Thus, the address is tied only to this order, how can I automatically delete it from the database later? And is it right to do so?

Look at the store. If it is real and alive with a claim to growth, then nothing can be deleted. It will be necessary for marketers to collect statistics. Draw charts for salespeople.
You can store the delivery address in the order, or you can store it in the user. You can auto-register a user according to the data from the order. Maybe you want to greet an old user, earn bonuses, keep history or start predicting the basket. There are many things where data is needed if the store grows and it is real.
If this is just a developer's test environment or a store is raised on some kind of Joomla, then it doesn't matter, anyway, you will delete it in half a year.
You can establish connections cascading on tables (when deleting one record, all related ones are deleted).
You can write triggers on events.
You can write events.
You can hang a separate command on kroner with a timer launch once a day, week, month, year to remove the "old" one.
In general, deleting the "old" and "unnecessary", as I noticed, is a maniacal idea for all beginners. For a large database, it’s better if you don’t touch the records and leave them in place than delete them all the time. Larger resources usually simulate deletion by simply putting a delete or similar field into each table and whether or not it is displayed.

A
Alexander Chernykh, 2016-11-02
@sashkets

create event in mysql

D
dom1n1k, 2017-01-14
@dom1n1k

Bulgarian is difficult to recognize for an unaccustomed person, because the Bulgarian Cyrillic alphabet is very different from the Russian one both in drawing and in general impression.
In general, individual letters are tritely similar to Helvetica.
Are there any other texts in the same font in more mainstream languages ​​- Russian, English, etc?

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question