SQL 연습문제 2-1

상품정보(products) 테이블에서 5개 레코드만 조회하세요.

select *
from `thelook_ecommerce.products`
limit 5;

SQL 연습문제 2-2

회원(users) 테이블에서 이메일 주소(email) 20개를 조회하세요.

select email
from `thelook_ecommerce.users`
limit 20;

SQL 연습문제 2-3

주문정보(orders) 테이블에서 상태정보(status)를 중복제거하여 아래와 같이 결과가 나오도록 조회하세요.

select distinct status
FROM `thelook_ecommerce.orders`

SQL 연습문제 2-4

상품정보(products) 테이블에서 카테고리(category)를 중복제거하여 아래와 같이 조회하세요.

select distinct category
from `thelook_ecommerce.products`

SQL 연습문제 2-5

상품정보(products) 테이블에서 카테고리(category), 브랜드(brand)를 중복제거하여 30개 조회하세요.

각 결과 컬럼의 이름은 다음과 같이 지정하세요.

select
  distinct category as product_category,
  brand as product_brand
from `thelook_ecommerce.products`
limit 30;

SQL 연습문제 2-6

상품정보(products) 테이블에서 id, 카테고리(category), 이름(name), 판매가격(retail_price), 비용(cost), 판매이익(판매가격 - 비용), 수익율을 조회하세요.