Creating Database

CREATE DATABASE <database_name>;

Creating Table

CREATE TABLE <table_name> (
    <column1> <datatype>,
    <column2> <datatype>,
    <column3> <datatype>
);

DataTyps

  1. Numeric Types
Data TypeDescriptionExample
INT / INTEGERWhole numbers10, 25
BIGINTLarge numbers999999999
DECIMAL(p,s)Exact decimal numbers10.50
NUMERICSame as DECIMAL99.99
SERIALAuto-increment integer1, 2, 3
  1. Character (Text) Types
Data TypeDescription
VARCHAR(n)Limited text (max n characters)
TEXTUnlimited text
CHAR(n)Fixed-length text
  1. Date & Time Types ⏰