欧美色欧美亚洲高清在线观看,国产特黄特色a级在线视频,国产一区视频一区欧美,亚洲成a 人在线观看中文

  1. <ul id="fwlom"></ul>

    <object id="fwlom"></object>

    <span id="fwlom"></span><dfn id="fwlom"></dfn>

      <object id="fwlom"></object>

      數(shù)據(jù)庫(kù)及表的創(chuàng)建與修改[本站推薦]

      時(shí)間:2019-05-13 17:59:44下載本文作者:會(huì)員上傳
      簡(jiǎn)介:寫寫幫文庫(kù)小編為你整理了多篇相關(guān)的《數(shù)據(jù)庫(kù)及表的創(chuàng)建與修改[本站推薦]》,但愿對(duì)你工作學(xué)習(xí)有幫助,當(dāng)然你在寫寫幫文庫(kù)還可以找到更多《數(shù)據(jù)庫(kù)及表的創(chuàng)建與修改[本站推薦]》。

      第一篇:數(shù)據(jù)庫(kù)及表的創(chuàng)建與修改[本站推薦]

      實(shí)驗(yàn)一

      數(shù)據(jù)庫(kù)及表的創(chuàng)建與修改

      一、實(shí)驗(yàn)?zāi)康?/p>

      1.熟悉掌握利用SSMS中的設(shè)計(jì)工具來(lái)創(chuàng)建表。修改表結(jié)構(gòu)以及查看表屬性等操作。

      2.熟悉T-SQL的數(shù)據(jù)定義語(yǔ)言,能夠熟練地使用SQL語(yǔ)句創(chuàng)建和更改基本表。

      二、實(shí)驗(yàn)內(nèi)容

      1.完成實(shí)驗(yàn)教材中,實(shí)驗(yàn)1.1的全部?jī)?nèi)容。熟悉SQL SERVER的工作環(huán)境。

      2、依照實(shí)驗(yàn)1.2中的二維表,完成如下內(nèi)容。

      1.利用SSMS中的設(shè)計(jì)工具為數(shù)據(jù)庫(kù)LibraryLib創(chuàng)建表表1-5所示的BookClass(圖書類別表)、1-6所示的Publish(出版社信息表)、表1-7所示的Book(圖書信息表)。

      2.利用T-SQL創(chuàng)建新表1-

      8、1-9與1-10。

      3.修改表1-10 ExtraDateFee(超期罰款信息表):將FineMoney字段數(shù)據(jù)類型更改為:numeric(15,2);刪除Remarks字段;增加新字段Descript(varchar,70)。

      4.利用T-SQL語(yǔ)句:刪除BookClass(圖書類別表),并重新創(chuàng)建該表。5.在SSMS中查看Book(圖書信息表)的屬性。

      三、實(shí)驗(yàn)步驟

      1.利用SSMS中的設(shè)計(jì)工具為數(shù)據(jù)庫(kù)LibraryLib創(chuàng)建表。

      表創(chuàng)建后的截圖如下: 表1-5:

      表1-6:

      表1-7:

      2.T-SQL語(yǔ)句創(chuàng)建表:

      創(chuàng)建表1-8: CREATE TABLE [Borrow]([BorrowID] [int] NOT NULL , [UserID] [varchar](20)COLLATE Chinese_PRC_CI_AS NOT NULL , [BookID] [int] NOT NULL , [BorrowBeginDate] [datetime] NOT NULL , [BorrowEndDate] [datetime] NOT NULL , [ManagerID] [varchar](20)COLLATE Chinese_PRC_CI_AS NOT NULL , CONSTRAINT [PK_Borrow] PRIMARY KEY CLUSTERED([BorrowID])ON [PRIMARY])ON [PRIMARY]

      創(chuàng)建表1-9:

      CREATE TABLE [BorrowHistory]([BorrowID] [int] IDENTITY(1, 1)NOT NULL , [UserID] [varchar](20)COLLATE Chinese_PRC_CI_AS NOT NULL , [BookID] [int] NOT NULL , [BorrowBeginDate] [datetime] NOT NULL , [BorrowEndDate] [datetime] NOT NULL , [BorrowReturnDate] [datetime] NOT NULL , [ManagerID] [varchar](20)COLLATE Chinese_PRC_CI_AS NOT NULL , [ManagerReturnID] [varchar](20)COLLATE Chinese_PRC_CI_AS NOT NULL , CONSTRAINT [PK_BorrowHistory] PRIMARY KEY CLUSTERED([BorrowID])ON [PRIMARY])ON [PRIMARY] 創(chuàng)建表1-10: CREATE TABLE [ExtraDateFee]([BorrowID] [int] NOT NULL , [UserID] [varchar](20)COLLATE Chinese_PRC_CI_AS NOT NULL , [BookID] [int] NOT NULL , [BorrowBeginDate] [datetime] NOT NULL , [BorrowEndDate] [datetime] NULL , [BorrowReturnDate] [datetime] NOT NULL , [ManagerID] [varchar](20)COLLATE Chinese_PRC_CI_AS NOT NULL , [ManagerReturnID] [varchar](20)COLLATE Chinese_PRC_CI_AS NOT NULL , [FineMoney] [money] NOT NULL , [TurnIn] [bit] NOT NULL , [ManagerFineID] [varchar](20)COLLATE Chinese_PRC_CI_AS NOT NULL , [Remarks] [char](10)COLLATE Chinese_PRC_CI_AS NOT NULL , CONSTRAINT [PK_ExtraDateFee] PRIMARY KEY CLUSTERED([BorrowID])ON [PRIMARY])ON [PRIMARY]

      3.修改表1-10 ExtraDateFee(超期罰款信息表):將FineMoney字段數(shù)據(jù)類型更改為:numeric(15,2);刪除Remarks字段;增加新字段Descript(varchar,70)。

      修改前:

      修改后:

      4.利用T-SQL語(yǔ)句:刪除BookClass(圖書類別表),并重新創(chuàng)建該表。刪除BookClass: Delete book: DELETE FROM [LibraryLib1].[dbo].[BookClass]

      創(chuàng)建BookClass: Create book: CREATE TABLE [BookClass]([BookClassID] [int] IDENTITY(1, 1)NOT NULL , [BookClassName] [varchar](30)COLLATE Chinese_PRC_CI_AS NOT NULL , [BookBorrowDays]

      [int]

      NOT

      NULL

      CONSTRAINT [DF_BookClass_BookBorrowDays] DEFAULT(60), [BookFee] [money] NOT NULL , CONSTRAINT [PK_BookClass] PRIMARY KEY CLUSTERED

      ([BookClassID])ON [PRIMARY])ON [PRIMARY]

      5.在SSMS中查看Book(圖書信息表)的屬性。

      四、實(shí)驗(yàn)心得

      1.剛剛開(kāi)始使用SQL servers進(jìn)行數(shù)據(jù)庫(kù)的建立及其操作,對(duì)這個(gè)平臺(tái)的功能還不大熟悉。在尋找功能鍵這一步就話了很多的時(shí)間。

      2.實(shí)驗(yàn)室安裝的平臺(tái)是SQL SERVERS 2005,但是實(shí)驗(yàn)書上用的平臺(tái)是SQL SERVERS 2008,兩者使用的語(yǔ)句以及兩個(gè)平臺(tái)之間的功能都有一下差異,導(dǎo)致理解上有些困難。

      3.雖然理論課上已經(jīng)學(xué)了很多SQL的操作語(yǔ)句,像表的建立,表的修改插入刪除等,但是由于平時(shí)沒(méi)有及時(shí)進(jìn)行實(shí)際的上機(jī)操作,感覺(jué)對(duì)SQL的語(yǔ)句掌握得不太好,以后會(huì)多實(shí)踐改進(jìn)。

      第二篇:VFP講稿(創(chuàng)建數(shù)據(jù)庫(kù)和表)

      第二部分

      數(shù)據(jù)庫(kù)的創(chuàng)建與單命令

      創(chuàng)建數(shù)據(jù)庫(kù)和表

      一、Visual FoxPro 6.0的配置

      P28

      二、項(xiàng)目及其管理器

      P31

      1.項(xiàng)目的概念

      項(xiàng)目:是文件、數(shù)據(jù)、文檔和Visual FoxPro對(duì)象的集合,被保存為擴(kuò)展名為PJX的文件。

      建立項(xiàng)目可以對(duì)相關(guān)的內(nèi)容(項(xiàng)目的各組成部分)進(jìn)行統(tǒng)一組織、統(tǒng)一管理。

      項(xiàng)目管理器:是Visual FoxPro中處理數(shù)據(jù)和對(duì)象的主要組織工具,是Visual FoxPro的“控制中心”。

      項(xiàng)目管理器為其各個(gè)組成部分提供了一個(gè)組織良好的分層結(jié)構(gòu)視圖。利用項(xiàng)目管理器,用戶可以創(chuàng)建、修改、移出或刪除文件。只要簡(jiǎn)單地單擊鼠標(biāo),就可以跟蹤表和查詢,組織表單、報(bào)表、標(biāo)簽、代碼、位圖和其它文件。

      2.項(xiàng)目的創(chuàng)建

      3.一個(gè)項(xiàng)目產(chǎn)生兩個(gè)文件.PJX和.PJT。4.打開(kāi)/關(guān)閉項(xiàng)目 5.選項(xiàng)卡

      三、Visual FoxPro 數(shù)據(jù)庫(kù)的基本操作

      P93 1.建立數(shù)據(jù)庫(kù)

      (1)在項(xiàng)目管理器中建立 *(2)從“新建”對(duì)話框中建立 *(3)用命令建立

      P94(4)新建立的數(shù)據(jù)庫(kù)有三個(gè)文件

      三個(gè)文件的擴(kuò)展名分別是:dbc

      dct

      dcx ? dbc數(shù)據(jù)庫(kù)文件的擴(kuò)展名 ? dct數(shù)據(jù)庫(kù)備注文件的擴(kuò)展名 ? dcx數(shù)據(jù)庫(kù)索引文件的擴(kuò)展名 2.打開(kāi)和關(guān)閉數(shù)據(jù)庫(kù)(1)打開(kāi)數(shù)據(jù)庫(kù) 有三種打開(kāi)方法: ? 在項(xiàng)目管理器中打開(kāi) ? *從“打開(kāi)”對(duì)話框中打開(kāi) ? *用命令打開(kāi)

      OPEN DATABASE命令

      P95(2)關(guān)閉數(shù)據(jù)庫(kù) CLOSE DATABASE 3.數(shù)據(jù)庫(kù)設(shè)計(jì)器

      有三種打開(kāi)方法: ? 在項(xiàng)目管理器中打開(kāi) ? *從“打開(kāi)”對(duì)話框中打開(kāi) ? *用命令打開(kāi)

      MODIFY DATABASE命令

      P98 4刪除數(shù)據(jù)庫(kù)

      有兩種刪除方法: ? 在項(xiàng)目管理器中刪除 ? *用命令刪除

      DELETE DATABASE命令

      P99

      四、數(shù)據(jù)庫(kù)表

      1.建立數(shù)據(jù)庫(kù)表

      P99(1)表設(shè)計(jì)器

      (2)字段名:命名規(guī)則與內(nèi)存變量的命名規(guī)則相同。可與內(nèi)存變量同名。(3)字段類型和寬度(4)建立數(shù)據(jù)庫(kù)表產(chǎn)生的文件(5)字段有效性組框(6)用命令建立表

      使用命令CREATE <表名> 有打開(kāi)的數(shù)據(jù)庫(kù)時(shí),建立的是數(shù)據(jù)庫(kù)表,否則建立的是自由表。2.修改表結(jié)構(gòu)

      P102(1)插入字段(2)刪除字段(3)修改字段

      (4)用命令MODIFY STRUCTURE打開(kāi)表設(shè)計(jì)器進(jìn)行修改

      五、自由表

      如果當(dāng)前沒(méi)有打開(kāi)數(shù)據(jù)庫(kù),創(chuàng)建的表是自由表。1.創(chuàng)建自由表。

      2.自由表和數(shù)據(jù)庫(kù)表的異同。

      自由表和數(shù)據(jù)庫(kù)表的設(shè)計(jì)器不同。*數(shù)據(jù)庫(kù)表有很多附加信息。3.將自由表添加到數(shù)據(jù)庫(kù)。4.從數(shù)據(jù)庫(kù)中移出表。

      第三篇:實(shí)驗(yàn)2,數(shù)據(jù)庫(kù)表的創(chuàng)建與維護(hù)

      《數(shù)據(jù)庫(kù)原理》實(shí)驗(yàn)報(bào)告

      實(shí)驗(yàn)名稱 數(shù)據(jù)庫(kù)表/視圖的創(chuàng)建與維護(hù)實(shí)驗(yàn)

      班 級(jí)

      2011211309

      組 號(hào)

      組員姓名 浦倩 楊洋

      實(shí)驗(yàn)?zāi)康?/p>

      1. 掌握將E-R圖轉(zhuǎn)換為數(shù)據(jù)庫(kù)邏輯模式(關(guān)系表)的方法。

      2. 通過(guò)進(jìn)行數(shù)據(jù)庫(kù)表的建立操作,熟悉并掌握在Microsoft SQL Server數(shù)據(jù)庫(kù)中建立表的方法,理解關(guān)系數(shù)據(jù)庫(kù)表的結(jié)構(gòu),鞏固SQL標(biāo)準(zhǔn)中關(guān)于數(shù)據(jù)庫(kù)表的建立語(yǔ)句。

      3. 通過(guò)對(duì)Microsoft SQL Server數(shù)據(jù)庫(kù)中建立、維護(hù)視圖的實(shí)驗(yàn),熟悉Microsoft SQL Server數(shù)據(jù)庫(kù)中建立和維護(hù)視圖的方法,理解和掌握視圖的概念。

      4. 掌握從Excel表向Microsoft SQL Server關(guān)系數(shù)據(jù)庫(kù)導(dǎo)入數(shù)據(jù)的方法,利用實(shí)際數(shù)據(jù)建立GSM網(wǎng)絡(luò)配置數(shù)據(jù)庫(kù)。實(shí)驗(yàn)環(huán)境

      采用Microsoft SQL Server數(shù)據(jù)庫(kù)管理系統(tǒng)作為實(shí)驗(yàn)平臺(tái)。實(shí)驗(yàn)內(nèi)容與步驟

      1.閱讀《GSM移動(dòng)通信網(wǎng)絡(luò)配置數(shù)據(jù)庫(kù)》課程實(shí)驗(yàn)背景資料-11-v4.doc,將其中數(shù)據(jù)需求轉(zhuǎn)化為E-R圖。具體的E-R物理模型圖如下:(主鍵和外鍵關(guān)聯(lián)已在圖中顯示)

      2.寫好SQL腳本文件(包括多個(gè)create table、create view等命令),一次性生成表和視圖,在Microsoft SQL Server中打開(kāi)SQL腳本文件并執(zhí)行。寫好的SQL腳本見(jiàn)附錄。

      3.數(shù)據(jù)導(dǎo)入

      選擇要導(dǎo)入的數(shù)據(jù)源,原始數(shù)據(jù)要進(jìn)行去空行,刪除中文行等操作。

      選擇要導(dǎo)入的數(shù)據(jù)庫(kù)名。

      選擇復(fù)制整個(gè)表

      將數(shù)據(jù)源和數(shù)據(jù)庫(kù)中的表對(duì)應(yīng)起來(lái)。

      在映射數(shù)據(jù)屬性的時(shí)候,相同的名字系統(tǒng)會(huì)自動(dòng)對(duì)應(yīng)。如果要導(dǎo)入的數(shù)據(jù)源和關(guān)系中屬性名字不相同的情況下,可以編輯映射將他們聯(lián)系起來(lái)。

      成功導(dǎo)入數(shù)據(jù)。(因?yàn)閷?dǎo)入數(shù)據(jù)可能出現(xiàn)一些小問(wèn)題,所以本次實(shí)驗(yàn)的所有實(shí)體數(shù)據(jù)是分開(kāi)導(dǎo)入的。)

      4.創(chuàng)建視圖(腳本見(jiàn)附錄)

      A.在表“小區(qū)基本信息”上創(chuàng)建“LAC號(hào)為14121的小區(qū)基本位置信息”視圖CellInfo,屬性包括(CellID、所屬地區(qū)、LAC號(hào)、經(jīng)度、緯度)。

      B.在表“20個(gè)小區(qū)一周分鐘級(jí)話務(wù)數(shù)據(jù)”上創(chuàng)建“全速率話務(wù)量平均值大于23的小區(qū)話務(wù)量數(shù)據(jù)信息”視圖CellCallInfo,屬性包括(CellID、平均半速率話務(wù)量率、平均擁塞率)。

      C.創(chuàng)建“MscID = 5214的MSC管轄的BTS的基本信息,及其BTS對(duì)應(yīng)的天線基本信息。

      附錄:(SQL腳本)

      create view CellInfo as select CellID,AreaName,LAC,Longitude,Latitude from CELL where LAC=14121 go create view CellCallInfo as(select CELLID,avg(rate)as avg_r,avg(callcongs)as avg_c from HuaWu group by HuaWu.CELLID having avg(traff)>23)Go create view ParMscInfo as select BTS.*,Antenna.* from MSC,BSC,BTS,CELL,Antenna where MSC.MscId=5214 and MSC.MscId=BSC.MscId and BSC.BscId=BTS.BscId and BTS.BtsName=CELL.BtsName and CELL.CellId=Antenna.CellId go

      use [victory] Go create table MSC(MscID int not null, MscName char(256)null, MscCompany char(256)null, MscLongitude float null, MscLatitude float null, MscAltitude float null, primary key(MscID))go

      /*================*/ /* Table: BSC */ /*================*/ create table BSC(BscId int not null, BscName char(256)null, BscCompany char(256)null, Latitude float null, Longitude float null, MscID int null, primary key(BscId), foreign key(MscID)references MSC)go

      /*================*/ /* Table: BTS */ /*================*/ create table BTS(Btsname char(256)not null, BscId int null, Latitude float null, Longitude float null, Altitude float null, BtsCompany char(256)null, BtsPower int null, primary key(Btsname), foreign key(BscId)references BSC)go

      /*================*/ /* Table: MS */ /*================*/ create table MS(IMEI char(256)not null, MSISDN char(256)null, UserName char(256)null, MSCompany char(256)null, gsmMspSense float null, gsmMsHeight float null, gsmMspFout float null, MZONE char(256)null, primary key(IMEI))go

      /*================*/ /* Table: “CELL” */ /*================*/ create table “CELL”(CellID int not null, LAC int not null, BtsName char(256)null, AreaName char(256)null, Longitude float null, Latitude float null, Direction float null, Bcch int null, primary key(CellID), foreign key(BtsName)references BTS)go create table Antenna(CellID int not null, AntennaHeight float null, HalfPAngle float null, MaxAttenuation float null, Gain float null, AntTilt float null, Pt float null, MsPwt float null, primary key(CellID), foreign key(CellID)references CELL)go

      /*================*/ /* Table: PinDian */ /*================*/ create table PinDian(CellID int not null, Freq char(256)not null, primary key(CellID,Freq), foreign key(CellID)references CELL)go

      /*================*/ /* Table: LinQu */ /*================*/ create table LinQu(CellID int not null, AdjCellId int null, CellLac float null, AdjCellLac float null, foreign key(CellID)references CELL)go

      /*================*/ /* Table: LuCe */ /*================*/ create table LuCe(KeyNum int not null, CellID int null, Latitude float null, Longitude float null, RxLev float null, primary key(KeyNum), foreign key(CellID)references CELL)go

      /*================*/ /* Table: HuaWu */ /*================*/ create table HuaWu(CellID int not null, DATA datetime not null, TIME datetime not null, nTCH float null, traff float null, rate float null, thtraff float null, callnum float null, congsnum float null, callcongs float null, primary key(DATA,TIME,CellID), foreign key(CellID)references CELL)go

      實(shí)驗(yàn)要求 本實(shí)驗(yàn)內(nèi)容比較繁多,要求同學(xué)一定要進(jìn)行完全的實(shí)驗(yàn),并做出詳盡的記錄。

      實(shí)驗(yàn)總結(jié)

      通過(guò)本次實(shí)驗(yàn),掌握了如何使用SQL語(yǔ)言創(chuàng)建新的關(guān)系,以及設(shè)置主鍵和外鍵。在創(chuàng)建外鍵的時(shí)候,要注意其引用的主鍵要在其之前創(chuàng)建,也就是說(shuō),在實(shí)驗(yàn)開(kāi)始的時(shí)候,我們沒(méi)有注意到創(chuàng)建不同的關(guān)系的順序問(wèn)題,導(dǎo)致不能夠成功執(zhí)行腳本。在導(dǎo)入數(shù)據(jù)的過(guò)程中,一周內(nèi)的話務(wù)信息不能夠成功導(dǎo)入,問(wèn)題是話務(wù)信息的主鍵DATA和TIME,僅由這兩個(gè)屬性不能夠唯一確定一次話務(wù)信息,所以我們只能刪除主鍵,將話務(wù)數(shù)據(jù)導(dǎo)入。另外的問(wèn)題是,數(shù)據(jù)源的屬性名稱可能與數(shù)據(jù)庫(kù)中的屬性名稱不同,這時(shí)導(dǎo)入數(shù)據(jù)時(shí)系統(tǒng)不能夠自動(dòng)映射出他們之間的關(guān)系,所以要在導(dǎo)入數(shù)據(jù)時(shí)手動(dòng)編輯映射。編輯腳本語(yǔ)言時(shí),要注意視圖必須在最前面??傊?,雖然在實(shí)驗(yàn)之前已經(jīng)較熟悉SQL語(yǔ)言的相應(yīng)應(yīng)用,但是在實(shí)驗(yàn)的過(guò)程中仍然會(huì)出現(xiàn)很多問(wèn)題,這讓我們收獲了耐心嚴(yán)謹(jǐn)?shù)膶W(xué)習(xí)態(tài)度。

      第四篇:oracle-sql語(yǔ)句-創(chuàng)建表空間、數(shù)據(jù)庫(kù)

      1、查看表空間的名稱及大小

      select t.tablespace_name, round(sum(bytes/(1024*1024)),0)ts_size from dba_tablespaces t, dba_data_files d where t.tablespace_name = d.tablespace_name group by t.tablespace_name;

      2、查看表空間物理文件的名稱及大小

      select tablespace_name, file_id, file_name, round(bytes/(1024*1024),0)total_space from dba_data_files order by tablespace_name;

      3、查看回滾段名稱及大小

      select segment_name, tablespace_name, r.status,(initial_extent/1024)InitialExtent,(next_extent/1024)NextExtent, max_extents, v.curext CurExtent From dba_rollback_segs r, v$rollstat v Where r.segment_id = v.usn(+)order by segment_name;

      4、查看控制文件

      select name from v$controlfile;獲取創(chuàng)建表空間的sql select

      dbms_lob.substr(dbms_metadata.get_ddl('TABLESPACE',a.tablespace_name))from dba_tablespaces a;

      SQL> select sid,serial# from v$session where username='TEST';alter system kill session '150,9019';查看被鎖的表 select object_name,machine,s.sid,s.serial#,s.event from gv$locked_object l,dba_objects o,gv$session s where l.object_id=o.object_id and l.session_id=s.sid;alter system kill session ‘sid,serial#’;

      5、查看日志文件

      select member from v$logfile;

      6、查看表空間的使用情況

      select sum(bytes)/(1024*1024)as free_space,tablespace_name from dba_free_space group by tablespace_name;

      SELECT A.TABLESPACE_NAME,A.BYTES TOTAL,B.BYTES USED, C.BYTES FREE,(B.BYTES*100)/A.BYTES “% USED”,(C.BYTES*100)/A.BYTES “% FREE” FROM SYS.SM$TS_AVAIL A,SYS.SM$TS_USED B,SYS.SM$TS_FREE C WHERE A.TABLESPACE_NAME=B.TABLESPACE_NAME AND A.TABLESPACE_NAME=C.TABLESPACE_NAME;

      Select b.tablespace_name as表空間名,b.bytes as字節(jié)數(shù),(b.bytes-sum(nvl(a.bytes,0)))as已使用,sum(nvl(a.bytes,0))as剩余空間,sum(nvl(a.bytes,0))/(b.bytes)*100 as 剩余百分比 from dba_free_space a,dba_data_files b where a.file_id=b.file_id group by b.tablespace_name,b.file_id,b.bytes order by b.file_id;

      7、查看數(shù)據(jù)庫(kù)庫(kù)對(duì)象

      select owner, object_type, status, count(*)count# from all_objects group by owner, object_type, status;

      8、查看數(shù)據(jù)庫(kù)的版本

      Select version FROM Product_component_version Where SUBSTR(PRODUCT,1,6)='Oracle';

      9.查看某個(gè)表空間內(nèi)所占空間大于某個(gè)值的段(表或索引):

      Select segment_name,bytes FROM dba_segments Where bytes>10000000 AND tablespace_name='tablespace_name';10.查看所有表空間的碎片程度(值在30以下表示碎片很多)

      select tablespace_name,sum(bytes),sum(free),sum(free)*100/sum(bytes)from(select

      b.file_id file_ID,b.tablespace_name tablespace_name,b.bytes Bytes,(b.bytes-sum(nvl(a.bytes,0)))used,sum(nvl(a.bytes,0))free,sum(nvl(a.bytes,0))/(b.bytes)*100

      Percent

      from dba_free_space a,dba_data_files b

      where a.file_id=b.file_id

      group by b.tablespace_name,b.file_id,b.bytes

      order by b.file_id)group by tablespace_name order by sum(free)*100/sum(bytes);11.查看自上次數(shù)據(jù)庫(kù)啟動(dòng)以來(lái)所有數(shù)據(jù)文件的讀寫次數(shù)

      select

      substr(DF.NAME,1,5)Drive,DF.NAME file_name,(fs.phyblkrd+fs.phyblkwrt)

      from v$filestat fs,v$datafile df

      where df.file#=fs.file#;

      創(chuàng)建臨時(shí)表空間: //創(chuàng)建臨時(shí)表空間

      create temporary tablespace mytest tempfile 'E:/Program/oracle/product/10.1.0/oradata/orcl/mytest.dbf' size 32m autoextend on next 32m maxsize 1024m extent management local;

      //創(chuàng)建數(shù)據(jù)表空間

      create tablespace mytest_data logging datafile 'E:/Program/oracle/product/10.1.0/oradata/orcl/mytest_data.dbf' size 32m autoextend on next 32m maxsize 1024m extent management local;//創(chuàng)建用戶并指定表空間

      create user testaccount identified by testpwd default tablespace mytest_data temporary tablespace mytest;//給用戶授予權(quán)限

      grant connect,resource to testaccount;(db2:指定所有權(quán)限)12,創(chuàng)建一個(gè)用戶:

      CREATE USER username IDENTIFIED BY password OR IDENTIFIED EXETERNALLYOR IDENTIFIED GLOBALLY AS ‘CN=user’[DEFAULT TABLESPACE tablespace][TEMPORARY TABLESPACE temptablespace][QUOTA [integer K[M] ] [UNLIMITED] ] ON tablespace[,QUOTA [integer K[M] ] [UNLIMITED] ] ON tablespace[PROFILES profile_name][PASSWORD EXPIRE][ACCOUNT LOCK or ACCOUNT UNLOCK];

      //查看數(shù)據(jù)庫(kù)中的所有用戶: select * from all_users;//or select * from dba_users 13查看oracle最大連接數(shù): Select session_max,session_current,sessions_highwater,users_max from v$license;Select username,count(username)from v$session group by username;加密存儲(chǔ)過(guò)程 WRAP

      INAME=D:ORACLESOURCEDATE.SQL ONAME=D:ORACLESOURCEDATA.PLD

      第五篇:圖書管理系統(tǒng)--創(chuàng)建數(shù)據(jù)庫(kù)和表

      /* 1管理員表(L_Administrator)字段名 字段說(shuō)明 數(shù)據(jù)類型 約束 備注 a_id 管理員編號(hào) int Primary Key Identity(1000,1)a_name 管理員姓名 nvarchar(20)Not null a_pwd */ use Library go create table L_Administrator(a_id int not null primary key Identity(1000,1), a_name nvarchar(20)not null, a_pwd varchar(20)not null);

      /* 2職務(wù)類型表(L_Duty)字段名 字段說(shuō)明 數(shù)據(jù)類型 約束 備注 d_id 職務(wù)編號(hào) int Primary Key Identity(1000,1)d_name 職務(wù)名稱 nvarchar(20)Not null d_maxcount 最大借閱數(shù)量 tinyint Not Null */ use Library go create table L_Duty(d_id int not null primary key Identity(1000,1), d_name nvarchar(20)not null, d_maxcount tinyint not null);

      /* 3讀者表(L_Reader)字段名 字段說(shuō)明 數(shù)據(jù)類型 管理員密碼 varchar(20)

      Not Null

      約束 備注

      r_id 讀者編號(hào) bigint Primary Key r_name 讀者姓名 nvarchar(20)Not Null r_pwd r_sex 讀者密碼 讀者性別 varchar(20)Not Null bit Not Null

      int Foreign Key 職務(wù)類型表的主鍵

      r_typeid 職務(wù)類型

      r_academy 所在院系 nVarchar(20)r_major 專業(yè) nVarchar(20)

      r_contact 聯(lián)系方式 Varchar(20)r_email 郵箱 nvarchar(20)

      r_photo 讀者照片 */ use Library nVarchar(100)

      存的是讀者照片的路徑 go create table L_Reader(r_id bigint not null primary key, r_name nvarchar(20)not null, r_pwd varchar(20)not null, r_sex bit not null, r_typeid int not null, r_academy nvarchar(20), r_major nvarchar(20), r_contact varchar(20), r_email varchar(20), r_photo nvarchar(100));alter table L_Reader add constraint fk_dtypeid foreign key(r_typeid)references L_Duty(d_id)on delete cascade on update cascade;

      /*創(chuàng)建一個(gè)存儲(chǔ)過(guò)程*/ use Library go create procedure reader @r_id bigint, @r_name nvarchar(20), @r_pwd varchar(20), @r_sex bit, @r_typeid int, @r_academy nvarchar(20), @r_major nvarchar(20), @r_contact varchar(20), @r_email varchar(20), @r_photo nvarchar(100)as begin insert into L_Reader(r_id,r_name,r_pwd,r_sex,r_typeid,r_academy,r_major,r_contact,r_email,r_photo)values(@r_id,@r_name,@r_pwd,@r_sex,@r_typeid,@r_academy,@r_major,@r_contact,@r_email,@r_photo);end /* 4圖書類型表(L_BookType)字段名 字段說(shuō)明 數(shù)據(jù)類型 bt_id 類型編號(hào) bt_name 類型名稱 */

      約束 備注

      int Primary Key Identity(1000,1)nVarchar(20)Not null use Library go create table L_BookType(bt_id int not null primary key Identity(1000,1), bt_name nvarchar(20)not null);

      /* 5出版社信息表(L_Publishing)字段名 字段說(shuō)明 數(shù)據(jù)類型 ISBN */ use Library go create table L_Publishing(ISBN char(13)not null primary key, p_name nvarchar(30)not null);

      /* 6圖書信息表(L_Book)字段名 字段說(shuō)明 數(shù)據(jù)類型 國(guó)際標(biāo)準(zhǔn)圖書編碼

      約束 備注

      char(13)Primary Key

      p_name 出版社名稱 nvarchar(30)Not Null

      約束 備注

      b_id 圖書編號(hào) Varchar(30)Primary Key Identity(1000,1)b_name 圖書名稱 nvarchar(30)Not Null ISBN 國(guó)際標(biāo)準(zhǔn)圖書編碼 char(13)Foreign Key 13位數(shù)字組成 b_bkcaseid 書架編號(hào) Varchar(20)

      b_price 定價(jià) b_author 作者 Numeric(10,2)nvarchar(20)

      b_typeid 類型編號(hào) int Foreign Key b_intime 入庫(kù)時(shí)間 DateTime b_synopsis 圖書簡(jiǎn)介 Nvarchar(500)b_state 圖書狀態(tài) b_photo 封面圖片 */ use Library go

      create table L_Book(b_id varchar(20)not null primary key , b_name nvarchar(30)not null, ISBN char(13), b_bkcaseid varchar(20), b_price Numeric(10,2)not null, b_author nvarchar(20), b_typeid int, b_intime DateTime,bit 0--借出,1--沒(méi)有借出 Nvarchar(100)存的是路徑 b_synopsis nvarchar(1000), b_state bit not null default 0, b_photo nvarchar(100));

      alter table L_Book add L_BookType(bt_id)on delete cascade on update cascade;alter table L_Book add constraint fk_bisbn foreign key(ISBN)references L_Publishing(ISBN)on delete cascade on update cascade;alter table L_Book drop column b_bkcaseid /*創(chuàng)建存儲(chǔ)過(guò)程*/ use Library go create procedure book @b_name nvarchar(30), @ISBN char(13), @b_bkcaseid varchar(20), @b_price numeric(10,2), @b_author nvarchar(20), @b_intime datetime,@b_synopsis nvarchar(1000), @b_photo nvarchar(100)as begin insert into L_Book(b_name,ISBN,b_bkcaseid,b_price,b_author,b_intime,b_synopsis,b_photo)values(@b_name,@ISBN,@b_bkcaseid,@b_price,@b_author,@b_intime,@b_synopsis,@b_photo);end /* 7借閱管理表(L_Borrow)字段名 字段說(shuō)明 數(shù)據(jù)類型

      constraint fk_btypeid foreign key(b_typeid)references

      約束 備注

      bw_id 借閱編號(hào) int Primary Key Identity(1,1)bw_bookid 圖書編號(hào) Varchar(20)Foreign Key bw_readerid 讀者編號(hào) bw_outtime 借出日期 bw_endtime 到期日期 bw_backtime 歸還日期 bw_isexpired 是否過(guò)期 bw_fine 罰款數(shù)目 */ use Library

      Int Foreign Key DateTimeNot Null DateTimeNot Null

      DateTime

      Bit Not Null 默認(rèn)為0--不過(guò)期

      過(guò)期后才計(jì)算罰款數(shù)目 Numeric(10,2)go create table L_Borrow(bw_id int not null primary key Identity(1,1), bw_bookid varchar(20), bw_readerid bigint , bw_outtime datetime not null,bw_endtime as dateadd(d,30,bw_outtime), bw_backtime datetime, bw_isexperied bit default 0, bw_fine numeric(10,2)default 0.00);alter table L_Borrow add constraint fk_bookid foreign key(bw_bookid)references L_Book(b_id)on delete cascade on update cascade;alter table L_Borrow add constraint fk_readerid foreign key(bw_readerid)references L_Reader(r_id)on delete cascade on update cascade;/* 8圖書資源表(L_Resource)字段名 字段說(shuō)明 數(shù)據(jù)類型

      約束 備注

      rs_id 資源編號(hào) Int Primary Key Identity(1000,1)rs_name 資源名稱 nVarchar(30)Not null rs_synopsis 資源簡(jiǎn)介 nVarchar(500)rs_amount 資源大小 int 單位為KB或是MB rs_type 資源類型 等常用格式 */ use Library go create table L_Resource(rs_id int not null primary key Identity(1000,1), rs_name nvarchar(30)not null, rs_synopsis nvarchar(500), rs_amount bigint, rs_type varchar(20));

      /* 9圖書評(píng)論表(L_BookMarks)

      字段名 字段說(shuō)明 數(shù)據(jù)類型 約束 備注 ISBN 國(guó)際標(biāo)準(zhǔn)圖書編碼 char(13)Foreign Key bm_contents 評(píng)論內(nèi)容 Nvarchar(500)Not Null bm_time 評(píng)論時(shí)間 DateTimeNot Null */ Varchar(20)

      類似于doc、xsl、ppt、pdf、zip、rar、MP3、wmvuse Library go create table L_BookMarks(ISBN char(13)not null, bm_contents nvarchar(500)not null, bm_time datetime not null);alter table L_BookMarks add constraint fk_bmisbn foreign key(ISBN)references L_Publishing(ISBN)on delete cascade on update cascade;/* 10書架信息表(L_BookCase)字段名 字段說(shuō)明 數(shù)據(jù)類型 約束 備注

      bc_id 書架編號(hào) int Primary Key Identity(1000,1)bc_typeid 類型編號(hào) int Foreign Key

      */ use Library go create table L_BookCase(bc_id int not null primary key Identity(1000,1), bc_typeid int not null);alter table L_BookCase add constraint fk_bctypeid foreign key(bc_typeid)L_BookType(bt_id);

      references

      下載數(shù)據(jù)庫(kù)及表的創(chuàng)建與修改[本站推薦]word格式文檔
      下載數(shù)據(jù)庫(kù)及表的創(chuàng)建與修改[本站推薦].doc
      將本文檔下載到自己電腦,方便修改和收藏,請(qǐng)勿使用迅雷等下載。
      點(diǎn)此處下載文檔

      文檔為doc格式


      聲明:本文內(nèi)容由互聯(lián)網(wǎng)用戶自發(fā)貢獻(xiàn)自行上傳,本網(wǎng)站不擁有所有權(quán),未作人工編輯處理,也不承擔(dān)相關(guān)法律責(zé)任。如果您發(fā)現(xiàn)有涉嫌版權(quán)的內(nèi)容,歡迎發(fā)送郵件至:645879355@qq.com 進(jìn)行舉報(bào),并提供相關(guān)證據(jù),工作人員會(huì)在5個(gè)工作日內(nèi)聯(lián)系你,一經(jīng)查實(shí),本站將立刻刪除涉嫌侵權(quán)內(nèi)容。

      相關(guān)范文推薦

        數(shù)據(jù)庫(kù)和表的創(chuàng)建與管理實(shí)驗(yàn)報(bào)告(共5則)

        南京信息工程大學(xué)實(shí)驗(yàn)(實(shí)習(xí))報(bào)告 實(shí)驗(yàn)(實(shí)習(xí))名稱 數(shù)據(jù)庫(kù)和表的創(chuàng)建與管理 實(shí)驗(yàn)(實(shí)習(xí))日期得分指導(dǎo)教師系計(jì)算機(jī) 專業(yè) 計(jì)算機(jī)科學(xué)與技術(shù) 年級(jí)班次姓名學(xué)號(hào) 一、實(shí)驗(yàn)?zāi)康?1.熟悉SQL......

        Oracle 數(shù)據(jù)庫(kù)表空間(tablespace)的創(chuàng)建、刪除、修改、擴(kuò)展以及檢查(小編推薦)

        Oracle 數(shù)據(jù)庫(kù)表空間(tablespace)的創(chuàng)建、刪除、修改、擴(kuò)展以及檢查-------------oracle 數(shù)據(jù)庫(kù)表空間學(xué)習(xí)--------------------- --oracle 數(shù)據(jù)庫(kù)表空間的作用 1.決定數(shù)......

        Geodatabase 數(shù)據(jù)庫(kù)創(chuàng)建

        Geodatabase 數(shù)據(jù)庫(kù)創(chuàng)建 1 Geodatabase概述 地理數(shù)據(jù)庫(kù)(GeoDatabase) 是為了更好的管理和使用地理要素?cái)?shù)據(jù),而按照一定的模型、規(guī)則組合起來(lái)的存儲(chǔ)空間數(shù)據(jù)和屬性數(shù)據(jù)的容器。......

        修改數(shù)據(jù)庫(kù)狀態(tài)以便修改歸檔模式

        SQL*Plus: Release 10.2.0.1.0Production With the Partitioning, OLAP and Data Mining options第一步【關(guān)閉數(shù)據(jù)庫(kù)】: shutdown immediate; 數(shù)據(jù)庫(kù)已經(jīng)關(guān)閉。 已經(jīng)卸載數(shù)據(jù)......

        第二章 數(shù)據(jù)庫(kù)和表的操作

        第二章 數(shù)據(jù)庫(kù)和表的操作 首先創(chuàng)建名為“教學(xué)管理”的數(shù)據(jù)庫(kù),完成以下操作: 1. 在數(shù)據(jù)庫(kù)中,建立“教師表”,表結(jié)構(gòu)如下: 教師表(教師編號(hào),姓名,性別,工作時(shí)間,政治面貌,學(xué)歷,職稱,系別,電......

        access創(chuàng)建數(shù)據(jù)庫(kù)-教案

        創(chuàng)建數(shù)據(jù)庫(kù) 計(jì)算機(jī)組 余金光 一.教學(xué)重點(diǎn) 1.數(shù)據(jù)庫(kù)的創(chuàng)建方法 2.退出數(shù)據(jù)庫(kù) 二.教學(xué)難點(diǎn) 打開(kāi)數(shù)據(jù)庫(kù)的方法和退出關(guān)閉數(shù)據(jù)庫(kù)的方法 三.教學(xué)方法 演示法,討論法,講授法,練習(xí)法 四.教......

        創(chuàng)建數(shù)據(jù)庫(kù)的相關(guān)知識(shí)

        create database PeronalBlog/*創(chuàng)建文章內(nèi)容表(id, 標(biāo)題,內(nèi)容,關(guān)鍵字)*/ create table TitleInfo( Tid varchar(20) primary key, Ttile varchar(20) not null, Ttext varchar(80......

        Oracle數(shù)據(jù)庫(kù)創(chuàng)建表空間、建立用戶、授權(quán)、還原備份

        創(chuàng)建用戶一般分四步: 第一步:創(chuàng)建臨時(shí)表空間 第二步:創(chuàng)建數(shù)據(jù)表空間 第三步:創(chuàng)建用戶并制定表空間 第四步:給用戶授予權(quán)限 --Oracle創(chuàng)建臨時(shí)表空間 如果沒(méi)有指定的臨時(shí)表空間,則可......