
SQL 2008 将SQL2000中的企业管理器和查询分析器合并了,
为SQL Server Management Studio,
在SQL Server Management Studio中新建查询即可。
查询分析器:










查询分析器的使用(5)
使用查询分析器再次完成梁山好汉管理数据库
1、建库
2、建表
英雄表 hero
[这里涉及到对表的几个重要概念:a、字段;b、字段类型(简单介绍);c、表行;d、表列;e、记录]
1、对表进行增加、删除、修改、查询的操作
查询分析器中创建数据库
--创建数据库
create database LiangshanHero2
--创建表
use LiangshanHero2--使用指定数据库
go--执行
create table hero--表名
(heroId int ,--英雄排名
heroName varchar(50),--名字
heroNickName varchar(50),--绰号
sex char(2),--性别
sal int
)
--删除一张表(把表的结构和表的数据删除)
drop table hero
--使用sql语句来添加数据
insert into hero values(1,'宋江','及时雨','男',20000)
insert into hero values(2,'卢俊义','玉麒麟','男',15000)
insert into hero values(3,'吴用','智多星','男',30)
insert into hero values(4,'公孙胜','入云龙','男',80)
--使用sql语句查询数据,最基础的查询语句
select * from hero
--1、查询工资低于100的同志
select * from hero where sal<100
--2、把工资低于100的人工资提高10%(update)
--语法结构:update 表名 set 字段名1=?,字段名2=?...where 条件语句
update hero set sal=sal*1.1 where sal<100
--3、请删除工资性别为女的
delete from hero where sex='男'
<wiz_tmp_tag id="wiz-table-range-border" contenteditable="false" style="display: none;">