🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: pl.comp.bazy-danych
Article #194948

Re: [SQL]Jak zastąpić wiersz tabeli?

#194948
From: Wojtek Gapiński
Date: Wed, 11 May 2016 08:24
17 lines
1666 bytes
W dniu 11-05-2016 o 09:14, Adam Klobukowski pisze:
> W dniu środa, 11 maja 2016 09:06:24 UTC+2 użytkownik Borneq napisał:
>> Insert nie działa gdy mamy w bazie już wiersz o tym samym kluczu
>> głównym. Jeden sposób to delete i to z selectem istniejącego wiersza, a
>> czy istnieje szybszy sposób zastąpienia?
>
> Zależy od engine SQLowego. Przykładowo, MySQL posiada operację INSERT ...  ON DUPLICATE KEY UPDATE. W tych które takiej operacji nie mają, pozostaje (w transakcji) select a nastepnie insert lub update.
>
> AdamK
>


W MySQL jest jeszcze coś takiego jak REPLACE.

-- 
Wojtek Gapiński
http://www.jwmprojekt.pl
Technical Details
Message-ID: <nguq80$iju$1@node1.news.atman.pl>
Path: mbox-mo1.pugleaf.net!news-archive.icm.edu.pl!agh.edu.pl!news.agh.edu.pl!newsfeed2.atman.pl!newsfeed.atman.pl!.POSTED!not-for-mail
References: <ngullf$fc2$1@node2.news.atman.pl> <5013664c-63f8-41b1-a462-d143ca0d47ab@googlegroups.com>

Show Full Headers
Complete Article Headers
Path: mbox-mo1.pugleaf.net!news-archive.icm.edu.pl!agh.edu.pl!news.agh.edu.pl!newsfeed2.atman.pl!newsfeed.atman.pl!.POSTED!not-for-mail
From: Wojtek Gapiński <wojtas_g.WYTNIJ.TO@wp.I.TO.TEZ.pl>
Newsgroups: pl.comp.bazy-danych
Subject: Re: [SQL]Jak zastąpić wiersz tabeli?
Date: Wed, 11 May 2016 10:24:33 +0200
Organization: ATMAN - ATM S.A.
Lines: 17
Message-ID: <nguq80$iju$1@node1.news.atman.pl>
References: <ngullf$fc2$1@node2.news.atman.pl> <5013664c-63f8-41b1-a462-d143ca0d47ab@googlegroups.com>
NNTP-Posting-Host: 88-199-166-58.tktelekom.pl
Mime-Version: 1.0
X-Trace: node1.news.atman.pl 1462955072 19070 88.199.166.58 (11 May 2016 08:24:32 GMT)
X-Complaints-To: usenet@atman.pl
NNTP-Posting-Date: Wed, 11 May 2016 08:24:32 +0000 (UTC)
User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:45.0) Gecko/20100101 Thunderbird/45.0
In-Reply-To: <5013664c-63f8-41b1-a462-d143ca0d47ab@googlegroups.com>
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit