SQL语句
--两个减号,注释一行
/*结合起来是注释一段*/
create database ss--创建一个名叫ss的数据库
go--可有可无
use ss--使用ss这个数据库
go
drop database ss --删除ss这个数据库
--创建表的步骤
create table student
(
code int not null,
name varchar(20),
birthday datetime
)
go
--修改表添加列
alter table student add sex int
--修改表删除列
alter table student drop column sex
--删除整个表
drop table student
--往表中插入数据
insert into student values(1,'张三','1990-09-09')
insert into student values(2,'李四','1990-09-09')
insert into student(code,name,birthday)values(3,'王五','1990-09-09')
--查询表中所有数据
select *from student
--修改表的一列数据
update student set birthday='1990-09-09'
--修改表的一行数据
update student set birthday='1991-09-23'where name='李四'
--删除表中的所有数据
delete from student
--删除表中的一行数据
delete from student where name='王五'

浙公网安备 33010602011771号