연두색연필
LimePencil's Log
연두색연필
전체 방문자
오늘
어제

About Me

  • GitHub
  • Instagram
  • Gmail

인기 글

  • 분류 전체보기 (69)
    • Machine Learning (3)
      • MNIST (2)
    • PS & Algorithm (9)
    • Web (4)
      • HTML (1)
      • JavaScript (3)
    • Rust (2)
      • The Rust Programming Langua.. (2)
    • 논문 리뷰 (12)
      • Reinforcement Learning (10)
      • Computer Vision (2)
    • DevOps (17)
      • Docker (9)
      • Kubernetes (8)
    • Development (6)
      • SQL (6)
    • 잡다한 것들 (15)
      • 부스트캠프 AI Tech 4기 (13)

최근 댓글

Tag

  • 쿠버네티스
  • K8s
  • 백준
  • 도커
  • docker
  • Kubernetes
  • SQL
  • 부스트캠프
  • Python
  • 파이썬
05-09 07:05
hELLO · Designed By 정상우.
연두색연필

LimePencil's Log

Development/SQL

[SQL 배우기] Section 2. SQL Statement Fundamentals

2024. 3. 12. 00:56

The Complete SQL Bootcamp for the Manipulation and Analysis of Data | Udemy

 

SELECT: most common statement used to retrieve information from a table

  • SELECT column_name FROM table_name
    • using * instead of the column name retrieves all the columns
    • separate column names by a comma for multiple columns
  • using capital letters for SQL keywords helps with visualization

 

SELECT DISTINCT: used to return distinct values in columns

  • SELECT DISTINCT column_name FROM table_name
    • parenthesis can be used around column name for better clarity

 

COUNT: returns the number of input rows that match a specific condition of a query

  • SELECT COUNT (column_name/results) FROM table_name;
    • needs parenthesis
  • SELECT COUNT(*) FROM table_name
    • returns the number of rows in a table
  • more useful when used with keywords like DISTINCT

 

SELECT WHERE: allows to specify conditions on columns for the rows to be returned (filtering

  • SELECT column_names FROM table_names WHERE conditions
  • Comparison operators
    • =,>,<,>=,<=, (<> or !=)
  • Logical operators
    • AND, OR, NOT

 

ORDER BY: sort rows based on a column value (ascending or descending)

  • SELECT columns FROM table ORDER BY columns ASC/DESC

 

LIMIT: limit the number of rows returned for a query

  • LIMIT num_of_rows
  • only viewing a few rows to get an idea of the table
  • useful with ORDER BY
  • goes to the end of the query

 

BETWEEN: used to match a value against a range of values

  • value BETWEEN low AND high
    • inclusive
    • can be used with dates when it is in YYYY-MM-DD format

 

IN: creates a condition to check if a value is included in a list of options

  • value IN (option1, option2, option3, option_n)

 

LIKE: pattern matching with string data using wildcard characters

  • %
    • matches any sequence of characters
    • putting % in the back of the character is looking for matching in the beginning, and vice versa
  • _
    • matches any single character (replacing a single character)
    • can use multiple underscores

 

ILIKE: case-insensitive version of LIKE

'Development > SQL' 카테고리의 다른 글

[SQL 배우기] Section 8. Creating Databases and Tables  (1) 2024.03.12
[SQL 배우기] Section 6. Advanced SQL Commands  (0) 2024.03.12
[SQL 배우기] Section 5. JOINS  (0) 2024.03.12
[SQL 배우기] Section 3. GROUP BY Statements  (0) 2024.03.12
[SQL 배우기] Section 1. Course Introduction  (0) 2024.03.12
    'Development/SQL' 카테고리의 다른 글
    • [SQL 배우기] Section 6. Advanced SQL Commands
    • [SQL 배우기] Section 5. JOINS
    • [SQL 배우기] Section 3. GROUP BY Statements
    • [SQL 배우기] Section 1. Course Introduction
    연두색연필
    연두색연필
    ML, Programming, PS, 삶의 순간을 기록

    티스토리툴바