精品丰满熟女一区二区三区_五月天亚洲欧美综合网_亚洲青青青在线观看_国产一区二区精选

  • <menu id="29e66"></menu>

    <bdo id="29e66"><mark id="29e66"><legend id="29e66"></legend></mark></bdo>

  • <pre id="29e66"><tt id="29e66"><rt id="29e66"></rt></tt></pre>

      <label id="29e66"></label><address id="29e66"><mark id="29e66"><strike id="29e66"></strike></mark></address>
      學(xué)習(xí)啦 > 學(xué)習(xí)英語(yǔ) > 專業(yè)英語(yǔ) > 計(jì)算機(jī)英語(yǔ) > 數(shù)據(jù)庫(kù)update的用法

      數(shù)據(jù)庫(kù)update的用法

      時(shí)間: 長(zhǎng)思709 分享

      數(shù)據(jù)庫(kù)update的用法

        數(shù)據(jù)庫(kù)update的用法的用法你知道嗎?下面小編就跟你們?cè)敿?xì)介紹下數(shù)據(jù)庫(kù)update的用法的用法,希望對(duì)你們有用。

        數(shù)據(jù)庫(kù)update的用法的用法如下:

        SQL語(yǔ)句中的更新語(yǔ)句update是最常用的語(yǔ)句之一,下面將為您介紹update語(yǔ)句的三種使用方法,供您參考,希望對(duì)您有所幫助。

        一、環(huán)境:

        MySQL-5.0.41-win32

        Windows XP professional

        二、建立測(cè)試環(huán)境:

        DROP TABLE IF EXISTS t_test;

        CREATE TABLE t_test (

        bs bigint(20) NOT NULL auto_increment,

        username varchar(20) NOT NULL,

        password varchar(20) default NULL,

        remark varchar(200) default NULL,

        PRIMARY KEY (bs)

        ) ENGINE=InnoDB AUTO_INCREMENT=4 DEFAULT CHARSET=gbk;

        INSERT INTO t_test VALUES (1,'lavasoft','123456',NULL);

        INSERT INTO t_test VALUES (2,'hello',NULL,NULL);

        INSERT INTO t_test VALUES (3,'haha',zz,tt);

        三、測(cè)試

        1、set一個(gè)字段

        在表t_test中設(shè)置第二條記錄(bs為2)的password為'***'。

        update t_test t

        set t.password = '***'

        where t.bs = 2;

        2、set多個(gè)字段

        在表t_test中設(shè)置第一條記錄(bs為1)的password為'*'、remark為'*'。

        update t_test t

        set t.password = '*', t.remark = '*'

        where t.bs = 1;

        3、set null值

        在表t_test中設(shè)置第三條記錄(bs為3)的password為null、remark為null。

        update t_test t

        set t.password = null, t.remark = null

        where t.bs = 3;

        這個(gè)是按照標(biāo)準(zhǔn)語(yǔ)法寫的,在不同的數(shù)據(jù)庫(kù)系統(tǒng)中,update還有更多的寫法,但是標(biāo)準(zhǔn)寫法都是支持的。以上三個(gè)例子為了說(shuō)明情況,每次都更新一行。在實(shí)際中,可以通過(guò)where語(yǔ)句約束來(lái)控制更新行數(shù)。

      543109