DB 2일차 2()

2022. 12. 8. 12:05코딩배움일지/DataBase

db 는 조회 할때 쓴다.

select 

순서를 바꾸고 내가 원하는 것만 뽑을 수도 있다.

from 으로 부터 영향을 받는다.

 

SELECT
	id,
	`name`,
	student_year,
	score
FROM
	student_mst	
WHERE
	student_year = 1 /* = equal 대입은 없다. */
	AND score > 79;

업데이트 에서는 대입이다.

 

SELECT
	id,
	`name`,
	student_year,
	score
FROM
	student_mst	
WHERE
	student_year = 1 /* = equal 대입은 없다. */
	or score > 79;

SELECT
	id,
	`name`,
	student_year,
	score
FROM
	student_mst	
WHERE
	student_year = 1 /* = equal 대입은 없다. */
	and score > 80 OR score = 80;

 

SELECT
	id,
	`name`,
	student_year,
	score
FROM
	student_mst	
WHERE /* = equal 대입은 없다. */
	student_year = 1 and score > 80 
	(or student_year = 3 and score = 75);

1학년 중에서 80점 이상이고 3학년 중에서 75점인 학생

'코딩배움일지 > DataBase' 카테고리의 다른 글

DB 3일차 1()  (0) 2022.12.09
DB 2일차 3()  (0) 2022.12.08
DB 2일차 1()  (0) 2022.12.08
DB 1일차 3(dml)  (0) 2022.12.06
DB 1일차 2  (0) 2022.12.06