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

About Me

  • GitHub
  • Instagram
  • Gmail

인기 글

  • 분류 전체보기 (70)
    • 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

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

LimePencil's Log

Development/SQL

[SQL 배우기] Section 6. Advanced SQL Commands

2024. 3. 12. 01:02

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

 

Types of time information:

  • TIME: time
  • DATE: date
  • TIMESTAMP: time, date
  • TIMESTAMPTZ: date, time, and timezone

 

The time information cannot be added although it can be removed

 

SHOW ALL: shows all the metadata related to the database

 

can show other details by using other functions such as:

  • SHOW TIMEZONE
  • SELECT NOW()
  • SELECT TIMEOFDAY()
  • SELECT CURRENT_TIME
  • SELECT CURRENT_DATE

 

EXTRACT(): allows the user to obtain a sub-component of a date value

  • EXTRACT(YEAR FROM date_col)

 

AGE(): calculates and returns the current age given a timestamp

  • AGE(date_col)

 

TO_CHAR(): function to convert data types to text

  • TO_CHAR(date_col,’mm-dd-yyyy’)
  • PostgreSQL: Documentation: 12: 9.8. Data Type Formatting Functions

 

Mathematical functions and operators:

  • can be used to perform mathematical operations on columns
  • PostgreSQL: Documentation: 9.5: Mathematical Functions and Operators

 

String functions and operators:

  • can perform manipulations on strings
  • PostgreSQL: Documentation: 9.1: String Functions and Operators

 

Subquery: can construct complex queries, by performing a query on the result of another query

  • involves two SELECT statement
  • involves parentheses that contain a SELECT statement
  • EXISTS: used to test for the existence of rows in a subquery
    • SELECT column_name FROM table_name WHERE EXISTS (SELECT column_name FROM table_name WHERE condition)

 

Self-join: joining within the same table as if the tables are different

  • SELECT tableA.col, tableB.col FROM table AS tableA JOIN table AS tableB ON tableA.some_col = tableB.other_col
  • requires the use of an alias

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

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

    티스토리툴바