データベース(実験2データベーステーブル)

8208 ワード

データベースの作成

//         
create database testbase2
on
(name=testbase2_data,
 filename='D:\      \lianxi2\testbase2_data.mdf',
 size=5mb,
 maxsize=50mb,
 filegrowth=20%)
 //          
 log on 
 (name=testbase2_log,
  filename='D:\      \lianxi2\testbase2_log.ldf',
  size=20mb,
  maxsize=500mb,
  filegrowth=10mb)

1建設教師表/
  create table Teacher
  (TNO char(2) not null,
   TN char(8) not null,
   SEX char(2),
   AGE tinyint,
   PROF char(10),
   SAL smallint,
   COMM smallint,
   DEPT char(10))

/2学生表を作成/
  create table Student
  (SNO char(2) not null,
   SN char(8) not null,
   SEX char(2),
   AGE tinyint,
   DEPT char(10))

/3カリキュラム/
  create table Course
  (CNO char(2) not null,
   CN char(10) not null,
   CT tinyint)

/4選択リストを作成/
create table SC
  (SNO char(2) not null,
   CNO char(2) not null,
   CT tinyint)

/5カリキュラムの作成/
  create table TC
  (TNO char(2) not null,
   CNO char(2) not null,
   Evalution char(20))

データベース・テーブルの削除
  /*  Teacher */
  drop table Teacher
  /*  Student */
  drop table Student
  /*  Course */
  drop table Course
  /*  SC */
  drop table SC
  /*  TC */
  drop table TC

データベース・テーブルの追加、変更
  /*  Student NATIVE */
  ALTER table Student
   ADD NATIVE char(40) null
   
  /*      Student   NATIVE*/
  alter table Student
	alter column NATIVE char(16) null