SQL(Structured Query Language)
SQL은 관계형 데이터배이스 카테고리에 속하는 제품들이 공통적으로 데이터배이스 서버를 제어할 때 사용하는 표준화된 언어이다.
테이블의 구조
실습
sudo mysql -uroot -p
USE db1;
CREATE TABLE topic(
id INT(11) NOT NULL AUTO_INCREMENT,
title VARCHAR(100) NOT NULL,
description TEXT NULL,
created DATETIME NULL,
author VARCHAR(30) NULL,
profile VARCHAR(100) NULL,
PRIMARY KEY(id));
더보기
Data Type
Numeric
TINYINT
A very small integer
SMALLINT
A small integer
MEDIUMINT
A medium-sized integer
INT
A standard integer
BIGINT
A large integer
DECIMAL
A fixed-point number
FLOAT
A single-precision floating point number
DOUBLE
A double-precision floating point number
BIT
A bit field
String
CHAR
A fixed-length nonbinary (character) string
VARCHAR
A variable-length non-binary string
BINARY
A fixed-length binary string
VARBINARY
A variable-length binary string
TINYBLOB
A very small BLOB (binary large object)
BLOB
A small BLOB
MEDIUMBLOB
A medium-sized BLOB
LONGBLOB
A large BLOB
TINYTEXT
A very small non-binary string
TEXT
A small non-binary string
MEDIUMTEXT
A medium-sized non-binary string
LONGTEXT
A large non-binary string
ENUM
An enumeration; each column value may be assigned one enumeration member
SET
A set; each column value may be assigned zero or more SET members
Date
DATE
A date value in CCYY-MM-DD format
TIME
A time value in hh:mm:ss format
DATETIME
A date and time value inCCYY-MM-DD hh:mm:ssformat
TIMESTAMP
A timestamp value in CCYY-MM-DD hh:mm:ss format
YEAR
A year value in CCYY or YY format
Spatial data types
GEOMETRY
A spatial value of any type
POINT
A point (a pair of X-Y coordinates)
LINESTRING
A curve (one or more POINT values)
POLYGON
A polygon
GEOMETRYCOLLECTION
A collection of GEOMETRYvalues
MULTILINESTRING
A collection of LINESTRINGvalues
MULTIPOINT
A collection of POINTvalues
MULTIPOLYGON
A collection of POLYGONvalues