라벨이 Column인 게시물 표시

PostgreSQL Column(컬럼)의 속성을 배열로 하고 생성, 조회, 수정, 삭제하기

이미지
 postgres의 컬럼 설정에서는 배열을 넣을수가 있다.  컬럼을 생성할때 위 사진처럼 컬럼 arr을 숫자형 배열로 지정할수 있다 하나의 레코드를 삽입하면 위 사진처럼 id및 arr이 배열로 저장되게 된다. 이때 동일한 배열을 찾을때 WHERE을 이용하여 찾는다. 하지만 모든 배열을 아는것이 아니면 위방법으로 레코드를 조회할수 없다. arr을 텍스트로 변환한 다음 LIKE을 이용하여 조회를 해야 합낟. 이때 arr은 배열에서 문자열로 조회할때만 전환된다. 문자열 배열또한 만들수 있다. 문자열 배열또한 생성, 수정 삭제, 조회가 가능하며 LIKE을 사용할려면 조회할 배열을 text로 변환후 확인해야 한다.

DB mysql Basic Query - Add, Delete Data from Table, Delete Table

이미지
 OS : Ubuntu Add Record in Table -> INSERT INTO [table name](name : column1, column2, .....)      VALUES(value1, value2, ....);     Delete Record in Table -> DELETE FROM [table name] WHERE [column name] = '[element]'; Delete Table -> DROP TABLE [table name]; Priveous Link

DB mysql Basic Query - CREATE(DB, Table), Add(Column), Delete(DB, Table, Column)

이미지
OS : Ubuntu Start mysql - sudo mysql Shows the current DB - SHOW DATABASES; Create DataBase -> CREATE DATABASE [DB name]; Delete DB -> DROP DATABASE [DB name]; Warning: If you delete the DB, the data will also be deleted. Use the DB -> USE [DB name]; Create Table -> CREATE TABLE [Table name](     [column name] INT NOT NULL AUTO_INCREMENT, -> id is primary number      [column name]  VARCHAR(255) NOT NULL,     PRIMARY KEY( [column name] )     ); INT : integer number NOT NULL : Not allow null AUTO_INCREMENT : id number will increase automatically VARCHAR : You could type string PRIMARY KEY([column name]) : Assign a Primary key Show tables -> SHOW TABLES; Add column in the existed table -> ALTER TABLE [table name]     ADD COLUMN [column name] INT AFTER [existed column name]; -> 'age' is what you want to add ALTER TABLE [table name] : Update table ADD COLUMN : Add column AFTER name : column 'name' is already ...