Skip to content

Commit ba49127

Browse files
authored
Merge pull request #4078 from Apoorva-Atre/mybranch
Added sql-data-types.md in SQL under docs
2 parents 23c2bad + eb33226 commit ba49127

File tree

1 file changed

+55
-0
lines changed

1 file changed

+55
-0
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,55 @@
1+
---
2+
id: sql-data-types
3+
title: DBMS - SQL data-types
4+
sidebar_label: Data-Types
5+
sidebar_position: 5
6+
description: SQL data-types
7+
tags:
8+
- DBMS
9+
- SQL
10+
- Data Types
11+
---
12+
13+
## Introduction:
14+
Varios datatypes are supported in SQL. They include numeric data types, string data types and date and time.
15+
16+
## Numeric data types
17+
18+
1. int- <br /> For integer data.
19+
eg:
20+
```sql
21+
create table temp(
22+
age int
23+
);
24+
```
25+
2. tinyint- <br />For very small values.
26+
3. smallint- <br />For small values.
27+
4. mediumint- <br /> For medium vakues.
28+
5. bigint- <br /> Upto 20 digits.
29+
6. float- <br /> Used for decimals. It has 2 arguments, length and the number of digits after decimals.
30+
eg:
31+
```sql
32+
create table temp(
33+
cash float(10,2)
34+
);
35+
```
36+
7. double- <br /> Similar to float but can denote much larger numbers.
37+
38+
39+
## String data types
40+
41+
1. char- <br /> Used if the length of string is fixed. Has an argument, the length.
42+
2. varchar- <br /> Used for variable length strings. It also has an argument, the maximum possible length.
43+
eg:
44+
```sql
45+
create table temp(
46+
name varchar(50)
47+
);
48+
```
49+
50+
## Date and Time
51+
52+
1. date
53+
2. time
54+
3. datetime
55+
4. timestamnp

0 commit comments

Comments
 (0)