以下为《数据库常用语句》的无排版文字预览,完整内容请下载
//------数据库------
CREAT DATABASE
CREAT DATABSE JXGL
ON
(NAME = JXGL,
FILENAME = 'D:\JXGLSYS\DATA\JAGL.mdf',
SIZE = 5,
FILEGROWTH = 1
)
LOG ON
(NAME = JXGL_log,
FILENAME = 'D:\JXGLSYS\DATA\JAGL.ldf',
SIZE = 2,
MAXSIZE = 20,
FILEGROWTH = 10%
)
DATABASEPROPERTYEX ( , )
ALTER DATABASE
USE JXGL
ALTER DATABASE JXGL
MODIFY FILE
(NAME =JXGL,
SIZE = 10)
USE JXGL
ALTER DATABASE JXGL
ADD FILE
(NAME = JXGL_1,
FILENAME = 'D:\JXGLSYS\DATA\JAGL_1.ndf',
SIZE = 5,
MAXSIZE = 30,
FILEGROWTH = 5%
)
USE JXGL
ALTER DATABSE JXGL
REMOVE FILE JXGL_1
DROP DATABASE
//-----数据表-----
CREAT TABLE
USE JXGL
CEREAT TABLE S
(SNO nchar(9) NOT NULL
CONSTRAINT PK_SNO PRIMARY KEY CLUSTERED
CHECK (SNO LIKE'***1[0-9][0-9]'),
SNEM nchar(8) NOT NULL,
SEX nchar(2) NULL,
BIRTHDATE data NULL,
COLLEGE nchar(20) NULL
)
ALTER TABLE
USE JXGL
ALTER TABLE S
ALTER COLUMN SEX CHAR(1) NULL
USE JXGL
ALTER TABLE S
DROP COLUNM BIRTHDATA
ALERT TABLE S
ADD AGE SMALLINT
USE JXGL
ALTER TABLE S
DROP CONSTRAINT PK_SNO
DROP TABLE
USE JXGL
DROP TABLE S
INSERT INTO
USE JXGL
INSERT INTO S(SNO,SANME,SEX,AGE,SDEPT)
VALUES ('S13','程某某','女',21,'CS')
UPDATA
USE JXGL
UPDATA S
SET NAME = '王某某',BIRTHDATA = '1997-06-06'
WHERE SNO = 'S2'
DELETE FROM
USE JXGL
DELETE S
WEHER SNAME = '张丽'
//-----视图-----
CREAT VIEW
CREAT VIEW V_MA
AS
SELECT SNO, SNAME, BIRTHDATE
FROM S
WHERE COLLEGE='MA'
WITH CHECK OPTION
USE JXGL
GO CREAT VIEW V_MA
AS
S 内容过长,仅展示头部和尾部部分文字预览,全文请查看图片预览。 ON S
INSTEAD OF DELETE
AS
DELETE FROM SC WHERE SC.SNO IN
(SELECT SNO FROM deleted)
RETURN
ALTER TRIGGER
ALTER TRIGGER S_I_U
ON S
INSTEAD OF
INSERT, UPDATE
AS
PRINT '你执行的插入或修改操作无效!'
DROP TRIGGER
DROP TRIGGER DEL_COUNT
ALTER TABLE
ALTER TABLE S
DISABLE TRIGGER ALL
[文章尾部最后300字内容到此结束,中间部分内容请查看底下的图片预览]
以上为《数据库常用语句》的无排版文字预览,完整内容请下载
数据库常用语句由用户“喵小新时代”分享发布,转载请注明出处