Pomoc - Szukaj - Użytkownicy - Kalendarz
Pełna wersja: [MySQL]Wartosc default w tabeli
Forum PHP.pl > Forum > Przedszkole
kusiu
Witam!
Czy mozna w tabeli w polu np. `cena_brutton` jako wartosc domyslna wstawic wartosc z inengo pola np. z pola `cena`?
Czyli w `cela_brutto` bedzie wartosc pola `cena`+22%

Da sie cos takiego??
Z gory dzieki
Cezar708
Cytat
DEFAULT default_expr

The DEFAULT clause assigns a default data value for the column whose column definition it appears within. The value is any variable-free expression (subqueries and cross-references to other columns in the current table are not allowed). The data type of the default expression must match the data type of the column.

The default expression will be used in any insert operation that does not specify a value for the column. If there is no default for a column, then the default is null.



to jest cytat z dokumentacji PostgreSQL, a skoro jest to niemożliwe w PostgreSQL na 99% jestem przekonany, że i w MySQL również nie jest to dozwolone... lecz niestety nie znalazłem zmianki na ten temat w dokumentacji MySQL.

Pozdrawiam
To jest wersja lo-fi głównej zawartości. Aby zobaczyć pełną wersję z większą zawartością, obrazkami i formatowaniem proszę kliknij tutaj.
Invision Power Board © 2001-2025 Invision Power Services, Inc.