--reate database Study --drop database study --创建数据库语句 CREATE DATABASE Study ON ( NAME=study_data, filename='c:\software\sql\studydata.mdf', size=10, maxsize=500, filegrowth=10 ) log ON ( NAME=study_log, filename='c:\software\sql\study_data.ldf', size=5, maxsize=500, filegrowth=5 ) ----查询所包含的全部数据库 SELECT * FROM sysdatabases; ----创建数据表 CREATE TABLE T_person ( FName VARCHAR(20), FAge INT ) SELECT* FROM T_person; --定义非空约束 CREATE TABLE T_student ( Fnumber VARCHAR(20) NOT NULL, Fname VARCHAR(20) NOT NULL, Fage INT NOT NULL, FFavorite VARCHAR(20), Fphonenumber VARCHAR(20) ) SELECT * FROM T_student; --定义默认值 CREATE TABLE T_teacher ( Fnumber VARCHAR(20), Fname VARCHAR(20), Fage INT, Fismaster VARCHAR(20) DEFAULT 'NO' ) SELECT * FROM T_teacher;