본문 바로가기
SQL

02 SQL: Basics_Writing Queries (3)

by treethicket 2023. 2. 11.

(source: Codecademy, https://www.codecademy.com)

LIMIT : specify the maximum number of rows the result set will have


CASE : create different outputs (usually in the SELECT statement)

  • Each WHEN tests a condition and the following THEN gives us the string if the condition is true
  • The ELSE gives us the string if all the above conditions are false
  • The CASE statement must end with END
  • Rename the whole CASE statement to ‘Mood’ using AS




Let’s summarize:

  • SELECT is the clause we use every time we want to query information from a database.
  • AS renames a column or table.
  • DISTINCT return unique values.
  • WHERE is a popular command that lets you filter the results of the query based on conditions that you specify.
  • LIKE and BETWEEN are special operators.
  • AND and OR combines multiple conditions.
  • ORDER BY sorts the result.
  • LIMIT specifies the maximum number of rows that the query will return.
  • CASE creates different outputs.

'SQL' 카테고리의 다른 글

03 SQL: Intermediate_Aggregate Functions Projects and Applications  (0) 2023.02.12
02 SQL: Basics_Writing Queries (2)  (0) 2023.02.10
02 SQL: Basics_Writing Queries (1)  (0) 2023.02.05
01 Introduction to SQL  (0) 2023.02.04

댓글