日本综合一区二区|亚洲中文天堂综合|日韩欧美自拍一区|男女精品天堂一区|欧美自拍第6页亚洲成人精品一区|亚洲黄色天堂一区二区成人|超碰91偷拍第一页|日韩av夜夜嗨中文字幕|久久蜜综合视频官网|精美人妻一区二区三区

RELATEED CONSULTING
相關(guān)咨詢
選擇下列產(chǎn)品馬上在線溝通
服務(wù)時間:8:30-17:00
你可能遇到了下面的問題
關(guān)閉右側(cè)工具欄

新聞中心

這里有您想知道的互聯(lián)網(wǎng)營銷解決方案
sqlservercreate語句實例

sql server create語句用于創(chuàng)建數(shù)據(jù)庫和表,下面就將為您介紹使用sql server create語句創(chuàng)建數(shù)據(jù)庫的實例,供您參考,希望對您更深入了解sql server create語句有所幫助。

創(chuàng)新互聯(lián)專注于企業(yè)成都全網(wǎng)營銷、網(wǎng)站重做改版、宜君網(wǎng)站定制設(shè)計、自適應(yīng)品牌網(wǎng)站建設(shè)、H5技術(shù)、電子商務(wù)商城網(wǎng)站建設(shè)、集團(tuán)公司官網(wǎng)建設(shè)、外貿(mào)網(wǎng)站制作、高端網(wǎng)站制作、響應(yīng)式網(wǎng)頁設(shè)計等建站業(yè)務(wù),價格優(yōu)惠性價比高,為宜君等各大城市提供網(wǎng)站開發(fā)制作服務(wù)。

 
 
 
  1. use master --切換到master數(shù)據(jù)庫   
  2. go   
  3. --檢測是否存在同名的數(shù)據(jù)庫   
  4. if exists(select 1 from sysdatabases where name = 'tour')   
  5. begin   
  6.   drop database tour   
  7. end   
  8. go   
  9. create database tour   
  10. on --數(shù)據(jù)文件   
  11. (   
  12.   name = 'tour_mdf', --數(shù)據(jù)文件邏輯名   
  13.   filename = 'D:\tour.mdf',--數(shù)據(jù)文件存放路徑   
  14.   size = 1MB,--初始大小   
  15.   maxsize = 10MB,--最大大小   
  16.   filegrowth = 1MB--增長速度   
  17. )   
  18. log on --日志文件   
  19. (   
  20.   name = 'tour_ldf', --日志文件邏輯名   
  21.   filename = 'D:\tour.ldf',--日志文件存放路徑   
  22.   size = 1MB,--初始大小   
  23.   maxsize = 10MB,--最大大小   
  24.   filegrowth = 1MB--增長速度   
  25. )   
  26. go   
  27. use tour   
  28. go   
  29. 創(chuàng)建數(shù)據(jù)庫表   
  30. if exists(select * from sysobjects where name='stuInfo') drop table stuInfo   
  31. create table   stuInfo    /*-創(chuàng)建學(xué)員信息表-*/   
  32. (   
  33.  
  34. stuNo   varchar(6) not null unique,   --學(xué)號,非空(必填)   
  35. stuName  varchar(20) not null ,  --姓名,非空(必填)   
  36. stuAge  int  not null,  --年齡,INT類型默認(rèn)為4個字節(jié)   
  37. stuID  NUMERIC(18,0),     --身份證號   
  38. stuSeat   int  IDENTITY (1,1),   --座位號,自動編號   
  39. stuAddress   text   --住址,允許為空,即可選輸入   
  40. )   
  41. go   
  42.  
  43. if exists(select * from sysobjects where name='stuMarks') drop table stuMarks   
  44. create table  stuMarks   
  45. (   
  46. ExamNo  varchar(6)  not null foreign key references stuInfo(stuNo) ,  --考號   
  47. stuNo  varchar(6) not null,   --學(xué)號   
  48. writtenExam  int  not null,  --筆試成績   
  49. LabExam  int  not null    --機(jī)試成績   
  50. )   
  51. go   
  52.  
  53. if exists(select * from sysobjects where name='users') drop table users   
  54. create table users   
  55. (   
  56.     userID int not null primary key identity(1,1),   
  57.     userName varchar(255) not null unique,   
  58.     userPWD varchar(255) not null,   
  59.     userAge int,   
  60.     userBirthDay datetime,   
  61.     userEmail varchar(255)   
  62. )   
  63. go  

【編輯推薦】

強(qiáng)制關(guān)閉SQL Server數(shù)據(jù)庫連接的方法

sql server字符串的類型

sql server字符串函數(shù)分類詳解

sql server端口的更改方法

sql server日志文件過大的解決辦法


文章標(biāo)題:sqlservercreate語句實例
轉(zhuǎn)載注明:http://www.dlmjj.cn/article/cdgedih.html