14.-1复习

---恢复内容开始---

DDL(数据定义语言)、DML(数据操作语言)、DCL(数据库控制语言)

C#语言中,用双引号(" ")表示字符串;sql中,用单引号(' ')表示字符串。

C#语言中,判断两个变量是否相等,使用双等号(==)来判断;在数据库中,使用单等号(=)。

C#语言中,转义符号。例如:

“HI HELLO ""FdSF""FSDFSD "

sql语句中,两个单引号转义一个单引号。例如:

‘hsgjgskhgk ''sgvhgsgj   shjhb’
--创建数据库TestSchool
--TblStudent学生表
----tSId  --学生编号
----     tSName  --姓名
----     tSGender  --性别
----     tSAddress  --地址
----     tSPhone  --电话
----     tSAge  --年龄
----     tSBirthday  --生日
----     tSCardId  --身份证号
----     tSClassId  --班级Id
----创建一个班级表TblClass,班级名称和班级ID
--创建学生成绩表TblScore
--tScoreId(成绩id,主键,自动编号)、tSId(学生编号)、tEnglish(英语成绩)、tMath(数学成绩)
--创建老师表TblTeacher
--tTId、tTName、tTGender、tTAge、tTSalary、tTBirthday

create table TblScore
(
  tScoreId int identity(1,1) primary key,
  tSId int not null,
  tEnglish float,
  tMath float
) 


create table TblTeacher
(
   tTId int identity(1,1) primary key,
   tTNmae nvarchar(50) not null ,
   tTGender bit,
   tAge int,
   tTSalary money,--money类型占用8个字节
   tTBirthday date
)

create table TblStudent
(
   tSId int identity(1,1) primary key,
   tSName nvarchar(50) not null,
   tSGender bit, --或者为tSGender nchar(1  )
   tSAddress nvarchar(500),
   tSPhone varchar(50),
   tSAge int,
   tSBirthday date,
   tSCardId varchar(18),
   tSClassId int 
)
create table TblClass
(
   tClassId int identity(1,1) primary key,
   tClassName nvarchar(50)
)
原文地址:https://www.cnblogs.com/Strugglinggirl/p/7171166.html