Database article

*countAnd count column names **

Count (*) includes all columns, which is equivalent to the number of rows. If the value of a column is NULL count(1), the value of a column is ignored. If the value of a column is NULL count(1), the value of a column is ignored. Counting columns that are null (null is not just an empty string or 0, but represents NULL) is ignored, that is, when a field value is null, it is not counted.

Database optimization

From SQL statement optimization, database structure optimization, server hardware optimization three aspects of statement optimization: a variety of situations, as far as possible to choose the most efficient statement database structure optimization: 1) paradigm optimization: such as eliminating redundancy (save space..) 3) Split table: vertical split and horizontal split server hardware optimization: more money \

Four features of database transactions

Atomicity: a series of relevant logic operation, either to do, or don’t do consistency: all transaction execution results must be from one to another consistent state consistency isolation: the operation of a transaction cannot be affected by the operation of other transactions, concurrent execution can’t interfere with each other Persistence: transaction once submitted, the data change is permanent and cannot be rolled back.

Three paradigm

The first normal form: the field is the smallest unit and cannot be divided again. The second normal form: the fields in the table must depend on all the primary keys, not some of them. The third normal form: the fields other than the primary keys must be independent