---------------------- android培训、java培训、期待与您交流! ----------------------
DML(Data Manipulation Language,数据操作语言)
为具体说明首先在MySchool数据库里先建一个Student表格
------------------------------------------------------------------------------------------------------
use MySchool
go
Create table Student
(
StudentId varchar(50) primary key, --学号作为主键
Name varchar(50), --学生姓名
GradeId tinyint, --所在年级号
)
-------------------------------------------------------------------------------------------------------
DML语句包括insert(增)、delete(删)、update(改)
1)insert语句
insert into Student(StudentId,Name,GradeId) values('001','韩梅梅',2) --这里第一个括号可以省去,但添加数据的值位置要对应
------------------------------------------------------------------------------------------
--insert select语句
insert into Student
select StudentId,Name,GradeId from Students
where .... --假设有Students表也有相应字段,类型一致,可以用select语句插入多条语句
-------------------------------------------------------------------------------------------
--select into 语句
select StudentId,Name into Student1 from student
where .... --select into是将查询结果创建一个新表,这里Student1原先没有才能,如果存在会报错
2)Delete语句
Delete [From] Student
where name='韩梅梅' --注意delete时要加where条件不然就会删除所有表数据,删除的是数据,表的结构还是存在
3)Update语句
Update Student set GradeId=3
where name='韩梅梅' --注意Update时要加where条件不然就会修改所有表数据
---------------------- android培训、java培训、期待与您交流! ----------------------详细请查看:http://edu.csdn.net/heima