TABLE 생성

-- table create
create table sales.promotions(
	promotion_id int primary key IDENTITY (1,1),
	promotion_name varchar (255) not null,
	discount numeric (3,2) default 0,
	start_date date not null,
	expired_date date not null
);

Database 확인

select DB_NAME();

image.png

Table 삭제

drop table promotions;

Data 삽입

INSERT INTO PROMOTIONS(
    PROMOTION_NAME
)
VALUES(
    '2025 SUMMER PROMOTION'
);

Data 확인

select * from production.brands; -- table name
use F_Test;
-- 한줄로 처리가 가능하나, 가독성을 위해 한줄로 쓰는 것을 추천
select employee_id, employee_name, birth_date From staff;

image.png

Column name 변경

select employee_id, birth_date AS '생년월일'
from staff;

image.png

중복 값 제거 후 출력

-- Distinct 중복값 제거
select distinct gender from staff;