Basic Tools of SQL 1-1

Sungju Kim·2024년 7월 3일

What is SQL?

  • It's a language used to talk to the database.
  • You send queries to get the data you want

Basic commands: Select,From,*

  • select: used to call any and all data in SQL
  • from: specifies the data table we plan to get from the query
  • *: indicates we are getting all
  • the code below calls all the columns from food orders data base/table
select *
from food_orders

Getting specific columns only

select restaurant_name, addr
from food_orders

How to give temporary “alias” to columns/variables

  • Method1: using double quotes
  • Method2: simply writing it after a space
select restaurant_name as "음식점", addr address
from food_orders
  • For non-English alias, you need to use the double quotes method
  • ‘as’ is optional

Filtering using WHERE

select *
from food_orders fo
where cuisine_type='Korean'
  • Result
  • You can use 'and' to add further filters!
select *
from food_orders fo
where cuisine_type='Korean' and quantity>=3

profile
Fully ✨committed✨ developer, always eager to learn!

0개의 댓글