sql 常用操作脚本代码

1,--运行fy_mh库[use]

use fy_mh



2,--查询 mh_dblj表

select * 

from mh_dblj



3,--更新 某个字段(把表的某个字段下的所有的数据清空)[update ; set]

update mh_dblj 

set LJZC=''



4,--查询YK_TYPK 表中 JLDW 字段 是空(NULL)的所有数据[is null]

select * 

from YK_TYPK 

where JLDW is null



4.1,-- 查询YK_TYPK 表中 JLDW 字段 不是空(NULL)的所有数据[is not null]

select * 

from YK_TYPK 

where JLDW  is not null



5,--删除GY_SFXM表中某一SFXM='65'(SFXM字段下是65的一列)列

delete

from GY_SFXM

where SFXM='65';



6,--更新表 某些字段的值

更新YK_TYPK 表YPMC,PYDM两个字段的值,在ypxh字段下为100501列的

update YK_TYPK set YPMC='无名' ,PYDM='WM1' where ypxh='100501';

6.1----更新表某个字段的值

update YK_TYPK set ybdzbm='10100858' where YPXH='100000'



7,--查询某张表中 某个字段带有%尿液分析%的所有数据

select * from dbo.mgxiao where mc like '%尿液分析%'



8,--向某张表添加一个字段

alter table sysrpt add FPrintori char(1)NULL

 

你可能感兴趣的:(sql)