请问: 
看了文档和一些博客 老看不明白: 
1,select排序问题 能不能按照下面给的select执行的7条顺序 帮忙写个例子 将这7条一一对应在各语句的后面进行声明     1、from子句组装来自不同数据源的数据; 
    2、where子句基于指定的条件对记录行进行筛选; 
    3、group  by子句将数据划分为多个分组; 
    4、使用聚集函数进行计算; 
    5、使用having子句筛选分组; 
    6、计算所有的表达式; 
    7、使用order  by对结果集进行排序 2,文件组问题 请举例说明 
①:主文件组怎么创建 它对应的路径是什么 
②:次文件组怎么创建 它对应的路径是什么 
③:如何将主数据文件放入主文件组 
④:如何将其它数据文件放入次文件组 
⑤:如何将不同磁盘的文件放入文件组中 抱歉 问题比较多  请帮帮忙说下各位的想法 
另外 非常希望各位能写例子进行说明 
谢谢

解决方案 »

  1.   

    联机丛书和google我都用了 都没看明白 如果愿意 请帮忙说说
    谢谢
      

  2.   

    Select A.A1,B.B1,Sum(A.s1)as1,Sum(B.s1)Bs1,......From Servername1.DateBase.dbo.TableName1 A,Servername2.DateBase.dbo.TableName1 B
    Where A.Key=B.Key
    Group by A.A1,B.B1
    Having A.A1<>'sdfsdfs'
    Order by A.A1,B.B1
    文件组的创建好好看一下联机帮助。
      

  3.   

    我个人认为查询语句才是SQL的真正精华。只有真正的玩转的查询,才能更好的了解数据库。
      

  4.   

    这个不是大家不跟你讲啊!
    基本的书里都有讲到,例子也很多的!
    你真的可以到图书馆借本书或者去书店买一本,看看就明白了
    一句话,SQL语言就是从一张或者多张表中筛选出你需要的东东~~~~~~~
      

  5.   

    --------=======数据库
    --1.创建数据库(要求包含辅助文件)
    create database stu
    on primary
    (
    name='st',--逻辑文件名
    filename='c:\aa\st.mdf',--文件存放路径
    size=20mb,--初始大小
    maxsize=100mb,--最大大小
    filegrowth=10%--增长方式
    )
    ,
    (
    name='st1',
    filename='c:\aa\st1.ndf',
    size=2mb,
    maxsize=50mb,
    filegrowth=5mb
    )
    log on
    (
    name='st2',
    filename='c:\aa\st2.ldf',
    size=1mb,
    maxsize=10mb,
    filegrowth=1mb
    )--2.数据库改名
    alter database stu
    modify name=aaa
    go 
    alter database aaa
    modify name=stu--3.删除数据库(删除对象使用drop)
    drop database stu
    --====表
    --1.创建表(要求联合主键
    use stu
    create table xs
    (
    学号 int,
    身份证号 varchar(100),
    姓名 varchar(50),
    性别 char(2),
    成绩 int not null,
    备注 varchar(200),
    primary key(学号,身份证号)
    )
    --2.忘学生表中插入数据
    insert into xs values(1000,'420822198902225214','aa','男',80,null)
    insert into xs values(1001,'420822198902225215','bb','男',88,null)
    select * from xs
    --3.为表添加一个新列
    alter table xs
    add 学分 int 
    --3.删除表
    drop table xs--===基本T_SQl语句
    --1.增(inser into 1.直接插入记录 2.复制表 )
    insert into xs values(1002,'420822198902125215','cc','男',88,null,null)
    --2.删
    delete from xs where 学号=1000
    delete from xs --没带条件所以是删除表中所有记录
    truncate table xs --删除表中所有记录比delete更快更节省系统资源
    --3.改(update可以一次修改多列,不带条件则修改所有的记录)
    update xs
    set 姓名='aaa'
    where 姓名='aa'
    --3.查(select)
    select * from xs where 学号=1000--==高级查询(联结,嵌套,子查询,union,group.....by,group...by...having,group.....by...with rollup)
    --联结(join...on,where,exists)(嵌套,子查询)
    /*查找出选修了课程名为'软件工程'的学生的姓名*/
    --1.join...on
    select 姓名 from xs join xs_kc on xs.学号=xs_kc.学号
    join kc on xs_kc.课程号=kc.课程号 where 专业名='软件工程'
    --2.where
    select 姓名 from xs,xs_kc,kc
    where xs.学号=xs_kc.学号 and xs_kc.课程号=kc.课程号 and 专业名='软件工程'
    select 姓名 from xs where 学号 in(select 学号 from xs_kc
    where 课程号 in(select 课程号 from kc where 专业名='软件工程'))
    --3. exists
    select 姓名 from xs
    where exists(select * from xs_kc 
    where exists(select * from kc 
    where xs.学号=xs_kc.学号 and xs_kc.课程号=kc.课程号 and 专业名='软件工程'))--union(将查询的结果合并,要求列数相同数据类型相同)
    select * from xs_kc where 学号<='001103'
    union
    select * from kc