life is egg

23.01.10 [SQL 2일차] 본문

TIL

23.01.10 [SQL 2일차]

삶은계란진재혁 2023. 1. 11. 00:58

과제및...NBC

 강의자료에 있는 파일이 다운이 안되고 인터넷창에서 켜지길래

따로 창켜진곳에서 오른쪽클릭해서 다른이름으로 저장하고 그러면 메모장파일로 저장됨..

그런뒤 메모장 파일열고 거기서 다른이름으로 저장하고 저장할때 txt말고 모든파일형식 하고 .sql 붙여주면 MySQL 워크벤치에서 불러서 사용가능함..

첫날배운거 다까먹었지만 그래도 복습하다보면 익숙해 지겠지...

 

SQL 2일차다 인설트문이랑 업데이트 델리트 배웠다 

더보기
create table users (id int, name char(35), age int);
desc users;

select * from users;

insert into users (id, name,age) values(1,'벨라',25); -- 적은순서를 맞춰줘서 values값을 적어주면됨  --열이름을 안적으면 순서대로 넣어야함


drop table users;

create table users (id int auto_increment primary key, name char(35), age int);

insert into users values(null,'벨라',25); 
insert into users (name,age) values('재혁',28); 

desc world.city;
select count(*) 총개수 from world.city;

create table my_city (city_name char(35), population int) ;

insert into my_city select null, name, population from world.city;

select*from my_city;

use market_db;

create table my_city (id int auto_increment primary key,city_name char(35), population int) ;

desc my_city; --  테이블 자체를 삭제 

truncate table my_city; -- 내용만삭제

--   인서트문은 여기까지고 -- 

-- 업데이트문    -- 

update my_city set city_name = '서울' where city_name = 'seoul';

select * from my_city where city_name = 'seoul';

select * from my_city where city_name = '서울';

-- 데이터 삭제  drop truncate--

delete from my_city where city_name like 'New%';

코테

약수구하는거... n/2하는걸 배웠다 .. ! 그니까 더 메모리? 절약이 가능하다 ..        

 


개인공부 -1

 

 

 


개인공부-2

'TIL' 카테고리의 다른 글

23.01.12 [SQL4일차]  (0) 2023.01.13
23.01.12 [SQL 3일차]  (1) 2023.01.12
23.01.09 [SQL]  (0) 2023.01.09
23.01.06 [KTP회고 및 발표]  (0) 2023.01.06
23.01.05 [예외처리 탐구..]  (0) 2023.01.05
Comments