yeriimii
    • Create new note
    • Create a note from template
      • Sharing URL Link copied
      • /edit
      • View mode
        • Edit mode
        • View mode
        • Book mode
        • Slide mode
        Edit mode View mode Book mode Slide mode
      • Customize slides
      • Note Permission
      • Read
        • Only me
        • Signed-in users
        • Everyone
        Only me Signed-in users Everyone
      • Write
        • Only me
        • Signed-in users
        • Everyone
        Only me Signed-in users Everyone
      • Engagement control Commenting, Suggest edit, Emoji Reply
      • Invitee
    • Publish Note

      Share your work with the world Congratulations! 🎉 Your note is out in the world Publish Note

      Your note will be visible on your profile and discoverable by anyone.
      Your note is now live.
      This note is visible on your profile and discoverable online.
      Everyone on the web can find and read all notes of this public team.
      See published notes
      Unpublish note
      Please check the box to agree to the Community Guidelines.
      View profile
    • Commenting
      Permission
      Disabled Forbidden Owners Signed-in users Everyone
    • Enable
    • Permission
      • Forbidden
      • Owners
      • Signed-in users
      • Everyone
    • Suggest edit
      Permission
      Disabled Forbidden Owners Signed-in users Everyone
    • Enable
    • Permission
      • Forbidden
      • Owners
      • Signed-in users
    • Emoji Reply
    • Enable
    • Versions and GitHub Sync
    • Note settings
    • Engagement control
    • Transfer ownership
    • Delete this note
    • Save as template
    • Insert from template
    • Import from
      • Dropbox
      • Google Drive
      • Gist
      • Clipboard
    • Export to
      • Dropbox
      • Google Drive
      • Gist
    • Download
      • Markdown
      • HTML
      • Raw HTML
Menu Note settings Sharing URL Create Help
Create Create new note Create a note from template
Menu
Options
Versions and GitHub Sync Engagement control Transfer ownership Delete this note
Import from
Dropbox Google Drive Gist Clipboard
Export to
Dropbox Google Drive Gist
Download
Markdown HTML Raw HTML
Back
Sharing URL Link copied
/edit
View mode
  • Edit mode
  • View mode
  • Book mode
  • Slide mode
Edit mode View mode Book mode Slide mode
Customize slides
Note Permission
Read
Only me
  • Only me
  • Signed-in users
  • Everyone
Only me Signed-in users Everyone
Write
Only me
  • Only me
  • Signed-in users
  • Everyone
Only me Signed-in users Everyone
Engagement control Commenting, Suggest edit, Emoji Reply
Invitee
Publish Note

Share your work with the world Congratulations! 🎉 Your note is out in the world Publish Note

Your note will be visible on your profile and discoverable by anyone.
Your note is now live.
This note is visible on your profile and discoverable online.
Everyone on the web can find and read all notes of this public team.
See published notes
Unpublish note
Please check the box to agree to the Community Guidelines.
View profile
Engagement control
Commenting
Permission
Disabled Forbidden Owners Signed-in users Everyone
Enable
Permission
  • Forbidden
  • Owners
  • Signed-in users
  • Everyone
Suggest edit
Permission
Disabled Forbidden Owners Signed-in users Everyone
Enable
Permission
  • Forbidden
  • Owners
  • Signed-in users
Emoji Reply
Enable
Import from Dropbox Google Drive Gist Clipboard
   owned this note    owned this note      
Published Linked with GitHub
Subscribed
  • Any changes
    Be notified of any changes
  • Mention me
    Be notified of mention me
  • Unsubscribe
Subscribe
# 스터디 일자 - 2024.11.3 일요일 # 참여한 사람 - 옐리 - 샤피 - 데이 - 그로밋 # 11.1 ## OX 문제 - `sql_mode` 시스템 변수 중 `ANSI`로 설정 시 MySQL 서버가 최대한 SQL 표준에 맞게 동작하게 할 수 있다. ( O ) - 유닉스 계열 운영체제에서 테이블명의 대소문자를 구분하지 않는다. ( X ) - 예약어인지 확인하려면 테이블명이나 컬럼명에 '\`'(백틱)를 사용하면 알 수 있다. ( X ) # 11.2 ## 아래 SQL 문법 표기를 보고 올바른 설명을 모두 고르세요. ```sql INSERT [LOW_PRIORITY | DELAYED | HIGH_PRIORITY] [IGNORE] [INTO] tbl_name [PARTITION] (partition_name [, partition_name ...)] [(col_name [, col_name] ...)] {VALUES | VALUE} (value_list) [, (value_list)] value: {expr | DEFAULT} value_list: value [, value] ... assignment: col_name = value assignment_list: assignment [, assignment] ``` 1. 대문자로 표현된 단어는 키워드를 의미한다. 2. 대괄호(`[]`)로 표현된 키워드나 표현식은 반드시 포함되야 하는 키워드를 의미한다. 3. 파이프(`|`) 표현은 표현식 중에서 여러 개를 선택해서 사용할 수 있다. 4. 중괄호(`{}`)는 여러 개 아이템 중 반드시 하나만 선택해서 사용하는 경우를 의미한다. 올바른 설명: - 1번 : O (규칙) - 2번 : X (선택사항임) - 3번 : X (단 하나만 선택 가능) - 4번 : O # 11.3 ### 문자열 OX 문제 - SQL 표준은 문자열은 홑따옴표(`'`)만 사용가능하지만 MySQL은 쌍따옴표(`"`)로도 표현할 수 있다. ( O ) ### 숫자 1. `SELECT * FROM tab_test WHERE number_column='10001';` 2. `SELECT * FROM tab_test WHERE string_column=10001;` 위의 두 쿼리 중 인덱스를 사용하지 못하는 쿼리는 몇 번 쿼리이며, 그 이유를 설명해 보세요. (복수 정답일 수 있음) (각 컬럼에 인덱스가 있다고 가정) - 2번, string_column 컬럼 자체를 숫자로 변환하기 때문에 인덱스를 사용할 수 없습니다. ### 날짜 1. `SELECT * FROM dept_emp WHERE from_date='2011-04-29';` 2. `SELECT * FROM dept_emp WHERE from_date=STR_TO_DATE('2011-04-29');` 위의 두 쿼리 중 인덱스를 사용할 수 있는 쿼리를 고르세요. (복수 정답일 수 있음) (인덱스가 있다고 가정) - 1, 2번. 둘은 같은 쿼리 - 문자로 따로 변환해서 비교하지 않기 때문 ### 불리언 OX 문제 - BOOL, BOOLEAN, TINYINT 모두 다른 타입이다. ( X ) - 결국 전부 TINYINT라서 같은 타입임 ### BETWEEN #### 아래 쿼리에 대한 설명을 OX로 표기해 보세요. ```sql SELECT * FROM dept_emp WHERE dept_no BETWEEN 'd003' AND 'd005' AND emp_no=10001; ``` - `emp_no=10001` 조건에 의해 비교 범위를 줄인다. ( X ) -> BETWEEN은 범위조건이라 동등비교보다 먼저 나오면 범위를 줄이지 못함 - BETWEEN 연산자는 크다, 작다(<, >) 연산을 합친 연산자다. ( O ) => ( X ) -> 크거나 같다 `<=` 작거나 같다 `>=` 연산 - 레코드가 10만건이 있으면 10만건을 모두 읽는다. ( 보류 ) -> 전체 데이터의 3분의 1 이상이면 10만건을 모두 읽는다. ### IN 연산자 #### 아래 쿼리에 대한 설명을 OX로 표기해 보세요. ```sql SELECT * FROM dept_emp WHERE dept_no IN ('d003', 'd004', 'd005') AND emp_no=10001; ``` - `emp_no=10001` 조건에 의해 비교 범위를 줄인다. ( O ) - IN 연산자는 동등 비교(=)를 여러 번 사용해서 빠르다. ( O ) - 레코드가 10만건이 있으면 10만건을 모두 읽는다. ( 보류 ) # 11.4 ## 인덱스를 사용하기 위한 기본 규칙 OX 1. 컬럼을 변형하지 않는다. ( O ) 2. 두 비교 대상의 타입을 동일하게 맞춰야 한다. ( O ) ## NULL 비교 ```sql SELECT * FROM titles WHERE to_date IS NULL; SELECT * FROM titles WHERE ISNULL(to_date); SELECT * FROM titles WHERE ISNULL(to_date)=1; SELECT * FROM titles WHERE ISNULL(to_date)=true; ``` - 위의 쿼리 4개 중 인덱스 레인지 스캔을 할 수 있는 쿼리를 모두 고르세요. 1, 2 가능 ## DATETIME 비교 OX - DATE, DATETIME 타입의 컬럼과 비교 시 비교 대상(표현식)에 문자열을 사용해도 인덱스를 사용한다. ( O ) ## COUNT OX - `COUNT(*)` 는 NULL 인 레코드는 제외한다. ( X ) -> 포함된다 -> NULL이 있는 칼럼은 COUNT 쓸 때 주의해야 함 -> * : 레코드 자체를 의미 ## JOIN에서 인덱스 사전 지식: 인덱스 레인지 스캔은 `인덱스 탐색 작업`과 `스캔 작업`으로 나눠집니다. 드라이빙 테이블을 읽을 때는 `인덱스 탐색 작업`을 단 한 번만 수행합니다. 이후 `스캔 작업`만 합니다. 드리븐 테이블은 `인덱스 탐색 작업`과 `스캔 작업`을 드라이빙 테이블에서 읽은 레코드 건수 만큼 반복합니다. 따라서 옵티마이저는 항상 **드리븐 테이블**을 최적으로 읽을 수 있도록 실행 계획을 수립합니다. - WHERE 절과 동일하게 비교 대상 컬럼과 표현식의 데이터 타입을 반드시 동일하게 사용해야 인덱스를 사용할 수 있다. ( O ) - OUTER JOIN 되는 테이블은 드라이빙 테이블이 될 수 있다. ( X ) -> 옵티마이저 학습이 필요해 보임 - 외래키가 있어야 테이블 간 JOIN 작업을 할 수 있다. ( X ) ## CTE(Common Table Expression) - CTE 임시 테이블은 SQL 문장 종료가 되어도 버퍼에 저장되어 있다. ( X ) ## 잠금을 거는 SELECT - `SELECT * FROM employees WHERE emp_no=10001 FOR SHARE;` - 위의 레코드는 배타 잠금(exclusive lock)을 걸기 때문에 다른 트랜잭션에서 읽기가 불가능하다. ( X ) - `SELECT * FROM employees WHERE emp_no=10001 FOR UPDATE;` - 위의 레코드는 공유 잠금(shared lock)을 걸기 때문에 다른 트랜잭션에서 읽기가 가능하다. ( X ) ## NOWAIT & SKIP LOCKED - MySQL 8.0 부터 사용 가능. - redis, memcached 대체할 수 있다

Import from clipboard

Paste your markdown or webpage here...

Advanced permission required

Your current role can only read. Ask the system administrator to acquire write and comment permission.

This team is disabled

Sorry, this team is disabled. You can't edit this note.

This note is locked

Sorry, only owner can edit this note.

Reach the limit

Sorry, you've reached the max length this note can be.
Please reduce the content or divide it to more notes, thank you!

Import from Gist

Import from Snippet

or

Export to Snippet

Are you sure?

Do you really want to delete this note?
All users will lose their connection.

Create a note from template

Create a note from template

Oops...
This template has been removed or transferred.
Upgrade
All
  • All
  • Team
No template.

Create a template

Upgrade

Delete template

Do you really want to delete this template?
Turn this template into a regular note and keep its content, versions, and comments.

This page need refresh

You have an incompatible client version.
Refresh to update.
New version available!
See releases notes here
Refresh to enjoy new features.
Your user state has changed.
Refresh to load new user state.

Sign in

Forgot password

or

By clicking below, you agree to our terms of service.

Sign in via Facebook Sign in via Twitter Sign in via GitHub Sign in via Dropbox Sign in with Wallet
Wallet ( )
Connect another wallet

New to HackMD? Sign up

Help

  • English
  • 中文
  • Français
  • Deutsch
  • 日本語
  • Español
  • Català
  • Ελληνικά
  • Português
  • italiano
  • Türkçe
  • Русский
  • Nederlands
  • hrvatski jezik
  • język polski
  • Українська
  • हिन्दी
  • svenska
  • Esperanto
  • dansk

Documents

Help & Tutorial

How to use Book mode

Slide Example

API Docs

Edit in VSCode

Install browser extension

Contacts

Feedback

Discord

Send us email

Resources

Releases

Pricing

Blog

Policy

Terms

Privacy

Cheatsheet

Syntax Example Reference
# Header Header 基本排版
- Unordered List
  • Unordered List
1. Ordered List
  1. Ordered List
- [ ] Todo List
  • Todo List
> Blockquote
Blockquote
**Bold font** Bold font
*Italics font* Italics font
~~Strikethrough~~ Strikethrough
19^th^ 19th
H~2~O H2O
++Inserted text++ Inserted text
==Marked text== Marked text
[link text](https:// "title") Link
![image alt](https:// "title") Image
`Code` Code 在筆記中貼入程式碼
```javascript
var i = 0;
```
var i = 0;
:smile: :smile: Emoji list
{%youtube youtube_id %} Externals
$L^aT_eX$ LaTeX
:::info
This is a alert area.
:::

This is a alert area.

Versions and GitHub Sync
Get Full History Access

  • Edit version name
  • Delete

revision author avatar     named on  

More Less

Note content is identical to the latest version.
Compare
    Choose a version
    No search result
    Version not found
Sign in to link this note to GitHub
Learn more
This note is not linked with GitHub
 

Feedback

Submission failed, please try again

Thanks for your support.

On a scale of 0-10, how likely is it that you would recommend HackMD to your friends, family or business associates?

Please give us some advice and help us improve HackMD.

 

Thanks for your feedback

Remove version name

Do you want to remove this version name and description?

Transfer ownership

Transfer to
    Warning: is a public team. If you transfer note to this team, everyone on the web can find and read this note.

      Link with GitHub

      Please authorize HackMD on GitHub
      • Please sign in to GitHub and install the HackMD app on your GitHub repo.
      • HackMD links with GitHub through a GitHub App. You can choose which repo to install our App.
      Learn more  Sign in to GitHub

      Push the note to GitHub Push to GitHub Pull a file from GitHub

        Authorize again
       

      Choose which file to push to

      Select repo
      Refresh Authorize more repos
      Select branch
      Select file
      Select branch
      Choose version(s) to push
      • Save a new version and push
      • Choose from existing versions
      Include title and tags
      Available push count

      Pull from GitHub

       
      File from GitHub
      File from HackMD

      GitHub Link Settings

      File linked

      Linked by
      File path
      Last synced branch
      Available push count

      Danger Zone

      Unlink
      You will no longer receive notification when GitHub file changes after unlink.

      Syncing

      Push failed

      Push successfully