yekang

use/create/select/insert/delete/update 본문

빅데이터/SQL

use/create/select/insert/delete/update

예캉 2017. 7. 14. 16:31




use pnudb; # pnudb를 사용하겠다.

select count(*) from gisa1; # gisa1의 개수를 count한값을 보인다.


create table test( # test 테이블을 작성한다.

    id varchar(20) not null,

    pw varchar(8) not null,

    user_name varchar(30) not null # 마지막은 ','를 찍지않는다.

);


select * from test; # test 테이블을 보여라!

desc test; # test테이블의 field type null default 등을 보여준다.(id / varchar(20) /NO/NULL)


insert into test(id,pw,user_name) values ('admin','1234','kim'); # test table에 값을 추가한다.

insert into test(id,pw,user_name) values ('dev','1234','lee');

insert into test(id,pw,user_name) values ('tester','1234','choi');

insert into test(id,pw,user_name) values ('user1','1234','ahn');

insert into test(id,pw,user_name) values ('user2','1234','park');



delete from test where id='admin'; # test table 에서 id가 admin인건 다지운다.

update test set pw='2345' where id='admin'; # id가 admin인 값에 대해서 비밀번호를 2345로 수정한다.



'빅데이터 > SQL' 카테고리의 다른 글

관계형데이터베이스와 SELECT문  (0) 2017.12.27
SQL 처리 단계  (0) 2017.12.27
프로그램이 패러다임과 SQL  (0) 2017.12.27
데이터베이스/ csv 파일 불러와서 데이터 다뤄보기  (1) 2017.07.14
데이터베이스  (0) 2017.07.13
Comments