日韩天天综合网_野战两个奶头被亲到高潮_亚洲日韩欧美精品综合_av女人天堂污污污_视频一区**字幕无弹窗_国产亚洲欧美小视频_国内性爱精品在线免费视频_国产一级电影在线播放_日韩欧美内地福利_亚洲一二三不卡片区

解析最基本的sql語句操作_Mssql數(shù)據(jù)庫教程

編輯Tag賺U幣
教程Tag:暫無Tag,歡迎添加,賺取U幣!

推薦:SQL語句查詢是否為空 =null及null
abcd 980515精頂企業(yè)有限公司簡家豪NULL 980514全欣木業(yè)有限公司NULL123 980514迅億科技股份有限公司簡逢浚NULL 980515聖越國際企業(yè)有限公司NULL111 表結(jié)構(gòu)如上所示,要查詢C列為空的記錄的SQL語句不是select*fromtablewherec=null;或者select*fromtablewh

   首先,簡要介紹基礎(chǔ)語句:
  1、說明:創(chuàng)建數(shù)據(jù)庫
CREATE DATABASE database-name
  2、說明:刪除數(shù)據(jù)庫
drop database dbname
  3、說明:備份sql server
  --- 創(chuàng)建 備份數(shù)據(jù)的 device
USE master
EXEC sp_addumpdevice ’disk’, ’testBack’, ’c:\mssql7backup\MyNwind_1.dat’
  --- 開始 備份
BACKUP DATABASE pubs TO testBack
  4、說明:創(chuàng)建新表
create table tabname(col1 type1 [not null] [primary key],col2 type2 [not null],..)
  根據(jù)已有的表創(chuàng)建新表:
A:create table tab_new like tab_old (使用舊表創(chuàng)建新表)
B:create table tab_new as select col1,col2… from tab_old definition only
  5、說明:
  刪除新表:drop table tabname
  6、說明:
  增加一個列:Alter table tabname add column col type
  注:列增加后將不能刪除。DB2中列加上后數(shù)據(jù)類型也不能改變,唯一能改變的是增加varchar類型的長度。
  7、說明:
  添加主鍵:Alter table tabname add primary key(col)
  說明:
  刪除主鍵:Alter table tabname drop primary key(col)
  8、說明:
  創(chuàng)建索引:create [unique] index idxname on tabname(col….)
  刪除索引:drop index idxname
  注:索引是不可更改的,想更改必須刪除重新建。
  9、說明:
  創(chuàng)建視圖:create view viewname as select statement
  刪除視圖:drop view viewname

      10、幾個簡單的基本的sql語句:
  選擇:select * from table1 where 范圍
  插入:insert into table1(field1,field2) values(value1,value2)
  刪除:delete from table1 where 范圍
  更新:update table1 set field1=value1 where 范圍
  查找:select * from table1 where field1 like ’%value1%’ ---like的語法很精妙,查資料!
  排序:select * from table1 order by field1,field2 [desc]
  總數(shù):select count * as totalcount from table1
  求和:select sum(field1) as sumvalue from table1
  平均:select avg(field1) as avgvalue from table1
  最大:select max(field1) as maxvalue from table1
  最小:select min(field1) as minvalue from table1

分享:如何掌握SQL Server的鎖機(jī)制和鎖模式
各種大型數(shù)據(jù)庫所采用的鎖的基本理論是一致的,但在具體實現(xiàn)上各有差別。SQLServer更強(qiáng)調(diào)由系統(tǒng)來管理鎖。在用戶有SQL請求時,系統(tǒng)分析請求,自動在滿足鎖定條件和系統(tǒng)性能之間為數(shù)據(jù)庫加上適當(dāng)?shù)逆i,同時系統(tǒng)在運行期間常常自動進(jìn)行優(yōu)化處理,實行動態(tài)加鎖

來源:模板無憂//所屬分類:Mssql數(shù)據(jù)庫教程/更新時間:2010-01-31
相關(guān)Mssql數(shù)據(jù)庫教程