Skip to content

Added sql-data-types.md in SQL under docs #4078

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jul 30, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
55 changes: 55 additions & 0 deletions docs/DBMS/Structured Query Language/sql-data-types.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
---
id: sql-data-types
title: DBMS - SQL data-types
sidebar_label: Data-Types
sidebar_position: 5
description: SQL data-types
tags:
- DBMS
- SQL
- Data Types
---

## Introduction:
Varios datatypes are supported in SQL. They include numeric data types, string data types and date and time.

## Numeric data types

1. int- <br /> For integer data.
eg:
```sql
create table temp(
age int
);
```
2. tinyint- <br />For very small values.
3. smallint- <br />For small values.
4. mediumint- <br /> For medium vakues.
5. bigint- <br /> Upto 20 digits.
6. float- <br /> Used for decimals. It has 2 arguments, length and the number of digits after decimals.
eg:
```sql
create table temp(
cash float(10,2)
);
```
7. double- <br /> Similar to float but can denote much larger numbers.


## String data types

1. char- <br /> Used if the length of string is fixed. Has an argument, the length.
2. varchar- <br /> Used for variable length strings. It also has an argument, the maximum possible length.
eg:
```sql
create table temp(
name varchar(50)
);
```

## Date and Time

1. date
2. time
3. datetime
4. timestamnp
Loading