update…set…語句用于修改表中字段內(nèi)容。
正確答案是 D: update t1 set name=’lixiaoming’ where id=100;。
專業(yè)分析如下:
1. **A: create table t1(id int,name char(30),salary int);**
- 這個語句的作用是創(chuàng)建一個名為 t1 的表,其中包含 id、name 和 salary 三個字段。這并不是更新表中字段內(nèi)容的語句,而是一個創(chuàng)建表的語句。
2. **B: drop table t1;**
- 這個語句的作用是刪除名為 t1 的表。刪除表會導(dǎo)致表中的所有數(shù)據(jù)被移除,這也不是更新表中字段內(nèi)容的語句,而是一個刪除表的語句。
3. **C: create view v_t1 as select id,name from t1;**
- 這個語句的作用是創(chuàng)建一個名為 v_t1 的視圖,視圖中包含從 t1 表中選擇的 id 和 name 字段。這是一個創(chuàng)建視圖的語句,并不涉及更新表中字段內(nèi)容。
4. **D: update t1 set name=’lixiaoming’ where id=100;**
- 這個語句的作用是更新 t1 表中 id 為 100 的記錄,將其 name 字段的值設(shè)置為 'lixiaoming'。這正是更新表中字段內(nèi)容的操作。
綜上所述,只有選項 D 是用于更新表 t1 中字段內(nèi)容的語句,因此正確答案是 D。