Witaj Gościu! ( Zaloguj | Rejestruj )

Forum PHP.pl

 
Reply to this topicStart new topic
> [MySQL]Wartosc default w tabeli
kusiu
post
Post #1





Grupa: Zarejestrowani
Postów: 163
Pomógł: 10
Dołączył: 24.01.2006

Ostrzeżenie: (30%)
XX---


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
Go to the top of the page
+Quote Post
Cezar708
post
Post #2





Grupa: Zarejestrowani
Postów: 1 116
Pomógł: 119
Dołączył: 10.05.2005
Skąd: Poznań

Ostrzeżenie: (0%)
-----


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
Go to the top of the page
+Quote Post

Reply to this topicStart new topic
2 Użytkowników czyta ten temat (2 Gości i 0 Anonimowych użytkowników)
0 Zarejestrowanych:

 



RSS Aktualny czas: 22.08.2025 - 22:23