[01.10] 내일배움캠프[Spring] TIL-50
1. SQL
Id - Auto_InCrement
Create Table users(
id int auto_increment primary key,
name char(35),
age int
);
INSERT INTO users values(null,"park","25");
INSERT INTO users values(null,"kim","30");
INSERT INTO users (name,age) values("Lee","77");
desc users;
DB 여러종류?
select * from world.city;
select count(*) '총 개수' FROM world.city;
다른 Table Data를 내가 만든 Table로 가져오기
Create table my_city (
city_name char(35),
population int
);
insert into my_city select name,population from world.city;
삭제구문
DROP TABLE users;
TRUNCATE TABLE users;
DELETE from my_city where city_name = "서울";
DELETE from my_city where city_name = "New%";
업데이트 구문
update my_city set city_name = "서울" where city_name = "Seoul";
2. 코딩 테스트