Search

2021๋…„ 2ํšŒ

2021๋…„ 2ํšŒ ๊ธฐ์ถœ๋ถ„์„

๋ฒˆํ˜ธ
๊ณผ๋ชฉ
์ฃผ์š” ๊ฐœ๋…
๊ธฐ์ถœ ํ†ต๊ณ„
1
7. SQL ์‘์šฉ
ํŠธ๋žœ์žญ์…˜ ํŠน์ง• โ€“ ์›์ž์„ฑ
2
3. ๋ฐ์ดํ„ฐ ์ž…์ถœ๋ ฅ ๊ตฌํ˜„
์ •๊ทœํ™” - ์ œ2์ •๊ทœํ˜•
3
7. SQL ์‘์šฉ
UPDATE
4
7. SQL ์‘์šฉ
INNER JOIN
5
7. SQL ์‘์šฉ
LIKE, ORDER BY
์ด์”จ ์„ฑ, ๋‚ด๋ฆผ์ฐจ์ˆœ ใ……์ •๋ ฌ
6
7. SQL ์‘์šฉ
๋ณ‘ํ–‰์ œ์–ด ๊ธฐ๋ฒ• โ€“ ๋กœํ‚น
7
6. ํ”„๋กœ๊ทธ๋ž˜๋ฐ ์–ธ์–ด ํ™œ์šฉ
[C] 2์˜ 10์Šน
8
6. ํ”„๋กœ๊ทธ๋ž˜๋ฐ ์–ธ์–ด ํ™œ์šฉ
[C] ๋ฐฐ์—ด, ํฌ์ธํ„ฐ
9
6. ํ”„๋กœ๊ทธ๋ž˜๋ฐ ์–ธ์–ด ํ™œ์šฉ
[Java] static
10
6. ํ”„๋กœ๊ทธ๋ž˜๋ฐ ์–ธ์–ด ํ™œ์šฉ
[Java] ์ƒ์†, ์˜ค๋ฒ„๋ผ์ด๋”ฉ
11
6. ํ”„๋กœ๊ทธ๋ž˜๋ฐ ์–ธ์–ด ํ™œ์šฉ
[Python] โ€“ ๋น„ํŠธ ์—ฐ์‚ฐ, range()
๋ˆ„์  ๋‚š์‹œ
ํŠธ๋žœ์žญ์…˜์˜ ํŠน์ง• ์ค‘, ์›์ž์„ฑ(Atomicity)์— ๋Œ€ํ•ด ์•ฝ์ˆ ํ•˜์‹œ์˜ค.
๋‹ค์Œ์€ ์ œ ( ) ์ •๊ทœํ˜•์œผ๋กœ ๋ถ€๋ถ„ ํ•จ์ˆ˜์  ์ข…์†์„ฑ ์ œ๊ฑฐํ•˜์—ฌ ์™„์ „ ํ•จ์ˆ˜์  ์ข…์†์„ ๋งŒ์กฑํ•˜๋Š” ์ •๊ทœํ˜•์ด๋‹ค. ๊ด„ํ˜ธ์•ˆ์— ๋“ค์–ด๊ฐˆ ๋‹ต์•ˆ์„ ์“ฐ์‹œ์˜ค.
[์ˆ˜๊ฐ•๊ฐ•์˜ ํ…Œ์ด๋ธ”]
ํ•™์ƒ๋ฒˆํ˜ธ
๊ฐ•์ขŒ์ด๋ฆ„
๊ฐ•์˜์‹ค
์„ฑ์ 
501
๋ฐ์ดํ„ฐ๋ฒ ์ด์Šค
๊ณตํ•™๊ด€ 110
3.5
401
๋ฐ์ดํ„ฐ๋ฒ ์ด์Šค
๊ณตํ•™๊ด€ 110
4.0
402
์Šคํฌ์ธ ๊ฒฝ์˜ํ•™
์ฒด์œก๊ด€ 103
3.5
502
์ž๋ฃŒ๊ตฌ์กฐ
๊ณตํ•™๊ด€ 111
4.0
501
์ž๋ฃŒ๊ตฌ์กฐ
๊ณตํ•™๊ด€ 111
3.5
[์ˆ˜๊ฐ• ํ…Œ์ด๋ธ”]
ํ•™์ƒ๋ฒˆํ˜ธ
๊ฐ•์ขŒ์ด๋ฆ„
์„ฑ์ 
501
๋ฐ์ดํ„ฐ๋ฒ ์ด์Šค
3.5
401
๋ฐ์ดํ„ฐ๋ฒ ์ด์Šค
4.0
402
์Šคํฌ์ธ ๊ฒฝ์˜ํ•™
3.5
502
์ž๋ฃŒ๊ตฌ์กฐ
4.0
501
์ž๋ฃŒ๊ตฌ์กฐ
3.5
[๊ฐ•์˜ ํ…Œ์ด๋ธ”]
๊ฐ•์ขŒ์ด๋ฆ„
๊ฐ•์˜์‹ค
๋ฐ์ดํ„ฐ๋ฒ ์ด์Šค
๊ณตํ•™๊ด€ 110
์Šคํฌ์ธ ๊ฒฝ์˜ํ•™
์ฒด์œก๊ด€ 103
์ž๋ฃŒ๊ตฌ์กฐ
๊ณตํ•™๊ด€ 111
ํ…Œ์ด๋ธ”์˜ ํŠœํ”Œ์„ ์ˆ˜์ •ํ•˜๊ณ ์ž ํ•œ๋‹ค. ์˜ฌ๋ฐ”๋ฅธ SQL์„ ์ž‘์„ฑํ•˜๊ธฐ ์œ„ํ•ด ๋นˆ์นธ์„ ์ฑ„์šฐ์‹œ์˜ค.
( A ) ํ…Œ์ด๋ธ”๋ช… ( B ) ์ปฌ๋Ÿผ = ๊ฐ’ WHERE ์ ์ˆ˜ >= 90;
SQL
๋ณต์‚ฌ
๋‹ค์Œ์€ Inner Join์„ ํ•˜๊ธฐ ์œ„ํ•œ SQL์ด๋‹ค. ๋นˆ์นธ์— ๋“ค์–ด๊ฐˆ ๋ฌธ๊ตฌ๋ฅผ ์ ์œผ์‹œ์˜ค.
SELECT * FROM ํ•™์ƒ์ •๋ณด a JOIN ํ•™๊ณผ์ •๋ณด b ( A ) a.ํ•™๊ณผ = b.( B )
SQL
๋ณต์‚ฌ
๋‹ค์Œ์€ '์ด'์”จ ์„ฑ์„ ๊ฐ€์ง„ ์‚ฌ๋žŒ์˜ ์ด๋ฆ„์„ ๋‚ด๋ฆผ์ฐจ์ˆœ์œผ๋กœ ์ถœ๋ ฅํ•˜๊ธฐ ์œ„ํ•œ SQL๋ฌธ์ด๋‹ค. ๊ด„ํ˜ธ์•ˆ์— ๋“ค์–ด๊ฐˆ ์•Œ๋งž์€ ๋‹ต์•ˆ์„ ์ž‘์„ฑํ•˜์‹œ์˜ค.
SELECT * FROM ํ•™์ƒ WHERE ์ด๋ฆ„ LIKE ( A ) ORDER BY ( B )
SQL
๋ณต์‚ฌ
๋‹ค์Œ์ด ์„ค๋ช…ํ•˜๋Š” ์šฉ์–ด๋ฅผ ์ž‘์„ฑํ•˜์‹œ์˜ค.
๋ณ‘ํ–‰์ œ์–ด๊ธฐ๋ฒ• ์ค‘, ์ ‘๊ทผํ•œ ๋ฐ์ดํ„ฐ์— ๋Œ€ํ•œ ์—ฐ์‚ฐ์„ ๋ชจ๋‘ ๋งˆ์น ๋•Œ๊นŒ์ง€ ์ƒํ˜ธ๋ฐฐ์ œํ•˜๋Š” ๊ธฐ๋ฒ•์„ ๋ฌด์—‡์ด๋ผ ํ•˜๋Š”์ง€ ์ž‘์„ฑํ•˜์‹œ์˜ค.
๋‹ค์Œ์€ C์–ธ์–ด์— ๊ด€ํ•œ ์†Œ์Šค์ฝ”๋“œ์ด๋‹ค. ์‹คํ–‰ ๊ฒฐ๊ณผ๊ฐ’์„ ์ž‘์„ฑํ•˜์‹œ์˜ค.
#include <stdio.h> int mp(int base, int exp); int main(){ int res; res = mp(2,10); printf("%d",res); return 0; } int mp(int base, int exp) { int res = 1; for(int i=0; i < exp; i++){ res = res * base; } return res; }
C
๋ณต์‚ฌ
๋‹ค์Œ์€ C์–ธ์–ด ์ฝ”๋“œ์˜ ์‹คํ–‰ ๊ฒฐ๊ณผ๋ฅผ ์ ์œผ์‹œ์˜ค.
#include <stdio.h> int main() { int ary[3]; int s = 0; *(ary + 0) = 1; ary[1] = *(ary + 0) + 2; ary[2] = *ary + 3; for(int i = 0; i < 3; i++) { s = s + ary[i]; } printf("%d", s); }
C
๋ณต์‚ฌ
์ด๊ฒƒ์€ ํด๋ž˜์Šค ๋‚ด์—์„œ ๊ฐ์ฒด ์ƒ์„ฑ ์—†์ด ์‚ฌ์šฉํ•  ์ˆ˜ ์žˆ๋Š” ๋ฉ”์†Œ๋“œ์ด๋‹ค. ๋‹ค์Œ์˜ ์ถœ๋ ฅ ๊ฒฐ๊ณผ๋ฅผ ๋ณด๊ณ  ๊ด„ํ˜ธ์•ˆ์— ์•Œ๋งž์€ ๋‹ต์•ˆ์„ ์ž‘์„ฑํ•˜์‹œ์˜ค.
public class Test { public static void main(String[] args){ System.out.print(Test.check(1)); } ( ๊ด„ํ˜ธ ) String check (int num) { return (num >= 0) ? "positive" : "negative"; } }
Java
๋ณต์‚ฌ
โ€ข
์ถœ๋ ฅ๊ฒฐ๊ณผ
positive
Java
๋ณต์‚ฌ
๋‹ค์Œ JAVA ์ฝ”๋“œ์˜ ์‹คํ–‰ ๊ฒฐ๊ณผ๋ฅผ ์ ์œผ์‹œ์˜ค.
public class SuperObject { public static void main(String[] args){ SuperObject a1 = new SuperObject(); SubObject a2 = new SubObject(); System.out.println(a1.sun(3,2) + a2.sun(3,2)); } int sun(int x, int y){ return x + y; } } class SubObject extends SuperObject { int sun(int x, int y){ return x - y + super.sun(x,y); } }
Java
๋ณต์‚ฌ
๋‹ค์Œ ํŒŒ์ด์ฌ ์ฝ”๋“œ์˜ ๊ฒฐ๊ณผ๋ฅผ ์ ์œผ์‹œ์˜ค.
a = 100 result = 0 for i in range(1,3): result = a >> i result = result + 1 print(result)
Python
๋ณต์‚ฌ