现在的位置: 首页 > 综合 > 正文

SQL语句,查询

2013年04月17日 ⁄ 综合 ⁄ 共 516字 ⁄ 字号 评论关闭

 

↘多对多

select c.* from course c, (select sc.* from sc,(select * from student where name='liu') s where s.id=sc.id_student) sc where c.id=sc.id_course;

 

 

↘查找ID为18的blog 的所以评论。1条 查 多条

select * from (
    select * from blog where id=18
        ) b,comment c where b.blog_id=b.id;

或者是 select c.* from comment as c where c.blog_id=18;

 

↘查询ID为18的blog的分类。 1条 查 1条

select c.* from (
    select * from blog where id=18
        ) b,category c where b.category_id=c.id;

 

↘分页查询

select * from (
    select my_table.*, rownum  my_rownum from (
        select name, birthday from employee order by birthday
            ) my_table where rownum < 120 
                ) where my_rownum >= 100;

 

 

@@@

抱歉!评论已关闭.