File tree 1 file changed +55
-0
lines changed
docs/DBMS/Structured Query Language
1 file changed +55
-0
lines changed Original file line number Diff line number Diff line change
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
You can’t perform that action at this time.
0 commit comments