'2016/11/16'에 해당되는 글 2건

  1. 2016.11.16 [cassandra] insert는 update와 같다.
  2. 2016.11.16 [mysql] alter table after 필드

cassandra는 insert는 update이다.



예시는 다음과 같다. 


cqlsh> insert into google.relation(id, profile_id) values (1, 1) 


 followee_id | profile_id

-------------+------------

           1 |          1


cqlsh> insert into google.relation(id, profile_id) values (1, 1) using ttl 20;






20초 뒤에는..확인하면, 다음과 같다.


cqlsh> select * from story.user_followee_recent_relation;


 followee_id | profile_id

-------------+------------









'cassandra' 카테고리의 다른 글

[cassadra] compaction 전략  (0) 2016.12.09
[cassandra] select count(*) 구하기  (0) 2016.12.07
[cassandra] read repair  (0) 2016.11.23
[cassandra] cqlsh 팁  (0) 2016.11.21
[cassandra] counter 테이블 예시 및 유의 사항  (0) 2016.11.17
Posted by '김용환'
,

[mysql] alter table after 필드

DB 2016. 11. 16. 10:48

테이블에서 새로운 필드를 추가하려면 아래와 비슷한 타입으로 쓴다. 


alter table tableName add column columnName not null


이 때, 맨 마지막 컬럼에 위치하게 되므로 원하는 모델이 되지 않을 수 있다.


순서를 특정 컬럼 다음에 위치하려면, after를 사용한다. 



alter table tableName add column columnName not null after preColumnName


뿐만 아니라 first도 사용할 수 있다.





자세한 내용은 http://dev.mysql.com/doc/refman/5.7/en/alter-table.html를 참고한다.


To add a column at a specific position within a table row, use FIRST or AFTER col_name. The default is to add the column last. You can also use FIRST and AFTER in CHANGE or MODIFY operations to reorder columns within a table.


'DB' 카테고리의 다른 글

[derby] validation query  (0) 2017.04.10
[mysql] auto increment 이슈  (0) 2016.12.19
[mysql] SELECT .. INTO OUTFILE  (0) 2016.04.16
[mysql] INSERT INTO .. VALUES ON DUPLICATE KEY UPDATE.. 응답 값  (0) 2016.03.31
[MySQL] GROUP_CONCAT  (0) 2016.02.15
Posted by '김용환'
,