Wednesday 18 April 2018

Data Types

INT or INTEGER - It holds whole number between -32,768 and 32,767 either it is negative or positive. It can not hold a decimal numbers. The maximum number of digits may be specified in parenthesis.

Syntax :-
 column_name INT (size);

Ex :-
 roll INT (5);


DEC or DECIMAL (size, p) - It holds fixed point numbers, size is the total number of digits and p is the number of digits after the decimal point. The decimal point and the negative sign '-' are not counted in size. If p is 0, values have no decimal point. The maximum number of size for decimal is 65 and for p 30. if p omitted the default is 0. if size is omitted, the default is 10.

Syntax :-
 column_name DECIMAL(size, p);

Ex :- 
 price DECIMAL (4,2);

CHAR or CHARACTER - It holds a fixed length string  (can contain letter, numbers, and special characters). The fixed size is specified in parenthesis. It can store up to 255haracters.

Syntax :- 
 column_name CHAR (20);

Ex :-
  name CHAR (20);

VARCHAR - It holds a variable length string (can contains letters, numbers, and special character). The maximum size is specified parenthesis. It can store up to 255 characters.
Note : If we put a greater value than 255 it will be converted to a TEXT type.

Syntax :- 
 column_name VARCHAR (size);

Ex :- 
 name VARCHAR (50);

TEXT - It holds a string with a maximum length of 65,535 characters.

Syntax :-
 column_name TEXT;

Ex :- 
 address TEXT;

DATE - It display Date values in yyyy-mm-dd format.

Syntax :-
 column_name DATE;

Ex :-
age DATE;

DATATIME - It display DATETIME values in yyyy-mm-dd  hh:mm:ss format.

Syntax :- 
 column_name DATETIME;

Ex :- 
 Date_of_join DATETIME;

TIMESTAMP - It also displayes date and time.

Syntax :-
 column_name TIMESTAMP;

Ex :- 
 login_dt TIMESTAMP;






0 Comments:

Post a Comment

Popular Posts

Categories

AI (31) Android (24) AngularJS (1) Assembly Language (2) aws (17) Azure (7) BI (10) book (4) Books (146) C (77) C# (12) C++ (82) Course (67) Coursera (195) Cybersecurity (24) data management (11) Data Science (106) Data Strucures (8) Deep Learning (11) Django (14) Downloads (3) edx (2) Engineering (14) Excel (13) Factorial (1) Finance (6) flask (3) flutter (1) FPL (17) Google (20) Hadoop (3) HTML&CSS (47) IBM (25) IoT (1) IS (25) Java (93) Leet Code (4) Machine Learning (46) Meta (18) MICHIGAN (5) microsoft (4) Pandas (3) PHP (20) Projects (29) Python (876) Python Coding Challenge (281) Questions (2) R (70) React (6) Scripting (1) security (3) Selenium Webdriver (2) Software (17) SQL (42) UX Research (1) web application (8)

Followers

Person climbing a staircase. Learn Data Science from Scratch: online program with 21 courses