상세 컨텐츠

본문 제목

DataCamp SQL_05 'Foreign keys'

IT & 프로그래밍

by 천승원 2022. 1. 6. 09:21

본문

Foreign keys

Recall that foreign keys reference another row in the database via a unique ID. Values in a foreign key column are restricted to values in the referenced column OR NULL.

Using what you know about foreign keys, why can't the tag column in the tag_type table be a foreign key that references the tag column in the stackoverflow table?

Remember, you can reference the slides using the icon in the upper right of the screen to review the requirements for a foreign key.

 

SELECT tag, COUNT(tag)
FROM stackoverflow
GROUP BY tag
HAVING COUNT(tag) > 1;

 

관련글 더보기

댓글 영역