메뉴 건너뛰기

조회 수 138 추천 수 0 댓글 0
?

단축키

Prev이전 문서

Next다음 문서

크게 작게 위로 아래로 댓글로 가기 인쇄 첨부
?

단축키

Prev이전 문서

Next다음 문서

크게 작게 위로 아래로 댓글로 가기 인쇄 첨부

-- select 명령문의 조합 

 

 

-- 학년이 2, 3 학년인 학생의 학번과 이름을 출력하라

select stu_no, stu_name,grade from student where grade in (2 ,3);

 

 

select stu_no, stu_name,grade

from student

where grade = 2

union

select stu_no, stu_name,grade

from student

where grade = 3

 

 

 

-- 적어도 한번 이상 수강신청을 했거나 등록을 한 학생의 학번을 출력하라 

 

select stu_no 

from attend

union

select stu_no

from fee;

 

 

-- 적어도 한번 동아리에 가입했거나,

-- 등록을 하고 그리고 수강신청을 한 학생 중에서

-- 이상의 조건 중 둘 또는 세가지 조건을 만족하는 또는 두개의 조건에 모두 포함되는 각 학생의 학번을 출력하라 

 

 

-- (x)

select stu_no from attend where stu_no in 

(select stu_no from circle

union

select stu_no from fee

);

 

-- (o)

 

select stu_no from circle

union

select stu_no from fee

union 

select stu_no

from attend

where att_div='Y';

 

 

-- 적어도 한번 이상 등록금 납부하고 동아리에 가입한 모든 학생을 출력하라 

-- (단 중복된 행을 제거하지 않고 모두 출력한다. )

 

select stu_no from fee 

UNION all

select stu_no from circle;

 

-- 20061011 학생과 20071307 학생이 받은 장학금액을 출력하라

 

 

select stu_no ,jang_total 

from fee

where stu_no in (20061011, 20071307);

 

 

 

select stu_no, jang_total

from fee

where stu_no =20061011

union

select stu_no, jang_total

from fee

where stu_no =20071307;

 

 

-- -------------------------------------------------------

 

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
-- select 명령문의 조합 
 
 
-- 학년이 2, 3 학년인 학생의 학번과 이름을 출력하라
select stu_no, stu_name,grade from student where grade in (2 ,3);
 
 
select stu_no, stu_name,grade
from student
where grade = 2
union
select stu_no, stu_name,grade
from student
where grade = 3
 
 
 
-- 적어도 한번 이상 수강신청을 했거나 등록을 한 학생의 학번을 출력하라 
 
select stu_no 
from attend
union
select stu_no
from fee;
 
 
-- 적어도 한번 동아리에 가입했거나,
-- 등록을 하고 그리고 수강신청을 한 학생 중에서
-- 이상의 조건 중 둘 또는 세가지 조건을 만족하는 또는 두개의 조건에 모두 포함되는 각 학생의 학번을 출력하라 
 
 
-- (x)
select stu_no from attend where stu_no in 
(select stu_no from circle
union
select stu_no from fee
);
 
-- (o)
 
select stu_no from circle
union
select stu_no from fee
union 
select stu_no
from attend
where att_div='Y';
 
 
-- 적어도 한번 이상 등록금 납부하고 동아리에 가입한 모든 학생을 출력하라 
-- (단 중복된 행을 제거하지 않고 모두 출력한다. )
 
select stu_no from fee 
UNION all
select stu_no from circle;
 
-- 20061011 학생과 20071307 학생이 받은 장학금액을 출력하라
 
 
select stu_no ,jang_total 
from fee
where stu_no in (2006101120071307);
 
 
 
select stu_no, jang_total
from fee
where stu_no =20061011
union
select stu_no, jang_total
from fee
where stu_no =20071307;
 
 
-- -------------------------------------------------------


 


  1. MySQL 대용량 DBMS 개선 사례

    Date2017.12.28 Views8013
    Read More
  2. mysql 날짜 관련 date_add, date_format

    Date2016.12.23 Views5500
    Read More
  3. MYSQL 기초문법&예제&문제 2

    Date2021.03.27 Views136
    Read More
  4. MYSQL 기초문법&예제&문제

    Date2021.03.27 Views156
    Read More
  5. Mysql 기본 명령어

    Date2014.02.27 Views5693
    Read More
  6. MySQL 계정생성하기

    Date2017.04.12 Views5008
    Read More
  7. MySQL Table 복구 - Got error 127 from storage engine

    Date2018.07.24 Views4367
    Read More
  8. mysql table 값 변경 mariadb 테이블 값 변경

    Date2023.01.12 Views83
    Read More
  9. MySQL Shard 데이터 재분배

    Date2017.11.28 Views4950
    Read More
  10. MYSQL select 명령문의 조합 &union 예제&문제 8

    Date2021.03.27 Views138
    Read More
  11. MySQL root 패스워드 분실시

    Date2017.04.12 Views5252
    Read More
  12. MySQL Replication 설정(Master-Slave, Maste

    Date2014.02.27 Views6782
    Read More
  13. MySQL replication SQL 문 실행 오류 해결 방법

    Date2018.07.18 Views1608
    Read More
  14. MySQL ORDER BY 조건별 필드 및 ASC DESC

    Date2019.01.08 Views4420
    Read More
  15. MYSQL order by 예제&문제 7

    Date2021.03.27 Views126
    Read More
  16. Mysql Join 해부(Left, Right, Outer, Inner Join)

    Date2017.11.28 Views5340
    Read More
  17. Mysql Join 해부(Left, Right, Outer, Inner Join

    Date2018.10.02 Views1276
    Read More
  18. MySQL JOIN 걸어서 UPDATE 하기

    Date2017.04.12 Views5352
    Read More
  19. MySQL INSERT 성능 향상

    Date2016.12.22 Views11523
    Read More
  20. MYSQL IN&BETWEEN&NULL&예제&FROM절 문제3

    Date2021.03.27 Views104
    Read More
Board Pagination Prev 1 2 3 4 5 6 7 Next
/ 7

하단 정보를 입력할 수 있습니다

© k2s0o1d4e0s2i1g5n. All Rights Reserved