成人免费xxxxx在线视频软件_久久精品久久久_亚洲国产精品久久久_天天色天天色_亚洲人成一区_欧美一级欧美三级在线观看

SQL Server學(xué)習(xí)筆記之一對多的刪除問題

數(shù)據(jù)庫 SQL Server
我們今天主要向大家講述的是SQL Server學(xué)習(xí)筆記之一對多的刪除問題,以下就是文章對其具體內(nèi)容的詳細(xì)解析,望大家瀏覽之后會有所收獲。

以下的文章主要描述的是SQL Server學(xué)習(xí)筆記之一對多的刪除問題,假如你對其實(shí)際相關(guān)操作有興趣了解的話,下面的文章你一定不要錯過,望你在瀏覽完此篇文章之后會對你在今后的學(xué)習(xí)中有更好的了解。

Hibernate能支持MS SQL7.0嗎?

 

Hibernate深度探險!!----原創(chuàng)!

 

推薦圈子: Database圈子

更多相關(guān)推薦

1、create database school 創(chuàng)建數(shù)據(jù)庫school

 

2、drop database school 刪除數(shù)據(jù)庫school

3、use school 連接到school數(shù)據(jù)庫,使其成為當(dāng)前數(shù)據(jù)庫

4、create table class(classID int primary key identity not null)

創(chuàng)建一個名為class的表,其有一個int型數(shù)據(jù)classID字段,該字段設(shè)置了主鍵約束

 

SQL Server學(xué)習(xí)筆記之并自動編號列且不能為空

 

5、select * from class 查詢class表中的所有字段

6、drop table class 刪除class表

7、select * into class2 from class

將class表中的所有數(shù)據(jù)復(fù)制到class2表中

 

8、select * into class2 from class where 1=0 只復(fù)制表結(jié)構(gòu)

9、insert into class2(className) values('Juhn')或

insert into class2(className,tel) values('Bile','0731-2255664')

 

在class2表中插入一條記錄

 

10、delete from class2 where classID=2

刪除class2表中classID為2的行,如果指定where條件將刪除所有的行

 

 

delete from Student where StudentID between 13 and 15

 

刪除Student表中StudentID在13至15之間的數(shù)據(jù)(包括13和15)

 

11、alter table class2 add tel varchar(15) default('沒有電話')

修改表class2,為它添加一個tel列并將其默認(rèn)值設(shè)為'沒有電話'

 

12、alter table class2 drop column tel 刪除列

13、alter table student add constraint telDefault default('沒有電話') for tel

SQL Server學(xué)習(xí)筆記之修改tel列的默認(rèn)值

 

14、create table class3(classID int ,constraint id_key primary key(classID))

創(chuàng)建一個名為class3的表并為它設(shè)置了名為id_key的主鍵約束

 

15、unique 唯一約束

16、alter table class2 add age int check (age between 0 and 120)

為class2添一個age列,并為其設(shè)置檢查約束,使其的取值在0到120之間

 

17、alter table class2 add age int ,constraint ageCheck check

(age between 0 and 120)

 

其設(shè)置檢查約束方法二,為約束取名為ageCheck

 

18、alter table class2 add tel varchar(15) ,check

(tel like '[0-9][0-9][0-9]-[0-9][0-9][0-9][0-9][0-9][0-9][0-9]')

 

其設(shè)置檢查約束方法三,此為模糊約束

 

19、create table class3(ID int primary key identity,classID int ,

name varchar(15) ,constraint classID foreign key(classID) references

 

class2(classID)) #p#

 

SQL Server學(xué)習(xí)筆記之設(shè)置外鍵約束

 

20、alter table class3 drop classID

刪除class3的classID外鍵約束

 

21、create index class2Name on class2(className)

在class2表的calssName字段上創(chuàng)建一個class2Name的索引

 

22、create unique index class2Name on class2(className)

SQL Server學(xué)習(xí)筆記之創(chuàng)建唯一索引

 

23、select classID,className from class2 where className='body'

select classID,className from class2 where className like '%s'

 

創(chuàng)建索引后查詢的的速度將更快,但會降低insert、update、delete的執(zhí)行速度

 

24、drop index class2.class2Name 刪除表class2上的class2Name索引

25、update class2 set className='Lida',tel='13787277732' where classID=3

將class2表中className和tel列、classID=3

 

行的單元格的值改為'Lida'和'13787277732',注意忽略where語句將改變表中所有的行

 

26、create default sexDefault as '男'; 創(chuàng)建一個名為sexDefault的默認(rèn)值

sp_bindefault sexDefault,'student.sex';

 

將創(chuàng)建的sexDefault默認(rèn)值綁定到student表的sex字段上

 

27、insert into class2(name,names) select name,names from class1

將class1中的數(shù)據(jù)全部復(fù)制到class2中

 

28、truncate table class 刪除class表中所有的行

29、select Name 國家,Population 人口 from BBC where Name

in('France','Cermany','Italy United')

 

查詢BBC表中'France','Cermany','Italy United'三個地區(qū)的所在的國家和人口數(shù)

 

30、select Name 國家 from BBC where Name like '%United%'

查詢BBC表中的Name字段中包含United字符的國家,通配符"_"表示匹配任意單個字符

 

30、select Name 國家, Population 人口 from BBC where Population>100000000 order by Population desc

查詢BBC表中的Population字段大于100000000的國家和人口,并按降序排序,默認(rèn)為升序asc

 

31、select Name,round(Population/1000000,0) as '人口(百萬)' from BBC where Region='South Asia'

查詢BBC表中的Region='South Asia'國家和百萬人口數(shù)(round是四舍五入)

 

32、select distinct Region from BBC

查詢BBC表中的Region字段中的非重復(fù)數(shù)據(jù),distinct排除重復(fù)數(shù)據(jù)

 

如有多列則作用在列的組合上,而不再作用在單列上

 

33、select top 50 percent * from BBC

查詢BBC表中的所有字段,但只返回總行數(shù)的50%,percent表百分?jǐn)?shù)、可選

 

34、select * from BBC where Area>100 and not GDP<10000000

查詢BBC表中的所有Area小于100并且GDP不小于10000000的數(shù)據(jù),會返回所有的列,不只是Area列

 

33、select * from BBC where Area not between 20000 and 30000

查詢BBC表中的所有Area不在20000和30000之間的數(shù)據(jù),會返回所有的列,不只是Area列

 

34、select distinct Name+str(Age) 學(xué)生 from Student

查詢Student表中Name和Age字段都不重復(fù)的數(shù)據(jù)

 

str(Age)返回Age的字符串表達(dá)形式,"學(xué)生"是別名

 

 

35、select * from Student where Nealth is null

 

查詢Student表中Nealth字段為null的數(shù)據(jù)

 

 

36、exec sp_helpconstraint 'Teacher'

 

SQL Server學(xué)習(xí)筆記之查看'Teacher'表中的所有約束

 

 

37、select * from Student where StudentID=1

 

for xml raw

 

返回XML語句

 

38、drop procedure MyProcedure

 

刪除一個存在的存儲過程

 

39、create procedure insert_Procedure

 

@Name varchar(10),

 

@Sex varchar(2),

 

@Age int,

 

@Tel varchar(20),

 

@Address varchar(50)

 

as

 

insert into student(Name,Sex,Age,Tel,Address) values(@Name,@Sex,@Age,@Tel,@Address)

 

創(chuàng)建一個插入數(shù)據(jù)的存儲過程

 

40、select datediff(day,'20090403',getdate())

 

用指定時間減去當(dāng)前時間,返回的是天數(shù),還可以用month返回月數(shù)

 

 

以上的相關(guān)內(nèi)容就是對SQL Server學(xué)習(xí)筆記之一對多的刪除問題的介紹,望你能有所收獲。 

【編輯推薦】

  1. 實(shí)現(xiàn)SQL Server視圖的代碼有哪些?
  2. 實(shí)現(xiàn)SQL Server索引的代碼示例
  3. SQL Server創(chuàng)建約束的代碼運(yùn)用
  4. SQL Server創(chuàng)建表所要用到的代碼
  5. SQL Server 2005商業(yè)智能功能淺析

 

責(zé)任編輯:佚名 來源: 清華大學(xué)出版社
相關(guān)推薦

2009-06-04 16:14:22

Hibernate一對Hibernate一對Hibernate多對

2009-09-22 09:55:58

Hibernate實(shí)例

2010-04-15 09:09:02

Hibernate

2009-07-21 17:31:39

iBATIS一對多映射

2022-02-18 11:05:25

Jpa配置Address

2011-08-17 10:28:53

多對多查詢SQL Server

2009-09-23 10:37:50

Hibernate一對

2010-07-08 12:52:58

SQL Server

2023-06-12 08:09:01

FlaskSQLAlchemy

2020-06-23 14:28:24

MySQL商品數(shù)據(jù)

2009-09-23 10:57:02

Hibernate一對

2011-07-04 14:28:18

SQL Server分區(qū)

2022-02-16 15:32:58

FlexUI框架容器組件

2010-06-28 12:46:09

SQL Server

2011-08-01 16:10:00

SQL Server

2012-06-27 10:28:12

編程語言語言學(xué)習(xí)多門語言

2011-02-28 13:19:50

SQL Server SQL死鎖

2010-10-21 11:10:57

SQL Server查

2009-12-23 09:31:11

寬帶路由上網(wǎng)故障

2010-07-15 14:55:05

SQL Server數(shù)
點(diǎn)贊
收藏

51CTO技術(shù)棧公眾號

主站蜘蛛池模板: 五月网婷婷 | 成人黄在线观看 | 久久一二区 | 国产精品91网站 | 成人在线免费观看视频 | 日韩成人性视频 | av在线免费网 | 久久久久久中文字幕 | 91精品国产91久久久久久吃药 | 成人精品免费 | 日本精品免费在线观看 | 国产精品99 | 欧美aaa| 日韩在线欧美 | 亚洲一区日韩 | 91精品国产一区 | 成人久久久| 成人免费在线视频 | 国产女人与拘做受免费视频 | 国内久久 | 久久久性| 国产成人免费视频网站高清观看视频 | 国产在线视频一区 | 亚欧洲精品在线视频免费观看 | 亚洲欧美精品在线观看 | 日本又色又爽又黄又高潮 | 国产精品区二区三区日本 | 亚洲区中文字幕 | 亚洲人人舔人人 | 国产视频久久 | 欧美一区二区三区在线观看 | 国产一区2区 | 亚洲精品一区二区三区蜜桃久 | 国产在线第一页 | 国产日韩欧美一区二区 | 久久久久久久综合 | 国产免费又黄又爽又刺激蜜月al | 欧美精品久久久久 | 电影91久久久 | 久草视| 亚洲人人|